@pie-element/simple-cloze 0.1.4-next.0 → 0.1.4-next.10

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