@pie-element/simple-cloze 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4149 @@
1
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/disclose-version.js
2
+ if (typeof window !== "undefined") {
3
+ var _window$__svelte, _window;
4
+ ((_window$__svelte = (_window = window).__svelte ?? (_window.__svelte = {})).v ?? (_window$__svelte.v = /* @__PURE__ */ new Set())).add("5");
5
+ }
6
+ //#endregion
7
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/constants.js
8
+ var HYDRATION_ERROR = {};
9
+ var UNINITIALIZED = Symbol();
10
+ var NAMESPACE_SVG = "http://www.w3.org/2000/svg";
11
+ var NAMESPACE_MATHML = "http://www.w3.org/1998/Math/MathML";
12
+ //#endregion
13
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/shared/utils.js
14
+ var is_array = Array.isArray;
15
+ var index_of = Array.prototype.indexOf;
16
+ var includes = Array.prototype.includes;
17
+ var array_from = Array.from;
18
+ var object_keys = Object.keys;
19
+ var define_property = Object.defineProperty;
20
+ var get_descriptor = Object.getOwnPropertyDescriptor;
21
+ var object_prototype = Object.prototype;
22
+ var array_prototype = Array.prototype;
23
+ var get_prototype_of = Object.getPrototypeOf;
24
+ var is_extensible = Object.isExtensible;
25
+ var noop = () => {};
26
+ /** @param {Array<() => void>} arr */
27
+ function run_all(arr) {
28
+ for (var i = 0; i < arr.length; i++) arr[i]();
29
+ }
30
+ /**
31
+ * TODO replace with Promise.withResolvers once supported widely enough
32
+ * @template [T=void]
33
+ */
34
+ function deferred() {
35
+ /** @type {(value: T) => void} */
36
+ var resolve;
37
+ /** @type {(reason: any) => void} */
38
+ var reject;
39
+ return {
40
+ promise: new Promise((res, rej) => {
41
+ resolve = res;
42
+ reject = rej;
43
+ }),
44
+ resolve,
45
+ reject
46
+ };
47
+ }
48
+ //#endregion
49
+ //#region \0@oxc-project+runtime@0.120.0/helpers/typeof.js
50
+ function _typeof(o) {
51
+ "@babel/helpers - typeof";
52
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
53
+ return typeof o;
54
+ } : function(o) {
55
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
56
+ }, _typeof(o);
57
+ }
58
+ //#endregion
59
+ //#region \0@oxc-project+runtime@0.120.0/helpers/toPrimitive.js
60
+ function toPrimitive(t, r) {
61
+ if ("object" != _typeof(t) || !t) return t;
62
+ var e = t[Symbol.toPrimitive];
63
+ if (void 0 !== e) {
64
+ var i = e.call(t, r || "default");
65
+ if ("object" != _typeof(i)) return i;
66
+ throw new TypeError("@@toPrimitive must return a primitive value.");
67
+ }
68
+ return ("string" === r ? String : Number)(t);
69
+ }
70
+ //#endregion
71
+ //#region \0@oxc-project+runtime@0.120.0/helpers/toPropertyKey.js
72
+ function toPropertyKey(t) {
73
+ var i = toPrimitive(t, "string");
74
+ return "symbol" == _typeof(i) ? i : i + "";
75
+ }
76
+ //#endregion
77
+ //#region \0@oxc-project+runtime@0.120.0/helpers/defineProperty.js
78
+ function _defineProperty(e, r, t) {
79
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
80
+ value: t,
81
+ enumerable: !0,
82
+ configurable: !0,
83
+ writable: !0
84
+ }) : e[r] = t, e;
85
+ }
86
+ var CLEAN = 1024;
87
+ var DIRTY = 2048;
88
+ var MAYBE_DIRTY = 4096;
89
+ var INERT = 8192;
90
+ var DESTROYED = 16384;
91
+ /** Set once a reaction has run for the first time */
92
+ var REACTION_RAN = 32768;
93
+ /** Effect is in the process of getting destroyed. Can be observed in child teardown functions */
94
+ var DESTROYING = 1 << 25;
95
+ /**
96
+ * 'Transparent' effects do not create a transition boundary.
97
+ * This is on a block effect 99% of the time but may also be on a branch effect if its parent block effect was pruned
98
+ */
99
+ var EFFECT_TRANSPARENT = 65536;
100
+ var EFFECT_PRESERVED = 1 << 19;
101
+ var USER_EFFECT = 1 << 20;
102
+ /**
103
+ * Tells that we marked this derived and its reactions as visited during the "mark as (maybe) dirty"-phase.
104
+ * Will be lifted during execution of the derived and during checking its dirty state (both are necessary
105
+ * because a derived might be checked but not executed).
106
+ */
107
+ var WAS_MARKED = 65536;
108
+ var REACTION_IS_UPDATING = 1 << 21;
109
+ var ASYNC = 1 << 22;
110
+ var ERROR_VALUE = 1 << 23;
111
+ var STATE_SYMBOL = Symbol("$state");
112
+ var LEGACY_PROPS = Symbol("legacy props");
113
+ /** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
114
+ var STALE_REACTION = new class StaleReactionError extends Error {
115
+ constructor(..._args) {
116
+ super(..._args);
117
+ _defineProperty(this, "name", "StaleReactionError");
118
+ _defineProperty(this, "message", "The reaction that called `getAbortSignal()` was re-run or destroyed");
119
+ }
120
+ }();
121
+ globalThis.document?.contentType;
122
+ //#endregion
123
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/errors.js
124
+ /**
125
+ * Cannot create a `$derived(...)` with an `await` expression outside of an effect tree
126
+ * @returns {never}
127
+ */
128
+ function async_derived_orphan() {
129
+ throw new Error(`https://svelte.dev/e/async_derived_orphan`);
130
+ }
131
+ /**
132
+ * `%rune%` cannot be used inside an effect cleanup function
133
+ * @param {string} rune
134
+ * @returns {never}
135
+ */
136
+ function effect_in_teardown(rune) {
137
+ throw new Error(`https://svelte.dev/e/effect_in_teardown`);
138
+ }
139
+ /**
140
+ * Effect cannot be created inside a `$derived` value that was not itself created inside an effect
141
+ * @returns {never}
142
+ */
143
+ function effect_in_unowned_derived() {
144
+ throw new Error(`https://svelte.dev/e/effect_in_unowned_derived`);
145
+ }
146
+ /**
147
+ * `%rune%` can only be used inside an effect (e.g. during component initialisation)
148
+ * @param {string} rune
149
+ * @returns {never}
150
+ */
151
+ function effect_orphan(rune) {
152
+ throw new Error(`https://svelte.dev/e/effect_orphan`);
153
+ }
154
+ /**
155
+ * Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
156
+ * @returns {never}
157
+ */
158
+ function effect_update_depth_exceeded() {
159
+ throw new Error(`https://svelte.dev/e/effect_update_depth_exceeded`);
160
+ }
161
+ /**
162
+ * Failed to hydrate the application
163
+ * @returns {never}
164
+ */
165
+ function hydration_failed() {
166
+ throw new Error(`https://svelte.dev/e/hydration_failed`);
167
+ }
168
+ /**
169
+ * Cannot do `bind:%key%={undefined}` when `%key%` has a fallback value
170
+ * @param {string} key
171
+ * @returns {never}
172
+ */
173
+ function props_invalid_value(key) {
174
+ throw new Error(`https://svelte.dev/e/props_invalid_value`);
175
+ }
176
+ /**
177
+ * Property descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.
178
+ * @returns {never}
179
+ */
180
+ function state_descriptors_fixed() {
181
+ throw new Error(`https://svelte.dev/e/state_descriptors_fixed`);
182
+ }
183
+ /**
184
+ * Cannot set prototype of `$state` object
185
+ * @returns {never}
186
+ */
187
+ function state_prototype_fixed() {
188
+ throw new Error(`https://svelte.dev/e/state_prototype_fixed`);
189
+ }
190
+ /**
191
+ * Updating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`
192
+ * @returns {never}
193
+ */
194
+ function state_unsafe_mutation() {
195
+ throw new Error(`https://svelte.dev/e/state_unsafe_mutation`);
196
+ }
197
+ /**
198
+ * A `<svelte:boundary>` `reset` function cannot be called while an error is still being handled
199
+ * @returns {never}
200
+ */
201
+ function svelte_boundary_reset_onerror() {
202
+ throw new Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`);
203
+ }
204
+ /**
205
+ * Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near %location%
206
+ * @param {string | undefined | null} [location]
207
+ */
208
+ function hydration_mismatch(location) {
209
+ console.warn(`https://svelte.dev/e/hydration_mismatch`);
210
+ }
211
+ /**
212
+ * A `<svelte:boundary>` `reset` function only resets the boundary the first time it is called
213
+ */
214
+ function svelte_boundary_reset_noop() {
215
+ console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
216
+ }
217
+ //#endregion
218
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/hydration.js
219
+ /** @import { TemplateNode } from '#client' */
220
+ /**
221
+ * Use this variable to guard everything related to hydration code so it can be treeshaken out
222
+ * if the user doesn't use the `hydrate` method and these code paths are therefore not needed.
223
+ */
224
+ var hydrating = false;
225
+ /** @param {boolean} value */
226
+ function set_hydrating(value) {
227
+ hydrating = value;
228
+ }
229
+ /**
230
+ * The node that is currently being hydrated. This starts out as the first node inside the opening
231
+ * <!--[--> comment, and updates each time a component calls `$.child(...)` or `$.sibling(...)`.
232
+ * When entering a block (e.g. `{#if ...}`), `hydrate_node` is the block opening comment; by the
233
+ * time we leave the block it is the closing comment, which serves as the block's anchor.
234
+ * @type {TemplateNode}
235
+ */
236
+ var hydrate_node;
237
+ /** @param {TemplateNode | null} node */
238
+ function set_hydrate_node(node) {
239
+ if (node === null) {
240
+ hydration_mismatch();
241
+ throw HYDRATION_ERROR;
242
+ }
243
+ return hydrate_node = node;
244
+ }
245
+ function hydrate_next() {
246
+ return set_hydrate_node(/* @__PURE__ */ get_next_sibling(hydrate_node));
247
+ }
248
+ /** @param {TemplateNode} node */
249
+ function reset(node) {
250
+ if (!hydrating) return;
251
+ if (/* @__PURE__ */ get_next_sibling(hydrate_node) !== null) {
252
+ hydration_mismatch();
253
+ throw HYDRATION_ERROR;
254
+ }
255
+ hydrate_node = node;
256
+ }
257
+ function next(count = 1) {
258
+ if (hydrating) {
259
+ var i = count;
260
+ var node = hydrate_node;
261
+ while (i--) node = /* @__PURE__ */ get_next_sibling(node);
262
+ hydrate_node = node;
263
+ }
264
+ }
265
+ /**
266
+ * Skips or removes (depending on {@link remove}) all nodes starting at `hydrate_node` up until the next hydration end comment
267
+ * @param {boolean} remove
268
+ */
269
+ function skip_nodes(remove = true) {
270
+ var depth = 0;
271
+ var node = hydrate_node;
272
+ while (true) {
273
+ if (node.nodeType === 8) {
274
+ var data = node.data;
275
+ if (data === "]") {
276
+ if (depth === 0) return node;
277
+ depth -= 1;
278
+ } else if (data === "[" || data === "[!" || data[0] === "[" && !isNaN(Number(data.slice(1)))) depth += 1;
279
+ }
280
+ var next = /* @__PURE__ */ get_next_sibling(node);
281
+ if (remove) node.remove();
282
+ node = next;
283
+ }
284
+ }
285
+ /**
286
+ *
287
+ * @param {TemplateNode} node
288
+ */
289
+ function read_hydration_instruction(node) {
290
+ if (!node || node.nodeType !== 8) {
291
+ hydration_mismatch();
292
+ throw HYDRATION_ERROR;
293
+ }
294
+ return node.data;
295
+ }
296
+ //#endregion
297
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/equality.js
298
+ /** @import { Equals } from '#client' */
299
+ /** @type {Equals} */
300
+ function equals(value) {
301
+ return value === this.v;
302
+ }
303
+ /**
304
+ * @param {unknown} a
305
+ * @param {unknown} b
306
+ * @returns {boolean}
307
+ */
308
+ function safe_not_equal(a, b) {
309
+ return a != a ? b == b : a !== b || a !== null && typeof a === "object" || typeof a === "function";
310
+ }
311
+ /** @type {Equals} */
312
+ function safe_equals(value) {
313
+ return !safe_not_equal(value, this.v);
314
+ }
315
+ //#endregion
316
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/flags/index.js
317
+ /** True if experimental.async=true */
318
+ var async_mode_flag = false;
319
+ /** True if we're not certain that we only have Svelte 5 code in the compilation */
320
+ var legacy_mode_flag = false;
321
+ //#endregion
322
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/context.js
323
+ /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
324
+ /** @type {ComponentContext | null} */
325
+ var component_context = null;
326
+ /** @param {ComponentContext | null} context */
327
+ function set_component_context(context) {
328
+ component_context = context;
329
+ }
330
+ /**
331
+ * @param {Record<string, unknown>} props
332
+ * @param {any} runes
333
+ * @param {Function} [fn]
334
+ * @returns {void}
335
+ */
336
+ function push(props, runes = false, fn) {
337
+ component_context = {
338
+ p: component_context,
339
+ i: false,
340
+ c: null,
341
+ e: null,
342
+ s: props,
343
+ x: null,
344
+ r: active_effect,
345
+ l: legacy_mode_flag && !runes ? {
346
+ s: null,
347
+ u: null,
348
+ $: []
349
+ } : null
350
+ };
351
+ }
352
+ /**
353
+ * @template {Record<string, any>} T
354
+ * @param {T} [component]
355
+ * @returns {T}
356
+ */
357
+ function pop(component) {
358
+ var context = component_context;
359
+ var effects = context.e;
360
+ if (effects !== null) {
361
+ context.e = null;
362
+ for (var fn of effects) create_user_effect(fn);
363
+ }
364
+ if (component !== void 0) context.x = component;
365
+ context.i = true;
366
+ component_context = context.p;
367
+ return component ?? {};
368
+ }
369
+ /** @returns {boolean} */
370
+ function is_runes() {
371
+ return !legacy_mode_flag || component_context !== null && component_context.l === null;
372
+ }
373
+ //#endregion
374
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/task.js
375
+ /** @type {Array<() => void>} */
376
+ var micro_tasks = [];
377
+ function run_micro_tasks() {
378
+ var tasks = micro_tasks;
379
+ micro_tasks = [];
380
+ run_all(tasks);
381
+ }
382
+ /**
383
+ * @param {() => void} fn
384
+ */
385
+ function queue_micro_task(fn) {
386
+ if (micro_tasks.length === 0 && !is_flushing_sync) {
387
+ var tasks = micro_tasks;
388
+ queueMicrotask(() => {
389
+ if (tasks === micro_tasks) run_micro_tasks();
390
+ });
391
+ }
392
+ micro_tasks.push(fn);
393
+ }
394
+ /**
395
+ * Synchronously run any queued tasks.
396
+ */
397
+ function flush_tasks() {
398
+ while (micro_tasks.length > 0) run_micro_tasks();
399
+ }
400
+ /**
401
+ * @param {unknown} error
402
+ */
403
+ function handle_error(error) {
404
+ var effect = active_effect;
405
+ if (effect === null) {
406
+ /** @type {Derived} */ active_reaction.f |= ERROR_VALUE;
407
+ return error;
408
+ }
409
+ if ((effect.f & 32768) === 0 && (effect.f & 4) === 0) throw error;
410
+ invoke_error_boundary(error, effect);
411
+ }
412
+ /**
413
+ * @param {unknown} error
414
+ * @param {Effect | null} effect
415
+ */
416
+ function invoke_error_boundary(error, effect) {
417
+ while (effect !== null) {
418
+ if ((effect.f & 128) !== 0) {
419
+ if ((effect.f & 32768) === 0) throw error;
420
+ try {
421
+ /** @type {Boundary} */ effect.b.error(error);
422
+ return;
423
+ } catch (e) {
424
+ error = e;
425
+ }
426
+ }
427
+ effect = effect.parent;
428
+ }
429
+ throw error;
430
+ }
431
+ //#endregion
432
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/status.js
433
+ /** @import { Derived, Signal } from '#client' */
434
+ var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
435
+ /**
436
+ * @param {Signal} signal
437
+ * @param {number} status
438
+ */
439
+ function set_signal_status(signal, status) {
440
+ signal.f = signal.f & STATUS_MASK | status;
441
+ }
442
+ /**
443
+ * Set a derived's status to CLEAN or MAYBE_DIRTY based on its connection state.
444
+ * @param {Derived} derived
445
+ */
446
+ function update_derived_status(derived) {
447
+ if ((derived.f & 512) !== 0 || derived.deps === null) set_signal_status(derived, CLEAN);
448
+ else set_signal_status(derived, MAYBE_DIRTY);
449
+ }
450
+ //#endregion
451
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/utils.js
452
+ /** @import { Derived, Effect, Value } from '#client' */
453
+ /**
454
+ * @param {Value[] | null} deps
455
+ */
456
+ function clear_marked(deps) {
457
+ if (deps === null) return;
458
+ for (const dep of deps) {
459
+ if ((dep.f & 2) === 0 || (dep.f & 65536) === 0) continue;
460
+ dep.f ^= WAS_MARKED;
461
+ clear_marked(
462
+ /** @type {Derived} */
463
+ dep.deps
464
+ );
465
+ }
466
+ }
467
+ /**
468
+ * @param {Effect} effect
469
+ * @param {Set<Effect>} dirty_effects
470
+ * @param {Set<Effect>} maybe_dirty_effects
471
+ */
472
+ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
473
+ if ((effect.f & 2048) !== 0) dirty_effects.add(effect);
474
+ else if ((effect.f & 4096) !== 0) maybe_dirty_effects.add(effect);
475
+ clear_marked(effect.deps);
476
+ set_signal_status(effect, CLEAN);
477
+ }
478
+ //#endregion
479
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/store.js
480
+ /**
481
+ * We set this to `true` when updating a store so that we correctly
482
+ * schedule effects if the update takes place inside a `$:` effect
483
+ */
484
+ var legacy_is_updating_store = false;
485
+ /**
486
+ * Whether or not the prop currently being read is a store binding, as in
487
+ * `<Child bind:x={$y} />`. If it is, we treat the prop as mutable even in
488
+ * runes mode, and skip `binding_property_non_reactive` validation
489
+ */
490
+ var is_store_binding = false;
491
+ /**
492
+ * Returns a tuple that indicates whether `fn()` reads a prop that is a store binding.
493
+ * Used to prevent `binding_property_non_reactive` validation false positives and
494
+ * ensure that these props are treated as mutable even in runes mode
495
+ * @template T
496
+ * @param {() => T} fn
497
+ * @returns {[T, boolean]}
498
+ */
499
+ function capture_store_binding(fn) {
500
+ var previous_is_store_binding = is_store_binding;
501
+ try {
502
+ is_store_binding = false;
503
+ return [fn(), is_store_binding];
504
+ } finally {
505
+ is_store_binding = previous_is_store_binding;
506
+ }
507
+ }
508
+ //#endregion
509
+ //#region \0@oxc-project+runtime@0.120.0/helpers/checkPrivateRedeclaration.js
510
+ function _checkPrivateRedeclaration(e, t) {
511
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
512
+ }
513
+ //#endregion
514
+ //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateMethodInitSpec.js
515
+ function _classPrivateMethodInitSpec(e, a) {
516
+ _checkPrivateRedeclaration(e, a), a.add(e);
517
+ }
518
+ //#endregion
519
+ //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateFieldInitSpec.js
520
+ function _classPrivateFieldInitSpec(e, t, a) {
521
+ _checkPrivateRedeclaration(e, t), t.set(e, a);
522
+ }
523
+ //#endregion
524
+ //#region \0@oxc-project+runtime@0.120.0/helpers/assertClassBrand.js
525
+ function _assertClassBrand(e, t, n) {
526
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
527
+ throw new TypeError("Private element is not present on this object");
528
+ }
529
+ //#endregion
530
+ //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateFieldGet2.js
531
+ function _classPrivateFieldGet2(s, a) {
532
+ return s.get(_assertClassBrand(s, a));
533
+ }
534
+ //#endregion
535
+ //#region \0@oxc-project+runtime@0.120.0/helpers/classPrivateFieldSet2.js
536
+ function _classPrivateFieldSet2(s, a, r) {
537
+ return s.set(_assertClassBrand(s, a), r), r;
538
+ }
539
+ //#endregion
540
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/batch.js
541
+ /** @import { Fork } from 'svelte' */
542
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
543
+ var _Batch;
544
+ /** @type {Set<Batch>} */
545
+ var batches = /* @__PURE__ */ new Set();
546
+ /** @type {Batch | null} */
547
+ var current_batch = null;
548
+ /**
549
+ * When time travelling (i.e. working in one batch, while other batches
550
+ * still have ongoing work), we ignore the real values of affected
551
+ * signals in favour of their values within the batch
552
+ * @type {Map<Value, any> | null}
553
+ */
554
+ var batch_values = null;
555
+ /** @type {Effect | null} */
556
+ var last_scheduled_effect = null;
557
+ var is_flushing_sync = false;
558
+ var is_processing = false;
559
+ /**
560
+ * During traversal, this is an array. Newly created effects are (if not immediately
561
+ * executed) pushed to this array, rather than going through the scheduling
562
+ * rigamarole that would cause another turn of the flush loop.
563
+ * @type {Effect[] | null}
564
+ */
565
+ var collected_effects = null;
566
+ /**
567
+ * An array of effects that are marked during traversal as a result of a `set`
568
+ * (not `internal_set`) call. These will be added to the next batch and
569
+ * trigger another `batch.process()`
570
+ * @type {Effect[] | null}
571
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
572
+ */
573
+ var legacy_updates = null;
574
+ var flush_count = 0;
575
+ var uid = 1;
576
+ var _commit_callbacks = /* @__PURE__ */ new WeakMap();
577
+ var _discard_callbacks = /* @__PURE__ */ new WeakMap();
578
+ var _pending = /* @__PURE__ */ new WeakMap();
579
+ var _blocking_pending = /* @__PURE__ */ new WeakMap();
580
+ var _deferred = /* @__PURE__ */ new WeakMap();
581
+ var _roots = /* @__PURE__ */ new WeakMap();
582
+ var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
583
+ var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
584
+ var _skipped_branches = /* @__PURE__ */ new WeakMap();
585
+ var _decrement_queued = /* @__PURE__ */ new WeakMap();
586
+ var _Batch_brand = /* @__PURE__ */ new WeakSet();
587
+ var Batch = class Batch {
588
+ constructor() {
589
+ _classPrivateMethodInitSpec(this, _Batch_brand);
590
+ _defineProperty(this, "id", uid++);
591
+ _defineProperty(
592
+ this,
593
+ /**
594
+ * The current values of any sources that are updated in this batch
595
+ * They keys of this map are identical to `this.#previous`
596
+ * @type {Map<Source, any>}
597
+ */
598
+ "current",
599
+ /* @__PURE__ */ new Map()
600
+ );
601
+ _defineProperty(
602
+ this,
603
+ /**
604
+ * The values of any sources that are updated in this batch _before_ those updates took place.
605
+ * They keys of this map are identical to `this.#current`
606
+ * @type {Map<Source, any>}
607
+ */
608
+ "previous",
609
+ /* @__PURE__ */ new Map()
610
+ );
611
+ _classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
612
+ _classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
613
+ _classPrivateFieldInitSpec(this, _pending, 0);
614
+ _classPrivateFieldInitSpec(this, _blocking_pending, 0);
615
+ _classPrivateFieldInitSpec(this, _deferred, null);
616
+ _classPrivateFieldInitSpec(this, _roots, []);
617
+ _classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
618
+ _classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
619
+ _classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
620
+ _defineProperty(this, "is_fork", false);
621
+ _classPrivateFieldInitSpec(this, _decrement_queued, false);
622
+ }
623
+ /**
624
+ * Add an effect to the #skipped_branches map and reset its children
625
+ * @param {Effect} effect
626
+ */
627
+ skip_effect(effect) {
628
+ if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
629
+ d: [],
630
+ m: []
631
+ });
632
+ }
633
+ /**
634
+ * Remove an effect from the #skipped_branches map and reschedule
635
+ * any tracked dirty/maybe_dirty child effects
636
+ * @param {Effect} effect
637
+ */
638
+ unskip_effect(effect) {
639
+ var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
640
+ if (tracked) {
641
+ _classPrivateFieldGet2(_skipped_branches, this).delete(effect);
642
+ for (var e of tracked.d) {
643
+ set_signal_status(e, DIRTY);
644
+ this.schedule(e);
645
+ }
646
+ for (e of tracked.m) {
647
+ set_signal_status(e, MAYBE_DIRTY);
648
+ this.schedule(e);
649
+ }
650
+ }
651
+ }
652
+ /**
653
+ * Associate a change to a given source with the current
654
+ * batch, noting its previous and current values
655
+ * @param {Source} source
656
+ * @param {any} old_value
657
+ */
658
+ capture(source, old_value) {
659
+ if (old_value !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, old_value);
660
+ if ((source.f & 8388608) === 0) {
661
+ this.current.set(source, source.v);
662
+ batch_values?.set(source, source.v);
663
+ }
664
+ }
665
+ activate() {
666
+ current_batch = this;
667
+ }
668
+ deactivate() {
669
+ current_batch = null;
670
+ batch_values = null;
671
+ }
672
+ flush() {
673
+ try {
674
+ is_processing = true;
675
+ current_batch = this;
676
+ _assertClassBrand(_Batch_brand, this, _process).call(this);
677
+ } finally {
678
+ flush_count = 0;
679
+ last_scheduled_effect = null;
680
+ collected_effects = null;
681
+ legacy_updates = null;
682
+ is_processing = false;
683
+ current_batch = null;
684
+ batch_values = null;
685
+ old_values.clear();
686
+ }
687
+ }
688
+ discard() {
689
+ for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
690
+ _classPrivateFieldGet2(_discard_callbacks, this).clear();
691
+ batches.delete(this);
692
+ }
693
+ /**
694
+ *
695
+ * @param {boolean} blocking
696
+ */
697
+ increment(blocking) {
698
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) + 1);
699
+ if (blocking) _classPrivateFieldSet2(_blocking_pending, this, _classPrivateFieldGet2(_blocking_pending, this) + 1);
700
+ }
701
+ /**
702
+ * @param {boolean} blocking
703
+ * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
704
+ */
705
+ decrement(blocking, skip) {
706
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) - 1);
707
+ if (blocking) _classPrivateFieldSet2(_blocking_pending, this, _classPrivateFieldGet2(_blocking_pending, this) - 1);
708
+ if (_classPrivateFieldGet2(_decrement_queued, this) || skip) return;
709
+ _classPrivateFieldSet2(_decrement_queued, this, true);
710
+ queue_micro_task(() => {
711
+ _classPrivateFieldSet2(_decrement_queued, this, false);
712
+ this.flush();
713
+ });
714
+ }
715
+ /**
716
+ * @param {Set<Effect>} dirty_effects
717
+ * @param {Set<Effect>} maybe_dirty_effects
718
+ */
719
+ transfer_effects(dirty_effects, maybe_dirty_effects) {
720
+ for (const e of dirty_effects) _classPrivateFieldGet2(_dirty_effects$1, this).add(e);
721
+ for (const e of maybe_dirty_effects) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(e);
722
+ dirty_effects.clear();
723
+ maybe_dirty_effects.clear();
724
+ }
725
+ /** @param {(batch: Batch) => void} fn */
726
+ oncommit(fn) {
727
+ _classPrivateFieldGet2(_commit_callbacks, this).add(fn);
728
+ }
729
+ /** @param {(batch: Batch) => void} fn */
730
+ ondiscard(fn) {
731
+ _classPrivateFieldGet2(_discard_callbacks, this).add(fn);
732
+ }
733
+ settled() {
734
+ return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
735
+ }
736
+ static ensure() {
737
+ if (current_batch === null) {
738
+ const batch = current_batch = new Batch();
739
+ if (!is_processing) {
740
+ batches.add(current_batch);
741
+ if (!is_flushing_sync) queue_micro_task(() => {
742
+ if (current_batch !== batch) return;
743
+ batch.flush();
744
+ });
745
+ }
746
+ }
747
+ return current_batch;
748
+ }
749
+ apply() {
750
+ if (!async_mode_flag || !this.is_fork && batches.size === 1) {
751
+ batch_values = null;
752
+ return;
753
+ }
754
+ batch_values = new Map(this.current);
755
+ for (const batch of batches) {
756
+ if (batch === this || batch.is_fork) continue;
757
+ for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
758
+ }
759
+ }
760
+ /**
761
+ *
762
+ * @param {Effect} effect
763
+ */
764
+ schedule(effect) {
765
+ last_scheduled_effect = effect;
766
+ if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
767
+ effect.b.defer_effect(effect);
768
+ return;
769
+ }
770
+ var e = effect;
771
+ while (e.parent !== null) {
772
+ e = e.parent;
773
+ var flags = e.f;
774
+ if (collected_effects !== null && e === active_effect) {
775
+ if (async_mode_flag) return;
776
+ if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
777
+ }
778
+ if ((flags & 96) !== 0) {
779
+ if ((flags & 1024) === 0) return;
780
+ e.f ^= CLEAN;
781
+ }
782
+ }
783
+ _classPrivateFieldGet2(_roots, this).push(e);
784
+ }
785
+ };
786
+ _Batch = Batch;
787
+ function _is_deferred() {
788
+ return this.is_fork || _classPrivateFieldGet2(_blocking_pending, this) > 0;
789
+ }
790
+ function _process() {
791
+ if (flush_count++ > 1e3) {
792
+ batches.delete(this);
793
+ infinite_loop_guard();
794
+ }
795
+ if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
796
+ for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
797
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
798
+ set_signal_status(e, DIRTY);
799
+ this.schedule(e);
800
+ }
801
+ for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
802
+ set_signal_status(e, MAYBE_DIRTY);
803
+ this.schedule(e);
804
+ }
805
+ }
806
+ const roots = _classPrivateFieldGet2(_roots, this);
807
+ _classPrivateFieldSet2(_roots, this, []);
808
+ this.apply();
809
+ /** @type {Effect[]} */
810
+ var effects = collected_effects = [];
811
+ /** @type {Effect[]} */
812
+ var render_effects = [];
813
+ /**
814
+ * @type {Effect[]}
815
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
816
+ */
817
+ var updates = legacy_updates = [];
818
+ for (const root of roots) try {
819
+ _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
820
+ } catch (e) {
821
+ reset_all(root);
822
+ throw e;
823
+ }
824
+ current_batch = null;
825
+ if (updates.length > 0) {
826
+ var batch = _Batch.ensure();
827
+ for (const e of updates) batch.schedule(e);
828
+ }
829
+ collected_effects = null;
830
+ legacy_updates = null;
831
+ if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
832
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
833
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
834
+ for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
835
+ } else {
836
+ if (_classPrivateFieldGet2(_pending, this) === 0) batches.delete(this);
837
+ _classPrivateFieldGet2(_dirty_effects$1, this).clear();
838
+ _classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
839
+ for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
840
+ _classPrivateFieldGet2(_commit_callbacks, this).clear();
841
+ flush_queued_effects(render_effects);
842
+ flush_queued_effects(effects);
843
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
844
+ }
845
+ var next_batch = current_batch;
846
+ if (_classPrivateFieldGet2(_roots, this).length > 0) {
847
+ const batch = next_batch ?? (next_batch = this);
848
+ _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
849
+ }
850
+ if (next_batch !== null) {
851
+ batches.add(next_batch);
852
+ _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
853
+ }
854
+ if (!batches.has(this)) _assertClassBrand(_Batch_brand, this, _commit$1).call(this);
855
+ }
856
+ /**
857
+ * Traverse the effect tree, executing effects or stashing
858
+ * them for later execution as appropriate
859
+ * @param {Effect} root
860
+ * @param {Effect[]} effects
861
+ * @param {Effect[]} render_effects
862
+ */
863
+ function _traverse(root, effects, render_effects) {
864
+ root.f ^= CLEAN;
865
+ var effect = root.first;
866
+ while (effect !== null) {
867
+ var flags = effect.f;
868
+ var is_branch = (flags & 96) !== 0;
869
+ if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || _classPrivateFieldGet2(_skipped_branches, this).has(effect)) && effect.fn !== null) {
870
+ if (is_branch) effect.f ^= CLEAN;
871
+ else if ((flags & 4) !== 0) effects.push(effect);
872
+ else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
873
+ else if (is_dirty(effect)) {
874
+ if ((flags & 16) !== 0) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(effect);
875
+ update_effect(effect);
876
+ }
877
+ var child = effect.first;
878
+ if (child !== null) {
879
+ effect = child;
880
+ continue;
881
+ }
882
+ }
883
+ while (effect !== null) {
884
+ var next = effect.next;
885
+ if (next !== null) {
886
+ effect = next;
887
+ break;
888
+ }
889
+ effect = effect.parent;
890
+ }
891
+ }
892
+ }
893
+ /**
894
+ * @param {Effect[]} effects
895
+ */
896
+ function _defer_effects(effects) {
897
+ for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
898
+ }
899
+ function _commit$1() {
900
+ for (const batch of batches) {
901
+ var is_earlier = batch.id < this.id;
902
+ /** @type {Source[]} */
903
+ var sources = [];
904
+ for (const [source, value] of this.current) {
905
+ if (batch.current.has(source)) if (is_earlier && value !== batch.current.get(source)) batch.current.set(source, value);
906
+ else continue;
907
+ sources.push(source);
908
+ }
909
+ var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
910
+ if (others.length === 0) {
911
+ if (is_earlier) batch.discard();
912
+ } else if (sources.length > 0) {
913
+ batch.activate();
914
+ /** @type {Set<Value>} */
915
+ var marked = /* @__PURE__ */ new Set();
916
+ /** @type {Map<Reaction, boolean>} */
917
+ var checked = /* @__PURE__ */ new Map();
918
+ for (var source of sources) mark_effects(source, others, marked, checked);
919
+ if (_classPrivateFieldGet2(_roots, batch).length > 0) {
920
+ batch.apply();
921
+ for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
922
+ _classPrivateFieldSet2(_roots, batch, []);
923
+ }
924
+ batch.deactivate();
925
+ }
926
+ }
927
+ }
928
+ /**
929
+ * Synchronously flush any pending updates.
930
+ * Returns void if no callback is provided, otherwise returns the result of calling the callback.
931
+ * @template [T=void]
932
+ * @param {(() => T) | undefined} [fn]
933
+ * @returns {T}
934
+ */
935
+ function flushSync(fn) {
936
+ var was_flushing_sync = is_flushing_sync;
937
+ is_flushing_sync = true;
938
+ try {
939
+ var result;
940
+ if (fn) {
941
+ if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
942
+ result = fn();
943
+ }
944
+ while (true) {
945
+ flush_tasks();
946
+ if (current_batch === null) return result;
947
+ current_batch.flush();
948
+ }
949
+ } finally {
950
+ is_flushing_sync = was_flushing_sync;
951
+ }
952
+ }
953
+ function infinite_loop_guard() {
954
+ try {
955
+ effect_update_depth_exceeded();
956
+ } catch (error) {
957
+ invoke_error_boundary(error, last_scheduled_effect);
958
+ }
959
+ }
960
+ /** @type {Set<Effect> | null} */
961
+ var eager_block_effects = null;
962
+ /**
963
+ * @param {Array<Effect>} effects
964
+ * @returns {void}
965
+ */
966
+ function flush_queued_effects(effects) {
967
+ var length = effects.length;
968
+ if (length === 0) return;
969
+ var i = 0;
970
+ while (i < length) {
971
+ var effect = effects[i++];
972
+ if ((effect.f & 24576) === 0 && is_dirty(effect)) {
973
+ eager_block_effects = /* @__PURE__ */ new Set();
974
+ update_effect(effect);
975
+ if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
976
+ if (eager_block_effects?.size > 0) {
977
+ old_values.clear();
978
+ for (const e of eager_block_effects) {
979
+ if ((e.f & 24576) !== 0) continue;
980
+ /** @type {Effect[]} */
981
+ const ordered_effects = [e];
982
+ let ancestor = e.parent;
983
+ while (ancestor !== null) {
984
+ if (eager_block_effects.has(ancestor)) {
985
+ eager_block_effects.delete(ancestor);
986
+ ordered_effects.push(ancestor);
987
+ }
988
+ ancestor = ancestor.parent;
989
+ }
990
+ for (let j = ordered_effects.length - 1; j >= 0; j--) {
991
+ const e = ordered_effects[j];
992
+ if ((e.f & 24576) !== 0) continue;
993
+ update_effect(e);
994
+ }
995
+ }
996
+ eager_block_effects.clear();
997
+ }
998
+ }
999
+ }
1000
+ eager_block_effects = null;
1001
+ }
1002
+ /**
1003
+ * This is similar to `mark_reactions`, but it only marks async/block effects
1004
+ * depending on `value` and at least one of the other `sources`, so that
1005
+ * these effects can re-run after another batch has been committed
1006
+ * @param {Value} value
1007
+ * @param {Source[]} sources
1008
+ * @param {Set<Value>} marked
1009
+ * @param {Map<Reaction, boolean>} checked
1010
+ */
1011
+ function mark_effects(value, sources, marked, checked) {
1012
+ if (marked.has(value)) return;
1013
+ marked.add(value);
1014
+ if (value.reactions !== null) for (const reaction of value.reactions) {
1015
+ const flags = reaction.f;
1016
+ if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1017
+ else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1018
+ set_signal_status(reaction, DIRTY);
1019
+ schedule_effect(reaction);
1020
+ }
1021
+ }
1022
+ }
1023
+ /**
1024
+ * @param {Reaction} reaction
1025
+ * @param {Source[]} sources
1026
+ * @param {Map<Reaction, boolean>} checked
1027
+ */
1028
+ function depends_on(reaction, sources, checked) {
1029
+ const depends = checked.get(reaction);
1030
+ if (depends !== void 0) return depends;
1031
+ if (reaction.deps !== null) for (const dep of reaction.deps) {
1032
+ if (includes.call(sources, dep)) return true;
1033
+ if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1034
+ checked.set(dep, true);
1035
+ return true;
1036
+ }
1037
+ }
1038
+ checked.set(reaction, false);
1039
+ return false;
1040
+ }
1041
+ /**
1042
+ * @param {Effect} effect
1043
+ * @returns {void}
1044
+ */
1045
+ function schedule_effect(effect) {
1046
+ /** @type {Batch} */ current_batch.schedule(effect);
1047
+ }
1048
+ /**
1049
+ * Mark all the effects inside a skipped branch CLEAN, so that
1050
+ * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
1051
+ * effects so they can be rescheduled if the branch survives.
1052
+ * @param {Effect} effect
1053
+ * @param {{ d: Effect[], m: Effect[] }} tracked
1054
+ */
1055
+ function reset_branch(effect, tracked) {
1056
+ if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
1057
+ if ((effect.f & 2048) !== 0) tracked.d.push(effect);
1058
+ else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
1059
+ set_signal_status(effect, CLEAN);
1060
+ var e = effect.first;
1061
+ while (e !== null) {
1062
+ reset_branch(e, tracked);
1063
+ e = e.next;
1064
+ }
1065
+ }
1066
+ /**
1067
+ * Mark an entire effect tree clean following an error
1068
+ * @param {Effect} effect
1069
+ */
1070
+ function reset_all(effect) {
1071
+ set_signal_status(effect, CLEAN);
1072
+ var e = effect.first;
1073
+ while (e !== null) {
1074
+ reset_all(e);
1075
+ e = e.next;
1076
+ }
1077
+ }
1078
+ //#endregion
1079
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/reactivity/create-subscriber.js
1080
+ /**
1081
+ * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
1082
+ * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
1083
+ *
1084
+ * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
1085
+ * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
1086
+ *
1087
+ * If `start` returns a cleanup function, it will be called when the effect is destroyed.
1088
+ *
1089
+ * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
1090
+ * are active, and the returned teardown function will only be called when all effects are destroyed.
1091
+ *
1092
+ * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
1093
+ *
1094
+ * ```js
1095
+ * import { createSubscriber } from 'svelte/reactivity';
1096
+ * import { on } from 'svelte/events';
1097
+ *
1098
+ * export class MediaQuery {
1099
+ * #query;
1100
+ * #subscribe;
1101
+ *
1102
+ * constructor(query) {
1103
+ * this.#query = window.matchMedia(`(${query})`);
1104
+ *
1105
+ * this.#subscribe = createSubscriber((update) => {
1106
+ * // when the `change` event occurs, re-run any effects that read `this.current`
1107
+ * const off = on(this.#query, 'change', update);
1108
+ *
1109
+ * // stop listening when all the effects are destroyed
1110
+ * return () => off();
1111
+ * });
1112
+ * }
1113
+ *
1114
+ * get current() {
1115
+ * // This makes the getter reactive, if read in an effect
1116
+ * this.#subscribe();
1117
+ *
1118
+ * // Return the current state of the query, whether or not we're in an effect
1119
+ * return this.#query.matches;
1120
+ * }
1121
+ * }
1122
+ * ```
1123
+ * @param {(update: () => void) => (() => void) | void} start
1124
+ * @since 5.7.0
1125
+ */
1126
+ function createSubscriber(start) {
1127
+ let subscribers = 0;
1128
+ let version = source(0);
1129
+ /** @type {(() => void) | void} */
1130
+ let stop;
1131
+ return () => {
1132
+ if (effect_tracking()) {
1133
+ get(version);
1134
+ render_effect(() => {
1135
+ if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
1136
+ subscribers += 1;
1137
+ return () => {
1138
+ queue_micro_task(() => {
1139
+ subscribers -= 1;
1140
+ if (subscribers === 0) {
1141
+ stop?.();
1142
+ stop = void 0;
1143
+ increment(version);
1144
+ }
1145
+ });
1146
+ };
1147
+ });
1148
+ }
1149
+ };
1150
+ }
1151
+ //#endregion
1152
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1153
+ /** @import { Effect, Source, TemplateNode, } from '#client' */
1154
+ /**
1155
+ * @typedef {{
1156
+ * onerror?: (error: unknown, reset: () => void) => void;
1157
+ * failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;
1158
+ * pending?: (anchor: Node) => void;
1159
+ * }} BoundaryProps
1160
+ */
1161
+ var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
1162
+ /**
1163
+ * @param {TemplateNode} node
1164
+ * @param {BoundaryProps} props
1165
+ * @param {((anchor: Node) => void)} children
1166
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
1167
+ * @returns {void}
1168
+ */
1169
+ function boundary(node, props, children, transform_error) {
1170
+ new Boundary(node, props, children, transform_error);
1171
+ }
1172
+ var _anchor = /* @__PURE__ */ new WeakMap();
1173
+ var _hydrate_open = /* @__PURE__ */ new WeakMap();
1174
+ var _props = /* @__PURE__ */ new WeakMap();
1175
+ var _children = /* @__PURE__ */ new WeakMap();
1176
+ var _effect = /* @__PURE__ */ new WeakMap();
1177
+ var _main_effect = /* @__PURE__ */ new WeakMap();
1178
+ var _pending_effect = /* @__PURE__ */ new WeakMap();
1179
+ var _failed_effect = /* @__PURE__ */ new WeakMap();
1180
+ var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
1181
+ var _local_pending_count = /* @__PURE__ */ new WeakMap();
1182
+ var _pending_count = /* @__PURE__ */ new WeakMap();
1183
+ var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
1184
+ var _dirty_effects = /* @__PURE__ */ new WeakMap();
1185
+ var _maybe_dirty_effects = /* @__PURE__ */ new WeakMap();
1186
+ var _effect_pending = /* @__PURE__ */ new WeakMap();
1187
+ var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
1188
+ var _Boundary_brand = /* @__PURE__ */ new WeakSet();
1189
+ var Boundary = class {
1190
+ /**
1191
+ * @param {TemplateNode} node
1192
+ * @param {BoundaryProps} props
1193
+ * @param {((anchor: Node) => void)} children
1194
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
1195
+ */
1196
+ constructor(node, props, children, transform_error) {
1197
+ _classPrivateMethodInitSpec(this, _Boundary_brand);
1198
+ _defineProperty(
1199
+ this,
1200
+ /** @type {Boundary | null} */
1201
+ "parent",
1202
+ void 0
1203
+ );
1204
+ _defineProperty(this, "is_pending", false);
1205
+ _defineProperty(
1206
+ this,
1207
+ /**
1208
+ * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
1209
+ * Inherited from parent boundary, or defaults to identity.
1210
+ * @type {(error: unknown) => unknown}
1211
+ */
1212
+ "transform_error",
1213
+ void 0
1214
+ );
1215
+ _classPrivateFieldInitSpec(this, _anchor, void 0);
1216
+ _classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
1217
+ _classPrivateFieldInitSpec(this, _props, void 0);
1218
+ _classPrivateFieldInitSpec(this, _children, void 0);
1219
+ _classPrivateFieldInitSpec(this, _effect, void 0);
1220
+ _classPrivateFieldInitSpec(this, _main_effect, null);
1221
+ _classPrivateFieldInitSpec(this, _pending_effect, null);
1222
+ _classPrivateFieldInitSpec(this, _failed_effect, null);
1223
+ _classPrivateFieldInitSpec(this, _offscreen_fragment, null);
1224
+ _classPrivateFieldInitSpec(this, _local_pending_count, 0);
1225
+ _classPrivateFieldInitSpec(this, _pending_count, 0);
1226
+ _classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
1227
+ _classPrivateFieldInitSpec(this, _dirty_effects, /* @__PURE__ */ new Set());
1228
+ _classPrivateFieldInitSpec(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
1229
+ _classPrivateFieldInitSpec(this, _effect_pending, null);
1230
+ _classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
1231
+ _classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
1232
+ return () => {
1233
+ _classPrivateFieldSet2(_effect_pending, this, null);
1234
+ };
1235
+ }));
1236
+ _classPrivateFieldSet2(_anchor, this, node);
1237
+ _classPrivateFieldSet2(_props, this, props);
1238
+ _classPrivateFieldSet2(_children, this, (anchor) => {
1239
+ var effect = active_effect;
1240
+ effect.b = this;
1241
+ effect.f |= 128;
1242
+ children(anchor);
1243
+ });
1244
+ this.parent = active_effect.b;
1245
+ this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
1246
+ _classPrivateFieldSet2(_effect, this, block(() => {
1247
+ if (hydrating) {
1248
+ const comment = _classPrivateFieldGet2(_hydrate_open, this);
1249
+ hydrate_next();
1250
+ const server_rendered_pending = comment.data === "[!";
1251
+ if (comment.data.startsWith("[?")) {
1252
+ const serialized_error = JSON.parse(comment.data.slice(2));
1253
+ _assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
1254
+ } else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
1255
+ else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
1256
+ } else _assertClassBrand(_Boundary_brand, this, _render).call(this);
1257
+ }, flags));
1258
+ if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
1259
+ }
1260
+ /**
1261
+ * Defer an effect inside a pending boundary until the boundary resolves
1262
+ * @param {Effect} effect
1263
+ */
1264
+ defer_effect(effect) {
1265
+ defer_effect(effect, _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1266
+ }
1267
+ /**
1268
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
1269
+ * @returns {boolean}
1270
+ */
1271
+ is_rendered() {
1272
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
1273
+ }
1274
+ has_pending_snippet() {
1275
+ return !!_classPrivateFieldGet2(_props, this).pending;
1276
+ }
1277
+ /**
1278
+ * Update the source that powers `$effect.pending()` inside this boundary,
1279
+ * and controls when the current `pending` snippet (if any) is removed.
1280
+ * Do not call from inside the class
1281
+ * @param {1 | -1} d
1282
+ * @param {Batch} batch
1283
+ */
1284
+ update_pending_count(d, batch) {
1285
+ _assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
1286
+ _classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
1287
+ if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
1288
+ _classPrivateFieldSet2(_pending_count_update_queued, this, true);
1289
+ queue_micro_task(() => {
1290
+ _classPrivateFieldSet2(_pending_count_update_queued, this, false);
1291
+ if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
1292
+ });
1293
+ }
1294
+ get_effect_pending() {
1295
+ _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
1296
+ return get(_classPrivateFieldGet2(_effect_pending, this));
1297
+ }
1298
+ /** @param {unknown} error */
1299
+ error(error) {
1300
+ var onerror = _classPrivateFieldGet2(_props, this).onerror;
1301
+ let failed = _classPrivateFieldGet2(_props, this).failed;
1302
+ if (!onerror && !failed) throw error;
1303
+ if (_classPrivateFieldGet2(_main_effect, this)) {
1304
+ destroy_effect(_classPrivateFieldGet2(_main_effect, this));
1305
+ _classPrivateFieldSet2(_main_effect, this, null);
1306
+ }
1307
+ if (_classPrivateFieldGet2(_pending_effect, this)) {
1308
+ destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
1309
+ _classPrivateFieldSet2(_pending_effect, this, null);
1310
+ }
1311
+ if (_classPrivateFieldGet2(_failed_effect, this)) {
1312
+ destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
1313
+ _classPrivateFieldSet2(_failed_effect, this, null);
1314
+ }
1315
+ if (hydrating) {
1316
+ set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
1317
+ next();
1318
+ set_hydrate_node(skip_nodes());
1319
+ }
1320
+ var did_reset = false;
1321
+ var calling_on_error = false;
1322
+ const reset = () => {
1323
+ if (did_reset) {
1324
+ svelte_boundary_reset_noop();
1325
+ return;
1326
+ }
1327
+ did_reset = true;
1328
+ if (calling_on_error) svelte_boundary_reset_onerror();
1329
+ if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
1330
+ _classPrivateFieldSet2(_failed_effect, this, null);
1331
+ });
1332
+ _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1333
+ _assertClassBrand(_Boundary_brand, this, _render).call(this);
1334
+ });
1335
+ };
1336
+ /** @param {unknown} transformed_error */
1337
+ const handle_error_result = (transformed_error) => {
1338
+ try {
1339
+ calling_on_error = true;
1340
+ onerror?.(transformed_error, reset);
1341
+ calling_on_error = false;
1342
+ } catch (error) {
1343
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1344
+ }
1345
+ if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1346
+ try {
1347
+ return branch(() => {
1348
+ var effect = active_effect;
1349
+ effect.b = this;
1350
+ effect.f |= 128;
1351
+ failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
1352
+ });
1353
+ } catch (error) {
1354
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
1355
+ return null;
1356
+ }
1357
+ }));
1358
+ };
1359
+ queue_micro_task(() => {
1360
+ /** @type {unknown} */
1361
+ var result;
1362
+ try {
1363
+ result = this.transform_error(error);
1364
+ } catch (e) {
1365
+ invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1366
+ return;
1367
+ }
1368
+ if (result !== null && typeof result === "object" && typeof result.then === "function")
1369
+ /** @type {any} */ result.then(
1370
+ handle_error_result,
1371
+ /** @param {unknown} e */
1372
+ (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
1373
+ );
1374
+ else handle_error_result(result);
1375
+ });
1376
+ }
1377
+ };
1378
+ function _hydrate_resolved_content() {
1379
+ try {
1380
+ _classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
1381
+ } catch (error) {
1382
+ this.error(error);
1383
+ }
1384
+ }
1385
+ /**
1386
+ * @param {unknown} error The deserialized error from the server's hydration comment
1387
+ */
1388
+ function _hydrate_failed_content(error) {
1389
+ const failed = _classPrivateFieldGet2(_props, this).failed;
1390
+ if (!failed) return;
1391
+ _classPrivateFieldSet2(_failed_effect, this, branch(() => {
1392
+ failed(_classPrivateFieldGet2(_anchor, this), () => error, () => () => {});
1393
+ }));
1394
+ }
1395
+ function _hydrate_pending_content() {
1396
+ const pending = _classPrivateFieldGet2(_props, this).pending;
1397
+ if (!pending) return;
1398
+ this.is_pending = true;
1399
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1400
+ queue_micro_task(() => {
1401
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1402
+ var anchor = create_text();
1403
+ fragment.append(anchor);
1404
+ _classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1405
+ return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
1406
+ }));
1407
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1408
+ _classPrivateFieldGet2(_anchor, this).before(fragment);
1409
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
1410
+ pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1411
+ _classPrivateFieldSet2(_pending_effect, this, null);
1412
+ });
1413
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1414
+ }
1415
+ });
1416
+ }
1417
+ function _render() {
1418
+ try {
1419
+ this.is_pending = this.has_pending_snippet();
1420
+ _classPrivateFieldSet2(_pending_count, this, 0);
1421
+ _classPrivateFieldSet2(_local_pending_count, this, 0);
1422
+ _classPrivateFieldSet2(_main_effect, this, branch(() => {
1423
+ _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
1424
+ }));
1425
+ if (_classPrivateFieldGet2(_pending_count, this) > 0) {
1426
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1427
+ move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
1428
+ const pending = _classPrivateFieldGet2(_props, this).pending;
1429
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1430
+ } else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1431
+ } catch (error) {
1432
+ this.error(error);
1433
+ }
1434
+ }
1435
+ /**
1436
+ * @param {Batch} batch
1437
+ */
1438
+ function _resolve(batch) {
1439
+ this.is_pending = false;
1440
+ batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1441
+ }
1442
+ /**
1443
+ * @template T
1444
+ * @param {() => T} fn
1445
+ */
1446
+ function _run(fn) {
1447
+ var previous_effect = active_effect;
1448
+ var previous_reaction = active_reaction;
1449
+ var previous_ctx = component_context;
1450
+ set_active_effect(_classPrivateFieldGet2(_effect, this));
1451
+ set_active_reaction(_classPrivateFieldGet2(_effect, this));
1452
+ set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
1453
+ try {
1454
+ Batch.ensure();
1455
+ return fn();
1456
+ } catch (e) {
1457
+ handle_error(e);
1458
+ return null;
1459
+ } finally {
1460
+ set_active_effect(previous_effect);
1461
+ set_active_reaction(previous_reaction);
1462
+ set_component_context(previous_ctx);
1463
+ }
1464
+ }
1465
+ /**
1466
+ * Updates the pending count associated with the currently visible pending snippet,
1467
+ * if any, such that we can replace the snippet with content once work is done
1468
+ * @param {1 | -1} d
1469
+ * @param {Batch} batch
1470
+ */
1471
+ function _update_pending_count(d, batch) {
1472
+ if (!this.has_pending_snippet()) {
1473
+ if (this.parent) {
1474
+ var _this$parent;
1475
+ _assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
1476
+ }
1477
+ return;
1478
+ }
1479
+ _classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
1480
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1481
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
1482
+ if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1483
+ _classPrivateFieldSet2(_pending_effect, this, null);
1484
+ });
1485
+ if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
1486
+ _classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
1487
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
1488
+ }
1489
+ }
1490
+ }
1491
+ //#endregion
1492
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/async.js
1493
+ /** @import { Blocker, Effect, Value } from '#client' */
1494
+ /**
1495
+ * @param {Blocker[]} blockers
1496
+ * @param {Array<() => any>} sync
1497
+ * @param {Array<() => Promise<any>>} async
1498
+ * @param {(values: Value[]) => any} fn
1499
+ */
1500
+ function flatten(blockers, sync, async, fn) {
1501
+ const d = is_runes() ? derived : derived_safe_equal;
1502
+ var pending = blockers.filter((b) => !b.settled);
1503
+ if (async.length === 0 && pending.length === 0) {
1504
+ fn(sync.map(d));
1505
+ return;
1506
+ }
1507
+ var parent = active_effect;
1508
+ var restore = capture();
1509
+ var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
1510
+ /** @param {Value[]} values */
1511
+ function finish(values) {
1512
+ restore();
1513
+ try {
1514
+ fn(values);
1515
+ } catch (error) {
1516
+ if ((parent.f & 16384) === 0) invoke_error_boundary(error, parent);
1517
+ }
1518
+ unset_context();
1519
+ }
1520
+ if (async.length === 0) {
1521
+ /** @type {Promise<any>} */ blocker_promise.then(() => finish(sync.map(d)));
1522
+ return;
1523
+ }
1524
+ var decrement_pending = increment_pending();
1525
+ function run() {
1526
+ Promise.all(async.map((expression) => /* @__PURE__ */ async_derived(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary(error, parent)).finally(() => decrement_pending());
1527
+ }
1528
+ if (blocker_promise) blocker_promise.then(() => {
1529
+ restore();
1530
+ run();
1531
+ unset_context();
1532
+ });
1533
+ else run();
1534
+ }
1535
+ /**
1536
+ * Captures the current effect context so that we can restore it after
1537
+ * some asynchronous work has happened (so that e.g. `await a + b`
1538
+ * causes `b` to be registered as a dependency).
1539
+ */
1540
+ function capture() {
1541
+ var previous_effect = active_effect;
1542
+ var previous_reaction = active_reaction;
1543
+ var previous_component_context = component_context;
1544
+ var previous_batch = current_batch;
1545
+ return function restore(activate_batch = true) {
1546
+ set_active_effect(previous_effect);
1547
+ set_active_reaction(previous_reaction);
1548
+ set_component_context(previous_component_context);
1549
+ if (activate_batch && (previous_effect.f & 16384) === 0) {
1550
+ previous_batch?.activate();
1551
+ previous_batch?.apply();
1552
+ }
1553
+ };
1554
+ }
1555
+ function unset_context(deactivate_batch = true) {
1556
+ set_active_effect(null);
1557
+ set_active_reaction(null);
1558
+ set_component_context(null);
1559
+ if (deactivate_batch) current_batch?.deactivate();
1560
+ }
1561
+ /**
1562
+ * @returns {(skip?: boolean) => void}
1563
+ */
1564
+ function increment_pending() {
1565
+ var boundary = active_effect.b;
1566
+ var batch = current_batch;
1567
+ var blocking = boundary.is_rendered();
1568
+ boundary.update_pending_count(1, batch);
1569
+ batch.increment(blocking);
1570
+ return (skip = false) => {
1571
+ boundary.update_pending_count(-1, batch);
1572
+ batch.decrement(blocking, skip);
1573
+ };
1574
+ }
1575
+ /**
1576
+ * @template V
1577
+ * @param {() => V} fn
1578
+ * @returns {Derived<V>}
1579
+ */
1580
+ /* @__NO_SIDE_EFFECTS__ */
1581
+ function derived(fn) {
1582
+ var flags = 2 | DIRTY;
1583
+ var parent_derived = active_reaction !== null && (active_reaction.f & 2) !== 0 ? active_reaction : null;
1584
+ if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
1585
+ return {
1586
+ ctx: component_context,
1587
+ deps: null,
1588
+ effects: null,
1589
+ equals,
1590
+ f: flags,
1591
+ fn,
1592
+ reactions: null,
1593
+ rv: 0,
1594
+ v: UNINITIALIZED,
1595
+ wv: 0,
1596
+ parent: parent_derived ?? active_effect,
1597
+ ac: null
1598
+ };
1599
+ }
1600
+ /**
1601
+ * @template V
1602
+ * @param {() => V | Promise<V>} fn
1603
+ * @param {string} [label]
1604
+ * @param {string} [location] If provided, print a warning if the value is not read immediately after update
1605
+ * @returns {Promise<Source<V>>}
1606
+ */
1607
+ /* @__NO_SIDE_EFFECTS__ */
1608
+ function async_derived(fn, label, location) {
1609
+ let parent = active_effect;
1610
+ if (parent === null) async_derived_orphan();
1611
+ var promise = void 0;
1612
+ var signal = source(UNINITIALIZED);
1613
+ var should_suspend = !active_reaction;
1614
+ /** @type {Map<Batch, ReturnType<typeof deferred<V>>>} */
1615
+ var deferreds = /* @__PURE__ */ new Map();
1616
+ async_effect(() => {
1617
+ var effect = active_effect;
1618
+ /** @type {ReturnType<typeof deferred<V>>} */
1619
+ var d = deferred();
1620
+ promise = d.promise;
1621
+ try {
1622
+ Promise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);
1623
+ } catch (error) {
1624
+ d.reject(error);
1625
+ unset_context();
1626
+ }
1627
+ var batch = current_batch;
1628
+ if (should_suspend) {
1629
+ if ((effect.f & 32768) !== 0) var decrement_pending = increment_pending();
1630
+ if (parent.b.is_rendered()) {
1631
+ deferreds.get(batch)?.reject(STALE_REACTION);
1632
+ deferreds.delete(batch);
1633
+ } else {
1634
+ for (const d of deferreds.values()) d.reject(STALE_REACTION);
1635
+ deferreds.clear();
1636
+ }
1637
+ deferreds.set(batch, d);
1638
+ }
1639
+ /**
1640
+ * @param {any} value
1641
+ * @param {unknown} error
1642
+ */
1643
+ const handler = (value, error = void 0) => {
1644
+ if (decrement_pending) decrement_pending(error === STALE_REACTION);
1645
+ if (error === STALE_REACTION || (effect.f & 16384) !== 0) return;
1646
+ batch.activate();
1647
+ if (error) {
1648
+ signal.f |= ERROR_VALUE;
1649
+ internal_set(signal, error);
1650
+ } else {
1651
+ if ((signal.f & 8388608) !== 0) signal.f ^= ERROR_VALUE;
1652
+ internal_set(signal, value);
1653
+ for (const [b, d] of deferreds) {
1654
+ deferreds.delete(b);
1655
+ if (b === batch) break;
1656
+ d.reject(STALE_REACTION);
1657
+ }
1658
+ }
1659
+ batch.deactivate();
1660
+ };
1661
+ d.promise.then(handler, (e) => handler(null, e || "unknown"));
1662
+ });
1663
+ teardown(() => {
1664
+ for (const d of deferreds.values()) d.reject(STALE_REACTION);
1665
+ });
1666
+ return new Promise((fulfil) => {
1667
+ /** @param {Promise<V>} p */
1668
+ function next(p) {
1669
+ function go() {
1670
+ if (p === promise) fulfil(signal);
1671
+ else next(promise);
1672
+ }
1673
+ p.then(go, go);
1674
+ }
1675
+ next(promise);
1676
+ });
1677
+ }
1678
+ /**
1679
+ * @template V
1680
+ * @param {() => V} fn
1681
+ * @returns {Derived<V>}
1682
+ */
1683
+ /* @__NO_SIDE_EFFECTS__ */
1684
+ function derived_safe_equal(fn) {
1685
+ const signal = /* @__PURE__ */ derived(fn);
1686
+ signal.equals = safe_equals;
1687
+ return signal;
1688
+ }
1689
+ /**
1690
+ * @param {Derived} derived
1691
+ * @returns {void}
1692
+ */
1693
+ function destroy_derived_effects(derived) {
1694
+ var effects = derived.effects;
1695
+ if (effects !== null) {
1696
+ derived.effects = null;
1697
+ for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
1698
+ }
1699
+ }
1700
+ /**
1701
+ * @param {Derived} derived
1702
+ * @returns {Effect | null}
1703
+ */
1704
+ function get_derived_parent_effect(derived) {
1705
+ var parent = derived.parent;
1706
+ while (parent !== null) {
1707
+ if ((parent.f & 2) === 0) return (parent.f & 16384) === 0 ? parent : null;
1708
+ parent = parent.parent;
1709
+ }
1710
+ return null;
1711
+ }
1712
+ /**
1713
+ * @template T
1714
+ * @param {Derived} derived
1715
+ * @returns {T}
1716
+ */
1717
+ function execute_derived(derived) {
1718
+ var value;
1719
+ var prev_active_effect = active_effect;
1720
+ set_active_effect(get_derived_parent_effect(derived));
1721
+ try {
1722
+ derived.f &= ~WAS_MARKED;
1723
+ destroy_derived_effects(derived);
1724
+ value = update_reaction(derived);
1725
+ } finally {
1726
+ set_active_effect(prev_active_effect);
1727
+ }
1728
+ return value;
1729
+ }
1730
+ /**
1731
+ * @param {Derived} derived
1732
+ * @returns {void}
1733
+ */
1734
+ function update_derived(derived) {
1735
+ var old_value = derived.v;
1736
+ var value = execute_derived(derived);
1737
+ if (!derived.equals(value)) {
1738
+ derived.wv = increment_write_version();
1739
+ if (!current_batch?.is_fork || derived.deps === null) {
1740
+ derived.v = value;
1741
+ current_batch?.capture(derived, old_value);
1742
+ if (derived.deps === null) {
1743
+ set_signal_status(derived, CLEAN);
1744
+ return;
1745
+ }
1746
+ }
1747
+ }
1748
+ if (is_destroying_effect) return;
1749
+ if (batch_values !== null) {
1750
+ if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
1751
+ } else update_derived_status(derived);
1752
+ }
1753
+ /**
1754
+ * @param {Derived} derived
1755
+ */
1756
+ function freeze_derived_effects(derived) {
1757
+ if (derived.effects === null) return;
1758
+ for (const e of derived.effects) if (e.teardown || e.ac) {
1759
+ e.teardown?.();
1760
+ e.ac?.abort(STALE_REACTION);
1761
+ e.teardown = noop;
1762
+ e.ac = null;
1763
+ remove_reactions(e, 0);
1764
+ destroy_effect_children(e);
1765
+ }
1766
+ }
1767
+ /**
1768
+ * @param {Derived} derived
1769
+ */
1770
+ function unfreeze_derived_effects(derived) {
1771
+ if (derived.effects === null) return;
1772
+ for (const e of derived.effects) if (e.teardown) update_effect(e);
1773
+ }
1774
+ //#endregion
1775
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/sources.js
1776
+ /** @import { Derived, Effect, Source, Value } from '#client' */
1777
+ /** @type {Set<any>} */
1778
+ var eager_effects = /* @__PURE__ */ new Set();
1779
+ /** @type {Map<Source, any>} */
1780
+ var old_values = /* @__PURE__ */ new Map();
1781
+ var eager_effects_deferred = false;
1782
+ /**
1783
+ * @template V
1784
+ * @param {V} v
1785
+ * @param {Error | null} [stack]
1786
+ * @returns {Source<V>}
1787
+ */
1788
+ function source(v, stack) {
1789
+ return {
1790
+ f: 0,
1791
+ v,
1792
+ reactions: null,
1793
+ equals,
1794
+ rv: 0,
1795
+ wv: 0
1796
+ };
1797
+ }
1798
+ /**
1799
+ * @template V
1800
+ * @param {V} v
1801
+ * @param {Error | null} [stack]
1802
+ */
1803
+ /* @__NO_SIDE_EFFECTS__ */
1804
+ function state(v, stack) {
1805
+ const s = source(v, stack);
1806
+ push_reaction_value(s);
1807
+ return s;
1808
+ }
1809
+ /**
1810
+ * @template V
1811
+ * @param {V} initial_value
1812
+ * @param {boolean} [immutable]
1813
+ * @returns {Source<V>}
1814
+ */
1815
+ /* @__NO_SIDE_EFFECTS__ */
1816
+ function mutable_source(initial_value, immutable = false, trackable = true) {
1817
+ const s = source(initial_value);
1818
+ if (!immutable) s.equals = safe_equals;
1819
+ if (legacy_mode_flag && trackable && component_context !== null && component_context.l !== null) {
1820
+ var _component_context$l;
1821
+ ((_component_context$l = component_context.l).s ?? (_component_context$l.s = [])).push(s);
1822
+ }
1823
+ return s;
1824
+ }
1825
+ /**
1826
+ * @template V
1827
+ * @param {Source<V>} source
1828
+ * @param {V} value
1829
+ * @param {boolean} [should_proxy]
1830
+ * @returns {V}
1831
+ */
1832
+ function set(source, value, should_proxy = false) {
1833
+ if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !includes.call(current_sources, source))) state_unsafe_mutation();
1834
+ return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
1835
+ }
1836
+ /**
1837
+ * @template V
1838
+ * @param {Source<V>} source
1839
+ * @param {V} value
1840
+ * @param {Effect[] | null} [updated_during_traversal]
1841
+ * @returns {V}
1842
+ */
1843
+ function internal_set(source, value, updated_during_traversal = null) {
1844
+ if (!source.equals(value)) {
1845
+ var old_value = source.v;
1846
+ if (is_destroying_effect) old_values.set(source, value);
1847
+ else old_values.set(source, old_value);
1848
+ source.v = value;
1849
+ var batch = Batch.ensure();
1850
+ batch.capture(source, old_value);
1851
+ if ((source.f & 2) !== 0) {
1852
+ const derived = source;
1853
+ if ((source.f & 2048) !== 0) execute_derived(derived);
1854
+ if (batch_values === null) update_derived_status(derived);
1855
+ }
1856
+ source.wv = increment_write_version();
1857
+ mark_reactions(source, DIRTY, updated_during_traversal);
1858
+ if (is_runes() && active_effect !== null && (active_effect.f & 1024) !== 0 && (active_effect.f & 96) === 0) if (untracked_writes === null) set_untracked_writes([source]);
1859
+ else untracked_writes.push(source);
1860
+ if (!batch.is_fork && eager_effects.size > 0 && !eager_effects_deferred) flush_eager_effects();
1861
+ }
1862
+ return value;
1863
+ }
1864
+ function flush_eager_effects() {
1865
+ eager_effects_deferred = false;
1866
+ for (const effect of eager_effects) {
1867
+ if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
1868
+ if (is_dirty(effect)) update_effect(effect);
1869
+ }
1870
+ eager_effects.clear();
1871
+ }
1872
+ /**
1873
+ * Silently (without using `get`) increment a source
1874
+ * @param {Source<number>} source
1875
+ */
1876
+ function increment(source) {
1877
+ set(source, source.v + 1);
1878
+ }
1879
+ /**
1880
+ * @param {Value} signal
1881
+ * @param {number} status should be DIRTY or MAYBE_DIRTY
1882
+ * @param {Effect[] | null} updated_during_traversal
1883
+ * @returns {void}
1884
+ */
1885
+ function mark_reactions(signal, status, updated_during_traversal) {
1886
+ var reactions = signal.reactions;
1887
+ if (reactions === null) return;
1888
+ var runes = is_runes();
1889
+ var length = reactions.length;
1890
+ for (var i = 0; i < length; i++) {
1891
+ var reaction = reactions[i];
1892
+ var flags = reaction.f;
1893
+ if (!runes && reaction === active_effect) continue;
1894
+ var not_dirty = (flags & DIRTY) === 0;
1895
+ if (not_dirty) set_signal_status(reaction, status);
1896
+ if ((flags & 2) !== 0) {
1897
+ var derived = reaction;
1898
+ batch_values?.delete(derived);
1899
+ if ((flags & 65536) === 0) {
1900
+ if (flags & 512) reaction.f |= WAS_MARKED;
1901
+ mark_reactions(derived, MAYBE_DIRTY, updated_during_traversal);
1902
+ }
1903
+ } else if (not_dirty) {
1904
+ var effect = reaction;
1905
+ if ((flags & 16) !== 0 && eager_block_effects !== null) eager_block_effects.add(effect);
1906
+ if (updated_during_traversal !== null) updated_during_traversal.push(effect);
1907
+ else schedule_effect(effect);
1908
+ }
1909
+ }
1910
+ }
1911
+ /**
1912
+ * @template T
1913
+ * @param {T} value
1914
+ * @returns {T}
1915
+ */
1916
+ function proxy(value) {
1917
+ if (typeof value !== "object" || value === null || STATE_SYMBOL in value) return value;
1918
+ const prototype = get_prototype_of(value);
1919
+ if (prototype !== object_prototype && prototype !== array_prototype) return value;
1920
+ /** @type {Map<any, Source<any>>} */
1921
+ var sources = /* @__PURE__ */ new Map();
1922
+ var is_proxied_array = is_array(value);
1923
+ var version = /* @__PURE__ */ state(0);
1924
+ var stack = null;
1925
+ var parent_version = update_version;
1926
+ /**
1927
+ * Executes the proxy in the context of the reaction it was originally created in, if any
1928
+ * @template T
1929
+ * @param {() => T} fn
1930
+ */
1931
+ var with_parent = (fn) => {
1932
+ if (update_version === parent_version) return fn();
1933
+ var reaction = active_reaction;
1934
+ var version = update_version;
1935
+ set_active_reaction(null);
1936
+ set_update_version(parent_version);
1937
+ var result = fn();
1938
+ set_active_reaction(reaction);
1939
+ set_update_version(version);
1940
+ return result;
1941
+ };
1942
+ if (is_proxied_array) sources.set("length", /* @__PURE__ */ state(
1943
+ /** @type {any[]} */
1944
+ value.length,
1945
+ stack
1946
+ ));
1947
+ return new Proxy(value, {
1948
+ defineProperty(_, prop, descriptor) {
1949
+ if (!("value" in descriptor) || descriptor.configurable === false || descriptor.enumerable === false || descriptor.writable === false) state_descriptors_fixed();
1950
+ var s = sources.get(prop);
1951
+ if (s === void 0) with_parent(() => {
1952
+ var s = /* @__PURE__ */ state(descriptor.value, stack);
1953
+ sources.set(prop, s);
1954
+ return s;
1955
+ });
1956
+ else set(s, descriptor.value, true);
1957
+ return true;
1958
+ },
1959
+ deleteProperty(target, prop) {
1960
+ var s = sources.get(prop);
1961
+ if (s === void 0) {
1962
+ if (prop in target) {
1963
+ const s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
1964
+ sources.set(prop, s);
1965
+ increment(version);
1966
+ }
1967
+ } else {
1968
+ set(s, UNINITIALIZED);
1969
+ increment(version);
1970
+ }
1971
+ return true;
1972
+ },
1973
+ get(target, prop, receiver) {
1974
+ if (prop === STATE_SYMBOL) return value;
1975
+ var s = sources.get(prop);
1976
+ var exists = prop in target;
1977
+ if (s === void 0 && (!exists || get_descriptor(target, prop)?.writable)) {
1978
+ s = with_parent(() => {
1979
+ return /* @__PURE__ */ state(proxy(exists ? target[prop] : UNINITIALIZED), stack);
1980
+ });
1981
+ sources.set(prop, s);
1982
+ }
1983
+ if (s !== void 0) {
1984
+ var v = get(s);
1985
+ return v === UNINITIALIZED ? void 0 : v;
1986
+ }
1987
+ return Reflect.get(target, prop, receiver);
1988
+ },
1989
+ getOwnPropertyDescriptor(target, prop) {
1990
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
1991
+ if (descriptor && "value" in descriptor) {
1992
+ var s = sources.get(prop);
1993
+ if (s) descriptor.value = get(s);
1994
+ } else if (descriptor === void 0) {
1995
+ var source = sources.get(prop);
1996
+ var value = source?.v;
1997
+ if (source !== void 0 && value !== UNINITIALIZED) return {
1998
+ enumerable: true,
1999
+ configurable: true,
2000
+ value,
2001
+ writable: true
2002
+ };
2003
+ }
2004
+ return descriptor;
2005
+ },
2006
+ has(target, prop) {
2007
+ if (prop === STATE_SYMBOL) return true;
2008
+ var s = sources.get(prop);
2009
+ var has = s !== void 0 && s.v !== UNINITIALIZED || Reflect.has(target, prop);
2010
+ if (s !== void 0 || active_effect !== null && (!has || get_descriptor(target, prop)?.writable)) {
2011
+ if (s === void 0) {
2012
+ s = with_parent(() => {
2013
+ return /* @__PURE__ */ state(has ? proxy(target[prop]) : UNINITIALIZED, stack);
2014
+ });
2015
+ sources.set(prop, s);
2016
+ }
2017
+ if (get(s) === UNINITIALIZED) return false;
2018
+ }
2019
+ return has;
2020
+ },
2021
+ set(target, prop, value, receiver) {
2022
+ var s = sources.get(prop);
2023
+ var has = prop in target;
2024
+ if (is_proxied_array && prop === "length") for (var i = value; i < s.v; i += 1) {
2025
+ var other_s = sources.get(i + "");
2026
+ if (other_s !== void 0) set(other_s, UNINITIALIZED);
2027
+ else if (i in target) {
2028
+ other_s = with_parent(() => /* @__PURE__ */ state(UNINITIALIZED, stack));
2029
+ sources.set(i + "", other_s);
2030
+ }
2031
+ }
2032
+ if (s === void 0) {
2033
+ if (!has || get_descriptor(target, prop)?.writable) {
2034
+ s = with_parent(() => /* @__PURE__ */ state(void 0, stack));
2035
+ set(s, proxy(value));
2036
+ sources.set(prop, s);
2037
+ }
2038
+ } else {
2039
+ has = s.v !== UNINITIALIZED;
2040
+ var p = with_parent(() => proxy(value));
2041
+ set(s, p);
2042
+ }
2043
+ var descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
2044
+ if (descriptor?.set) descriptor.set.call(receiver, value);
2045
+ if (!has) {
2046
+ if (is_proxied_array && typeof prop === "string") {
2047
+ var ls = sources.get("length");
2048
+ var n = Number(prop);
2049
+ if (Number.isInteger(n) && n >= ls.v) set(ls, n + 1);
2050
+ }
2051
+ increment(version);
2052
+ }
2053
+ return true;
2054
+ },
2055
+ ownKeys(target) {
2056
+ get(version);
2057
+ var own_keys = Reflect.ownKeys(target).filter((key) => {
2058
+ var source = sources.get(key);
2059
+ return source === void 0 || source.v !== UNINITIALIZED;
2060
+ });
2061
+ for (var [key, source] of sources) if (source.v !== UNINITIALIZED && !(key in target)) own_keys.push(key);
2062
+ return own_keys;
2063
+ },
2064
+ setPrototypeOf() {
2065
+ state_prototype_fixed();
2066
+ }
2067
+ });
2068
+ }
2069
+ //#endregion
2070
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/operations.js
2071
+ /** @import { Effect, TemplateNode } from '#client' */
2072
+ /** @type {Window} */
2073
+ var $window;
2074
+ /** @type {boolean} */
2075
+ var is_firefox;
2076
+ /** @type {() => Node | null} */
2077
+ var first_child_getter;
2078
+ /** @type {() => Node | null} */
2079
+ var next_sibling_getter;
2080
+ /**
2081
+ * Initialize these lazily to avoid issues when using the runtime in a server context
2082
+ * where these globals are not available while avoiding a separate server entry point
2083
+ */
2084
+ function init_operations() {
2085
+ if ($window !== void 0) return;
2086
+ $window = window;
2087
+ is_firefox = /Firefox/.test(navigator.userAgent);
2088
+ var element_prototype = Element.prototype;
2089
+ var node_prototype = Node.prototype;
2090
+ var text_prototype = Text.prototype;
2091
+ first_child_getter = get_descriptor(node_prototype, "firstChild").get;
2092
+ next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
2093
+ if (is_extensible(element_prototype)) {
2094
+ element_prototype.__click = void 0;
2095
+ element_prototype.__className = void 0;
2096
+ element_prototype.__attributes = null;
2097
+ element_prototype.__style = void 0;
2098
+ element_prototype.__e = void 0;
2099
+ }
2100
+ if (is_extensible(text_prototype)) text_prototype.__t = void 0;
2101
+ }
2102
+ /**
2103
+ * @param {string} value
2104
+ * @returns {Text}
2105
+ */
2106
+ function create_text(value = "") {
2107
+ return document.createTextNode(value);
2108
+ }
2109
+ /**
2110
+ * @template {Node} N
2111
+ * @param {N} node
2112
+ */
2113
+ /* @__NO_SIDE_EFFECTS__ */
2114
+ function get_first_child(node) {
2115
+ return first_child_getter.call(node);
2116
+ }
2117
+ /**
2118
+ * @template {Node} N
2119
+ * @param {N} node
2120
+ */
2121
+ /* @__NO_SIDE_EFFECTS__ */
2122
+ function get_next_sibling(node) {
2123
+ return next_sibling_getter.call(node);
2124
+ }
2125
+ /**
2126
+ * Don't mark this as side-effect-free, hydration needs to walk all nodes
2127
+ * @template {Node} N
2128
+ * @param {N} node
2129
+ * @param {boolean} is_text
2130
+ * @returns {TemplateNode | null}
2131
+ */
2132
+ function child(node, is_text) {
2133
+ if (!hydrating) return /* @__PURE__ */ get_first_child(node);
2134
+ var child = /* @__PURE__ */ get_first_child(hydrate_node);
2135
+ if (child === null) child = hydrate_node.appendChild(create_text());
2136
+ else if (is_text && child.nodeType !== 3) {
2137
+ var text = create_text();
2138
+ child?.before(text);
2139
+ set_hydrate_node(text);
2140
+ return text;
2141
+ }
2142
+ if (is_text) merge_text_nodes(child);
2143
+ set_hydrate_node(child);
2144
+ return child;
2145
+ }
2146
+ /**
2147
+ * @template {Node} N
2148
+ * @param {N} node
2149
+ * @returns {void}
2150
+ */
2151
+ function clear_text_content(node) {
2152
+ node.textContent = "";
2153
+ }
2154
+ /**
2155
+ * Returns `true` if we're updating the current block, for example `condition` in
2156
+ * an `{#if condition}` block just changed. In this case, the branch should be
2157
+ * appended (or removed) at the same time as other updates within the
2158
+ * current `<svelte:boundary>`
2159
+ */
2160
+ function should_defer_append() {
2161
+ if (!async_mode_flag) return false;
2162
+ if (eager_block_effects !== null) return false;
2163
+ return (active_effect.f & REACTION_RAN) !== 0;
2164
+ }
2165
+ /**
2166
+ * @template {keyof HTMLElementTagNameMap | string} T
2167
+ * @param {T} tag
2168
+ * @param {string} [namespace]
2169
+ * @param {string} [is]
2170
+ * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}
2171
+ */
2172
+ function create_element(tag, namespace, is) {
2173
+ let options = is ? { is } : void 0;
2174
+ return document.createElementNS(namespace ?? "http://www.w3.org/1999/xhtml", tag, options);
2175
+ }
2176
+ /**
2177
+ * Browsers split text nodes larger than 65536 bytes when parsing.
2178
+ * For hydration to succeed, we need to stitch them back together
2179
+ * @param {Text} text
2180
+ */
2181
+ function merge_text_nodes(text) {
2182
+ if (text.nodeValue.length < 65536) return;
2183
+ let next = text.nextSibling;
2184
+ while (next !== null && next.nodeType === 3) {
2185
+ next.remove();
2186
+ /** @type {string} */ text.nodeValue += next.nodeValue;
2187
+ next = text.nextSibling;
2188
+ }
2189
+ }
2190
+ //#endregion
2191
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2192
+ /**
2193
+ * @template T
2194
+ * @param {() => T} fn
2195
+ */
2196
+ function without_reactive_context(fn) {
2197
+ var previous_reaction = active_reaction;
2198
+ var previous_effect = active_effect;
2199
+ set_active_reaction(null);
2200
+ set_active_effect(null);
2201
+ try {
2202
+ return fn();
2203
+ } finally {
2204
+ set_active_reaction(previous_reaction);
2205
+ set_active_effect(previous_effect);
2206
+ }
2207
+ }
2208
+ //#endregion
2209
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/effects.js
2210
+ /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
2211
+ /**
2212
+ * @param {'$effect' | '$effect.pre' | '$inspect'} rune
2213
+ */
2214
+ function validate_effect(rune) {
2215
+ if (active_effect === null) {
2216
+ if (active_reaction === null) effect_orphan(rune);
2217
+ effect_in_unowned_derived();
2218
+ }
2219
+ if (is_destroying_effect) effect_in_teardown(rune);
2220
+ }
2221
+ /**
2222
+ * @param {Effect} effect
2223
+ * @param {Effect} parent_effect
2224
+ */
2225
+ function push_effect(effect, parent_effect) {
2226
+ var parent_last = parent_effect.last;
2227
+ if (parent_last === null) parent_effect.last = parent_effect.first = effect;
2228
+ else {
2229
+ parent_last.next = effect;
2230
+ effect.prev = parent_last;
2231
+ parent_effect.last = effect;
2232
+ }
2233
+ }
2234
+ /**
2235
+ * @param {number} type
2236
+ * @param {null | (() => void | (() => void))} fn
2237
+ * @returns {Effect}
2238
+ */
2239
+ function create_effect(type, fn) {
2240
+ var parent = active_effect;
2241
+ if (parent !== null && (parent.f & 8192) !== 0) type |= INERT;
2242
+ /** @type {Effect} */
2243
+ var effect = {
2244
+ ctx: component_context,
2245
+ deps: null,
2246
+ nodes: null,
2247
+ f: type | DIRTY | 512,
2248
+ first: null,
2249
+ fn,
2250
+ last: null,
2251
+ next: null,
2252
+ parent,
2253
+ b: parent && parent.b,
2254
+ prev: null,
2255
+ teardown: null,
2256
+ wv: 0,
2257
+ ac: null
2258
+ };
2259
+ /** @type {Effect | null} */
2260
+ var e = effect;
2261
+ if ((type & 4) !== 0) if (collected_effects !== null) collected_effects.push(effect);
2262
+ else Batch.ensure().schedule(effect);
2263
+ else if (fn !== null) {
2264
+ try {
2265
+ update_effect(effect);
2266
+ } catch (e) {
2267
+ destroy_effect(effect);
2268
+ throw e;
2269
+ }
2270
+ if (e.deps === null && e.teardown === null && e.nodes === null && e.first === e.last && (e.f & 524288) === 0) {
2271
+ e = e.first;
2272
+ if ((type & 16) !== 0 && (type & 65536) !== 0 && e !== null) e.f |= EFFECT_TRANSPARENT;
2273
+ }
2274
+ }
2275
+ if (e !== null) {
2276
+ e.parent = parent;
2277
+ if (parent !== null) push_effect(e, parent);
2278
+ if (active_reaction !== null && (active_reaction.f & 2) !== 0 && (type & 64) === 0) {
2279
+ var derived = active_reaction;
2280
+ (derived.effects ?? (derived.effects = [])).push(e);
2281
+ }
2282
+ }
2283
+ return effect;
2284
+ }
2285
+ /**
2286
+ * Internal representation of `$effect.tracking()`
2287
+ * @returns {boolean}
2288
+ */
2289
+ function effect_tracking() {
2290
+ return active_reaction !== null && !untracking;
2291
+ }
2292
+ /**
2293
+ * @param {() => void} fn
2294
+ */
2295
+ function teardown(fn) {
2296
+ const effect = create_effect(8, null);
2297
+ set_signal_status(effect, CLEAN);
2298
+ effect.teardown = fn;
2299
+ return effect;
2300
+ }
2301
+ /**
2302
+ * Internal representation of `$effect(...)`
2303
+ * @param {() => void | (() => void)} fn
2304
+ */
2305
+ function user_effect(fn) {
2306
+ validate_effect("$effect");
2307
+ var flags = active_effect.f;
2308
+ if (!active_reaction && (flags & 32) !== 0 && (flags & 32768) === 0) {
2309
+ var context = component_context;
2310
+ (context.e ?? (context.e = [])).push(fn);
2311
+ } else return create_user_effect(fn);
2312
+ }
2313
+ /**
2314
+ * @param {() => void | (() => void)} fn
2315
+ */
2316
+ function create_user_effect(fn) {
2317
+ return create_effect(4 | USER_EFFECT, fn);
2318
+ }
2319
+ /**
2320
+ * Internal representation of `$effect.root(...)`
2321
+ * @param {() => void | (() => void)} fn
2322
+ * @returns {() => void}
2323
+ */
2324
+ function effect_root(fn) {
2325
+ Batch.ensure();
2326
+ const effect = create_effect(64 | EFFECT_PRESERVED, fn);
2327
+ return () => {
2328
+ destroy_effect(effect);
2329
+ };
2330
+ }
2331
+ /**
2332
+ * An effect root whose children can transition out
2333
+ * @param {() => void} fn
2334
+ * @returns {(options?: { outro?: boolean }) => Promise<void>}
2335
+ */
2336
+ function component_root(fn) {
2337
+ Batch.ensure();
2338
+ const effect = create_effect(64 | EFFECT_PRESERVED, fn);
2339
+ return (options = {}) => {
2340
+ return new Promise((fulfil) => {
2341
+ if (options.outro) pause_effect(effect, () => {
2342
+ destroy_effect(effect);
2343
+ fulfil(void 0);
2344
+ });
2345
+ else {
2346
+ destroy_effect(effect);
2347
+ fulfil(void 0);
2348
+ }
2349
+ });
2350
+ };
2351
+ }
2352
+ /**
2353
+ * @param {() => void | (() => void)} fn
2354
+ * @returns {Effect}
2355
+ */
2356
+ function effect(fn) {
2357
+ return create_effect(4, fn);
2358
+ }
2359
+ /**
2360
+ * @param {() => void | (() => void)} fn
2361
+ * @returns {Effect}
2362
+ */
2363
+ function async_effect(fn) {
2364
+ return create_effect(ASYNC | EFFECT_PRESERVED, fn);
2365
+ }
2366
+ /**
2367
+ * @param {() => void | (() => void)} fn
2368
+ * @returns {Effect}
2369
+ */
2370
+ function render_effect(fn, flags = 0) {
2371
+ return create_effect(8 | flags, fn);
2372
+ }
2373
+ /**
2374
+ * @param {(...expressions: any) => void | (() => void)} fn
2375
+ * @param {Array<() => any>} sync
2376
+ * @param {Array<() => Promise<any>>} async
2377
+ * @param {Blocker[]} blockers
2378
+ */
2379
+ function template_effect(fn, sync = [], async = [], blockers = []) {
2380
+ flatten(blockers, sync, async, (values) => {
2381
+ create_effect(8, () => fn(...values.map(get)));
2382
+ });
2383
+ }
2384
+ /**
2385
+ * @param {(() => void)} fn
2386
+ * @param {number} flags
2387
+ */
2388
+ function block(fn, flags = 0) {
2389
+ return create_effect(16 | flags, fn);
2390
+ }
2391
+ /**
2392
+ * @param {(() => void)} fn
2393
+ */
2394
+ function branch(fn) {
2395
+ return create_effect(32 | EFFECT_PRESERVED, fn);
2396
+ }
2397
+ /**
2398
+ * @param {Effect} effect
2399
+ */
2400
+ function execute_effect_teardown(effect) {
2401
+ var teardown = effect.teardown;
2402
+ if (teardown !== null) {
2403
+ const previously_destroying_effect = is_destroying_effect;
2404
+ const previous_reaction = active_reaction;
2405
+ set_is_destroying_effect(true);
2406
+ set_active_reaction(null);
2407
+ try {
2408
+ teardown.call(null);
2409
+ } finally {
2410
+ set_is_destroying_effect(previously_destroying_effect);
2411
+ set_active_reaction(previous_reaction);
2412
+ }
2413
+ }
2414
+ }
2415
+ /**
2416
+ * @param {Effect} signal
2417
+ * @param {boolean} remove_dom
2418
+ * @returns {void}
2419
+ */
2420
+ function destroy_effect_children(signal, remove_dom = false) {
2421
+ var effect = signal.first;
2422
+ signal.first = signal.last = null;
2423
+ while (effect !== null) {
2424
+ const controller = effect.ac;
2425
+ if (controller !== null) without_reactive_context(() => {
2426
+ controller.abort(STALE_REACTION);
2427
+ });
2428
+ var next = effect.next;
2429
+ if ((effect.f & 64) !== 0) effect.parent = null;
2430
+ else destroy_effect(effect, remove_dom);
2431
+ effect = next;
2432
+ }
2433
+ }
2434
+ /**
2435
+ * @param {Effect} signal
2436
+ * @returns {void}
2437
+ */
2438
+ function destroy_block_effect_children(signal) {
2439
+ var effect = signal.first;
2440
+ while (effect !== null) {
2441
+ var next = effect.next;
2442
+ if ((effect.f & 32) === 0) destroy_effect(effect);
2443
+ effect = next;
2444
+ }
2445
+ }
2446
+ /**
2447
+ * @param {Effect} effect
2448
+ * @param {boolean} [remove_dom]
2449
+ * @returns {void}
2450
+ */
2451
+ function destroy_effect(effect, remove_dom = true) {
2452
+ var removed = false;
2453
+ if ((remove_dom || (effect.f & 262144) !== 0) && effect.nodes !== null && effect.nodes.end !== null) {
2454
+ remove_effect_dom(effect.nodes.start, effect.nodes.end);
2455
+ removed = true;
2456
+ }
2457
+ set_signal_status(effect, DESTROYING);
2458
+ destroy_effect_children(effect, remove_dom && !removed);
2459
+ remove_reactions(effect, 0);
2460
+ var transitions = effect.nodes && effect.nodes.t;
2461
+ if (transitions !== null) for (const transition of transitions) transition.stop();
2462
+ execute_effect_teardown(effect);
2463
+ effect.f ^= DESTROYING;
2464
+ effect.f |= DESTROYED;
2465
+ var parent = effect.parent;
2466
+ if (parent !== null && parent.first !== null) unlink_effect(effect);
2467
+ effect.next = effect.prev = effect.teardown = effect.ctx = effect.deps = effect.fn = effect.nodes = effect.ac = null;
2468
+ }
2469
+ /**
2470
+ *
2471
+ * @param {TemplateNode | null} node
2472
+ * @param {TemplateNode} end
2473
+ */
2474
+ function remove_effect_dom(node, end) {
2475
+ while (node !== null) {
2476
+ /** @type {TemplateNode | null} */
2477
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
2478
+ node.remove();
2479
+ node = next;
2480
+ }
2481
+ }
2482
+ /**
2483
+ * Detach an effect from the effect tree, freeing up memory and
2484
+ * reducing the amount of work that happens on subsequent traversals
2485
+ * @param {Effect} effect
2486
+ */
2487
+ function unlink_effect(effect) {
2488
+ var parent = effect.parent;
2489
+ var prev = effect.prev;
2490
+ var next = effect.next;
2491
+ if (prev !== null) prev.next = next;
2492
+ if (next !== null) next.prev = prev;
2493
+ if (parent !== null) {
2494
+ if (parent.first === effect) parent.first = next;
2495
+ if (parent.last === effect) parent.last = prev;
2496
+ }
2497
+ }
2498
+ /**
2499
+ * When a block effect is removed, we don't immediately destroy it or yank it
2500
+ * out of the DOM, because it might have transitions. Instead, we 'pause' it.
2501
+ * It stays around (in memory, and in the DOM) until outro transitions have
2502
+ * completed, and if the state change is reversed then we _resume_ it.
2503
+ * A paused effect does not update, and the DOM subtree becomes inert.
2504
+ * @param {Effect} effect
2505
+ * @param {() => void} [callback]
2506
+ * @param {boolean} [destroy]
2507
+ */
2508
+ function pause_effect(effect, callback, destroy = true) {
2509
+ /** @type {TransitionManager[]} */
2510
+ var transitions = [];
2511
+ pause_children(effect, transitions, true);
2512
+ var fn = () => {
2513
+ if (destroy) destroy_effect(effect);
2514
+ if (callback) callback();
2515
+ };
2516
+ var remaining = transitions.length;
2517
+ if (remaining > 0) {
2518
+ var check = () => --remaining || fn();
2519
+ for (var transition of transitions) transition.out(check);
2520
+ } else fn();
2521
+ }
2522
+ /**
2523
+ * @param {Effect} effect
2524
+ * @param {TransitionManager[]} transitions
2525
+ * @param {boolean} local
2526
+ */
2527
+ function pause_children(effect, transitions, local) {
2528
+ if ((effect.f & 8192) !== 0) return;
2529
+ effect.f ^= INERT;
2530
+ var t = effect.nodes && effect.nodes.t;
2531
+ if (t !== null) {
2532
+ for (const transition of t) if (transition.is_global || local) transitions.push(transition);
2533
+ }
2534
+ var child = effect.first;
2535
+ while (child !== null) {
2536
+ var sibling = child.next;
2537
+ var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0 && (effect.f & 16) !== 0;
2538
+ pause_children(child, transitions, transparent ? local : false);
2539
+ child = sibling;
2540
+ }
2541
+ }
2542
+ /**
2543
+ * The opposite of `pause_effect`. We call this if (for example)
2544
+ * `x` becomes falsy then truthy: `{#if x}...{/if}`
2545
+ * @param {Effect} effect
2546
+ */
2547
+ function resume_effect(effect) {
2548
+ resume_children(effect, true);
2549
+ }
2550
+ /**
2551
+ * @param {Effect} effect
2552
+ * @param {boolean} local
2553
+ */
2554
+ function resume_children(effect, local) {
2555
+ if ((effect.f & 8192) === 0) return;
2556
+ effect.f ^= INERT;
2557
+ if ((effect.f & 1024) === 0) {
2558
+ set_signal_status(effect, DIRTY);
2559
+ Batch.ensure().schedule(effect);
2560
+ }
2561
+ var child = effect.first;
2562
+ while (child !== null) {
2563
+ var sibling = child.next;
2564
+ var transparent = (child.f & 65536) !== 0 || (child.f & 32) !== 0;
2565
+ resume_children(child, transparent ? local : false);
2566
+ child = sibling;
2567
+ }
2568
+ var t = effect.nodes && effect.nodes.t;
2569
+ if (t !== null) {
2570
+ for (const transition of t) if (transition.is_global || local) transition.in();
2571
+ }
2572
+ }
2573
+ /**
2574
+ * @param {Effect} effect
2575
+ * @param {DocumentFragment} fragment
2576
+ */
2577
+ function move_effect(effect, fragment) {
2578
+ if (!effect.nodes) return;
2579
+ /** @type {TemplateNode | null} */
2580
+ var node = effect.nodes.start;
2581
+ var end = effect.nodes.end;
2582
+ while (node !== null) {
2583
+ /** @type {TemplateNode | null} */
2584
+ var next = node === end ? null : /* @__PURE__ */ get_next_sibling(node);
2585
+ fragment.append(node);
2586
+ node = next;
2587
+ }
2588
+ }
2589
+ //#endregion
2590
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/legacy.js
2591
+ /**
2592
+ * @type {Set<Value> | null}
2593
+ * @deprecated
2594
+ */
2595
+ var captured_signals = null;
2596
+ //#endregion
2597
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/runtime.js
2598
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
2599
+ var is_updating_effect = false;
2600
+ var is_destroying_effect = false;
2601
+ /** @param {boolean} value */
2602
+ function set_is_destroying_effect(value) {
2603
+ is_destroying_effect = value;
2604
+ }
2605
+ /** @type {null | Reaction} */
2606
+ var active_reaction = null;
2607
+ var untracking = false;
2608
+ /** @param {null | Reaction} reaction */
2609
+ function set_active_reaction(reaction) {
2610
+ active_reaction = reaction;
2611
+ }
2612
+ /** @type {null | Effect} */
2613
+ var active_effect = null;
2614
+ /** @param {null | Effect} effect */
2615
+ function set_active_effect(effect) {
2616
+ active_effect = effect;
2617
+ }
2618
+ /**
2619
+ * When sources are created within a reaction, reading and writing
2620
+ * them within that reaction should not cause a re-run
2621
+ * @type {null | Source[]}
2622
+ */
2623
+ var current_sources = null;
2624
+ /** @param {Value} value */
2625
+ function push_reaction_value(value) {
2626
+ if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) if (current_sources === null) current_sources = [value];
2627
+ else current_sources.push(value);
2628
+ }
2629
+ /**
2630
+ * The dependencies of the reaction that is currently being executed. In many cases,
2631
+ * the dependencies are unchanged between runs, and so this will be `null` unless
2632
+ * and until a new dependency is accessed — we track this via `skipped_deps`
2633
+ * @type {null | Value[]}
2634
+ */
2635
+ var new_deps = null;
2636
+ var skipped_deps = 0;
2637
+ /**
2638
+ * Tracks writes that the effect it's executed in doesn't listen to yet,
2639
+ * so that the dependency can be added to the effect later on if it then reads it
2640
+ * @type {null | Source[]}
2641
+ */
2642
+ var untracked_writes = null;
2643
+ /** @param {null | Source[]} value */
2644
+ function set_untracked_writes(value) {
2645
+ untracked_writes = value;
2646
+ }
2647
+ /**
2648
+ * @type {number} Used by sources and deriveds for handling updates.
2649
+ * Version starts from 1 so that unowned deriveds differentiate between a created effect and a run one for tracing
2650
+ **/
2651
+ var write_version = 1;
2652
+ /** @type {number} Used to version each read of a source of derived to avoid duplicating depedencies inside a reaction */
2653
+ var read_version = 0;
2654
+ var update_version = read_version;
2655
+ /** @param {number} value */
2656
+ function set_update_version(value) {
2657
+ update_version = value;
2658
+ }
2659
+ function increment_write_version() {
2660
+ return ++write_version;
2661
+ }
2662
+ /**
2663
+ * Determines whether a derived or effect is dirty.
2664
+ * If it is MAYBE_DIRTY, will set the status to CLEAN
2665
+ * @param {Reaction} reaction
2666
+ * @returns {boolean}
2667
+ */
2668
+ function is_dirty(reaction) {
2669
+ var flags = reaction.f;
2670
+ if ((flags & 2048) !== 0) return true;
2671
+ if (flags & 2) reaction.f &= ~WAS_MARKED;
2672
+ if ((flags & 4096) !== 0) {
2673
+ var dependencies = reaction.deps;
2674
+ var length = dependencies.length;
2675
+ for (var i = 0; i < length; i++) {
2676
+ var dependency = dependencies[i];
2677
+ if (is_dirty(dependency)) update_derived(dependency);
2678
+ if (dependency.wv > reaction.wv) return true;
2679
+ }
2680
+ if ((flags & 512) !== 0 && batch_values === null) set_signal_status(reaction, CLEAN);
2681
+ }
2682
+ return false;
2683
+ }
2684
+ /**
2685
+ * @param {Value} signal
2686
+ * @param {Effect} effect
2687
+ * @param {boolean} [root]
2688
+ */
2689
+ function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
2690
+ var reactions = signal.reactions;
2691
+ if (reactions === null) return;
2692
+ if (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) return;
2693
+ for (var i = 0; i < reactions.length; i++) {
2694
+ var reaction = reactions[i];
2695
+ if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
2696
+ else if (effect === reaction) {
2697
+ if (root) set_signal_status(reaction, DIRTY);
2698
+ else if ((reaction.f & 1024) !== 0) set_signal_status(reaction, MAYBE_DIRTY);
2699
+ schedule_effect(reaction);
2700
+ }
2701
+ }
2702
+ }
2703
+ /** @param {Reaction} reaction */
2704
+ function update_reaction(reaction) {
2705
+ var previous_deps = new_deps;
2706
+ var previous_skipped_deps = skipped_deps;
2707
+ var previous_untracked_writes = untracked_writes;
2708
+ var previous_reaction = active_reaction;
2709
+ var previous_sources = current_sources;
2710
+ var previous_component_context = component_context;
2711
+ var previous_untracking = untracking;
2712
+ var previous_update_version = update_version;
2713
+ var flags = reaction.f;
2714
+ new_deps = null;
2715
+ skipped_deps = 0;
2716
+ untracked_writes = null;
2717
+ active_reaction = (flags & 96) === 0 ? reaction : null;
2718
+ current_sources = null;
2719
+ set_component_context(reaction.ctx);
2720
+ untracking = false;
2721
+ update_version = ++read_version;
2722
+ if (reaction.ac !== null) {
2723
+ without_reactive_context(() => {
2724
+ /** @type {AbortController} */ reaction.ac.abort(STALE_REACTION);
2725
+ });
2726
+ reaction.ac = null;
2727
+ }
2728
+ try {
2729
+ reaction.f |= REACTION_IS_UPDATING;
2730
+ var fn = reaction.fn;
2731
+ var result = fn();
2732
+ reaction.f |= REACTION_RAN;
2733
+ var deps = reaction.deps;
2734
+ var is_fork = current_batch?.is_fork;
2735
+ if (new_deps !== null) {
2736
+ var i;
2737
+ if (!is_fork) remove_reactions(reaction, skipped_deps);
2738
+ if (deps !== null && skipped_deps > 0) {
2739
+ deps.length = skipped_deps + new_deps.length;
2740
+ for (i = 0; i < new_deps.length; i++) deps[skipped_deps + i] = new_deps[i];
2741
+ } else reaction.deps = deps = new_deps;
2742
+ if (effect_tracking() && (reaction.f & 512) !== 0) for (i = skipped_deps; i < deps.length; i++) {
2743
+ var _deps$i;
2744
+ ((_deps$i = deps[i]).reactions ?? (_deps$i.reactions = [])).push(reaction);
2745
+ }
2746
+ } else if (!is_fork && deps !== null && skipped_deps < deps.length) {
2747
+ remove_reactions(reaction, skipped_deps);
2748
+ deps.length = skipped_deps;
2749
+ }
2750
+ if (is_runes() && untracked_writes !== null && !untracking && deps !== null && (reaction.f & 6146) === 0) for (i = 0; i < untracked_writes.length; i++) schedule_possible_effect_self_invalidation(untracked_writes[i], reaction);
2751
+ if (previous_reaction !== null && previous_reaction !== reaction) {
2752
+ read_version++;
2753
+ if (previous_reaction.deps !== null) for (let i = 0; i < previous_skipped_deps; i += 1) previous_reaction.deps[i].rv = read_version;
2754
+ if (previous_deps !== null) for (const dep of previous_deps) dep.rv = read_version;
2755
+ if (untracked_writes !== null) if (previous_untracked_writes === null) previous_untracked_writes = untracked_writes;
2756
+ else previous_untracked_writes.push(...untracked_writes);
2757
+ }
2758
+ if ((reaction.f & 8388608) !== 0) reaction.f ^= ERROR_VALUE;
2759
+ return result;
2760
+ } catch (error) {
2761
+ return handle_error(error);
2762
+ } finally {
2763
+ reaction.f ^= REACTION_IS_UPDATING;
2764
+ new_deps = previous_deps;
2765
+ skipped_deps = previous_skipped_deps;
2766
+ untracked_writes = previous_untracked_writes;
2767
+ active_reaction = previous_reaction;
2768
+ current_sources = previous_sources;
2769
+ set_component_context(previous_component_context);
2770
+ untracking = previous_untracking;
2771
+ update_version = previous_update_version;
2772
+ }
2773
+ }
2774
+ /**
2775
+ * @template V
2776
+ * @param {Reaction} signal
2777
+ * @param {Value<V>} dependency
2778
+ * @returns {void}
2779
+ */
2780
+ function remove_reaction(signal, dependency) {
2781
+ let reactions = dependency.reactions;
2782
+ if (reactions !== null) {
2783
+ var index = index_of.call(reactions, signal);
2784
+ if (index !== -1) {
2785
+ var new_length = reactions.length - 1;
2786
+ if (new_length === 0) reactions = dependency.reactions = null;
2787
+ else {
2788
+ reactions[index] = reactions[new_length];
2789
+ reactions.pop();
2790
+ }
2791
+ }
2792
+ }
2793
+ if (reactions === null && (dependency.f & 2) !== 0 && (new_deps === null || !includes.call(new_deps, dependency))) {
2794
+ var derived = dependency;
2795
+ if ((derived.f & 512) !== 0) {
2796
+ derived.f ^= 512;
2797
+ derived.f &= ~WAS_MARKED;
2798
+ }
2799
+ update_derived_status(derived);
2800
+ freeze_derived_effects(derived);
2801
+ remove_reactions(derived, 0);
2802
+ }
2803
+ }
2804
+ /**
2805
+ * @param {Reaction} signal
2806
+ * @param {number} start_index
2807
+ * @returns {void}
2808
+ */
2809
+ function remove_reactions(signal, start_index) {
2810
+ var dependencies = signal.deps;
2811
+ if (dependencies === null) return;
2812
+ for (var i = start_index; i < dependencies.length; i++) remove_reaction(signal, dependencies[i]);
2813
+ }
2814
+ /**
2815
+ * @param {Effect} effect
2816
+ * @returns {void}
2817
+ */
2818
+ function update_effect(effect) {
2819
+ var flags = effect.f;
2820
+ if ((flags & 16384) !== 0) return;
2821
+ set_signal_status(effect, CLEAN);
2822
+ var previous_effect = active_effect;
2823
+ var was_updating_effect = is_updating_effect;
2824
+ active_effect = effect;
2825
+ is_updating_effect = true;
2826
+ try {
2827
+ if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
2828
+ else destroy_effect_children(effect);
2829
+ execute_effect_teardown(effect);
2830
+ var teardown = update_reaction(effect);
2831
+ effect.teardown = typeof teardown === "function" ? teardown : null;
2832
+ effect.wv = write_version;
2833
+ } finally {
2834
+ is_updating_effect = was_updating_effect;
2835
+ active_effect = previous_effect;
2836
+ }
2837
+ }
2838
+ /**
2839
+ * @template V
2840
+ * @param {Value<V>} signal
2841
+ * @returns {V}
2842
+ */
2843
+ function get(signal) {
2844
+ var is_derived = (signal.f & 2) !== 0;
2845
+ captured_signals?.add(signal);
2846
+ if (active_reaction !== null && !untracking) {
2847
+ if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !includes.call(current_sources, signal))) {
2848
+ var deps = active_reaction.deps;
2849
+ if ((active_reaction.f & 2097152) !== 0) {
2850
+ if (signal.rv < read_version) {
2851
+ signal.rv = read_version;
2852
+ if (new_deps === null && deps !== null && deps[skipped_deps] === signal) skipped_deps++;
2853
+ else if (new_deps === null) new_deps = [signal];
2854
+ else new_deps.push(signal);
2855
+ }
2856
+ } else {
2857
+ var _active_reaction;
2858
+ ((_active_reaction = active_reaction).deps ?? (_active_reaction.deps = [])).push(signal);
2859
+ var reactions = signal.reactions;
2860
+ if (reactions === null) signal.reactions = [active_reaction];
2861
+ else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
2862
+ }
2863
+ }
2864
+ }
2865
+ if (is_destroying_effect && old_values.has(signal)) return old_values.get(signal);
2866
+ if (is_derived) {
2867
+ var derived = signal;
2868
+ if (is_destroying_effect) {
2869
+ var value = derived.v;
2870
+ if ((derived.f & 1024) === 0 && derived.reactions !== null || depends_on_old_values(derived)) value = execute_derived(derived);
2871
+ old_values.set(derived, value);
2872
+ return value;
2873
+ }
2874
+ var should_connect = (derived.f & 512) === 0 && !untracking && active_reaction !== null && (is_updating_effect || (active_reaction.f & 512) !== 0);
2875
+ var is_new = (derived.f & REACTION_RAN) === 0;
2876
+ if (is_dirty(derived)) {
2877
+ if (should_connect) derived.f |= 512;
2878
+ update_derived(derived);
2879
+ }
2880
+ if (should_connect && !is_new) {
2881
+ unfreeze_derived_effects(derived);
2882
+ reconnect(derived);
2883
+ }
2884
+ }
2885
+ if (batch_values?.has(signal)) return batch_values.get(signal);
2886
+ if ((signal.f & 8388608) !== 0) throw signal.v;
2887
+ return signal.v;
2888
+ }
2889
+ /**
2890
+ * (Re)connect a disconnected derived, so that it is notified
2891
+ * of changes in `mark_reactions`
2892
+ * @param {Derived} derived
2893
+ */
2894
+ function reconnect(derived) {
2895
+ derived.f |= 512;
2896
+ if (derived.deps === null) return;
2897
+ for (const dep of derived.deps) {
2898
+ (dep.reactions ?? (dep.reactions = [])).push(derived);
2899
+ if ((dep.f & 2) !== 0 && (dep.f & 512) === 0) {
2900
+ unfreeze_derived_effects(dep);
2901
+ reconnect(dep);
2902
+ }
2903
+ }
2904
+ }
2905
+ /** @param {Derived} derived */
2906
+ function depends_on_old_values(derived) {
2907
+ if (derived.v === UNINITIALIZED) return true;
2908
+ if (derived.deps === null) return false;
2909
+ for (const dep of derived.deps) {
2910
+ if (old_values.has(dep)) return true;
2911
+ if ((dep.f & 2) !== 0 && depends_on_old_values(dep)) return true;
2912
+ }
2913
+ return false;
2914
+ }
2915
+ /**
2916
+ * When used inside a [`$derived`](https://svelte.dev/docs/svelte/$derived) or [`$effect`](https://svelte.dev/docs/svelte/$effect),
2917
+ * any state read inside `fn` will not be treated as a dependency.
2918
+ *
2919
+ * ```ts
2920
+ * $effect(() => {
2921
+ * // this will run when `data` changes, but not when `time` changes
2922
+ * save(data, {
2923
+ * timestamp: untrack(() => time)
2924
+ * });
2925
+ * });
2926
+ * ```
2927
+ * @template T
2928
+ * @param {() => T} fn
2929
+ * @returns {T}
2930
+ */
2931
+ function untrack(fn) {
2932
+ var previous_untracking = untracking;
2933
+ try {
2934
+ untracking = true;
2935
+ return fn();
2936
+ } finally {
2937
+ untracking = previous_untracking;
2938
+ }
2939
+ }
2940
+ //#endregion
2941
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/events.js
2942
+ /**
2943
+ * Used on elements, as a map of event type -> event handler,
2944
+ * and on events themselves to track which element handled an event
2945
+ */
2946
+ var event_symbol = Symbol("events");
2947
+ /** @type {Set<string>} */
2948
+ var all_registered_events = /* @__PURE__ */ new Set();
2949
+ /** @type {Set<(events: Array<string>) => void>} */
2950
+ var root_event_handles = /* @__PURE__ */ new Set();
2951
+ var last_propagated_event = null;
2952
+ /**
2953
+ * @this {EventTarget}
2954
+ * @param {Event} event
2955
+ * @returns {void}
2956
+ */
2957
+ function handle_event_propagation(event) {
2958
+ var handler_element = this;
2959
+ var owner_document = handler_element.ownerDocument;
2960
+ var event_name = event.type;
2961
+ var path = event.composedPath?.() || [];
2962
+ var current_target = path[0] || event.target;
2963
+ last_propagated_event = event;
2964
+ var path_idx = 0;
2965
+ var handled_at = last_propagated_event === event && event[event_symbol];
2966
+ if (handled_at) {
2967
+ var at_idx = path.indexOf(handled_at);
2968
+ if (at_idx !== -1 && (handler_element === document || handler_element === window)) {
2969
+ event[event_symbol] = handler_element;
2970
+ return;
2971
+ }
2972
+ var handler_idx = path.indexOf(handler_element);
2973
+ if (handler_idx === -1) return;
2974
+ if (at_idx <= handler_idx) path_idx = at_idx;
2975
+ }
2976
+ current_target = path[path_idx] || event.target;
2977
+ if (current_target === handler_element) return;
2978
+ define_property(event, "currentTarget", {
2979
+ configurable: true,
2980
+ get() {
2981
+ return current_target || owner_document;
2982
+ }
2983
+ });
2984
+ var previous_reaction = active_reaction;
2985
+ var previous_effect = active_effect;
2986
+ set_active_reaction(null);
2987
+ set_active_effect(null);
2988
+ try {
2989
+ /**
2990
+ * @type {unknown}
2991
+ */
2992
+ var throw_error;
2993
+ /**
2994
+ * @type {unknown[]}
2995
+ */
2996
+ var other_errors = [];
2997
+ while (current_target !== null) {
2998
+ /** @type {null | Element} */
2999
+ var parent_element = current_target.assignedSlot || current_target.parentNode || current_target.host || null;
3000
+ try {
3001
+ var delegated = current_target[event_symbol]?.[event_name];
3002
+ if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
3003
+ } catch (error) {
3004
+ if (throw_error) other_errors.push(error);
3005
+ else throw_error = error;
3006
+ }
3007
+ if (event.cancelBubble || parent_element === handler_element || parent_element === null) break;
3008
+ current_target = parent_element;
3009
+ }
3010
+ if (throw_error) {
3011
+ for (let error of other_errors) queueMicrotask(() => {
3012
+ throw error;
3013
+ });
3014
+ throw throw_error;
3015
+ }
3016
+ } finally {
3017
+ event[event_symbol] = handler_element;
3018
+ delete event.currentTarget;
3019
+ set_active_reaction(previous_reaction);
3020
+ set_active_effect(previous_effect);
3021
+ }
3022
+ }
3023
+ //#endregion
3024
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/reconciler.js
3025
+ var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { createHTML: (html) => {
3026
+ return html;
3027
+ } });
3028
+ /** @param {string} html */
3029
+ function create_trusted_html(html) {
3030
+ return policy?.createHTML(html) ?? html;
3031
+ }
3032
+ /**
3033
+ * @param {string} html
3034
+ */
3035
+ function create_fragment_from_html(html) {
3036
+ var elem = create_element("template");
3037
+ elem.innerHTML = create_trusted_html(html.replaceAll("<!>", "<!---->"));
3038
+ return elem.content;
3039
+ }
3040
+ //#endregion
3041
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/template.js
3042
+ /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
3043
+ /** @import { TemplateStructure } from './types' */
3044
+ /**
3045
+ * @param {TemplateNode} start
3046
+ * @param {TemplateNode | null} end
3047
+ */
3048
+ function assign_nodes(start, end) {
3049
+ var effect = active_effect;
3050
+ if (effect.nodes === null) effect.nodes = {
3051
+ start,
3052
+ end,
3053
+ a: null,
3054
+ t: null
3055
+ };
3056
+ }
3057
+ /**
3058
+ * @param {string} content
3059
+ * @param {number} flags
3060
+ * @returns {() => Node | Node[]}
3061
+ */
3062
+ /* @__NO_SIDE_EFFECTS__ */
3063
+ function from_html(content, flags) {
3064
+ var is_fragment = (flags & 1) !== 0;
3065
+ var use_import_node = (flags & 2) !== 0;
3066
+ /** @type {Node} */
3067
+ var node;
3068
+ /**
3069
+ * Whether or not the first item is a text/element node. If not, we need to
3070
+ * create an additional comment node to act as `effect.nodes.start`
3071
+ */
3072
+ var has_start = !content.startsWith("<!>");
3073
+ return () => {
3074
+ if (hydrating) {
3075
+ assign_nodes(hydrate_node, null);
3076
+ return hydrate_node;
3077
+ }
3078
+ if (node === void 0) {
3079
+ node = create_fragment_from_html(has_start ? content : "<!>" + content);
3080
+ if (!is_fragment) node = /* @__PURE__ */ get_first_child(node);
3081
+ }
3082
+ var clone = use_import_node || is_firefox ? document.importNode(node, true) : node.cloneNode(true);
3083
+ if (is_fragment) {
3084
+ var start = /* @__PURE__ */ get_first_child(clone);
3085
+ var end = clone.lastChild;
3086
+ assign_nodes(start, end);
3087
+ } else assign_nodes(clone, clone);
3088
+ return clone;
3089
+ };
3090
+ }
3091
+ /**
3092
+ * Assign the created (or in hydration mode, traversed) dom elements to the current block
3093
+ * and insert the elements into the dom (in client mode).
3094
+ * @param {Text | Comment | Element} anchor
3095
+ * @param {DocumentFragment | Element} dom
3096
+ */
3097
+ function append(anchor, dom) {
3098
+ if (hydrating) {
3099
+ var effect = active_effect;
3100
+ if ((effect.f & 32768) === 0 || effect.nodes.end === null) effect.nodes.end = hydrate_node;
3101
+ hydrate_next();
3102
+ return;
3103
+ }
3104
+ if (anchor === null) return;
3105
+ anchor.before(dom);
3106
+ }
3107
+ /**
3108
+ * Subset of delegated events which should be passive by default.
3109
+ * These two are already passive via browser defaults on window, document and body.
3110
+ * But since
3111
+ * - we're delegating them
3112
+ * - they happen often
3113
+ * - they apply to mobile which is generally less performant
3114
+ * we're marking them as passive by default for other elements, too.
3115
+ */
3116
+ var PASSIVE_EVENTS = ["touchstart", "touchmove"];
3117
+ /**
3118
+ * Returns `true` if `name` is a passive event
3119
+ * @param {string} name
3120
+ */
3121
+ function is_passive_event(name) {
3122
+ return PASSIVE_EVENTS.includes(name);
3123
+ }
3124
+ /**
3125
+ * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component.
3126
+ * Transitions will play during the initial render unless the `intro` option is set to `false`.
3127
+ *
3128
+ * @template {Record<string, any>} Props
3129
+ * @template {Record<string, any>} Exports
3130
+ * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component
3131
+ * @param {MountOptions<Props>} options
3132
+ * @returns {Exports}
3133
+ */
3134
+ function mount(component, options) {
3135
+ return _mount(component, options);
3136
+ }
3137
+ /**
3138
+ * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component
3139
+ *
3140
+ * @template {Record<string, any>} Props
3141
+ * @template {Record<string, any>} Exports
3142
+ * @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component
3143
+ * @param {{} extends Props ? {
3144
+ * target: Document | Element | ShadowRoot;
3145
+ * props?: Props;
3146
+ * events?: Record<string, (e: any) => any>;
3147
+ * context?: Map<any, any>;
3148
+ * intro?: boolean;
3149
+ * recover?: boolean;
3150
+ * transformError?: (error: unknown) => unknown;
3151
+ * } : {
3152
+ * target: Document | Element | ShadowRoot;
3153
+ * props: Props;
3154
+ * events?: Record<string, (e: any) => any>;
3155
+ * context?: Map<any, any>;
3156
+ * intro?: boolean;
3157
+ * recover?: boolean;
3158
+ * transformError?: (error: unknown) => unknown;
3159
+ * }} options
3160
+ * @returns {Exports}
3161
+ */
3162
+ function hydrate(component, options) {
3163
+ init_operations();
3164
+ options.intro = options.intro ?? false;
3165
+ const target = options.target;
3166
+ const was_hydrating = hydrating;
3167
+ const previous_hydrate_node = hydrate_node;
3168
+ try {
3169
+ var anchor = /* @__PURE__ */ get_first_child(target);
3170
+ while (anchor && (anchor.nodeType !== 8 || anchor.data !== "[")) anchor = /* @__PURE__ */ get_next_sibling(anchor);
3171
+ if (!anchor) throw HYDRATION_ERROR;
3172
+ set_hydrating(true);
3173
+ set_hydrate_node(anchor);
3174
+ const instance = _mount(component, {
3175
+ ...options,
3176
+ anchor
3177
+ });
3178
+ set_hydrating(false);
3179
+ return instance;
3180
+ } catch (error) {
3181
+ if (error instanceof Error && error.message.split("\n").some((line) => line.startsWith("https://svelte.dev/e/"))) throw error;
3182
+ if (error !== HYDRATION_ERROR) console.warn("Failed to hydrate: ", error);
3183
+ if (options.recover === false) hydration_failed();
3184
+ init_operations();
3185
+ clear_text_content(target);
3186
+ set_hydrating(false);
3187
+ return mount(component, options);
3188
+ } finally {
3189
+ set_hydrating(was_hydrating);
3190
+ set_hydrate_node(previous_hydrate_node);
3191
+ }
3192
+ }
3193
+ /** @type {Map<EventTarget, Map<string, number>>} */
3194
+ var listeners = /* @__PURE__ */ new Map();
3195
+ /**
3196
+ * @template {Record<string, any>} Exports
3197
+ * @param {ComponentType<SvelteComponent<any>> | Component<any>} Component
3198
+ * @param {MountOptions} options
3199
+ * @returns {Exports}
3200
+ */
3201
+ function _mount(Component, { target, anchor, props = {}, events, context, intro = true, transformError }) {
3202
+ init_operations();
3203
+ /** @type {Exports} */
3204
+ var component = void 0;
3205
+ var unmount = component_root(() => {
3206
+ var anchor_node = anchor ?? target.appendChild(create_text());
3207
+ boundary(anchor_node, { pending: () => {} }, (anchor_node) => {
3208
+ push({});
3209
+ var ctx = component_context;
3210
+ if (context) ctx.c = context;
3211
+ if (events)
3212
+ /** @type {any} */ props.$$events = events;
3213
+ if (hydrating) assign_nodes(anchor_node, null);
3214
+ component = Component(anchor_node, props) || {};
3215
+ if (hydrating) {
3216
+ /** @type {Effect & { nodes: EffectNodes }} */ active_effect.nodes.end = hydrate_node;
3217
+ if (hydrate_node === null || hydrate_node.nodeType !== 8 || hydrate_node.data !== "]") {
3218
+ hydration_mismatch();
3219
+ throw HYDRATION_ERROR;
3220
+ }
3221
+ }
3222
+ pop();
3223
+ }, transformError);
3224
+ /** @type {Set<string>} */
3225
+ var registered_events = /* @__PURE__ */ new Set();
3226
+ /** @param {Array<string>} events */
3227
+ var event_handle = (events) => {
3228
+ for (var i = 0; i < events.length; i++) {
3229
+ var event_name = events[i];
3230
+ if (registered_events.has(event_name)) continue;
3231
+ registered_events.add(event_name);
3232
+ var passive = is_passive_event(event_name);
3233
+ for (const node of [target, document]) {
3234
+ var counts = listeners.get(node);
3235
+ if (counts === void 0) {
3236
+ counts = /* @__PURE__ */ new Map();
3237
+ listeners.set(node, counts);
3238
+ }
3239
+ var count = counts.get(event_name);
3240
+ if (count === void 0) {
3241
+ node.addEventListener(event_name, handle_event_propagation, { passive });
3242
+ counts.set(event_name, 1);
3243
+ } else counts.set(event_name, count + 1);
3244
+ }
3245
+ }
3246
+ };
3247
+ event_handle(array_from(all_registered_events));
3248
+ root_event_handles.add(event_handle);
3249
+ return () => {
3250
+ for (var event_name of registered_events) for (const node of [target, document]) {
3251
+ var counts = listeners.get(node);
3252
+ var count = counts.get(event_name);
3253
+ if (--count == 0) {
3254
+ node.removeEventListener(event_name, handle_event_propagation);
3255
+ counts.delete(event_name);
3256
+ if (counts.size === 0) listeners.delete(node);
3257
+ } else counts.set(event_name, count);
3258
+ }
3259
+ root_event_handles.delete(event_handle);
3260
+ if (anchor_node !== anchor) anchor_node.parentNode?.removeChild(anchor_node);
3261
+ };
3262
+ });
3263
+ mounted_components.set(component, unmount);
3264
+ return component;
3265
+ }
3266
+ /**
3267
+ * References of the components that were mounted or hydrated.
3268
+ * Uses a `WeakMap` to avoid memory leaks.
3269
+ */
3270
+ var mounted_components = /* @__PURE__ */ new WeakMap();
3271
+ /**
3272
+ * Unmounts a component that was previously mounted using `mount` or `hydrate`.
3273
+ *
3274
+ * Since 5.13.0, if `options.outro` is `true`, [transitions](https://svelte.dev/docs/svelte/transition) will play before the component is removed from the DOM.
3275
+ *
3276
+ * Returns a `Promise` that resolves after transitions have completed if `options.outro` is true, or immediately otherwise (prior to 5.13.0, returns `void`).
3277
+ *
3278
+ * ```js
3279
+ * import { mount, unmount } from 'svelte';
3280
+ * import App from './App.svelte';
3281
+ *
3282
+ * const app = mount(App, { target: document.body });
3283
+ *
3284
+ * // later...
3285
+ * unmount(app, { outro: true });
3286
+ * ```
3287
+ * @param {Record<string, any>} component
3288
+ * @param {{ outro?: boolean }} [options]
3289
+ * @returns {Promise<void>}
3290
+ */
3291
+ function unmount(component, options) {
3292
+ const fn = mounted_components.get(component);
3293
+ if (fn) {
3294
+ mounted_components.delete(component);
3295
+ return fn(options);
3296
+ }
3297
+ return Promise.resolve();
3298
+ }
3299
+ //#endregion
3300
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3301
+ /** @import { Effect, TemplateNode } from '#client' */
3302
+ var _batches = /* @__PURE__ */ new WeakMap();
3303
+ var _onscreen = /* @__PURE__ */ new WeakMap();
3304
+ var _offscreen = /* @__PURE__ */ new WeakMap();
3305
+ var _outroing = /* @__PURE__ */ new WeakMap();
3306
+ var _transition = /* @__PURE__ */ new WeakMap();
3307
+ var _commit = /* @__PURE__ */ new WeakMap();
3308
+ var _discard = /* @__PURE__ */ new WeakMap();
3309
+ /**
3310
+ * @typedef {{ effect: Effect, fragment: DocumentFragment }} Branch
3311
+ */
3312
+ /**
3313
+ * @template Key
3314
+ */
3315
+ var BranchManager = class {
3316
+ /**
3317
+ * @param {TemplateNode} anchor
3318
+ * @param {boolean} transition
3319
+ */
3320
+ constructor(anchor, transition = true) {
3321
+ _defineProperty(
3322
+ this,
3323
+ /** @type {TemplateNode} */
3324
+ "anchor",
3325
+ void 0
3326
+ );
3327
+ _classPrivateFieldInitSpec(this, _batches, /* @__PURE__ */ new Map());
3328
+ _classPrivateFieldInitSpec(this, _onscreen, /* @__PURE__ */ new Map());
3329
+ _classPrivateFieldInitSpec(this, _offscreen, /* @__PURE__ */ new Map());
3330
+ _classPrivateFieldInitSpec(this, _outroing, /* @__PURE__ */ new Set());
3331
+ _classPrivateFieldInitSpec(this, _transition, true);
3332
+ _classPrivateFieldInitSpec(this, _commit, (batch) => {
3333
+ if (!_classPrivateFieldGet2(_batches, this).has(batch)) return;
3334
+ var key = _classPrivateFieldGet2(_batches, this).get(batch);
3335
+ var onscreen = _classPrivateFieldGet2(_onscreen, this).get(key);
3336
+ if (onscreen) {
3337
+ resume_effect(onscreen);
3338
+ _classPrivateFieldGet2(_outroing, this).delete(key);
3339
+ } else {
3340
+ var offscreen = _classPrivateFieldGet2(_offscreen, this).get(key);
3341
+ if (offscreen) {
3342
+ _classPrivateFieldGet2(_onscreen, this).set(key, offscreen.effect);
3343
+ _classPrivateFieldGet2(_offscreen, this).delete(key);
3344
+ /** @type {TemplateNode} */ offscreen.fragment.lastChild.remove();
3345
+ this.anchor.before(offscreen.fragment);
3346
+ onscreen = offscreen.effect;
3347
+ }
3348
+ }
3349
+ for (const [b, k] of _classPrivateFieldGet2(_batches, this)) {
3350
+ _classPrivateFieldGet2(_batches, this).delete(b);
3351
+ if (b === batch) break;
3352
+ const offscreen = _classPrivateFieldGet2(_offscreen, this).get(k);
3353
+ if (offscreen) {
3354
+ destroy_effect(offscreen.effect);
3355
+ _classPrivateFieldGet2(_offscreen, this).delete(k);
3356
+ }
3357
+ }
3358
+ for (const [k, effect] of _classPrivateFieldGet2(_onscreen, this)) {
3359
+ if (k === key || _classPrivateFieldGet2(_outroing, this).has(k)) continue;
3360
+ const on_destroy = () => {
3361
+ if (Array.from(_classPrivateFieldGet2(_batches, this).values()).includes(k)) {
3362
+ var fragment = document.createDocumentFragment();
3363
+ move_effect(effect, fragment);
3364
+ fragment.append(create_text());
3365
+ _classPrivateFieldGet2(_offscreen, this).set(k, {
3366
+ effect,
3367
+ fragment
3368
+ });
3369
+ } else destroy_effect(effect);
3370
+ _classPrivateFieldGet2(_outroing, this).delete(k);
3371
+ _classPrivateFieldGet2(_onscreen, this).delete(k);
3372
+ };
3373
+ if (_classPrivateFieldGet2(_transition, this) || !onscreen) {
3374
+ _classPrivateFieldGet2(_outroing, this).add(k);
3375
+ pause_effect(effect, on_destroy, false);
3376
+ } else on_destroy();
3377
+ }
3378
+ });
3379
+ _classPrivateFieldInitSpec(this, _discard, (batch) => {
3380
+ _classPrivateFieldGet2(_batches, this).delete(batch);
3381
+ const keys = Array.from(_classPrivateFieldGet2(_batches, this).values());
3382
+ for (const [k, branch] of _classPrivateFieldGet2(_offscreen, this)) if (!keys.includes(k)) {
3383
+ destroy_effect(branch.effect);
3384
+ _classPrivateFieldGet2(_offscreen, this).delete(k);
3385
+ }
3386
+ });
3387
+ this.anchor = anchor;
3388
+ _classPrivateFieldSet2(_transition, this, transition);
3389
+ }
3390
+ /**
3391
+ *
3392
+ * @param {any} key
3393
+ * @param {null | ((target: TemplateNode) => void)} fn
3394
+ */
3395
+ ensure(key, fn) {
3396
+ var batch = current_batch;
3397
+ var defer = should_defer_append();
3398
+ if (fn && !_classPrivateFieldGet2(_onscreen, this).has(key) && !_classPrivateFieldGet2(_offscreen, this).has(key)) if (defer) {
3399
+ var fragment = document.createDocumentFragment();
3400
+ var target = create_text();
3401
+ fragment.append(target);
3402
+ _classPrivateFieldGet2(_offscreen, this).set(key, {
3403
+ effect: branch(() => fn(target)),
3404
+ fragment
3405
+ });
3406
+ } else _classPrivateFieldGet2(_onscreen, this).set(key, branch(() => fn(this.anchor)));
3407
+ _classPrivateFieldGet2(_batches, this).set(batch, key);
3408
+ if (defer) {
3409
+ for (const [k, effect] of _classPrivateFieldGet2(_onscreen, this)) if (k === key) batch.unskip_effect(effect);
3410
+ else batch.skip_effect(effect);
3411
+ for (const [k, branch] of _classPrivateFieldGet2(_offscreen, this)) if (k === key) batch.unskip_effect(branch.effect);
3412
+ else batch.skip_effect(branch.effect);
3413
+ batch.oncommit(_classPrivateFieldGet2(_commit, this));
3414
+ batch.ondiscard(_classPrivateFieldGet2(_discard, this));
3415
+ } else {
3416
+ if (hydrating) this.anchor = hydrate_node;
3417
+ _classPrivateFieldGet2(_commit, this).call(this, batch);
3418
+ }
3419
+ }
3420
+ };
3421
+ //#endregion
3422
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/blocks/if.js
3423
+ /** @import { TemplateNode } from '#client' */
3424
+ /**
3425
+ * @param {TemplateNode} node
3426
+ * @param {(branch: (fn: (anchor: Node) => void, key?: number | false) => void) => void} fn
3427
+ * @param {boolean} [elseif] True if this is an `{:else if ...}` block rather than an `{#if ...}`, as that affects which transitions are considered 'local'
3428
+ * @returns {void}
3429
+ */
3430
+ function if_block(node, fn, elseif = false) {
3431
+ /** @type {TemplateNode | undefined} */
3432
+ var marker;
3433
+ if (hydrating) {
3434
+ marker = hydrate_node;
3435
+ hydrate_next();
3436
+ }
3437
+ var branches = new BranchManager(node);
3438
+ var flags = elseif ? EFFECT_TRANSPARENT : 0;
3439
+ /**
3440
+ * @param {number | false} key
3441
+ * @param {null | ((anchor: Node) => void)} fn
3442
+ */
3443
+ function update_branch(key, fn) {
3444
+ if (hydrating) {
3445
+ var data = read_hydration_instruction(marker);
3446
+ if (key !== parseInt(data.substring(1))) {
3447
+ var anchor = skip_nodes();
3448
+ set_hydrate_node(anchor);
3449
+ branches.anchor = anchor;
3450
+ set_hydrating(false);
3451
+ branches.ensure(key, fn);
3452
+ set_hydrating(true);
3453
+ return;
3454
+ }
3455
+ }
3456
+ branches.ensure(key, fn);
3457
+ }
3458
+ block(() => {
3459
+ var has_branch = false;
3460
+ fn((fn, key = 0) => {
3461
+ has_branch = true;
3462
+ update_branch(key, fn);
3463
+ });
3464
+ if (!has_branch) update_branch(-1, null);
3465
+ }, flags);
3466
+ }
3467
+ /**
3468
+ * @param {Element | Text | Comment} node
3469
+ * @param {() => string | TrustedHTML} get_value
3470
+ * @param {boolean} [is_controlled]
3471
+ * @param {boolean} [svg]
3472
+ * @param {boolean} [mathml]
3473
+ * @param {boolean} [skip_warning]
3474
+ * @returns {void}
3475
+ */
3476
+ function html(node, get_value, is_controlled = false, svg = false, mathml = false, skip_warning = false) {
3477
+ var anchor = node;
3478
+ /** @type {string | TrustedHTML} */
3479
+ var value = "";
3480
+ if (is_controlled) {
3481
+ var parent_node = node;
3482
+ if (hydrating) anchor = set_hydrate_node(/* @__PURE__ */ get_first_child(parent_node));
3483
+ }
3484
+ template_effect(() => {
3485
+ var effect = active_effect;
3486
+ if (value === (value = get_value() ?? "")) {
3487
+ if (hydrating) hydrate_next();
3488
+ return;
3489
+ }
3490
+ if (is_controlled && !hydrating) {
3491
+ effect.nodes = null;
3492
+ parent_node.innerHTML = value;
3493
+ if (value !== "") assign_nodes(/* @__PURE__ */ get_first_child(parent_node), parent_node.lastChild);
3494
+ return;
3495
+ }
3496
+ if (effect.nodes !== null) {
3497
+ remove_effect_dom(effect.nodes.start, effect.nodes.end);
3498
+ effect.nodes = null;
3499
+ }
3500
+ if (value === "") return;
3501
+ if (hydrating) {
3502
+ hydrate_node.data;
3503
+ /** @type {TemplateNode | null} */
3504
+ var next = hydrate_next();
3505
+ var last = next;
3506
+ while (next !== null && (next.nodeType !== 8 || next.data !== "")) {
3507
+ last = next;
3508
+ next = /* @__PURE__ */ get_next_sibling(next);
3509
+ }
3510
+ if (next === null) {
3511
+ hydration_mismatch();
3512
+ throw HYDRATION_ERROR;
3513
+ }
3514
+ assign_nodes(hydrate_node, last);
3515
+ anchor = set_hydrate_node(next);
3516
+ return;
3517
+ }
3518
+ var wrapper = create_element(svg ? "svg" : mathml ? "math" : "template", svg ? NAMESPACE_SVG : mathml ? NAMESPACE_MATHML : void 0);
3519
+ wrapper.innerHTML = value;
3520
+ /** @type {DocumentFragment | Element} */
3521
+ var node = svg || mathml ? wrapper : wrapper.content;
3522
+ assign_nodes(/* @__PURE__ */ get_first_child(node), node.lastChild);
3523
+ if (svg || mathml) while (/* @__PURE__ */ get_first_child(node)) anchor.before(/* @__PURE__ */ get_first_child(node));
3524
+ else anchor.before(node);
3525
+ });
3526
+ }
3527
+ //#endregion
3528
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/css.js
3529
+ /**
3530
+ * @param {Node} anchor
3531
+ * @param {{ hash: string, code: string }} css
3532
+ */
3533
+ function append_styles(anchor, css) {
3534
+ effect(() => {
3535
+ var root = anchor.getRootNode();
3536
+ var target = root.host ? root : root.head ?? root.ownerDocument.head;
3537
+ if (!target.querySelector("#" + css.hash)) {
3538
+ const style = create_element("style");
3539
+ style.id = css.hash;
3540
+ style.textContent = css.code;
3541
+ target.appendChild(style);
3542
+ }
3543
+ });
3544
+ }
3545
+ //#endregion
3546
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3547
+ var _ResizeObserverSingleton;
3548
+ var _listeners = /* @__PURE__ */ new WeakMap();
3549
+ var _observer = /* @__PURE__ */ new WeakMap();
3550
+ var _options = /* @__PURE__ */ new WeakMap();
3551
+ var _ResizeObserverSingleton_brand = /* @__PURE__ */ new WeakSet();
3552
+ /**
3553
+ * We create one listener for all elements
3554
+ * @see {@link https://groups.google.com/a/chromium.org/g/blink-dev/c/z6ienONUb5A/m/F5-VcUZtBAAJ Explanation}
3555
+ */
3556
+ var ResizeObserverSingleton = class {
3557
+ /** @param {ResizeObserverOptions} options */
3558
+ constructor(options) {
3559
+ _classPrivateMethodInitSpec(this, _ResizeObserverSingleton_brand);
3560
+ _classPrivateFieldInitSpec(this, _listeners, /* @__PURE__ */ new WeakMap());
3561
+ _classPrivateFieldInitSpec(this, _observer, void 0);
3562
+ _classPrivateFieldInitSpec(this, _options, void 0);
3563
+ _classPrivateFieldSet2(_options, this, options);
3564
+ }
3565
+ /**
3566
+ * @param {Element} element
3567
+ * @param {(entry: ResizeObserverEntry) => any} listener
3568
+ */
3569
+ observe(element, listener) {
3570
+ var listeners = _classPrivateFieldGet2(_listeners, this).get(element) || /* @__PURE__ */ new Set();
3571
+ listeners.add(listener);
3572
+ _classPrivateFieldGet2(_listeners, this).set(element, listeners);
3573
+ _assertClassBrand(_ResizeObserverSingleton_brand, this, _getObserver).call(this).observe(element, _classPrivateFieldGet2(_options, this));
3574
+ return () => {
3575
+ var listeners = _classPrivateFieldGet2(_listeners, this).get(element);
3576
+ listeners.delete(listener);
3577
+ if (listeners.size === 0) {
3578
+ _classPrivateFieldGet2(_listeners, this).delete(element);
3579
+ /** @type {ResizeObserver} */ _classPrivateFieldGet2(_observer, this).unobserve(element);
3580
+ }
3581
+ };
3582
+ }
3583
+ };
3584
+ _ResizeObserverSingleton = ResizeObserverSingleton;
3585
+ function _getObserver() {
3586
+ return _classPrivateFieldGet2(_observer, this) ?? _classPrivateFieldSet2(_observer, this, new ResizeObserver(
3587
+ /** @param {any} entries */
3588
+ (entries) => {
3589
+ for (var entry of entries) {
3590
+ _ResizeObserverSingleton.entries.set(entry.target, entry);
3591
+ for (var listener of _classPrivateFieldGet2(_listeners, this).get(entry.target) || []) listener(entry);
3592
+ }
3593
+ }
3594
+ ));
3595
+ }
3596
+ _defineProperty(ResizeObserverSingleton, "entries", /* @__PURE__ */ new WeakMap());
3597
+ //#endregion
3598
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/reactivity/props.js
3599
+ /** @import { Effect, Source } from './types.js' */
3600
+ /**
3601
+ * This function is responsible for synchronizing a possibly bound prop with the inner component state.
3602
+ * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.
3603
+ * @template V
3604
+ * @param {Record<string, unknown>} props
3605
+ * @param {string} key
3606
+ * @param {number} flags
3607
+ * @param {V | (() => V)} [fallback]
3608
+ * @returns {(() => V | ((arg: V) => V) | ((arg: V, mutation: boolean) => V))}
3609
+ */
3610
+ function prop(props, key, flags, fallback) {
3611
+ var runes = !legacy_mode_flag || (flags & 2) !== 0;
3612
+ var bindable = (flags & 8) !== 0;
3613
+ var lazy = (flags & 16) !== 0;
3614
+ var fallback_value = fallback;
3615
+ var fallback_dirty = true;
3616
+ var get_fallback = () => {
3617
+ if (fallback_dirty) {
3618
+ fallback_dirty = false;
3619
+ fallback_value = lazy ? untrack(fallback) : fallback;
3620
+ }
3621
+ return fallback_value;
3622
+ };
3623
+ /** @type {((v: V) => void) | undefined} */
3624
+ let setter;
3625
+ if (bindable) {
3626
+ var is_entry_props = STATE_SYMBOL in props || LEGACY_PROPS in props;
3627
+ setter = get_descriptor(props, key)?.set ?? (is_entry_props && key in props ? (v) => props[key] = v : void 0);
3628
+ }
3629
+ /** @type {V} */
3630
+ var initial_value;
3631
+ var is_store_sub = false;
3632
+ if (bindable) [initial_value, is_store_sub] = capture_store_binding(() => props[key]);
3633
+ else initial_value = props[key];
3634
+ if (initial_value === void 0 && fallback !== void 0) {
3635
+ initial_value = get_fallback();
3636
+ if (setter) {
3637
+ if (runes) props_invalid_value(key);
3638
+ setter(initial_value);
3639
+ }
3640
+ }
3641
+ /** @type {() => V} */
3642
+ var getter;
3643
+ if (runes) getter = () => {
3644
+ var value = props[key];
3645
+ if (value === void 0) return get_fallback();
3646
+ fallback_dirty = true;
3647
+ return value;
3648
+ };
3649
+ else getter = () => {
3650
+ var value = props[key];
3651
+ if (value !== void 0) fallback_value = void 0;
3652
+ return value === void 0 ? fallback_value : value;
3653
+ };
3654
+ if (runes && (flags & 4) === 0) return getter;
3655
+ if (setter) {
3656
+ var legacy_parent = props.$$legacy;
3657
+ return (function(value, mutation) {
3658
+ if (arguments.length > 0) {
3659
+ if (!runes || !mutation || legacy_parent || is_store_sub)
3660
+ /** @type {Function} */ setter(mutation ? getter() : value);
3661
+ return value;
3662
+ }
3663
+ return getter();
3664
+ });
3665
+ }
3666
+ var overridden = false;
3667
+ var d = ((flags & 1) !== 0 ? derived : derived_safe_equal)(() => {
3668
+ overridden = false;
3669
+ return getter();
3670
+ });
3671
+ if (bindable) get(d);
3672
+ var parent_effect = active_effect;
3673
+ return (function(value, mutation) {
3674
+ if (arguments.length > 0) {
3675
+ const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;
3676
+ set(d, new_value);
3677
+ overridden = true;
3678
+ if (fallback_value !== void 0) fallback_value = new_value;
3679
+ return value;
3680
+ }
3681
+ if (is_destroying_effect && overridden || (parent_effect.f & 16384) !== 0) return d.v;
3682
+ return get(d);
3683
+ });
3684
+ }
3685
+ //#endregion
3686
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/legacy/legacy-client.js
3687
+ /** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
3688
+ /**
3689
+ * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
3690
+ *
3691
+ * @deprecated Use this only as a temporary solution to migrate your imperative component code to Svelte 5.
3692
+ *
3693
+ * @template {Record<string, any>} Props
3694
+ * @template {Record<string, any>} Exports
3695
+ * @template {Record<string, any>} Events
3696
+ * @template {Record<string, any>} Slots
3697
+ *
3698
+ * @param {ComponentConstructorOptions<Props> & {
3699
+ * component: ComponentType<SvelteComponent<Props, Events, Slots>> | Component<Props>;
3700
+ * }} options
3701
+ * @returns {SvelteComponent<Props, Events, Slots> & Exports}
3702
+ */
3703
+ function createClassComponent(options) {
3704
+ return new Svelte4Component(options);
3705
+ }
3706
+ var _events = /* @__PURE__ */ new WeakMap();
3707
+ var _instance = /* @__PURE__ */ new WeakMap();
3708
+ /**
3709
+ * Support using the component as both a class and function during the transition period
3710
+ * @typedef {{new (o: ComponentConstructorOptions): SvelteComponent;(...args: Parameters<Component<Record<string, any>>>): ReturnType<Component<Record<string, any>, Record<string, any>>>;}} LegacyComponentType
3711
+ */
3712
+ var Svelte4Component = class {
3713
+ /**
3714
+ * @param {ComponentConstructorOptions & {
3715
+ * component: any;
3716
+ * }} options
3717
+ */
3718
+ constructor(options) {
3719
+ _classPrivateFieldInitSpec(this, _events, void 0);
3720
+ _classPrivateFieldInitSpec(this, _instance, void 0);
3721
+ var sources = /* @__PURE__ */ new Map();
3722
+ /**
3723
+ * @param {string | symbol} key
3724
+ * @param {unknown} value
3725
+ */
3726
+ var add_source = (key, value) => {
3727
+ var s = /* @__PURE__ */ mutable_source(value, false, false);
3728
+ sources.set(key, s);
3729
+ return s;
3730
+ };
3731
+ const props = new Proxy({
3732
+ ...options.props || {},
3733
+ $$events: {}
3734
+ }, {
3735
+ get(target, prop) {
3736
+ return get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
3737
+ },
3738
+ has(target, prop) {
3739
+ if (prop === LEGACY_PROPS) return true;
3740
+ get(sources.get(prop) ?? add_source(prop, Reflect.get(target, prop)));
3741
+ return Reflect.has(target, prop);
3742
+ },
3743
+ set(target, prop, value) {
3744
+ set(sources.get(prop) ?? add_source(prop, value), value);
3745
+ return Reflect.set(target, prop, value);
3746
+ }
3747
+ });
3748
+ _classPrivateFieldSet2(_instance, this, (options.hydrate ? hydrate : mount)(options.component, {
3749
+ target: options.target,
3750
+ anchor: options.anchor,
3751
+ props,
3752
+ context: options.context,
3753
+ intro: options.intro ?? false,
3754
+ recover: options.recover,
3755
+ transformError: options.transformError
3756
+ }));
3757
+ if (!async_mode_flag && (!options?.props?.$$host || options.sync === false)) flushSync();
3758
+ _classPrivateFieldSet2(_events, this, props.$$events);
3759
+ for (const key of Object.keys(_classPrivateFieldGet2(_instance, this))) {
3760
+ if (key === "$set" || key === "$destroy" || key === "$on") continue;
3761
+ define_property(this, key, {
3762
+ get() {
3763
+ return _classPrivateFieldGet2(_instance, this)[key];
3764
+ },
3765
+ set(value) {
3766
+ _classPrivateFieldGet2(_instance, this)[key] = value;
3767
+ },
3768
+ enumerable: true
3769
+ });
3770
+ }
3771
+ _classPrivateFieldGet2(_instance, this).$set = (next) => {
3772
+ Object.assign(props, next);
3773
+ };
3774
+ _classPrivateFieldGet2(_instance, this).$destroy = () => {
3775
+ unmount(_classPrivateFieldGet2(_instance, this));
3776
+ };
3777
+ }
3778
+ /** @param {Record<string, any>} props */
3779
+ $set(props) {
3780
+ _classPrivateFieldGet2(_instance, this).$set(props);
3781
+ }
3782
+ /**
3783
+ * @param {string} event
3784
+ * @param {(...args: any[]) => any} callback
3785
+ * @returns {any}
3786
+ */
3787
+ $on(event, callback) {
3788
+ _classPrivateFieldGet2(_events, this)[event] = _classPrivateFieldGet2(_events, this)[event] || [];
3789
+ /** @param {any[]} args */
3790
+ const cb = (...args) => callback.call(this, ...args);
3791
+ _classPrivateFieldGet2(_events, this)[event].push(cb);
3792
+ return () => {
3793
+ _classPrivateFieldGet2(_events, this)[event] = _classPrivateFieldGet2(_events, this)[event].filter(
3794
+ /** @param {any} fn */
3795
+ (fn) => fn !== cb
3796
+ );
3797
+ };
3798
+ }
3799
+ $destroy() {
3800
+ _classPrivateFieldGet2(_instance, this).$destroy();
3801
+ }
3802
+ };
3803
+ //#endregion
3804
+ //#region ../../../node_modules/.bun/svelte@5.54.0/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
3805
+ /**
3806
+ * @typedef {Object} CustomElementPropDefinition
3807
+ * @property {string} [attribute]
3808
+ * @property {boolean} [reflect]
3809
+ * @property {'String'|'Boolean'|'Number'|'Array'|'Object'} [type]
3810
+ */
3811
+ /** @type {any} */
3812
+ var SvelteElement;
3813
+ if (typeof HTMLElement === "function") SvelteElement = class extends HTMLElement {
3814
+ /**
3815
+ * @param {*} $$componentCtor
3816
+ * @param {*} $$slots
3817
+ * @param {ShadowRootInit | undefined} shadow_root_init
3818
+ */
3819
+ constructor($$componentCtor, $$slots, shadow_root_init) {
3820
+ super();
3821
+ _defineProperty(
3822
+ this,
3823
+ /** The Svelte component constructor */
3824
+ "$$ctor",
3825
+ void 0
3826
+ );
3827
+ _defineProperty(
3828
+ this,
3829
+ /** Slots */
3830
+ "$$s",
3831
+ void 0
3832
+ );
3833
+ _defineProperty(
3834
+ this,
3835
+ /** @type {any} The Svelte component instance */
3836
+ "$$c",
3837
+ void 0
3838
+ );
3839
+ _defineProperty(
3840
+ this,
3841
+ /** Whether or not the custom element is connected */
3842
+ "$$cn",
3843
+ false
3844
+ );
3845
+ _defineProperty(
3846
+ this,
3847
+ /** @type {Record<string, any>} Component props data */
3848
+ "$$d",
3849
+ {}
3850
+ );
3851
+ _defineProperty(
3852
+ this,
3853
+ /** `true` if currently in the process of reflecting component props back to attributes */
3854
+ "$$r",
3855
+ false
3856
+ );
3857
+ _defineProperty(
3858
+ this,
3859
+ /** @type {Record<string, CustomElementPropDefinition>} Props definition (name, reflected, type etc) */
3860
+ "$$p_d",
3861
+ {}
3862
+ );
3863
+ _defineProperty(
3864
+ this,
3865
+ /** @type {Record<string, EventListenerOrEventListenerObject[]>} Event listeners */
3866
+ "$$l",
3867
+ {}
3868
+ );
3869
+ _defineProperty(
3870
+ this,
3871
+ /** @type {Map<EventListenerOrEventListenerObject, Function>} Event listener unsubscribe functions */
3872
+ "$$l_u",
3873
+ /* @__PURE__ */ new Map()
3874
+ );
3875
+ _defineProperty(
3876
+ this,
3877
+ /** @type {any} The managed render effect for reflecting attributes */
3878
+ "$$me",
3879
+ void 0
3880
+ );
3881
+ _defineProperty(
3882
+ this,
3883
+ /** @type {ShadowRoot | null} The ShadowRoot of the custom element */
3884
+ "$$shadowRoot",
3885
+ null
3886
+ );
3887
+ this.$$ctor = $$componentCtor;
3888
+ this.$$s = $$slots;
3889
+ if (shadow_root_init) this.$$shadowRoot = this.attachShadow(shadow_root_init);
3890
+ }
3891
+ /**
3892
+ * @param {string} type
3893
+ * @param {EventListenerOrEventListenerObject} listener
3894
+ * @param {boolean | AddEventListenerOptions} [options]
3895
+ */
3896
+ addEventListener(type, listener, options) {
3897
+ this.$$l[type] = this.$$l[type] || [];
3898
+ this.$$l[type].push(listener);
3899
+ if (this.$$c) {
3900
+ const unsub = this.$$c.$on(type, listener);
3901
+ this.$$l_u.set(listener, unsub);
3902
+ }
3903
+ super.addEventListener(type, listener, options);
3904
+ }
3905
+ /**
3906
+ * @param {string} type
3907
+ * @param {EventListenerOrEventListenerObject} listener
3908
+ * @param {boolean | AddEventListenerOptions} [options]
3909
+ */
3910
+ removeEventListener(type, listener, options) {
3911
+ super.removeEventListener(type, listener, options);
3912
+ if (this.$$c) {
3913
+ const unsub = this.$$l_u.get(listener);
3914
+ if (unsub) {
3915
+ unsub();
3916
+ this.$$l_u.delete(listener);
3917
+ }
3918
+ }
3919
+ }
3920
+ async connectedCallback() {
3921
+ this.$$cn = true;
3922
+ if (!this.$$c) {
3923
+ await Promise.resolve();
3924
+ if (!this.$$cn || this.$$c) return;
3925
+ /** @param {string} name */
3926
+ function create_slot(name) {
3927
+ /**
3928
+ * @param {Element} anchor
3929
+ */
3930
+ return (anchor) => {
3931
+ const slot = create_element("slot");
3932
+ if (name !== "default") slot.name = name;
3933
+ append(anchor, slot);
3934
+ };
3935
+ }
3936
+ /** @type {Record<string, any>} */
3937
+ const $$slots = {};
3938
+ const existing_slots = get_custom_elements_slots(this);
3939
+ for (const name of this.$$s) if (name in existing_slots) if (name === "default" && !this.$$d.children) {
3940
+ this.$$d.children = create_slot(name);
3941
+ $$slots.default = true;
3942
+ } else $$slots[name] = create_slot(name);
3943
+ for (const attribute of this.attributes) {
3944
+ const name = this.$$g_p(attribute.name);
3945
+ if (!(name in this.$$d)) this.$$d[name] = get_custom_element_value(name, attribute.value, this.$$p_d, "toProp");
3946
+ }
3947
+ for (const key in this.$$p_d) if (!(key in this.$$d) && this[key] !== void 0) {
3948
+ this.$$d[key] = this[key];
3949
+ delete this[key];
3950
+ }
3951
+ this.$$c = createClassComponent({
3952
+ component: this.$$ctor,
3953
+ target: this.$$shadowRoot || this,
3954
+ props: {
3955
+ ...this.$$d,
3956
+ $$slots,
3957
+ $$host: this
3958
+ }
3959
+ });
3960
+ this.$$me = effect_root(() => {
3961
+ render_effect(() => {
3962
+ this.$$r = true;
3963
+ for (const key of object_keys(this.$$c)) {
3964
+ if (!this.$$p_d[key]?.reflect) continue;
3965
+ this.$$d[key] = this.$$c[key];
3966
+ const attribute_value = get_custom_element_value(key, this.$$d[key], this.$$p_d, "toAttribute");
3967
+ if (attribute_value == null) this.removeAttribute(this.$$p_d[key].attribute || key);
3968
+ else this.setAttribute(this.$$p_d[key].attribute || key, attribute_value);
3969
+ }
3970
+ this.$$r = false;
3971
+ });
3972
+ });
3973
+ for (const type in this.$$l) for (const listener of this.$$l[type]) {
3974
+ const unsub = this.$$c.$on(type, listener);
3975
+ this.$$l_u.set(listener, unsub);
3976
+ }
3977
+ this.$$l = {};
3978
+ }
3979
+ }
3980
+ /**
3981
+ * @param {string} attr
3982
+ * @param {string} _oldValue
3983
+ * @param {string} newValue
3984
+ */
3985
+ attributeChangedCallback(attr, _oldValue, newValue) {
3986
+ if (this.$$r) return;
3987
+ attr = this.$$g_p(attr);
3988
+ this.$$d[attr] = get_custom_element_value(attr, newValue, this.$$p_d, "toProp");
3989
+ this.$$c?.$set({ [attr]: this.$$d[attr] });
3990
+ }
3991
+ disconnectedCallback() {
3992
+ this.$$cn = false;
3993
+ Promise.resolve().then(() => {
3994
+ if (!this.$$cn && this.$$c) {
3995
+ this.$$c.$destroy();
3996
+ this.$$me();
3997
+ this.$$c = void 0;
3998
+ }
3999
+ });
4000
+ }
4001
+ /**
4002
+ * @param {string} attribute_name
4003
+ */
4004
+ $$g_p(attribute_name) {
4005
+ 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;
4006
+ }
4007
+ };
4008
+ /**
4009
+ * @param {string} prop
4010
+ * @param {any} value
4011
+ * @param {Record<string, CustomElementPropDefinition>} props_definition
4012
+ * @param {'toAttribute' | 'toProp'} [transform]
4013
+ */
4014
+ function get_custom_element_value(prop, value, props_definition, transform) {
4015
+ const type = props_definition[prop]?.type;
4016
+ value = type === "Boolean" && typeof value !== "boolean" ? value != null : value;
4017
+ if (!transform || !props_definition[prop]) return value;
4018
+ else if (transform === "toAttribute") switch (type) {
4019
+ case "Object":
4020
+ case "Array": return value == null ? null : JSON.stringify(value);
4021
+ case "Boolean": return value ? "" : null;
4022
+ case "Number": return value == null ? null : value;
4023
+ default: return value;
4024
+ }
4025
+ else switch (type) {
4026
+ case "Object":
4027
+ case "Array": return value && JSON.parse(value);
4028
+ case "Boolean": return value;
4029
+ case "Number": return value != null ? +value : value;
4030
+ default: return value;
4031
+ }
4032
+ }
4033
+ /**
4034
+ * @param {HTMLElement} element
4035
+ */
4036
+ function get_custom_elements_slots(element) {
4037
+ /** @type {Record<string, true>} */
4038
+ const result = {};
4039
+ element.childNodes.forEach((node) => {
4040
+ result[node.slot || "default"] = true;
4041
+ });
4042
+ return result;
4043
+ }
4044
+ /**
4045
+ * @internal
4046
+ *
4047
+ * Turn a Svelte component into a custom element.
4048
+ * @param {any} Component A Svelte component function
4049
+ * @param {Record<string, CustomElementPropDefinition>} props_definition The props to observe
4050
+ * @param {string[]} slots The slots to create
4051
+ * @param {string[]} exports Explicitly exported values, other than props
4052
+ * @param {ShadowRootInit | undefined} shadow_root_init Options passed to shadow DOM constructor
4053
+ * @param {(ce: new () => HTMLElement) => new () => HTMLElement} [extend]
4054
+ */
4055
+ function create_custom_element(Component, props_definition, slots, exports, shadow_root_init, extend) {
4056
+ let Class = class extends SvelteElement {
4057
+ constructor() {
4058
+ super(Component, slots, shadow_root_init);
4059
+ this.$$p_d = props_definition;
4060
+ }
4061
+ static get observedAttributes() {
4062
+ return object_keys(props_definition).map((key) => (props_definition[key].attribute || key).toLowerCase());
4063
+ }
4064
+ };
4065
+ object_keys(props_definition).forEach((prop) => {
4066
+ define_property(Class.prototype, prop, {
4067
+ get() {
4068
+ return this.$$c && prop in this.$$c ? this.$$c[prop] : this.$$d[prop];
4069
+ },
4070
+ set(value) {
4071
+ value = get_custom_element_value(prop, value, props_definition);
4072
+ this.$$d[prop] = value;
4073
+ var component = this.$$c;
4074
+ if (component) if (get_descriptor(component, prop)?.get) component[prop] = value;
4075
+ else component.$set({ [prop]: value });
4076
+ }
4077
+ });
4078
+ });
4079
+ exports.forEach((property) => {
4080
+ define_property(Class.prototype, property, { get() {
4081
+ return this.$$c?.[property];
4082
+ } });
4083
+ });
4084
+ if (extend) Class = extend(Class);
4085
+ Component.element = Class;
4086
+ return Class;
4087
+ }
4088
+ //#endregion
4089
+ //#region src/print/Print.svelte
4090
+ var root_1 = /* @__PURE__ */ from_html(`<div class="mb-4 prose prose-sm svelte-1fx5wwa"></div>`);
4091
+ var root = /* @__PURE__ */ from_html(`<div class="p-4 print:p-0"><!> <div class="inline-block"><input type="text" placeholder="______________________" class="px-3 py-2 border-b-2 border-gray-400 bg-transparent print:border-black svelte-1fx5wwa" style="border-top: none; border-left: none; border-right: none;" disabled=""/></div></div>`);
4092
+ var $$css = {
4093
+ hash: "svelte-1fx5wwa",
4094
+ code: "\n @media print {input.svelte-1fx5wwa {border-color:black !important;}\n }.prose.svelte-1fx5wwa p {margin:0.5em 0;}.prose.svelte-1fx5wwa strong {font-weight:600;}"
4095
+ };
4096
+ function Print($$anchor, $$props) {
4097
+ push($$props, true);
4098
+ append_styles($$anchor, $$css);
4099
+ let model = prop($$props, "model", 7, null);
4100
+ let prompt = /* @__PURE__ */ state("");
4101
+ user_effect(() => {
4102
+ set(prompt, model()?.prompt || "", true);
4103
+ });
4104
+ var $$exports = {
4105
+ get model() {
4106
+ return model();
4107
+ },
4108
+ set model($$value = null) {
4109
+ model($$value);
4110
+ flushSync();
4111
+ }
4112
+ };
4113
+ var div = root();
4114
+ var node = child(div);
4115
+ var consequent = ($$anchor) => {
4116
+ var div_1 = root_1();
4117
+ html(div_1, () => get(prompt), true);
4118
+ reset(div_1);
4119
+ append($$anchor, div_1);
4120
+ };
4121
+ if_block(node, ($$render) => {
4122
+ if (get(prompt)) $$render(consequent);
4123
+ });
4124
+ next(2);
4125
+ reset(div);
4126
+ append($$anchor, div);
4127
+ return pop($$exports);
4128
+ }
4129
+ create_custom_element(Print, { model: { type: "Object" } }, [], []);
4130
+ //#endregion
4131
+ //#region src/print/index.ts
4132
+ var SvelteElementClass = Print.element;
4133
+ var SimpleClozePrint = class extends SvelteElementClass {
4134
+ constructor(..._args) {
4135
+ super(..._args);
4136
+ _defineProperty(this, "_model", null);
4137
+ }
4138
+ set model(m) {
4139
+ this._model = m;
4140
+ super.model = m;
4141
+ }
4142
+ get model() {
4143
+ return this._model;
4144
+ }
4145
+ };
4146
+ //#endregion
4147
+ export { SimpleClozePrint as default };
4148
+
4149
+ //# sourceMappingURL=index.js.map