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B,KAAcgB,GACpBhB,EAAW,WAAaU,IAC3BV,EAAW,GAAG,EAIlB,CAEO,SAASiB,GAAQrG,EAAgCJ,EAAgB,CACvE,OAAQI,EAAO,EAAIkF,KAAe,CACnC,CAMO,SAASoB,GAAYtG,EAAQuG,EAAU,CAC7C,GAAKvG,EAAO,MAMZ,QAHIsF,EAAOtF,EAAO,MAAM,MACpBuF,EAAMvF,EAAO,MAAM,IAEhBsF,IAAS,MAAM,CAErB,IAAIV,EAAOU,IAASC,EAAM,KAAOtG,EAAiBqG,CAAI,EAEtDiB,EAAS,OAAOjB,CAAI,EACpBA,EAAOV,CACR,CACD","names":["is_dirty","active_effect","active_reaction","update_effect","get","is_destroying_effect","remove_reactions","set_active_reaction","set_is_destroying_effect","set_signal_status","untrack","untracking","DIRTY","BRANCH_EFFECT","RENDER_EFFECT","EFFECT","DESTROYED","INERT","EFFECT_RAN","BLOCK_EFFECT","ROOT_EFFECT","EFFECT_TRANSPARENT","DERIVED","CLEAN","EAGER_EFFECT","HEAD_EFFECT","MAYBE_DIRTY","EFFECT_PRESERVED","STALE_REACTION","USER_EFFECT","ASYNC","CONNECTED","MANAGED_EFFECT","e","o","define_property","get_next_sibling","component_context","dev_current_component_function","dev_stack","Batch","current_batch","schedule_effect","flatten","without_reactive_context","validate_effect","rune","active_effect","active_reaction","is_destroying_effect","push_effect","effect","parent_effect","parent_last","create_effect","type","fn","sync","parent","o","EAGER_EFFECT","INERT","DIRTY","CONNECTED","update_effect","EFFECT_RAN","e","destroy_effect","EFFECT_PRESERVED","BLOCK_EFFECT","EFFECT_TRANSPARENT","DERIVED","ROOT_EFFECT","derived","effect_tracking","untracking","teardown","RENDER_EFFECT","set_signal_status","CLEAN","user_effect","flags","defer","BRANCH_EFFECT","context","create_user_effect","EFFECT","USER_EFFECT","user_pre_effect","eager_effect","effect_root","component_root","options","fulfil","pause_effect","legacy_pre_effect","deps","token","render_effect","untrack","legacy_pre_effect_reset","MAYBE_DIRTY","is_dirty","async_effect","ASYNC","template_effect","async","blockers","values","get","deferred_template_effect","batch","is_async","block","managed","MANAGED_EFFECT","branch","execute_effect_teardown","previously_destroying_effect","previous_reaction","set_is_destroying_effect","set_active_reaction","destroy_effect_children","signal","remove_dom","controller","STALE_REACTION","next","destroy_block_effect_children","removed","HEAD_EFFECT","remove_effect_dom","remove_reactions","DESTROYED","transitions","transition","unlink_effect","node","end","prev","callback","destroy","pause_children","remaining","check","local","child","sibling","transparent","resume_effect","resume_children","t","aborted","move_effect","fragment"],"sources":["../esm/npm/svelte@5.45.5/node_modules/svelte/src/internal/client/reactivity/effects.js","npm-replacement:esm-env"],"sourcesContent":["/** @import { ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */\nimport {\n\tis_dirty,\n\tactive_effect,\n\tactive_reaction,\n\tupdate_effect,\n\tget,\n\tis_destroying_effect,\n\tremove_reactions,\n\tset_active_reaction,\n\tset_is_destroying_effect,\n\tset_signal_status,\n\tuntrack,\n\tuntracking\n} from '../runtime.js';\nimport {\n\tDIRTY,\n\tBRANCH_EFFECT,\n\tRENDER_EFFECT,\n\tEFFECT,\n\tDESTROYED,\n\tINERT,\n\tEFFECT_RAN,\n\tBLOCK_EFFECT,\n\tROOT_EFFECT,\n\tEFFECT_TRANSPARENT,\n\tDERIVED,\n\tCLEAN,\n\tEAGER_EFFECT,\n\tHEAD_EFFECT,\n\tMAYBE_DIRTY,\n\tEFFECT_PRESERVED,\n\tSTALE_REACTION,\n\tUSER_EFFECT,\n\tASYNC,\n\tCONNECTED,\n\tMANAGED_EFFECT\n} from '#client/constants';\nimport * as e from '../errors.js';\nimport { DEV } from 'esm-env';\nimport { define_property } from '../../shared/utils.js';\nimport { get_next_sibling } from '../dom/operations.js';\nimport { component_context, dev_current_component_function, dev_stack } from '../context.js';\nimport { Batch, current_batch, schedule_effect } from './batch.js';\nimport { flatten } from './async.js';\nimport { without_reactive_context } from '../dom/elements/bindings/shared.js';\n\n/**\n * @param {'$effect' | '$effect.pre' | '$inspect'} rune\n */\nexport function validate_effect(rune) {\n\tif (active_effect === null) {\n\t\tif (active_reaction === null) {\n\t\t\te.effect_orphan(rune);\n\t\t}\n\n\t\te.effect_in_unowned_derived();\n\t}\n\n\tif (is_destroying_effect) {\n\t\te.effect_in_teardown(rune);\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect} parent_effect\n */\nfunction push_effect(effect, parent_effect) {\n\tvar parent_last = parent_effect.last;\n\tif (parent_last === null) {\n\t\tparent_effect.last = parent_effect.first = effect;\n\t} else {\n\t\tparent_last.next = effect;\n\t\teffect.prev = parent_last;\n\t\tparent_effect.last = effect;\n\t}\n}\n\n/**\n * @param {number} type\n * @param {null | (() =\u003e void | (() =\u003e void))} fn\n * @param {boolean} sync\n * @returns {Effect}\n */\nfunction create_effect(type, fn, sync) {\n\tvar parent = active_effect;\n\n\tif (DEV) {\n\t\t// Ensure the parent is never an inspect effect\n\t\twhile (parent !== null \u0026\u0026 (parent.f \u0026 EAGER_EFFECT) !== 0) {\n\t\t\tparent = parent.parent;\n\t\t}\n\t}\n\n\tif (parent !== null \u0026\u0026 (parent.f \u0026 INERT) !== 0) {\n\t\ttype |= INERT;\n\t}\n\n\t/** @type {Effect} */\n\tvar effect = {\n\t\tctx: component_context,\n\t\tdeps: null,\n\t\tnodes: null,\n\t\tf: type | DIRTY | CONNECTED,\n\t\tfirst: null,\n\t\tfn,\n\t\tlast: null,\n\t\tnext: null,\n\t\tparent,\n\t\tb: parent \u0026\u0026 parent.b,\n\t\tprev: null,\n\t\tteardown: null,\n\t\twv: 0,\n\t\tac: null\n\t};\n\n\tif (DEV) {\n\t\teffect.component_function = dev_current_component_function;\n\t}\n\n\tif (sync) {\n\t\ttry {\n\t\t\tupdate_effect(effect);\n\t\t\teffect.f |= EFFECT_RAN;\n\t\t} catch (e) {\n\t\t\tdestroy_effect(effect);\n\t\t\tthrow e;\n\t\t}\n\t} else if (fn !== null) {\n\t\tschedule_effect(effect);\n\t}\n\n\t/** @type {Effect | null} */\n\tvar e = effect;\n\n\t// if an effect has already ran and doesn't need to be kept in the tree\n\t// (because it won't re-run, has no DOM, and has no teardown etc)\n\t// then we skip it and go to its child (if any)\n\tif (\n\t\tsync \u0026\u0026\n\t\te.deps === null \u0026\u0026\n\t\te.teardown === null \u0026\u0026\n\t\te.nodes === null \u0026\u0026\n\t\te.first === e.last \u0026\u0026 // either `null`, or a singular child\n\t\t(e.f \u0026 EFFECT_PRESERVED) === 0\n\t) {\n\t\te = e.first;\n\t\tif ((type \u0026 BLOCK_EFFECT) !== 0 \u0026\u0026 (type \u0026 EFFECT_TRANSPARENT) !== 0 \u0026\u0026 e !== null) {\n\t\t\te.f |= EFFECT_TRANSPARENT;\n\t\t}\n\t}\n\n\tif (e !== null) {\n\t\te.parent = parent;\n\n\t\tif (parent !== null) {\n\t\t\tpush_effect(e, parent);\n\t\t}\n\n\t\t// if we're in a derived, add the effect there too\n\t\tif (\n\t\t\tactive_reaction !== null \u0026\u0026\n\t\t\t(active_reaction.f \u0026 DERIVED) !== 0 \u0026\u0026\n\t\t\t(type \u0026 ROOT_EFFECT) === 0\n\t\t) {\n\t\t\tvar derived = /** @type {Derived} */ (active_reaction);\n\t\t\t(derived.effects ??= []).push(e);\n\t\t}\n\t}\n\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect.tracking()`\n * @returns {boolean}\n */\nexport function effect_tracking() {\n\treturn active_reaction !== null \u0026\u0026 !untracking;\n}\n\n/**\n * @param {() =\u003e void} fn\n */\nexport function teardown(fn) {\n\tconst effect = create_effect(RENDER_EFFECT, null, false);\n\tset_signal_status(effect, CLEAN);\n\teffect.teardown = fn;\n\treturn effect;\n}\n\n/**\n * Internal representation of `$effect(...)`\n * @param {() =\u003e void | (() =\u003e void)} fn\n */\nexport function user_effect(fn) {\n\tvalidate_effect('$effect');\n\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect'\n\t\t});\n\t}\n\n\t// Non-nested `$effect(...)` in a component should be deferred\n\t// until the component is mounted\n\tvar flags = /** @type {Effect} */ (active_effect).f;\n\tvar defer = !active_reaction \u0026\u0026 (flags \u0026 BRANCH_EFFECT) !== 0 \u0026\u0026 (flags \u0026 EFFECT_RAN) === 0;\n\n\tif (defer) {\n\t\t// Top-level `$effect(...)` in an unmounted component — defer until mount\n\t\tvar context = /** @type {ComponentContext} */ (component_context);\n\t\t(context.e ??= []).push(fn);\n\t} else {\n\t\t// Everything else — create immediately\n\t\treturn create_user_effect(fn);\n\t}\n}\n\n/**\n * @param {() =\u003e void | (() =\u003e void)} fn\n */\nexport function create_user_effect(fn) {\n\treturn create_effect(EFFECT | USER_EFFECT, fn, false);\n}\n\n/**\n * Internal representation of `$effect.pre(...)`\n * @param {() =\u003e void | (() =\u003e void)} fn\n * @returns {Effect}\n */\nexport function user_pre_effect(fn) {\n\tvalidate_effect('$effect.pre');\n\tif (DEV) {\n\t\tdefine_property(fn, 'name', {\n\t\t\tvalue: '$effect.pre'\n\t\t});\n\t}\n\treturn create_effect(RENDER_EFFECT | USER_EFFECT, fn, true);\n}\n\n/** @param {() =\u003e void | (() =\u003e void)} fn */\nexport function eager_effect(fn) {\n\treturn create_effect(EAGER_EFFECT, fn, true);\n}\n\n/**\n * Internal representation of `$effect.root(...)`\n * @param {() =\u003e void | (() =\u003e void)} fn\n * @returns {() =\u003e void}\n */\nexport function effect_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn, true);\n\n\treturn () =\u003e {\n\t\tdestroy_effect(effect);\n\t};\n}\n\n/**\n * An effect root whose children can transition out\n * @param {() =\u003e void} fn\n * @returns {(options?: { outro?: boolean }) =\u003e Promise\u003cvoid\u003e}\n */\nexport function component_root(fn) {\n\tBatch.ensure();\n\tconst effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn, true);\n\n\treturn (options = {}) =\u003e {\n\t\treturn new Promise((fulfil) =\u003e {\n\t\t\tif (options.outro) {\n\t\t\t\tpause_effect(effect, () =\u003e {\n\t\t\t\t\tdestroy_effect(effect);\n\t\t\t\t\tfulfil(undefined);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdestroy_effect(effect);\n\t\t\t\tfulfil(undefined);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * @param {() =\u003e void | (() =\u003e void)} fn\n * @returns {Effect}\n */\nexport function effect(fn) {\n\treturn create_effect(EFFECT, fn, false);\n}\n\n/**\n * Internal representation of `$: ..`\n * @param {() =\u003e any} deps\n * @param {() =\u003e void | (() =\u003e void)} fn\n */\nexport function legacy_pre_effect(deps, fn) {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\t/** @type {{ effect: null | Effect, ran: boolean, deps: () =\u003e any }} */\n\tvar token = { effect: null, ran: false, deps };\n\n\tcontext.l.$.push(token);\n\n\ttoken.effect = render_effect(() =\u003e {\n\t\tdeps();\n\n\t\t// If this legacy pre effect has already run before the end of the reset, then\n\t\t// bail out to emulate the same behavior.\n\t\tif (token.ran) return;\n\n\t\ttoken.ran = true;\n\t\tuntrack(fn);\n\t});\n}\n\nexport function legacy_pre_effect_reset() {\n\tvar context = /** @type {ComponentContextLegacy} */ (component_context);\n\n\trender_effect(() =\u003e {\n\t\t// Run dirty `$:` statements\n\t\tfor (var token of context.l.$) {\n\t\t\ttoken.deps();\n\n\t\t\tvar effect = token.effect;\n\n\t\t\t// If the effect is CLEAN, then make it MAYBE_DIRTY. This ensures we traverse through\n\t\t\t// the effects dependencies and correctly ensure each dependency is up-to-date.\n\t\t\tif ((effect.f \u0026 CLEAN) !== 0) {\n\t\t\t\tset_signal_status(effect, MAYBE_DIRTY);\n\t\t\t}\n\n\t\t\tif (is_dirty(effect)) {\n\t\t\t\tupdate_effect(effect);\n\t\t\t}\n\n\t\t\ttoken.ran = false;\n\t\t}\n\t});\n}\n\n/**\n * @param {() =\u003e void | (() =\u003e void)} fn\n * @returns {Effect}\n */\nexport function async_effect(fn) {\n\treturn create_effect(ASYNC | EFFECT_PRESERVED, fn, true);\n}\n\n/**\n * @param {() =\u003e void | (() =\u003e void)} fn\n * @returns {Effect}\n */\nexport function render_effect(fn, flags = 0) {\n\treturn create_effect(RENDER_EFFECT | flags, fn, true);\n}\n\n/**\n * @param {(...expressions: any) =\u003e void | (() =\u003e void)} fn\n * @param {Array\u003c() =\u003e any\u003e} sync\n * @param {Array\u003c() =\u003e Promise\u003cany\u003e\u003e} async\n * @param {Array\u003cPromise\u003cvoid\u003e\u003e} blockers\n */\nexport function template_effect(fn, sync = [], async = [], blockers = []) {\n\tflatten(blockers, sync, async, (values) =\u003e {\n\t\tcreate_effect(RENDER_EFFECT, () =\u003e fn(...values.map(get)), true);\n\t});\n}\n\n/**\n * Like `template_effect`, but with an effect which is deferred until the batch commits\n * @param {(...expressions: any) =\u003e void | (() =\u003e void)} fn\n * @param {Array\u003c() =\u003e any\u003e} sync\n * @param {Array\u003c() =\u003e Promise\u003cany\u003e\u003e} async\n * @param {Array\u003cPromise\u003cvoid\u003e\u003e} blockers\n */\nexport function deferred_template_effect(fn, sync = [], async = [], blockers = []) {\n\tvar batch = /** @type {Batch} */ (current_batch);\n\tvar is_async = async.length \u003e 0 || blockers.length \u003e 0;\n\n\tif (is_async) batch.increment(true);\n\n\tflatten(blockers, sync, async, (values) =\u003e {\n\t\tcreate_effect(EFFECT, () =\u003e fn(...values.map(get)), false);\n\t\tif (is_async) batch.decrement(true);\n\t});\n}\n\n/**\n * @param {(() =\u003e void)} fn\n * @param {number} flags\n */\nexport function block(fn, flags = 0) {\n\tvar effect = create_effect(BLOCK_EFFECT | flags, fn, true);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() =\u003e void)} fn\n * @param {number} flags\n */\nexport function managed(fn, flags = 0) {\n\tvar effect = create_effect(MANAGED_EFFECT | flags, fn, true);\n\tif (DEV) {\n\t\teffect.dev_stack = dev_stack;\n\t}\n\treturn effect;\n}\n\n/**\n * @param {(() =\u003e void)} fn\n */\nexport function branch(fn) {\n\treturn create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn, true);\n}\n\n/**\n * @param {Effect} effect\n */\nexport function execute_effect_teardown(effect) {\n\tvar teardown = effect.teardown;\n\tif (teardown !== null) {\n\t\tconst previously_destroying_effect = is_destroying_effect;\n\t\tconst previous_reaction = active_reaction;\n\t\tset_is_destroying_effect(true);\n\t\tset_active_reaction(null);\n\t\ttry {\n\t\t\tteardown.call(null);\n\t\t} finally {\n\t\t\tset_is_destroying_effect(previously_destroying_effect);\n\t\t\tset_active_reaction(previous_reaction);\n\t\t}\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @param {boolean} remove_dom\n * @returns {void}\n */\nexport function destroy_effect_children(signal, remove_dom = false) {\n\tvar effect = signal.first;\n\tsignal.first = signal.last = null;\n\n\twhile (effect !== null) {\n\t\tconst controller = effect.ac;\n\n\t\tif (controller !== null) {\n\t\t\twithout_reactive_context(() =\u003e {\n\t\t\t\tcontroller.abort(STALE_REACTION);\n\t\t\t});\n\t\t}\n\n\t\tvar next = effect.next;\n\n\t\tif ((effect.f \u0026 ROOT_EFFECT) !== 0) {\n\t\t\t// this is now an independent root\n\t\t\teffect.parent = null;\n\t\t} else {\n\t\t\tdestroy_effect(effect, remove_dom);\n\t\t}\n\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} signal\n * @returns {void}\n */\nexport function destroy_block_effect_children(signal) {\n\tvar effect = signal.first;\n\n\twhile (effect !== null) {\n\t\tvar next = effect.next;\n\t\tif ((effect.f \u0026 BRANCH_EFFECT) === 0) {\n\t\t\tdestroy_effect(effect);\n\t\t}\n\t\teffect = next;\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} [remove_dom]\n * @returns {void}\n */\nexport function destroy_effect(effect, remove_dom = true) {\n\tvar removed = false;\n\n\tif (\n\t\t(remove_dom || (effect.f \u0026 HEAD_EFFECT) !== 0) \u0026\u0026\n\t\teffect.nodes !== null \u0026\u0026\n\t\teffect.nodes.end !== null\n\t) {\n\t\tremove_effect_dom(effect.nodes.start, /** @type {TemplateNode} */ (effect.nodes.end));\n\t\tremoved = true;\n\t}\n\n\tdestroy_effect_children(effect, remove_dom \u0026\u0026 !removed);\n\tremove_reactions(effect, 0);\n\tset_signal_status(effect, DESTROYED);\n\n\tvar transitions = effect.nodes \u0026\u0026 effect.nodes.t;\n\n\tif (transitions !== null) {\n\t\tfor (const transition of transitions) {\n\t\t\ttransition.stop();\n\t\t}\n\t}\n\n\texecute_effect_teardown(effect);\n\n\tvar parent = effect.parent;\n\n\t// If the parent doesn't have any children, then skip this work altogether\n\tif (parent !== null \u0026\u0026 parent.first !== null) {\n\t\tunlink_effect(effect);\n\t}\n\n\tif (DEV) {\n\t\teffect.component_function = null;\n\t}\n\n\t// `first` and `child` are nulled out in destroy_effect_children\n\t// we don't null out `parent` so that error propagation can work correctly\n\teffect.next =\n\t\teffect.prev =\n\t\teffect.teardown =\n\t\teffect.ctx =\n\t\teffect.deps =\n\t\teffect.fn =\n\t\teffect.nodes =\n\t\teffect.ac =\n\t\t\tnull;\n}\n\n/**\n *\n * @param {TemplateNode | null} node\n * @param {TemplateNode} end\n */\nexport function remove_effect_dom(node, end) {\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tnode.remove();\n\t\tnode = next;\n\t}\n}\n\n/**\n * Detach an effect from the effect tree, freeing up memory and\n * reducing the amount of work that happens on subsequent traversals\n * @param {Effect} effect\n */\nexport function unlink_effect(effect) {\n\tvar parent = effect.parent;\n\tvar prev = effect.prev;\n\tvar next = effect.next;\n\n\tif (prev !== null) prev.next = next;\n\tif (next !== null) next.prev = prev;\n\n\tif (parent !== null) {\n\t\tif (parent.first === effect) parent.first = next;\n\t\tif (parent.last === effect) parent.last = prev;\n\t}\n}\n\n/**\n * When a block effect is removed, we don't immediately destroy it or yank it\n * out of the DOM, because it might have transitions. Instead, we 'pause' it.\n * It stays around (in memory, and in the DOM) until outro transitions have\n * completed, and if the state change is reversed then we _resume_ it.\n * A paused effect does not update, and the DOM subtree becomes inert.\n * @param {Effect} effect\n * @param {() =\u003e void} [callback]\n * @param {boolean} [destroy]\n */\nexport function pause_effect(effect, callback, destroy = true) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\n\tpause_children(effect, transitions, true);\n\n\tvar fn = () =\u003e {\n\t\tif (destroy) destroy_effect(effect);\n\t\tif (callback) callback();\n\t};\n\n\tvar remaining = transitions.length;\n\tif (remaining \u003e 0) {\n\t\tvar check = () =\u003e --remaining || fn();\n\t\tfor (var transition of transitions) {\n\t\t\ttransition.out(check);\n\t\t}\n\t} else {\n\t\tfn();\n\t}\n}\n\n/**\n * @param {Effect} effect\n * @param {TransitionManager[]} transitions\n * @param {boolean} local\n */\nfunction pause_children(effect, transitions, local) {\n\tif ((effect.f \u0026 INERT) !== 0) return;\n\teffect.f ^= INERT;\n\n\tvar t = effect.nodes \u0026\u0026 effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransitions.push(transition);\n\t\t\t}\n\t\t}\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\t\tvar transparent =\n\t\t\t(child.f \u0026 EFFECT_TRANSPARENT) !== 0 ||\n\t\t\t// If this is a branch effect without a block effect parent,\n\t\t\t// it means the parent block effect was pruned. In that case,\n\t\t\t// transparency information was transferred to the branch effect.\n\t\t\t((child.f \u0026 BRANCH_EFFECT) !== 0 \u0026\u0026 (effect.f \u0026 BLOCK_EFFECT) !== 0);\n\t\t// TODO we don't need to call pause_children recursively with a linked list in place\n\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t// through the tree.\n\t\tpause_children(child, transitions, transparent ? local : false);\n\t\tchild = sibling;\n\t}\n}\n\n/**\n * The opposite of `pause_effect`. We call this if (for example)\n * `x` becomes falsy then truthy: `{#if x}...{/if}`\n * @param {Effect} effect\n */\nexport function resume_effect(effect) {\n\tresume_children(effect, true);\n}\n\n/**\n * @param {Effect} effect\n * @param {boolean} local\n */\nfunction resume_children(effect, local) {\n\tif ((effect.f \u0026 INERT) === 0) return;\n\teffect.f ^= INERT;\n\n\t// If a dependency of this effect changed while it was paused,\n\t// schedule the effect to update. we don't use `is_dirty`\n\t// here because we don't want to eagerly recompute a derived like\n\t// `{#if foo}{foo.bar()}{/if}` if `foo` is now `undefined\n\tif ((effect.f \u0026 CLEAN) === 0) {\n\t\tset_signal_status(effect, DIRTY);\n\t\tschedule_effect(effect);\n\t}\n\n\tvar child = effect.first;\n\n\twhile (child !== null) {\n\t\tvar sibling = child.next;\n\t\tvar transparent = (child.f \u0026 EFFECT_TRANSPARENT) !== 0 || (child.f \u0026 BRANCH_EFFECT) !== 0;\n\t\t// TODO we don't need to call resume_children recursively with a linked list in place\n\t\t// it's slightly more involved though as we have to account for `transparent` changing\n\t\t// through the tree.\n\t\tresume_children(child, transparent ? local : false);\n\t\tchild = sibling;\n\t}\n\n\tvar t = effect.nodes \u0026\u0026 effect.nodes.t;\n\n\tif (t !== null) {\n\t\tfor (const transition of t) {\n\t\t\tif (transition.is_global || local) {\n\t\t\t\ttransition.in();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function aborted(effect = /** @type {Effect} */ (active_effect)) {\n\treturn (effect.f \u0026 DESTROYED) !== 0;\n}\n\n/**\n * @param {Effect} effect\n * @param {DocumentFragment} fragment\n */\nexport function move_effect(effect, fragment) {\n\tif (!effect.nodes) return;\n\n\t/** @type {TemplateNode | null} */\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\twhile (node !== null) {\n\t\t/** @type {TemplateNode | null} */\n\t\tvar next = node === end ? null : get_next_sibling(node);\n\n\t\tfragment.append(node);\n\t\tnode = next;\n\t}\n}\n","const e=typeof window\u003c\"u\"\u0026\u0026typeof Deno\u003e\"u\",o=!1,n=!1;export{e as BROWSER,o as DEV,n as NODE};\n"],"version":3}
