Files
voidarc-homepage/node_modules/.vite/deps/index-client-D0TavHuA.js
2026-11-02 12:42:04 +00:00

4491 lines
144 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { $n as NAMESPACE_SVG, A as remove_effect_dom, Ar as is_array, Bn as hydrating, Bt as add_form_reset_listener, C as effect_root, Cn as invalid_snippet, Cr as define_property, D as managed, Dn as rune_outside_svelte, Dr as get_descriptors, Dt as capture, En as props_rest_readonly, Er as get_descriptor, F as user_effect, Fn as svelte_element_invalid_this_value, Fr as run, Ft as unset_context, Gn as set_hydrating, Gt as queue_micro_task, H as clear_text_content, Hn as read_hydration_instruction, I as user_pre_effect, In as safe_not_equal, Ir as run_all, J as get_first_child, Jn as FILENAME, K as create_text, Kn as skip_nodes, L as validate_effect, Ln as hydrate_next, Lt as listen, M as resume_effect, Mn as lifecycle_outside_component, Mr as is_promise, N as teardown, Nn as snippet_without_render_tag, Nr as noop, O as move_effect, Or as get_prototype_of, Ot as flatten, P as template_effect, Pn as store_invalid_shape, Pr as object_keys, Qn as NAMESPACE_MATHML, Rn as hydrate_node, Rt as listen_to_event_and_reset_event, S as effect, St as previous_batch, Tn as props_invalid_value, Tt as derived_safe_equal, U as create_comment, Un as reset, Vt as autofocus, W as create_element, Wn as set_hydrate_node, Xn as HYDRATION_ERROR, Xt as dev_stack, Y as get_next_sibling, Yn as HMR, Yt as dev_current_component_function, Zn as NAMESPACE_HTML, _ as branch, _n as each_key_duplicate, _t as current_batch, a as get, at as is, b as destroy_effect, bn as get_abort_signal_outside_reaction, c as set_active_effect, cr as EFFECT_TRANSPARENT, ct as internal_set, d as tick, dr as HMR_ANCHOR, dt as set, en as is_runes, er as UNINITIALIZED, f as untrack, fn as snapshot, ft as source, g as block, gn as component_api_invalid_new, gt as Batch, hn as component_api_changed, hr as LOADING_ATTR_SYMBOL, i as deep_read_state, j as render_effect, jn as invalid_snippet_arguments, jr as is_function, jt as run_after_blockers, k as pause_effect, kn as experimental_async_required, kr as has_own_property, l as set_active_reaction, ln as tag, lr as FORM_RESET_HANDLER, lt as mutable_source, mn as bind_invalid_checkbox_value, mr as LEGACY_PROPS, mt as update, n as active_reaction, nr as CLASS_CACHE, o as is_destroying_effect, on as set_dev_current_component_function, or as EFFECT_OFFSCREEN, ot as proxy, pn as dynamic_void_element_content, pr as IS_XHTML, qn as ATTACHMENT_KEY, qt as component_context, sn as get_error, t as active_effect, tn as mark_as_component, tr as ATTRIBUTES_CACHE, tt as should_defer_append, ur as HEAD_EFFECT, vn as each_key_volatile, vr as STATE_SYMBOL, wn as lifecycle_legacy_only, wt as derived, x as eager_effect, xn as hydratable_missing_but_required, xr as array_from, xt as is_flushing_sync, yr as STYLE_CACHE, yt as flushSync, zt as without_reactive_context } from "./runtime-BOFXI46e.js";
import { B as sanitize_location, C as assign_nodes, F as hash, I as is_capture_event, L as is_raw_text_element, M as create_fragment_from_html, N as create_trusted_html, P as can_delegate_event, R as is_void, S as append, g as set_should_intro, r as createClassComponent, v as should_intro, z as normalize_attribute } from "./legacy-client-DZ46pveM.js";
import { _ as select_multiple_invalid_value, a as console_log_state, d as hydration_mismatch, f as invalid_raw_snippet_render, g as ownership_invalid_mutation, h as ownership_invalid_binding, i as binding_property_non_reactive, l as hydration_attribute_changed, t as assignment_value_stale, u as hydration_html_changed } from "./warnings-BCxPSjeg.js";
import "./esm-env-D8Yi5ac9.js";
import { a as delegated, i as delegate, r as create_event } from "./events-21uQP6Br.js";
import { clsx as clsx$1 } from "./svelte_n_clsx.js";
import { a as legacy_mode_flag, t as async_mode_flag } from "./flags-qfBdqUK7.js";
import { n as get$1, o as subscribe_to_store } from "./shared-CBkF5T1F.js";
// node_modules/svelte/src/attachments/index.js
/** @import { Action, ActionReturn } from '../action/public' */
/** @import { Attachment } from './public' */
/**
* Creates an object key that will be recognised as an attachment when the object is spread onto an element,
* as a programmatic alternative to using `{@attach ...}`. This can be useful for library authors, though
* is generally not needed when building an app.
*
* ```svelte
* <script>
* import { createAttachmentKey } from 'svelte/attachments';
*
* const props = {
* class: 'cool',
* onclick: () => alert('clicked'),
* [createAttachmentKey()]: (node) => {
* node.textContent = 'attached!';
* }
* };
* <\/script>
*
* <button {...props}>click me</button>
* ```
* @since 5.29
*/
function createAttachmentKey() {
return Symbol(ATTACHMENT_KEY);
}
/**
* Converts an [action](https://svelte.dev/docs/svelte/use) into an [attachment](https://svelte.dev/docs/svelte/@attach) keeping the same behavior.
* It's useful if you want to start using attachments on components but you have actions provided by a library.
*
* Note that the second argument, if provided, must be a function that _returns_ the argument to the
* action function, not the argument itself.
*
* ```svelte
* <!-- with an action -->
* <div use:foo={bar}>...</div>
*
* <!-- with an attachment -->
* <div {@attach fromAction(foo, () => bar)}>...</div>
* ```
* @template {EventTarget} E
* @template {unknown} T
* @overload
* @param {Action<E, T> | ((element: E, arg: T) => void | ActionReturn<T>)} action The action function
* @param {() => T} fn A function that returns the argument for the action
* @returns {Attachment<E>}
*/
/**
* Converts an [action](https://svelte.dev/docs/svelte/use) into an [attachment](https://svelte.dev/docs/svelte/@attach) keeping the same behavior.
* It's useful if you want to start using attachments on components but you have actions provided by a library.
*
* Note that the second argument, if provided, must be a function that _returns_ the argument to the
* action function, not the argument itself.
*
* ```svelte
* <!-- with an action -->
* <div use:foo={bar}>...</div>
*
* <!-- with an attachment -->
* <div {@attach fromAction(foo, () => bar)}>...</div>
* ```
* @template {EventTarget} E
* @overload
* @param {Action<E, void> | ((element: E) => void | ActionReturn<void>)} action The action function
* @returns {Attachment<E>}
*/
/**
* Converts an [action](https://svelte.dev/docs/svelte/use) into an [attachment](https://svelte.dev/docs/svelte/@attach) keeping the same behavior.
* It's useful if you want to start using attachments on components but you have actions provided by a library.
*
* Note that the second argument, if provided, must be a function that _returns_ the argument to the
* action function, not the argument itself.
*
* ```svelte
* <!-- with an action -->
* <div use:foo={bar}>...</div>
*
* <!-- with an attachment -->
* <div {@attach fromAction(foo, () => bar)}>...</div>
* ```
*
* @template {EventTarget} E
* @template {unknown} T
* @param {Action<E, T> | ((element: E, arg: T) => void | ActionReturn<T>)} action The action function
* @param {() => T} fn A function that returns the argument for the action
* @returns {Attachment<E>}
* @since 5.32
*/
function fromAction(action, fn = noop) {
return (element) => {
const { update, destroy } = untrack(() => action(element, fn()) ?? {});
if (update) {
var ran = false;
render_effect(() => {
const arg = fn();
if (ran) update(arg);
});
ran = true;
}
if (destroy) teardown(destroy);
};
}
// node_modules/svelte/src/internal/client/dev/assign.js
/**
*
* @param {any} a
* @param {any} b
* @param {string} property
* @param {string} location
*/
function compare(a, b, property, location) {
if (a !== b && typeof b === "object" && STATE_SYMBOL in b) assignment_value_stale(property, sanitize_location(location));
return a;
}
/**
* @param {any} object
* @param {string} property
* @param {string} operator
* @param {any} rhs
* @param {string} location
*/
function assign(object, property, operator, rhs, location) {
return compare(operator === "=" ? object[property] = rhs : operator === "&&=" ? object[property] &&= rhs() : operator === "||=" ? object[property] ||= rhs() : operator === "??=" ? object[property] ??= rhs() : null, untrack(() => object[property]), property, location);
}
/**
* @param {any} object
* @param {string} property
* @param {string} operator
* @param {any} rhs
* @param {string} location
*/
async function assign_async(object, property, operator, rhs, location) {
return compare(operator === "=" ? object[property] = await rhs : operator === "&&=" ? object[property] &&= await rhs() : operator === "||=" ? object[property] ||= await rhs() : operator === "??=" ? object[property] ??= await rhs() : null, untrack(() => object[property]), property, location);
}
// node_modules/svelte/src/internal/client/dev/css.js
/** @type {Map<String, Set<HTMLStyleElement>>} */
var all_styles = /* @__PURE__ */ new Map();
/**
* @param {String} hash
* @param {HTMLStyleElement} style
*/
function register_style(hash, style) {
var styles = all_styles.get(hash);
if (!styles) {
styles = /* @__PURE__ */ new Set();
all_styles.set(hash, styles);
}
styles.add(style);
}
/**
* @param {String} hash
*/
function cleanup_styles(hash) {
var styles = all_styles.get(hash);
if (!styles) return;
for (const style of styles) style.remove();
all_styles.delete(hash);
}
// node_modules/svelte/src/internal/client/dev/elements.js
/** @import { SourceLocation } from '#client' */
/**
* @param {any} fn
* @param {string} filename
* @param {SourceLocation[]} locations
* @returns {any}
*/
function add_locations(fn, filename, locations) {
return (...args) => {
const dom = fn(...args);
assign_locations(hydrating ? dom : dom.nodeType === 11 ? dom.firstChild : dom, filename, locations);
return dom;
};
}
/**
* @param {Element} element
* @param {string} filename
* @param {SourceLocation} location
*/
function assign_location(element, filename, location) {
element.__svelte_meta = {
parent: dev_stack,
loc: {
file: filename,
line: location[0],
column: location[1]
}
};
if (location[2]) assign_locations(element.firstChild, filename, location[2]);
}
/**
* @param {Node | null} node
* @param {string} filename
* @param {SourceLocation[]} locations
*/
function assign_locations(node, filename, locations) {
var i = 0;
var depth = 0;
while (node && i < locations.length) {
if (hydrating && node.nodeType === 8) {
var comment = node;
if (comment.data[0] === "[") depth += 1;
else if (comment.data[0] === "]") depth -= 1;
}
if (depth === 0 && node.nodeType === 1) assign_location(node, filename, locations[i++]);
node = node.nextSibling;
}
}
// node_modules/svelte/src/internal/client/dev/hmr.js
/** @import { Effect, TemplateNode } from '#client' */
/**
* @template {(anchor: Comment, props: any) => any} Component
* @param {Component} fn
*/
function hmr(fn) {
const current = source(fn);
/**
* @param {TemplateNode} initial_anchor
* @param {any} props
*/
function wrapper(initial_anchor, props) {
let component = {};
let instance = {};
/** @type {Effect} */
let effect;
let ran = false;
let anchor = initial_anchor;
block(() => {
if (component === (component = get(current))) return;
if (effect) {
for (var k in instance) delete instance[k];
destroy_effect(effect);
}
effect = branch(() => {
anchor = anchor[HMR_ANCHOR] ?? anchor;
if (ran) set_should_intro(false);
var result = new.target ? new component(anchor, props) : component(anchor, props);
if (result) Object.defineProperties(instance, Object.getOwnPropertyDescriptors(result));
if (ran) set_should_intro(true);
});
var inner_nodes = effect.nodes;
if (inner_nodes) {
var ae = active_effect;
if (ae.nodes) {
ae.nodes.start = inner_nodes.start;
ae.nodes.end = inner_nodes.end;
} else ae.nodes = {
start: inner_nodes.start,
end: inner_nodes.end,
a: null,
t: null
};
}
}, EFFECT_TRANSPARENT);
ran = true;
if (hydrating) anchor = hydrate_node;
return instance;
}
wrapper[FILENAME] = fn[FILENAME];
wrapper[HMR] = {
fn,
current,
update: (incoming) => {
set(wrapper[HMR].current, incoming[HMR].fn);
incoming[HMR].current = wrapper[HMR].current;
}
};
return wrapper;
}
// node_modules/svelte/src/internal/client/dev/ownership.js
/** @typedef {{ file: string, line: number, column: number }} Location */
/**
* Sets up a validator that
* - traverses the path of a prop to find out if it is allowed to be mutated
* - checks that the binding chain is not interrupted
* @param {Record<string, any>} props
*/
function create_ownership_validator(props) {
const component = component_context?.function;
const parent = component_context?.p?.function;
return {
/**
* @param {string} prop
* @param {any[]} path
* @param {any} result
* @param {number} line
* @param {number} column
*/
mutation: (prop, path, result, line, column) => {
const name = path[0];
if (is_bound_or_unset(props, name) || !parent) return result;
/** @type {any} */
let value = props;
for (let i = 0; i < path.length - 1; i++) {
value = value[path[i]];
if (!value?.[STATE_SYMBOL]) return result;
}
const location = sanitize_location(`${component[FILENAME]}:${line}:${column}`);
ownership_invalid_mutation(name, location, prop, parent[FILENAME]);
return result;
},
/**
* @param {any} key
* @param {any} child_component
* @param {() => any} value
*/
binding: (key, child_component, value) => {
if (!is_bound_or_unset(props, key) && parent && value()?.[STATE_SYMBOL]) ownership_invalid_binding(component[FILENAME], key, child_component[FILENAME], parent[FILENAME]);
}
};
}
/**
* @param {Record<string, any>} props
* @param {string} prop_name
*/
function is_bound_or_unset(props, prop_name) {
const is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;
return !!get_descriptor(props, prop_name)?.set || is_entry_props && prop_name in props || !(prop_name in props);
}
// node_modules/svelte/src/internal/client/dev/legacy.js
/** @param {Function & { [FILENAME]: string }} target */
function check_target(target) {
if (target) component_api_invalid_new(target[FILENAME] ?? "a component", target.name);
}
function legacy_api() {
const component = component_context?.function;
/** @param {string} method */
function error(method) {
component_api_changed(method, component[FILENAME]);
}
return {
$destroy: () => error("$destroy()"),
$on: () => error("$on(...)"),
$set: () => error("$set(...)")
};
}
// node_modules/svelte/src/internal/client/dev/inspect.js
/**
* @param {() => any[]} get_value
* @param {Function} inspector
* @param {boolean} show_stack
*/
function inspect(get_value, inspector, show_stack = false) {
validate_effect("$inspect");
let initial = true;
let error = UNINITIALIZED;
eager_effect(() => {
error = UNINITIALIZED;
try {
var value = get_value();
} catch (e) {
error = e;
return;
}
var snap = snapshot(value, true, true);
untrack(() => {
if (show_stack) {
inspector(...snap);
if (!initial) {
const stack = get_error("$inspect(...)");
if (stack) {
console.groupCollapsed("stack trace");
console.log(stack);
console.groupEnd();
}
}
} else inspector(initial ? "init" : "update", ...snap);
});
initial = false;
});
render_effect(() => {
try {
get_value();
} catch {}
if (error !== UNINITIALIZED) {
console.error(error);
error = UNINITIALIZED;
}
});
}
// node_modules/svelte/src/internal/client/dom/blocks/async.js
/** @import { Blocker, TemplateNode, Value } from '#client' */
/**
* @param {TemplateNode} node
* @param {Blocker[]} blockers
* @param {Array<() => Promise<any>>} expressions
* @param {(anchor: TemplateNode, ...deriveds: Value[]) => void} fn
*/
function async(node, blockers = [], expressions = [], fn) {
var was_hydrating = hydrating;
var end = null;
if (was_hydrating) {
hydrate_next();
end = skip_nodes(false);
assign_nodes(node, end);
}
if (expressions.length === 0 && blockers.every((b) => b.settled)) {
fn(node);
if (was_hydrating) set_hydrate_node(end);
return;
}
if (was_hydrating) {
var previous_hydrate_node = hydrate_node;
set_hydrate_node(end);
}
flatten(blockers, [], expressions, (values) => {
if (was_hydrating) {
set_hydrating(true);
set_hydrate_node(previous_hydrate_node);
}
try {
for (const d of values) get(d);
fn(node, ...values);
} finally {
if (was_hydrating) set_hydrating(false);
}
});
}
// node_modules/svelte/src/internal/client/dev/validation.js
/**
* @param {Node} anchor
* @param {...(()=>any)[]} args
*/
function validate_snippet_args(anchor, ...args) {
if (typeof anchor !== "object" || !(anchor instanceof Node)) invalid_snippet_arguments();
for (let arg of args) if (typeof arg !== "function") invalid_snippet_arguments();
}
// node_modules/svelte/src/internal/client/dom/blocks/branches.js
/** @import { Effect, TemplateNode } from '#client' */
/**
* @typedef {{ effect: Effect, fragment: DocumentFragment }} Branch
*/
/**
* @template Key
*/
var BranchManager = class {
/** @type {TemplateNode} */
anchor;
/** @type {Map<Batch, Key>} */
#batches = /* @__PURE__ */ new Map();
/**
* Map of keys to effects that are currently rendered in the DOM.
* These effects are visible and actively part of the document tree.
* Example:
* ```
* {#if condition}
* foo
* {:else}
* bar
* {/if}
* ```
* Can result in the entries `true->Effect` and `false->Effect`
* @type {Map<Key, Effect>}
*/
#onscreen = /* @__PURE__ */ new Map();
/**
* Similar to #onscreen with respect to the keys, but contains branches that are not yet
* in the DOM, because their insertion is deferred.
* @type {Map<Key, Branch>}
*/
#offscreen = /* @__PURE__ */ new Map();
/**
* Keys of effects that are currently outroing
* @type {Set<Key>}
*/
#outroing = /* @__PURE__ */ new Set();
/**
* Whether to pause (i.e. outro) on change, or destroy immediately.
* This is necessary for `<svelte:element>`
*/
#transition = true;
/**
* @param {TemplateNode} anchor
* @param {boolean} transition
*/
constructor(anchor, transition = true) {
this.anchor = anchor;
this.#transition = transition;
}
/**
* @param {Batch} batch
*/
#commit = (batch) => {
if (!this.#batches.has(batch)) return;
var key = this.#batches.get(batch);
var onscreen = this.#onscreen.get(key);
if (onscreen) {
resume_effect(onscreen);
this.#outroing.delete(key);
} else {
var offscreen = this.#offscreen.get(key);
if (offscreen) {
resume_effect(offscreen.effect);
this.#onscreen.set(key, offscreen.effect);
this.#offscreen.delete(key);
/** @type {any} */ offscreen.fragment.lastChild[HMR_ANCHOR] = this.anchor;
/** @type {TemplateNode} */ offscreen.fragment.lastChild.remove();
this.anchor.before(offscreen.fragment);
onscreen = offscreen.effect;
}
}
for (const [b, k] of this.#batches) {
this.#batches.delete(b);
if (b === batch) break;
const offscreen = this.#offscreen.get(k);
if (offscreen) {
destroy_effect(offscreen.effect);
this.#offscreen.delete(k);
}
}
for (const [k, effect] of this.#onscreen) {
if (k === key || this.#outroing.has(k)) continue;
const on_destroy = () => {
if (Array.from(this.#batches.values()).includes(k)) {
var fragment = document.createDocumentFragment();
move_effect(effect, fragment);
fragment.append(create_text());
this.#offscreen.set(k, {
effect,
fragment
});
} else destroy_effect(effect);
this.#outroing.delete(k);
this.#onscreen.delete(k);
};
if (this.#transition || !onscreen) {
this.#outroing.add(k);
pause_effect(effect, on_destroy, false);
} else on_destroy();
}
};
/**
* @param {Batch} batch
*/
#discard = (batch) => {
this.#batches.delete(batch);
const keys = Array.from(this.#batches.values());
for (const [k, branch] of this.#offscreen) if (!keys.includes(k)) {
destroy_effect(branch.effect);
this.#offscreen.delete(k);
}
};
/**
*
* @param {any} key
* @param {null | ((target: TemplateNode) => void)} fn
*/
ensure(key, fn) {
var batch = current_batch;
var defer = should_defer_append();
if (fn && !this.#onscreen.has(key) && !this.#offscreen.has(key)) {
if (defer) {
var fragment = document.createDocumentFragment();
var target = create_text();
fragment.append(target);
this.#offscreen.set(key, {
effect: branch(() => fn(target)),
fragment
});
} else this.#onscreen.set(key, branch(() => fn(this.anchor)));
}
this.#batches.set(batch, key);
if (defer) {
for (const [k, effect] of this.#onscreen) if (k === key) batch.unskip_effect(effect);
else batch.skip_effect(effect);
for (const [k, branch] of this.#offscreen) if (k === key) batch.unskip_effect(branch.effect);
else batch.skip_effect(branch.effect);
batch.oncommit(this.#commit);
batch.ondiscard(this.#discard);
} else {
if (hydrating) this.anchor = hydrate_node;
this.#commit(batch);
}
}
};
// node_modules/svelte/src/internal/client/dom/blocks/await.js
/** @import { Source, TemplateNode } from '#client' */
var PENDING = 0;
var THEN = 1;
var CATCH = 2;
/** @typedef {typeof PENDING | typeof THEN | typeof CATCH} AwaitState */
/**
* @template V
* @param {TemplateNode} node
* @param {(() => any)} get_input
* @param {null | ((anchor: Node) => void)} pending_fn
* @param {null | ((anchor: Node, value: Source<V>) => void)} then_fn
* @param {null | ((anchor: Node, error: unknown) => void)} catch_fn
* @returns {void}
*/
function await_block(node, get_input, pending_fn, then_fn, catch_fn) {
if (hydrating) hydrate_next();
var runes = is_runes();
var v = UNINITIALIZED;
var value = runes ? source(v) : /* @__PURE__ */ mutable_source(v, false, false);
var error = runes ? source(v) : /* @__PURE__ */ mutable_source(v, false, false);
value.label = "{#await ...} value";
error.label = "{#await ...} error";
var branches = new BranchManager(node);
block(() => {
var batch = current_batch;
var input = get_input();
var destroyed = false;
/** Whether or not there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */
let mismatch = hydrating && is_promise(input) === (node.data === "[!");
if (mismatch) {
set_hydrate_node(skip_nodes());
set_hydrating(false);
}
if (is_promise(input)) {
var restore = capture();
var resolved = false;
/**
* @param {() => void} fn
*/
const resolve = (fn) => {
if (destroyed) return;
resolved = true;
restore(false);
if (current_batch === batch) batch.deactivate();
Batch.ensure();
try {
fn();
} finally {
unset_context(false);
if (!is_flushing_sync) flushSync();
}
};
input.then((v) => {
resolve(() => {
internal_set(value, v);
branches.ensure(THEN, then_fn && ((target) => then_fn(target, value)));
});
}, (e) => {
resolve(() => {
internal_set(error, e);
branches.ensure(CATCH, catch_fn && ((target) => catch_fn(target, error)));
if (!catch_fn) throw error.v;
});
});
if (hydrating) branches.ensure(PENDING, pending_fn);
else queue_micro_task(() => {
if (!resolved) resolve(() => {
branches.ensure(PENDING, pending_fn);
});
});
} else {
internal_set(value, input);
branches.ensure(THEN, then_fn && ((target) => then_fn(target, value)));
}
if (mismatch) set_hydrating(true);
return () => {
destroyed = true;
};
});
}
// node_modules/svelte/src/internal/client/dom/blocks/if.js
/** @import { TemplateNode } from '#client' */
/**
* @param {TemplateNode} node
* @param {(branch: (fn: (anchor: Node) => void, key?: number | false) => void) => void} fn
* @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'
* @returns {void}
*/
function if_block(node, fn, elseif = false) {
/** @type {TemplateNode | undefined} */
var marker;
if (hydrating) {
marker = hydrate_node;
hydrate_next();
}
var branches = new BranchManager(node);
var flags = elseif ? EFFECT_TRANSPARENT : 0;
/**
* @param {number | false} key
* @param {null | ((anchor: Node) => void)} fn
*/
function update_branch(key, fn) {
if (hydrating) {
var data = read_hydration_instruction(marker);
if (key !== parseInt(data.substring(1))) {
var anchor = skip_nodes();
set_hydrate_node(anchor);
branches.anchor = anchor;
set_hydrating(false);
branches.ensure(key, fn);
set_hydrating(true);
return;
}
}
branches.ensure(key, fn);
}
block(() => {
var has_branch = false;
fn((fn, key = 0) => {
has_branch = true;
update_branch(key, fn);
});
if (!has_branch) update_branch(-1, null);
}, flags);
}
// node_modules/svelte/src/internal/client/dom/blocks/key.js
/** @import { TemplateNode } from '#client' */
var NAN = Symbol("NaN");
/**
* @template V
* @param {TemplateNode} node
* @param {() => V} get_key
* @param {(anchor: Node) => TemplateNode | void} render_fn
* @returns {void}
*/
function key(node, get_key, render_fn) {
if (hydrating) hydrate_next();
var branches = new BranchManager(node);
var legacy = !is_runes();
block(() => {
var key = get_key();
if (key !== key) key = NAN;
if (legacy && key !== null && typeof key === "object") key = {};
branches.ensure(key, render_fn);
});
}
// node_modules/svelte/src/internal/client/dom/blocks/css-props.js
/**
* @param {HTMLDivElement | SVGGElement} element
* @param {() => Record<string, string>} get_styles
* @returns {void}
*/
function css_props(element, get_styles) {
if (hydrating) set_hydrate_node(/* @__PURE__ */ get_first_child(element));
render_effect(() => {
var styles = get_styles();
for (var key in styles) {
var value = styles[key];
if (value == null || value === "") element.style.removeProperty(key);
else element.style.setProperty(key, value);
}
});
}
// node_modules/svelte/src/internal/client/dom/blocks/each.js
/** @import { EachItem, EachOutroGroup, EachState, Effect, EffectNodes, MaybeSource, TemplateNode, TransitionManager } from '#client' */
/** @import { Batch } from '../../reactivity/batch.js'; */
/**
* @param {any} _
* @param {number} i
*/
function index(_, i) {
return i;
}
/**
* Pause multiple effects simultaneously, and coordinate their
* subsequent destruction. Used in each blocks
* @param {EachState} state
* @param {Effect[]} to_destroy
* @param {null | Node} controlled_anchor
*/
function pause_effects(state, to_destroy, controlled_anchor) {
/** @type {TransitionManager[]} */
var transitions = [];
var length = to_destroy.length;
/** @type {EachOutroGroup} */
var group;
var remaining = to_destroy.length;
for (var i = 0; i < length; i++) {
let effect = to_destroy[i];
pause_effect(effect, () => {
if (group) {
group.pending.delete(effect);
group.done.add(effect);
if (group.pending.size === 0) {
var groups = state.outrogroups;
destroy_effects(state, array_from(group.done));
groups.delete(group);
if (groups.size === 0) state.outrogroups = null;
}
} else remaining -= 1;
}, false);
}
if (remaining === 0) {
var fast_path = transitions.length === 0 && controlled_anchor !== null && state.pending.size === 0;
if (fast_path) {
var anchor = controlled_anchor;
var parent_node = anchor.parentNode;
clear_text_content(parent_node);
parent_node.append(anchor);
state.items.clear();
}
destroy_effects(state, to_destroy, !fast_path);
} else {
group = {
pending: new Set(to_destroy),
done: /* @__PURE__ */ new Set()
};
(state.outrogroups ??= /* @__PURE__ */ new Set()).add(group);
}
}
/**
* @param {EachState} state
* @param {Effect[]} to_destroy
* @param {boolean} remove_dom
*/
function destroy_effects(state, to_destroy, remove_dom = true) {
/** @type {Set<Effect> | undefined} */
var preserved_effects;
if (state.pending.size > 0) {
preserved_effects = /* @__PURE__ */ new Set();
for (const keys of state.pending.values()) for (const key of keys) preserved_effects.add(
/** @type {EachItem} */
state.items.get(key).e
);
}
for (var i = 0; i < to_destroy.length; i++) {
var e = to_destroy[i];
if (preserved_effects?.has(e)) {
e.f |= EFFECT_OFFSCREEN;
const fragment = document.createDocumentFragment();
move_effect(e, fragment);
} else destroy_effect(to_destroy[i], remove_dom);
}
}
/** @type {TemplateNode} */
var offscreen_anchor;
/**
* @template V
* @param {Element | Comment} node The next sibling node, or the parent node if this is a 'controlled' block
* @param {number} flags
* @param {() => V[]} get_collection
* @param {(value: V, index: number) => any} get_key
* @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>) => void} render_fn
* @param {null | ((anchor: Node) => void)} fallback_fn
* @returns {void}
*/
function each(node, flags, get_collection, get_key, render_fn, fallback_fn = null) {
var anchor = node;
/** @type {Map<any, EachItem>} */
var items = /* @__PURE__ */ new Map();
if ((flags & 4) !== 0) {
var parent_node = node;
anchor = hydrating ? set_hydrate_node(/* @__PURE__ */ get_first_child(parent_node)) : parent_node.appendChild(create_text());
}
if (hydrating) hydrate_next();
/** @type {Effect | null} */
var fallback = null;
var each_array = /* @__PURE__ */ derived_safe_equal(() => {
var collection = get_collection();
return is_array(collection) ? collection : collection == null ? [] : array_from(collection);
});
tag(each_array, "{#each ...}");
/** @type {Map<Batch, Set<any>>} */
var pending = /* @__PURE__ */ new Map();
var first_run = true;
/**
* @param {Batch} batch
*/
function commit(batch) {
if ((state.effect.f & 16384) !== 0) return;
state.pending.delete(batch);
var array = get(each_array);
state.fallback = fallback;
reconcile(state, array, anchor, flags, get_key);
if (fallback !== null) {
if (array.length === 0) {
if ((fallback.f & 33554432) === 0) resume_effect(fallback);
else {
fallback.f ^= EFFECT_OFFSCREEN;
move(fallback, null, anchor);
}
} else pause_effect(fallback, () => {
fallback = null;
});
}
}
/**
* @param {Batch} batch
*/
function discard(batch) {
state.pending.delete(batch);
}
/** @type {EachState} */
var state = {
effect: block(() => {
var array = get(each_array);
var length = array.length;
/** `true` if there was a hydration mismatch. Needs to be a `let` or else it isn't treeshaken out */
let mismatch = false;
if (hydrating) {
if (read_hydration_instruction(anchor) === "[!" !== (length === 0)) {
anchor = skip_nodes();
set_hydrate_node(anchor);
set_hydrating(false);
mismatch = true;
}
}
var keys = /* @__PURE__ */ new Set();
var batch = current_batch;
var defer = should_defer_append();
for (var index = 0; index < length; index += 1) {
if (hydrating && hydrate_node.nodeType === 8 && hydrate_node.data === "]") {
anchor = hydrate_node;
mismatch = true;
set_hydrating(false);
}
var value = array[index];
var key = get_key(value, index);
var key_again = get_key(value, index);
if (key !== key_again) each_key_volatile(String(index), String(key), String(key_again));
var item = first_run ? null : items.get(key);
if (item) {
if (item.v) internal_set(item.v, value);
if (item.i) internal_set(item.i, index);
if (defer) batch.unskip_effect(item.e);
} else {
item = create_item(items, first_run ? anchor : offscreen_anchor ??= create_text(), value, key, index, render_fn, flags, get_collection);
if (!first_run) item.e.f |= EFFECT_OFFSCREEN;
items.set(key, item);
}
keys.add(key);
}
if (length === 0 && fallback_fn && !fallback) {
if (first_run) fallback = branch(() => fallback_fn(anchor));
else {
fallback = branch(() => fallback_fn(offscreen_anchor ??= create_text()));
fallback.f |= EFFECT_OFFSCREEN;
}
}
if (length > keys.size) validate_each_keys(array, get_key);
if (hydrating && length > 0) set_hydrate_node(skip_nodes());
if (!first_run) {
pending.set(batch, keys);
if (defer) {
for (const [key, item] of items) if (!keys.has(key)) batch.skip_effect(item.e);
batch.oncommit(commit);
batch.ondiscard(discard);
} else commit(batch);
}
if (mismatch) set_hydrating(true);
get(each_array);
}),
flags,
items,
pending,
outrogroups: null,
fallback
};
first_run = false;
if (hydrating) anchor = hydrate_node;
}
/**
* Skip past any non-branch effects (which could be created with `createSubscriber`, for example) to find the next branch effect
* @param {Effect | null} effect
* @returns {Effect | null}
*/
function skip_to_branch(effect) {
while (effect !== null && (effect.f & 32) === 0) effect = effect.next;
return effect;
}
/**
* Add, remove, or reorder items output by an each block as its input changes
* @template V
* @param {EachState} state
* @param {Array<V>} array
* @param {Element | Comment | Text} anchor
* @param {number} flags
* @param {(value: V, index: number) => any} get_key
* @returns {void}
*/
function reconcile(state, array, anchor, flags, get_key) {
var is_animated = (flags & 8) !== 0;
var length = array.length;
var items = state.items;
var current = skip_to_branch(state.effect.first);
/** @type {undefined | Set<Effect>} */
var seen;
/** @type {Effect | null} */
var prev = null;
/** @type {undefined | Set<Effect>} */
var to_animate;
/** @type {Effect[]} */
var matched = [];
/** @type {Effect[]} */
var stashed = [];
/** @type {V} */
var value;
/** @type {any} */
var key;
/** @type {Effect | undefined} */
var effect;
/** @type {number} */
var i;
if (is_animated) for (i = 0; i < length; i += 1) {
value = array[i];
key = get_key(value, i);
effect = items.get(key).e;
if ((effect.f & 33554432) === 0) {
effect.nodes?.a?.measure();
(to_animate ??= /* @__PURE__ */ new Set()).add(effect);
}
}
for (i = 0; i < length; i += 1) {
value = array[i];
key = get_key(value, i);
effect = items.get(key).e;
if (state.outrogroups !== null) for (const group of state.outrogroups) {
group.pending.delete(effect);
group.done.delete(effect);
}
if ((effect.f & 8192) !== 0) {
resume_effect(effect);
if (is_animated) {
effect.nodes?.a?.unfix();
(to_animate ??= /* @__PURE__ */ new Set()).delete(effect);
}
}
if ((effect.f & 33554432) !== 0) {
effect.f ^= EFFECT_OFFSCREEN;
if (effect === current) move(effect, null, anchor);
else {
var next = prev ? prev.next : current;
if (effect === state.effect.last) state.effect.last = effect.prev;
if (effect.prev) effect.prev.next = effect.next;
if (effect.next) effect.next.prev = effect.prev;
link(state, prev, effect);
link(state, effect, next);
move(effect, next, anchor);
prev = effect;
matched = [];
stashed = [];
current = skip_to_branch(prev.next);
continue;
}
}
if (effect !== current) {
if (seen !== void 0 && seen.has(effect)) {
if (matched.length < stashed.length) {
var start = stashed[0];
var j;
prev = start.prev;
var a = matched[0];
var b = matched[matched.length - 1];
for (j = 0; j < matched.length; j += 1) move(matched[j], start, anchor);
for (j = 0; j < stashed.length; j += 1) seen.delete(stashed[j]);
link(state, a.prev, b.next);
link(state, prev, a);
link(state, b, start);
current = start;
prev = b;
i -= 1;
matched = [];
stashed = [];
} else {
seen.delete(effect);
move(effect, current, anchor);
link(state, effect.prev, effect.next);
link(state, effect, prev === null ? state.effect.first : prev.next);
link(state, prev, effect);
prev = effect;
}
continue;
}
matched = [];
stashed = [];
while (current !== null && current !== effect) {
(seen ??= /* @__PURE__ */ new Set()).add(current);
stashed.push(current);
current = skip_to_branch(current.next);
}
if (current === null) continue;
}
if ((effect.f & 33554432) === 0) matched.push(effect);
prev = effect;
current = skip_to_branch(effect.next);
}
if (state.outrogroups !== null) {
for (const group of state.outrogroups) if (group.pending.size === 0) {
destroy_effects(state, array_from(group.done));
state.outrogroups?.delete(group);
}
if (state.outrogroups.size === 0) state.outrogroups = null;
}
if (current !== null || seen !== void 0) {
/** @type {Effect[]} */
var to_destroy = [];
if (seen !== void 0) {
for (effect of seen) if ((effect.f & 8192) === 0) to_destroy.push(effect);
}
while (current !== null) {
if ((current.f & 8192) === 0 && current !== state.fallback) to_destroy.push(current);
current = skip_to_branch(current.next);
}
var destroy_length = to_destroy.length;
if (destroy_length > 0) {
var controlled_anchor = (flags & 4) !== 0 && length === 0 ? anchor : null;
if (is_animated) {
for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.measure();
for (i = 0; i < destroy_length; i += 1) to_destroy[i].nodes?.a?.fix();
}
pause_effects(state, to_destroy, controlled_anchor);
}
}
if (is_animated) queue_micro_task(() => {
if (to_animate === void 0) return;
for (effect of to_animate) effect.nodes?.a?.apply();
});
}
/**
* @template V
* @param {Map<any, EachItem>} items
* @param {Node} anchor
* @param {V} value
* @param {unknown} key
* @param {number} index
* @param {(anchor: Node, item: MaybeSource<V>, index: MaybeSource<number>, collection: () => V[]) => void} render_fn
* @param {number} flags
* @param {() => V[]} get_collection
* @returns {EachItem}
*/
function create_item(items, anchor, value, key, index, render_fn, flags, get_collection) {
var v = (flags & 1) !== 0 ? (flags & 16) === 0 ? /* @__PURE__ */ mutable_source(value, false, false) : source(value) : null;
var i = (flags & 2) !== 0 ? source(index) : null;
if (v) v.trace = () => {
get_collection()[i?.v ?? index];
};
return {
v,
i,
e: branch(() => {
render_fn(anchor, v ?? value, i ?? index, get_collection);
return () => {
items.delete(key);
};
})
};
}
/**
* @param {Effect} effect
* @param {Effect | null} next
* @param {Text | Element | Comment} anchor
*/
function move(effect, next, anchor) {
if (!effect.nodes) return;
var node = effect.nodes.start;
var end = effect.nodes.end;
var dest = next && (next.f & 33554432) === 0 ? next.nodes.start : anchor;
while (node !== null) {
var next_node = /* @__PURE__ */ get_next_sibling(node);
dest.before(node);
if (node === end) return;
node = next_node;
}
}
/**
* @param {EachState} state
* @param {Effect | null} prev
* @param {Effect | null} next
*/
function link(state, prev, next) {
if (prev === null) state.effect.first = next;
else prev.next = next;
if (next === null) state.effect.last = prev;
else next.prev = prev;
}
/**
* @param {Array<any>} array
* @param {(item: any, index: number) => string} key_fn
* @returns {void}
*/
function validate_each_keys(array, key_fn) {
const keys = /* @__PURE__ */ new Map();
const length = array.length;
for (let i = 0; i < length; i++) {
const key = key_fn(array[i], i);
if (keys.has(key)) {
const a = String(keys.get(key));
const b = String(i);
/** @type {string | null} */
let k = String(key);
if (k.startsWith("[object ")) k = null;
each_key_duplicate(a, b, k);
}
keys.set(key, i);
}
}
// node_modules/svelte/src/internal/client/dom/blocks/html.js
/** @import { Effect, TemplateNode } from '#client' */
/** @import {} from 'trusted-types' */
/**
* @param {Element} element
* @param {string | null} server_hash
* @param {string | TrustedHTML} value
*/
function check_hash(element, server_hash, value) {
if (!server_hash || server_hash === hash(String(value ?? ""))) return;
let location;
const loc = element.__svelte_meta?.loc;
if (loc) location = `near ${loc.file}:${loc.line}:${loc.column}`;
else if (dev_current_component_function?.[FILENAME]) location = `in ${dev_current_component_function[FILENAME]}`;
hydration_html_changed(sanitize_location(location));
}
/**
* @param {Element | Text | Comment} node
* @param {() => string | TrustedHTML} get_value
* @param {boolean} [is_controlled]
* @param {boolean} [svg]
* @param {boolean} [mathml]
* @param {boolean} [skip_warning]
* @returns {void}
*/
function html(node, get_value, is_controlled = false, svg = false, mathml = false, skip_warning = false) {
var anchor = node;
/** @type {string | TrustedHTML} */
var value = "";
if (is_controlled) {
var parent_node = node;
if (hydrating) anchor = set_hydrate_node(/* @__PURE__ */ get_first_child(parent_node));
}
template_effect(() => {
var effect = active_effect;
if (value === (value = get_value() ?? "")) {
if (hydrating) hydrate_next();
return;
}
if (is_controlled && !hydrating) {
effect.nodes = null;
parent_node.innerHTML = value;
if (value !== "") assign_nodes(/* @__PURE__ */ get_first_child(parent_node), parent_node.lastChild);
return;
}
if (effect.nodes !== null) {
remove_effect_dom(effect.nodes.start, effect.nodes.end);
effect.nodes = null;
}
if (value === "") return;
if (hydrating) {
var hash = hydrate_node.data;
/** @type {TemplateNode | null} */
var next = hydrate_next();
var last = next;
while (next !== null && (next.nodeType !== 8 || next.data !== "")) {
last = next;
next = /* @__PURE__ */ get_next_sibling(next);
}
if (next === null) {
hydration_mismatch();
throw HYDRATION_ERROR;
}
if (!skip_warning) check_hash(next.parentNode, hash, value);
assign_nodes(hydrate_node, last);
anchor = set_hydrate_node(next);
return;
}
var wrapper = create_element(svg ? "svg" : mathml ? "math" : "template", svg ? NAMESPACE_SVG : mathml ? NAMESPACE_MATHML : void 0);
wrapper.innerHTML = value;
/** @type {DocumentFragment | Element} */
var node = svg || mathml ? wrapper : /** @type {HTMLTemplateElement} */ wrapper.content;
assign_nodes(/* @__PURE__ */ get_first_child(node), node.lastChild);
if (svg || mathml) while (/* @__PURE__ */ get_first_child(node)) anchor.before(/* @__PURE__ */ get_first_child(node));
else anchor.before(node);
});
}
// node_modules/svelte/src/internal/client/dom/blocks/slot.js
/**
* @param {Comment} anchor
* @param {Record<string, any>} $$props
* @param {string} name
* @param {Record<string, unknown>} slot_props
* @param {null | ((anchor: Comment) => void)} fallback_fn
*/
function slot(anchor, $$props, name, slot_props, fallback_fn) {
if (hydrating) hydrate_next();
if ($$props.$$host?.$$shadowRoot) {
const element = create_element("slot");
if (name !== "default") element.name = name;
append(anchor, element);
if (fallback_fn !== null) {
const fallback_anchor = create_text();
element.append(fallback_anchor);
fallback_fn(fallback_anchor);
}
return;
}
var slot_fn = $$props.$$slots?.[name];
var is_interop = false;
if (slot_fn === true) {
slot_fn = $$props[name === "default" ? "children" : name];
is_interop = true;
}
if (slot_fn === void 0) {
if (fallback_fn !== null) fallback_fn(anchor);
} else slot_fn(anchor, is_interop ? () => slot_props : slot_props);
}
/**
* @param {Record<string, any>} props
* @returns {Record<string, boolean>}
*/
function sanitize_slots(props) {
/** @type {Record<string, boolean>} */
const sanitized = {};
if (props.children) sanitized.default = true;
for (const key in props.$$slots) sanitized[key] = true;
return sanitized;
}
// node_modules/svelte/src/internal/shared/validate.js
/**
* @param {() => string} tag_fn
* @returns {void}
*/
function validate_void_dynamic_element(tag_fn) {
const tag = tag_fn();
if (tag && is_void(tag)) dynamic_void_element_content(tag);
}
/** @param {() => unknown} tag_fn */
function validate_dynamic_element_tag(tag_fn) {
const tag = tag_fn();
if (tag && !(typeof tag === "string")) svelte_element_invalid_this_value();
}
/**
* @param {any} store
* @param {string} name
*/
function validate_store(store, name) {
if (store != null && typeof store.subscribe !== "function") store_invalid_shape(name);
}
/**
* @template {(...args: any[]) => unknown} T
* @param {T} fn
*/
function prevent_snippet_stringification(fn) {
fn.toString = () => {
snippet_without_render_tag();
return "";
};
return fn;
}
// node_modules/svelte/src/internal/client/dom/blocks/snippet.js
/** @import { Snippet } from 'svelte' */
/** @import { TemplateNode } from '#client' */
/** @import { Getters } from '#shared' */
/**
* @template {(node: TemplateNode, ...args: any[]) => void} SnippetFn
* @param {TemplateNode} node
* @param {() => SnippetFn | null | undefined} get_snippet
* @param {(() => any)[]} args
* @returns {void}
*/
function snippet(node, get_snippet, ...args) {
var branches = new BranchManager(node);
block(() => {
const snippet = get_snippet() ?? null;
if (snippet == null) invalid_snippet();
branches.ensure(snippet, snippet && ((anchor) => snippet(anchor, ...args)));
}, EFFECT_TRANSPARENT);
}
/**
* In development, wrap the snippet function so that it passes validation, and so that the
* correct component context is set for ownership checks
* @param {any} component
* @param {(node: TemplateNode, ...args: any[]) => void} fn
*/
function wrap_snippet(component, fn) {
const snippet = (node, ...args) => {
var previous_component_function = dev_current_component_function;
set_dev_current_component_function(component);
try {
return fn(node, ...args);
} finally {
set_dev_current_component_function(previous_component_function);
}
};
prevent_snippet_stringification(snippet);
return snippet;
}
/**
* Create a snippet programmatically
* @template {unknown[]} Params
* @param {(...params: Getters<Params>) => {
* render: () => string
* setup?: (element: Element) => void | (() => void)
* }} fn
* @returns {Snippet<Params>}
*/
function createRawSnippet(fn) {
return (anchor, ...params) => {
var snippet = fn(...params);
/** @type {Element} */
var element;
if (hydrating) {
element = hydrate_node;
hydrate_next();
} else {
var html = snippet.render().trim();
var fragment = create_fragment_from_html(html);
element = /* @__PURE__ */ get_first_child(fragment);
if (/* @__PURE__ */ get_next_sibling(element) !== null || element.nodeType !== 1) invalid_raw_snippet_render();
anchor.before(element);
}
const result = snippet.setup?.(element);
assign_nodes(element, element);
if (typeof result === "function") teardown(result);
};
}
// node_modules/svelte/src/internal/client/dom/blocks/svelte-component.js
/** @import { TemplateNode, Dom } from '#client' */
/**
* @template P
* @template {(props: P) => void} C
* @param {TemplateNode} node
* @param {() => C} get_component
* @param {(anchor: TemplateNode, component: C) => Dom | void} render_fn
* @returns {void}
*/
function component(node, get_component, render_fn) {
/** @type {TemplateNode | undefined} */
var hydration_start_node;
if (hydrating) {
hydration_start_node = hydrate_node;
hydrate_next();
}
var branches = new BranchManager(node);
block(() => {
var component = get_component() ?? null;
if (hydrating) {
if (read_hydration_instruction(hydration_start_node) === "[" !== (component !== null)) {
var anchor = skip_nodes();
set_hydrate_node(anchor);
branches.anchor = anchor;
set_hydrating(false);
branches.ensure(component, component && ((target) => render_fn(target, component)));
set_hydrating(true);
return;
}
}
branches.ensure(component, component && ((target) => render_fn(target, component)));
}, EFFECT_TRANSPARENT);
}
// node_modules/svelte/src/internal/client/timing.js
/** @import { Raf } from '#client' */
var now = () => performance.now();
/** @type {Raf} */
var raf = {
tick: /** @param {any} _ */ (_) => requestAnimationFrame(_),
now: () => now(),
tasks: /* @__PURE__ */ new Set()
};
// node_modules/svelte/src/internal/client/loop.js
/** @import { TaskCallback, Task, TaskEntry } from '#client' */
/**
* @returns {void}
*/
function run_tasks() {
const now = raf.now();
raf.tasks.forEach((task) => {
if (!task.c(now)) {
raf.tasks.delete(task);
task.f();
}
});
if (raf.tasks.size !== 0) raf.tick(run_tasks);
}
/**
* Creates a new task that runs on each raf frame
* until it returns a falsy value or is aborted
* @param {TaskCallback} callback
* @returns {Task}
*/
function loop(callback) {
/** @type {TaskEntry} */
let task;
if (raf.tasks.size === 0) raf.tick(run_tasks);
return {
promise: new Promise((fulfill) => {
raf.tasks.add(task = {
c: callback,
f: fulfill
});
}),
abort() {
raf.tasks.delete(task);
}
};
}
// node_modules/svelte/src/internal/client/dom/elements/transitions.js
/** @import { AnimateFn, Animation, AnimationConfig, EachItem, Effect, EffectNodes, TransitionFn, TransitionManager } from '#client' */
/**
* @param {Element} element
* @param {'introstart' | 'introend' | 'outrostart' | 'outroend'} type
* @returns {void}
*/
function dispatch_event(element, type) {
without_reactive_context(() => {
element.dispatchEvent(new CustomEvent(type));
});
}
/**
* Converts a property to the camel-case format expected by Element.animate(), KeyframeEffect(), and KeyframeEffect.setKeyframes().
* @param {string} style
* @returns {string}
*/
function css_property_to_camelcase(style) {
if (style === "float") return "cssFloat";
if (style === "offset") return "cssOffset";
if (style.startsWith("--")) return style;
const parts = style.split("-");
if (parts.length === 1) return parts[0];
return parts[0] + parts.slice(1).map(
/** @param {any} word */
(word) => word[0].toUpperCase() + word.slice(1)
).join("");
}
/**
* @param {string} css
* @returns {Keyframe}
*/
function css_to_keyframe(css) {
/** @type {Keyframe} */
const keyframe = {};
const parts = css.split(";");
for (const part of parts) {
const [property, value] = part.split(":");
if (!property || value === void 0) break;
const formatted_property = css_property_to_camelcase(property.trim());
keyframe[formatted_property] = value.trim();
}
return keyframe;
}
/** @param {number} t */
var linear = (t) => t;
/** @type {Effect | null} */
var animation_effect_override = null;
/** @param {Effect | null} v */
function set_animation_effect_override(v) {
animation_effect_override = v;
}
/**
* Called inside keyed `{#each ...}` blocks (as `$.animation(...)`). This creates an animation manager
* and attaches it to the block, so that moves can be animated following reconciliation.
* @template P
* @param {Element} element
* @param {() => AnimateFn<P | undefined>} get_fn
* @param {(() => P) | null} get_params
*/
function animation(element, get_fn, get_params) {
var nodes = (animation_effect_override ?? active_effect).nodes;
/** @type {DOMRect} */
var from;
/** @type {DOMRect} */
var to;
/** @type {Animation | undefined} */
var animation;
/** @type {null | { position: string, width: string, height: string, transform: string }} */
var original_styles = null;
nodes.a ??= {
element,
measure() {
from = this.element.getBoundingClientRect();
},
apply() {
animation?.abort();
to = this.element.getBoundingClientRect();
if (from.left !== to.left || from.right !== to.right || from.top !== to.top || from.bottom !== to.bottom) {
const options = get_fn()(this.element, {
from,
to
}, get_params?.());
animation = animate(this.element, options, void 0, 1, () => {}, () => {
animation?.abort();
animation = void 0;
});
}
},
fix() {
if (element.getAnimations().length) return;
var { position, width, height } = getComputedStyle(element);
if (position !== "absolute" && position !== "fixed") {
var style = element.style;
original_styles = {
position: style.position,
width: style.width,
height: style.height,
transform: style.transform
};
style.position = "absolute";
style.width = width;
style.height = height;
var to = element.getBoundingClientRect();
if (from.left !== to.left || from.top !== to.top) {
var transform = `translate(${from.left - to.left}px, ${from.top - to.top}px)`;
style.transform = style.transform ? `${style.transform} ${transform}` : transform;
}
}
},
unfix() {
if (original_styles) {
var style = element.style;
style.position = original_styles.position;
style.width = original_styles.width;
style.height = original_styles.height;
style.transform = original_styles.transform;
}
}
};
nodes.a.element = element;
}
/**
* Called inside block effects as `$.transition(...)`. This creates a transition manager and
* attaches it to the current effect — later, inside `pause_effect` and `resume_effect`, we
* use this to create `intro` and `outro` transitions.
* @template P
* @param {number} flags
* @param {HTMLElement} element
* @param {() => TransitionFn<P | undefined>} get_fn
* @param {(() => P) | null} get_params
* @returns {void}
*/
function transition(flags, element, get_fn, get_params) {
var is_intro = (flags & 1) !== 0;
var is_outro = (flags & 2) !== 0;
var is_both = is_intro && is_outro;
var is_global = (flags & 4) !== 0;
/** @type {'in' | 'out' | 'both'} */
var direction = is_both ? "both" : is_intro ? "in" : "out";
/** @type {AnimationConfig | ((opts: { direction: 'in' | 'out' }) => AnimationConfig) | undefined} */
var current_options;
var inert = element.inert;
/**
* The default overflow style, stashed so we can revert changes during the transition
* that are necessary to work around a Safari <18 bug
* TODO 6.0 remove this, if older versions of Safari have died out enough
*/
var overflow = element.style.overflow;
/** @type {Animation | undefined} */
var intro;
/** @type {Animation | undefined} */
var outro;
function get_options() {
return without_reactive_context(() => {
return current_options ??= get_fn()(element, get_params?.() ?? {}, { direction });
});
}
/** @type {TransitionManager} */
var transition = {
is_global,
in() {
element.inert = inert;
if (!is_intro) {
outro?.abort();
outro?.reset?.();
return;
}
if (!is_outro) intro?.abort();
intro = animate(element, get_options(), outro, 1, () => {
dispatch_event(element, "introstart");
}, () => {
dispatch_event(element, "introend");
intro?.abort();
intro = current_options = void 0;
element.style.overflow = overflow;
});
},
out(fn) {
if (!is_outro) {
fn?.();
current_options = void 0;
return;
}
element.inert = true;
outro = animate(element, get_options(), intro, 0, () => {
dispatch_event(element, "outrostart");
}, () => {
dispatch_event(element, "outroend");
fn?.();
});
},
stop: () => {
intro?.abort();
outro?.abort();
}
};
var e = active_effect;
(e.nodes.t ??= []).push(transition);
if (is_intro && should_intro) {
var run = is_global;
if (!run) {
var block = e.parent;
while (block && (block.f & 65536) !== 0) while (block = block.parent) if ((block.f & 16) !== 0) break;
run = !block || (block.f & 32768) !== 0;
}
if (run) effect(() => {
untrack(() => transition.in());
});
}
}
/**
* Animates an element, according to the provided configuration
* @param {Element} element
* @param {AnimationConfig | ((opts: { direction: 'in' | 'out' }) => AnimationConfig)} options
* @param {Animation | undefined} counterpart The corresponding intro/outro to this outro/intro
* @param {number} t2 The target `t` value — `1` for intro, `0` for outro
* @param {(() => void)} on_begin Called just before beginning the animation
* @param {(() => void)} on_finish Called after successfully completing the animation
* @returns {Animation}
*/
function animate(element, options, counterpart, t2, on_begin, on_finish) {
var is_intro = t2 === 1;
var aborted = false;
if (is_function(options)) {
/** @type {Animation} */
var a;
queue_micro_task(() => {
if (aborted) return;
a = animate(element, options({ direction: is_intro ? "in" : "out" }), counterpart, t2, on_begin, on_finish);
});
return {
abort: () => {
aborted = true;
a?.abort();
},
deactivate: () => a?.deactivate(),
reset: () => a?.reset(),
t: () => a?.t() ?? 1 - t2
};
}
counterpart?.deactivate();
if (!options?.duration && !options?.delay) {
on_begin();
on_finish();
return {
abort: noop,
deactivate: noop,
reset: noop,
t: () => t2
};
}
const { delay = 0, css, tick, easing = linear } = options;
/** @type {globalThis.Animation} */
var animation;
var get_t = () => 1 - t2;
queue_micro_task(() => {
if (aborted) return;
var keyframes = [];
if (is_intro && counterpart === void 0) {
if (tick) tick(0, 1);
if (css) {
var styles = css_to_keyframe(css(0, 1));
keyframes.push(styles, styles);
}
}
animation = element.animate(keyframes, {
duration: delay,
fill: "forwards"
});
animation.onfinish = () => {
animation.cancel();
on_begin();
var t1 = counterpart?.t() ?? 1 - t2;
counterpart?.abort();
var delta = t2 - t1;
var duration = options.duration * Math.abs(delta);
var keyframes = [];
if (duration > 0) {
/**
* Whether or not the CSS includes `overflow: hidden`, in which case we need to
* add it as an inline style to work around a Safari <18 bug
* TODO 6.0 remove this, if possible
*/
var needs_overflow_hidden = false;
if (css) {
var n = Math.ceil(duration / (1e3 / 60));
for (var i = 0; i <= n; i += 1) {
var t = t1 + delta * easing(i / n);
var styles = css_to_keyframe(css(t, 1 - t));
keyframes.push(styles);
needs_overflow_hidden ||= styles.overflow === "hidden";
}
}
if (needs_overflow_hidden)
/** @type {HTMLElement} */ element.style.overflow = "hidden";
get_t = () => {
var time = animation.currentTime;
return t1 + delta * easing(time / duration);
};
if (tick) loop(() => {
if (animation.playState !== "running") return false;
var t = get_t();
tick(t, 1 - t);
return true;
});
}
animation = element.animate(keyframes, {
duration,
fill: "forwards"
});
animation.onfinish = () => {
get_t = () => t2;
tick?.(t2, 1 - t2);
on_finish();
};
};
});
return {
abort: () => {
aborted = true;
if (animation) {
animation.cancel();
animation.effect = null;
animation.onfinish = noop;
}
},
deactivate: () => {
on_finish = noop;
},
reset: () => {
if (t2 === 0) tick?.(1, 0);
},
t: () => get_t()
};
}
// node_modules/svelte/src/internal/client/dom/blocks/svelte-element.js
/** @import { Effect, EffectNodes, TemplateNode } from '#client' */
/**
* @param {Comment | Element} node
* @param {() => string} get_tag
* @param {boolean} is_svg
* @param {undefined | ((element: Element, anchor: Node | null) => void)} render_fn,
* @param {undefined | (() => string)} get_namespace
* @param {undefined | [number, number]} location
* @returns {void}
*/
function element(node, get_tag, is_svg, render_fn, get_namespace, location) {
let was_hydrating = hydrating;
if (hydrating) hydrate_next();
var filename = location && component_context?.function[FILENAME];
/** @type {null | Element} */
var element = null;
if (hydrating && hydrate_node.nodeType === 1) {
element = hydrate_node;
hydrate_next();
}
var anchor = hydrating ? hydrate_node : node;
/**
* We track this so we can set it when changing the element, allowing any
* `animate:` directive to bind itself to the correct block
*/
var parent_effect = active_effect;
var branches = new BranchManager(anchor, false);
block(() => {
const next_tag = get_tag() || null;
var ns = get_namespace ? get_namespace() : is_svg || next_tag === "svg" ? NAMESPACE_SVG : void 0;
if (next_tag === null) {
branches.ensure(null, null);
set_should_intro(true);
return;
}
branches.ensure(next_tag, (anchor) => {
if (next_tag) {
var is_hydrating = hydrating;
element = hydrating ? element : create_element(next_tag, ns);
if (location) element.__svelte_meta = {
parent: dev_stack,
loc: {
file: filename,
line: location[0],
column: location[1]
}
};
assign_nodes(element, element);
if (render_fn) {
var tmp_comment = null;
if (hydrating && is_raw_text_element(next_tag)) element.append(tmp_comment = document.createComment(""));
var child_anchor = hydrating ? /* @__PURE__ */ get_first_child(element) : element.appendChild(create_text());
if (hydrating) {
if (child_anchor === null) set_hydrating(false);
else set_hydrate_node(child_anchor);
}
set_animation_effect_override(parent_effect);
render_fn(element, child_anchor);
tmp_comment?.remove();
set_animation_effect_override(null);
}
/** @type {Effect & { nodes: EffectNodes }} */ active_effect.nodes.end = element;
if (!is_hydrating) anchor.before(element);
}
if (hydrating) set_hydrate_node(anchor);
});
set_should_intro(true);
return () => {
if (next_tag) set_should_intro(false);
};
}, EFFECT_TRANSPARENT);
teardown(() => {
set_should_intro(true);
});
if (was_hydrating) {
set_hydrating(true);
set_hydrate_node(anchor);
}
}
// node_modules/svelte/src/internal/client/dom/blocks/svelte-head.js
/** @import { TemplateNode } from '#client' */
/**
* @param {string} hash
* @param {(anchor: Node) => void} render_fn
* @returns {void}
*/
function head(hash, render_fn) {
let previous_hydrate_node = null;
let was_hydrating = hydrating;
/** @type {Comment | Text} */
var anchor;
if (hydrating) {
previous_hydrate_node = hydrate_node;
var head_anchor = /* @__PURE__ */ get_first_child(document.head);
while (head_anchor !== null && (head_anchor.nodeType !== 8 || head_anchor.data !== hash)) head_anchor = /* @__PURE__ */ get_next_sibling(head_anchor);
if (head_anchor === null) set_hydrating(false);
else {
var start = /* @__PURE__ */ get_next_sibling(head_anchor);
head_anchor.remove();
set_hydrate_node(start);
}
}
if (!hydrating) anchor = document.head.appendChild(create_text());
try {
block(() => {
var e = branch(() => render_fn(anchor));
e.f |= HEAD_EFFECT;
if (!hydrating) {
if (e.nodes === null) e.nodes = {
start: anchor,
end: anchor,
a: null,
t: null
};
else e.nodes.end = anchor;
}
});
} finally {
if (was_hydrating) {
set_hydrating(true);
set_hydrate_node(previous_hydrate_node);
}
}
}
// node_modules/svelte/src/internal/client/dom/css.js
/**
* @param {Node} anchor
* @param {{ hash: string, code: string }} css
*/
function append_styles$1(anchor, css) {
effect(() => {
anchor = active_effect?.parent?.nodes?.start ?? anchor;
var root = anchor.getRootNode();
var target = root.host ? root : /** @type {Document} */ root.head ?? root.ownerDocument.head;
if (!target.querySelector("#" + css.hash)) {
const style = create_element("style");
style.id = css.hash;
style.textContent = css.code;
target.appendChild(style);
register_style(css.hash, style);
}
});
}
// node_modules/svelte/src/internal/client/dom/elements/actions.js
/** @import { ActionPayload } from '#client' */
/**
* @template P
* @param {Element} dom
* @param {(dom: Element, value?: P) => ActionPayload<P>} action
* @param {() => P} [get_value]
* @returns {void}
*/
function action(dom, action, get_value) {
effect(() => {
var payload = untrack(() => action(dom, get_value?.()) || {});
if (get_value && payload?.update) {
var inited = false;
/** @type {P} */
var prev = {};
render_effect(() => {
var value = get_value();
deep_read_state(value);
if (inited && safe_not_equal(prev, value)) {
prev = value;
/** @type {Function} */ payload.update(value);
}
});
inited = true;
}
if (payload?.destroy) return () => payload.destroy();
});
}
// node_modules/svelte/src/internal/client/dom/elements/attachments.js
/** @import { Effect } from '#client' */
/**
* @param {Element} node
* @param {() => (node: Element) => void} get_fn
*/
function attach(node, get_fn) {
/** @type {false | undefined | ((node: Element) => void)} */
var fn = void 0;
/** @type {Effect | null} */
var e;
managed(() => {
if (fn !== (fn = get_fn())) {
if (e) {
destroy_effect(e);
e = null;
}
if (fn) e = branch(() => {
effect(() => fn(node));
});
}
});
}
// node_modules/svelte/src/escaping.js
var ATTR_REGEX = /[&"<]/g;
var CONTENT_REGEX = /[&<]/g;
/**
* @template V
* @param {V} value
* @param {boolean} [is_attr]
*/
function escape_html(value, is_attr) {
const str = String(value ?? "");
const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;
pattern.lastIndex = 0;
let escaped = "";
let last = 0;
while (pattern.test(str)) {
const i = pattern.lastIndex - 1;
const ch = str[i];
escaped += str.substring(last, i) + (ch === "&" ? "&amp;" : ch === "\"" ? "&quot;" : "&lt;");
last = i + 1;
}
return escaped + str.substring(last);
}
// node_modules/svelte/src/internal/shared/attributes.js
/**
* `<div translate={false}>` should be rendered as `<div translate="no">` and _not_
* `<div translate="false">`, which is equivalent to `<div translate="yes">`. There
* may be other odd cases that need to be added to this list in future
* @type {Record<string, Map<any, string>>}
*/
var replacements = { translate: /* @__PURE__ */ new Map([[true, "yes"], [false, "no"]]) };
/**
* @template V
* @param {string} name
* @param {V} value
* @param {boolean} [is_boolean]
* @returns {string}
*/
function attr(name, value, is_boolean = false) {
if (name === "hidden" && value !== "until-found") is_boolean = true;
if (value == null || is_boolean && !value && value !== "") return "";
const normalized = has_own_property.call(replacements, name) && replacements[name].get(value) || value;
return ` ${name}${is_boolean ? `=""` : `="${escape_html(normalized, true)}"`}`;
}
/**
* Small wrapper around clsx to preserve Svelte's (weird) handling of falsy values.
* TODO Svelte 6 revisit this, and likely turn all falsy values into the empty string (what clsx also does)
* @param {any} value
*/
function clsx(value) {
if (typeof value === "object") return clsx$1(value);
else return value ?? "";
}
var whitespace = [..." \n\r\f\xA0\v"];
/**
* @param {any} value
* @param {string | null} [hash]
* @param {Record<string, boolean>} [directives]
* @returns {string | null}
*/
function to_class(value, hash, directives) {
var classname = value == null ? "" : "" + value;
if (hash) classname = classname ? classname + " " + hash : hash;
if (directives) {
for (var key of Object.keys(directives)) if (directives[key]) classname = classname ? classname + " " + key : key;
else if (classname.length) {
var len = key.length;
var a = 0;
while ((a = classname.indexOf(key, a)) >= 0) {
var b = a + len;
if ((a === 0 || whitespace.includes(classname[a - 1])) && (b === classname.length || whitespace.includes(classname[b]))) classname = (a === 0 ? "" : classname.substring(0, a)) + classname.substring(b + 1);
else a = b;
}
}
}
return classname === "" ? null : classname;
}
/**
*
* @param {Record<string,any>} styles
* @param {boolean} important
*/
function append_styles(styles, important = false) {
var separator = important ? " !important;" : ";";
var css = "";
for (var key of Object.keys(styles)) {
var value = styles[key];
if (value != null && value !== "") css += " " + key + ": " + value + separator;
}
return css;
}
/**
* @param {string} name
* @returns {string}
*/
function to_css_name(name) {
if (name[0] !== "-" || name[1] !== "-") return name.toLowerCase();
return name;
}
/**
* @param {any} value
* @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [styles]
* @returns {string | null}
*/
function to_style(value, styles) {
if (styles) {
var new_style = "";
/** @type {Record<string,any> | undefined} */
var normal_styles;
/** @type {Record<string,any> | undefined} */
var important_styles;
if (Array.isArray(styles)) {
normal_styles = styles[0];
important_styles = styles[1];
} else normal_styles = styles;
if (value) {
value = String(value).replaceAll(/\/\*.*?\*\//g, "").trim();
/** @type {boolean | '"' | "'"} */
var in_str = false;
var in_apo = 0;
var in_comment = false;
var reserved_names = [];
if (normal_styles) reserved_names.push(...Object.keys(normal_styles).map(to_css_name));
if (important_styles) reserved_names.push(...Object.keys(important_styles).map(to_css_name));
var start_index = 0;
var name_index = -1;
const len = value.length;
for (var i = 0; i < len; i++) {
var c = value[i];
if (in_comment) {
if (c === "/" && value[i - 1] === "*") in_comment = false;
} else if (in_str) {
if (in_str === c) in_str = false;
} else if (c === "/" && value[i + 1] === "*") in_comment = true;
else if (c === "\"" || c === "'") in_str = c;
else if (c === "(") in_apo++;
else if (c === ")") in_apo--;
if (!in_comment && in_str === false && in_apo === 0) {
if (c === ":" && name_index === -1) name_index = i;
else if (c === ";" || i === len - 1) {
if (name_index !== -1) {
var name = to_css_name(value.substring(start_index, name_index).trim());
if (!reserved_names.includes(name)) {
if (c !== ";") i++;
var property = value.substring(start_index, i).trim();
new_style += " " + property + ";";
}
}
start_index = i + 1;
name_index = -1;
}
}
}
}
if (normal_styles) new_style += append_styles(normal_styles);
if (important_styles) new_style += append_styles(important_styles, true);
new_style = new_style.trim();
return new_style === "" ? null : new_style;
}
return value == null ? null : String(value);
}
// node_modules/svelte/src/internal/client/dom/elements/class.js
/**
* @param {Element} dom
* @param {boolean | number} is_html
* @param {string | null} value
* @param {string} [hash]
* @param {Record<string, any>} [prev_classes]
* @param {Record<string, any>} [next_classes]
* @returns {Record<string, boolean> | undefined}
*/
function set_class(dom, is_html, value, hash, prev_classes, next_classes) {
var prev = dom[CLASS_CACHE];
if (hydrating || prev !== value || prev === void 0) {
var next_class_name = to_class(value, hash, next_classes);
if (!hydrating || next_class_name !== dom.getAttribute("class")) {
if (next_class_name == null) dom.removeAttribute("class");
else if (is_html) dom.className = next_class_name;
else dom.setAttribute("class", next_class_name);
}
/** @type {any} */ dom[CLASS_CACHE] = value;
} else if (next_classes && prev_classes !== next_classes) for (var key in next_classes) {
var is_present = !!next_classes[key];
if (prev_classes == null || is_present !== !!prev_classes[key]) dom.classList.toggle(key, is_present);
}
return next_classes;
}
// node_modules/svelte/src/internal/client/dom/elements/style.js
/**
* @param {Element & ElementCSSInlineStyle} dom
* @param {Record<string, any>} prev
* @param {Record<string, any>} next
* @param {string} [priority]
*/
function update_styles(dom, prev = {}, next, priority) {
for (var key in next) {
var value = next[key];
if (prev[key] !== value) {
if (next[key] == null) dom.style.removeProperty(key);
else dom.style.setProperty(key, value, priority);
}
}
}
/**
* @param {Element & ElementCSSInlineStyle} dom
* @param {string | null} value
* @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [prev_styles]
* @param {Record<string, any> | [Record<string, any>, Record<string, any>]} [next_styles]
*/
function set_style(dom, value, prev_styles, next_styles) {
var prev = dom[STYLE_CACHE];
if (hydrating || prev !== value) {
var next_style_attr = to_style(value, next_styles);
if (!hydrating || next_style_attr !== dom.getAttribute("style")) {
if (next_style_attr == null) dom.removeAttribute("style");
else dom.style.cssText = next_style_attr;
}
/** @type {any} */ dom[STYLE_CACHE] = value;
} else if (next_styles) {
if (Array.isArray(next_styles)) {
update_styles(dom, prev_styles?.[0], next_styles[0]);
update_styles(dom, prev_styles?.[1], next_styles[1], "important");
} else update_styles(dom, prev_styles, next_styles);
}
return next_styles;
}
// node_modules/svelte/src/internal/client/dom/elements/bindings/select.js
/**
* Sets the `selected` attribute on an option so form reset can restore it.
* @param {HTMLOptionElement} option
* @param {boolean} selected
*/
function set_selected(option, selected) {
if (selected) {
if (!option.hasAttribute("selected")) option.setAttribute("selected", "");
} else option.removeAttribute("selected");
}
/**
* Sets the options a form reset should restore. The first call selects
* them if nothing has set a value, later calls leave the current selection alone.
* @param {HTMLSelectElement} select
* @param {any} value
*/
function set_default_select_value(select, value) {
var mounting = !("__defaultValue" in select);
if (!mounting && select.__defaultValue === value) return;
select.__defaultValue = value;
apply_default_select_value(select, !mounting || "__value" in select);
}
/**
* Marks the options matching `__defaultValue` as selected. Without `preserve`
* a newly matching option gets selected, as an inserted `<option selected>` would.
* @param {HTMLSelectElement} select
* @param {boolean} preserve
*/
function apply_default_select_value(select, preserve) {
var value = select.__defaultValue;
var multiple = select.multiple;
var values = multiple ? value ?? [] : null;
if (multiple && !is_array(values)) return;
var index = select.selectedIndex;
var selected = preserve && multiple ? new Set(select.selectedOptions) : null;
for (var option of select.options) {
var option_value = get_option_value(option);
set_selected(option, multiple ? values.includes(option_value) : is(option_value, value));
}
if (!preserve) return;
if (selected !== null) for (option of select.options) {
var was_selected = selected.has(option);
if (option.selected !== was_selected) option.selected = was_selected;
}
else if (select.selectedIndex !== index) select.selectedIndex = index;
}
/**
* Selects the correct option(s) (depending on whether this is a multiple select)
* @template V
* @param {HTMLSelectElement} select
* @param {V} value
* @param {boolean} mounting
*/
function select_option(select, value, mounting = false) {
if (select.multiple) {
if (value == void 0) return;
if (!is_array(value)) return select_multiple_invalid_value();
for (var option of select.options) option.selected = value.includes(get_option_value(option));
return;
}
for (option of select.options) {
var option_value = get_option_value(option);
if (is(option_value, value)) {
option.selected = true;
return;
}
}
if (!mounting || value !== void 0) select.selectedIndex = -1;
}
/**
* Sets up a mutation observer to sync the current selection
* and default to the dom when the options change, for example
* when they are inside an `#each` block. Called once per `<select>`,
* by the compiled output or by `attribute_effect` for spreads.
* @param {HTMLSelectElement} select
*/
function init_select(select) {
var observer = new MutationObserver((entries) => {
if (entries.every(is_selectedcontent_mutation)) return;
if ("__defaultValue" in select) apply_default_select_value(select, false);
if ("__value" in select) select_option(select, select.__value);
});
observer.observe(select, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ["value"]
});
teardown(() => {
observer.disconnect();
});
}
/**
* @param {HTMLSelectElement} select
* @param {() => unknown} get
* @param {(value: unknown) => void} set
* @returns {void}
*/
function bind_select_value(select, get, set = get) {
var batches = /* @__PURE__ */ new WeakSet();
var mounting = true;
listen_to_event_and_reset_event(select, "change", (is_reset) => {
var query = is_reset ? "[selected]" : ":checked";
/** @type {unknown} */
var value;
if (select.multiple) value = [].map.call(select.querySelectorAll(query), get_option_value);
else {
/** @type {HTMLOptionElement | null} */
var selected_option = select.querySelector(query) ?? select.querySelector("option:not([disabled])");
value = selected_option && get_option_value(selected_option);
}
set(value);
select.__value = value;
if (current_batch !== null) batches.add(current_batch);
});
effect(() => {
var value = get();
if (select === document.activeElement) {
var batch = async_mode_flag ? previous_batch : current_batch;
if (batches.has(batch)) return;
}
select_option(select, value, mounting);
if (mounting && value === void 0) {
/** @type {HTMLOptionElement | null} */
var selected_option = select.querySelector(":checked");
if (selected_option !== null) {
value = get_option_value(selected_option);
set(value);
}
}
select.__value = value;
mounting = false;
});
}
/** @param {HTMLOptionElement} option */
function get_option_value(option) {
if ("__value" in option) return option.__value;
else return option.value;
}
/**
* Returns `true` if the mutation stems from the browser mirroring the selected
* option's content into `<selectedcontent>`, or from us replacing the
* `<selectedcontent>` element with a clone of itself
* @param {MutationRecord} entry
*/
function is_selectedcontent_mutation(entry) {
if (entry.target.closest("selectedcontent") !== null) return true;
if (entry.type === "childList") {
var nodes = [...entry.addedNodes, ...entry.removedNodes];
return nodes.length > 0 && nodes.every((node) => node.nodeName === "SELECTEDCONTENT");
}
return false;
}
// node_modules/svelte/src/internal/client/dom/elements/attributes.js
/** @import { Blocker, Effect } from '#client' */
var CLASS = Symbol("class");
var STYLE = Symbol("style");
var IS_CUSTOM_ELEMENT = Symbol("is custom element");
var IS_HTML = Symbol("is html");
var LINK_TAG = IS_XHTML ? "link" : "LINK";
var INPUT_TAG = IS_XHTML ? "input" : "INPUT";
var OPTION_TAG = IS_XHTML ? "option" : "OPTION";
var SELECT_TAG = IS_XHTML ? "select" : "SELECT";
var PROGRESS_TAG = IS_XHTML ? "progress" : "PROGRESS";
/**
* The value/checked attribute in the template actually corresponds to the defaultValue property, so we need
* to remove it upon hydration to avoid a bug when someone resets the form value.
* @param {HTMLInputElement} input
* @returns {void}
*/
function remove_input_defaults(input) {
if (!hydrating) return;
var already_removed = false;
var remove_defaults = () => {
if (already_removed) return;
already_removed = true;
if (input.hasAttribute("value")) {
var value = input.value;
set_attribute(input, "value", null);
input.value = value;
}
if (input.hasAttribute("checked")) {
var checked = input.checked;
set_attribute(input, "checked", null);
input.checked = checked;
}
};
/** @type {any} */ input[FORM_RESET_HANDLER] = remove_defaults;
queue_micro_task(remove_defaults);
add_form_reset_listener();
}
/**
* @param {Element} element
* @param {any} value
*/
function set_value(element, value) {
var attributes = get_attributes(element);
if (attributes.value === (attributes.value = value ?? void 0) || element.value === value && (value !== 0 || element.nodeName !== PROGRESS_TAG)) return;
element.value = value ?? "";
}
/**
* @param {Element} element
* @param {boolean} checked
*/
function set_checked(element, checked) {
var attributes = get_attributes(element);
if (attributes.checked === (attributes.checked = checked ?? void 0)) return;
element.checked = checked;
}
/**
* Applies the default checked property without influencing the current checked property.
* @param {HTMLInputElement} element
* @param {boolean} checked
*/
function set_default_checked(element, checked) {
const existing_value = element.checked;
element.defaultChecked = checked;
element.checked = existing_value;
}
/**
* Applies the default value property without influencing the current value property.
* @param {HTMLInputElement | HTMLTextAreaElement} element
* @param {string} value
*/
function set_default_value(element, value) {
const existing_value = element.value;
element.defaultValue = value;
element.value = existing_value;
}
/**
* @param {Element} element
* @param {string} attribute
* @param {string | null} value
* @param {boolean} [skip_warning]
*/
function set_attribute(element, attribute, value, skip_warning) {
var attributes = get_attributes(element);
if (hydrating) {
attributes[attribute] = element.getAttribute(attribute);
if (attribute === "src" || attribute === "srcset" || attribute === "href" && element.nodeName === LINK_TAG) {
if (!skip_warning) check_src_in_dev_hydration(element, attribute, value ?? "");
return;
}
}
var previous = attributes[attribute];
if (previous === (attributes[attribute] = value)) return;
if (attribute === "loading") element[LOADING_ATTR_SYMBOL] = value;
if (value == null) element.removeAttribute(attribute);
else if (typeof value !== "string" && get_setters(element).has(attribute)) element[attribute] = value;
else if (!(hydrating && (typeof value === "number" || typeof value === "boolean") && previous === String(value))) element.setAttribute(attribute, value);
}
/**
* @param {Element} dom
* @param {string} attribute
* @param {string} value
*/
function set_xlink_attribute(dom, attribute, value) {
dom.setAttributeNS("http://www.w3.org/1999/xlink", attribute, value);
}
/**
* @param {HTMLElement} node
* @param {string} prop
* @param {any} value
*/
function set_custom_element_data(node, prop, value) {
var previous_reaction = active_reaction;
var previous_effect = active_effect;
let was_hydrating = hydrating;
if (hydrating) set_hydrating(false);
set_active_reaction(null);
set_active_effect(null);
try {
if (prop !== "style" && (setters_cache.has(node.getAttribute("is") || node.nodeName) || !customElements || customElements.get(node.getAttribute("is") || node.nodeName.toLowerCase()) ? get_setters(node).has(prop) : value && typeof value === "object")) node[prop] = value;
else set_attribute(node, prop, value == null ? value : String(value));
} finally {
set_active_reaction(previous_reaction);
set_active_effect(previous_effect);
if (was_hydrating) set_hydrating(true);
}
}
/**
* Spreads attributes onto a DOM element, taking into account the currently set attributes
* @param {Element & ElementCSSInlineStyle} element
* @param {Record<string | symbol, any> | undefined} prev
* @param {Record<string | symbol, any>} next New attributes - this function mutates this object
* @param {string} [css_hash]
* @param {boolean} [should_remove_defaults]
* @param {boolean} [skip_warning]
* @returns {Record<string, any>}
*/
function set_attributes(element, prev, next, css_hash, should_remove_defaults = false, skip_warning = false) {
if (hydrating && should_remove_defaults && element.nodeName === INPUT_TAG) {
if (!("defaultValue" in next || "defaultChecked" in next)) remove_input_defaults(element);
}
var attributes = get_attributes(element);
var is_custom_element = attributes[IS_CUSTOM_ELEMENT];
var preserve_attribute_case = !attributes[IS_HTML];
let is_hydrating_custom_element = hydrating && is_custom_element;
if (is_hydrating_custom_element) set_hydrating(false);
var current = prev || {};
var is_option_element = element.nodeName === OPTION_TAG;
var is_select_element = element.nodeName === SELECT_TAG;
try {
for (var key in prev) if (!(key in next) && key[0] + key[1] !== "$$") next[key] = null;
if (next.class) next.class = clsx(next.class);
else if (css_hash || next[CLASS]) next.class = null;
if (next[STYLE]) next.style ??= null;
var setters = get_setters(element);
if (element.nodeName === INPUT_TAG && "type" in next && ("value" in next || "__value" in next)) {
var type = next.type;
if (type !== current.type || type === void 0 && element.hasAttribute("type")) {
current.type = type;
set_attribute(element, "type", type, skip_warning);
}
}
for (const key in next) {
let value = next[key];
if (is_option_element && key === "value" && value == null) {
element.value = element.__value = "";
current[key] = value;
continue;
}
if (key === "class") {
set_class(element, element.namespaceURI === "http://www.w3.org/1999/xhtml", value, css_hash, prev?.[CLASS], next[CLASS]);
current[key] = value;
current[CLASS] = next[CLASS];
continue;
}
if (key === "style") {
set_style(element, value, prev?.[STYLE], next[STYLE]);
current[key] = value;
current[STYLE] = next[STYLE];
continue;
}
var prev_value = current[key];
if (value === prev_value && !(value === void 0 && element.hasAttribute(key))) continue;
current[key] = value;
var prefix = key[0] + key[1];
if (prefix === "$$") continue;
if (prefix === "on") {
/** @type {{ capture?: true }} */
const opts = {};
const event_handle_key = "$$" + key;
let event_name = key.slice(2);
var is_delegated = can_delegate_event(event_name);
if (is_capture_event(event_name)) {
event_name = event_name.slice(0, -7);
opts.capture = true;
}
if (!is_delegated && prev_value) {
if (value != null) continue;
element.removeEventListener(event_name, current[event_handle_key], opts);
current[event_handle_key] = null;
}
if (is_delegated) {
delegated(event_name, element, value);
delegate([event_name]);
} else if (value != null) {
/**
* @this {any}
* @param {Event} evt
*/
function handle(evt) {
current[key].call(this, evt);
}
current[event_handle_key] = create_event(event_name, element, handle, opts);
}
} else if (key === "style") set_attribute(element, key, value);
else if (key === "autofocus") autofocus(element, Boolean(value));
else if (!is_custom_element && (key === "__value" || key === "value" && value != null)) {
element.__value = value;
if (prev_value == null || element.value !== value || value === 0 && element.nodeName === PROGRESS_TAG) element.value = value;
} else if (key === "selected" && is_option_element) set_selected(element, value);
else {
var name = key;
if (!preserve_attribute_case) name = normalize_attribute(name);
var is_default = name === "defaultValue" || name === "defaultChecked";
if (is_select_element && name === "defaultValue") continue;
if (value == null && !is_custom_element && !is_default) {
attributes[key] = null;
if (name === "value" || name === "checked") {
let input = element;
const use_default = prev === void 0;
if (name === "value") {
let previous = input.defaultValue;
input.removeAttribute(name);
input.defaultValue = previous;
input.value = input.__value = use_default ? previous : null;
} else {
let previous = input.defaultChecked;
input.removeAttribute(name);
input.defaultChecked = previous;
input.checked = use_default ? previous : false;
}
} else element.removeAttribute(key);
} else if (is_default || (is_custom_element || typeof value !== "string") && setters.has(name)) {
element[name] = value;
if (name in attributes) attributes[name] = UNINITIALIZED;
} else if (typeof value !== "function") set_attribute(element, name, value, skip_warning);
}
}
} finally {
if (is_hydrating_custom_element) set_hydrating(true);
}
return current;
}
/**
* @param {Element & ElementCSSInlineStyle} element
* @param {(...expressions: any) => Record<string | symbol, any>} fn
* @param {Array<() => any>} sync
* @param {Array<() => Promise<any>>} async
* @param {Blocker[]} blockers
* @param {string} [css_hash]
* @param {boolean} [should_remove_defaults]
* @param {boolean} [skip_warning]
*/
function attribute_effect(element, fn, sync = [], async = [], blockers = [], css_hash, should_remove_defaults = false, skip_warning = false) {
flatten(blockers, sync, async, (values) => {
/** @type {Record<string | symbol, any> | undefined} */
var prev = void 0;
/** @type {Record<symbol, Effect>} */
var effects = {};
var is_select = element.nodeName === SELECT_TAG;
var inited = false;
managed(() => {
var next = fn(...values.map(get));
/** @type {Record<string | symbol, any>} */
var current = set_attributes(element, prev, next, css_hash, should_remove_defaults, skip_warning);
if (inited && is_select) {
var select = element;
if ("defaultValue" in next) set_default_select_value(select, next.defaultValue);
if ("value" in next) select_option(select, next.value);
}
for (let symbol of Object.getOwnPropertySymbols(effects)) if (!next[symbol]) destroy_effect(effects[symbol]);
for (let symbol of Object.getOwnPropertySymbols(next)) {
var n = next[symbol];
if (symbol.description === "@attach" && (!prev || n !== prev[symbol])) {
if (effects[symbol]) destroy_effect(effects[symbol]);
effects[symbol] = branch(() => attach(element, () => n));
}
current[symbol] = n;
}
prev = current;
});
if (is_select) {
var select = element;
effect(() => {
var attrs = prev;
if ("defaultValue" in attrs) set_default_select_value(select, attrs.defaultValue);
select_option(select, attrs.value, true);
init_select(select);
});
}
inited = true;
});
}
/**
*
* @param {Element} element
*/
function get_attributes(element) {
return element[ATTRIBUTES_CACHE] ??= {
[IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"),
[IS_HTML]: element.namespaceURI === NAMESPACE_HTML
};
}
/** @type {Map<string, Set<string>>} */
var setters_cache = /* @__PURE__ */ new Map();
/** @param {Element} element */
function get_setters(element) {
var cache_key = element.getAttribute("is") || element.nodeName;
var setters = setters_cache.get(cache_key);
if (setters) return setters;
setters_cache.set(cache_key, setters = /* @__PURE__ */ new Set());
var descriptors;
var proto = element;
var element_proto = Element.prototype;
while (element_proto !== proto) {
descriptors = get_descriptors(proto);
for (var key in descriptors) if (descriptors[key].set && key !== "innerHTML" && key !== "textContent" && key !== "innerText") setters.add(key);
proto = get_prototype_of(proto);
}
return setters;
}
/**
* @param {any} element
* @param {string} attribute
* @param {string} value
*/
function check_src_in_dev_hydration(element, attribute, value) {
if (attribute === "srcset" && srcset_url_equal(element, value)) return;
if (src_url_equal(element.getAttribute(attribute) ?? "", value)) return;
hydration_attribute_changed(attribute, element.outerHTML.replace(element.innerHTML, element.innerHTML && "..."), String(value));
}
/**
* @param {string} element_src
* @param {string} url
* @returns {boolean}
*/
function src_url_equal(element_src, url) {
if (element_src === url) return true;
return new URL(element_src, document.baseURI).href === new URL(url, document.baseURI).href;
}
/** @param {string} srcset */
function split_srcset(srcset) {
return srcset.split(",").map((src) => src.trim().split(" ").filter(Boolean));
}
/**
* @param {HTMLSourceElement | HTMLImageElement} element
* @param {string} srcset
* @returns {boolean}
*/
function srcset_url_equal(element, srcset) {
var element_urls = split_srcset(element.srcset);
var urls = split_srcset(srcset);
return urls.length === element_urls.length && urls.every(([url, width], i) => width === element_urls[i][1] && (src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0])));
}
// node_modules/svelte/src/internal/client/dom/elements/customizable-select.js
/** @type {boolean | null} */
var supported = null;
/**
* Checks if the browser supports rich HTML content inside `<option>` elements.
* Modern browsers preserve HTML elements inside options, while older browsers
* strip them during parsing, leaving only text content.
* @returns {boolean}
*/
function is_supported() {
if (supported === null) {
var select = create_element("select");
select.innerHTML = create_trusted_html("<option><span>t</span></option>");
supported = select.firstChild?.firstChild?.nodeType === 1;
}
return supported;
}
/**
*
* @param {HTMLElement} element
* @param {(new_element: HTMLElement) => void} update_element
*/
function selectedcontent(element, update_element) {
if (!is_supported()) return;
attach(element, () => () => {
const select = element.closest("select");
if (!select) return;
const observer = new MutationObserver((entries) => {
var selected = false;
for (const entry of entries) {
if (entry.target === element) return;
selected ||= !!entry.target.parentElement?.closest("option")?.selected;
}
if (selected) {
element.replaceWith(element = element.cloneNode(true));
update_element(element);
}
});
observer.observe(select, {
childList: true,
characterData: true,
subtree: true
});
return () => {
observer.disconnect();
};
});
}
/**
* Handles rich HTML content inside `<option>`, `<optgroup>`, or `<select>` elements with browser-specific branching.
* Modern browsers preserve HTML inside options, while older browsers strip it to text only.
*
* @param {HTMLOptionElement | HTMLOptGroupElement | HTMLSelectElement} element The element to process
* @param {() => void} rich_fn Function to process rich HTML content (modern browsers)
*/
function customizable_select(element, rich_fn) {
var was_hydrating = hydrating;
if (!is_supported()) {
set_hydrating(false);
element.textContent = "";
element.append(create_comment(""));
}
try {
rich_fn();
} finally {
if (was_hydrating) {
if (hydrating) reset(element);
else {
set_hydrating(true);
set_hydrate_node(element);
}
}
}
}
// node_modules/svelte/src/internal/client/dom/elements/bindings/document.js
/**
* @param {(activeElement: Element | null) => void} update
* @returns {void}
*/
function bind_active_element(update) {
listen(document, ["focusin", "focusout"], (event) => {
if (event && event.type === "focusout" && event.relatedTarget) return;
without_reactive_context(() => update(document.activeElement));
});
}
// node_modules/svelte/src/internal/client/dom/elements/bindings/input.js
/** @import { Batch } from '../../../reactivity/batch.js' */
/**
* @param {HTMLInputElement} input
* @param {() => unknown} get
* @param {(value: unknown) => void} set
* @returns {void}
*/
function bind_value(input, get, set = get) {
var batches = /* @__PURE__ */ new WeakSet();
listen_to_event_and_reset_event(input, "input", async (is_reset) => {
if (input.type === "checkbox") bind_invalid_checkbox_value();
/** @type {any} */
var value = is_reset ? input.defaultValue : input.value;
value = is_numberlike_input(input) ? to_number(value) : value;
set(value);
if (current_batch !== null) batches.add(current_batch);
await tick();
if (value !== (value = get())) {
var start = input.selectionStart;
var end = input.selectionEnd;
var length = input.value.length;
input.value = value ?? "";
if (end !== null) {
var new_length = input.value.length;
if (start === end && end === length && new_length > length) {
input.selectionStart = new_length;
input.selectionEnd = new_length;
} else {
input.selectionStart = start;
input.selectionEnd = Math.min(end, new_length);
}
}
}
});
if (hydrating && input.defaultValue !== input.value || untrack(get) == null && input.value) {
set(is_numberlike_input(input) ? to_number(input.value) : input.value);
if (current_batch !== null) batches.add(current_batch);
}
render_effect(() => {
if (input.type === "checkbox") bind_invalid_checkbox_value();
var value = get();
if (input === document.activeElement) {
var batch = async_mode_flag ? previous_batch : current_batch;
if (batches.has(batch)) return;
}
if (is_numberlike_input(input) && value === to_number(input.value)) return;
if (input.type === "date" && !value && !input.value) return;
if (value !== input.value) input.value = value ?? "";
});
}
/** @type {Set<HTMLInputElement[]>} */
var pending = /* @__PURE__ */ new Set();
/**
* @param {HTMLInputElement[]} inputs
* @param {null | [number]} group_index
* @param {HTMLInputElement} input
* @param {() => unknown} get
* @param {(value: unknown) => void} set
* @returns {void}
*/
function bind_group(inputs, group_index, input, get, set = get) {
var is_checkbox = input.getAttribute("type") === "checkbox";
var binding_group = inputs;
let hydration_mismatch = false;
if (group_index !== null) for (var index of group_index) binding_group = binding_group[index] ??= [];
binding_group.push(input);
listen_to_event_and_reset_event(input, "change", () => {
var value = input.__value;
if (is_checkbox) value = get_binding_group_value(binding_group, value, input.checked);
set(value);
}, () => set(is_checkbox ? [] : null));
render_effect(() => {
var value = get();
if (hydrating && input.defaultChecked !== input.checked) {
hydration_mismatch = true;
return;
}
if (is_checkbox) {
value = value || [];
input.checked = value.includes(input.__value);
} else input.checked = is(input.__value, value);
});
teardown(() => {
var index = binding_group.indexOf(input);
if (index !== -1) binding_group.splice(index, 1);
});
if (!pending.has(binding_group)) {
pending.add(binding_group);
queue_micro_task(() => {
binding_group.sort((a, b) => a.compareDocumentPosition(b) === 4 ? -1 : 1);
pending.delete(binding_group);
});
}
queue_micro_task(() => {
if (hydration_mismatch) {
var value;
if (is_checkbox) value = get_binding_group_value(binding_group, value, input.checked);
else value = binding_group.find((input) => input.checked)?.__value;
set(value);
}
});
}
/**
* @param {HTMLInputElement} input
* @param {() => unknown} get
* @param {(value: unknown) => void} set
* @returns {void}
*/
function bind_checked(input, get, set = get) {
listen_to_event_and_reset_event(input, "change", (is_reset) => {
set(is_reset ? input.defaultChecked : input.checked);
});
if (hydrating && input.defaultChecked !== input.checked || untrack(get) == null) set(input.checked);
render_effect(() => {
var value = get();
input.checked = Boolean(value);
});
}
/**
* @template V
* @param {Array<HTMLInputElement>} group
* @param {V} __value
* @param {boolean} checked
* @returns {V[]}
*/
function get_binding_group_value(group, __value, checked) {
/** @type {Set<V>} */
var value = /* @__PURE__ */ new Set();
for (var i = 0; i < group.length; i += 1) if (group[i].checked) value.add(group[i].__value);
if (!checked) value.delete(__value);
return Array.from(value);
}
/**
* @param {HTMLInputElement} input
*/
function is_numberlike_input(input) {
var type = input.type;
return type === "number" || type === "range";
}
/**
* @param {string} value
*/
function to_number(value) {
return value === "" ? null : +value;
}
/**
* @param {HTMLInputElement} input
* @param {() => FileList | null} get
* @param {(value: FileList | null) => void} set
*/
function bind_files(input, get, set = get) {
listen_to_event_and_reset_event(input, "change", () => {
set(input.files);
});
if (hydrating && input.files) set(input.files);
render_effect(() => {
input.files = get();
});
}
// node_modules/svelte/src/internal/client/dom/elements/bindings/media.js
/** @param {TimeRanges} ranges */
function time_ranges_to_array(ranges) {
var array = [];
for (var i = 0; i < ranges.length; i += 1) array.push({
start: ranges.start(i),
end: ranges.end(i)
});
return array;
}
/**
* @param {HTMLVideoElement | HTMLAudioElement} media
* @param {() => number | undefined} get
* @param {(value: number) => void} set
* @returns {void}
*/
function bind_current_time(media, get, set = get) {
/** @type {number} */
var raf_id;
/** @type {number} */
var value;
var callback = () => {
cancelAnimationFrame(raf_id);
if (!media.paused) raf_id = requestAnimationFrame(callback);
var next_value = media.currentTime;
if (value !== next_value) set(value = next_value);
};
raf_id = requestAnimationFrame(callback);
media.addEventListener("timeupdate", callback);
render_effect(() => {
var next_value = Number(get());
if (value !== next_value && !isNaN(next_value)) media.currentTime = value = next_value;
});
teardown(() => {
cancelAnimationFrame(raf_id);
media.removeEventListener("timeupdate", callback);
});
}
/**
* @param {HTMLVideoElement | HTMLAudioElement} media
* @param {(array: Array<{ start: number; end: number }>) => void} set
*/
function bind_buffered(media, set) {
/** @type {{ start: number; end: number; }[]} */
var current;
listen(media, [
"loadedmetadata",
"progress",
"timeupdate",
"seeking"
], () => {
var ranges = media.buffered;
if (!current || current.length !== ranges.length || current.some((range, i) => ranges.start(i) !== range.start || ranges.end(i) !== range.end)) {
current = time_ranges_to_array(ranges);
set(current);
}
});
}
/**
* @param {HTMLVideoElement | HTMLAudioElement} media
* @param {(array: Array<{ start: number; end: number }>) => void} set
*/
function bind_seekable(media, set) {
listen(media, ["loadedmetadata"], () => set(time_ranges_to_array(media.seekable)));
}
/**
* @param {HTMLVideoElement | HTMLAudioElement} media
* @param {(array: Array<{ start: number; end: number }>) => void} set
*/
function bind_played(media, set) {
listen(media, ["timeupdate"], () => set(time_ranges_to_array(media.played)));
}
/**
* @param {HTMLVideoElement | HTMLAudioElement} media
* @param {(seeking: boolean) => void} set
*/
function bind_seeking(media, set) {
listen(media, ["seeking", "seeked"], () => set(media.seeking));
}
/**
* @param {HTMLVideoElement | HTMLAudioElement} media
* @param {(seeking: boolean) => void} set
*/
function bind_ended(media, set) {
listen(media, ["timeupdate", "ended"], () => set(media.ended));
}
/**
* @param {HTMLVideoElement | HTMLAudioElement} media
* @param {(ready_state: number) => void} set
*/
function bind_ready_state(media, set) {
listen(media, [
"loadedmetadata",
"loadeddata",
"canplay",
"canplaythrough",
"playing",
"waiting",
"emptied"
], () => set(media.readyState));
}
/**
* @param {HTMLVideoElement | HTMLAudioElement} media
* @param {() => number | undefined} get
* @param {(playback_rate: number) => void} set
*/
function bind_playback_rate(media, get, set = get) {
effect(() => {
var value = Number(get());
if (value !== media.playbackRate && !isNaN(value)) media.playbackRate = value;
});
effect(() => {
listen(media, ["ratechange"], () => {
set(media.playbackRate);
});
});
}
/**
* @param {HTMLVideoElement | HTMLAudioElement} media
* @param {() => boolean | undefined} get
* @param {(paused: boolean) => void} set
*/
function bind_paused(media, get, set = get) {
var paused = get();
var update = () => {
if (paused !== media.paused) set(paused = media.paused);
};
listen(media, [
"play",
"pause",
"canplay"
], update, paused == null);
effect(() => {
if ((paused = !!get()) !== media.paused) {
if (paused) media.pause();
else media.play().catch((error) => {
set(paused = true);
throw error;
});
}
});
}
/**
* @param {HTMLVideoElement | HTMLAudioElement} media
* @param {() => number | undefined} get
* @param {(volume: number) => void} set
*/
function bind_volume(media, get, set = get) {
var callback = () => {
set(media.volume);
};
if (get() == null) callback();
listen(media, ["volumechange"], callback, false);
render_effect(() => {
var value = Number(get());
if (value !== media.volume && !isNaN(value)) media.volume = value;
});
}
/**
* @param {HTMLVideoElement | HTMLAudioElement} media
* @param {() => boolean | undefined} get
* @param {(muted: boolean) => void} set
*/
function bind_muted(media, get, set = get) {
var callback = () => {
set(media.muted);
};
if (get() == null) callback();
listen(media, ["volumechange"], callback, false);
render_effect(() => {
var value = !!get();
if (media.muted !== value) media.muted = value;
});
}
// node_modules/svelte/src/internal/client/dom/elements/bindings/navigator.js
/**
* @param {(online: boolean) => void} update
* @returns {void}
*/
function bind_online(update) {
listen(window, ["online", "offline"], () => {
update(navigator.onLine);
});
}
// node_modules/svelte/src/internal/client/dom/elements/bindings/props.js
/**
* Makes an `export`ed (non-prop) variable available on the `$$props` object
* so that consumers can do `bind:x` on the component.
* @template V
* @param {Record<string, unknown>} props
* @param {string} prop
* @param {V} value
* @returns {void}
*/
function bind_prop(props, prop, value) {
var desc = get_descriptor(props, prop);
if (desc && desc.set) {
props[prop] = value;
teardown(() => {
props[prop] = null;
});
}
}
// node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
/**
* We create one listener for all elements
* @see {@link https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ Explanation}
*/
var ResizeObserverSingleton = class ResizeObserverSingleton {
/** */
#listeners = /* @__PURE__ */ new WeakMap();
/** @type {ResizeObserver | undefined} */
#observer;
/** @type {ResizeObserverOptions} */
#options;
/** @static */
static entries = /* @__PURE__ */ new WeakMap();
/** @param {ResizeObserverOptions} options */
constructor(options) {
this.#options = options;
}
/**
* @param {Element} element
* @param {(entry: ResizeObserverEntry) => any} listener
*/
observe(element, listener) {
var listeners = this.#listeners.get(element) || /* @__PURE__ */ new Set();
listeners.add(listener);
this.#listeners.set(element, listeners);
this.#getObserver().observe(element, this.#options);
return () => {
var listeners = this.#listeners.get(element);
listeners.delete(listener);
if (listeners.size === 0) {
this.#listeners.delete(element);
/** @type {ResizeObserver} */ this.#observer.unobserve(element);
}
};
}
#getObserver() {
return this.#observer ?? (this.#observer = new ResizeObserver(
/** @param {any} entries */
(entries) => {
for (var entry of entries) {
ResizeObserverSingleton.entries.set(entry.target, entry);
for (var listener of this.#listeners.get(entry.target) || []) listener(entry);
}
}
));
}
};
var resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: "content-box" });
var resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: "border-box" });
var resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton({ box: "device-pixel-content-box" });
/**
* @param {Element} element
* @param {'contentRect' | 'contentBoxSize' | 'borderBoxSize' | 'devicePixelContentBoxSize'} type
* @param {(entry: keyof ResizeObserverEntry) => void} set
*/
function bind_resize_observer(element, type, set) {
var unsub = (type === "contentRect" || type === "contentBoxSize" ? resize_observer_content_box : type === "borderBoxSize" ? resize_observer_border_box : resize_observer_device_pixel_content_box).observe(
element,
/** @param {any} entry */
(entry) => set(entry[type])
);
teardown(unsub);
}
/**
* @param {HTMLElement} element
* @param {'clientWidth' | 'clientHeight' | 'offsetWidth' | 'offsetHeight'} type
* @param {(size: number) => void} set
*/
function bind_element_size(element, type, set) {
var unsub = resize_observer_border_box.observe(element, () => set(element[type]));
effect(() => {
untrack(() => set(element[type]));
return unsub;
});
}
// node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
/** @import { ComponentContext, Effect } from '#client' */
/**
* @param {any} bound_value
* @param {Element} element_or_component
* @returns {boolean}
*/
function is_bound_this(bound_value, element_or_component) {
return bound_value === element_or_component || bound_value?.[STATE_SYMBOL] === element_or_component;
}
/**
* @param {any} element_or_component
* @param {(value: unknown, ...parts: unknown[]) => void} update
* @param {(...parts: unknown[]) => unknown} get_value
* @param {() => unknown[]} [get_parts] Set if the this binding is used inside an each block,
* returns all the parts of the each block context that are used in the expression
* @returns {void}
*/
function bind_this(element_or_component = mark_as_component(), update, get_value, get_parts) {
var component_effect = component_context.r;
var parent = active_effect;
effect(() => {
/** @type {unknown[]} */
var old_parts;
/** @type {unknown[]} */
var parts;
render_effect(() => {
old_parts = parts;
parts = get_parts?.() || [];
untrack(() => {
if (!is_bound_this(get_value(...parts), element_or_component)) {
update(element_or_component, ...parts);
if (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) update(null, ...old_parts);
}
});
});
return () => {
let p = parent;
while (p !== component_effect && p.parent !== null && p.parent.f & 33554432) p = p.parent;
const teardown = () => {
if (parts && is_bound_this(get_value(...parts), element_or_component)) update(null, ...parts);
};
const original_teardown = p.teardown;
p.teardown = () => {
teardown();
original_teardown?.();
};
};
});
return element_or_component;
}
// node_modules/svelte/src/internal/client/dom/elements/bindings/universal.js
/**
* @param {'innerHTML' | 'textContent' | 'innerText'} property
* @param {HTMLElement} element
* @param {() => unknown} get
* @param {(value: unknown) => void} set
* @returns {void}
*/
function bind_content_editable(property, element, get, set = get) {
element.addEventListener("input", () => {
set(element[property]);
});
render_effect(() => {
var value = get();
if (element[property] !== value) {
if (value == null) {
var non_null_value = element[property];
set(non_null_value);
} else element[property] = value + "";
}
});
}
/**
* @param {string} property
* @param {string} event_name
* @param {Element} element
* @param {(value: unknown) => void} set
* @param {() => unknown} [get]
* @returns {void}
*/
function bind_property(property, event_name, element, set, get) {
var handler = () => {
set(element[property]);
};
element.addEventListener(event_name, handler);
if (get) render_effect(() => {
element[property] = get();
});
else handler();
if (element === document.body || element === window || element === document) teardown(() => {
element.removeEventListener(event_name, handler);
});
}
/**
* @param {HTMLElement} element
* @param {(value: unknown) => void} set
* @returns {void}
*/
function bind_focused(element, set) {
listen(element, ["focus", "blur"], () => {
set(element === document.activeElement);
});
}
// node_modules/svelte/src/internal/client/dom/elements/bindings/window.js
/**
* @param {'x' | 'y'} type
* @param {() => number} get
* @param {(value: number) => void} set
* @returns {void}
*/
function bind_window_scroll(type, get, set = get) {
var is_scrolling_x = type === "x";
var target_handler = () => without_reactive_context(() => {
scrolling = true;
clearTimeout(timeout);
timeout = setTimeout(clear, 100);
set(window[is_scrolling_x ? "scrollX" : "scrollY"]);
});
addEventListener("scroll", target_handler, { passive: true });
var scrolling = false;
/** @type {ReturnType<typeof setTimeout>} */
var timeout;
var clear = () => {
scrolling = false;
};
var first = true;
render_effect(() => {
var latest_value = get();
if (first) first = false;
else if (!scrolling && latest_value != null) {
scrolling = true;
clearTimeout(timeout);
if (is_scrolling_x) scrollTo(latest_value, window.scrollY);
else scrollTo(window.scrollX, latest_value);
timeout = setTimeout(clear, 100);
}
});
effect(target_handler);
teardown(() => {
removeEventListener("scroll", target_handler);
});
}
/**
* @param {'innerWidth' | 'innerHeight' | 'outerWidth' | 'outerHeight'} type
* @param {(size: number) => void} set
*/
function bind_window_size(type, set) {
listen(window, ["resize"], () => without_reactive_context(() => set(window[type])));
}
// node_modules/svelte/src/internal/client/dom/legacy/lifecycle.js
/** @import { ComponentContextLegacy } from '#client' */
/**
* Legacy-mode only: Call `onMount` callbacks and set up `beforeUpdate`/`afterUpdate` effects
* @param {boolean} [immutable]
*/
function init(immutable = false) {
const context = component_context;
const callbacks = context.l.u;
if (!callbacks) return;
let props = () => deep_read_state(context.s);
if (immutable) {
let version = 0;
let prev = {};
const d = /* @__PURE__ */ derived(() => {
let changed = false;
const props = context.s;
for (const key in props) if (props[key] !== prev[key]) {
prev[key] = props[key];
changed = true;
}
if (changed) version++;
return version;
});
props = () => get(d);
}
if (callbacks.b.length) user_pre_effect(() => {
observe_all(context, props);
run_all(callbacks.b);
});
user_effect(() => {
const fns = untrack(() => callbacks.m.map(run));
return () => {
for (const fn of fns) if (typeof fn === "function") fn();
};
});
if (callbacks.a.length) user_effect(() => {
observe_all(context, props);
run_all(callbacks.a);
});
}
/**
* Invoke the getter of all signals associated with a component
* so they can be registered to the effect this function is called in.
* @param {ComponentContextLegacy} context
* @param {(() => void)} props
*/
function observe_all(context, props) {
if (context.l.s) for (const signal of context.l.s) get(signal);
props();
}
// node_modules/svelte/src/internal/client/dom/legacy/misc.js
/**
* Under some circumstances, imports may be reactive in legacy mode. In that case,
* they should be using `reactive_import` as part of the transformation
* @param {() => any} fn
*/
function reactive_import(fn) {
var s = source(0);
return function() {
if (arguments.length === 1) {
set(s, get(s) + 1);
return arguments[0];
} else {
get(s);
return fn();
}
};
}
/**
* @this {any}
* @param {Record<string, unknown>} $$props
* @param {Event} event
* @returns {void}
*/
function bubble_event($$props, event) {
var events = $$props.$$events?.[event.type];
for (var fn of is_array(events) ? events.slice() : events == null ? [] : [events]) fn.call(this, event);
}
/**
* Used to simulate `$on` on a component instance when `compatibility.componentApi === 4`
* @param {Record<string, any>} $$props
* @param {string} event_name
* @param {Function} event_callback
*/
function add_legacy_event_listener($$props, event_name, event_callback) {
$$props.$$events ||= {};
$$props.$$events[event_name] ||= [];
$$props.$$events[event_name].push(event_callback);
}
/**
* Used to simulate `$set` on a component instance when `compatibility.componentApi === 4`.
* Needs component accessors so that it can call the setter of the prop. Therefore doesn't
* work for updating props in `$$props` or `$$restProps`.
* @this {Record<string, any>}
* @param {Record<string, any>} $$new_props
*/
function update_legacy_props($$new_props) {
for (var key in $$new_props) if (key in this) this[key] = $$new_props[key];
}
/**
* Whether or not the prop currently being read is a store binding, as in
* `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in
* runes mode, and skip `binding_property_non_reactive` validation
*/
var is_store_binding = false;
var IS_UNMOUNTED = Symbol("unmounted");
/**
* Gets the current value of a store. If the store isn't subscribed to yet, it will create a proxy
* signal that will be updated when the store is. The store references container is needed to
* track reassignments to stores and to track the correct component context.
* @template V
* @param {Store<V> | null | undefined} store
* @param {string} store_name
* @param {StoreReferencesContainer} stores
* @returns {V}
*/
function store_get(store, store_name, stores) {
const entry = stores[store_name] ??= {
store: null,
source: /* @__PURE__ */ mutable_source(void 0),
unsubscribe: noop
};
entry.source.label = store_name;
if (entry.store !== store && !(IS_UNMOUNTED in stores)) {
entry.unsubscribe();
entry.store = store ?? null;
if (store == null) {
entry.source.v = void 0;
entry.unsubscribe = noop;
} else {
var is_synchronous_callback = true;
entry.unsubscribe = subscribe_to_store(store, (v) => {
if (is_synchronous_callback) entry.source.v = v;
else set(entry.source, v);
});
is_synchronous_callback = false;
}
}
if (store && IS_UNMOUNTED in stores) return get$1(store);
return get(entry.source);
}
/**
* Unsubscribe from a store if it's not the same as the one in the store references container.
* We need this in addition to `store_get` because someone could unsubscribe from a store but
* then never subscribe to the new one (if any), causing the subscription to stay open wrongfully.
* @param {Store<any> | null | undefined} store
* @param {string} store_name
* @param {StoreReferencesContainer} stores
*/
function store_unsub(store, store_name, stores) {
/** @type {StoreReferencesContainer[''] | undefined} */
let entry = stores[store_name];
if (entry && entry.store !== store) {
entry.unsubscribe();
entry.unsubscribe = noop;
}
return store;
}
/**
* Sets the new value of a store and returns that value.
* @template V
* @param {Store<V>} store
* @param {V} value
* @returns {V}
*/
function store_set(store, value) {
update_with_flag(store, value);
return value;
}
/**
* @param {StoreReferencesContainer} stores
* @param {string} store_name
*/
function invalidate_store(stores, store_name) {
var entry = stores[store_name];
if (entry.store !== null) store_set(entry.store, entry.source.v);
}
/**
* Unsubscribes from all auto-subscribed stores on destroy
* @returns {[StoreReferencesContainer, ()=>void]}
*/
function setup_stores() {
/** @type {StoreReferencesContainer} */
const stores = {};
function cleanup() {
teardown(() => {
for (var store_name in stores) stores[store_name].unsubscribe();
define_property(stores, IS_UNMOUNTED, {
enumerable: false,
value: true
});
});
}
return [stores, cleanup];
}
/**
* @param {Store<V>} store
* @param {V} value
* @template V
*/
function update_with_flag(store, value) {
try {
store.set(value);
} finally {}
}
/**
* Updates a store with a new value.
* @param {Store<V>} store the store to update
* @param {any} expression the expression that mutates the store
* @param {V} new_value the new store value
* @template V
*/
function store_mutate(store, expression, new_value) {
update_with_flag(store, new_value);
return expression;
}
/**
* @param {Store<number>} store
* @param {number} store_value
* @param {1 | -1} [d]
* @returns {number}
*/
function update_store(store, store_value, d = 1) {
update_with_flag(store, store_value + d);
return store_value;
}
/**
* @param {Store<number>} store
* @param {number} store_value
* @param {1 | -1} [d]
* @returns {number}
*/
function update_pre_store(store, store_value, d = 1) {
const value = store_value + d;
update_with_flag(store, value);
return value;
}
/**
* Called inside prop getters to communicate that the prop is a store binding
*/
function mark_store_binding() {
is_store_binding = true;
}
/**
* Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.
* Used to prevent `binding_property_non_reactive` validation false positives and
* ensure that these props are treated as mutable even in runes mode
* @template T
* @param {() => T} fn
* @returns {[T, boolean]}
*/
function capture_store_binding(fn) {
var previous_is_store_binding = is_store_binding;
try {
is_store_binding = false;
return [fn(), is_store_binding];
} finally {
is_store_binding = previous_is_store_binding;
}
}
// node_modules/svelte/src/internal/client/reactivity/props.js
/** @import { Derived, Effect, Source } from './types.js' */
/**
* @param {((value?: number) => number)} fn
* @param {1 | -1} [d]
* @returns {number}
*/
function update_prop(fn, d = 1) {
const value = fn();
fn(value + d);
return value;
}
/**
* @param {((value?: number) => number)} fn
* @param {1 | -1} [d]
* @returns {number}
*/
function update_pre_prop(fn, d = 1) {
const value = fn() + d;
fn(value);
return value;
}
/**
* The proxy handler for rest props (i.e. `const { x, ...rest } = $props()`).
* Is passed the full `$$props` object and excludes the named props.
* @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Set<string | symbol>, name?: string }>}}
*/
var rest_props_handler = {
get(target, key) {
if (target.exclude.has(key)) return;
return target.props[key];
},
set(target, key) {
props_rest_readonly(`${target.name}.${String(key)}`);
return false;
},
getOwnPropertyDescriptor(target, key) {
if (target.exclude.has(key)) return;
if (key in target.props) return {
enumerable: true,
configurable: true,
value: target.props[key]
};
},
has(target, key) {
if (target.exclude.has(key)) return false;
return key in target.props;
},
ownKeys(target) {
return Reflect.ownKeys(target.props).filter((key) => !target.exclude.has(key));
}
};
/**
* @param {Record<string, unknown>} props
* @param {Set<string>} exclude
* @param {string} [name]
* @returns {Record<string, unknown>}
*/
/*#__NO_SIDE_EFFECTS__*/
function rest_props(props, exclude, name) {
return new Proxy({
props,
exclude,
name
}, rest_props_handler);
}
/**
* The proxy handler for legacy $$restProps and $$props
* @type {ProxyHandler<{ props: Record<string | symbol, unknown>, exclude: Array<string | symbol>, special: Record<string | symbol, (v?: unknown) => unknown>, version: Source<number>, parent_effect: Effect }>}}
*/
var legacy_rest_props_handler = {
get(target, key) {
if (target.exclude.includes(key)) return;
get(target.version);
return key in target.special ? target.special[key]() : target.props[key];
},
set(target, key, value) {
if (!(key in target.special)) {
var previous_effect = active_effect;
try {
set_active_effect(target.parent_effect);
/** @type {Record<string, (v?: unknown) => unknown>} */
target.special[key] = prop({ get [key]() {
return target.props[key];
} }, key, 4);
} finally {
set_active_effect(previous_effect);
}
}
target.special[key](value);
update(target.version);
return true;
},
getOwnPropertyDescriptor(target, key) {
if (target.exclude.includes(key)) return;
if (key in target.props) return {
enumerable: true,
configurable: true,
value: target.props[key]
};
},
deleteProperty(target, key) {
if (target.exclude.includes(key)) return true;
target.exclude.push(key);
update(target.version);
return true;
},
has(target, key) {
if (target.exclude.includes(key)) return false;
return key in target.props;
},
ownKeys(target) {
return Reflect.ownKeys(target.props).filter((key) => !target.exclude.includes(key));
}
};
/**
* @param {Record<string, unknown>} props
* @param {string[]} exclude
* @returns {Record<string, unknown>}
*/
function legacy_rest_props(props, exclude) {
return new Proxy({
props,
exclude,
special: {},
version: source(0),
parent_effect: active_effect
}, legacy_rest_props_handler);
}
/**
* The proxy handler for spread props. Handles the incoming array of props
* that looks like `() => { dynamic: props }, { static: prop }, ..` and wraps
* them so that the whole thing is passed to the component as the `$$props` argument.
* @type {ProxyHandler<{ props: Array<Record<string | symbol, unknown> | (() => Record<string | symbol, unknown>)> }>}}
*/
var spread_props_handler = {
get(target, key) {
let i = target.props.length;
while (i--) {
let p = target.props[i];
if (is_function(p)) p = p();
if (typeof p === "object" && p !== null && key in p) return p[key];
}
},
set(target, key, value) {
let i = target.props.length;
while (i--) {
let p = target.props[i];
if (is_function(p)) p = p();
const desc = get_descriptor(p, key);
if (desc && desc.set) {
desc.set(value);
return true;
}
}
return false;
},
getOwnPropertyDescriptor(target, key) {
let i = target.props.length;
while (i--) {
let p = target.props[i];
if (is_function(p)) p = p();
if (typeof p === "object" && p !== null && key in p) {
const descriptor = get_descriptor(p, key);
if (descriptor && !descriptor.configurable) descriptor.configurable = true;
return descriptor;
}
}
},
has(target, key) {
if (key === STATE_SYMBOL || key === LEGACY_PROPS) return false;
for (let p of target.props) {
if (is_function(p)) p = p();
if (p != null && key in p) return true;
}
return false;
},
ownKeys(target) {
/** @type {Array<string | symbol>} */
const keys = [];
for (let p of target.props) {
if (is_function(p)) p = p();
if (!p) continue;
for (const key in p) if (!keys.includes(key)) keys.push(key);
for (const key of Object.getOwnPropertySymbols(p)) if (!keys.includes(key)) keys.push(key);
}
return keys;
}
};
/**
* @param {Array<Record<string, unknown> | (() => Record<string, unknown>)>} props
* @returns {any}
*/
function spread_props(...props) {
return new Proxy({ props }, spread_props_handler);
}
/**
* This function is responsible for synchronizing a possibly bound prop with the inner component state.
* It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.
* @template V
* @param {Record<string, unknown>} props
* @param {string} key
* @param {number} flags
* @param {V | (() => V)} [fallback]
* @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))}
*/
function prop(props, key, flags, fallback) {
var runes = !legacy_mode_flag || (flags & 2) !== 0;
var bindable = (flags & 8) !== 0;
var lazy = (flags & 16) !== 0;
var fallback_value = fallback;
var fallback_dirty = true;
var fallback_signal = void 0;
var get_fallback = () => {
if (lazy && runes) {
fallback_signal ??= /* @__PURE__ */ derived(fallback);
return get(fallback_signal);
}
if (fallback_dirty) {
fallback_dirty = false;
fallback_value = lazy ? untrack(fallback) : fallback;
}
return fallback_value;
};
/** @type {((v: V) => void) | undefined} */
let setter;
if (bindable) {
var is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;
setter = get_descriptor(props, key)?.set ?? (is_entry_props && key in props ? (v) => props[key] = v : void 0);
}
/** @type {V} */
var initial_value;
var is_store_sub = false;
if (bindable) [initial_value, is_store_sub] = capture_store_binding(() => props[key]);
else initial_value = props[key];
if (initial_value === void 0 && fallback !== void 0) {
initial_value = get_fallback();
if (setter) {
if (runes) props_invalid_value(key);
setter(initial_value);
}
}
/** @type {() => V} */
var getter;
if (runes) getter = () => {
var value = props[key];
if (value === void 0) return get_fallback();
fallback_dirty = true;
return value;
};
else getter = () => {
var value = props[key];
if (value !== void 0) fallback_value = void 0;
return value === void 0 ? fallback_value : value;
};
if (runes && (flags & 4) === 0) return getter;
if (setter) {
var legacy_parent = props.$$legacy;
return (function(value, mutation) {
if (arguments.length > 0) {
if (!runes || !mutation || legacy_parent || is_store_sub)
/** @type {Function} */ setter(mutation ? getter() : value);
return value;
}
return getter();
});
}
var overridden = false;
var d = ((flags & 1) !== 0 ? derived : derived_safe_equal)(() => {
overridden = false;
return getter();
});
d.label = key;
if (bindable) get(d);
var parent_effect = active_effect;
return (function(value, mutation) {
if (arguments.length > 0) {
const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;
set(d, new_value);
overridden = true;
if (fallback_value !== void 0) fallback_value = new_value;
return value;
}
if (is_destroying_effect && overridden || (parent_effect.f & 16384) !== 0) return d.v;
return get(d);
});
}
// node_modules/svelte/src/internal/client/validate.js
/** @import { Blocker } from '#client' */
/**
* @param {string} binding
* @param {Blocker[]} blockers
* @param {() => Record<string, any>} get_object
* @param {() => string} get_property
* @param {number} line
* @param {number} column
*/
function validate_binding(binding, blockers, get_object, get_property, line, column) {
run_after_blockers(blockers, () => {
var warned = false;
var filename = dev_current_component_function?.[FILENAME];
render_effect(() => {
if (warned) return;
var [object, is_store_sub] = capture_store_binding(get_object);
if (is_store_sub) return;
var property = get_property();
var ran = false;
var effect = render_effect(() => {
if (ran) return;
object[property];
});
ran = true;
if (effect.deps === null) {
var location = `${filename}:${line}:${column}`;
binding_property_non_reactive(binding, location);
warned = true;
}
});
});
}
// node_modules/svelte/src/internal/client/dom/elements/custom-element.js
/**
* @typedef {Object} CustomElementPropDefinition
* @property {string} [attribute]
* @property {boolean} [reflect]
* @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type]
*/
/** @type {any} */
var SvelteElement;
if (typeof HTMLElement === "function") SvelteElement = class extends HTMLElement {
/** The Svelte component constructor */
$$ctor;
/** Slots */
$$s;
/** @type {any} The Svelte component instance */
$$c;
/** Whether or not the custom element is connected */
$$cn = false;
/** @type {Record<string, any>} Component props data */
$$d = {};
/** `true` if currently in the process of reflecting component props back to attributes */
$$r = false;
/** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
$$p_d = {};
/** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */
$$l = {};
/** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */
$$l_u = /* @__PURE__ */ new Map();
/** @type {any} The managed render effect for reflecting attributes */
$$me;
/** @type {ShadowRoot | null} The ShadowRoot of the custom element */
$$shadowRoot = null;
/**
* @param {*} $$componentCtor
* @param {*} $$slots
* @param {ShadowRootInit | undefined} shadow_root_init
*/
constructor($$componentCtor, $$slots, shadow_root_init) {
super();
this.$$ctor = $$componentCtor;
this.$$s = $$slots;
if (shadow_root_init) this.$$shadowRoot = this.attachShadow(shadow_root_init);
}
/**
* @param {string} type
* @param {EventListenerOrEventListenerObject} listener
* @param {boolean | AddEventListenerOptions} [options]
*/
addEventListener(type, listener, options) {
this.$$l[type] = this.$$l[type] || [];
this.$$l[type].push(listener);
if (this.$$c) {
const unsub = this.$$c.$on(type, listener);
this.$$l_u.set(listener, unsub);
}
super.addEventListener(type, listener, options);
}
/**
* @param {string} type
* @param {EventListenerOrEventListenerObject} listener
* @param {boolean | AddEventListenerOptions} [options]
*/
removeEventListener(type, listener, options) {
super.removeEventListener(type, listener, options);
if (this.$$c) {
const unsub = this.$$l_u.get(listener);
if (unsub) {
unsub();
this.$$l_u.delete(listener);
}
}
}
async connectedCallback() {
this.$$cn = true;
if (!this.$$c) {
await Promise.resolve();
if (!this.$$cn || this.$$c) return;
/** @param {string} name */
function create_slot(name) {
/**
* @param {Element} anchor
*/
return (anchor) => {
const slot = create_element("slot");
if (name !== "default") slot.name = name;
append(anchor, slot);
};
}
/** @type {Record<string, any>} */
const $$slots = {};
const existing_slots = get_custom_elements_slots(this);
for (const name of this.$$s) if (name in existing_slots) {
if (name === "default" && !this.$$d.children) {
this.$$d.children = create_slot(name);
$$slots.default = true;
} else $$slots[name] = create_slot(name);
}
for (const attribute of this.attributes) {
const name = this.$$g_p(attribute.name);
if (!(name in this.$$d)) this.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, "toProp");
}
for (const key in this.$$p_d) if (!(key in this.$$d) && this[key] !== void 0) {
this.$$d[key] = this[key];
delete this[key];
}
this.$$c = createClassComponent({
component: this.$$ctor,
target: this.$$shadowRoot || this,
props: {
...this.$$d,
$$slots,
$$host: this
}
});
this.$$me = effect_root(() => {
render_effect(() => {
this.$$r = true;
for (const key of object_keys(this.$$c)) {
if (!this.$$p_d[key]?.reflect) continue;
this.$$d[key] = this.$$c[key];
const attribute_value = get_custom_element_value(key, this.$$d[key], this.$$p_d, "toAttribute");
if (attribute_value == null) this.removeAttribute(this.$$p_d[key].attribute || key);
else this.setAttribute(this.$$p_d[key].attribute || key, attribute_value);
}
this.$$r = false;
});
});
for (const type in this.$$l) for (const listener of this.$$l[type]) {
const unsub = this.$$c.$on(type, listener);
this.$$l_u.set(listener, unsub);
}
this.$$l = {};
}
}
/**
* @param {string} attr
* @param {string} _oldValue
* @param {string} newValue
*/
attributeChangedCallback(attr, _oldValue, newValue) {
if (this.$$r) return;
attr = this.$$g_p(attr);
this.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, "toProp");
this.$$c?.$set({ [attr]: this.$$d[attr] });
}
disconnectedCallback() {
this.$$cn = false;
Promise.resolve().then(() => {
if (!this.$$cn && this.$$c) {
this.$$c.$destroy();
this.$$me();
this.$$c = void 0;
}
});
}
/**
* @param {string} attribute_name
*/
$$g_p(attribute_name) {
return object_keys(this.$$p_d).find((key) => this.$$p_d[key].attribute === attribute_name || !this.$$p_d[key].attribute && key.toLowerCase() === attribute_name) || attribute_name;
}
};
/**
* @param {string} prop
* @param {any} value
* @param {Record<string, CustomElementPropDefinition>} props_definition
* @param {'toAttribute' | 'toProp'} [transform]
*/
function get_custom_element_value(prop, value, props_definition, transform) {
const type = props_definition[prop]?.type;
value = type === "Boolean" && typeof value !== "boolean" ? value != null : value;
if (!transform || !props_definition[prop]) return value;
else if (transform === "toAttribute") switch (type) {
case "Object":
case "Array": return value == null ? null : JSON.stringify(value);
case "Boolean": return value ? "" : null;
case "Number": return value == null ? null : value;
default: return value;
}
else switch (type) {
case "Object":
case "Array": return value && JSON.parse(value);
case "Boolean": return value;
case "Number": return value != null ? +value : value;
default: return value;
}
}
/**
* @param {HTMLElement} element
*/
function get_custom_elements_slots(element) {
/** @type {Record<string, true>} */
const result = {};
element.childNodes.forEach((node) => {
result[node.slot || "default"] = true;
});
return result;
}
/**
* @internal
*
* Turn a Svelte component into a custom element.
* @param {any} Component A Svelte component function
* @param {Record<string, CustomElementPropDefinition>} props_definition The props to observe
* @param {string[]} slots The slots to create
* @param {string[]} exports Explicitly exported values, other than props
* @param {ShadowRootInit | undefined} shadow_root_init Options passed to shadow DOM constructor
* @param {(ce: new () => HTMLElement) => new () => HTMLElement} [extend]
*/
function create_custom_element(Component, props_definition, slots, exports, shadow_root_init, extend) {
let Class = class extends SvelteElement {
constructor() {
super(Component, slots, shadow_root_init);
this.$$p_d = props_definition;
}
static get observedAttributes() {
return object_keys(props_definition).map((key) => (props_definition[key].attribute || key).toLowerCase());
}
};
object_keys(props_definition).forEach((prop) => {
define_property(Class.prototype, prop, {
get() {
return this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop];
},
set(value) {
value = get_custom_element_value(prop, value, props_definition);
this.$$d[prop] = value;
var component = this.$$c;
if (component) {
if (get_descriptor(component, prop)?.get) component[prop] = value;
else component.$set({ [prop]: value });
}
}
});
});
exports.forEach((property) => {
define_property(Class.prototype, property, { get() {
return this.$$c?.[property];
} });
});
if (extend) Class = extend(Class);
Component.element = Class;
return Class;
}
// node_modules/svelte/src/internal/client/dev/console-log.js
/**
* @param {string} method
* @param {...any} objects
*/
function log_if_contains_state(method, ...objects) {
untrack(() => {
try {
let has_state = false;
const transformed = [];
for (const obj of objects) if (obj && typeof obj === "object" && STATE_SYMBOL in obj) {
transformed.push(snapshot(obj, true));
has_state = true;
} else transformed.push(obj);
if (has_state) {
console_log_state(method);
console.log("%c[snapshot]", "color: grey", ...transformed);
}
} catch {}
});
return objects;
}
// node_modules/svelte/src/internal/client/hydratable.js
/**
* @template T
* @param {string} key
* @param {() => T} fn
* @returns {T}
*/
function hydratable(key, fn) {
if (!async_mode_flag) experimental_async_required("hydratable");
if (hydrating) {
const store = window.__svelte?.h;
if (store?.has(key)) return store.get(key);
hydratable_missing_but_required(key);
}
return fn();
}
{
/**
* @param {string} rune
*/
function throw_rune_error(rune) {
if (!(rune in globalThis)) {
/** @type {any} */
let value;
Object.defineProperty(globalThis, rune, {
configurable: true,
get: () => {
if (value !== void 0) return value;
rune_outside_svelte(rune);
},
set: (v) => {
value = v;
}
});
}
}
throw_rune_error("$state");
throw_rune_error("$effect");
throw_rune_error("$derived");
throw_rune_error("$inspect");
throw_rune_error("$props");
throw_rune_error("$bindable");
}
/**
* Returns an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that aborts when the current [derived](https://svelte.dev/docs/svelte/$derived) or [effect](https://svelte.dev/docs/svelte/$effect) re-runs or is destroyed.
*
* Must be called while a derived or effect is running.
*
* ```svelte
* <script>
* import { getAbortSignal } from 'svelte';
*
* let { id } = $props();
*
* async function getData(id) {
* const response = await fetch(`/items/${id}`, {
* signal: getAbortSignal()
* });
*
* return await response.json();
* }
*
* const data = $derived(await getData(id));
* <\/script>
* ```
*/
function getAbortSignal() {
if (active_reaction === null) get_abort_signal_outside_reaction();
return (active_reaction.ac ??= new AbortController()).signal;
}
/**
* `onMount`, like [`$effect`](https://svelte.dev/docs/svelte/$effect), schedules a function to run as soon as the component has been mounted to the DOM.
* Unlike `$effect`, the provided function only runs once.
*
* It must be called during the component's initialisation (but doesn't need to live _inside_ the component;
* it can be called from an external module). If a function is returned _synchronously_ from `onMount`,
* it will be called when the component is unmounted.
*
* `onMount` functions do not run during [server-side rendering](https://svelte.dev/docs/svelte/svelte-server#render).
*
* @template T
* @param {() => NotFunction<T> | Promise<NotFunction<T>> | (() => any)} fn
* @returns {void}
*/
function onMount(fn) {
if (component_context === null) lifecycle_outside_component("onMount");
if (legacy_mode_flag && component_context.l !== null) init_update_callbacks(component_context).m.push(fn);
else user_effect(() => {
const cleanup = untrack(fn);
if (typeof cleanup === "function") return cleanup;
});
}
/**
* Schedules a callback to run immediately before the component is unmounted.
*
* Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the
* only one that runs inside a server-side component.
*
* @param {() => any} fn
* @returns {void}
*/
function onDestroy(fn) {
if (component_context === null) lifecycle_outside_component("onDestroy");
onMount(() => () => untrack(fn));
}
/**
* @template [T=any]
* @param {string} type
* @param {T} [detail]
* @param {any}params_0
* @returns {CustomEvent<T>}
*/
function create_custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {
return new CustomEvent(type, {
detail,
bubbles,
cancelable
});
}
/**
* Creates an event dispatcher that can be used to dispatch [component events](https://svelte.dev/docs/svelte/legacy-on#Component-events).
* Event dispatchers are functions that can take two arguments: `name` and `detail`.
*
* Component events created with `createEventDispatcher` create a
* [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).
* These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).
* The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)
* property and can contain any type of data.
*
* The event dispatcher can be typed to narrow the allowed event names and the type of the `detail` argument:
* ```ts
* const dispatch = createEventDispatcher<{
* loaded: null; // does not take a detail argument
* change: string; // takes a detail argument of type string, which is required
* optional: number | null; // takes an optional detail argument of type number
* }>();
* ```
*
* @deprecated Use callback props and/or the `$host()` rune instead — see [migration guide](https://svelte.dev/docs/svelte/v5-migration-guide#Event-changes-Component-events)
* @template {Record<string, any>} [EventMap = any]
* @returns {EventDispatcher<EventMap>}
*/
function createEventDispatcher() {
const active_component_context = component_context;
if (active_component_context === null) lifecycle_outside_component("createEventDispatcher");
/**
* @param [detail]
* @param [options]
*/
return (type, detail, options) => {
const events = active_component_context.s.$$events?.[type];
if (events) {
const callbacks = is_array(events) ? events.slice() : [events];
const event = create_custom_event(type, detail, options);
for (const fn of callbacks) fn.call(active_component_context.x, event);
return !event.defaultPrevented;
}
return true;
};
}
/**
* Schedules a callback to run immediately before the component is updated after any state change.
*
* The first time the callback runs will be before the initial `onMount`.
*
* In runes mode use `$effect.pre` instead.
*
* @deprecated Use [`$effect.pre`](https://svelte.dev/docs/svelte/$effect#$effect.pre) instead
* @param {() => void} fn
* @returns {void}
*/
function beforeUpdate(fn) {
if (component_context === null) lifecycle_outside_component("beforeUpdate");
if (component_context.l === null) lifecycle_legacy_only("beforeUpdate");
init_update_callbacks(component_context).b.push(fn);
}
/**
* Schedules a callback to run immediately after the component has been updated.
*
* The first time the callback runs will be after the initial `onMount`.
*
* In runes mode use `$effect` instead.
*
* @deprecated Use [`$effect`](https://svelte.dev/docs/svelte/$effect) instead
* @param {() => void} fn
* @returns {void}
*/
function afterUpdate(fn) {
if (component_context === null) lifecycle_outside_component("afterUpdate");
if (component_context.l === null) lifecycle_legacy_only("afterUpdate");
init_update_callbacks(component_context).a.push(fn);
}
/**
* Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate
* @param {ComponentContext} context
*/
function init_update_callbacks(context) {
var l = context.l;
return l.u ??= {
a: [],
b: [],
m: []
};
}
export { bind_files as $, inspect as $t, init as A, animation as At, bind_online as B, validate_store as Bt, store_unsub as C, attr as Ct, bubble_event as D, append_styles$1 as Dt, add_legacy_event_listener as E, action as Et, bind_property as F, createRawSnippet as Ft, bind_paused as G, each as Gt, bind_current_time as H, sanitize_slots as Ht, bind_this as I, snippet as It, bind_ready_state as J, key as Jt, bind_playback_rate as K, index as Kt, bind_element_size as L, wrap_snippet as Lt, bind_window_size as M, loop as Mt, bind_content_editable as N, raf as Nt, reactive_import as O, head as Ot, bind_focused as P, component as Pt, bind_checked as Q, async as Qt, bind_resize_observer as R, prevent_snippet_stringification as Rt, store_set as S, set_class as St, update_store as T, attach as Tt, bind_ended as U, slot as Ut, bind_buffered as V, validate_void_dynamic_element as Vt, bind_muted as W, html as Wt, bind_seeking as X, await_block as Xt, bind_seekable as Y, if_block as Yt, bind_volume as Z, validate_snippet_args as Zt, invalidate_store as _, init_select as _t, onDestroy as a, cleanup_styles as an, CLASS as at, store_get as b, set_selected as bt, log_if_contains_state as c, createAttachmentKey as cn, remove_input_defaults as ct, legacy_rest_props as d, set_custom_element_data as dt, check_target as en, bind_group as et, prop as f, set_default_checked as ft, update_prop as g, bind_select_value as gt, update_pre_prop as h, set_xlink_attribute as ht, getAbortSignal as i, add_locations as in, selectedcontent as it, bind_window_scroll as j, transition as jt, update_legacy_props as k, element as kt, create_custom_element as l, fromAction as ln, set_attribute as lt, spread_props as m, set_value as mt, beforeUpdate as n, create_ownership_validator as nn, bind_active_element as nt, onMount as o, assign as on, STYLE as ot, rest_props as p, set_default_value as pt, bind_played as q, css_props as qt, createEventDispatcher as r, hmr as rn, customizable_select as rt, hydratable as s, assign_async as sn, attribute_effect as st, afterUpdate as t, legacy_api as tn, bind_value as tt, validate_binding as u, set_checked as ut, mark_store_binding as v, select_option as vt, update_pre_store as w, clsx as wt, store_mutate as x, set_style as xt, setup_stores as y, set_default_select_value as yt, bind_prop as z, validate_dynamic_element_tag as zt };