wherever-dev 0.18.2 → 0.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/session-pool.d.ts +1 -1
- package/dist/session-pool.d.ts.map +1 -1
- package/dist/session-pool.js +18 -8
- package/dist/session-pool.js.map +1 -1
- package/package.json +1 -1
- package/public/_app/immutable/chunks/BDyT5Iv7.js +2 -0
- package/public/_app/immutable/chunks/{DGXiQ9ZV.js.map → BDyT5Iv7.js.map} +1 -1
- package/public/_app/immutable/chunks/{D9URj2y-.js → CxeW4bFU.js} +2 -2
- package/public/_app/immutable/chunks/{D9URj2y-.js.map → CxeW4bFU.js.map} +1 -1
- package/public/_app/immutable/chunks/{ayQO3yig.js → pzF36qD8.js} +2 -2
- package/public/_app/immutable/chunks/{ayQO3yig.js.map → pzF36qD8.js.map} +1 -1
- package/public/_app/immutable/entry/{app.BhOrDt22.js → app.fmRrIlrx.js} +3 -3
- package/public/_app/immutable/entry/{app.BhOrDt22.js.map → app.fmRrIlrx.js.map} +1 -1
- package/public/_app/immutable/entry/start.CR5sFyDq.js +2 -0
- package/public/_app/immutable/entry/start.CR5sFyDq.js.map +1 -0
- package/public/_app/immutable/nodes/{0.CXdAzqGq.js → 0.y9mNw2ua.js} +2 -2
- package/public/_app/immutable/nodes/{0.CXdAzqGq.js.map → 0.y9mNw2ua.js.map} +1 -1
- package/public/_app/immutable/nodes/{1.B1fORJLJ.js → 1.D0t3PhYs.js} +2 -2
- package/public/_app/immutable/nodes/{1.B1fORJLJ.js.map → 1.D0t3PhYs.js.map} +1 -1
- package/public/_app/immutable/nodes/{2.DnoKKNs8.js → 2.hfqxCQJf.js} +2 -2
- package/public/_app/immutable/nodes/{2.DnoKKNs8.js.map → 2.hfqxCQJf.js.map} +1 -1
- package/public/_app/version.json +1 -1
- package/public/index.html +10 -10
- package/public/service-worker.js +1 -1
- package/public/_app/immutable/chunks/DGXiQ9ZV.js +0 -2
- package/public/_app/immutable/entry/start.g-UtlC0Y.js +0 -2
- package/public/_app/immutable/entry/start.g-UtlC0Y.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ayQO3yig.js","sources":["../../../../../../../node_modules/.pnpm/svelte@5.55.9/node_modules/svelte/src/internal/client/dom/blocks/each.js","../../../../../../../node_modules/.pnpm/svelte@5.55.9/node_modules/svelte/src/internal/client/dom/elements/attributes.js","../../../../../../../node_modules/.pnpm/@sveltejs+kit@2.60.1_@opentelemetry+api@1.9.0_@sveltejs+vite-plugin-svelte@6.2.4_svelte_92561c5307f67095f16bb8153283369b/node_modules/@sveltejs/kit/src/runtime/app/paths/client.js","../../../../../../../node_modules/.pnpm/named-logs@0.4.1/node_modules/named-logs/dist/esm/index.js","../../../../../../src/lib/core/service-worker/utils.ts","../../../../../../src/lib/core/notifications/index.ts","../../../../../../src/lib/core/service-worker/index.ts","../../../../../../src/lib/core/utils/web/url.ts","../../../../../../src/lib/core/config.ts","../../../../../../src/lib/theme.ts","../../../../../../src/lib/core/token-adoption.ts","../../../../../../src/lib/session-store.ts"],"sourcesContent":["/** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */\n/** @import { Batch } from '../../reactivity/batch.js'; */\nimport {\n\tEACH_INDEX_REACTIVE,\n\tEACH_IS_ANIMATED,\n\tEACH_IS_CONTROLLED,\n\tEACH_ITEM_IMMUTABLE,\n\tEACH_ITEM_REACTIVE,\n\tHYDRATION_END,\n\tHYDRATION_START_ELSE\n} from '../../../../constants.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating\n} from '../hydration.js';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tshould_defer_append\n} from '../operations.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { source, mutable_source, internal_set } from '../../reactivity/sources.js';\nimport { array_from, is_array } from '../../../shared/utils.js';\nimport { BRANCH_EFFECT, COMMENT_NODE, DESTROYED, EFFECT_OFFSCREEN, INERT } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { get } from '../../runtime.js';\nimport { DEV } from 'esm-env';\nimport { derived_safe_equal } from '../../reactivity/deriveds.js';\nimport { current_batch } from '../../reactivity/batch.js';\nimport * as e from '../../errors.js';\nimport { tag } from '../../dev/tracing.js';\n\n// When making substantive changes to this file, validate them with the each block stress test:\n// https://svelte.dev/playground/1972b2cf46564476ad8c8c6405b23b7b\n// This test also exists in this repo, as `packages/svelte/tests/manual/each-stress-test`\n\n/**\n * @param {any} _\n * @param {number} i\n */\nexport function index(_, i) {\n\treturn i;\n}\n\n/**\n * Pause multiple effects simultaneously, and coordinate their\n * subsequent destruction. Used in each blocks\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {null | Node} controlled_anchor\n */\nfunction pause_effects(state, to_destroy, controlled_anchor) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\tvar length = to_destroy.length;\n\n\t/** @type {EachOutroGroup} */\n\tvar group;\n\tvar remaining = to_destroy.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tlet effect = to_destroy[i];\n\n\t\tpause_effect(\n\t\t\teffect,\n\t\t\t() => {\n\t\t\t\tif (group) {\n\t\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\t\tgroup.done.add(effect);\n\n\t\t\t\t\tif (group.pending.size === 0) {\n\t\t\t\t\t\tvar groups = /** @type {Set<EachOutroGroup>} */ (state.outrogroups);\n\n\t\t\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\t\t\tgroups.delete(group);\n\n\t\t\t\t\t\tif (groups.size === 0) {\n\t\t\t\t\t\t\tstate.outrogroups = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tremaining -= 1;\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\t}\n\n\tif (remaining === 0) {\n\t\t// If we're in a controlled each block (i.e. the block is the only child of an\n\t\t// element), and we are removing all items, _and_ there are no out transitions,\n\t\t// we can use the fast path — emptying the element and replacing the anchor\n\t\tvar fast_path = transitions.length === 0 && controlled_anchor !== null;\n\n\t\tif (fast_path) {\n\t\t\tvar anchor = /** @type {Element} */ (controlled_anchor);\n\t\t\tvar parent_node = /** @type {Element} */ (anchor.parentNode);\n\n\t\t\tclear_text_content(parent_node);\n\t\t\tparent_node.append(anchor);\n\n\t\t\tstate.items.clear();\n\t\t}\n\n\t\tdestroy_effects(state, to_destroy, !fast_path);\n\t} else {\n\t\tgroup = {\n\t\t\tpending: new Set(to_destroy),\n\t\t\tdone: new Set()\n\t\t};\n\n\t\t(state.outrogroups ??= new Set()).add(group);\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {boolean} remove_dom\n */\nfunction destroy_effects(state, to_destroy, remove_dom = true) {\n\t/** @type {Set<Effect> | undefined} */\n\tvar preserved_effects;\n\n\t// The loop-in-a-loop isn't ideal, but we should only hit this in relatively rare cases\n\tif (state.pending.size > 0) {\n\t\tpreserved_effects = new Set();\n\n\t\tfor (const keys of state.pending.values()) {\n\t\t\tfor (const key of keys) {\n\t\t\t\tpreserved_effects.add(/** @type {EachItem} */ (state.items.get(key)).e);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var i = 0; i < to_destroy.length; i++) {\n\t\tvar e = to_destroy[i];\n\n\t\tif (preserved_effects?.has(e)) {\n\t\t\te.f |= EFFECT_OFFSCREEN;\n\n\t\t\tconst fragment = document.createDocumentFragment();\n\t\t\tmove_effect(e, fragment);\n\t\t} else {\n\t\t\tdestroy_effect(to_destroy[i], remove_dom);\n\t\t}\n\t}\n}\n\n/** @type {TemplateNode} */\nvar offscreen_anchor;\n\n/**\n * @template V\n * @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @param {(value: V, index: number) => any} get_key\n * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn\n * @param {null | ((anchor: Node) => void)} fallback_fn\n * @returns {void}\n */\nexport function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {\n\tvar anchor = node;\n\n\t/** @type {Map<any, EachItem>} */\n\tvar items = new Map();\n\n\tvar is_controlled = (flags & EACH_IS_CONTROLLED) !== 0;\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tanchor = hydrating\n\t\t\t? set_hydrate_node(get_first_child(parent_node))\n\t\t\t: parent_node.appendChild(create_text());\n\t}\n\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\t/** @type {Effect | null} */\n\tvar fallback = null;\n\n\t// TODO: ideally we could use derived for runes mode but because of the ability\n\t// to use a store which can be mutated, we can't do that here as mutating a store\n\t// will still result in the collection array being the same from the store\n\tvar each_array = derived_safe_equal(() => {\n\t\tvar collection = get_collection();\n\n\t\treturn is_array(collection) ? collection : collection == null ? [] : array_from(collection);\n\t});\n\n\tif (DEV) {\n\t\ttag(each_array, '{#each ...}');\n\t}\n\n\t/** @type {V[]} */\n\tvar array;\n\n\t/** @type {Map<Batch, Set<any>>} */\n\tvar pending = new Map();\n\n\tvar first_run = true;\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction commit(batch) {\n\t\tif ((state.effect.f & DESTROYED) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tstate.pending.delete(batch);\n\n\t\tstate.fallback = fallback;\n\t\treconcile(state, array, anchor, flags, get_key);\n\n\t\tif (fallback !== null) {\n\t\t\tif (array.length === 0) {\n\t\t\t\tif ((fallback.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\t\tresume_effect(fallback);\n\t\t\t\t} else {\n\t\t\t\t\tfallback.f ^= EFFECT_OFFSCREEN;\n\t\t\t\t\tmove(fallback, null, anchor);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpause_effect(fallback, () => {\n\t\t\t\t\t// TODO only null out if no pending batch needs it,\n\t\t\t\t\t// otherwise re-add `fallback.fragment` and move the\n\t\t\t\t\t// effect into it\n\t\t\t\t\tfallback = null;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction discard(batch) {\n\t\tstate.pending.delete(batch);\n\t}\n\n\tvar effect = block(() => {\n\t\tarray = /** @type {V[]} */ (get(each_array));\n\t\tvar length = array.length;\n\n\t\t/** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */\n\t\tlet mismatch = false;\n\n\t\tif (hydrating) {\n\t\t\tvar is_else = read_hydration_instruction(anchor) === HYDRATION_START_ELSE;\n\n\t\t\tif (is_else !== (length === 0)) {\n\t\t\t\t// hydration mismatch — remove the server-rendered DOM and start over\n\t\t\t\tanchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tset_hydrating(false);\n\t\t\t\tmismatch = true;\n\t\t\t}\n\t\t}\n\n\t\tvar keys = new Set();\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tfor (var index = 0; index < length; index += 1) {\n\t\t\tif (\n\t\t\t\thydrating &&\n\t\t\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\t\t\t/** @type {Comment} */ (hydrate_node).data === HYDRATION_END\n\t\t\t) {\n\t\t\t\t// The server rendered fewer items than expected,\n\t\t\t\t// so break out and continue appending non-hydrated items\n\t\t\t\tanchor = /** @type {Comment} */ (hydrate_node);\n\t\t\t\tmismatch = true;\n\t\t\t\tset_hydrating(false);\n\t\t\t}\n\n\t\t\tvar value = array[index];\n\t\t\tvar key = get_key(value, index);\n\n\t\t\tif (DEV) {\n\t\t\t\t// Check that the key function is idempotent (returns the same value when called twice)\n\t\t\t\tvar key_again = get_key(value, index);\n\t\t\t\tif (key !== key_again) {\n\t\t\t\t\te.each_key_volatile(String(index), String(key), String(key_again));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar item = first_run ? null : items.get(key);\n\n\t\t\tif (item) {\n\t\t\t\t// update before reconciliation, to trigger any async updates\n\t\t\t\tif (item.v) internal_set(item.v, value);\n\t\t\t\tif (item.i) internal_set(item.i, index);\n\n\t\t\t\tif (defer) {\n\t\t\t\t\tbatch.unskip_effect(item.e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\titem = create_item(\n\t\t\t\t\titems,\n\t\t\t\t\tfirst_run ? anchor : (offscreen_anchor ??= create_text()),\n\t\t\t\t\tvalue,\n\t\t\t\t\tkey,\n\t\t\t\t\tindex,\n\t\t\t\t\trender_fn,\n\t\t\t\t\tflags,\n\t\t\t\t\tget_collection\n\t\t\t\t);\n\n\t\t\t\tif (!first_run) {\n\t\t\t\t\titem.e.f |= EFFECT_OFFSCREEN;\n\t\t\t\t}\n\n\t\t\t\titems.set(key, item);\n\t\t\t}\n\n\t\t\tkeys.add(key);\n\t\t}\n\n\t\tif (length === 0 && fallback_fn && !fallback) {\n\t\t\tif (first_run) {\n\t\t\t\tfallback = branch(() => fallback_fn(anchor));\n\t\t\t} else {\n\t\t\t\tfallback = branch(() => fallback_fn((offscreen_anchor ??= create_text())));\n\t\t\t\tfallback.f |= EFFECT_OFFSCREEN;\n\t\t\t}\n\t\t}\n\n\t\tif (length > keys.size) {\n\t\t\tif (DEV) {\n\t\t\t\tvalidate_each_keys(array, get_key);\n\t\t\t} else {\n\t\t\t\t// in prod, the additional information isn't printed, so don't bother computing it\n\t\t\t\te.each_key_duplicate('', '', '');\n\t\t\t}\n\t\t}\n\n\t\t// remove excess nodes\n\t\tif (hydrating && length > 0) {\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tif (!first_run) {\n\t\t\tpending.set(batch, keys);\n\n\t\t\tif (defer) {\n\t\t\t\tfor (const [key, item] of items) {\n\t\t\t\t\tif (!keys.has(key)) {\n\t\t\t\t\t\tbatch.skip_effect(item.e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.oncommit(commit);\n\t\t\t\tbatch.ondiscard(discard);\n\t\t\t} else {\n\t\t\t\tcommit(batch);\n\t\t\t}\n\t\t}\n\n\t\tif (mismatch) {\n\t\t\t// continue in hydration mode\n\t\t\tset_hydrating(true);\n\t\t}\n\n\t\t// When we mount the each block for the first time, the collection won't be\n\t\t// connected to this effect as the effect hasn't finished running yet and its deps\n\t\t// won't be assigned. However, it's possible that when reconciling the each block\n\t\t// that a mutation occurred and it's made the collection MAYBE_DIRTY, so reading the\n\t\t// collection again can provide consistency to the reactive graph again as the deriveds\n\t\t// will now be `CLEAN`.\n\t\tget(each_array);\n\t});\n\n\t/** @type {EachState} */\n\tvar state = { effect, flags, items, pending, outrogroups: null, fallback };\n\n\tfirst_run = false;\n\n\tif (hydrating) {\n\t\tanchor = hydrate_node;\n\t}\n}\n\n/**\n * Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect\n * @param {Effect | null} effect\n * @returns {Effect | null}\n */\nfunction skip_to_branch(effect) {\n\twhile (effect !== null && (effect.f & BRANCH_EFFECT) === 0) {\n\t\teffect = effect.next;\n\t}\n\treturn effect;\n}\n\n/**\n * Add, remove, or reorder items output by an each block as its input changes\n * @template V\n * @param {EachState} state\n * @param {Array<V>} array\n * @param {Element | Comment | Text} anchor\n * @param {number} flags\n * @param {(value: V, index: number) => any} get_key\n * @returns {void}\n */\nfunction reconcile(state, array, anchor, flags, get_key) {\n\tvar is_animated = (flags & EACH_IS_ANIMATED) !== 0;\n\n\tvar length = array.length;\n\tvar items = state.items;\n\tvar current = skip_to_branch(state.effect.first);\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar seen;\n\n\t/** @type {Effect | null} */\n\tvar prev = null;\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar to_animate;\n\n\t/** @type {Effect[]} */\n\tvar matched = [];\n\n\t/** @type {Effect[]} */\n\tvar stashed = [];\n\n\t/** @type {V} */\n\tvar value;\n\n\t/** @type {any} */\n\tvar key;\n\n\t/** @type {Effect | undefined} */\n\tvar effect;\n\n\t/** @type {number} */\n\tvar i;\n\n\tif (is_animated) {\n\t\tfor (i = 0; i < length; i += 1) {\n\t\t\tvalue = array[i];\n\t\t\tkey = get_key(value, i);\n\t\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\t\t// offscreen == coming in now, no animation in that case,\n\t\t\t// else this would happen https://github.com/sveltejs/svelte/issues/17181\n\t\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\teffect.nodes?.a?.measure();\n\t\t\t\t(to_animate ??= new Set()).add(effect);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < length; i += 1) {\n\t\tvalue = array[i];\n\t\tkey = get_key(value, i);\n\n\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\tif (state.outrogroups !== null) {\n\t\t\tfor (const group of state.outrogroups) {\n\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\tgroup.done.delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & INERT) !== 0) {\n\t\t\tresume_effect(effect);\n\t\t\tif (is_animated) {\n\t\t\t\teffect.nodes?.a?.unfix();\n\t\t\t\t(to_animate ??= new Set()).delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) !== 0) {\n\t\t\teffect.f ^= EFFECT_OFFSCREEN;\n\n\t\t\tif (effect === current) {\n\t\t\t\tmove(effect, null, anchor);\n\t\t\t} else {\n\t\t\t\tvar next = prev ? prev.next : current;\n\n\t\t\t\tif (effect === state.effect.last) {\n\t\t\t\t\tstate.effect.last = effect.prev;\n\t\t\t\t}\n\n\t\t\t\tif (effect.prev) effect.prev.next = effect.next;\n\t\t\t\tif (effect.next) effect.next.prev = effect.prev;\n\t\t\t\tlink(state, prev, effect);\n\t\t\t\tlink(state, effect, next);\n\n\t\t\t\tmove(effect, next, anchor);\n\t\t\t\tprev = effect;\n\n\t\t\t\tmatched = [];\n\t\t\t\tstashed = [];\n\n\t\t\t\tcurrent = skip_to_branch(prev.next);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (effect !== current) {\n\t\t\tif (seen !== undefined && seen.has(effect)) {\n\t\t\t\tif (matched.length < stashed.length) {\n\t\t\t\t\t// more efficient to move later items to the front\n\t\t\t\t\tvar start = stashed[0];\n\t\t\t\t\tvar j;\n\n\t\t\t\t\tprev = start.prev;\n\n\t\t\t\t\tvar a = matched[0];\n\t\t\t\t\tvar b = matched[matched.length - 1];\n\n\t\t\t\t\tfor (j = 0; j < matched.length; j += 1) {\n\t\t\t\t\t\tmove(matched[j], start, anchor);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (j = 0; j < stashed.length; j += 1) {\n\t\t\t\t\t\tseen.delete(stashed[j]);\n\t\t\t\t\t}\n\n\t\t\t\t\tlink(state, a.prev, b.next);\n\t\t\t\t\tlink(state, prev, a);\n\t\t\t\t\tlink(state, b, start);\n\n\t\t\t\t\tcurrent = start;\n\t\t\t\t\tprev = b;\n\t\t\t\t\ti -= 1;\n\n\t\t\t\t\tmatched = [];\n\t\t\t\t\tstashed = [];\n\t\t\t\t} else {\n\t\t\t\t\t// more efficient to move earlier items to the back\n\t\t\t\t\tseen.delete(effect);\n\t\t\t\t\tmove(effect, current, anchor);\n\n\t\t\t\t\tlink(state, effect.prev, effect.next);\n\t\t\t\t\tlink(state, effect, prev === null ? state.effect.first : prev.next);\n\t\t\t\t\tlink(state, prev, effect);\n\n\t\t\t\t\tprev = effect;\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tmatched = [];\n\t\t\tstashed = [];\n\n\t\t\twhile (current !== null && current !== effect) {\n\t\t\t\t(seen ??= new Set()).add(current);\n\t\t\t\tstashed.push(current);\n\t\t\t\tcurrent = skip_to_branch(current.next);\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\tmatched.push(effect);\n\t\t}\n\n\t\tprev = effect;\n\t\tcurrent = skip_to_branch(effect.next);\n\t}\n\n\tif (state.outrogroups !== null) {\n\t\tfor (const group of state.outrogroups) {\n\t\t\tif (group.pending.size === 0) {\n\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\tstate.outrogroups?.delete(group);\n\t\t\t}\n\t\t}\n\n\t\tif (state.outrogroups.size === 0) {\n\t\t\tstate.outrogroups = null;\n\t\t}\n\t}\n\n\tif (current !== null || seen !== undefined) {\n\t\t/** @type {Effect[]} */\n\t\tvar to_destroy = [];\n\n\t\tif (seen !== undefined) {\n\t\t\tfor (effect of seen) {\n\t\t\t\tif ((effect.f & INERT) === 0) {\n\t\t\t\t\tto_destroy.push(effect);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile (current !== null) {\n\t\t\t// If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished\n\t\t\tif ((current.f & INERT) === 0 && current !== state.fallback) {\n\t\t\t\tto_destroy.push(current);\n\t\t\t}\n\n\t\t\tcurrent = skip_to_branch(current.next);\n\t\t}\n\n\t\tvar destroy_length = to_destroy.length;\n\n\t\tif (destroy_length > 0) {\n\t\t\tvar controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;\n\n\t\t\tif (is_animated) {\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.measure();\n\t\t\t\t}\n\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.fix();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpause_effects(state, to_destroy, controlled_anchor);\n\t\t}\n\t}\n\n\tif (is_animated) {\n\t\tqueue_micro_task(() => {\n\t\t\tif (to_animate === undefined) return;\n\t\t\tfor (effect of to_animate) {\n\t\t\t\teffect.nodes?.a?.apply();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @template V\n * @param {Map<any, EachItem>} items\n * @param {Node} anchor\n * @param {V} value\n * @param {unknown} key\n * @param {number} index\n * @param {(anchor: Node, item: V | Source<V>, index: number | Value<number>, collection: () => V[]) => void} render_fn\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @returns {EachItem}\n */\nfunction create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {\n\tvar v =\n\t\t(flags & EACH_ITEM_REACTIVE) !== 0\n\t\t\t? (flags & EACH_ITEM_IMMUTABLE) === 0\n\t\t\t\t? mutable_source(value, false, false)\n\t\t\t\t: source(value)\n\t\t\t: null;\n\n\tvar i = (flags & EACH_INDEX_REACTIVE) !== 0 ? source(index) : null;\n\n\tif (DEV && v) {\n\t\t// For tracing purposes, we need to link the source signal we create with the\n\t\t// collection + index so that tracing works as intended\n\t\tv.trace = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\t\t\tget_collection()[i?.v ?? index];\n\t\t};\n\t}\n\n\treturn {\n\t\tv,\n\t\ti,\n\t\te: branch(() => {\n\t\t\trender_fn(anchor, v ?? value, i ?? index, get_collection);\n\n\t\t\treturn () => {\n\t\t\t\titems.delete(key);\n\t\t\t};\n\t\t})\n\t};\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect | null} next\n * @param {Text | Element | Comment} anchor\n */\nfunction move(effect, next, anchor) {\n\tif (!effect.nodes) return;\n\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\tvar dest =\n\t\tnext && (next.f & EFFECT_OFFSCREEN) === 0\n\t\t\t? /** @type {EffectNodes} */ (next.nodes).start\n\t\t\t: anchor;\n\n\twhile (node !== null) {\n\t\tvar next_node = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\tdest.before(node);\n\n\t\tif (node === end) {\n\t\t\treturn;\n\t\t}\n\n\t\tnode = next_node;\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect | null} prev\n * @param {Effect | null} next\n */\nfunction link(state, prev, next) {\n\tif (prev === null) {\n\t\tstate.effect.first = next;\n\t} else {\n\t\tprev.next = next;\n\t}\n\n\tif (next === null) {\n\t\tstate.effect.last = prev;\n\t} else {\n\t\tnext.prev = prev;\n\t}\n}\n\n/**\n * @param {Array<any>} array\n * @param {(item: any, index: number) => string} key_fn\n * @returns {void}\n */\nfunction validate_each_keys(array, key_fn) {\n\tconst keys = new Map();\n\tconst length = array.length;\n\n\tfor (let i = 0; i < length; i++) {\n\t\tconst key = key_fn(array[i], i);\n\n\t\tif (keys.has(key)) {\n\t\t\tconst a = String(keys.get(key));\n\t\t\tconst b = String(i);\n\n\t\t\t/** @type {string | null} */\n\t\t\tlet k = String(key);\n\t\t\tif (k.startsWith('[object ')) k = null;\n\n\t\t\te.each_key_duplicate(a, b, k);\n\t\t}\n\n\t\tkeys.set(key, i);\n\t}\n}\n","/** @import { Blocker, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport { hydrating, set_hydrating } from '../hydration.js';\nimport { get_descriptors, get_prototype_of } from '../../../shared/utils.js';\nimport { create_event, delegate, delegated, event, event_symbol } from './events.js';\nimport { add_form_reset_listener, autofocus } from './misc.js';\nimport * as w from '../../warnings.js';\nimport {\n\tATTRIBUTES_CACHE,\n\tFORM_RESET_HANDLER,\n\tIS_XHTML,\n\tLOADING_ATTR_SYMBOL\n} from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { is_capture_event, can_delegate_event, normalize_attribute } from '../../../../utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { attach } from './attachments.js';\nimport { clsx } from '../../../shared/attributes.js';\nimport { set_class } from './class.js';\nimport { set_style } from './style.js';\nimport { ATTACHMENT_KEY, NAMESPACE_HTML, UNINITIALIZED } from '../../../../constants.js';\nimport { branch, destroy_effect, effect, managed } from '../../reactivity/effects.js';\nimport { init_select, select_option } from './bindings/select.js';\nimport { flatten } from '../../reactivity/async.js';\n\nexport const CLASS = Symbol('class');\nexport const STYLE = Symbol('style');\n\nconst IS_CUSTOM_ELEMENT = Symbol('is custom element');\nconst IS_HTML = Symbol('is html');\n\nconst LINK_TAG = IS_XHTML ? 'link' : 'LINK';\nconst INPUT_TAG = IS_XHTML ? 'input' : 'INPUT';\nconst OPTION_TAG = IS_XHTML ? 'option' : 'OPTION';\nconst SELECT_TAG = IS_XHTML ? 'select' : 'SELECT';\nconst PROGRESS_TAG = IS_XHTML ? 'progress' : 'PROGRESS';\n\n/**\n * The value/checked attribute in the template actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLInputElement} input\n * @returns {void}\n */\nexport function remove_input_defaults(input) {\n\tif (!hydrating) return;\n\n\tvar already_removed = false;\n\n\t// We try and remove the default attributes later, rather than sync during hydration.\n\t// Doing it sync during hydration has a negative impact on performance, but deferring the\n\t// work in an idle task alleviates this greatly. If a form reset event comes in before\n\t// the idle callback, then we ensure the input defaults are cleared just before.\n\tvar remove_defaults = () => {\n\t\tif (already_removed) return;\n\t\talready_removed = true;\n\n\t\t// Remove the attributes but preserve the values\n\t\tif (input.hasAttribute('value')) {\n\t\t\tvar value = input.value;\n\t\t\tset_attribute(input, 'value', null);\n\t\t\tinput.value = value;\n\t\t}\n\n\t\tif (input.hasAttribute('checked')) {\n\t\t\tvar checked = input.checked;\n\t\t\tset_attribute(input, 'checked', null);\n\t\t\tinput.checked = checked;\n\t\t}\n\t};\n\n\t/** @type {any} */ (input)[FORM_RESET_HANDLER] = remove_defaults;\n\tqueue_micro_task(remove_defaults);\n\tadd_form_reset_listener();\n}\n\n/**\n * @param {Element} element\n * @param {any} value\n */\nexport function set_value(element, value) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.value ===\n\t\t\t(attributes.value =\n\t\t\t\t// treat null and undefined the same for the initial value\n\t\t\t\tvalue ?? undefined) ||\n\t\t// @ts-expect-error\n\t\t// `progress` elements always need their value set when it's `0`\n\t\t(element.value === value && (value !== 0 || element.nodeName !== PROGRESS_TAG))\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.value = value ?? '';\n}\n\n/**\n * @param {Element} element\n * @param {boolean} checked\n */\nexport function set_checked(element, checked) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.checked ===\n\t\t(attributes.checked =\n\t\t\t// treat null and undefined the same for the initial value\n\t\t\tchecked ?? undefined)\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.checked = checked;\n}\n\n/**\n * Sets the `selected` attribute on an `option` element.\n * Not set through the property because that doesn't reflect to the DOM,\n * which means it wouldn't be taken into account when a form is reset.\n * @param {HTMLOptionElement} element\n * @param {boolean} selected\n */\nexport function set_selected(element, selected) {\n\tif (selected) {\n\t\t// The selected option could've changed via user selection, and\n\t\t// setting the value without this check would set it back.\n\t\tif (!element.hasAttribute('selected')) {\n\t\t\telement.setAttribute('selected', '');\n\t\t}\n\t} else {\n\t\telement.removeAttribute('selected');\n\t}\n}\n\n/**\n * Applies the default checked property without influencing the current checked property.\n * @param {HTMLInputElement} element\n * @param {boolean} checked\n */\nexport function set_default_checked(element, checked) {\n\tconst existing_value = element.checked;\n\telement.defaultChecked = checked;\n\telement.checked = existing_value;\n}\n\n/**\n * Applies the default value property without influencing the current value property.\n * @param {HTMLInputElement | HTMLTextAreaElement} element\n * @param {string} value\n */\nexport function set_default_value(element, value) {\n\tconst existing_value = element.value;\n\telement.defaultValue = value;\n\telement.value = existing_value;\n}\n\n/**\n * @param {Element} element\n * @param {string} attribute\n * @param {string | null} value\n * @param {boolean} [skip_warning]\n */\nexport function set_attribute(element, attribute, value, skip_warning) {\n\tvar attributes = get_attributes(element);\n\n\tif (hydrating) {\n\t\tattributes[attribute] = element.getAttribute(attribute);\n\n\t\tif (\n\t\t\tattribute === 'src' ||\n\t\t\tattribute === 'srcset' ||\n\t\t\t(attribute === 'href' && element.nodeName === LINK_TAG)\n\t\t) {\n\t\t\tif (!skip_warning) {\n\t\t\t\tcheck_src_in_dev_hydration(element, attribute, value ?? '');\n\t\t\t}\n\n\t\t\t// If we reset these attributes, they would result in another network request, which we want to avoid.\n\t\t\t// We assume they are the same between client and server as checking if they are equal is expensive\n\t\t\t// (we can't just compare the strings as they can be different between client and server but result in the\n\t\t\t// same url, so we would need to create hidden anchor elements to compare them)\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (attributes[attribute] === (attributes[attribute] = value)) return;\n\n\tif (attribute === 'loading') {\n\t\t// @ts-expect-error\n\t\telement[LOADING_ATTR_SYMBOL] = value;\n\t}\n\n\tif (value == null) {\n\t\telement.removeAttribute(attribute);\n\t} else if (typeof value !== 'string' && get_setters(element).includes(attribute)) {\n\t\t// @ts-ignore\n\t\telement[attribute] = value;\n\t} else {\n\t\telement.setAttribute(attribute, value);\n\t}\n}\n\n/**\n * @param {Element} dom\n * @param {string} attribute\n * @param {string} value\n */\nexport function set_xlink_attribute(dom, attribute, value) {\n\tdom.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @param {string} prop\n * @param {any} value\n */\nexport function set_custom_element_data(node, prop, value) {\n\t// We need to ensure that setting custom element props, which can\n\t// invoke lifecycle methods on other custom elements, does not also\n\t// associate those lifecycle methods with the current active reaction\n\t// or effect\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet was_hydrating = hydrating;\n\tif (hydrating) {\n\t\tset_hydrating(false);\n\t}\n\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\tif (\n\t\t\t// `style` should use `set_attribute` rather than the setter\n\t\t\tprop !== 'style' &&\n\t\t\t// Don't compute setters for custom elements while they aren't registered yet,\n\t\t\t// because during their upgrade/instantiation they might add more setters.\n\t\t\t// Instead, fall back to a simple \"an object, then set as property\" heuristic.\n\t\t\t(setters_cache.has(node.getAttribute('is') || node.nodeName) ||\n\t\t\t// customElements may not be available in browser extension contexts\n\t\t\t!customElements ||\n\t\t\tcustomElements.get(node.getAttribute('is') || node.nodeName.toLowerCase())\n\t\t\t\t? get_setters(node).includes(prop)\n\t\t\t\t: value && typeof value === 'object')\n\t\t) {\n\t\t\t// @ts-expect-error\n\t\t\tnode[prop] = value;\n\t\t} else {\n\t\t\t// We did getters etc checks already, stringify before passing to set_attribute\n\t\t\t// to ensure it doesn't invoke the same logic again, and potentially populating\n\t\t\t// the setters cache too early.\n\t\t\tset_attribute(node, prop, value == null ? value : String(value));\n\t\t}\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t\tif (was_hydrating) {\n\t\t\tset_hydrating(true);\n\t\t}\n\t}\n}\n\n/**\n * Spreads attributes onto a DOM element, taking into account the currently set attributes\n * @param {Element & ElementCSSInlineStyle} element\n * @param {Record<string | symbol, any> | undefined} prev\n * @param {Record<string | symbol, any>} next New attributes - this function mutates this object\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n * @returns {Record<string, any>}\n */\nfunction set_attributes(\n\telement,\n\tprev,\n\tnext,\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tif (hydrating && should_remove_defaults && element.nodeName === INPUT_TAG) {\n\t\tvar input = /** @type {HTMLInputElement} */ (element);\n\t\tvar attribute = input.type === 'checkbox' ? 'defaultChecked' : 'defaultValue';\n\n\t\tif (!(attribute in next)) {\n\t\t\tremove_input_defaults(input);\n\t\t}\n\t}\n\n\tvar attributes = get_attributes(element);\n\n\tvar is_custom_element = attributes[IS_CUSTOM_ELEMENT];\n\tvar preserve_attribute_case = !attributes[IS_HTML];\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet is_hydrating_custom_element = hydrating && is_custom_element;\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(false);\n\t}\n\n\tvar current = prev || {};\n\tvar is_option_element = element.nodeName === OPTION_TAG;\n\n\tfor (var key in prev) {\n\t\tif (!(key in next)) {\n\t\t\tnext[key] = null;\n\t\t}\n\t}\n\n\tif (next.class) {\n\t\tnext.class = clsx(next.class);\n\t} else if (css_hash || next[CLASS]) {\n\t\tnext.class = null; /* force call to set_class() */\n\t}\n\n\tif (next[STYLE]) {\n\t\tnext.style ??= null; /* force call to set_style() */\n\t}\n\n\tvar setters = get_setters(element);\n\n\t// since key is captured we use const\n\tfor (const key in next) {\n\t\t// let instead of var because referenced in a closure\n\t\tlet value = next[key];\n\n\t\t// Up here because we want to do this for the initial value, too, even if it's undefined,\n\t\t// and this wouldn't be reached in case of undefined because of the equality check below\n\t\tif (is_option_element && key === 'value' && value == null) {\n\t\t\t// The <option> element is a special case because removing the value attribute means\n\t\t\t// the value is set to the text content of the option element, and setting the value\n\t\t\t// to null or undefined means the value is set to the string \"null\" or \"undefined\".\n\t\t\t// To align with how we handle this case in non-spread-scenarios, this logic is needed.\n\t\t\t// There's a super-edge-case bug here that is left in in favor of smaller code size:\n\t\t\t// Because of the \"set missing props to null\" logic above, we can't differentiate\n\t\t\t// between a missing value and an explicitly set value of null or undefined. That means\n\t\t\t// that once set, the value attribute of an <option> element can't be removed. This is\n\t\t\t// a very rare edge case, and removing the attribute altogether isn't possible either\n\t\t\t// for the <option value={undefined}> case, so we're not losing any functionality here.\n\t\t\t// @ts-ignore\n\t\t\telement.value = element.__value = '';\n\t\t\tcurrent[key] = value;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'class') {\n\t\t\tvar is_html = element.namespaceURI === 'http://www.w3.org/1999/xhtml';\n\t\t\tset_class(element, is_html, value, css_hash, prev?.[CLASS], next[CLASS]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[CLASS] = next[CLASS];\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'style') {\n\t\t\tset_style(element, value, prev?.[STYLE], next[STYLE]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[STYLE] = next[STYLE];\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar prev_value = current[key];\n\n\t\t// Skip if value is unchanged, unless it's `undefined` and the element still has the attribute\n\t\tif (value === prev_value && !(value === undefined && element.hasAttribute(key))) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tcurrent[key] = value;\n\n\t\tvar prefix = key[0] + key[1]; // this is faster than key.slice(0, 2)\n\t\tif (prefix === '$$') continue;\n\n\t\tif (prefix === 'on') {\n\t\t\t/** @type {{ capture?: true }} */\n\t\t\tconst opts = {};\n\t\t\tconst event_handle_key = '$$' + key;\n\t\t\tlet event_name = key.slice(2);\n\t\t\tvar is_delegated = can_delegate_event(event_name);\n\n\t\t\tif (is_capture_event(event_name)) {\n\t\t\t\tevent_name = event_name.slice(0, -7);\n\t\t\t\topts.capture = true;\n\t\t\t}\n\n\t\t\tif (!is_delegated && prev_value) {\n\t\t\t\t// Listening to same event but different handler -> our handle function below takes care of this\n\t\t\t\t// If we were to remove and add listeners in this case, it could happen that the event is \"swallowed\"\n\t\t\t\t// (the browser seems to not know yet that a new one exists now) and doesn't reach the handler\n\t\t\t\t// https://github.com/sveltejs/svelte/issues/11903\n\t\t\t\tif (value != null) continue;\n\n\t\t\t\telement.removeEventListener(event_name, current[event_handle_key], opts);\n\t\t\t\tcurrent[event_handle_key] = null;\n\t\t\t}\n\n\t\t\tif (is_delegated) {\n\t\t\t\tdelegated(event_name, element, value);\n\t\t\t\tdelegate([event_name]);\n\t\t\t} else if (value != null) {\n\t\t\t\t/**\n\t\t\t\t * @this {any}\n\t\t\t\t * @param {Event} evt\n\t\t\t\t */\n\t\t\t\tfunction handle(evt) {\n\t\t\t\t\tcurrent[key].call(this, evt);\n\t\t\t\t}\n\n\t\t\t\tcurrent[event_handle_key] = create_event(event_name, element, handle, opts);\n\t\t\t}\n\t\t} else if (key === 'style') {\n\t\t\t// avoid using the setter\n\t\t\tset_attribute(element, key, value);\n\t\t} else if (key === 'autofocus') {\n\t\t\tautofocus(/** @type {HTMLElement} */ (element), Boolean(value));\n\t\t} else if (!is_custom_element && (key === '__value' || (key === 'value' && value != null))) {\n\t\t\t// @ts-ignore We're not running this for custom elements because __value is actually\n\t\t\t// how Lit stores the current value on the element, and messing with that would break things.\n\t\t\telement.value = element.__value = value;\n\t\t} else if (key === 'selected' && is_option_element) {\n\t\t\tset_selected(/** @type {HTMLOptionElement} */ (element), value);\n\t\t} else {\n\t\t\tvar name = key;\n\t\t\tif (!preserve_attribute_case) {\n\t\t\t\tname = normalize_attribute(name);\n\t\t\t}\n\n\t\t\tvar is_default = name === 'defaultValue' || name === 'defaultChecked';\n\n\t\t\tif (value == null && !is_custom_element && !is_default) {\n\t\t\t\tattributes[key] = null;\n\n\t\t\t\tif (name === 'value' || name === 'checked') {\n\t\t\t\t\t// removing value/checked also removes defaultValue/defaultChecked — preserve\n\t\t\t\t\tlet input = /** @type {HTMLInputElement} */ (element);\n\t\t\t\t\tconst use_default = prev === undefined;\n\t\t\t\t\tif (name === 'value') {\n\t\t\t\t\t\tlet previous = input.defaultValue;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultValue = previous;\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tinput.value = input.__value = use_default ? previous : null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet previous = input.defaultChecked;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultChecked = previous;\n\t\t\t\t\t\tinput.checked = use_default ? previous : false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\telement.removeAttribute(key);\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tis_default ||\n\t\t\t\t(setters.includes(name) && (is_custom_element || typeof value !== 'string'))\n\t\t\t) {\n\t\t\t\t// @ts-ignore\n\t\t\t\telement[name] = value;\n\t\t\t\t// remove it from attributes's cache\n\t\t\t\tif (name in attributes) attributes[name] = UNINITIALIZED;\n\t\t\t} else if (typeof value !== 'function') {\n\t\t\t\tset_attribute(element, name, value, skip_warning);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(true);\n\t}\n\n\treturn current;\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} element\n * @param {(...expressions: any) => Record<string | symbol, any>} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n */\nexport function attribute_effect(\n\telement,\n\tfn,\n\tsync = [],\n\tasync = [],\n\tblockers = [],\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tflatten(blockers, sync, async, (values) => {\n\t\t/** @type {Record<string | symbol, any> | undefined} */\n\t\tvar prev = undefined;\n\n\t\t/** @type {Record<symbol, Effect>} */\n\t\tvar effects = {};\n\n\t\tvar is_select = element.nodeName === SELECT_TAG;\n\t\tvar inited = false;\n\n\t\tmanaged(() => {\n\t\t\tvar next = fn(...values.map(get));\n\t\t\t/** @type {Record<string | symbol, any>} */\n\t\t\tvar current = set_attributes(\n\t\t\t\telement,\n\t\t\t\tprev,\n\t\t\t\tnext,\n\t\t\t\tcss_hash,\n\t\t\t\tshould_remove_defaults,\n\t\t\t\tskip_warning\n\t\t\t);\n\n\t\t\tif (inited && is_select && 'value' in next) {\n\t\t\t\tselect_option(/** @type {HTMLSelectElement} */ (element), next.value);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(effects)) {\n\t\t\t\tif (!next[symbol]) destroy_effect(effects[symbol]);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(next)) {\n\t\t\t\tvar n = next[symbol];\n\n\t\t\t\tif (symbol.description === ATTACHMENT_KEY && (!prev || n !== prev[symbol])) {\n\t\t\t\t\tif (effects[symbol]) destroy_effect(effects[symbol]);\n\t\t\t\t\teffects[symbol] = branch(() => attach(element, () => n));\n\t\t\t\t}\n\n\t\t\t\tcurrent[symbol] = n;\n\t\t\t}\n\n\t\t\tprev = current;\n\t\t});\n\n\t\tif (is_select) {\n\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\teffect(() => {\n\t\t\t\tselect_option(select, /** @type {Record<string | symbol, any>} */ (prev).value, true);\n\t\t\t\tinit_select(select);\n\t\t\t});\n\t\t}\n\n\t\tinited = true;\n\t});\n}\n\n/**\n *\n * @param {Element} element\n */\nfunction get_attributes(element) {\n\treturn /** @type {Record<string | symbol, unknown>} **/ (\n\t\t/** @type {any} */ (element)[ATTRIBUTES_CACHE] ??= {\n\t\t\t[IS_CUSTOM_ELEMENT]: element.nodeName.includes('-'),\n\t\t\t[IS_HTML]: element.namespaceURI === NAMESPACE_HTML\n\t\t}\n\t);\n}\n\n/** @type {Map<string, string[]>} */\nvar setters_cache = new Map();\n\n/** @param {Element} element */\nfunction get_setters(element) {\n\tvar cache_key = element.getAttribute('is') || element.nodeName;\n\tvar setters = setters_cache.get(cache_key);\n\tif (setters) return setters;\n\tsetters_cache.set(cache_key, (setters = []));\n\n\tvar descriptors;\n\tvar proto = element; // In the case of custom elements there might be setters on the instance\n\tvar element_proto = Element.prototype;\n\n\t// Stop at Element, from there on there's only unnecessary (and dangerous, like innerHTML) setters we're not interested in\n\t// Do not use constructor.name here as that's unreliable in some browser environments\n\twhile (element_proto !== proto) {\n\t\tdescriptors = get_descriptors(proto);\n\n\t\tfor (var key in descriptors) {\n\t\t\tif (\n\t\t\t\tdescriptors[key].set &&\n\t\t\t\t// better safe than sorry, we don't want spread attributes to mess with HTML content\n\t\t\t\tkey !== 'innerHTML' &&\n\t\t\t\tkey !== 'textContent' &&\n\t\t\t\tkey !== 'innerText'\n\t\t\t) {\n\t\t\t\tsetters.push(key);\n\t\t\t}\n\t\t}\n\n\t\tproto = get_prototype_of(proto);\n\t}\n\n\treturn setters;\n}\n\n/**\n * @param {any} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction check_src_in_dev_hydration(element, attribute, value) {\n\tif (!DEV) return;\n\tif (attribute === 'srcset' && srcset_url_equal(element, value)) return;\n\tif (src_url_equal(element.getAttribute(attribute) ?? '', value)) return;\n\n\tw.hydration_attribute_changed(\n\t\tattribute,\n\t\telement.outerHTML.replace(element.innerHTML, element.innerHTML && '...'),\n\t\tString(value)\n\t);\n}\n\n/**\n * @param {string} element_src\n * @param {string} url\n * @returns {boolean}\n */\nfunction src_url_equal(element_src, url) {\n\tif (element_src === url) return true;\n\treturn new URL(element_src, document.baseURI).href === new URL(url, document.baseURI).href;\n}\n\n/** @param {string} srcset */\nfunction split_srcset(srcset) {\n\treturn srcset.split(',').map((src) => src.trim().split(' ').filter(Boolean));\n}\n\n/**\n * @param {HTMLSourceElement | HTMLImageElement} element\n * @param {string} srcset\n * @returns {boolean}\n */\nfunction srcset_url_equal(element, srcset) {\n\tvar element_urls = split_srcset(element.srcset);\n\tvar urls = split_srcset(srcset);\n\n\treturn (\n\t\turls.length === element_urls.length &&\n\t\turls.every(\n\t\t\t([url, width], i) =>\n\t\t\t\twidth === element_urls[i][1] &&\n\t\t\t\t// We need to test both ways because Vite will create an a full URL with\n\t\t\t\t// `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the\n\t\t\t\t// relative URLs inside srcset are not automatically resolved to absolute URLs by\n\t\t\t\t// browsers (in contrast to img.src). This means both SSR and DOM code could\n\t\t\t\t// contain relative or absolute URLs.\n\t\t\t\t(src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0]))\n\t\t)\n\t);\n}\n","/** @import { Asset, RouteId, RouteIdWithSearchOrHash, Pathname, PathnameWithSearchOrHash, ResolvedPathname } from '$app/types' */\n/** @import { ResolveArgs } from './types.js' */\nimport { base, assets, hash_routing } from './internal/client.js';\nimport { resolve_route } from '../../../utils/routing.js';\nimport { get_navigation_intent } from '../../client/client.js';\n\n/**\n * Resolve the URL of an asset in your `static` directory, by prefixing it with [`config.kit.paths.assets`](https://svelte.dev/docs/kit/configuration#paths) if configured, or otherwise by prefixing it with the base path.\n *\n * During server rendering, the base path is relative and depends on the page currently being rendered.\n *\n * @example\n * ```svelte\n * <script>\n * \timport { asset } from '$app/paths';\n * </script>\n *\n * <img alt=\"a potato\" src={asset('/potato.jpg')} />\n * ```\n * @since 2.26\n *\n * @param {Asset} file\n * @returns {string}\n */\nexport function asset(file) {\n\treturn (assets || base) + file;\n}\n\nconst pathname_prefix = hash_routing ? '#' : '';\n\n/**\n * Resolve a pathname by prefixing it with the base path, if any, or resolve a route ID by populating dynamic segments with parameters.\n *\n * During server rendering, the base path is relative and depends on the page currently being rendered.\n *\n * @example\n * ```js\n * import { resolve } from '$app/paths';\n *\n * // using a pathname\n * const resolved = resolve(`/blog/hello-world`);\n *\n * // using a route ID plus parameters\n * const resolved = resolve('/blog/[slug]', {\n * \tslug: 'hello-world'\n * });\n * ```\n * @since 2.26\n *\n * @template {RouteIdWithSearchOrHash | PathnameWithSearchOrHash} T\n * @param {ResolveArgs<T>} args\n * @returns {ResolvedPathname}\n */\nexport function resolve(...args) {\n\tif (!args[0].startsWith('/')) {\n\t\tthrow new Error(\n\t\t\t`Cannot use \\`resolve(...)\\` with a non-absolute pathname or route ID (got \"${args[0]}\"). ` +\n\t\t\t\t'`resolve` is only for internal pathnames and route IDs; external URLs should be used directly.'\n\t\t);\n\t}\n\n\t// The type error is correct here, and if someone doesn't pass params when they should there's a runtime error,\n\t// but we don't want to adjust the internal resolve_route function to accept `undefined`, hence the type cast.\n\treturn (\n\t\tbase + pathname_prefix + resolve_route(args[0], /** @type {Record<string, string>} */ (args[1]))\n\t);\n}\n\n/**\n * Match a path or URL to a route ID and extracts any parameters.\n *\n * @example\n * ```js\n * import { match } from '$app/paths';\n *\n * const route = await match('/blog/hello-world');\n *\n * if (route?.id === '/blog/[slug]') {\n * \tconst slug = route.params.slug;\n * \tconst response = await fetch(`/api/posts/${slug}`);\n * \tconst post = await response.json();\n * }\n * ```\n * @since 2.52.0\n *\n * @param {Pathname | URL | (string & {})} url\n * @returns {Promise<{ id: RouteId, params: Record<string, string> } | null>}\n */\nexport async function match(url) {\n\tif (typeof url === 'string') {\n\t\turl = new URL(url, location.href);\n\t}\n\n\tconst intent = await get_navigation_intent(url, false);\n\n\tif (intent) {\n\t\treturn {\n\t\t\tid: /** @type {RouteId} */ (intent.route.id),\n\t\t\tparams: intent.params\n\t\t};\n\t}\n\n\treturn null;\n}\n\nexport { base, assets, resolve as resolveRoute };\n","const noop=()=>{},noopLogger={assert:noop,error:noop,warn:noop,info:noop,log:noop,debug:noop,dir:noop,table:noop,trace:noop,write:noop,time:noop,timeEnd:noop,timeLog:noop};let _factory;export function hook(o){\"undefined\"!=typeof globalThis&&(globalThis._logFactory=o),_factory=o}const fallbackFactory=o=>{let n;return new Proxy({},{get(r,t,e){if(n)return n[t];const l=_getFactory();return l?(n=l(o),n[t]):noop}})};function _getFactory(){return _factory||(null===globalThis||void 0===globalThis?void 0:globalThis._logFactory)}export function logs(o,n){const r=_getFactory();return r?r(o,{decoration:null==n?void 0:n.decoration}):(null==n?void 0:n.fallbackOnProxy)?\"boolean\"==typeof n.fallbackOnProxy?n.fallbackOnProxy?fallbackFactory(o):noopLogger:\"string\"==typeof n.fallbackOnProxy&&\"undefined\"!=typeof process&&(null===process||void 0===process?void 0:process.env[n.fallbackOnProxy])?fallbackFactory(o):noopLogger:noopLogger}","export function handleAutomaticUpdate(\n\tregistration: ServiceWorkerRegistration,\n\tintervals: {idle: number; checks: number},\n): NodeJS.Timeout {\n\tlet lastFocusTime = performance.now();\n\tfunction wakeup(evt?: Event) {\n\t\tconst timePassed = performance.now();\n\t\tif (timePassed - lastFocusTime > intervals.idle) {\n\t\t\tregistration.update();\n\t\t}\n\t\t// we reset the time each time we wake up\n\t\t// the idea here is that we do not want to bother users while they are actively using the app\n\t\tlastFocusTime = timePassed;\n\t}\n\t['focus', 'pointerdown'].forEach((evt) =>\n\t\twindow.addEventListener(evt, wakeup),\n\t);\n\n\t// Installed-PWA update trigger.\n\t// An installed PWA is a SPA (hash/client-side routing) and almost never\n\t// issues a `mode: 'navigate'` request, so the service worker's\n\t// \"skipWaiting on navigate\" trick (see src/service-worker/index.ts) never\n\t// fires and a waiting worker is never surfaced. The idle-gated `wakeup`\n\t// above also rarely passes right after a relaunch, so the update banner\n\t// never appears. Force an explicit update check on launch and every time\n\t// the app becomes visible (relaunch / tab re-show) so the manual update\n\t// popup can actually be shown.\n\tdocument.addEventListener('visibilitychange', () => {\n\t\tif (document.visibilityState === 'visible') {\n\t\t\tregistration.update();\n\t\t}\n\t});\n\t// also check immediately on registration\n\tregistration.update();\n\n\t// but we still do not an update every so often\n\t// TODO improve upon this\n\treturn setInterval(() => registration.update(), intervals.checks);\n}\n\n// taken from: https://stackoverflow.com/a/50535316\nexport function listenForWaitingServiceWorker(\n\tregistration: ServiceWorkerRegistration,\n\tcallback: (reg: ServiceWorkerRegistration) => void,\n) {\n\tfunction awaitStateChange() {\n\t\tif (registration.installing) {\n\t\t\tregistration.installing.addEventListener('statechange', function () {\n\t\t\t\tif (this.state === 'installed') callback(registration);\n\t\t\t});\n\t\t}\n\t}\n\tif (!registration) {\n\t\treturn;\n\t}\n\tif (registration.waiting) {\n\t\treturn callback(registration);\n\t}\n\tif (registration.installing) {\n\t\tawaitStateChange();\n\t} else {\n\t\tregistration.addEventListener('updatefound', awaitStateChange);\n\t}\n}\n","import {pushState} from '$app/navigation';\nimport {page} from '$app/state';\nimport {get, writable} from 'svelte/store';\ntype JSONNotification = {\n\ttitle: string;\n\toptions: NotificationOptions;\n};\n\nexport type PushNotification = {\n\ttype: 'push-notification';\n\tdata: JSONNotification;\n};\nexport type NotificationToAdd = PushNotification;\n\nexport type Notification = NotificationToAdd & {id: number};\n\nexport function createNotificationsService() {\n\tlet lastId = 1;\n\tconst store = writable<Notification[]>([]);\n\n\tfunction add(notification: NotificationToAdd) {\n\t\tstore.update((notifications) => [\n\t\t\t...notifications,\n\t\t\t{...notification, id: ++lastId},\n\t\t]);\n\t}\n\n\tfunction remove(id: number) {\n\t\tstore.update((notifications) =>\n\t\t\tnotifications.filter((notification) => notification.id !== id),\n\t\t);\n\t}\n\n\tfunction onClick(id: number) {\n\t\tconst notification = get(store).find((v) => v.id == id);\n\t\tremove(id);\n\t\tif (notification?.type === 'push-notification') {\n\t\t\tif (notification.data.options.data?.navigate) {\n\t\t\t\tpushState(notification.data.options.data.navigate, page.state);\n\t\t\t}\n\t\t}\n\t}\n\treturn {subscribe: store.subscribe, add, remove, onClick};\n}\n\nexport const notifications = createNotificationsService();\n","import {dev} from '$app/environment';\nimport {get, writable} from 'svelte/store';\nimport type {Logger} from 'named-logs';\nimport {logs} from 'named-logs';\nimport {handleAutomaticUpdate, listenForWaitingServiceWorker} from './utils';\nimport {notifications} from '$lib/core/notifications';\nimport {resolve} from '$app/paths';\n\nconst logger = logs('service-worker') as Logger & {\n\tlevel: number;\n\tenabled: boolean;\n};\n\nfunction updateLoggingForWorker(worker: ServiceWorker | null) {\n\tif (worker) {\n\t\tif (logger.enabled) {\n\t\t\tlogger.debug(\n\t\t\t\t`enabling logging for service worker, level: ${logger.level}`,\n\t\t\t);\n\t\t} else {\n\t\t\tlogger.debug(\n\t\t\t\t`disabling logging for service worker, level: ${logger.level}`,\n\t\t\t);\n\t\t}\n\t\tworker.postMessage({\n\t\t\ttype: 'debug',\n\t\t\tlevel: logger.level,\n\t\t\tenabled: logger.enabled,\n\t\t});\n\t}\n}\n\nconst IDLE_DELAY_MS = 3 * 60 * 1000;\nconst CHECK_DELAY_MS = 30 * 60 * 1000;\n\nexport type ServiceWorkerState =\n\t| undefined\n\t| {\n\t\t\tnotSupported: true;\n\t }\n\t| {\n\t\t\tnotSupported: false;\n\t\t\tregistering: true;\n\t }\n\t| {\n\t\t\tnotSupported: false;\n\t\t\tregistering: false;\n\t\t\terror: {message: string; cause: any};\n\t\t\tregistration: undefined;\n\t\t\tupdateAvailable: false;\n\t }\n\t| {\n\t\t\tregistration?: ServiceWorkerRegistration;\n\t\t\tupdateAvailable: boolean;\n\t\t\tnotSupported: false;\n\t\t\tregistering: false;\n\t };\n\nexport function createServiceWorker() {\n\tconst store = writable<ServiceWorkerState>(undefined);\n\n\tfunction pingServideWorker(\n\t\tstate: 'installing' | 'waiting' | 'active' = 'active',\n\t) {\n\t\tsendMessage(\n\t\t\t{\n\t\t\t\ttype: 'ping',\n\t\t\t},\n\t\t\tstate,\n\t\t);\n\t}\n\n\tfunction sendMessage(\n\t\tmessage: string | object,\n\t\tstate: 'installing' | 'waiting' | 'active' = 'active',\n\t) {\n\t\tconst $serviceWorker = get(store);\n\t\tif (!$serviceWorker) {\n\t\t\tthrow new Error(`not loaded`);\n\t\t}\n\t\tif ($serviceWorker.notSupported) {\n\t\t\tthrow new Error(`not supported`);\n\t\t}\n\t\tif ($serviceWorker.registering) {\n\t\t\tthrow new Error(`is registering...`);\n\t\t}\n\t\tconst registration = $serviceWorker.registration;\n\t\tif (!registration) {\n\t\t\tthrow new Error(`no registration`);\n\t\t}\n\t\tif (!registration[state]) {\n\t\t\tthrow new Error(`no registration in state: ${state}`);\n\t\t}\n\t\tregistration[state].postMessage(message);\n\t}\n\n\tfunction skipWaiting() {\n\t\tlogger.log(`accepting update...`);\n\t\tconst $serviceWorker = get(store);\n\t\tif (!$serviceWorker) {\n\t\t\tthrow new Error(`not loaded`);\n\t\t}\n\t\tif ($serviceWorker.notSupported) {\n\t\t\tthrow new Error(`not supported`);\n\t\t}\n\t\tif ($serviceWorker.registering) {\n\t\t\tthrow new Error(`is registering...`);\n\t\t}\n\t\tif ($serviceWorker.updateAvailable && $serviceWorker.registration) {\n\t\t\tconst registration = $serviceWorker.registration;\n\t\t\tif (!registration) {\n\t\t\t\tthrow new Error(`no registration`);\n\t\t\t}\n\n\t\t\tif (registration.waiting) {\n\t\t\t\tlogger.log(`was waiting, skipping...`);\n\t\t\t\tregistration.waiting.postMessage('skipWaiting');\n\t\t\t} else {\n\t\t\t\tlogger.log(`was not waiting, should we reload?`);\n\t\t\t\tlogger.error(`not waiting..., todo reload?`);\n\t\t\t\t// window.location.reload();\n\t\t\t}\n\n\t\t\tif (!dev) {\n\t\t\t\tlogger.log(`update store`);\n\t\t\t\tstore.set({\n\t\t\t\t\tnotSupported: false,\n\t\t\t\t\tupdateAvailable: false,\n\t\t\t\t\tregistration: $serviceWorker.registration,\n\t\t\t\t\tregistering: $serviceWorker.registering,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction skip() {\n\t\tconst $serviceWorker = get(store);\n\t\tif (!$serviceWorker) {\n\t\t\tthrow new Error(`not loaded`);\n\t\t}\n\t\tif ($serviceWorker.notSupported) {\n\t\t\tthrow new Error(`not supported`);\n\t\t}\n\t\tif ($serviceWorker.registering) {\n\t\t\tthrow new Error(`is registering...`);\n\t\t}\n\t\tstore.set({\n\t\t\tnotSupported: false,\n\t\t\tupdateAvailable: false,\n\t\t\tregistration: $serviceWorker.registration,\n\t\t\tregistering: $serviceWorker.registering,\n\t\t});\n\t}\n\n\tfunction register() {\n\t\tif (typeof navigator !== 'undefined' && 'serviceWorker' in navigator) {\n\t\t\tstore.set({notSupported: false, registering: true});\n\n\t\t\t// ------------------------------------------------------------------------------------------------\n\t\t\t// FORCE RELOAD ON CONTROLLER CHANGE\n\t\t\t// ------------------------------------------------------------------------------------------------\n\t\t\tlet refreshing = false;\n\t\t\tnavigator.serviceWorker.addEventListener('controllerchange', () => {\n\t\t\t\tif (refreshing) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\trefreshing = true;\n\t\t\t\twindow.location.reload();\n\t\t\t});\n\t\t\t// ------------------------------------------------------------------------------------------------\n\n\t\t\t//listen to messages\n\t\t\tnavigator.serviceWorker.onmessage = (event) => {\n\t\t\t\tif (event.data && event.data.type === 'notification') {\n\t\t\t\t\tconsole.log(event);\n\t\t\t\t\tnotifications.add({\n\t\t\t\t\t\ttype: 'push-notification',\n\t\t\t\t\t\tdata: event.data.notification,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst swLocation = resolve<any>(`/service-worker.js`);\n\t\t\t//{scope: `${base}/`}\n\t\t\tnavigator.serviceWorker\n\t\t\t\t.register(swLocation, {\n\t\t\t\t\ttype: dev ? 'module' : 'classic',\n\t\t\t\t})\n\t\t\t\t.then((registration) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\thandleAutomaticUpdate(registration, {\n\t\t\t\t\t\t\tidle: IDLE_DELAY_MS,\n\t\t\t\t\t\t\tchecks: CHECK_DELAY_MS,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e) {}\n\n\t\t\t\t\tstore.set({\n\t\t\t\t\t\tnotSupported: false,\n\t\t\t\t\t\tupdateAvailable: false,\n\t\t\t\t\t\tregistration: registration,\n\t\t\t\t\t\tregistering: false,\n\t\t\t\t\t});\n\t\t\t\t\tupdateLoggingForWorker(registration.installing);\n\t\t\t\t\tupdateLoggingForWorker(registration.waiting);\n\t\t\t\t\tupdateLoggingForWorker(registration.active);\n\t\t\t\t\tlistenForWaitingServiceWorker(registration, () => {\n\t\t\t\t\t\tstore.set({\n\t\t\t\t\t\t\tnotSupported: false,\n\t\t\t\t\t\t\tupdateAvailable: true,\n\t\t\t\t\t\t\tregistration: registration,\n\t\t\t\t\t\t\tregistering: false,\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.catch((e) => {\n\t\t\t\t\tconsole.error(e);\n\t\t\t\t\tstore.set({\n\t\t\t\t\t\tregistering: false,\n\t\t\t\t\t\tnotSupported: false,\n\t\t\t\t\t\tupdateAvailable: false,\n\t\t\t\t\t\tregistration: undefined,\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tmessage: `failed to register service-worker`,\n\t\t\t\t\t\t\tcause: e.message || e,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tlogger.error('Failed to register service worker', e);\n\t\t\t\t});\n\t\t} else {\n\t\t\tif (typeof window !== 'undefined') {\n\t\t\t\tstore.set({notSupported: true});\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tsubscribe: store.subscribe,\n\t\tset: store.set, // TODO remove and move handler logic in here\n\t\tget registration(): ServiceWorkerRegistration | undefined {\n\t\t\tconst $serviceWorker = get(store);\n\t\t\tif ($serviceWorker && 'registration' in $serviceWorker) {\n\t\t\t\treturn $serviceWorker.registration;\n\t\t\t} else {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t\tget updateAvailable(): boolean {\n\t\t\tconst $serviceWorker = get(store);\n\t\t\tif ($serviceWorker && 'updateAvailable' in $serviceWorker) {\n\t\t\t\treturn $serviceWorker.updateAvailable;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\tregister,\n\t\tpingServideWorker,\n\t\tsendMessage,\n\t\tskipWaiting,\n\t\tskip,\n\t};\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nexport function getParamsFromURL(url: string): {\n\tparams: Record<string, string>;\n\tpathname?: string;\n} {\n\tif (!url) {\n\t\treturn {params: {}, pathname: ''};\n\t}\n\tconst obj: Record<string, string> = {};\n\tconst hash = url.lastIndexOf('#');\n\n\tlet cleanedUrl = url;\n\tif (hash !== -1) {\n\t\tcleanedUrl = cleanedUrl.slice(0, hash);\n\t}\n\n\tconst question = cleanedUrl.indexOf('?');\n\tif (question !== -1) {\n\t\tcleanedUrl\n\t\t\t.slice(question + 1)\n\t\t\t.split('&')\n\t\t\t.forEach((piece) => {\n\t\t\t\tconst [key, val = ''] = piece.split('=');\n\t\t\t\tobj[decodeURIComponent(key)] =\n\t\t\t\t\tval === '' ? 'true' : decodeURIComponent(val);\n\t\t\t});\n\t}\n\n\tlet pathname = cleanedUrl.slice(0, question) || '';\n\tif (pathname && !pathname.endsWith('/')) {\n\t\tpathname += '/';\n\t}\n\treturn {params: obj, pathname};\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport function getParamsFromLocation(): {\n\tparams: Record<string, string>;\n\tpathname?: string;\n} {\n\tif (typeof window === 'undefined') {\n\t\treturn {params: {}};\n\t}\n\treturn getParamsFromURL(window.location.href);\n}\n\nexport function getHashParamsFromLocation(\n\tstr?: string,\n): Record<string, string> {\n\tif (typeof window === 'undefined') {\n\t\treturn {};\n\t}\n\tconst url = str || window.location.hash;\n\tconst obj: Record<string, string> = {};\n\tconst hash = url.lastIndexOf('#');\n\n\tif (hash !== -1) {\n\t\turl\n\t\t\t.slice(hash + 1)\n\t\t\t.split('&')\n\t\t\t.forEach((piece) => {\n\t\t\t\tconst [key, val = ''] = piece.split('=');\n\t\t\t\tobj[decodeURIComponent(key)] = decodeURIComponent(val);\n\t\t\t});\n\t}\n\treturn obj;\n}\n\nexport function queryStringifyNoArray(query: Record<string, string>): string {\n\tlet str = '';\n\tfor (const key of Object.keys(query)) {\n\t\tconst value = query[key];\n\t\tstr += `${str === '' ? '?' : '&'}${key}=${value}`;\n\t}\n\treturn str;\n}\n\nexport function rebuildLocationHash(hashParams: Record<string, string>): void {\n\tif (typeof window === 'undefined') {\n\t\treturn;\n\t}\n\tlet reconstructedHash = '';\n\tObject.entries(hashParams).forEach((param) => {\n\t\tif (reconstructedHash === '') {\n\t\t\treconstructedHash += '#';\n\t\t} else {\n\t\t\treconstructedHash += '&';\n\t\t}\n\t\treconstructedHash += param.join('=');\n\t});\n\n\tif ('replaceState' in window.history) {\n\t\twindow.history.replaceState(\n\t\t\t'',\n\t\t\tdocument.title,\n\t\t\twindow.location.pathname + window.location.search + reconstructedHash,\n\t\t);\n\t} else {\n\t\t// Prevent scrolling by storing the page's current scroll offset\n\t\tconst {scrollTop, scrollLeft} = document.body;\n\t\twindow.location.hash = '';\n\n\t\t// Restore the scroll offset, should be flicker free\n\t\tdocument.body.scrollTop = scrollTop;\n\t\tdocument.body.scrollLeft = scrollLeft;\n\t}\n}\n\nasync function chrome76Detection(): Promise<boolean> {\n\tif ('storage' in navigator && 'estimate' in navigator.storage) {\n\t\tconst {quota} = await navigator.storage.estimate();\n\t\treturn quota !== undefined && quota < 120000000;\n\t}\n\treturn false;\n}\n\nfunction isNewChrome(): boolean {\n\tconst pieces = navigator.userAgent.match(\n\t\t/Chrom(?:e|ium)\\/([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+)/,\n\t);\n\tif (pieces === null || pieces.length !== 5) {\n\t\treturn false;\n\t}\n\tconst major = pieces.map((piece) => parseInt(piece, 10))[1];\n\treturn major >= 76;\n}\n\nexport function isPrivateWindow(): Promise<boolean | null> {\n\treturn new Promise((resolve) => {\n\t\ttry {\n\t\t\tconst isSafari =\n\t\t\t\tnavigator.vendor &&\n\t\t\t\tnavigator.vendor.indexOf('Apple') > -1 &&\n\t\t\t\tnavigator.userAgent &&\n\t\t\t\tnavigator.userAgent.indexOf('CriOS') === -1 &&\n\t\t\t\tnavigator.userAgent.indexOf('FxiOS') === -1;\n\n\t\t\tif (isSafari) {\n\t\t\t\t// Safari\n\t\t\t\tlet e = false;\n\t\t\t\tif ((window as any).safariIncognito) {\n\t\t\t\t\te = true;\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t(window as any).openDatabase(null, null, null, null);\n\t\t\t\t\t\twindow.localStorage.setItem('test', '1');\n\t\t\t\t\t\tresolve(false);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\te = true;\n\t\t\t\t\t\tresolve(true);\n\t\t\t\t\t}\n\t\t\t\t\t!e && window.localStorage.removeItem('test');\n\t\t\t\t}\n\t\t\t} else if (navigator.userAgent.includes('Firefox')) {\n\t\t\t\t// Firefox\n\t\t\t\tconst db = indexedDB.open('test');\n\t\t\t\tdb.onerror = () => {\n\t\t\t\t\tresolve(true);\n\t\t\t\t};\n\t\t\t\tdb.onsuccess = () => {\n\t\t\t\t\tresolve(false);\n\t\t\t\t};\n\t\t\t} else if (\n\t\t\t\tnavigator.userAgent.includes('Edge') ||\n\t\t\t\tnavigator.userAgent.includes('Trident') ||\n\t\t\t\tnavigator.userAgent.includes('msie')\n\t\t\t) {\n\t\t\t\t// Edge or IE\n\t\t\t\tif (\n\t\t\t\t\t!window.indexedDB &&\n\t\t\t\t\t(window.PointerEvent || (window as any).MSPointerEvent)\n\t\t\t\t) {\n\t\t\t\t\tresolve(true);\n\t\t\t\t}\n\t\t\t\tresolve(false);\n\t\t\t} else {\n\t\t\t\t// Normally ORP or Chrome\n\t\t\t\tif (isNewChrome()) {\n\t\t\t\t\tresolve(chrome76Detection());\n\t\t\t\t}\n\n\t\t\t\tconst fs =\n\t\t\t\t\t(window as any).RequestFileSystem ||\n\t\t\t\t\t(window as any).webkitRequestFileSystem;\n\t\t\t\tif (!fs) {\n\t\t\t\t\tresolve(null);\n\t\t\t\t} else {\n\t\t\t\t\tfs(\n\t\t\t\t\t\t(window as any).TEMPORARY,\n\t\t\t\t\t\t100,\n\t\t\t\t\t\t() => resolve(false),\n\t\t\t\t\t\t() => resolve(true),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(err);\n\t\t\tresolve(null);\n\t\t}\n\t});\n}\n","import {version} from '$app/environment';\nimport {createServiceWorker} from './service-worker';\nimport {\n\tgetHashParamsFromLocation,\n\tgetParamsFromLocation,\n} from './utils/web/url';\n\nexport const serviceWorker = createServiceWorker();\n\nexport const hashParams = getHashParamsFromLocation();\nexport const {params} = getParamsFromLocation();\n\nexport const globalQueryParams = [\n\t'debug',\n\t'debugLevel',\n\t'traceLevel',\n\t'debugLabel',\n\t'eruda',\n];\n\nconsole.log(`VERSION: ${version}`);\n","/**\n * Runtime theming of the web dashboard, driven by the server's\n * `appearance` config (`~/.wherever/config.json`). Because the brand\n * palette is defined as Tailwind v4 `@theme` variables (`--color-brand-*`),\n * every `bg-brand-*` / `text-brand-*` / `border-brand-*` utility resolves\n * those custom properties at paint time: overriding them on the root\n * element re-themes the whole UI without a rebuild.\n *\n * This exists so machines that mirror the same pi sessions (e.g. via\n * cloned folders pushed over git) can be told apart at a glance: each\n * server instance gets its own accent color and label.\n */\n\n/** Brand color token keys shared with `AppearanceConfig` on the server. */\nexport type AppearanceColorKey =\n\t| 'brandDark'\n\t| 'brandSurface'\n\t| 'brandSurface2'\n\t| 'brandSurface3'\n\t| 'brandBorder'\n\t| 'brandText'\n\t| 'brandTextMuted'\n\t| 'brandCyan'\n\t| 'brandBlue'\n\t| 'brandPurple';\n\n/** Subtle backdrop patterns painted on the dashboard's dark background, in the accent tint. */\nexport type AppearancePattern = 'none' | 'stripes' | 'dots' | 'grid';\n\nexport interface AppearanceInfo {\n\t/** Instance label (defaults to the server machine's hostname). */\n\tlabel: string;\n\t/** Accent color overriding the brand accent tokens, or null. */\n\taccent: string | null;\n\t/** Per-token brand overrides, or null. */\n\tcolors: Partial<Record<AppearanceColorKey, string>> | null;\n\t/** Solid accent bar across the top edge of the whole dashboard. */\n\tframe: boolean;\n\t/** Backdrop pattern on the dark background, in the accent tint. */\n\tpattern: AppearancePattern;\n}\n\n/** Map of config color keys to the CSS custom properties they override. */\nconst TOKEN_VARS: Record<AppearanceColorKey, string> = {\n\tbrandDark: '--color-brand-dark',\n\tbrandSurface: '--color-brand-surface',\n\tbrandSurface2: '--color-brand-surface-2',\n\tbrandSurface3: '--color-brand-surface-3',\n\tbrandBorder: '--color-brand-border',\n\tbrandText: '--color-brand-text',\n\tbrandTextMuted: '--color-brand-text-muted',\n\tbrandCyan: '--color-brand-cyan',\n\tbrandBlue: '--color-brand-blue',\n\tbrandPurple: '--color-brand-purple',\n};\n\nconst ACCENT_VARS = [\n\t'--color-brand-cyan',\n\t'--color-brand-blue',\n\t'--color-brand-purple',\n];\n\n/** The appearance assumed before /config answers (the compiled defaults). */\nexport const defaultAppearance: AppearanceInfo = {\n\tlabel: '',\n\taccent: null,\n\tcolors: null,\n\tframe: false,\n\tpattern: 'none',\n};\n\n/**\n * Apply an appearance to the document. Values are written through\n * `style.setProperty` only (never innerHTML), so arbitrary config strings\n * cannot inject markup. Pass `defaultAppearance` to reset to the compiled\n * palette (e.g. when connecting to a different server).\n */\nexport function applyAppearance(appearance: AppearanceInfo): void {\n\tif (typeof document === 'undefined') return;\n\tconst root = document.documentElement;\n\n\t// Reset first: /config answers once per server, and a PWA reconnecting to\n\t// another instance must not blend two palettes.\n\tfor (const cssVar of Object.values(TOKEN_VARS)) {\n\t\troot.style.removeProperty(cssVar);\n\t}\n\troot.classList.remove('wherever-framed');\n\tdelete root.dataset.whereverPattern;\n\n\tif (appearance.accent) {\n\t\t// One accent color retints the gradient stops too (app.css builds the\n\t\t// gradient from these variables), giving each instance a uniform hue.\n\t\tfor (const cssVar of ACCENT_VARS) {\n\t\t\troot.style.setProperty(cssVar, appearance.accent);\n\t\t}\n\t\t// Match the mobile browser chrome / PWA status bar to the accent.\n\t\tdocument\n\t\t\t.querySelector('meta[name=\"theme-color\"]')\n\t\t\t?.setAttribute('content', appearance.accent);\n\t}\n\n\tif (appearance.frame) {\n\t\t// A solid accent bar over the top edge of everything (app.css), visible\n\t\t// even with the sidebar collapsed or a session filling the screen.\n\t\troot.classList.add('wherever-framed');\n\t}\n\tif (appearance.pattern && appearance.pattern !== 'none') {\n\t\t// The backdrop pattern (app.css) reads this attribute.\n\t\troot.dataset.whereverPattern = appearance.pattern;\n\t}\n\n\tif (appearance.colors) {\n\t\tfor (const [key, value] of Object.entries(appearance.colors) as [\n\t\t\tAppearanceColorKey,\n\t\t\tstring,\n\t\t][]) {\n\t\t\tconst cssVar = TOKEN_VARS[key];\n\t\t\tif (cssVar && typeof value === 'string') {\n\t\t\t\troot.style.setProperty(cssVar, value);\n\t\t\t}\n\t\t}\n\t}\n}\n","// Adopting an auth token handed to the browser in the page URL.\n//\n// A token-protected server authenticates BOTH the page request and the\n// WebSocket upgrade (`/ws?token=...`). The dashboard only ever learned its\n// token from the `wherever-config` localStorage entry, so a freshly opened\n// `https://host/?token=SECRET` rendered the page (the server saw the query\n// parameter) and then failed the upgrade, because the client had no token to\n// put on the WebSocket URL. This module closes that gap: on boot the token is\n// taken out of the page URL, merged into the stored config, and removed from\n// the address bar. From then on every consumer -- page fetches, /sessions\n// calls, the WebSocket -- reads it from the config as usual.\n//\n// THE HASH FRAGMENT IS THE DOCUMENTED FORM, AND THAT IS DELIBERATE: a fragment\n// is never sent to the server. `https://host/#token=SECRET` keeps the secret\n// out of HTTP access logs, out of the `Referer` header sent to any third party\n// the user navigates to next, and out of the request logs of every reverse\n// proxy and intermediary in between, none of which is true of `?token=SECRET`.\n// Do NOT \"simplify\" this by folding the hash form back into the query\n// parameter: the query form is retained only as a fallback for links that were\n// already handed out, and both forms are scrubbed from the address bar the\n// moment they are read.\n\n// The single localStorage entry holding the dashboard's connection config.\n// Read/written here directly (rather than through wherever.ts) so adoption can\n// run before any config consumer without importing half the app.\nconst CONFIG_KEY = 'wherever-config';\nconst TOKEN_PARAM = 'token';\n\ntype TokenTake = {\n\t/** A `token` key was present, whether or not its value was usable. */\n\tpresent: boolean;\n\t/** The value verbatim, '' when there was no non-blank one. */\n\tvalue: string;\n\t/** The `?...` / `#...` remainder with the token key(s) removed, '' when empty. */\n\trest: string;\n};\n\n// Parses one URL component with URLSearchParams, so `#token=X&foo=1` behaves\n// sensibly and a percent-encoded token is decoded correctly.\n//\n// The key is matched CASE-INSENSITIVELY, which matters more here than it looks:\n// the fragment is ALSO this app's session-id channel (`+page.svelte` feeds\n// `location.hash` straight into switchSession). A near-miss capitalisation such\n// as `#TOKEN=SECRET` that this function failed to recognise would not merely be\n// ignored, it would be read as a session id, sent to the server, and echoed\n// back into the DOM as `Session with ID \"<secret>\" not found`. Recognising the\n// key in any case keeps the secret out of that path.\nfunction takeToken(raw: string, prefix: '?' | '#'): TokenTake {\n\tconst body = raw.startsWith(prefix) ? raw.slice(1) : raw;\n\tif (!body) return {present: false, value: '', rest: raw};\n\tconst params = new URLSearchParams(body);\n\tconst keys = [\n\t\t...new Set(\n\t\t\t[...params.keys()].filter((k) => k.toLowerCase() === TOKEN_PARAM),\n\t\t),\n\t];\n\t// When there is no token key the component is left BYTE-FOR-BYTE alone\n\t// rather than reserialised: a non key/value fragment (say `#/some/route`,\n\t// which is exactly what a session deep link looks like) would come back out\n\t// of URLSearchParams mangled into `%2Fsome%2Froute=`.\n\tif (keys.length === 0) return {present: false, value: '', rest: raw};\n\t// Stored VERBATIM, not trimmed: the server compares the token byte-for-byte\n\t// (`provided === token`), and this project deliberately supports a token with\n\t// surrounding whitespace (see \"Supplying the token\" in the README, where the\n\t// pre-existing sources are taken as-is). Trimming here would silently change\n\t// which string authenticates. The trim below decides only whether the value\n\t// is BLANK, which is a separate question.\n\t// All values are collected before anything is deleted, so a link that\n\t// repeats the key (`#token=&token=REAL`) still finds the usable one instead\n\t// of stopping at the blank first occurrence.\n\tconst values = keys.flatMap((key) => params.getAll(key));\n\tconst value = values.find((candidate) => candidate.trim()) ?? '';\n\tfor (const key of keys) params.delete(key);\n\tconst remaining = params.toString();\n\treturn {present: true, value, rest: remaining ? `${prefix}${remaining}` : ''};\n}\n\nexport type UrlTokenRead = {\n\t/** The usable token, or null when absent or blank. */\n\ttoken: string | null;\n\t/** A token key was present somewhere, so the address bar needs scrubbing. */\n\tpresent: boolean;\n\t/** The search component to keep. */\n\tsearch: string;\n\t/** The hash component to keep. */\n\thash: string;\n};\n\n/**\n * Pure read of the token from a URL's search and hash components.\n *\n * The hash wins when it carries a value; the query is a fallback. A blank or\n * whitespace-only token yields `token: null` but still `present: true`, so the\n * caller scrubs it without storing it: writing '' would clear a token that is\n * already working, turning a malformed link into a logout.\n *\n * Note that `+` decodes to a space, as form encoding says it must, and as the\n * server already does for the query form. A token containing `+` has to be\n * percent-encoded in the link; the README says so.\n */\nexport function readUrlToken(search: string, hash: string): UrlTokenRead {\n\tconst fromHash = takeToken(hash || '', '#');\n\tconst fromSearch = takeToken(search || '', '?');\n\tconst value = fromHash.value || fromSearch.value;\n\treturn {\n\t\ttoken: value ? value : null,\n\t\tpresent: fromHash.present || fromSearch.present,\n\t\tsearch: fromSearch.rest,\n\t\thash: fromHash.rest,\n\t};\n}\n\n/**\n * Removes the token from the address bar, leaving the rest of the URL alone.\n *\n * Idempotent and safe to call at any time: with no token in the URL it does\n * nothing. It is SEPARATE from adoption, and exported, because in a SvelteKit\n * app it MUST run a second time. This is measured behaviour, not a precaution:\n *\n * The dashboard boots in client-side-routing mode (the generated index.html\n * calls `kit.start(app, element)` with no hydrate payload), and SvelteKit's\n * `start()` reads `location.href` and then performs an initial `enter`\n * navigation with it. That navigation is what dynamically imports the route\n * modules, which is where adoption below runs, so the URL is scrubbed while the\n * navigation is still in flight. When the navigation then commits, SvelteKit\n * stamps the history entry with the href it captured BEFORE the import, and the\n * token reappears in the address bar. Instrumented in a real browser: the scrub\n * lands, and ~12ms later the router's own `history.replaceState` puts the token\n * back. Nothing in a jsdom-free unit test can see this, because the router is\n * not running there.\n *\n * Hence `+layout.svelte` calls this again from `afterNavigate`, which fires\n * after that commit. Native `history.replaceState` is used rather than the\n * `replaceState` from `$app/navigation` because this whole app already drives\n * the fragment natively (`window.location.hash = ...` in `+page.svelte` and\n * `SessionBrowser.svelte`): the app's session-id channel is the fragment, and\n * routing it through the shallow-routing API here would be the odd one out.\n *\n * Returns true when the address bar was actually changed.\n */\nexport function scrubTokenFromUrl(): boolean {\n\tif (typeof window === 'undefined' || !window.location) return false;\n\n\tconst loc = window.location;\n\tconst read = readUrlToken(loc.search || '', loc.hash || '');\n\tif (!read.present) return false;\n\n\t// replaceState, never pushState: a pushed entry would keep the secret alive\n\t// in the session history (and in the back button) after the URL is clean.\n\ttry {\n\t\tconst history = window.history;\n\t\tif (history && typeof history.replaceState === 'function') {\n\t\t\tconst path = loc.pathname || '/';\n\t\t\thistory.replaceState(\n\t\t\t\thistory.state ?? null,\n\t\t\t\t'',\n\t\t\t\t`${path}${read.search}${read.hash}`,\n\t\t\t);\n\t\t\treturn true;\n\t\t}\n\t} catch {\n\t\t// A failed scrub must not cost the user the token itself.\n\t}\n\treturn false;\n}\n\n/**\n * Adopts a token from the current page URL: persist it into the stored config\n * (MERGED, never replacing the object, so host/port/hideThinking/beepDefault\n * and the rest survive) and strip it from the address bar.\n *\n * Returns true when a token was actually stored.\n */\nexport function adoptTokenFromUrl(): boolean {\n\t// SSR/prerender: no window, nothing to adopt.\n\tif (typeof window === 'undefined' || !window.location) return false;\n\n\tconst loc = window.location;\n\tconst read = readUrlToken(loc.search || '', loc.hash || '');\n\tif (!read.present) return false;\n\n\t// Scrub FIRST, and regardless of whether the value turned out to be usable.\n\tscrubTokenFromUrl();\n\n\tif (!read.token) return false;\n\n\t// A corrupt entry is parsed in ITS OWN try, so it degrades to \"no stored\n\t// config\" (which is how getConfig() already treats it) instead of aborting\n\t// the adoption and leaving the user with no token at all.\n\tlet stored: Record<string, unknown> = {};\n\ttry {\n\t\tconst raw = localStorage.getItem(CONFIG_KEY);\n\t\tif (raw) {\n\t\t\tconst parsed = JSON.parse(raw);\n\t\t\tif (parsed && typeof parsed === 'object') {\n\t\t\t\tstored = parsed as Record<string, unknown>;\n\t\t\t}\n\t\t}\n\t} catch {\n\t\tstored = {};\n\t}\n\n\ttry {\n\t\t// A non-empty token in the URL wins over a stored one -- following a link\n\t\t// is an explicit act by the user -- but it overwrites the token FIELD\n\t\t// only. Never log or render the value.\n\t\tlocalStorage.setItem(\n\t\t\tCONFIG_KEY,\n\t\t\tJSON.stringify({...stored, token: read.token}),\n\t\t);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nlet adopted = false;\n\n/**\n * Idempotent entry point. Called from every place that reads the config early\n * (getConfig() in wherever.ts, session-store's module scope) so adoption has\n * always happened before the first read, no matter which module the route\n * pulled in first. Repeat calls are free.\n */\nexport function adoptTokenFromUrlOnce(): boolean {\n\tif (adopted) return false;\n\tadopted = true;\n\treturn adoptTokenFromUrl();\n}\n","import {writable, get} from 'svelte/store';\nimport {defaultAppearance, type AppearanceInfo} from '$lib/theme';\nimport {adoptTokenFromUrlOnce} from '$lib/core/token-adoption';\n\n// getToken()/getBaseUrl() below read the stored config STRAIGHT out of\n// localStorage, and a route can import this module without importing\n// wherever.ts, so adoption is kicked off here at module scope too. It is\n// idempotent and shares its state with the call in getConfig().\nadoptTokenFromUrlOnce();\n\nexport interface SessionInfo {\n\tpath: string;\n\tid: string;\n\tname?: string;\n\tcreated: string;\n\tmodified: string;\n\tmessageCount: number;\n\t// Short, capped preview of the first user message (not the full text).\n\tfirstMessage: string;\n\tisActive: boolean;\n\tclientCount: number;\n\t// Absolute path of the parent session this one was forked from, or undefined\n\t// for a root session. Used to build the fork-hierarchy tree in the browser.\n\tparentSessionPath?: string;\n}\n\nexport interface FolderWithSessions {\n\tpath: string;\n\tname: string;\n\tsessions: SessionInfo[];\n\treadOnly?: boolean;\n\t// True when this folder does not exist on this machine (the listing view of\n\t// the folder-missing state). ORTHOGONAL to readOnly, which is a configured\n\t// policy: a folder can be either, both or neither, so the browser renders the\n\t// two differently and never as one thing.\n\tmissing?: boolean;\n}\n\nexport interface ModelInfo {\n\tprovider: string;\n\tmodelId: string;\n\tlabel: string;\n\tisDefault?: boolean;\n}\n\nexport interface SessionStoreData {\n\tfolders: FolderWithSessions[];\n\tactiveSessions: string[];\n\tcurrentSession: string | null;\n\tloading: boolean;\n}\n\nexport interface ModelsStoreData {\n\tmodels: ModelInfo[];\n\tloading: boolean;\n}\n\nexport const sessionFolders = writable<SessionStoreData>({\n\tfolders: [],\n\tactiveSessions: [],\n\tcurrentSession: null,\n\tloading: false,\n});\n\nexport const availableModels = writable<ModelsStoreData>({\n\tmodels: [],\n\tloading: false,\n});\n\n// Separate store for the read-only sessions page (sessions.readOnly folders),\n// fetched on demand via /sessions?view=readonly. Kept distinct from the main\n// list so the default dashboard payload stays small.\nexport const readOnlySessionFolders = writable<SessionStoreData>({\n\tfolders: [],\n\tactiveSessions: [],\n\tcurrentSession: null,\n\tloading: false,\n});\n\n// Default port when none is explicitly configured: prefer the page's own\n// origin port so reverse-proxy deployments (e.g. https://host behind Caddy on\n// 443, no port in the URL) work without the user configuring a port. Falls\n// back to the dev default 31415 only when no usable location port exists.\nfunction defaultPort(): number {\n\tif (typeof window !== 'undefined' && window.location) {\n\t\tconst loc = window.location;\n\t\tif (loc.port) return Number(loc.port);\n\t\tif (loc.protocol === 'https:') return 443;\n\t\tif (loc.protocol === 'http:') return 80;\n\t}\n\treturn 31415;\n}\n\nexport function getBaseUrl(): string {\n\tconst config = localStorage.getItem('wherever-config');\n\tconst defaultHost =\n\t\ttypeof window !== 'undefined' && window.location && window.location.hostname\n\t\t\t? window.location.hostname\n\t\t\t: 'localhost';\n\n\tif (config) {\n\t\tconst parsed = JSON.parse(config);\n\t\tconst protocol = window.location.protocol === 'https:' ? 'https:' : 'http:';\n\t\tlet host = parsed.host || defaultHost;\n\t\tif (host === 'localhost' || host === '127.0.0.1') {\n\t\t\tif (\n\t\t\t\tdefaultHost &&\n\t\t\t\tdefaultHost !== 'localhost' &&\n\t\t\t\tdefaultHost !== '127.0.0.1'\n\t\t\t) {\n\t\t\t\thost = defaultHost;\n\t\t\t}\n\t\t}\n\t\thost = host.startsWith('http') ? host.replace(/^wss?:\\/\\//, '') : host;\n\t\t// Heal a legacy stored 31415 when actually served from another origin\n\t\t// port (matches getConfig() in wherever.ts), so proxied setups don't\n\t\t// dial a closed 31415.\n\t\tlet port = parsed.port;\n\t\tif ((port === 31415 || port === undefined) && defaultPort() !== 31415) {\n\t\t\tport = defaultPort();\n\t\t}\n\t\treturn `${protocol}//${host}:${port || defaultPort()}`;\n\t}\n\treturn `${window.location.protocol}//${window.location.host}`;\n}\n\nlet fetchTimeout: ReturnType<typeof setTimeout> | null = null;\nlet resolveQueue: (() => void)[] = [];\n// In-flight + coalescing guards: a stream of `sessions_updated` events (one per\n// agent turn) used to pull the whole list repeatedly. We now (a) never run two\n// fetches at once, (b) collapse any requests that arrive during a fetch into a\n// single trailing re-fetch, and (c) cap the debounce reset so a continuous\n// stream still resolves promptly instead of being pushed back forever.\nlet fetchInFlight = false;\nlet refetchRequested = false;\nlet firstQueuedAt = 0;\nconst FETCH_DEBOUNCE_MS = 150;\nconst FETCH_MAX_WAIT_MS = 1000;\n\nasync function doFetchSessions(): Promise<void> {\n\tfetchInFlight = true;\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/sessions${token ? `?token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = await res.json();\n\t\tsessionFolders.set({\n\t\t\tfolders: data.folders || [],\n\t\t\tactiveSessions: (data.activeSessions || []).map(\n\t\t\t\t(s: any) => s.sessionFile,\n\t\t\t),\n\t\t\tcurrentSession: get(sessionFolders).currentSession,\n\t\t\tloading: false,\n\t\t});\n\t} catch (err) {\n\t\tsessionFolders.update((s) => ({...s, loading: false}));\n\t\tconsole.error('Failed to fetch sessions:', err);\n\t} finally {\n\t\tfetchInFlight = false;\n\t}\n}\n\nexport function fetchSessions(): Promise<void> {\n\tsessionFolders.update((s) => ({...s, loading: true}));\n\n\tconst promise = new Promise<void>((resolve) => {\n\t\tresolveQueue.push(resolve);\n\t});\n\n\t// If a fetch is already running, just mark that we need one more pass when it\n\t// finishes (collapsing any number of mid-flight requests into a single one).\n\t// The resolver we just queued is drained by that trailing pass, so the\n\t// returned promise still settles even though we schedule nothing here.\n\tif (fetchInFlight) {\n\t\trefetchRequested = true;\n\t\treturn promise;\n\t}\n\n\tconst now = Date.now();\n\tif (!fetchTimeout) {\n\t\tfirstQueuedAt = now;\n\t} else {\n\t\tclearTimeout(fetchTimeout);\n\t\t// Cap the debounce: if we have already been waiting MAX_WAIT, fire now\n\t\t// rather than letting a continuous event stream postpone the fetch forever.\n\t\tif (now - firstQueuedAt >= FETCH_MAX_WAIT_MS) {\n\t\t\tfetchTimeout = null;\n\t\t\tvoid runQueuedFetch();\n\t\t\treturn promise;\n\t\t}\n\t}\n\n\tfetchTimeout = setTimeout(() => {\n\t\tfetchTimeout = null;\n\t\tvoid runQueuedFetch();\n\t}, FETCH_DEBOUNCE_MS);\n\n\treturn promise;\n}\n\nasync function runQueuedFetch(): Promise<void> {\n\ttry {\n\t\t// Each pass claims the resolvers queued so far and settles them with THAT\n\t\t// pass's data. Requests that arrive mid-flight queue their resolver and set\n\t\t// refetchRequested, so the loop runs one more pass and settles them against\n\t\t// fresher data. Claiming the queue up-front instead (the previous shape)\n\t\t// stranded any resolver added during the fetch: nothing scheduled a further\n\t\t// pass for it, so `await fetchSessions()` could hang forever.\n\t\tdo {\n\t\t\trefetchRequested = false;\n\t\t\tconst resolves = resolveQueue;\n\t\t\tresolveQueue = [];\n\t\t\ttry {\n\t\t\t\tawait doFetchSessions();\n\t\t\t} finally {\n\t\t\t\tfor (const r of resolves) r();\n\t\t\t}\n\t\t} while (refetchRequested);\n\t} finally {\n\t\t// Safety net: never strand a resolver, whatever happens above.\n\t\tconst rest = resolveQueue;\n\t\tresolveQueue = [];\n\t\tfor (const r of rest) r();\n\t}\n}\n\n// Fetch the read-only session folders (sessions.readOnly) for the separate\n// read-only page. Deliberately simple (no debounce/coalesce): it is only\n// triggered while that page is open, not on the hot dashboard path.\nexport async function fetchReadOnlySessions(): Promise<void> {\n\treadOnlySessionFolders.update((s) => ({...s, loading: true}));\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/sessions?view=readonly${token ? `&token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = await res.json();\n\t\treadOnlySessionFolders.set({\n\t\t\tfolders: data.folders || [],\n\t\t\tactiveSessions: (data.activeSessions || []).map(\n\t\t\t\t(s: any) => s.sessionFile,\n\t\t\t),\n\t\t\tcurrentSession: get(readOnlySessionFolders).currentSession,\n\t\t\tloading: false,\n\t\t});\n\t} catch (err) {\n\t\treadOnlySessionFolders.update((s) => ({...s, loading: false}));\n\t\tconsole.error('Failed to fetch read-only sessions:', err);\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Conversation search (GET /search), backed by the memonaut index server-side.\n// ---------------------------------------------------------------------------\n\n// One session file carrying a match. `sessionPath` is normalized by the SERVER\n// with the same rule as SessionInfo.path, so it can be handed straight to\n// switchSession() and matches the fork tree's nodes.\nexport interface SearchThreadResult {\n\tsessionPath: string;\n\tname: string | null;\n\tcwd: string;\n\tfolderName: string;\n\tproject: string | null;\n\tlastActivity: string | null;\n\tentryCount: number;\n\tseq: number;\n\t/** Entries this thread accumulated after the match: what tells forks apart. */\n\tafter: number;\n\tisRoot: boolean;\n\treadOnly: boolean;\n}\n\nexport interface SearchHitResult {\n\tentryKey: string;\n\trole: string;\n\tkind: string;\n\ttool: string | null;\n\tts: string | null;\n\t/** FTS5 snippet with \\u0001/\\u0002 match markers (see core/search-snippet.ts). */\n\tsnippet: string;\n\tscore: number;\n\t/** EVERY visible thread carrying this entry, most recently active first. */\n\tthreads: SearchThreadResult[];\n\tthreadTotal: number;\n\totherHits: number;\n}\n\nexport interface SearchResponse {\n\tstatus: 'ok' | 'not-indexed' | 'unavailable' | 'error';\n\tquery: string;\n\tusedQuery?: string;\n\tquotedFallback?: boolean;\n\thits: SearchHitResult[];\n\tscanned?: number;\n\thiddenHits?: number;\n\tindex?: {path: string; files: number; entries: number; newest: string | null};\n\tmessage?: string;\n}\n\n// The latest query wins: a superseded request is aborted rather than raced, so\n// a slow earlier response can never paint over a newer one.\nlet searchAbort: AbortController | null = null;\n\n/**\n * Run one conversation search. Never throws: a transport failure comes back as\n * status:'error' so the panel can explain itself, and an aborted (superseded)\n * request resolves to null so the caller simply keeps what it has.\n */\nexport async function searchConversations(\n\tquery: string,\n\tview: 'default' | 'readonly' = 'default',\n): Promise<SearchResponse | null> {\n\tsearchAbort?.abort();\n\tconst controller = new AbortController();\n\tsearchAbort = controller;\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst params = new URLSearchParams({q: query});\n\t\tif (view === 'readonly') params.set('view', 'readonly');\n\t\tif (token) params.set('token', token);\n\t\tconst res = await fetch(`${baseUrl}/search?${params.toString()}`, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\tif (!res.ok) {\n\t\t\treturn {\n\t\t\t\tstatus: 'error',\n\t\t\t\tquery,\n\t\t\t\thits: [],\n\t\t\t\tmessage:\n\t\t\t\t\tres.status === 401\n\t\t\t\t\t\t? 'Unauthorized: check the token in Connection Settings.'\n\t\t\t\t\t\t: `Search failed (HTTP ${res.status}).`,\n\t\t\t};\n\t\t}\n\t\treturn (await res.json()) as SearchResponse;\n\t} catch (err) {\n\t\tif ((err as Error)?.name === 'AbortError') return null;\n\t\treturn {\n\t\t\tstatus: 'error',\n\t\t\tquery,\n\t\t\thits: [],\n\t\t\tmessage: (err as Error)?.message || 'Search request failed.',\n\t\t};\n\t} finally {\n\t\tif (searchAbort === controller) searchAbort = null;\n\t}\n}\n\nexport async function fetchModels(): Promise<void> {\n\tavailableModels.update((s) => ({...s, loading: true}));\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/models${token ? `?token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = await res.json();\n\t\tavailableModels.set({\n\t\t\tmodels: data.models || [],\n\t\t\tloading: false,\n\t\t});\n\t} catch (err) {\n\t\tavailableModels.update((s) => ({...s, loading: false}));\n\t\tconsole.error('Failed to fetch models:', err);\n\t}\n}\n\nexport function getToken(): string {\n\ttry {\n\t\tconst config = localStorage.getItem('wherever-config');\n\t\tif (config) {\n\t\t\tconst parsed = JSON.parse(config);\n\t\t\treturn parsed.token || '';\n\t\t}\n\t} catch {}\n\treturn '';\n}\n\nexport const gitInitDefaultStore = writable<boolean>(false);\nexport const uploadMethodStore = writable<'websocket' | 'post'>('websocket');\nexport const searchFolderStore = writable<string | null>(null);\nexport const searchCreateRemoteStore = writable<boolean>(false);\n// Default model (as \"provider:modelId\") for the configured search folder,\n// resolved server-side against that folder's settings. null when unset.\nexport const searchDefaultModelStore = writable<string | null>(null);\n\n/** Visual identity of the connected server instance (label + theme overrides). */\nexport const appearanceStore = writable<AppearanceInfo>(defaultAppearance);\n\nexport interface PathCheckResult {\n\texists: boolean;\n\tisGit: boolean;\n\tresolvedPath: string;\n}\n\nexport async function checkPath(\n\tpathStr: string,\n): Promise<PathCheckResult | null> {\n\tif (!pathStr.trim()) return null;\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/check-path?path=${encodeURIComponent(pathStr)}${token ? `&token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\treturn (await res.json()) as PathCheckResult;\n\t} catch (err) {\n\t\tconsole.error('Failed to check path:', err);\n\t\treturn null;\n\t}\n}\n\nexport interface RemoteRepoCheckResult {\n\tmatched: boolean;\n\tprovider?: string;\n\texists: boolean;\n\tsshUrl?: string;\n}\n\n/**\n * Submit-time probe: ask the server whether the remote repo that would be\n * created for `pathStr` already exists. Runs a provider CLI on the server, so\n * this is called ON DEMAND at create time, never on every keystroke.\n */\nexport async function checkRemoteRepo(\n\tpathStr: string,\n): Promise<RemoteRepoCheckResult | null> {\n\tif (!pathStr.trim()) return null;\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/check-remote-repo?path=${encodeURIComponent(pathStr)}${token ? `&token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\treturn (await res.json()) as RemoteRepoCheckResult;\n\t} catch (err) {\n\t\tconsole.error('Failed to check remote repo:', err);\n\t\treturn null;\n\t}\n}\n\nexport interface RemoteCandidate {\n\t/** An scp-style SSH URL (`git@host:owner/repo.git`). Never HTTPS. */\n\turl: string;\n\tsource: 'probe' | 'path-convention';\n}\n\nexport interface RemoteCandidatesResult {\n\tresolvedPath: string;\n\tcandidates: RemoteCandidate[];\n}\n\n/**\n * Which repository does this (missing) folder probably correspond to?\n *\n * Answers an ORDERED, ADVISORY list of SSH candidates -- the provider probe\n * first, then the `<host-token>/<owner>/<repo>` path convention -- used to\n * PRE-FILL the restore panel's editable url field so a repository can be\n * restored from a phone without typing one. Advisory only: the server clones\n * what it is finally given, not what it guessed, and an empty list is an honest\n * answer the user pastes over.\n *\n * The probe shells out to a provider CLI, so this is called ON DEMAND (the panel\n * opening), never per keystroke.\n */\nexport async function fetchRemoteCandidates(\n\tpathStr: string,\n): Promise<RemoteCandidate[]> {\n\tif (!pathStr.trim()) return [];\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/remote-candidates?path=${encodeURIComponent(pathStr)}${token ? `&token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = (await res.json()) as RemoteCandidatesResult;\n\t\treturn Array.isArray(data.candidates) ? data.candidates : [];\n\t} catch (err) {\n\t\t// A candidate is a convenience, never a gate: an unreachable endpoint leaves\n\t\t// the field empty and the user pastes a url.\n\t\tconsole.error('Failed to resolve remote candidates:', err);\n\t\treturn [];\n\t}\n}\n\nexport interface PathAutocompleteResult {\n\tcompletions: string[];\n}\n\nexport async function autocompletePath(pathStr: string): Promise<string[]> {\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/autocomplete-path?path=${encodeURIComponent(pathStr)}${token ? `&token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = (await res.json()) as PathAutocompleteResult;\n\t\treturn data.completions || [];\n\t} catch (err) {\n\t\tconsole.error('Failed to autocomplete path:', err);\n\t\treturn [];\n\t}\n}\n\nexport async function fetchConfig(): Promise<void> {\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/config${token ? `?token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = await res.json();\n\t\tgitInitDefaultStore.set(!!data.gitInitDefault);\n\t\tuploadMethodStore.set(data.uploadMethod || 'websocket');\n\t\tsearchFolderStore.set(data.searchFolder || null);\n\t\tsearchCreateRemoteStore.set(!!data.searchCreateRemote);\n\t\tsearchDefaultModelStore.set(data.searchDefaultModel || null);\n\t\tconst appearance: AppearanceInfo = {\n\t\t\tlabel: data.appearance?.label || '',\n\t\t\taccent: data.appearance?.accent || null,\n\t\t\tcolors: data.appearance?.colors || null,\n\t\t\tframe: !!data.appearance?.frame,\n\t\t\tpattern: data.appearance?.pattern || 'none',\n\t\t};\n\t\t// Publishing the appearance is all this module does with it: painting it\n\t\t// onto the document belongs to the UI (+layout.svelte), which re-themes\n\t\t// whenever this store changes. Keeping the DOM write out of here means the\n\t\t// transport layer stays testable without a document.\n\t\tappearanceStore.set(appearance);\n\t} catch (err) {\n\t\tconsole.error('Failed to fetch config:', err);\n\t}\n}\n\nexport function setCurrentSession(sessionId: string | null): void {\n\tsessionFolders.update((s) => ({...s, currentSession: sessionId}));\n}\n"],"names":["index","_","i","pause_effects","state","to_destroy","controlled_anchor","transitions","length","group","remaining","effect","pause_effect","groups","destroy_effects","array_from","fast_path","anchor","parent_node","clear_text_content","remove_dom","preserved_effects","keys","key","e","EFFECT_OFFSCREEN","fragment","move_effect","destroy_effect","offscreen_anchor","each","node","flags","get_collection","get_key","render_fn","fallback_fn","items","is_controlled","EACH_IS_CONTROLLED","hydrating","set_hydrate_node","get_first_child","create_text","hydrate_next","fallback","each_array","derived_safe_equal","collection","is_array","array","pending","first_run","commit","batch","DESTROYED","reconcile","resume_effect","move","discard","block","get","mismatch","is_else","read_hydration_instruction","HYDRATION_START_ELSE","skip_nodes","set_hydrating","current_batch","defer","should_defer_append","hydrate_node","COMMENT_NODE","HYDRATION_END","value","item","internal_set","create_item","branch","e.each_key_duplicate","skip_to_branch","BRANCH_EFFECT","is_animated","EACH_IS_ANIMATED","current","seen","prev","to_animate","matched","stashed","INERT","next","link","start","j","a","b","destroy_length","queue_micro_task","v","EACH_ITEM_REACTIVE","EACH_ITEM_IMMUTABLE","mutable_source","source","EACH_INDEX_REACTIVE","end","dest","next_node","get_next_sibling","IS_CUSTOM_ELEMENT","IS_HTML","LINK_TAG","IS_XHTML","PROGRESS_TAG","remove_input_defaults","input","already_removed","remove_defaults","set_attribute","checked","FORM_RESET_HANDLER","add_form_reset_listener","set_value","element","attributes","get_attributes","set_checked","attribute","skip_warning","LOADING_ATTR_SYMBOL","get_setters","ATTRIBUTES_CACHE","NAMESPACE_HTML","setters_cache","cache_key","setters","descriptors","proto","element_proto","get_descriptors","get_prototype_of","pathname_prefix","resolve","args","base","resolve_route","noop","noopLogger","_getFactory","logs","o","n","r","handleAutomaticUpdate","registration","intervals","lastFocusTime","wakeup","evt","timePassed","listenForWaitingServiceWorker","callback","awaitStateChange","createNotificationsService","lastId","store","writable","add","notification","notifications","remove","id","onClick","pushState","page","logger","updateLoggingForWorker","worker","IDLE_DELAY_MS","CHECK_DELAY_MS","createServiceWorker","pingServideWorker","sendMessage","message","$serviceWorker","skipWaiting","skip","register","refreshing","event","swLocation","getParamsFromURL","url","obj","hash","cleanedUrl","question","piece","val","pathname","getParamsFromLocation","getHashParamsFromLocation","str","serviceWorker","params","version","TOKEN_VARS","ACCENT_VARS","defaultAppearance","applyAppearance","appearance","root","cssVar","CONFIG_KEY","TOKEN_PARAM","takeToken","raw","prefix","body","k","candidate","readUrlToken","search","fromHash","fromSearch","scrubTokenFromUrl","loc","read","history","path","adoptTokenFromUrl","stored","parsed","adopted","adoptTokenFromUrlOnce","sessionFolders","availableModels","readOnlySessionFolders","defaultPort","getBaseUrl","config","defaultHost","protocol","host","port","fetchTimeout","resolveQueue","fetchInFlight","refetchRequested","firstQueuedAt","FETCH_DEBOUNCE_MS","FETCH_MAX_WAIT_MS","doFetchSessions","baseUrl","token","getToken","res","data","s","err","fetchSessions","promise","now","runQueuedFetch","resolves","rest","fetchReadOnlySessions","searchAbort","searchConversations","query","view","controller","fetchModels","gitInitDefaultStore","uploadMethodStore","searchFolderStore","searchCreateRemoteStore","searchDefaultModelStore","appearanceStore","checkPath","pathStr","checkRemoteRepo","fetchRemoteCandidates","autocompletePath","fetchConfig","setCurrentSession","sessionId"],"mappings":"yhBAsDO,SAASA,GAAMC,EAAGC,EAAG,CAC3B,OAAOA,CACR,CASA,SAASC,GAAcC,EAAOC,EAAYC,EAAmB,CAS5D,QAPIC,EAAc,CAAA,EACdC,EAASH,EAAW,OAGpBI,EACAC,EAAYL,EAAW,OAElBH,EAAI,EAAGA,EAAIM,EAAQN,IAAK,CAChC,IAAIS,EAASN,EAAWH,CAAC,EAEzBU,GACCD,EACA,IAAM,CACL,GAAIF,GAIH,GAHAA,EAAM,QAAQ,OAAOE,CAAM,EAC3BF,EAAM,KAAK,IAAIE,CAAM,EAEjBF,EAAM,QAAQ,OAAS,EAAG,CAC7B,IAAII,EAA6CT,EAAM,YAEvDU,GAAgBV,EAAOW,GAAWN,EAAM,IAAI,CAAC,EAC7CI,EAAO,OAAOJ,CAAK,EAEfI,EAAO,OAAS,IACnBT,EAAM,YAAc,KAEtB,OAEAM,GAAa,CAEf,EACA,EACH,CACC,CAEA,GAAIA,IAAc,EAAG,CAIpB,I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../node_modules/.pnpm/svelte@5.55.9/node_modules/svelte/src/internal/client/dom/blocks/each.js","../../../../../../../node_modules/.pnpm/svelte@5.55.9/node_modules/svelte/src/internal/client/dom/elements/attributes.js","../../../../../../../node_modules/.pnpm/@sveltejs+kit@2.60.1_@opentelemetry+api@1.9.0_@sveltejs+vite-plugin-svelte@6.2.4_svelte_92561c5307f67095f16bb8153283369b/node_modules/@sveltejs/kit/src/runtime/app/paths/client.js","../../../../../../../node_modules/.pnpm/named-logs@0.4.1/node_modules/named-logs/dist/esm/index.js","../../../../../../src/lib/core/service-worker/utils.ts","../../../../../../src/lib/core/notifications/index.ts","../../../../../../src/lib/core/service-worker/index.ts","../../../../../../src/lib/core/utils/web/url.ts","../../../../../../src/lib/core/config.ts","../../../../../../src/lib/theme.ts","../../../../../../src/lib/core/token-adoption.ts","../../../../../../src/lib/session-store.ts"],"sourcesContent":["/** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, Source, TemplateNode, TransitionManager, Value } from '#client' */\n/** @import { Batch } from '../../reactivity/batch.js'; */\nimport {\n\tEACH_INDEX_REACTIVE,\n\tEACH_IS_ANIMATED,\n\tEACH_IS_CONTROLLED,\n\tEACH_ITEM_IMMUTABLE,\n\tEACH_ITEM_REACTIVE,\n\tHYDRATION_END,\n\tHYDRATION_START_ELSE\n} from '../../../../constants.js';\nimport {\n\thydrate_next,\n\thydrate_node,\n\thydrating,\n\tread_hydration_instruction,\n\tskip_nodes,\n\tset_hydrate_node,\n\tset_hydrating\n} from '../hydration.js';\nimport {\n\tclear_text_content,\n\tcreate_text,\n\tget_first_child,\n\tget_next_sibling,\n\tshould_defer_append\n} from '../operations.js';\nimport {\n\tblock,\n\tbranch,\n\tdestroy_effect,\n\tmove_effect,\n\tpause_effect,\n\tresume_effect\n} from '../../reactivity/effects.js';\nimport { source, mutable_source, internal_set } from '../../reactivity/sources.js';\nimport { array_from, is_array } from '../../../shared/utils.js';\nimport { BRANCH_EFFECT, COMMENT_NODE, DESTROYED, EFFECT_OFFSCREEN, INERT } from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { get } from '../../runtime.js';\nimport { DEV } from 'esm-env';\nimport { derived_safe_equal } from '../../reactivity/deriveds.js';\nimport { current_batch } from '../../reactivity/batch.js';\nimport * as e from '../../errors.js';\nimport { tag } from '../../dev/tracing.js';\n\n// When making substantive changes to this file, validate them with the each block stress test:\n// https://svelte.dev/playground/1972b2cf46564476ad8c8c6405b23b7b\n// This test also exists in this repo, as `packages/svelte/tests/manual/each-stress-test`\n\n/**\n * @param {any} _\n * @param {number} i\n */\nexport function index(_, i) {\n\treturn i;\n}\n\n/**\n * Pause multiple effects simultaneously, and coordinate their\n * subsequent destruction. Used in each blocks\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {null | Node} controlled_anchor\n */\nfunction pause_effects(state, to_destroy, controlled_anchor) {\n\t/** @type {TransitionManager[]} */\n\tvar transitions = [];\n\tvar length = to_destroy.length;\n\n\t/** @type {EachOutroGroup} */\n\tvar group;\n\tvar remaining = to_destroy.length;\n\n\tfor (var i = 0; i < length; i++) {\n\t\tlet effect = to_destroy[i];\n\n\t\tpause_effect(\n\t\t\teffect,\n\t\t\t() => {\n\t\t\t\tif (group) {\n\t\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\t\tgroup.done.add(effect);\n\n\t\t\t\t\tif (group.pending.size === 0) {\n\t\t\t\t\t\tvar groups = /** @type {Set<EachOutroGroup>} */ (state.outrogroups);\n\n\t\t\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\t\t\tgroups.delete(group);\n\n\t\t\t\t\t\tif (groups.size === 0) {\n\t\t\t\t\t\t\tstate.outrogroups = null;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tremaining -= 1;\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\t}\n\n\tif (remaining === 0) {\n\t\t// If we're in a controlled each block (i.e. the block is the only child of an\n\t\t// element), and we are removing all items, _and_ there are no out transitions,\n\t\t// we can use the fast path — emptying the element and replacing the anchor\n\t\tvar fast_path = transitions.length === 0 && controlled_anchor !== null;\n\n\t\tif (fast_path) {\n\t\t\tvar anchor = /** @type {Element} */ (controlled_anchor);\n\t\t\tvar parent_node = /** @type {Element} */ (anchor.parentNode);\n\n\t\t\tclear_text_content(parent_node);\n\t\t\tparent_node.append(anchor);\n\n\t\t\tstate.items.clear();\n\t\t}\n\n\t\tdestroy_effects(state, to_destroy, !fast_path);\n\t} else {\n\t\tgroup = {\n\t\t\tpending: new Set(to_destroy),\n\t\t\tdone: new Set()\n\t\t};\n\n\t\t(state.outrogroups ??= new Set()).add(group);\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect[]} to_destroy\n * @param {boolean} remove_dom\n */\nfunction destroy_effects(state, to_destroy, remove_dom = true) {\n\t/** @type {Set<Effect> | undefined} */\n\tvar preserved_effects;\n\n\t// The loop-in-a-loop isn't ideal, but we should only hit this in relatively rare cases\n\tif (state.pending.size > 0) {\n\t\tpreserved_effects = new Set();\n\n\t\tfor (const keys of state.pending.values()) {\n\t\t\tfor (const key of keys) {\n\t\t\t\tpreserved_effects.add(/** @type {EachItem} */ (state.items.get(key)).e);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (var i = 0; i < to_destroy.length; i++) {\n\t\tvar e = to_destroy[i];\n\n\t\tif (preserved_effects?.has(e)) {\n\t\t\te.f |= EFFECT_OFFSCREEN;\n\n\t\t\tconst fragment = document.createDocumentFragment();\n\t\t\tmove_effect(e, fragment);\n\t\t} else {\n\t\t\tdestroy_effect(to_destroy[i], remove_dom);\n\t\t}\n\t}\n}\n\n/** @type {TemplateNode} */\nvar offscreen_anchor;\n\n/**\n * @template V\n * @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @param {(value: V, index: number) => any} get_key\n * @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn\n * @param {null | ((anchor: Node) => void)} fallback_fn\n * @returns {void}\n */\nexport function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {\n\tvar anchor = node;\n\n\t/** @type {Map<any, EachItem>} */\n\tvar items = new Map();\n\n\tvar is_controlled = (flags & EACH_IS_CONTROLLED) !== 0;\n\n\tif (is_controlled) {\n\t\tvar parent_node = /** @type {Element} */ (node);\n\n\t\tanchor = hydrating\n\t\t\t? set_hydrate_node(get_first_child(parent_node))\n\t\t\t: parent_node.appendChild(create_text());\n\t}\n\n\tif (hydrating) {\n\t\thydrate_next();\n\t}\n\n\t/** @type {Effect | null} */\n\tvar fallback = null;\n\n\t// TODO: ideally we could use derived for runes mode but because of the ability\n\t// to use a store which can be mutated, we can't do that here as mutating a store\n\t// will still result in the collection array being the same from the store\n\tvar each_array = derived_safe_equal(() => {\n\t\tvar collection = get_collection();\n\n\t\treturn is_array(collection) ? collection : collection == null ? [] : array_from(collection);\n\t});\n\n\tif (DEV) {\n\t\ttag(each_array, '{#each ...}');\n\t}\n\n\t/** @type {V[]} */\n\tvar array;\n\n\t/** @type {Map<Batch, Set<any>>} */\n\tvar pending = new Map();\n\n\tvar first_run = true;\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction commit(batch) {\n\t\tif ((state.effect.f & DESTROYED) !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tstate.pending.delete(batch);\n\n\t\tstate.fallback = fallback;\n\t\treconcile(state, array, anchor, flags, get_key);\n\n\t\tif (fallback !== null) {\n\t\t\tif (array.length === 0) {\n\t\t\t\tif ((fallback.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\t\tresume_effect(fallback);\n\t\t\t\t} else {\n\t\t\t\t\tfallback.f ^= EFFECT_OFFSCREEN;\n\t\t\t\t\tmove(fallback, null, anchor);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpause_effect(fallback, () => {\n\t\t\t\t\t// TODO only null out if no pending batch needs it,\n\t\t\t\t\t// otherwise re-add `fallback.fragment` and move the\n\t\t\t\t\t// effect into it\n\t\t\t\t\tfallback = null;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param {Batch} batch\n\t */\n\tfunction discard(batch) {\n\t\tstate.pending.delete(batch);\n\t}\n\n\tvar effect = block(() => {\n\t\tarray = /** @type {V[]} */ (get(each_array));\n\t\tvar length = array.length;\n\n\t\t/** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */\n\t\tlet mismatch = false;\n\n\t\tif (hydrating) {\n\t\t\tvar is_else = read_hydration_instruction(anchor) === HYDRATION_START_ELSE;\n\n\t\t\tif (is_else !== (length === 0)) {\n\t\t\t\t// hydration mismatch — remove the server-rendered DOM and start over\n\t\t\t\tanchor = skip_nodes();\n\n\t\t\t\tset_hydrate_node(anchor);\n\t\t\t\tset_hydrating(false);\n\t\t\t\tmismatch = true;\n\t\t\t}\n\t\t}\n\n\t\tvar keys = new Set();\n\t\tvar batch = /** @type {Batch} */ (current_batch);\n\t\tvar defer = should_defer_append();\n\n\t\tfor (var index = 0; index < length; index += 1) {\n\t\t\tif (\n\t\t\t\thydrating &&\n\t\t\t\thydrate_node.nodeType === COMMENT_NODE &&\n\t\t\t\t/** @type {Comment} */ (hydrate_node).data === HYDRATION_END\n\t\t\t) {\n\t\t\t\t// The server rendered fewer items than expected,\n\t\t\t\t// so break out and continue appending non-hydrated items\n\t\t\t\tanchor = /** @type {Comment} */ (hydrate_node);\n\t\t\t\tmismatch = true;\n\t\t\t\tset_hydrating(false);\n\t\t\t}\n\n\t\t\tvar value = array[index];\n\t\t\tvar key = get_key(value, index);\n\n\t\t\tif (DEV) {\n\t\t\t\t// Check that the key function is idempotent (returns the same value when called twice)\n\t\t\t\tvar key_again = get_key(value, index);\n\t\t\t\tif (key !== key_again) {\n\t\t\t\t\te.each_key_volatile(String(index), String(key), String(key_again));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar item = first_run ? null : items.get(key);\n\n\t\t\tif (item) {\n\t\t\t\t// update before reconciliation, to trigger any async updates\n\t\t\t\tif (item.v) internal_set(item.v, value);\n\t\t\t\tif (item.i) internal_set(item.i, index);\n\n\t\t\t\tif (defer) {\n\t\t\t\t\tbatch.unskip_effect(item.e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\titem = create_item(\n\t\t\t\t\titems,\n\t\t\t\t\tfirst_run ? anchor : (offscreen_anchor ??= create_text()),\n\t\t\t\t\tvalue,\n\t\t\t\t\tkey,\n\t\t\t\t\tindex,\n\t\t\t\t\trender_fn,\n\t\t\t\t\tflags,\n\t\t\t\t\tget_collection\n\t\t\t\t);\n\n\t\t\t\tif (!first_run) {\n\t\t\t\t\titem.e.f |= EFFECT_OFFSCREEN;\n\t\t\t\t}\n\n\t\t\t\titems.set(key, item);\n\t\t\t}\n\n\t\t\tkeys.add(key);\n\t\t}\n\n\t\tif (length === 0 && fallback_fn && !fallback) {\n\t\t\tif (first_run) {\n\t\t\t\tfallback = branch(() => fallback_fn(anchor));\n\t\t\t} else {\n\t\t\t\tfallback = branch(() => fallback_fn((offscreen_anchor ??= create_text())));\n\t\t\t\tfallback.f |= EFFECT_OFFSCREEN;\n\t\t\t}\n\t\t}\n\n\t\tif (length > keys.size) {\n\t\t\tif (DEV) {\n\t\t\t\tvalidate_each_keys(array, get_key);\n\t\t\t} else {\n\t\t\t\t// in prod, the additional information isn't printed, so don't bother computing it\n\t\t\t\te.each_key_duplicate('', '', '');\n\t\t\t}\n\t\t}\n\n\t\t// remove excess nodes\n\t\tif (hydrating && length > 0) {\n\t\t\tset_hydrate_node(skip_nodes());\n\t\t}\n\n\t\tif (!first_run) {\n\t\t\tpending.set(batch, keys);\n\n\t\t\tif (defer) {\n\t\t\t\tfor (const [key, item] of items) {\n\t\t\t\t\tif (!keys.has(key)) {\n\t\t\t\t\t\tbatch.skip_effect(item.e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tbatch.oncommit(commit);\n\t\t\t\tbatch.ondiscard(discard);\n\t\t\t} else {\n\t\t\t\tcommit(batch);\n\t\t\t}\n\t\t}\n\n\t\tif (mismatch) {\n\t\t\t// continue in hydration mode\n\t\t\tset_hydrating(true);\n\t\t}\n\n\t\t// When we mount the each block for the first time, the collection won't be\n\t\t// connected to this effect as the effect hasn't finished running yet and its deps\n\t\t// won't be assigned. However, it's possible that when reconciling the each block\n\t\t// that a mutation occurred and it's made the collection MAYBE_DIRTY, so reading the\n\t\t// collection again can provide consistency to the reactive graph again as the deriveds\n\t\t// will now be `CLEAN`.\n\t\tget(each_array);\n\t});\n\n\t/** @type {EachState} */\n\tvar state = { effect, flags, items, pending, outrogroups: null, fallback };\n\n\tfirst_run = false;\n\n\tif (hydrating) {\n\t\tanchor = hydrate_node;\n\t}\n}\n\n/**\n * Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect\n * @param {Effect | null} effect\n * @returns {Effect | null}\n */\nfunction skip_to_branch(effect) {\n\twhile (effect !== null && (effect.f & BRANCH_EFFECT) === 0) {\n\t\teffect = effect.next;\n\t}\n\treturn effect;\n}\n\n/**\n * Add, remove, or reorder items output by an each block as its input changes\n * @template V\n * @param {EachState} state\n * @param {Array<V>} array\n * @param {Element | Comment | Text} anchor\n * @param {number} flags\n * @param {(value: V, index: number) => any} get_key\n * @returns {void}\n */\nfunction reconcile(state, array, anchor, flags, get_key) {\n\tvar is_animated = (flags & EACH_IS_ANIMATED) !== 0;\n\n\tvar length = array.length;\n\tvar items = state.items;\n\tvar current = skip_to_branch(state.effect.first);\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar seen;\n\n\t/** @type {Effect | null} */\n\tvar prev = null;\n\n\t/** @type {undefined | Set<Effect>} */\n\tvar to_animate;\n\n\t/** @type {Effect[]} */\n\tvar matched = [];\n\n\t/** @type {Effect[]} */\n\tvar stashed = [];\n\n\t/** @type {V} */\n\tvar value;\n\n\t/** @type {any} */\n\tvar key;\n\n\t/** @type {Effect | undefined} */\n\tvar effect;\n\n\t/** @type {number} */\n\tvar i;\n\n\tif (is_animated) {\n\t\tfor (i = 0; i < length; i += 1) {\n\t\t\tvalue = array[i];\n\t\t\tkey = get_key(value, i);\n\t\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\t\t// offscreen == coming in now, no animation in that case,\n\t\t\t// else this would happen https://github.com/sveltejs/svelte/issues/17181\n\t\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\t\teffect.nodes?.a?.measure();\n\t\t\t\t(to_animate ??= new Set()).add(effect);\n\t\t\t}\n\t\t}\n\t}\n\n\tfor (i = 0; i < length; i += 1) {\n\t\tvalue = array[i];\n\t\tkey = get_key(value, i);\n\n\t\teffect = /** @type {EachItem} */ (items.get(key)).e;\n\n\t\tif (state.outrogroups !== null) {\n\t\t\tfor (const group of state.outrogroups) {\n\t\t\t\tgroup.pending.delete(effect);\n\t\t\t\tgroup.done.delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & INERT) !== 0) {\n\t\t\tresume_effect(effect);\n\t\t\tif (is_animated) {\n\t\t\t\teffect.nodes?.a?.unfix();\n\t\t\t\t(to_animate ??= new Set()).delete(effect);\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) !== 0) {\n\t\t\teffect.f ^= EFFECT_OFFSCREEN;\n\n\t\t\tif (effect === current) {\n\t\t\t\tmove(effect, null, anchor);\n\t\t\t} else {\n\t\t\t\tvar next = prev ? prev.next : current;\n\n\t\t\t\tif (effect === state.effect.last) {\n\t\t\t\t\tstate.effect.last = effect.prev;\n\t\t\t\t}\n\n\t\t\t\tif (effect.prev) effect.prev.next = effect.next;\n\t\t\t\tif (effect.next) effect.next.prev = effect.prev;\n\t\t\t\tlink(state, prev, effect);\n\t\t\t\tlink(state, effect, next);\n\n\t\t\t\tmove(effect, next, anchor);\n\t\t\t\tprev = effect;\n\n\t\t\t\tmatched = [];\n\t\t\t\tstashed = [];\n\n\t\t\t\tcurrent = skip_to_branch(prev.next);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif (effect !== current) {\n\t\t\tif (seen !== undefined && seen.has(effect)) {\n\t\t\t\tif (matched.length < stashed.length) {\n\t\t\t\t\t// more efficient to move later items to the front\n\t\t\t\t\tvar start = stashed[0];\n\t\t\t\t\tvar j;\n\n\t\t\t\t\tprev = start.prev;\n\n\t\t\t\t\tvar a = matched[0];\n\t\t\t\t\tvar b = matched[matched.length - 1];\n\n\t\t\t\t\tfor (j = 0; j < matched.length; j += 1) {\n\t\t\t\t\t\tmove(matched[j], start, anchor);\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (j = 0; j < stashed.length; j += 1) {\n\t\t\t\t\t\tseen.delete(stashed[j]);\n\t\t\t\t\t}\n\n\t\t\t\t\tlink(state, a.prev, b.next);\n\t\t\t\t\tlink(state, prev, a);\n\t\t\t\t\tlink(state, b, start);\n\n\t\t\t\t\tcurrent = start;\n\t\t\t\t\tprev = b;\n\t\t\t\t\ti -= 1;\n\n\t\t\t\t\tmatched = [];\n\t\t\t\t\tstashed = [];\n\t\t\t\t} else {\n\t\t\t\t\t// more efficient to move earlier items to the back\n\t\t\t\t\tseen.delete(effect);\n\t\t\t\t\tmove(effect, current, anchor);\n\n\t\t\t\t\tlink(state, effect.prev, effect.next);\n\t\t\t\t\tlink(state, effect, prev === null ? state.effect.first : prev.next);\n\t\t\t\t\tlink(state, prev, effect);\n\n\t\t\t\t\tprev = effect;\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tmatched = [];\n\t\t\tstashed = [];\n\n\t\t\twhile (current !== null && current !== effect) {\n\t\t\t\t(seen ??= new Set()).add(current);\n\t\t\t\tstashed.push(current);\n\t\t\t\tcurrent = skip_to_branch(current.next);\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tif ((effect.f & EFFECT_OFFSCREEN) === 0) {\n\t\t\tmatched.push(effect);\n\t\t}\n\n\t\tprev = effect;\n\t\tcurrent = skip_to_branch(effect.next);\n\t}\n\n\tif (state.outrogroups !== null) {\n\t\tfor (const group of state.outrogroups) {\n\t\t\tif (group.pending.size === 0) {\n\t\t\t\tdestroy_effects(state, array_from(group.done));\n\t\t\t\tstate.outrogroups?.delete(group);\n\t\t\t}\n\t\t}\n\n\t\tif (state.outrogroups.size === 0) {\n\t\t\tstate.outrogroups = null;\n\t\t}\n\t}\n\n\tif (current !== null || seen !== undefined) {\n\t\t/** @type {Effect[]} */\n\t\tvar to_destroy = [];\n\n\t\tif (seen !== undefined) {\n\t\t\tfor (effect of seen) {\n\t\t\t\tif ((effect.f & INERT) === 0) {\n\t\t\t\t\tto_destroy.push(effect);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twhile (current !== null) {\n\t\t\t// If the each block isn't inert, then inert effects are currently outroing and will be removed once the transition is finished\n\t\t\tif ((current.f & INERT) === 0 && current !== state.fallback) {\n\t\t\t\tto_destroy.push(current);\n\t\t\t}\n\n\t\t\tcurrent = skip_to_branch(current.next);\n\t\t}\n\n\t\tvar destroy_length = to_destroy.length;\n\n\t\tif (destroy_length > 0) {\n\t\t\tvar controlled_anchor = (flags & EACH_IS_CONTROLLED) !== 0 && length === 0 ? anchor : null;\n\n\t\t\tif (is_animated) {\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.measure();\n\t\t\t\t}\n\n\t\t\t\tfor (i = 0; i < destroy_length; i += 1) {\n\t\t\t\t\tto_destroy[i].nodes?.a?.fix();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpause_effects(state, to_destroy, controlled_anchor);\n\t\t}\n\t}\n\n\tif (is_animated) {\n\t\tqueue_micro_task(() => {\n\t\t\tif (to_animate === undefined) return;\n\t\t\tfor (effect of to_animate) {\n\t\t\t\teffect.nodes?.a?.apply();\n\t\t\t}\n\t\t});\n\t}\n}\n\n/**\n * @template V\n * @param {Map<any, EachItem>} items\n * @param {Node} anchor\n * @param {V} value\n * @param {unknown} key\n * @param {number} index\n * @param {(anchor: Node, item: V | Source<V>, index: number | Value<number>, collection: () => V[]) => void} render_fn\n * @param {number} flags\n * @param {() => V[]} get_collection\n * @returns {EachItem}\n */\nfunction create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {\n\tvar v =\n\t\t(flags & EACH_ITEM_REACTIVE) !== 0\n\t\t\t? (flags & EACH_ITEM_IMMUTABLE) === 0\n\t\t\t\t? mutable_source(value, false, false)\n\t\t\t\t: source(value)\n\t\t\t: null;\n\n\tvar i = (flags & EACH_INDEX_REACTIVE) !== 0 ? source(index) : null;\n\n\tif (DEV && v) {\n\t\t// For tracing purposes, we need to link the source signal we create with the\n\t\t// collection + index so that tracing works as intended\n\t\tv.trace = () => {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unused-expressions\n\t\t\tget_collection()[i?.v ?? index];\n\t\t};\n\t}\n\n\treturn {\n\t\tv,\n\t\ti,\n\t\te: branch(() => {\n\t\t\trender_fn(anchor, v ?? value, i ?? index, get_collection);\n\n\t\t\treturn () => {\n\t\t\t\titems.delete(key);\n\t\t\t};\n\t\t})\n\t};\n}\n\n/**\n * @param {Effect} effect\n * @param {Effect | null} next\n * @param {Text | Element | Comment} anchor\n */\nfunction move(effect, next, anchor) {\n\tif (!effect.nodes) return;\n\n\tvar node = effect.nodes.start;\n\tvar end = effect.nodes.end;\n\n\tvar dest =\n\t\tnext && (next.f & EFFECT_OFFSCREEN) === 0\n\t\t\t? /** @type {EffectNodes} */ (next.nodes).start\n\t\t\t: anchor;\n\n\twhile (node !== null) {\n\t\tvar next_node = /** @type {TemplateNode} */ (get_next_sibling(node));\n\t\tdest.before(node);\n\n\t\tif (node === end) {\n\t\t\treturn;\n\t\t}\n\n\t\tnode = next_node;\n\t}\n}\n\n/**\n * @param {EachState} state\n * @param {Effect | null} prev\n * @param {Effect | null} next\n */\nfunction link(state, prev, next) {\n\tif (prev === null) {\n\t\tstate.effect.first = next;\n\t} else {\n\t\tprev.next = next;\n\t}\n\n\tif (next === null) {\n\t\tstate.effect.last = prev;\n\t} else {\n\t\tnext.prev = prev;\n\t}\n}\n\n/**\n * @param {Array<any>} array\n * @param {(item: any, index: number) => string} key_fn\n * @returns {void}\n */\nfunction validate_each_keys(array, key_fn) {\n\tconst keys = new Map();\n\tconst length = array.length;\n\n\tfor (let i = 0; i < length; i++) {\n\t\tconst key = key_fn(array[i], i);\n\n\t\tif (keys.has(key)) {\n\t\t\tconst a = String(keys.get(key));\n\t\t\tconst b = String(i);\n\n\t\t\t/** @type {string | null} */\n\t\t\tlet k = String(key);\n\t\t\tif (k.startsWith('[object ')) k = null;\n\n\t\t\te.each_key_duplicate(a, b, k);\n\t\t}\n\n\t\tkeys.set(key, i);\n\t}\n}\n","/** @import { Blocker, Effect } from '#client' */\nimport { DEV } from 'esm-env';\nimport { hydrating, set_hydrating } from '../hydration.js';\nimport { get_descriptors, get_prototype_of } from '../../../shared/utils.js';\nimport { create_event, delegate, delegated, event, event_symbol } from './events.js';\nimport { add_form_reset_listener, autofocus } from './misc.js';\nimport * as w from '../../warnings.js';\nimport {\n\tATTRIBUTES_CACHE,\n\tFORM_RESET_HANDLER,\n\tIS_XHTML,\n\tLOADING_ATTR_SYMBOL\n} from '#client/constants';\nimport { queue_micro_task } from '../task.js';\nimport { is_capture_event, can_delegate_event, normalize_attribute } from '../../../../utils.js';\nimport {\n\tactive_effect,\n\tactive_reaction,\n\tget,\n\tset_active_effect,\n\tset_active_reaction\n} from '../../runtime.js';\nimport { attach } from './attachments.js';\nimport { clsx } from '../../../shared/attributes.js';\nimport { set_class } from './class.js';\nimport { set_style } from './style.js';\nimport { ATTACHMENT_KEY, NAMESPACE_HTML, UNINITIALIZED } from '../../../../constants.js';\nimport { branch, destroy_effect, effect, managed } from '../../reactivity/effects.js';\nimport { init_select, select_option } from './bindings/select.js';\nimport { flatten } from '../../reactivity/async.js';\n\nexport const CLASS = Symbol('class');\nexport const STYLE = Symbol('style');\n\nconst IS_CUSTOM_ELEMENT = Symbol('is custom element');\nconst IS_HTML = Symbol('is html');\n\nconst LINK_TAG = IS_XHTML ? 'link' : 'LINK';\nconst INPUT_TAG = IS_XHTML ? 'input' : 'INPUT';\nconst OPTION_TAG = IS_XHTML ? 'option' : 'OPTION';\nconst SELECT_TAG = IS_XHTML ? 'select' : 'SELECT';\nconst PROGRESS_TAG = IS_XHTML ? 'progress' : 'PROGRESS';\n\n/**\n * The value/checked attribute in the template actually corresponds to the defaultValue property, so we need\n * to remove it upon hydration to avoid a bug when someone resets the form value.\n * @param {HTMLInputElement} input\n * @returns {void}\n */\nexport function remove_input_defaults(input) {\n\tif (!hydrating) return;\n\n\tvar already_removed = false;\n\n\t// We try and remove the default attributes later, rather than sync during hydration.\n\t// Doing it sync during hydration has a negative impact on performance, but deferring the\n\t// work in an idle task alleviates this greatly. If a form reset event comes in before\n\t// the idle callback, then we ensure the input defaults are cleared just before.\n\tvar remove_defaults = () => {\n\t\tif (already_removed) return;\n\t\talready_removed = true;\n\n\t\t// Remove the attributes but preserve the values\n\t\tif (input.hasAttribute('value')) {\n\t\t\tvar value = input.value;\n\t\t\tset_attribute(input, 'value', null);\n\t\t\tinput.value = value;\n\t\t}\n\n\t\tif (input.hasAttribute('checked')) {\n\t\t\tvar checked = input.checked;\n\t\t\tset_attribute(input, 'checked', null);\n\t\t\tinput.checked = checked;\n\t\t}\n\t};\n\n\t/** @type {any} */ (input)[FORM_RESET_HANDLER] = remove_defaults;\n\tqueue_micro_task(remove_defaults);\n\tadd_form_reset_listener();\n}\n\n/**\n * @param {Element} element\n * @param {any} value\n */\nexport function set_value(element, value) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.value ===\n\t\t\t(attributes.value =\n\t\t\t\t// treat null and undefined the same for the initial value\n\t\t\t\tvalue ?? undefined) ||\n\t\t// @ts-expect-error\n\t\t// `progress` elements always need their value set when it's `0`\n\t\t(element.value === value && (value !== 0 || element.nodeName !== PROGRESS_TAG))\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.value = value ?? '';\n}\n\n/**\n * @param {Element} element\n * @param {boolean} checked\n */\nexport function set_checked(element, checked) {\n\tvar attributes = get_attributes(element);\n\n\tif (\n\t\tattributes.checked ===\n\t\t(attributes.checked =\n\t\t\t// treat null and undefined the same for the initial value\n\t\t\tchecked ?? undefined)\n\t) {\n\t\treturn;\n\t}\n\n\t// @ts-expect-error\n\telement.checked = checked;\n}\n\n/**\n * Sets the `selected` attribute on an `option` element.\n * Not set through the property because that doesn't reflect to the DOM,\n * which means it wouldn't be taken into account when a form is reset.\n * @param {HTMLOptionElement} element\n * @param {boolean} selected\n */\nexport function set_selected(element, selected) {\n\tif (selected) {\n\t\t// The selected option could've changed via user selection, and\n\t\t// setting the value without this check would set it back.\n\t\tif (!element.hasAttribute('selected')) {\n\t\t\telement.setAttribute('selected', '');\n\t\t}\n\t} else {\n\t\telement.removeAttribute('selected');\n\t}\n}\n\n/**\n * Applies the default checked property without influencing the current checked property.\n * @param {HTMLInputElement} element\n * @param {boolean} checked\n */\nexport function set_default_checked(element, checked) {\n\tconst existing_value = element.checked;\n\telement.defaultChecked = checked;\n\telement.checked = existing_value;\n}\n\n/**\n * Applies the default value property without influencing the current value property.\n * @param {HTMLInputElement | HTMLTextAreaElement} element\n * @param {string} value\n */\nexport function set_default_value(element, value) {\n\tconst existing_value = element.value;\n\telement.defaultValue = value;\n\telement.value = existing_value;\n}\n\n/**\n * @param {Element} element\n * @param {string} attribute\n * @param {string | null} value\n * @param {boolean} [skip_warning]\n */\nexport function set_attribute(element, attribute, value, skip_warning) {\n\tvar attributes = get_attributes(element);\n\n\tif (hydrating) {\n\t\tattributes[attribute] = element.getAttribute(attribute);\n\n\t\tif (\n\t\t\tattribute === 'src' ||\n\t\t\tattribute === 'srcset' ||\n\t\t\t(attribute === 'href' && element.nodeName === LINK_TAG)\n\t\t) {\n\t\t\tif (!skip_warning) {\n\t\t\t\tcheck_src_in_dev_hydration(element, attribute, value ?? '');\n\t\t\t}\n\n\t\t\t// If we reset these attributes, they would result in another network request, which we want to avoid.\n\t\t\t// We assume they are the same between client and server as checking if they are equal is expensive\n\t\t\t// (we can't just compare the strings as they can be different between client and server but result in the\n\t\t\t// same url, so we would need to create hidden anchor elements to compare them)\n\t\t\treturn;\n\t\t}\n\t}\n\n\tif (attributes[attribute] === (attributes[attribute] = value)) return;\n\n\tif (attribute === 'loading') {\n\t\t// @ts-expect-error\n\t\telement[LOADING_ATTR_SYMBOL] = value;\n\t}\n\n\tif (value == null) {\n\t\telement.removeAttribute(attribute);\n\t} else if (typeof value !== 'string' && get_setters(element).includes(attribute)) {\n\t\t// @ts-ignore\n\t\telement[attribute] = value;\n\t} else {\n\t\telement.setAttribute(attribute, value);\n\t}\n}\n\n/**\n * @param {Element} dom\n * @param {string} attribute\n * @param {string} value\n */\nexport function set_xlink_attribute(dom, attribute, value) {\n\tdom.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @param {string} prop\n * @param {any} value\n */\nexport function set_custom_element_data(node, prop, value) {\n\t// We need to ensure that setting custom element props, which can\n\t// invoke lifecycle methods on other custom elements, does not also\n\t// associate those lifecycle methods with the current active reaction\n\t// or effect\n\tvar previous_reaction = active_reaction;\n\tvar previous_effect = active_effect;\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet was_hydrating = hydrating;\n\tif (hydrating) {\n\t\tset_hydrating(false);\n\t}\n\n\tset_active_reaction(null);\n\tset_active_effect(null);\n\n\ttry {\n\t\tif (\n\t\t\t// `style` should use `set_attribute` rather than the setter\n\t\t\tprop !== 'style' &&\n\t\t\t// Don't compute setters for custom elements while they aren't registered yet,\n\t\t\t// because during their upgrade/instantiation they might add more setters.\n\t\t\t// Instead, fall back to a simple \"an object, then set as property\" heuristic.\n\t\t\t(setters_cache.has(node.getAttribute('is') || node.nodeName) ||\n\t\t\t// customElements may not be available in browser extension contexts\n\t\t\t!customElements ||\n\t\t\tcustomElements.get(node.getAttribute('is') || node.nodeName.toLowerCase())\n\t\t\t\t? get_setters(node).includes(prop)\n\t\t\t\t: value && typeof value === 'object')\n\t\t) {\n\t\t\t// @ts-expect-error\n\t\t\tnode[prop] = value;\n\t\t} else {\n\t\t\t// We did getters etc checks already, stringify before passing to set_attribute\n\t\t\t// to ensure it doesn't invoke the same logic again, and potentially populating\n\t\t\t// the setters cache too early.\n\t\t\tset_attribute(node, prop, value == null ? value : String(value));\n\t\t}\n\t} finally {\n\t\tset_active_reaction(previous_reaction);\n\t\tset_active_effect(previous_effect);\n\t\tif (was_hydrating) {\n\t\t\tset_hydrating(true);\n\t\t}\n\t}\n}\n\n/**\n * Spreads attributes onto a DOM element, taking into account the currently set attributes\n * @param {Element & ElementCSSInlineStyle} element\n * @param {Record<string | symbol, any> | undefined} prev\n * @param {Record<string | symbol, any>} next New attributes - this function mutates this object\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n * @returns {Record<string, any>}\n */\nfunction set_attributes(\n\telement,\n\tprev,\n\tnext,\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tif (hydrating && should_remove_defaults && element.nodeName === INPUT_TAG) {\n\t\tvar input = /** @type {HTMLInputElement} */ (element);\n\t\tvar attribute = input.type === 'checkbox' ? 'defaultChecked' : 'defaultValue';\n\n\t\tif (!(attribute in next)) {\n\t\t\tremove_input_defaults(input);\n\t\t}\n\t}\n\n\tvar attributes = get_attributes(element);\n\n\tvar is_custom_element = attributes[IS_CUSTOM_ELEMENT];\n\tvar preserve_attribute_case = !attributes[IS_HTML];\n\n\t// If we're hydrating but the custom element is from Svelte, and it already scaffolded,\n\t// then it might run block logic in hydration mode, which we have to prevent.\n\tlet is_hydrating_custom_element = hydrating && is_custom_element;\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(false);\n\t}\n\n\tvar current = prev || {};\n\tvar is_option_element = element.nodeName === OPTION_TAG;\n\n\tfor (var key in prev) {\n\t\tif (!(key in next)) {\n\t\t\tnext[key] = null;\n\t\t}\n\t}\n\n\tif (next.class) {\n\t\tnext.class = clsx(next.class);\n\t} else if (css_hash || next[CLASS]) {\n\t\tnext.class = null; /* force call to set_class() */\n\t}\n\n\tif (next[STYLE]) {\n\t\tnext.style ??= null; /* force call to set_style() */\n\t}\n\n\tvar setters = get_setters(element);\n\n\t// since key is captured we use const\n\tfor (const key in next) {\n\t\t// let instead of var because referenced in a closure\n\t\tlet value = next[key];\n\n\t\t// Up here because we want to do this for the initial value, too, even if it's undefined,\n\t\t// and this wouldn't be reached in case of undefined because of the equality check below\n\t\tif (is_option_element && key === 'value' && value == null) {\n\t\t\t// The <option> element is a special case because removing the value attribute means\n\t\t\t// the value is set to the text content of the option element, and setting the value\n\t\t\t// to null or undefined means the value is set to the string \"null\" or \"undefined\".\n\t\t\t// To align with how we handle this case in non-spread-scenarios, this logic is needed.\n\t\t\t// There's a super-edge-case bug here that is left in in favor of smaller code size:\n\t\t\t// Because of the \"set missing props to null\" logic above, we can't differentiate\n\t\t\t// between a missing value and an explicitly set value of null or undefined. That means\n\t\t\t// that once set, the value attribute of an <option> element can't be removed. This is\n\t\t\t// a very rare edge case, and removing the attribute altogether isn't possible either\n\t\t\t// for the <option value={undefined}> case, so we're not losing any functionality here.\n\t\t\t// @ts-ignore\n\t\t\telement.value = element.__value = '';\n\t\t\tcurrent[key] = value;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'class') {\n\t\t\tvar is_html = element.namespaceURI === 'http://www.w3.org/1999/xhtml';\n\t\t\tset_class(element, is_html, value, css_hash, prev?.[CLASS], next[CLASS]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[CLASS] = next[CLASS];\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (key === 'style') {\n\t\t\tset_style(element, value, prev?.[STYLE], next[STYLE]);\n\t\t\tcurrent[key] = value;\n\t\t\tcurrent[STYLE] = next[STYLE];\n\t\t\tcontinue;\n\t\t}\n\n\t\tvar prev_value = current[key];\n\n\t\t// Skip if value is unchanged, unless it's `undefined` and the element still has the attribute\n\t\tif (value === prev_value && !(value === undefined && element.hasAttribute(key))) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tcurrent[key] = value;\n\n\t\tvar prefix = key[0] + key[1]; // this is faster than key.slice(0, 2)\n\t\tif (prefix === '$$') continue;\n\n\t\tif (prefix === 'on') {\n\t\t\t/** @type {{ capture?: true }} */\n\t\t\tconst opts = {};\n\t\t\tconst event_handle_key = '$$' + key;\n\t\t\tlet event_name = key.slice(2);\n\t\t\tvar is_delegated = can_delegate_event(event_name);\n\n\t\t\tif (is_capture_event(event_name)) {\n\t\t\t\tevent_name = event_name.slice(0, -7);\n\t\t\t\topts.capture = true;\n\t\t\t}\n\n\t\t\tif (!is_delegated && prev_value) {\n\t\t\t\t// Listening to same event but different handler -> our handle function below takes care of this\n\t\t\t\t// If we were to remove and add listeners in this case, it could happen that the event is \"swallowed\"\n\t\t\t\t// (the browser seems to not know yet that a new one exists now) and doesn't reach the handler\n\t\t\t\t// https://github.com/sveltejs/svelte/issues/11903\n\t\t\t\tif (value != null) continue;\n\n\t\t\t\telement.removeEventListener(event_name, current[event_handle_key], opts);\n\t\t\t\tcurrent[event_handle_key] = null;\n\t\t\t}\n\n\t\t\tif (is_delegated) {\n\t\t\t\tdelegated(event_name, element, value);\n\t\t\t\tdelegate([event_name]);\n\t\t\t} else if (value != null) {\n\t\t\t\t/**\n\t\t\t\t * @this {any}\n\t\t\t\t * @param {Event} evt\n\t\t\t\t */\n\t\t\t\tfunction handle(evt) {\n\t\t\t\t\tcurrent[key].call(this, evt);\n\t\t\t\t}\n\n\t\t\t\tcurrent[event_handle_key] = create_event(event_name, element, handle, opts);\n\t\t\t}\n\t\t} else if (key === 'style') {\n\t\t\t// avoid using the setter\n\t\t\tset_attribute(element, key, value);\n\t\t} else if (key === 'autofocus') {\n\t\t\tautofocus(/** @type {HTMLElement} */ (element), Boolean(value));\n\t\t} else if (!is_custom_element && (key === '__value' || (key === 'value' && value != null))) {\n\t\t\t// @ts-ignore We're not running this for custom elements because __value is actually\n\t\t\t// how Lit stores the current value on the element, and messing with that would break things.\n\t\t\telement.value = element.__value = value;\n\t\t} else if (key === 'selected' && is_option_element) {\n\t\t\tset_selected(/** @type {HTMLOptionElement} */ (element), value);\n\t\t} else {\n\t\t\tvar name = key;\n\t\t\tif (!preserve_attribute_case) {\n\t\t\t\tname = normalize_attribute(name);\n\t\t\t}\n\n\t\t\tvar is_default = name === 'defaultValue' || name === 'defaultChecked';\n\n\t\t\tif (value == null && !is_custom_element && !is_default) {\n\t\t\t\tattributes[key] = null;\n\n\t\t\t\tif (name === 'value' || name === 'checked') {\n\t\t\t\t\t// removing value/checked also removes defaultValue/defaultChecked — preserve\n\t\t\t\t\tlet input = /** @type {HTMLInputElement} */ (element);\n\t\t\t\t\tconst use_default = prev === undefined;\n\t\t\t\t\tif (name === 'value') {\n\t\t\t\t\t\tlet previous = input.defaultValue;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultValue = previous;\n\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\tinput.value = input.__value = use_default ? previous : null;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlet previous = input.defaultChecked;\n\t\t\t\t\t\tinput.removeAttribute(name);\n\t\t\t\t\t\tinput.defaultChecked = previous;\n\t\t\t\t\t\tinput.checked = use_default ? previous : false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\telement.removeAttribute(key);\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tis_default ||\n\t\t\t\t(setters.includes(name) && (is_custom_element || typeof value !== 'string'))\n\t\t\t) {\n\t\t\t\t// @ts-ignore\n\t\t\t\telement[name] = value;\n\t\t\t\t// remove it from attributes's cache\n\t\t\t\tif (name in attributes) attributes[name] = UNINITIALIZED;\n\t\t\t} else if (typeof value !== 'function') {\n\t\t\t\tset_attribute(element, name, value, skip_warning);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (is_hydrating_custom_element) {\n\t\tset_hydrating(true);\n\t}\n\n\treturn current;\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} element\n * @param {(...expressions: any) => Record<string | symbol, any>} fn\n * @param {Array<() => any>} sync\n * @param {Array<() => Promise<any>>} async\n * @param {Blocker[]} blockers\n * @param {string} [css_hash]\n * @param {boolean} [should_remove_defaults]\n * @param {boolean} [skip_warning]\n */\nexport function attribute_effect(\n\telement,\n\tfn,\n\tsync = [],\n\tasync = [],\n\tblockers = [],\n\tcss_hash,\n\tshould_remove_defaults = false,\n\tskip_warning = false\n) {\n\tflatten(blockers, sync, async, (values) => {\n\t\t/** @type {Record<string | symbol, any> | undefined} */\n\t\tvar prev = undefined;\n\n\t\t/** @type {Record<symbol, Effect>} */\n\t\tvar effects = {};\n\n\t\tvar is_select = element.nodeName === SELECT_TAG;\n\t\tvar inited = false;\n\n\t\tmanaged(() => {\n\t\t\tvar next = fn(...values.map(get));\n\t\t\t/** @type {Record<string | symbol, any>} */\n\t\t\tvar current = set_attributes(\n\t\t\t\telement,\n\t\t\t\tprev,\n\t\t\t\tnext,\n\t\t\t\tcss_hash,\n\t\t\t\tshould_remove_defaults,\n\t\t\t\tskip_warning\n\t\t\t);\n\n\t\t\tif (inited && is_select && 'value' in next) {\n\t\t\t\tselect_option(/** @type {HTMLSelectElement} */ (element), next.value);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(effects)) {\n\t\t\t\tif (!next[symbol]) destroy_effect(effects[symbol]);\n\t\t\t}\n\n\t\t\tfor (let symbol of Object.getOwnPropertySymbols(next)) {\n\t\t\t\tvar n = next[symbol];\n\n\t\t\t\tif (symbol.description === ATTACHMENT_KEY && (!prev || n !== prev[symbol])) {\n\t\t\t\t\tif (effects[symbol]) destroy_effect(effects[symbol]);\n\t\t\t\t\teffects[symbol] = branch(() => attach(element, () => n));\n\t\t\t\t}\n\n\t\t\t\tcurrent[symbol] = n;\n\t\t\t}\n\n\t\t\tprev = current;\n\t\t});\n\n\t\tif (is_select) {\n\t\t\tvar select = /** @type {HTMLSelectElement} */ (element);\n\n\t\t\teffect(() => {\n\t\t\t\tselect_option(select, /** @type {Record<string | symbol, any>} */ (prev).value, true);\n\t\t\t\tinit_select(select);\n\t\t\t});\n\t\t}\n\n\t\tinited = true;\n\t});\n}\n\n/**\n *\n * @param {Element} element\n */\nfunction get_attributes(element) {\n\treturn /** @type {Record<string | symbol, unknown>} **/ (\n\t\t/** @type {any} */ (element)[ATTRIBUTES_CACHE] ??= {\n\t\t\t[IS_CUSTOM_ELEMENT]: element.nodeName.includes('-'),\n\t\t\t[IS_HTML]: element.namespaceURI === NAMESPACE_HTML\n\t\t}\n\t);\n}\n\n/** @type {Map<string, string[]>} */\nvar setters_cache = new Map();\n\n/** @param {Element} element */\nfunction get_setters(element) {\n\tvar cache_key = element.getAttribute('is') || element.nodeName;\n\tvar setters = setters_cache.get(cache_key);\n\tif (setters) return setters;\n\tsetters_cache.set(cache_key, (setters = []));\n\n\tvar descriptors;\n\tvar proto = element; // In the case of custom elements there might be setters on the instance\n\tvar element_proto = Element.prototype;\n\n\t// Stop at Element, from there on there's only unnecessary (and dangerous, like innerHTML) setters we're not interested in\n\t// Do not use constructor.name here as that's unreliable in some browser environments\n\twhile (element_proto !== proto) {\n\t\tdescriptors = get_descriptors(proto);\n\n\t\tfor (var key in descriptors) {\n\t\t\tif (\n\t\t\t\tdescriptors[key].set &&\n\t\t\t\t// better safe than sorry, we don't want spread attributes to mess with HTML content\n\t\t\t\tkey !== 'innerHTML' &&\n\t\t\t\tkey !== 'textContent' &&\n\t\t\t\tkey !== 'innerText'\n\t\t\t) {\n\t\t\t\tsetters.push(key);\n\t\t\t}\n\t\t}\n\n\t\tproto = get_prototype_of(proto);\n\t}\n\n\treturn setters;\n}\n\n/**\n * @param {any} element\n * @param {string} attribute\n * @param {string} value\n */\nfunction check_src_in_dev_hydration(element, attribute, value) {\n\tif (!DEV) return;\n\tif (attribute === 'srcset' && srcset_url_equal(element, value)) return;\n\tif (src_url_equal(element.getAttribute(attribute) ?? '', value)) return;\n\n\tw.hydration_attribute_changed(\n\t\tattribute,\n\t\telement.outerHTML.replace(element.innerHTML, element.innerHTML && '...'),\n\t\tString(value)\n\t);\n}\n\n/**\n * @param {string} element_src\n * @param {string} url\n * @returns {boolean}\n */\nfunction src_url_equal(element_src, url) {\n\tif (element_src === url) return true;\n\treturn new URL(element_src, document.baseURI).href === new URL(url, document.baseURI).href;\n}\n\n/** @param {string} srcset */\nfunction split_srcset(srcset) {\n\treturn srcset.split(',').map((src) => src.trim().split(' ').filter(Boolean));\n}\n\n/**\n * @param {HTMLSourceElement | HTMLImageElement} element\n * @param {string} srcset\n * @returns {boolean}\n */\nfunction srcset_url_equal(element, srcset) {\n\tvar element_urls = split_srcset(element.srcset);\n\tvar urls = split_srcset(srcset);\n\n\treturn (\n\t\turls.length === element_urls.length &&\n\t\turls.every(\n\t\t\t([url, width], i) =>\n\t\t\t\twidth === element_urls[i][1] &&\n\t\t\t\t// We need to test both ways because Vite will create an a full URL with\n\t\t\t\t// `new URL(asset, import.meta.url).href` for the client when `base: './'`, and the\n\t\t\t\t// relative URLs inside srcset are not automatically resolved to absolute URLs by\n\t\t\t\t// browsers (in contrast to img.src). This means both SSR and DOM code could\n\t\t\t\t// contain relative or absolute URLs.\n\t\t\t\t(src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0]))\n\t\t)\n\t);\n}\n","/** @import { Asset, RouteId, RouteIdWithSearchOrHash, Pathname, PathnameWithSearchOrHash, ResolvedPathname } from '$app/types' */\n/** @import { ResolveArgs } from './types.js' */\nimport { base, assets, hash_routing } from './internal/client.js';\nimport { resolve_route } from '../../../utils/routing.js';\nimport { get_navigation_intent } from '../../client/client.js';\n\n/**\n * Resolve the URL of an asset in your `static` directory, by prefixing it with [`config.kit.paths.assets`](https://svelte.dev/docs/kit/configuration#paths) if configured, or otherwise by prefixing it with the base path.\n *\n * During server rendering, the base path is relative and depends on the page currently being rendered.\n *\n * @example\n * ```svelte\n * <script>\n * \timport { asset } from '$app/paths';\n * </script>\n *\n * <img alt=\"a potato\" src={asset('/potato.jpg')} />\n * ```\n * @since 2.26\n *\n * @param {Asset} file\n * @returns {string}\n */\nexport function asset(file) {\n\treturn (assets || base) + file;\n}\n\nconst pathname_prefix = hash_routing ? '#' : '';\n\n/**\n * Resolve a pathname by prefixing it with the base path, if any, or resolve a route ID by populating dynamic segments with parameters.\n *\n * During server rendering, the base path is relative and depends on the page currently being rendered.\n *\n * @example\n * ```js\n * import { resolve } from '$app/paths';\n *\n * // using a pathname\n * const resolved = resolve(`/blog/hello-world`);\n *\n * // using a route ID plus parameters\n * const resolved = resolve('/blog/[slug]', {\n * \tslug: 'hello-world'\n * });\n * ```\n * @since 2.26\n *\n * @template {RouteIdWithSearchOrHash | PathnameWithSearchOrHash} T\n * @param {ResolveArgs<T>} args\n * @returns {ResolvedPathname}\n */\nexport function resolve(...args) {\n\tif (!args[0].startsWith('/')) {\n\t\tthrow new Error(\n\t\t\t`Cannot use \\`resolve(...)\\` with a non-absolute pathname or route ID (got \"${args[0]}\"). ` +\n\t\t\t\t'`resolve` is only for internal pathnames and route IDs; external URLs should be used directly.'\n\t\t);\n\t}\n\n\t// The type error is correct here, and if someone doesn't pass params when they should there's a runtime error,\n\t// but we don't want to adjust the internal resolve_route function to accept `undefined`, hence the type cast.\n\treturn (\n\t\tbase + pathname_prefix + resolve_route(args[0], /** @type {Record<string, string>} */ (args[1]))\n\t);\n}\n\n/**\n * Match a path or URL to a route ID and extracts any parameters.\n *\n * @example\n * ```js\n * import { match } from '$app/paths';\n *\n * const route = await match('/blog/hello-world');\n *\n * if (route?.id === '/blog/[slug]') {\n * \tconst slug = route.params.slug;\n * \tconst response = await fetch(`/api/posts/${slug}`);\n * \tconst post = await response.json();\n * }\n * ```\n * @since 2.52.0\n *\n * @param {Pathname | URL | (string & {})} url\n * @returns {Promise<{ id: RouteId, params: Record<string, string> } | null>}\n */\nexport async function match(url) {\n\tif (typeof url === 'string') {\n\t\turl = new URL(url, location.href);\n\t}\n\n\tconst intent = await get_navigation_intent(url, false);\n\n\tif (intent) {\n\t\treturn {\n\t\t\tid: /** @type {RouteId} */ (intent.route.id),\n\t\t\tparams: intent.params\n\t\t};\n\t}\n\n\treturn null;\n}\n\nexport { base, assets, resolve as resolveRoute };\n","const noop=()=>{},noopLogger={assert:noop,error:noop,warn:noop,info:noop,log:noop,debug:noop,dir:noop,table:noop,trace:noop,write:noop,time:noop,timeEnd:noop,timeLog:noop};let _factory;export function hook(o){\"undefined\"!=typeof globalThis&&(globalThis._logFactory=o),_factory=o}const fallbackFactory=o=>{let n;return new Proxy({},{get(r,t,e){if(n)return n[t];const l=_getFactory();return l?(n=l(o),n[t]):noop}})};function _getFactory(){return _factory||(null===globalThis||void 0===globalThis?void 0:globalThis._logFactory)}export function logs(o,n){const r=_getFactory();return r?r(o,{decoration:null==n?void 0:n.decoration}):(null==n?void 0:n.fallbackOnProxy)?\"boolean\"==typeof n.fallbackOnProxy?n.fallbackOnProxy?fallbackFactory(o):noopLogger:\"string\"==typeof n.fallbackOnProxy&&\"undefined\"!=typeof process&&(null===process||void 0===process?void 0:process.env[n.fallbackOnProxy])?fallbackFactory(o):noopLogger:noopLogger}","export function handleAutomaticUpdate(\n\tregistration: ServiceWorkerRegistration,\n\tintervals: {idle: number; checks: number},\n): NodeJS.Timeout {\n\tlet lastFocusTime = performance.now();\n\tfunction wakeup(evt?: Event) {\n\t\tconst timePassed = performance.now();\n\t\tif (timePassed - lastFocusTime > intervals.idle) {\n\t\t\tregistration.update();\n\t\t}\n\t\t// we reset the time each time we wake up\n\t\t// the idea here is that we do not want to bother users while they are actively using the app\n\t\tlastFocusTime = timePassed;\n\t}\n\t['focus', 'pointerdown'].forEach((evt) =>\n\t\twindow.addEventListener(evt, wakeup),\n\t);\n\n\t// Installed-PWA update trigger.\n\t// An installed PWA is a SPA (hash/client-side routing) and almost never\n\t// issues a `mode: 'navigate'` request, so the service worker's\n\t// \"skipWaiting on navigate\" trick (see src/service-worker/index.ts) never\n\t// fires and a waiting worker is never surfaced. The idle-gated `wakeup`\n\t// above also rarely passes right after a relaunch, so the update banner\n\t// never appears. Force an explicit update check on launch and every time\n\t// the app becomes visible (relaunch / tab re-show) so the manual update\n\t// popup can actually be shown.\n\tdocument.addEventListener('visibilitychange', () => {\n\t\tif (document.visibilityState === 'visible') {\n\t\t\tregistration.update();\n\t\t}\n\t});\n\t// also check immediately on registration\n\tregistration.update();\n\n\t// but we still do not an update every so often\n\t// TODO improve upon this\n\treturn setInterval(() => registration.update(), intervals.checks);\n}\n\n// taken from: https://stackoverflow.com/a/50535316\nexport function listenForWaitingServiceWorker(\n\tregistration: ServiceWorkerRegistration,\n\tcallback: (reg: ServiceWorkerRegistration) => void,\n) {\n\tfunction awaitStateChange() {\n\t\tif (registration.installing) {\n\t\t\tregistration.installing.addEventListener('statechange', function () {\n\t\t\t\tif (this.state === 'installed') callback(registration);\n\t\t\t});\n\t\t}\n\t}\n\tif (!registration) {\n\t\treturn;\n\t}\n\tif (registration.waiting) {\n\t\treturn callback(registration);\n\t}\n\tif (registration.installing) {\n\t\tawaitStateChange();\n\t} else {\n\t\tregistration.addEventListener('updatefound', awaitStateChange);\n\t}\n}\n","import {pushState} from '$app/navigation';\nimport {page} from '$app/state';\nimport {get, writable} from 'svelte/store';\ntype JSONNotification = {\n\ttitle: string;\n\toptions: NotificationOptions;\n};\n\nexport type PushNotification = {\n\ttype: 'push-notification';\n\tdata: JSONNotification;\n};\nexport type NotificationToAdd = PushNotification;\n\nexport type Notification = NotificationToAdd & {id: number};\n\nexport function createNotificationsService() {\n\tlet lastId = 1;\n\tconst store = writable<Notification[]>([]);\n\n\tfunction add(notification: NotificationToAdd) {\n\t\tstore.update((notifications) => [\n\t\t\t...notifications,\n\t\t\t{...notification, id: ++lastId},\n\t\t]);\n\t}\n\n\tfunction remove(id: number) {\n\t\tstore.update((notifications) =>\n\t\t\tnotifications.filter((notification) => notification.id !== id),\n\t\t);\n\t}\n\n\tfunction onClick(id: number) {\n\t\tconst notification = get(store).find((v) => v.id == id);\n\t\tremove(id);\n\t\tif (notification?.type === 'push-notification') {\n\t\t\tif (notification.data.options.data?.navigate) {\n\t\t\t\tpushState(notification.data.options.data.navigate, page.state);\n\t\t\t}\n\t\t}\n\t}\n\treturn {subscribe: store.subscribe, add, remove, onClick};\n}\n\nexport const notifications = createNotificationsService();\n","import {dev} from '$app/environment';\nimport {get, writable} from 'svelte/store';\nimport type {Logger} from 'named-logs';\nimport {logs} from 'named-logs';\nimport {handleAutomaticUpdate, listenForWaitingServiceWorker} from './utils';\nimport {notifications} from '$lib/core/notifications';\nimport {resolve} from '$app/paths';\n\nconst logger = logs('service-worker') as Logger & {\n\tlevel: number;\n\tenabled: boolean;\n};\n\nfunction updateLoggingForWorker(worker: ServiceWorker | null) {\n\tif (worker) {\n\t\tif (logger.enabled) {\n\t\t\tlogger.debug(\n\t\t\t\t`enabling logging for service worker, level: ${logger.level}`,\n\t\t\t);\n\t\t} else {\n\t\t\tlogger.debug(\n\t\t\t\t`disabling logging for service worker, level: ${logger.level}`,\n\t\t\t);\n\t\t}\n\t\tworker.postMessage({\n\t\t\ttype: 'debug',\n\t\t\tlevel: logger.level,\n\t\t\tenabled: logger.enabled,\n\t\t});\n\t}\n}\n\nconst IDLE_DELAY_MS = 3 * 60 * 1000;\nconst CHECK_DELAY_MS = 30 * 60 * 1000;\n\nexport type ServiceWorkerState =\n\t| undefined\n\t| {\n\t\t\tnotSupported: true;\n\t }\n\t| {\n\t\t\tnotSupported: false;\n\t\t\tregistering: true;\n\t }\n\t| {\n\t\t\tnotSupported: false;\n\t\t\tregistering: false;\n\t\t\terror: {message: string; cause: any};\n\t\t\tregistration: undefined;\n\t\t\tupdateAvailable: false;\n\t }\n\t| {\n\t\t\tregistration?: ServiceWorkerRegistration;\n\t\t\tupdateAvailable: boolean;\n\t\t\tnotSupported: false;\n\t\t\tregistering: false;\n\t };\n\nexport function createServiceWorker() {\n\tconst store = writable<ServiceWorkerState>(undefined);\n\n\tfunction pingServideWorker(\n\t\tstate: 'installing' | 'waiting' | 'active' = 'active',\n\t) {\n\t\tsendMessage(\n\t\t\t{\n\t\t\t\ttype: 'ping',\n\t\t\t},\n\t\t\tstate,\n\t\t);\n\t}\n\n\tfunction sendMessage(\n\t\tmessage: string | object,\n\t\tstate: 'installing' | 'waiting' | 'active' = 'active',\n\t) {\n\t\tconst $serviceWorker = get(store);\n\t\tif (!$serviceWorker) {\n\t\t\tthrow new Error(`not loaded`);\n\t\t}\n\t\tif ($serviceWorker.notSupported) {\n\t\t\tthrow new Error(`not supported`);\n\t\t}\n\t\tif ($serviceWorker.registering) {\n\t\t\tthrow new Error(`is registering...`);\n\t\t}\n\t\tconst registration = $serviceWorker.registration;\n\t\tif (!registration) {\n\t\t\tthrow new Error(`no registration`);\n\t\t}\n\t\tif (!registration[state]) {\n\t\t\tthrow new Error(`no registration in state: ${state}`);\n\t\t}\n\t\tregistration[state].postMessage(message);\n\t}\n\n\tfunction skipWaiting() {\n\t\tlogger.log(`accepting update...`);\n\t\tconst $serviceWorker = get(store);\n\t\tif (!$serviceWorker) {\n\t\t\tthrow new Error(`not loaded`);\n\t\t}\n\t\tif ($serviceWorker.notSupported) {\n\t\t\tthrow new Error(`not supported`);\n\t\t}\n\t\tif ($serviceWorker.registering) {\n\t\t\tthrow new Error(`is registering...`);\n\t\t}\n\t\tif ($serviceWorker.updateAvailable && $serviceWorker.registration) {\n\t\t\tconst registration = $serviceWorker.registration;\n\t\t\tif (!registration) {\n\t\t\t\tthrow new Error(`no registration`);\n\t\t\t}\n\n\t\t\tif (registration.waiting) {\n\t\t\t\tlogger.log(`was waiting, skipping...`);\n\t\t\t\tregistration.waiting.postMessage('skipWaiting');\n\t\t\t} else {\n\t\t\t\tlogger.log(`was not waiting, should we reload?`);\n\t\t\t\tlogger.error(`not waiting..., todo reload?`);\n\t\t\t\t// window.location.reload();\n\t\t\t}\n\n\t\t\tif (!dev) {\n\t\t\t\tlogger.log(`update store`);\n\t\t\t\tstore.set({\n\t\t\t\t\tnotSupported: false,\n\t\t\t\t\tupdateAvailable: false,\n\t\t\t\t\tregistration: $serviceWorker.registration,\n\t\t\t\t\tregistering: $serviceWorker.registering,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction skip() {\n\t\tconst $serviceWorker = get(store);\n\t\tif (!$serviceWorker) {\n\t\t\tthrow new Error(`not loaded`);\n\t\t}\n\t\tif ($serviceWorker.notSupported) {\n\t\t\tthrow new Error(`not supported`);\n\t\t}\n\t\tif ($serviceWorker.registering) {\n\t\t\tthrow new Error(`is registering...`);\n\t\t}\n\t\tstore.set({\n\t\t\tnotSupported: false,\n\t\t\tupdateAvailable: false,\n\t\t\tregistration: $serviceWorker.registration,\n\t\t\tregistering: $serviceWorker.registering,\n\t\t});\n\t}\n\n\tfunction register() {\n\t\tif (typeof navigator !== 'undefined' && 'serviceWorker' in navigator) {\n\t\t\tstore.set({notSupported: false, registering: true});\n\n\t\t\t// ------------------------------------------------------------------------------------------------\n\t\t\t// FORCE RELOAD ON CONTROLLER CHANGE\n\t\t\t// ------------------------------------------------------------------------------------------------\n\t\t\tlet refreshing = false;\n\t\t\tnavigator.serviceWorker.addEventListener('controllerchange', () => {\n\t\t\t\tif (refreshing) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\trefreshing = true;\n\t\t\t\twindow.location.reload();\n\t\t\t});\n\t\t\t// ------------------------------------------------------------------------------------------------\n\n\t\t\t//listen to messages\n\t\t\tnavigator.serviceWorker.onmessage = (event) => {\n\t\t\t\tif (event.data && event.data.type === 'notification') {\n\t\t\t\t\tconsole.log(event);\n\t\t\t\t\tnotifications.add({\n\t\t\t\t\t\ttype: 'push-notification',\n\t\t\t\t\t\tdata: event.data.notification,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tconst swLocation = resolve<any>(`/service-worker.js`);\n\t\t\t//{scope: `${base}/`}\n\t\t\tnavigator.serviceWorker\n\t\t\t\t.register(swLocation, {\n\t\t\t\t\ttype: dev ? 'module' : 'classic',\n\t\t\t\t})\n\t\t\t\t.then((registration) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\thandleAutomaticUpdate(registration, {\n\t\t\t\t\t\t\tidle: IDLE_DELAY_MS,\n\t\t\t\t\t\t\tchecks: CHECK_DELAY_MS,\n\t\t\t\t\t\t});\n\t\t\t\t\t} catch (e) {}\n\n\t\t\t\t\tstore.set({\n\t\t\t\t\t\tnotSupported: false,\n\t\t\t\t\t\tupdateAvailable: false,\n\t\t\t\t\t\tregistration: registration,\n\t\t\t\t\t\tregistering: false,\n\t\t\t\t\t});\n\t\t\t\t\tupdateLoggingForWorker(registration.installing);\n\t\t\t\t\tupdateLoggingForWorker(registration.waiting);\n\t\t\t\t\tupdateLoggingForWorker(registration.active);\n\t\t\t\t\tlistenForWaitingServiceWorker(registration, () => {\n\t\t\t\t\t\tstore.set({\n\t\t\t\t\t\t\tnotSupported: false,\n\t\t\t\t\t\t\tupdateAvailable: true,\n\t\t\t\t\t\t\tregistration: registration,\n\t\t\t\t\t\t\tregistering: false,\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.catch((e) => {\n\t\t\t\t\tconsole.error(e);\n\t\t\t\t\tstore.set({\n\t\t\t\t\t\tregistering: false,\n\t\t\t\t\t\tnotSupported: false,\n\t\t\t\t\t\tupdateAvailable: false,\n\t\t\t\t\t\tregistration: undefined,\n\t\t\t\t\t\terror: {\n\t\t\t\t\t\t\tmessage: `failed to register service-worker`,\n\t\t\t\t\t\t\tcause: e.message || e,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t\tlogger.error('Failed to register service worker', e);\n\t\t\t\t});\n\t\t} else {\n\t\t\tif (typeof window !== 'undefined') {\n\t\t\t\tstore.set({notSupported: true});\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tsubscribe: store.subscribe,\n\t\tset: store.set, // TODO remove and move handler logic in here\n\t\tget registration(): ServiceWorkerRegistration | undefined {\n\t\t\tconst $serviceWorker = get(store);\n\t\t\tif ($serviceWorker && 'registration' in $serviceWorker) {\n\t\t\t\treturn $serviceWorker.registration;\n\t\t\t} else {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t},\n\t\tget updateAvailable(): boolean {\n\t\t\tconst $serviceWorker = get(store);\n\t\t\tif ($serviceWorker && 'updateAvailable' in $serviceWorker) {\n\t\t\t\treturn $serviceWorker.updateAvailable;\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\tregister,\n\t\tpingServideWorker,\n\t\tsendMessage,\n\t\tskipWaiting,\n\t\tskip,\n\t};\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nexport function getParamsFromURL(url: string): {\n\tparams: Record<string, string>;\n\tpathname?: string;\n} {\n\tif (!url) {\n\t\treturn {params: {}, pathname: ''};\n\t}\n\tconst obj: Record<string, string> = {};\n\tconst hash = url.lastIndexOf('#');\n\n\tlet cleanedUrl = url;\n\tif (hash !== -1) {\n\t\tcleanedUrl = cleanedUrl.slice(0, hash);\n\t}\n\n\tconst question = cleanedUrl.indexOf('?');\n\tif (question !== -1) {\n\t\tcleanedUrl\n\t\t\t.slice(question + 1)\n\t\t\t.split('&')\n\t\t\t.forEach((piece) => {\n\t\t\t\tconst [key, val = ''] = piece.split('=');\n\t\t\t\tobj[decodeURIComponent(key)] =\n\t\t\t\t\tval === '' ? 'true' : decodeURIComponent(val);\n\t\t\t});\n\t}\n\n\tlet pathname = cleanedUrl.slice(0, question) || '';\n\tif (pathname && !pathname.endsWith('/')) {\n\t\tpathname += '/';\n\t}\n\treturn {params: obj, pathname};\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport function getParamsFromLocation(): {\n\tparams: Record<string, string>;\n\tpathname?: string;\n} {\n\tif (typeof window === 'undefined') {\n\t\treturn {params: {}};\n\t}\n\treturn getParamsFromURL(window.location.href);\n}\n\nexport function getHashParamsFromLocation(\n\tstr?: string,\n): Record<string, string> {\n\tif (typeof window === 'undefined') {\n\t\treturn {};\n\t}\n\tconst url = str || window.location.hash;\n\tconst obj: Record<string, string> = {};\n\tconst hash = url.lastIndexOf('#');\n\n\tif (hash !== -1) {\n\t\turl\n\t\t\t.slice(hash + 1)\n\t\t\t.split('&')\n\t\t\t.forEach((piece) => {\n\t\t\t\tconst [key, val = ''] = piece.split('=');\n\t\t\t\tobj[decodeURIComponent(key)] = decodeURIComponent(val);\n\t\t\t});\n\t}\n\treturn obj;\n}\n\nexport function queryStringifyNoArray(query: Record<string, string>): string {\n\tlet str = '';\n\tfor (const key of Object.keys(query)) {\n\t\tconst value = query[key];\n\t\tstr += `${str === '' ? '?' : '&'}${key}=${value}`;\n\t}\n\treturn str;\n}\n\nexport function rebuildLocationHash(hashParams: Record<string, string>): void {\n\tif (typeof window === 'undefined') {\n\t\treturn;\n\t}\n\tlet reconstructedHash = '';\n\tObject.entries(hashParams).forEach((param) => {\n\t\tif (reconstructedHash === '') {\n\t\t\treconstructedHash += '#';\n\t\t} else {\n\t\t\treconstructedHash += '&';\n\t\t}\n\t\treconstructedHash += param.join('=');\n\t});\n\n\tif ('replaceState' in window.history) {\n\t\twindow.history.replaceState(\n\t\t\t'',\n\t\t\tdocument.title,\n\t\t\twindow.location.pathname + window.location.search + reconstructedHash,\n\t\t);\n\t} else {\n\t\t// Prevent scrolling by storing the page's current scroll offset\n\t\tconst {scrollTop, scrollLeft} = document.body;\n\t\twindow.location.hash = '';\n\n\t\t// Restore the scroll offset, should be flicker free\n\t\tdocument.body.scrollTop = scrollTop;\n\t\tdocument.body.scrollLeft = scrollLeft;\n\t}\n}\n\nasync function chrome76Detection(): Promise<boolean> {\n\tif ('storage' in navigator && 'estimate' in navigator.storage) {\n\t\tconst {quota} = await navigator.storage.estimate();\n\t\treturn quota !== undefined && quota < 120000000;\n\t}\n\treturn false;\n}\n\nfunction isNewChrome(): boolean {\n\tconst pieces = navigator.userAgent.match(\n\t\t/Chrom(?:e|ium)\\/([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+)/,\n\t);\n\tif (pieces === null || pieces.length !== 5) {\n\t\treturn false;\n\t}\n\tconst major = pieces.map((piece) => parseInt(piece, 10))[1];\n\treturn major >= 76;\n}\n\nexport function isPrivateWindow(): Promise<boolean | null> {\n\treturn new Promise((resolve) => {\n\t\ttry {\n\t\t\tconst isSafari =\n\t\t\t\tnavigator.vendor &&\n\t\t\t\tnavigator.vendor.indexOf('Apple') > -1 &&\n\t\t\t\tnavigator.userAgent &&\n\t\t\t\tnavigator.userAgent.indexOf('CriOS') === -1 &&\n\t\t\t\tnavigator.userAgent.indexOf('FxiOS') === -1;\n\n\t\t\tif (isSafari) {\n\t\t\t\t// Safari\n\t\t\t\tlet e = false;\n\t\t\t\tif ((window as any).safariIncognito) {\n\t\t\t\t\te = true;\n\t\t\t\t} else {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t(window as any).openDatabase(null, null, null, null);\n\t\t\t\t\t\twindow.localStorage.setItem('test', '1');\n\t\t\t\t\t\tresolve(false);\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\te = true;\n\t\t\t\t\t\tresolve(true);\n\t\t\t\t\t}\n\t\t\t\t\t!e && window.localStorage.removeItem('test');\n\t\t\t\t}\n\t\t\t} else if (navigator.userAgent.includes('Firefox')) {\n\t\t\t\t// Firefox\n\t\t\t\tconst db = indexedDB.open('test');\n\t\t\t\tdb.onerror = () => {\n\t\t\t\t\tresolve(true);\n\t\t\t\t};\n\t\t\t\tdb.onsuccess = () => {\n\t\t\t\t\tresolve(false);\n\t\t\t\t};\n\t\t\t} else if (\n\t\t\t\tnavigator.userAgent.includes('Edge') ||\n\t\t\t\tnavigator.userAgent.includes('Trident') ||\n\t\t\t\tnavigator.userAgent.includes('msie')\n\t\t\t) {\n\t\t\t\t// Edge or IE\n\t\t\t\tif (\n\t\t\t\t\t!window.indexedDB &&\n\t\t\t\t\t(window.PointerEvent || (window as any).MSPointerEvent)\n\t\t\t\t) {\n\t\t\t\t\tresolve(true);\n\t\t\t\t}\n\t\t\t\tresolve(false);\n\t\t\t} else {\n\t\t\t\t// Normally ORP or Chrome\n\t\t\t\tif (isNewChrome()) {\n\t\t\t\t\tresolve(chrome76Detection());\n\t\t\t\t}\n\n\t\t\t\tconst fs =\n\t\t\t\t\t(window as any).RequestFileSystem ||\n\t\t\t\t\t(window as any).webkitRequestFileSystem;\n\t\t\t\tif (!fs) {\n\t\t\t\t\tresolve(null);\n\t\t\t\t} else {\n\t\t\t\t\tfs(\n\t\t\t\t\t\t(window as any).TEMPORARY,\n\t\t\t\t\t\t100,\n\t\t\t\t\t\t() => resolve(false),\n\t\t\t\t\t\t() => resolve(true),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (err) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(err);\n\t\t\tresolve(null);\n\t\t}\n\t});\n}\n","import {version} from '$app/environment';\nimport {createServiceWorker} from './service-worker';\nimport {\n\tgetHashParamsFromLocation,\n\tgetParamsFromLocation,\n} from './utils/web/url';\n\nexport const serviceWorker = createServiceWorker();\n\nexport const hashParams = getHashParamsFromLocation();\nexport const {params} = getParamsFromLocation();\n\nexport const globalQueryParams = [\n\t'debug',\n\t'debugLevel',\n\t'traceLevel',\n\t'debugLabel',\n\t'eruda',\n];\n\nconsole.log(`VERSION: ${version}`);\n","/**\n * Runtime theming of the web dashboard, driven by the server's\n * `appearance` config (`~/.wherever/config.json`). Because the brand\n * palette is defined as Tailwind v4 `@theme` variables (`--color-brand-*`),\n * every `bg-brand-*` / `text-brand-*` / `border-brand-*` utility resolves\n * those custom properties at paint time: overriding them on the root\n * element re-themes the whole UI without a rebuild.\n *\n * This exists so machines that mirror the same pi sessions (e.g. via\n * cloned folders pushed over git) can be told apart at a glance: each\n * server instance gets its own accent color and label.\n */\n\n/** Brand color token keys shared with `AppearanceConfig` on the server. */\nexport type AppearanceColorKey =\n\t| 'brandDark'\n\t| 'brandSurface'\n\t| 'brandSurface2'\n\t| 'brandSurface3'\n\t| 'brandBorder'\n\t| 'brandText'\n\t| 'brandTextMuted'\n\t| 'brandCyan'\n\t| 'brandBlue'\n\t| 'brandPurple';\n\n/** Subtle backdrop patterns painted on the dashboard's dark background, in the accent tint. */\nexport type AppearancePattern = 'none' | 'stripes' | 'dots' | 'grid';\n\nexport interface AppearanceInfo {\n\t/** Instance label (defaults to the server machine's hostname). */\n\tlabel: string;\n\t/** Accent color overriding the brand accent tokens, or null. */\n\taccent: string | null;\n\t/** Per-token brand overrides, or null. */\n\tcolors: Partial<Record<AppearanceColorKey, string>> | null;\n\t/** Solid accent bar across the top edge of the whole dashboard. */\n\tframe: boolean;\n\t/** Backdrop pattern on the dark background, in the accent tint. */\n\tpattern: AppearancePattern;\n}\n\n/** Map of config color keys to the CSS custom properties they override. */\nconst TOKEN_VARS: Record<AppearanceColorKey, string> = {\n\tbrandDark: '--color-brand-dark',\n\tbrandSurface: '--color-brand-surface',\n\tbrandSurface2: '--color-brand-surface-2',\n\tbrandSurface3: '--color-brand-surface-3',\n\tbrandBorder: '--color-brand-border',\n\tbrandText: '--color-brand-text',\n\tbrandTextMuted: '--color-brand-text-muted',\n\tbrandCyan: '--color-brand-cyan',\n\tbrandBlue: '--color-brand-blue',\n\tbrandPurple: '--color-brand-purple',\n};\n\nconst ACCENT_VARS = [\n\t'--color-brand-cyan',\n\t'--color-brand-blue',\n\t'--color-brand-purple',\n];\n\n/** The appearance assumed before /config answers (the compiled defaults). */\nexport const defaultAppearance: AppearanceInfo = {\n\tlabel: '',\n\taccent: null,\n\tcolors: null,\n\tframe: false,\n\tpattern: 'none',\n};\n\n/**\n * Apply an appearance to the document. Values are written through\n * `style.setProperty` only (never innerHTML), so arbitrary config strings\n * cannot inject markup. Pass `defaultAppearance` to reset to the compiled\n * palette (e.g. when connecting to a different server).\n */\nexport function applyAppearance(appearance: AppearanceInfo): void {\n\tif (typeof document === 'undefined') return;\n\tconst root = document.documentElement;\n\n\t// Reset first: /config answers once per server, and a PWA reconnecting to\n\t// another instance must not blend two palettes.\n\tfor (const cssVar of Object.values(TOKEN_VARS)) {\n\t\troot.style.removeProperty(cssVar);\n\t}\n\troot.classList.remove('wherever-framed');\n\tdelete root.dataset.whereverPattern;\n\n\tif (appearance.accent) {\n\t\t// One accent color retints the gradient stops too (app.css builds the\n\t\t// gradient from these variables), giving each instance a uniform hue.\n\t\tfor (const cssVar of ACCENT_VARS) {\n\t\t\troot.style.setProperty(cssVar, appearance.accent);\n\t\t}\n\t\t// Match the mobile browser chrome / PWA status bar to the accent.\n\t\tdocument\n\t\t\t.querySelector('meta[name=\"theme-color\"]')\n\t\t\t?.setAttribute('content', appearance.accent);\n\t}\n\n\tif (appearance.frame) {\n\t\t// A solid accent bar over the top edge of everything (app.css), visible\n\t\t// even with the sidebar collapsed or a session filling the screen.\n\t\troot.classList.add('wherever-framed');\n\t}\n\tif (appearance.pattern && appearance.pattern !== 'none') {\n\t\t// The backdrop pattern (app.css) reads this attribute.\n\t\troot.dataset.whereverPattern = appearance.pattern;\n\t}\n\n\tif (appearance.colors) {\n\t\tfor (const [key, value] of Object.entries(appearance.colors) as [\n\t\t\tAppearanceColorKey,\n\t\t\tstring,\n\t\t][]) {\n\t\t\tconst cssVar = TOKEN_VARS[key];\n\t\t\tif (cssVar && typeof value === 'string') {\n\t\t\t\troot.style.setProperty(cssVar, value);\n\t\t\t}\n\t\t}\n\t}\n}\n","// Adopting an auth token handed to the browser in the page URL.\n//\n// A token-protected server authenticates BOTH the page request and the\n// WebSocket upgrade (`/ws?token=...`). The dashboard only ever learned its\n// token from the `wherever-config` localStorage entry, so a freshly opened\n// `https://host/?token=SECRET` rendered the page (the server saw the query\n// parameter) and then failed the upgrade, because the client had no token to\n// put on the WebSocket URL. This module closes that gap: on boot the token is\n// taken out of the page URL, merged into the stored config, and removed from\n// the address bar. From then on every consumer -- page fetches, /sessions\n// calls, the WebSocket -- reads it from the config as usual.\n//\n// THE HASH FRAGMENT IS THE DOCUMENTED FORM, AND THAT IS DELIBERATE: a fragment\n// is never sent to the server. `https://host/#token=SECRET` keeps the secret\n// out of HTTP access logs, out of the `Referer` header sent to any third party\n// the user navigates to next, and out of the request logs of every reverse\n// proxy and intermediary in between, none of which is true of `?token=SECRET`.\n// Do NOT \"simplify\" this by folding the hash form back into the query\n// parameter: the query form is retained only as a fallback for links that were\n// already handed out, and both forms are scrubbed from the address bar the\n// moment they are read.\n\n// The single localStorage entry holding the dashboard's connection config.\n// Read/written here directly (rather than through wherever.ts) so adoption can\n// run before any config consumer without importing half the app.\nconst CONFIG_KEY = 'wherever-config';\nconst TOKEN_PARAM = 'token';\n\ntype TokenTake = {\n\t/** A `token` key was present, whether or not its value was usable. */\n\tpresent: boolean;\n\t/** The value verbatim, '' when there was no non-blank one. */\n\tvalue: string;\n\t/** The `?...` / `#...` remainder with the token key(s) removed, '' when empty. */\n\trest: string;\n};\n\n// Parses one URL component with URLSearchParams, so `#token=X&foo=1` behaves\n// sensibly and a percent-encoded token is decoded correctly.\n//\n// The key is matched CASE-INSENSITIVELY, which matters more here than it looks:\n// the fragment is ALSO this app's session-id channel (`+page.svelte` feeds\n// `location.hash` straight into switchSession). A near-miss capitalisation such\n// as `#TOKEN=SECRET` that this function failed to recognise would not merely be\n// ignored, it would be read as a session id, sent to the server, and echoed\n// back into the DOM as `Session with ID \"<secret>\" not found`. Recognising the\n// key in any case keeps the secret out of that path.\nfunction takeToken(raw: string, prefix: '?' | '#'): TokenTake {\n\tconst body = raw.startsWith(prefix) ? raw.slice(1) : raw;\n\tif (!body) return {present: false, value: '', rest: raw};\n\tconst params = new URLSearchParams(body);\n\tconst keys = [\n\t\t...new Set(\n\t\t\t[...params.keys()].filter((k) => k.toLowerCase() === TOKEN_PARAM),\n\t\t),\n\t];\n\t// When there is no token key the component is left BYTE-FOR-BYTE alone\n\t// rather than reserialised: a non key/value fragment (say `#/some/route`,\n\t// which is exactly what a session deep link looks like) would come back out\n\t// of URLSearchParams mangled into `%2Fsome%2Froute=`.\n\tif (keys.length === 0) return {present: false, value: '', rest: raw};\n\t// Stored VERBATIM, not trimmed: the server compares the token byte-for-byte\n\t// (`provided === token`), and this project deliberately supports a token with\n\t// surrounding whitespace (see \"Supplying the token\" in the README, where the\n\t// pre-existing sources are taken as-is). Trimming here would silently change\n\t// which string authenticates. The trim below decides only whether the value\n\t// is BLANK, which is a separate question.\n\t// All values are collected before anything is deleted, so a link that\n\t// repeats the key (`#token=&token=REAL`) still finds the usable one instead\n\t// of stopping at the blank first occurrence.\n\tconst values = keys.flatMap((key) => params.getAll(key));\n\tconst value = values.find((candidate) => candidate.trim()) ?? '';\n\tfor (const key of keys) params.delete(key);\n\tconst remaining = params.toString();\n\treturn {present: true, value, rest: remaining ? `${prefix}${remaining}` : ''};\n}\n\nexport type UrlTokenRead = {\n\t/** The usable token, or null when absent or blank. */\n\ttoken: string | null;\n\t/** A token key was present somewhere, so the address bar needs scrubbing. */\n\tpresent: boolean;\n\t/** The search component to keep. */\n\tsearch: string;\n\t/** The hash component to keep. */\n\thash: string;\n};\n\n/**\n * Pure read of the token from a URL's search and hash components.\n *\n * The hash wins when it carries a value; the query is a fallback. A blank or\n * whitespace-only token yields `token: null` but still `present: true`, so the\n * caller scrubs it without storing it: writing '' would clear a token that is\n * already working, turning a malformed link into a logout.\n *\n * Note that `+` decodes to a space, as form encoding says it must, and as the\n * server already does for the query form. A token containing `+` has to be\n * percent-encoded in the link; the README says so.\n */\nexport function readUrlToken(search: string, hash: string): UrlTokenRead {\n\tconst fromHash = takeToken(hash || '', '#');\n\tconst fromSearch = takeToken(search || '', '?');\n\tconst value = fromHash.value || fromSearch.value;\n\treturn {\n\t\ttoken: value ? value : null,\n\t\tpresent: fromHash.present || fromSearch.present,\n\t\tsearch: fromSearch.rest,\n\t\thash: fromHash.rest,\n\t};\n}\n\n/**\n * Removes the token from the address bar, leaving the rest of the URL alone.\n *\n * Idempotent and safe to call at any time: with no token in the URL it does\n * nothing. It is SEPARATE from adoption, and exported, because in a SvelteKit\n * app it MUST run a second time. This is measured behaviour, not a precaution:\n *\n * The dashboard boots in client-side-routing mode (the generated index.html\n * calls `kit.start(app, element)` with no hydrate payload), and SvelteKit's\n * `start()` reads `location.href` and then performs an initial `enter`\n * navigation with it. That navigation is what dynamically imports the route\n * modules, which is where adoption below runs, so the URL is scrubbed while the\n * navigation is still in flight. When the navigation then commits, SvelteKit\n * stamps the history entry with the href it captured BEFORE the import, and the\n * token reappears in the address bar. Instrumented in a real browser: the scrub\n * lands, and ~12ms later the router's own `history.replaceState` puts the token\n * back. Nothing in a jsdom-free unit test can see this, because the router is\n * not running there.\n *\n * Hence `+layout.svelte` calls this again from `afterNavigate`, which fires\n * after that commit. Native `history.replaceState` is used rather than the\n * `replaceState` from `$app/navigation` because this whole app already drives\n * the fragment natively (`window.location.hash = ...` in `+page.svelte` and\n * `SessionBrowser.svelte`): the app's session-id channel is the fragment, and\n * routing it through the shallow-routing API here would be the odd one out.\n *\n * Returns true when the address bar was actually changed.\n */\nexport function scrubTokenFromUrl(): boolean {\n\tif (typeof window === 'undefined' || !window.location) return false;\n\n\tconst loc = window.location;\n\tconst read = readUrlToken(loc.search || '', loc.hash || '');\n\tif (!read.present) return false;\n\n\t// replaceState, never pushState: a pushed entry would keep the secret alive\n\t// in the session history (and in the back button) after the URL is clean.\n\ttry {\n\t\tconst history = window.history;\n\t\tif (history && typeof history.replaceState === 'function') {\n\t\t\tconst path = loc.pathname || '/';\n\t\t\thistory.replaceState(\n\t\t\t\thistory.state ?? null,\n\t\t\t\t'',\n\t\t\t\t`${path}${read.search}${read.hash}`,\n\t\t\t);\n\t\t\treturn true;\n\t\t}\n\t} catch {\n\t\t// A failed scrub must not cost the user the token itself.\n\t}\n\treturn false;\n}\n\n/**\n * Adopts a token from the current page URL: persist it into the stored config\n * (MERGED, never replacing the object, so host/port/hideThinking/beepDefault\n * and the rest survive) and strip it from the address bar.\n *\n * Returns true when a token was actually stored.\n */\nexport function adoptTokenFromUrl(): boolean {\n\t// SSR/prerender: no window, nothing to adopt.\n\tif (typeof window === 'undefined' || !window.location) return false;\n\n\tconst loc = window.location;\n\tconst read = readUrlToken(loc.search || '', loc.hash || '');\n\tif (!read.present) return false;\n\n\t// Scrub FIRST, and regardless of whether the value turned out to be usable.\n\tscrubTokenFromUrl();\n\n\tif (!read.token) return false;\n\n\t// A corrupt entry is parsed in ITS OWN try, so it degrades to \"no stored\n\t// config\" (which is how getConfig() already treats it) instead of aborting\n\t// the adoption and leaving the user with no token at all.\n\tlet stored: Record<string, unknown> = {};\n\ttry {\n\t\tconst raw = localStorage.getItem(CONFIG_KEY);\n\t\tif (raw) {\n\t\t\tconst parsed = JSON.parse(raw);\n\t\t\tif (parsed && typeof parsed === 'object') {\n\t\t\t\tstored = parsed as Record<string, unknown>;\n\t\t\t}\n\t\t}\n\t} catch {\n\t\tstored = {};\n\t}\n\n\ttry {\n\t\t// A non-empty token in the URL wins over a stored one -- following a link\n\t\t// is an explicit act by the user -- but it overwrites the token FIELD\n\t\t// only. Never log or render the value.\n\t\tlocalStorage.setItem(\n\t\t\tCONFIG_KEY,\n\t\t\tJSON.stringify({...stored, token: read.token}),\n\t\t);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nlet adopted = false;\n\n/**\n * Idempotent entry point. Called from every place that reads the config early\n * (getConfig() in wherever.ts, session-store's module scope) so adoption has\n * always happened before the first read, no matter which module the route\n * pulled in first. Repeat calls are free.\n */\nexport function adoptTokenFromUrlOnce(): boolean {\n\tif (adopted) return false;\n\tadopted = true;\n\treturn adoptTokenFromUrl();\n}\n","import {writable, get} from 'svelte/store';\nimport {defaultAppearance, type AppearanceInfo} from '$lib/theme';\nimport {adoptTokenFromUrlOnce} from '$lib/core/token-adoption';\n\n// getToken()/getBaseUrl() below read the stored config STRAIGHT out of\n// localStorage, and a route can import this module without importing\n// wherever.ts, so adoption is kicked off here at module scope too. It is\n// idempotent and shares its state with the call in getConfig().\nadoptTokenFromUrlOnce();\n\nexport interface SessionInfo {\n\tpath: string;\n\tid: string;\n\tname?: string;\n\tcreated: string;\n\tmodified: string;\n\tmessageCount: number;\n\t// Short, capped preview of the first user message (not the full text).\n\tfirstMessage: string;\n\tisActive: boolean;\n\tclientCount: number;\n\t// Absolute path of the parent session this one was forked from, or undefined\n\t// for a root session. Used to build the fork-hierarchy tree in the browser.\n\tparentSessionPath?: string;\n}\n\nexport interface FolderWithSessions {\n\tpath: string;\n\tname: string;\n\tsessions: SessionInfo[];\n\treadOnly?: boolean;\n\t// True when this folder does not exist on this machine (the listing view of\n\t// the folder-missing state). ORTHOGONAL to readOnly, which is a configured\n\t// policy: a folder can be either, both or neither, so the browser renders the\n\t// two differently and never as one thing.\n\tmissing?: boolean;\n}\n\nexport interface ModelInfo {\n\tprovider: string;\n\tmodelId: string;\n\tlabel: string;\n\tisDefault?: boolean;\n}\n\nexport interface SessionStoreData {\n\tfolders: FolderWithSessions[];\n\tactiveSessions: string[];\n\tcurrentSession: string | null;\n\tloading: boolean;\n}\n\nexport interface ModelsStoreData {\n\tmodels: ModelInfo[];\n\tloading: boolean;\n}\n\nexport const sessionFolders = writable<SessionStoreData>({\n\tfolders: [],\n\tactiveSessions: [],\n\tcurrentSession: null,\n\tloading: false,\n});\n\nexport const availableModels = writable<ModelsStoreData>({\n\tmodels: [],\n\tloading: false,\n});\n\n// Separate store for the read-only sessions page (sessions.readOnly folders),\n// fetched on demand via /sessions?view=readonly. Kept distinct from the main\n// list so the default dashboard payload stays small.\nexport const readOnlySessionFolders = writable<SessionStoreData>({\n\tfolders: [],\n\tactiveSessions: [],\n\tcurrentSession: null,\n\tloading: false,\n});\n\n// Default port when none is explicitly configured: prefer the page's own\n// origin port so reverse-proxy deployments (e.g. https://host behind Caddy on\n// 443, no port in the URL) work without the user configuring a port. Falls\n// back to the dev default 31415 only when no usable location port exists.\nfunction defaultPort(): number {\n\tif (typeof window !== 'undefined' && window.location) {\n\t\tconst loc = window.location;\n\t\tif (loc.port) return Number(loc.port);\n\t\tif (loc.protocol === 'https:') return 443;\n\t\tif (loc.protocol === 'http:') return 80;\n\t}\n\treturn 31415;\n}\n\nexport function getBaseUrl(): string {\n\tconst config = localStorage.getItem('wherever-config');\n\tconst defaultHost =\n\t\ttypeof window !== 'undefined' && window.location && window.location.hostname\n\t\t\t? window.location.hostname\n\t\t\t: 'localhost';\n\n\tif (config) {\n\t\tconst parsed = JSON.parse(config);\n\t\tconst protocol = window.location.protocol === 'https:' ? 'https:' : 'http:';\n\t\tlet host = parsed.host || defaultHost;\n\t\tif (host === 'localhost' || host === '127.0.0.1') {\n\t\t\tif (\n\t\t\t\tdefaultHost &&\n\t\t\t\tdefaultHost !== 'localhost' &&\n\t\t\t\tdefaultHost !== '127.0.0.1'\n\t\t\t) {\n\t\t\t\thost = defaultHost;\n\t\t\t}\n\t\t}\n\t\thost = host.startsWith('http') ? host.replace(/^wss?:\\/\\//, '') : host;\n\t\t// Heal a legacy stored 31415 when actually served from another origin\n\t\t// port (matches getConfig() in wherever.ts), so proxied setups don't\n\t\t// dial a closed 31415.\n\t\tlet port = parsed.port;\n\t\tif ((port === 31415 || port === undefined) && defaultPort() !== 31415) {\n\t\t\tport = defaultPort();\n\t\t}\n\t\treturn `${protocol}//${host}:${port || defaultPort()}`;\n\t}\n\treturn `${window.location.protocol}//${window.location.host}`;\n}\n\nlet fetchTimeout: ReturnType<typeof setTimeout> | null = null;\nlet resolveQueue: (() => void)[] = [];\n// In-flight + coalescing guards: a stream of `sessions_updated` events (one per\n// agent turn) used to pull the whole list repeatedly. We now (a) never run two\n// fetches at once, (b) collapse any requests that arrive during a fetch into a\n// single trailing re-fetch, and (c) cap the debounce reset so a continuous\n// stream still resolves promptly instead of being pushed back forever.\nlet fetchInFlight = false;\nlet refetchRequested = false;\nlet firstQueuedAt = 0;\nconst FETCH_DEBOUNCE_MS = 150;\nconst FETCH_MAX_WAIT_MS = 1000;\n\nasync function doFetchSessions(): Promise<void> {\n\tfetchInFlight = true;\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/sessions${token ? `?token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = await res.json();\n\t\tsessionFolders.set({\n\t\t\tfolders: data.folders || [],\n\t\t\tactiveSessions: (data.activeSessions || []).map(\n\t\t\t\t(s: any) => s.sessionFile,\n\t\t\t),\n\t\t\tcurrentSession: get(sessionFolders).currentSession,\n\t\t\tloading: false,\n\t\t});\n\t} catch (err) {\n\t\tsessionFolders.update((s) => ({...s, loading: false}));\n\t\tconsole.error('Failed to fetch sessions:', err);\n\t} finally {\n\t\tfetchInFlight = false;\n\t}\n}\n\nexport function fetchSessions(): Promise<void> {\n\tsessionFolders.update((s) => ({...s, loading: true}));\n\n\tconst promise = new Promise<void>((resolve) => {\n\t\tresolveQueue.push(resolve);\n\t});\n\n\t// If a fetch is already running, just mark that we need one more pass when it\n\t// finishes (collapsing any number of mid-flight requests into a single one).\n\t// The resolver we just queued is drained by that trailing pass, so the\n\t// returned promise still settles even though we schedule nothing here.\n\tif (fetchInFlight) {\n\t\trefetchRequested = true;\n\t\treturn promise;\n\t}\n\n\tconst now = Date.now();\n\tif (!fetchTimeout) {\n\t\tfirstQueuedAt = now;\n\t} else {\n\t\tclearTimeout(fetchTimeout);\n\t\t// Cap the debounce: if we have already been waiting MAX_WAIT, fire now\n\t\t// rather than letting a continuous event stream postpone the fetch forever.\n\t\tif (now - firstQueuedAt >= FETCH_MAX_WAIT_MS) {\n\t\t\tfetchTimeout = null;\n\t\t\tvoid runQueuedFetch();\n\t\t\treturn promise;\n\t\t}\n\t}\n\n\tfetchTimeout = setTimeout(() => {\n\t\tfetchTimeout = null;\n\t\tvoid runQueuedFetch();\n\t}, FETCH_DEBOUNCE_MS);\n\n\treturn promise;\n}\n\nasync function runQueuedFetch(): Promise<void> {\n\ttry {\n\t\t// Each pass claims the resolvers queued so far and settles them with THAT\n\t\t// pass's data. Requests that arrive mid-flight queue their resolver and set\n\t\t// refetchRequested, so the loop runs one more pass and settles them against\n\t\t// fresher data. Claiming the queue up-front instead (the previous shape)\n\t\t// stranded any resolver added during the fetch: nothing scheduled a further\n\t\t// pass for it, so `await fetchSessions()` could hang forever.\n\t\tdo {\n\t\t\trefetchRequested = false;\n\t\t\tconst resolves = resolveQueue;\n\t\t\tresolveQueue = [];\n\t\t\ttry {\n\t\t\t\tawait doFetchSessions();\n\t\t\t} finally {\n\t\t\t\tfor (const r of resolves) r();\n\t\t\t}\n\t\t} while (refetchRequested);\n\t} finally {\n\t\t// Safety net: never strand a resolver, whatever happens above.\n\t\tconst rest = resolveQueue;\n\t\tresolveQueue = [];\n\t\tfor (const r of rest) r();\n\t}\n}\n\n// Fetch the read-only session folders (sessions.readOnly) for the separate\n// read-only page. Deliberately simple (no debounce/coalesce): it is only\n// triggered while that page is open, not on the hot dashboard path.\nexport async function fetchReadOnlySessions(): Promise<void> {\n\treadOnlySessionFolders.update((s) => ({...s, loading: true}));\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/sessions?view=readonly${token ? `&token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = await res.json();\n\t\treadOnlySessionFolders.set({\n\t\t\tfolders: data.folders || [],\n\t\t\tactiveSessions: (data.activeSessions || []).map(\n\t\t\t\t(s: any) => s.sessionFile,\n\t\t\t),\n\t\t\tcurrentSession: get(readOnlySessionFolders).currentSession,\n\t\t\tloading: false,\n\t\t});\n\t} catch (err) {\n\t\treadOnlySessionFolders.update((s) => ({...s, loading: false}));\n\t\tconsole.error('Failed to fetch read-only sessions:', err);\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// Conversation search (GET /search), backed by the memonaut index server-side.\n// ---------------------------------------------------------------------------\n\n// One session file carrying a match. `sessionPath` is normalized by the SERVER\n// with the same rule as SessionInfo.path, so it can be handed straight to\n// switchSession() and matches the fork tree's nodes.\nexport interface SearchThreadResult {\n\tsessionPath: string;\n\tname: string | null;\n\tcwd: string;\n\tfolderName: string;\n\tproject: string | null;\n\tlastActivity: string | null;\n\tentryCount: number;\n\tseq: number;\n\t/** Entries this thread accumulated after the match: what tells forks apart. */\n\tafter: number;\n\tisRoot: boolean;\n\treadOnly: boolean;\n}\n\nexport interface SearchHitResult {\n\tentryKey: string;\n\trole: string;\n\tkind: string;\n\ttool: string | null;\n\tts: string | null;\n\t/** FTS5 snippet with \\u0001/\\u0002 match markers (see core/search-snippet.ts). */\n\tsnippet: string;\n\tscore: number;\n\t/** EVERY visible thread carrying this entry, most recently active first. */\n\tthreads: SearchThreadResult[];\n\tthreadTotal: number;\n\totherHits: number;\n}\n\nexport interface SearchResponse {\n\tstatus: 'ok' | 'not-indexed' | 'unavailable' | 'error';\n\tquery: string;\n\tusedQuery?: string;\n\tquotedFallback?: boolean;\n\thits: SearchHitResult[];\n\tscanned?: number;\n\thiddenHits?: number;\n\tindex?: {path: string; files: number; entries: number; newest: string | null};\n\tmessage?: string;\n}\n\n// The latest query wins: a superseded request is aborted rather than raced, so\n// a slow earlier response can never paint over a newer one.\nlet searchAbort: AbortController | null = null;\n\n/**\n * Run one conversation search. Never throws: a transport failure comes back as\n * status:'error' so the panel can explain itself, and an aborted (superseded)\n * request resolves to null so the caller simply keeps what it has.\n */\nexport async function searchConversations(\n\tquery: string,\n\tview: 'default' | 'readonly' = 'default',\n): Promise<SearchResponse | null> {\n\tsearchAbort?.abort();\n\tconst controller = new AbortController();\n\tsearchAbort = controller;\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst params = new URLSearchParams({q: query});\n\t\tif (view === 'readonly') params.set('view', 'readonly');\n\t\tif (token) params.set('token', token);\n\t\tconst res = await fetch(`${baseUrl}/search?${params.toString()}`, {\n\t\t\tsignal: controller.signal,\n\t\t});\n\t\tif (!res.ok) {\n\t\t\treturn {\n\t\t\t\tstatus: 'error',\n\t\t\t\tquery,\n\t\t\t\thits: [],\n\t\t\t\tmessage:\n\t\t\t\t\tres.status === 401\n\t\t\t\t\t\t? 'Unauthorized: check the token in Connection Settings.'\n\t\t\t\t\t\t: `Search failed (HTTP ${res.status}).`,\n\t\t\t};\n\t\t}\n\t\treturn (await res.json()) as SearchResponse;\n\t} catch (err) {\n\t\tif ((err as Error)?.name === 'AbortError') return null;\n\t\treturn {\n\t\t\tstatus: 'error',\n\t\t\tquery,\n\t\t\thits: [],\n\t\t\tmessage: (err as Error)?.message || 'Search request failed.',\n\t\t};\n\t} finally {\n\t\tif (searchAbort === controller) searchAbort = null;\n\t}\n}\n\nexport async function fetchModels(): Promise<void> {\n\tavailableModels.update((s) => ({...s, loading: true}));\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/models${token ? `?token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = await res.json();\n\t\tavailableModels.set({\n\t\t\tmodels: data.models || [],\n\t\t\tloading: false,\n\t\t});\n\t} catch (err) {\n\t\tavailableModels.update((s) => ({...s, loading: false}));\n\t\tconsole.error('Failed to fetch models:', err);\n\t}\n}\n\nexport function getToken(): string {\n\ttry {\n\t\tconst config = localStorage.getItem('wherever-config');\n\t\tif (config) {\n\t\t\tconst parsed = JSON.parse(config);\n\t\t\treturn parsed.token || '';\n\t\t}\n\t} catch {}\n\treturn '';\n}\n\nexport const gitInitDefaultStore = writable<boolean>(false);\nexport const uploadMethodStore = writable<'websocket' | 'post'>('websocket');\nexport const searchFolderStore = writable<string | null>(null);\nexport const searchCreateRemoteStore = writable<boolean>(false);\n// Default model (as \"provider:modelId\") for the configured search folder,\n// resolved server-side against that folder's settings. null when unset.\nexport const searchDefaultModelStore = writable<string | null>(null);\n\n/** Visual identity of the connected server instance (label + theme overrides). */\nexport const appearanceStore = writable<AppearanceInfo>(defaultAppearance);\n\nexport interface PathCheckResult {\n\texists: boolean;\n\tisGit: boolean;\n\tresolvedPath: string;\n}\n\nexport async function checkPath(\n\tpathStr: string,\n): Promise<PathCheckResult | null> {\n\tif (!pathStr.trim()) return null;\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/check-path?path=${encodeURIComponent(pathStr)}${token ? `&token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\treturn (await res.json()) as PathCheckResult;\n\t} catch (err) {\n\t\tconsole.error('Failed to check path:', err);\n\t\treturn null;\n\t}\n}\n\nexport interface RemoteRepoCheckResult {\n\tmatched: boolean;\n\tprovider?: string;\n\texists: boolean;\n\tsshUrl?: string;\n}\n\n/**\n * Submit-time probe: ask the server whether the remote repo that would be\n * created for `pathStr` already exists. Runs a provider CLI on the server, so\n * this is called ON DEMAND at create time, never on every keystroke.\n */\nexport async function checkRemoteRepo(\n\tpathStr: string,\n): Promise<RemoteRepoCheckResult | null> {\n\tif (!pathStr.trim()) return null;\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/check-remote-repo?path=${encodeURIComponent(pathStr)}${token ? `&token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\treturn (await res.json()) as RemoteRepoCheckResult;\n\t} catch (err) {\n\t\tconsole.error('Failed to check remote repo:', err);\n\t\treturn null;\n\t}\n}\n\nexport interface RemoteCandidate {\n\t/** An scp-style SSH URL (`git@host:owner/repo.git`). Never HTTPS. */\n\turl: string;\n\tsource: 'probe' | 'path-convention';\n}\n\nexport interface RemoteCandidatesResult {\n\tresolvedPath: string;\n\tcandidates: RemoteCandidate[];\n}\n\n/**\n * Which repository does this (missing) folder probably correspond to?\n *\n * Answers an ORDERED, ADVISORY list of SSH candidates -- the provider probe\n * first, then the `<host-token>/<owner>/<repo>` path convention -- used to\n * PRE-FILL the restore panel's editable url field so a repository can be\n * restored from a phone without typing one. Advisory only: the server clones\n * what it is finally given, not what it guessed, and an empty list is an honest\n * answer the user pastes over.\n *\n * The probe shells out to a provider CLI, so this is called ON DEMAND (the panel\n * opening), never per keystroke.\n */\nexport async function fetchRemoteCandidates(\n\tpathStr: string,\n): Promise<RemoteCandidate[]> {\n\tif (!pathStr.trim()) return [];\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/remote-candidates?path=${encodeURIComponent(pathStr)}${token ? `&token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = (await res.json()) as RemoteCandidatesResult;\n\t\treturn Array.isArray(data.candidates) ? data.candidates : [];\n\t} catch (err) {\n\t\t// A candidate is a convenience, never a gate: an unreachable endpoint leaves\n\t\t// the field empty and the user pastes a url.\n\t\tconsole.error('Failed to resolve remote candidates:', err);\n\t\treturn [];\n\t}\n}\n\nexport interface PathAutocompleteResult {\n\tcompletions: string[];\n}\n\nexport async function autocompletePath(pathStr: string): Promise<string[]> {\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/autocomplete-path?path=${encodeURIComponent(pathStr)}${token ? `&token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = (await res.json()) as PathAutocompleteResult;\n\t\treturn data.completions || [];\n\t} catch (err) {\n\t\tconsole.error('Failed to autocomplete path:', err);\n\t\treturn [];\n\t}\n}\n\nexport async function fetchConfig(): Promise<void> {\n\ttry {\n\t\tconst baseUrl = getBaseUrl();\n\t\tconst token = getToken();\n\t\tconst url = `${baseUrl}/config${token ? `?token=${encodeURIComponent(token)}` : ''}`;\n\t\tconst res = await fetch(url);\n\t\tif (!res.ok) throw new Error(`HTTP ${res.status}`);\n\t\tconst data = await res.json();\n\t\tgitInitDefaultStore.set(!!data.gitInitDefault);\n\t\tuploadMethodStore.set(data.uploadMethod || 'websocket');\n\t\tsearchFolderStore.set(data.searchFolder || null);\n\t\tsearchCreateRemoteStore.set(!!data.searchCreateRemote);\n\t\tsearchDefaultModelStore.set(data.searchDefaultModel || null);\n\t\tconst appearance: AppearanceInfo = {\n\t\t\tlabel: data.appearance?.label || '',\n\t\t\taccent: data.appearance?.accent || null,\n\t\t\tcolors: data.appearance?.colors || null,\n\t\t\tframe: !!data.appearance?.frame,\n\t\t\tpattern: data.appearance?.pattern || 'none',\n\t\t};\n\t\t// Publishing the appearance is all this module does with it: painting it\n\t\t// onto the document belongs to the UI (+layout.svelte), which re-themes\n\t\t// whenever this store changes. Keeping the DOM write out of here means the\n\t\t// transport layer stays testable without a document.\n\t\tappearanceStore.set(appearance);\n\t} catch (err) {\n\t\tconsole.error('Failed to fetch config:', err);\n\t}\n}\n\nexport function setCurrentSession(sessionId: string | null): void {\n\tsessionFolders.update((s) => ({...s, currentSession: sessionId}));\n}\n"],"names":["index","_","i","pause_effects","state","to_destroy","controlled_anchor","transitions","length","group","remaining","effect","pause_effect","groups","destroy_effects","array_from","fast_path","anchor","parent_node","clear_text_content","remove_dom","preserved_effects","keys","key","e","EFFECT_OFFSCREEN","fragment","move_effect","destroy_effect","offscreen_anchor","each","node","flags","get_collection","get_key","render_fn","fallback_fn","items","is_controlled","EACH_IS_CONTROLLED","hydrating","set_hydrate_node","get_first_child","create_text","hydrate_next","fallback","each_array","derived_safe_equal","collection","is_array","array","pending","first_run","commit","batch","DESTROYED","reconcile","resume_effect","move","discard","block","get","mismatch","is_else","read_hydration_instruction","HYDRATION_START_ELSE","skip_nodes","set_hydrating","current_batch","defer","should_defer_append","hydrate_node","COMMENT_NODE","HYDRATION_END","value","item","internal_set","create_item","branch","e.each_key_duplicate","skip_to_branch","BRANCH_EFFECT","is_animated","EACH_IS_ANIMATED","current","seen","prev","to_animate","matched","stashed","INERT","next","link","start","j","a","b","destroy_length","queue_micro_task","v","EACH_ITEM_REACTIVE","EACH_ITEM_IMMUTABLE","mutable_source","source","EACH_INDEX_REACTIVE","end","dest","next_node","get_next_sibling","IS_CUSTOM_ELEMENT","IS_HTML","LINK_TAG","IS_XHTML","PROGRESS_TAG","remove_input_defaults","input","already_removed","remove_defaults","set_attribute","checked","FORM_RESET_HANDLER","add_form_reset_listener","set_value","element","attributes","get_attributes","set_checked","attribute","skip_warning","LOADING_ATTR_SYMBOL","get_setters","ATTRIBUTES_CACHE","NAMESPACE_HTML","setters_cache","cache_key","setters","descriptors","proto","element_proto","get_descriptors","get_prototype_of","pathname_prefix","resolve","args","base","resolve_route","noop","noopLogger","_getFactory","logs","o","n","r","handleAutomaticUpdate","registration","intervals","lastFocusTime","wakeup","evt","timePassed","listenForWaitingServiceWorker","callback","awaitStateChange","createNotificationsService","lastId","store","writable","add","notification","notifications","remove","id","onClick","pushState","page","logger","updateLoggingForWorker","worker","IDLE_DELAY_MS","CHECK_DELAY_MS","createServiceWorker","pingServideWorker","sendMessage","message","$serviceWorker","skipWaiting","skip","register","refreshing","event","swLocation","getParamsFromURL","url","obj","hash","cleanedUrl","question","piece","val","pathname","getParamsFromLocation","getHashParamsFromLocation","str","serviceWorker","params","version","TOKEN_VARS","ACCENT_VARS","defaultAppearance","applyAppearance","appearance","root","cssVar","CONFIG_KEY","TOKEN_PARAM","takeToken","raw","prefix","body","k","candidate","readUrlToken","search","fromHash","fromSearch","scrubTokenFromUrl","loc","read","history","path","adoptTokenFromUrl","stored","parsed","adopted","adoptTokenFromUrlOnce","sessionFolders","availableModels","readOnlySessionFolders","defaultPort","getBaseUrl","config","defaultHost","protocol","host","port","fetchTimeout","resolveQueue","fetchInFlight","refetchRequested","firstQueuedAt","FETCH_DEBOUNCE_MS","FETCH_MAX_WAIT_MS","doFetchSessions","baseUrl","token","getToken","res","data","s","err","fetchSessions","promise","now","runQueuedFetch","resolves","rest","fetchReadOnlySessions","searchAbort","searchConversations","query","view","controller","fetchModels","gitInitDefaultStore","uploadMethodStore","searchFolderStore","searchCreateRemoteStore","searchDefaultModelStore","appearanceStore","checkPath","pathStr","checkRemoteRepo","fetchRemoteCandidates","autocompletePath","fetchConfig","setCurrentSession","sessionId"],"mappings":"yhBAsDO,SAASA,GAAMC,EAAGC,EAAG,CAC3B,OAAOA,CACR,CASA,SAASC,GAAcC,EAAOC,EAAYC,EAAmB,CAS5D,QAPIC,EAAc,CAAA,EACdC,EAASH,EAAW,OAGpBI,EACAC,EAAYL,EAAW,OAElBH,EAAI,EAAGA,EAAIM,EAAQN,IAAK,CAChC,IAAIS,EAASN,EAAWH,CAAC,EAEzBU,GACCD,EACA,IAAM,CACL,GAAIF,GAIH,GAHAA,EAAM,QAAQ,OAAOE,CAAM,EAC3BF,EAAM,KAAK,IAAIE,CAAM,EAEjBF,EAAM,QAAQ,OAAS,EAAG,CAC7B,IAAII,EAA6CT,EAAM,YAEvDU,GAAgBV,EAAOW,GAAWN,EAAM,IAAI,CAAC,EAC7CI,EAAO,OAAOJ,CAAK,EAEfI,EAAO,OAAS,IACnBT,EAAM,YAAc,KAEtB,OAEAM,GAAa,CAEf,EACA,EACH,CACC,CAEA,GAAIA,IAAc,EAAG,CAIpB,IAAIM,EAAYT,EAAY,SAAW,GAAKD,IAAsB,KAElE,GAAIU,EAAW,CACd,IAAIC,EAAiCX,EACjCY,EAAsCD,EAAO,WAEjDE,GAAmBD,CAAW,EAC9BA,EAA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