@pie-element/simple-cloze 0.1.4-next.6 → 0.1.4-next.8

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