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@5.7.0/lib/cjs/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/@cycle/run@5.7.0/lib/cjs/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar internals_1 = require(\"./internals\");\n/**\n * A function that prepares the Cycle application to be executed. Takes a `main`\n * function and prepares to circularly connects it to the given collection of\n * driver functions. As an output, `setup()` returns an object with three\n * properties: `sources`, `sinks` and `run`. Only when `run()` is called will\n * the application actually execute. Refer to the documentation of `run()` for\n * more details.\n *\n * **Example:**\n * ```js\n * import {setup} from '@cycle/run';\n * const {sources, sinks, run} = setup(main, drivers);\n * // ...\n * const dispose = run(); // Executes the application\n * // ...\n * dispose();\n * ```\n *\n * @param {Function} main a function that takes `sources` as input and outputs\n * `sinks`.\n * @param {Object} drivers an object where keys are driver names and values\n * are driver functions.\n * @return {Object} an object with three properties: `sources`, `sinks` and\n * `run`. `sources` is the collection of driver sources, `sinks` is the\n * collection of driver sinks, these can be used for debugging or testing. `run`\n * is the function that once called will execute the application.\n * @function setup\n */\nfunction setup(main, drivers) {\n    if (typeof main !== \"function\") {\n        throw new Error(\"First argument given to Cycle must be the 'main' \" + \"function.\");\n    }\n    if (typeof drivers !== \"object\" || drivers === null) {\n        throw new Error(\"Second argument given to Cycle must be an object \" +\n            \"with driver functions as properties.\");\n    }\n    if (internals_1.isObjectEmpty(drivers)) {\n        throw new Error(\"Second argument given to Cycle must be an object \" +\n            \"with at least one driver function declared as a property.\");\n    }\n    var engine = setupReusable(drivers);\n    var sinks = main(engine.sources);\n    if (typeof window !== 'undefined') {\n        window.Cyclejs = window.Cyclejs || {};\n        window.Cyclejs.sinks = sinks;\n    }\n    function _run() {\n        var disposeRun = engine.run(sinks);\n        return function dispose() {\n            disposeRun();\n            engine.dispose();\n        };\n    }\n    return { sinks: sinks, sources: engine.sources, run: _run };\n}\nexports.setup = setup;\n/**\n * A partially-applied variant of setup() which accepts only the drivers, and\n * allows many `main` functions to execute and reuse this same set of drivers.\n *\n * Takes an object with driver functions as input, and outputs an object which\n * contains the generated sources (from those drivers) and a `run` function\n * (which in turn expects sinks as argument). This `run` function can be called\n * multiple times with different arguments, and it will reuse the drivers that\n * were passed to `setupReusable`.\n *\n * **Example:**\n * ```js\n * import {setupReusable} from '@cycle/run';\n * const {sources, run, dispose} = setupReusable(drivers);\n * // ...\n * const sinks = main(sources);\n * const disposeRun = run(sinks);\n * // ...\n * disposeRun();\n * // ...\n * dispose(); // ends the reusability of drivers\n * ```\n *\n * @param {Object} drivers an object where keys are driver names and values\n * are driver functions.\n * @return {Object} an object with three properties: `sources`, `run` and\n * `dispose`. `sources` is the collection of driver sources, `run` is the\n * function that once called with 'sinks' as argument, will execute the\n * application, tying together sources with sinks. `dispose` terminates the\n * reusable resources used by the drivers. Note also that `run` returns a\n * dispose function which terminates resources that are specific (not reusable)\n * to that run.\n * @function setupReusable\n */\nfunction setupReusable(drivers) {\n    if (typeof drivers !== \"object\" || drivers === null) {\n        throw new Error(\"Argument given to setupReusable must be an object \" +\n            \"with driver functions as properties.\");\n    }\n    if (internals_1.isObjectEmpty(drivers)) {\n        throw new Error(\"Argument given to setupReusable must be an object \" +\n            \"with at least one driver function declared as a property.\");\n    }\n    var sinkProxies = internals_1.makeSinkProxies(drivers);\n    var rawSources = internals_1.callDrivers(drivers, sinkProxies);\n    var sources = internals_1.adaptSources(rawSources);\n    function _run(sinks) {\n        return internals_1.replicateMany(sinks, sinkProxies);\n    }\n    function disposeEngine() {\n        internals_1.disposeSources(sources);\n        internals_1.disposeSinkProxies(sinkProxies);\n    }\n    return { sources: sources, run: _run, dispose: disposeEngine };\n}\nexports.setupReusable = setupReusable;\n/**\n * Takes a `main` function and circularly connects it to the given collection\n * of driver functions.\n *\n * **Example:**\n * ```js\n * import run from '@cycle/run';\n * const dispose = run(main, drivers);\n * // ...\n * dispose();\n * ```\n *\n * The `main` function expects a collection of \"source\" streams (returned from\n * drivers) as input, and should return a collection of \"sink\" streams (to be\n * given to drivers). A \"collection of streams\" is a JavaScript object where\n * keys match the driver names registered by the `drivers` object, and values\n * are the streams. Refer to the documentation of each driver to see more\n * details on what types of sources it outputs and sinks it receives.\n *\n * @param {Function} main a function that takes `sources` as input and outputs\n * `sinks`.\n * @param {Object} drivers an object where keys are driver names and values\n * are driver functions.\n * @return {Function} a dispose function, used to terminate the execution of the\n * Cycle.js program, cleaning up resources used.\n * @function run\n */\nfunction run(main, drivers) {\n    var program = setup(main, drivers);\n    if (typeof window !== 'undefined' &&\n        window.CyclejsDevTool_startGraphSerializer) {\n        window.CyclejsDevTool_startGraphSerializer(program.sinks);\n    }\n    return program.run();\n}\nexports.run = run;\nexports.default = run;\n"]}