@pie-element/mc-populated-blank 0.2.13 → 0.3.0-next.4

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 (61) hide show
  1. package/README.md +1 -1
  2. package/configure.js +2 -0
  3. package/dist/author/index.d.ts +0 -1
  4. package/dist/author/index.js +1235 -1092
  5. package/dist/author/index.js.map +1 -1
  6. package/dist/browser/author/index.js +50 -0
  7. package/dist/browser/author/index.js.map +1 -0
  8. package/dist/browser/client-BAfWqkS6.js +2358 -0
  9. package/dist/browser/client-BAfWqkS6.js.map +1 -0
  10. package/dist/browser/controller/index.js +219 -0
  11. package/dist/browser/controller/index.js.map +1 -0
  12. package/dist/browser/delivery/index.js +1059 -0
  13. package/dist/browser/delivery/index.js.map +1 -0
  14. package/dist/browser/layoutLimits-ATKOwLHb.js +42 -0
  15. package/dist/browser/layoutLimits-ATKOwLHb.js.map +1 -0
  16. package/dist/browser/print/index.js +125 -0
  17. package/dist/browser/print/index.js.map +1 -0
  18. package/dist/controller/defaults.d.ts +0 -2
  19. package/dist/controller/index.d.ts +0 -3
  20. package/dist/controller/index.js +0 -2
  21. package/dist/controller/index.js.map +1 -1
  22. package/dist/delivery/computeAudioMode.d.ts +0 -1
  23. package/dist/delivery/computeChoiceCorrectness.d.ts +0 -1
  24. package/dist/delivery/computeDisplayState.d.ts +0 -1
  25. package/dist/delivery/computeLayoutProfile.d.ts +0 -1
  26. package/dist/delivery/computeLayoutStyle.d.ts +0 -2
  27. package/dist/delivery/index.d.ts +0 -1
  28. package/dist/delivery/index.js +1527 -1584
  29. package/dist/delivery/index.js.map +1 -1
  30. package/dist/delivery/variant-css-map.d.ts +0 -1
  31. package/dist/index.d.ts +0 -1
  32. package/dist/index.iife.d.ts +0 -3
  33. package/dist/index.iife.js +14 -15
  34. package/dist/index.js +1527 -1584
  35. package/dist/index.js.map +1 -1
  36. package/dist/print/index.d.ts +0 -1
  37. package/dist/print/index.js +1414 -1270
  38. package/dist/print/index.js.map +1 -1
  39. package/dist/runtime-support.d.ts +12 -0
  40. package/dist/runtime-support.js +14 -0
  41. package/dist/runtime-support.js.map +1 -0
  42. package/dist/shared/layoutLimits.d.ts +0 -1
  43. package/dist/shared/types.d.ts +9 -2
  44. package/module/print.js +2312 -0
  45. package/module/print.js.map +1 -0
  46. package/package.json +40 -8
  47. package/dist/author/index.d.ts.map +0 -1
  48. package/dist/controller/defaults.d.ts.map +0 -1
  49. package/dist/controller/index.d.ts.map +0 -1
  50. package/dist/delivery/computeAudioMode.d.ts.map +0 -1
  51. package/dist/delivery/computeChoiceCorrectness.d.ts.map +0 -1
  52. package/dist/delivery/computeDisplayState.d.ts.map +0 -1
  53. package/dist/delivery/computeLayoutProfile.d.ts.map +0 -1
  54. package/dist/delivery/computeLayoutStyle.d.ts.map +0 -1
  55. package/dist/delivery/index.d.ts.map +0 -1
  56. package/dist/delivery/variant-css-map.d.ts.map +0 -1
  57. package/dist/index.d.ts.map +0 -1
  58. package/dist/index.iife.d.ts.map +0 -1
  59. package/dist/print/index.d.ts.map +0 -1
  60. package/dist/shared/layoutLimits.d.ts.map +0 -1
  61. package/dist/shared/types.d.ts.map +0 -1
@@ -1,14 +1,14 @@
1
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/disclose-version.js
1
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/disclose-version.js
2
2
  if (typeof window !== "undefined") {
3
3
  var _window$__svelte, _window;
4
4
  ((_window$__svelte = (_window = window).__svelte ?? (_window.__svelte = {})).v ?? (_window$__svelte.v = /* @__PURE__ */ new Set())).add("5");
5
5
  }
6
6
  //#endregion
7
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/constants.js
7
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/constants.js
8
8
  var HYDRATION_ERROR = {};
9
- var UNINITIALIZED = Symbol();
9
+ var UNINITIALIZED = Symbol("uninitialized");
10
10
  //#endregion
11
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/shared/utils.js
11
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/shared/utils.js
12
12
  var is_array = Array.isArray;
13
13
  var index_of = Array.prototype.indexOf;
14
14
  var includes = Array.prototype.includes;
@@ -44,7 +44,7 @@ function deferred() {
44
44
  };
45
45
  }
46
46
  //#endregion
47
- //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
47
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/typeof.js
48
48
  function _typeof(o) {
49
49
  "@babel/helpers - typeof";
50
50
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -54,7 +54,7 @@ function _typeof(o) {
54
54
  }, _typeof(o);
55
55
  }
56
56
  //#endregion
57
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
57
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPrimitive.js
58
58
  function toPrimitive(t, r) {
59
59
  if ("object" != _typeof(t) || !t) return t;
60
60
  var e = t[Symbol.toPrimitive];
@@ -66,13 +66,13 @@ function toPrimitive(t, r) {
66
66
  return ("string" === r ? String : Number)(t);
67
67
  }
68
68
  //#endregion
69
- //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
69
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/toPropertyKey.js
70
70
  function toPropertyKey(t) {
71
71
  var i = toPrimitive(t, "string");
72
72
  return "symbol" == _typeof(i) ? i : i + "";
73
73
  }
74
74
  //#endregion
75
- //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
75
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/defineProperty.js
76
76
  function _defineProperty(e, r, t) {
77
77
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
78
78
  value: t,
@@ -108,6 +108,10 @@ var REACTION_IS_UPDATING = 1 << 21;
108
108
  var ERROR_VALUE = 1 << 23;
109
109
  var STATE_SYMBOL = Symbol("$state");
110
110
  var LEGACY_PROPS = Symbol("legacy props");
111
+ var ATTRIBUTES_CACHE = Symbol("attributes");
112
+ var CLASS_CACHE = Symbol("class");
113
+ var STYLE_CACHE = Symbol("style");
114
+ var TEXT_CACHE = Symbol("text");
111
115
  /** allow users to ignore aborted signal errors if `reason.name === 'StaleReactionError` */
112
116
  var STALE_REACTION = new class StaleReactionError extends Error {
113
117
  constructor(..._args) {
@@ -187,7 +191,7 @@ function svelte_boundary_reset_noop() {
187
191
  console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`);
188
192
  }
189
193
  //#endregion
190
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/hydration.js
194
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/hydration.js
191
195
  /** @import { TemplateNode } from '#client' */
192
196
  /**
193
197
  * Use this variable to guard everything related to hydration code so it can be treeshaken out
@@ -246,7 +250,7 @@ function skip_nodes(remove = true) {
246
250
  }
247
251
  }
248
252
  //#endregion
249
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/equality.js
253
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/equality.js
250
254
  /** @import { Equals } from '#client' */
251
255
  /** @type {Equals} */
252
256
  function equals(value) {
@@ -265,13 +269,13 @@ function safe_equals(value) {
265
269
  return !safe_not_equal(value, this.v);
266
270
  }
267
271
  //#endregion
268
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/flags/index.js
272
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/flags/index.js
269
273
  /** True if experimental.async=true */
270
274
  var async_mode_flag = false;
271
275
  /** True if we're not certain that we only have Svelte 5 code in the compilation */
272
276
  var legacy_mode_flag = false;
273
277
  //#endregion
274
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/context.js
278
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/context.js
275
279
  /** @import { ComponentContext, DevStackEntry, Effect } from '#client' */
276
280
  /** @type {ComponentContext | null} */
277
281
  var component_context = null;
@@ -323,7 +327,7 @@ function is_runes() {
323
327
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
324
328
  }
325
329
  //#endregion
326
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/task.js
330
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/task.js
327
331
  /** @type {Array<() => void>} */
328
332
  var micro_tasks = [];
329
333
  function run_micro_tasks() {
@@ -366,6 +370,7 @@ function handle_error(error) {
366
370
  * @param {Effect | null} effect
367
371
  */
368
372
  function invoke_error_boundary(error, effect) {
373
+ if (effect !== null && (effect.f & 16384) !== 0) return;
369
374
  while (effect !== null) {
370
375
  if ((effect.f & 128) !== 0) {
371
376
  if ((effect.f & 32768) === 0) throw error;
@@ -381,7 +386,7 @@ function invoke_error_boundary(error, effect) {
381
386
  throw error;
382
387
  }
383
388
  //#endregion
384
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/status.js
389
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/status.js
385
390
  /** @import { Derived, Signal } from '#client' */
386
391
  var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
387
392
  /**
@@ -400,7 +405,7 @@ function update_derived_status(derived) {
400
405
  else set_signal_status(derived, MAYBE_DIRTY);
401
406
  }
402
407
  //#endregion
403
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/utils.js
408
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/utils.js
404
409
  /** @import { Derived, Effect, Value } from '#client' */
405
410
  /**
406
411
  * @param {Value[] | null} deps
@@ -428,7 +433,7 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
428
433
  set_signal_status(effect, CLEAN);
429
434
  }
430
435
  //#endregion
431
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/store.js
436
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/store.js
432
437
  /**
433
438
  * We set this to `true` when updating a store so that we correctly
434
439
  * schedule effects if the update takes place inside a `$:` effect
@@ -458,1201 +463,1331 @@ function capture_store_binding(fn) {
458
463
  }
459
464
  }
460
465
  //#endregion
461
- //#region \0@oxc-project+runtime@0.129.0/helpers/checkPrivateRedeclaration.js
466
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
467
+ /**
468
+ * @template T
469
+ * @param {() => T} fn
470
+ */
471
+ function without_reactive_context(fn) {
472
+ var previous_reaction = active_reaction;
473
+ var previous_effect = active_effect;
474
+ set_active_reaction(null);
475
+ set_active_effect(null);
476
+ try {
477
+ return fn();
478
+ } finally {
479
+ set_active_reaction(previous_reaction);
480
+ set_active_effect(previous_effect);
481
+ }
482
+ }
483
+ //#endregion
484
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/reactivity/create-subscriber.js
485
+ /**
486
+ * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
487
+ * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
488
+ *
489
+ * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
490
+ * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
491
+ *
492
+ * If `start` returns a cleanup function, it will be called when the effect is destroyed.
493
+ *
494
+ * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
495
+ * are active, and the returned teardown function will only be called when all effects are destroyed.
496
+ *
497
+ * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
498
+ *
499
+ * ```js
500
+ * import { createSubscriber } from 'svelte/reactivity';
501
+ * import { on } from 'svelte/events';
502
+ *
503
+ * export class MediaQuery {
504
+ * #query;
505
+ * #subscribe;
506
+ *
507
+ * constructor(query) {
508
+ * this.#query = window.matchMedia(`(${query})`);
509
+ *
510
+ * this.#subscribe = createSubscriber((update) => {
511
+ * // when the `change` event occurs, re-run any effects that read `this.current`
512
+ * const off = on(this.#query, 'change', update);
513
+ *
514
+ * // stop listening when all the effects are destroyed
515
+ * return () => off();
516
+ * });
517
+ * }
518
+ *
519
+ * get current() {
520
+ * // This makes the getter reactive, if read in an effect
521
+ * this.#subscribe();
522
+ *
523
+ * // Return the current state of the query, whether or not we're in an effect
524
+ * return this.#query.matches;
525
+ * }
526
+ * }
527
+ * ```
528
+ * @param {(update: () => void) => (() => void) | void} start
529
+ * @since 5.7.0
530
+ */
531
+ function createSubscriber(start) {
532
+ let subscribers = 0;
533
+ let version = source(0);
534
+ /** @type {(() => void) | void} */
535
+ let stop;
536
+ return () => {
537
+ if (effect_tracking()) {
538
+ get(version);
539
+ render_effect(() => {
540
+ if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
541
+ subscribers += 1;
542
+ return () => {
543
+ queue_micro_task(() => {
544
+ subscribers -= 1;
545
+ if (subscribers === 0) {
546
+ stop?.();
547
+ stop = void 0;
548
+ increment(version);
549
+ }
550
+ });
551
+ };
552
+ });
553
+ }
554
+ };
555
+ }
556
+ //#endregion
557
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/checkPrivateRedeclaration.js
462
558
  function _checkPrivateRedeclaration(e, t) {
463
559
  if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
464
560
  }
465
561
  //#endregion
466
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateMethodInitSpec.js
562
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateMethodInitSpec.js
467
563
  function _classPrivateMethodInitSpec(e, a) {
468
564
  _checkPrivateRedeclaration(e, a), a.add(e);
469
565
  }
470
566
  //#endregion
471
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateFieldInitSpec.js
567
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldInitSpec.js
472
568
  function _classPrivateFieldInitSpec(e, t, a) {
473
569
  _checkPrivateRedeclaration(e, t), t.set(e, a);
474
570
  }
475
571
  //#endregion
476
- //#region \0@oxc-project+runtime@0.129.0/helpers/assertClassBrand.js
572
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/assertClassBrand.js
477
573
  function _assertClassBrand(e, t, n) {
478
574
  if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
479
575
  throw new TypeError("Private element is not present on this object");
480
576
  }
481
577
  //#endregion
482
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateFieldGet2.js
483
- function _classPrivateFieldGet2(s, a) {
484
- return s.get(_assertClassBrand(s, a));
485
- }
486
- //#endregion
487
- //#region \0@oxc-project+runtime@0.129.0/helpers/classPrivateFieldSet2.js
578
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldSet2.js
488
579
  function _classPrivateFieldSet2(s, a, r) {
489
580
  return s.set(_assertClassBrand(s, a), r), r;
490
581
  }
491
582
  //#endregion
492
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/batch.js
493
- /** @import { Fork } from 'svelte' */
494
- /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
495
- var _Batch;
496
- /** @type {Set<Batch>} */
497
- var batches = /* @__PURE__ */ new Set();
498
- /** @type {Batch | null} */
499
- var current_batch = null;
500
- /**
501
- * When time travelling (i.e. working in one batch, while other batches
502
- * still have ongoing work), we ignore the real values of affected
503
- * signals in favour of their values within the batch
504
- * @type {Map<Value, any> | null}
505
- */
506
- var batch_values = null;
507
- /** @type {Effect | null} */
508
- var last_scheduled_effect = null;
509
- var is_flushing_sync = false;
510
- var is_processing = false;
583
+ //#region \0@oxc-project+runtime@0.139.0/helpers/esm/classPrivateFieldGet2.js
584
+ function _classPrivateFieldGet2(s, a) {
585
+ return s.get(_assertClassBrand(s, a));
586
+ }
587
+ //#endregion
588
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
589
+ /** @import { Effect, Source, TemplateNode, } from '#client' */
511
590
  /**
512
- * During traversal, this is an array. Newly created effects are (if not immediately
513
- * executed) pushed to this array, rather than going through the scheduling
514
- * rigamarole that would cause another turn of the flush loop.
515
- * @type {Effect[] | null}
591
+ * @typedef {{
592
+ * onerror?: ((error: unknown, reset: () => void) => void) | null;
593
+ * failed?: ((anchor: Node, error: () => unknown, reset: () => () => void) => void) | null;
594
+ * pending?: ((anchor: Node) => void) | null;
595
+ * }} BoundaryProps
516
596
  */
517
- var collected_effects = null;
597
+ var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
518
598
  /**
519
- * An array of effects that are marked during traversal as a result of a `set`
520
- * (not `internal_set`) call. These will be added to the next batch and
521
- * trigger another `batch.process()`
522
- * @type {Effect[] | null}
523
- * @deprecated when we get rid of legacy mode and stores, we can get rid of this
599
+ * @param {TemplateNode} node
600
+ * @param {BoundaryProps} props
601
+ * @param {((anchor: Node) => void)} children
602
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
603
+ * @returns {void}
524
604
  */
525
- var legacy_updates = null;
526
- var flush_count = 0;
527
- var uid = 1;
528
- var _commit_callbacks = /* @__PURE__ */ new WeakMap();
529
- var _discard_callbacks = /* @__PURE__ */ new WeakMap();
530
- var _fork_commit_callbacks = /* @__PURE__ */ new WeakMap();
531
- var _pending = /* @__PURE__ */ new WeakMap();
532
- var _blocking_pending = /* @__PURE__ */ new WeakMap();
533
- var _deferred = /* @__PURE__ */ new WeakMap();
534
- var _roots = /* @__PURE__ */ new WeakMap();
535
- var _new_effects = /* @__PURE__ */ new WeakMap();
605
+ function boundary(node, props, children, transform_error) {
606
+ new Boundary(node, props, children, transform_error);
607
+ }
608
+ var _anchor = /* @__PURE__ */ new WeakMap();
609
+ var _hydrate_open = /* @__PURE__ */ new WeakMap();
610
+ var _props = /* @__PURE__ */ new WeakMap();
611
+ var _children = /* @__PURE__ */ new WeakMap();
612
+ var _effect = /* @__PURE__ */ new WeakMap();
613
+ var _main_effect = /* @__PURE__ */ new WeakMap();
614
+ var _pending_effect = /* @__PURE__ */ new WeakMap();
615
+ var _failed_effect = /* @__PURE__ */ new WeakMap();
616
+ var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
617
+ var _local_pending_count = /* @__PURE__ */ new WeakMap();
618
+ var _pending_count = /* @__PURE__ */ new WeakMap();
619
+ var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
536
620
  var _dirty_effects$1 = /* @__PURE__ */ new WeakMap();
537
621
  var _maybe_dirty_effects$1 = /* @__PURE__ */ new WeakMap();
538
- var _skipped_branches = /* @__PURE__ */ new WeakMap();
539
- var _unskipped_branches = /* @__PURE__ */ new WeakMap();
540
- var _decrement_queued = /* @__PURE__ */ new WeakMap();
541
- var _blockers = /* @__PURE__ */ new WeakMap();
542
- var _Batch_brand = /* @__PURE__ */ new WeakSet();
543
- var Batch = class Batch {
544
- constructor() {
545
- _classPrivateMethodInitSpec(this, _Batch_brand);
546
- _defineProperty(this, "id", uid++);
622
+ var _effect_pending = /* @__PURE__ */ new WeakMap();
623
+ var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
624
+ var _Boundary_brand = /* @__PURE__ */ new WeakSet();
625
+ var Boundary = class {
626
+ /**
627
+ * @param {TemplateNode} node
628
+ * @param {BoundaryProps} props
629
+ * @param {((anchor: Node) => void)} children
630
+ * @param {((error: unknown) => unknown) | undefined} [transform_error]
631
+ */
632
+ constructor(node, props, children, transform_error) {
633
+ _classPrivateMethodInitSpec(this, _Boundary_brand);
547
634
  _defineProperty(
548
635
  this,
549
- /**
550
- * The current values of any signals that are updated in this batch.
551
- * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
552
- * They keys of this map are identical to `this.#previous`
553
- * @type {Map<Value, [any, boolean]>}
554
- */
555
- "current",
556
- /* @__PURE__ */ new Map()
636
+ /** @type {Boundary | null} */
637
+ "parent",
638
+ void 0
557
639
  );
640
+ _defineProperty(this, "is_pending", false);
558
641
  _defineProperty(
559
642
  this,
560
643
  /**
561
- * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
562
- * They keys of this map are identical to `this.#current`
563
- * @type {Map<Value, any>}
644
+ * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
645
+ * Inherited from parent boundary, or defaults to identity.
646
+ * @type {(error: unknown) => unknown}
564
647
  */
565
- "previous",
566
- /* @__PURE__ */ new Map()
648
+ "transform_error",
649
+ void 0
567
650
  );
568
- _classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
569
- _classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
570
- _classPrivateFieldInitSpec(this, _fork_commit_callbacks, /* @__PURE__ */ new Set());
571
- _classPrivateFieldInitSpec(this, _pending, /* @__PURE__ */ new Map());
572
- _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
573
- _classPrivateFieldInitSpec(this, _deferred, null);
574
- _classPrivateFieldInitSpec(this, _roots, []);
575
- _classPrivateFieldInitSpec(this, _new_effects, []);
651
+ _classPrivateFieldInitSpec(this, _anchor, void 0);
652
+ _classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
653
+ _classPrivateFieldInitSpec(this, _props, void 0);
654
+ _classPrivateFieldInitSpec(this, _children, void 0);
655
+ _classPrivateFieldInitSpec(this, _effect, void 0);
656
+ _classPrivateFieldInitSpec(this, _main_effect, null);
657
+ _classPrivateFieldInitSpec(this, _pending_effect, null);
658
+ _classPrivateFieldInitSpec(this, _failed_effect, null);
659
+ _classPrivateFieldInitSpec(this, _offscreen_fragment, null);
660
+ _classPrivateFieldInitSpec(this, _local_pending_count, 0);
661
+ _classPrivateFieldInitSpec(this, _pending_count, 0);
662
+ _classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
576
663
  _classPrivateFieldInitSpec(this, _dirty_effects$1, /* @__PURE__ */ new Set());
577
664
  _classPrivateFieldInitSpec(this, _maybe_dirty_effects$1, /* @__PURE__ */ new Set());
578
- _classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
579
- _classPrivateFieldInitSpec(this, _unskipped_branches, /* @__PURE__ */ new Set());
580
- _defineProperty(this, "is_fork", false);
581
- _classPrivateFieldInitSpec(this, _decrement_queued, false);
582
- _classPrivateFieldInitSpec(this, _blockers, /* @__PURE__ */ new Set());
665
+ _classPrivateFieldInitSpec(this, _effect_pending, null);
666
+ _classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
667
+ _classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
668
+ return () => {
669
+ _classPrivateFieldSet2(_effect_pending, this, null);
670
+ };
671
+ }));
672
+ _classPrivateFieldSet2(_anchor, this, node);
673
+ _classPrivateFieldSet2(_props, this, props);
674
+ _classPrivateFieldSet2(_children, this, (anchor) => {
675
+ var effect = active_effect;
676
+ effect.b = this;
677
+ effect.f |= 128;
678
+ children(anchor);
679
+ });
680
+ this.parent = active_effect.b;
681
+ this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
682
+ _classPrivateFieldSet2(_effect, this, block(() => {
683
+ if (hydrating) {
684
+ const comment = _classPrivateFieldGet2(_hydrate_open, this);
685
+ hydrate_next();
686
+ const server_rendered_pending = comment.data === "[!";
687
+ if (comment.data.startsWith("[?")) {
688
+ const serialized_error = JSON.parse(comment.data.slice(2));
689
+ _assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
690
+ } else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
691
+ else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
692
+ } else _assertClassBrand(_Boundary_brand, this, _render).call(this);
693
+ }, flags));
694
+ if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
583
695
  }
584
696
  /**
585
- * Add an effect to the #skipped_branches map and reset its children
697
+ * Defer an effect inside a pending boundary until the boundary resolves
586
698
  * @param {Effect} effect
587
699
  */
588
- skip_effect(effect) {
589
- if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
590
- d: [],
591
- m: []
592
- });
593
- _classPrivateFieldGet2(_unskipped_branches, this).delete(effect);
594
- }
595
- /**
596
- * Remove an effect from the #skipped_branches map and reschedule
597
- * any tracked dirty/maybe_dirty child effects
598
- * @param {Effect} effect
599
- * @param {(e: Effect) => void} callback
600
- */
601
- unskip_effect(effect, callback = (e) => this.schedule(e)) {
602
- var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
603
- if (tracked) {
604
- _classPrivateFieldGet2(_skipped_branches, this).delete(effect);
605
- for (var e of tracked.d) {
606
- set_signal_status(e, DIRTY);
607
- callback(e);
608
- }
609
- for (e of tracked.m) {
610
- set_signal_status(e, MAYBE_DIRTY);
611
- callback(e);
612
- }
613
- }
614
- _classPrivateFieldGet2(_unskipped_branches, this).add(effect);
615
- }
616
- /**
617
- * Associate a change to a given source with the current
618
- * batch, noting its previous and current values
619
- * @param {Value} source
620
- * @param {any} value
621
- * @param {boolean} [is_derived]
622
- */
623
- capture(source, value, is_derived = false) {
624
- if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
625
- if ((source.f & 8388608) === 0) {
626
- this.current.set(source, [value, is_derived]);
627
- batch_values?.set(source, value);
628
- }
629
- if (!this.is_fork) source.v = value;
630
- }
631
- activate() {
632
- current_batch = this;
633
- }
634
- deactivate() {
635
- current_batch = null;
636
- batch_values = null;
637
- }
638
- flush() {
639
- try {
640
- is_processing = true;
641
- current_batch = this;
642
- _assertClassBrand(_Batch_brand, this, _process).call(this);
643
- } finally {
644
- flush_count = 0;
645
- last_scheduled_effect = null;
646
- collected_effects = null;
647
- legacy_updates = null;
648
- is_processing = false;
649
- current_batch = null;
650
- batch_values = null;
651
- old_values.clear();
652
- }
653
- }
654
- discard() {
655
- for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
656
- _classPrivateFieldGet2(_discard_callbacks, this).clear();
657
- _classPrivateFieldGet2(_fork_commit_callbacks, this).clear();
658
- batches.delete(this);
700
+ defer_effect(effect) {
701
+ defer_effect(effect, _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
659
702
  }
660
703
  /**
661
- * @param {Effect} effect
704
+ * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
705
+ * @returns {boolean}
662
706
  */
663
- register_created_effect(effect) {
664
- _classPrivateFieldGet2(_new_effects, this).push(effect);
707
+ is_rendered() {
708
+ return !this.is_pending && (!this.parent || this.parent.is_rendered());
665
709
  }
666
- /**
667
- * @param {boolean} blocking
668
- * @param {Effect} effect
669
- */
670
- increment(blocking, effect) {
671
- let pending_count = _classPrivateFieldGet2(_pending, this).get(effect) ?? 0;
672
- _classPrivateFieldGet2(_pending, this).set(effect, pending_count + 1);
673
- if (blocking) {
674
- let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
675
- _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
676
- }
710
+ has_pending_snippet() {
711
+ return !!_classPrivateFieldGet2(_props, this).pending;
677
712
  }
678
713
  /**
679
- * @param {boolean} blocking
680
- * @param {Effect} effect
681
- * @param {boolean} skip - whether to skip updates (because this is triggered by a stale reaction)
714
+ * Update the source that powers `$effect.pending()` inside this boundary,
715
+ * and controls when the current `pending` snippet (if any) is removed.
716
+ * Do not call from inside the class
717
+ * @param {1 | -1} d
718
+ * @param {Batch} batch
682
719
  */
683
- decrement(blocking, effect, skip) {
684
- let pending_count = _classPrivateFieldGet2(_pending, this).get(effect) ?? 0;
685
- if (pending_count === 1) _classPrivateFieldGet2(_pending, this).delete(effect);
686
- else _classPrivateFieldGet2(_pending, this).set(effect, pending_count - 1);
687
- if (blocking) {
688
- let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
689
- if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
690
- else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
691
- }
692
- if (_classPrivateFieldGet2(_decrement_queued, this) || skip) return;
693
- _classPrivateFieldSet2(_decrement_queued, this, true);
720
+ update_pending_count(d, batch) {
721
+ _assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
722
+ _classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
723
+ if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
724
+ _classPrivateFieldSet2(_pending_count_update_queued, this, true);
694
725
  queue_micro_task(() => {
695
- _classPrivateFieldSet2(_decrement_queued, this, false);
696
- this.flush();
726
+ _classPrivateFieldSet2(_pending_count_update_queued, this, false);
727
+ if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
697
728
  });
698
729
  }
699
- /**
700
- * @param {Set<Effect>} dirty_effects
701
- * @param {Set<Effect>} maybe_dirty_effects
702
- */
703
- transfer_effects(dirty_effects, maybe_dirty_effects) {
704
- for (const e of dirty_effects) _classPrivateFieldGet2(_dirty_effects$1, this).add(e);
705
- for (const e of maybe_dirty_effects) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(e);
706
- dirty_effects.clear();
707
- maybe_dirty_effects.clear();
708
- }
709
- /** @param {(batch: Batch) => void} fn */
710
- oncommit(fn) {
711
- _classPrivateFieldGet2(_commit_callbacks, this).add(fn);
712
- }
713
- /** @param {(batch: Batch) => void} fn */
714
- ondiscard(fn) {
715
- _classPrivateFieldGet2(_discard_callbacks, this).add(fn);
716
- }
717
- /** @param {(batch: Batch) => void} fn */
718
- on_fork_commit(fn) {
719
- _classPrivateFieldGet2(_fork_commit_callbacks, this).add(fn);
720
- }
721
- run_fork_commit_callbacks() {
722
- for (const fn of _classPrivateFieldGet2(_fork_commit_callbacks, this)) fn(this);
723
- _classPrivateFieldGet2(_fork_commit_callbacks, this).clear();
724
- }
725
- settled() {
726
- return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
730
+ get_effect_pending() {
731
+ _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
732
+ return get(_classPrivateFieldGet2(_effect_pending, this));
727
733
  }
728
- static ensure() {
729
- if (current_batch === null) {
730
- const batch = current_batch = new Batch();
731
- if (!is_processing) {
732
- batches.add(current_batch);
733
- if (!is_flushing_sync) queue_micro_task(() => {
734
- if (current_batch !== batch) return;
735
- batch.flush();
736
- });
737
- }
738
- }
739
- return current_batch;
734
+ /** @param {unknown} error */
735
+ error(error) {
736
+ if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
737
+ if (current_batch?.is_fork) {
738
+ if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
739
+ if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
740
+ if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
741
+ current_batch.oncommit(() => {
742
+ _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
743
+ });
744
+ } else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
740
745
  }
741
- apply() {
742
- if (!async_mode_flag || !this.is_fork && batches.size === 1) {
743
- batch_values = null;
744
- return;
745
- }
746
- batch_values = /* @__PURE__ */ new Map();
747
- for (const [source, [value]] of this.current) batch_values.set(source, value);
748
- for (const batch of batches) {
749
- if (batch === this || batch.is_fork) continue;
750
- var intersects = false;
751
- var differs = false;
752
- if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
753
- if (is_derived) continue;
754
- intersects || (intersects = this.current.has(source));
755
- differs || (differs = !this.current.has(source));
756
- }
757
- if (intersects && differs) _classPrivateFieldGet2(_blockers, this).add(batch);
758
- else for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
759
- }
746
+ };
747
+ function _hydrate_resolved_content() {
748
+ try {
749
+ _classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
750
+ } catch (error) {
751
+ this.error(error);
760
752
  }
761
- /**
762
- *
763
- * @param {Effect} effect
764
- */
765
- schedule(effect) {
766
- last_scheduled_effect = effect;
767
- if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
768
- effect.b.defer_effect(effect);
753
+ }
754
+ /**
755
+ * @param {unknown} error The deserialized error from the server's hydration comment
756
+ */
757
+ function _hydrate_failed_content(error) {
758
+ const failed = _classPrivateFieldGet2(_props, this).failed;
759
+ const { reset, invoke_onerror } = _assertClassBrand(_Boundary_brand, this, _create_reset).call(this, error);
760
+ queue_micro_task(invoke_onerror);
761
+ if (!failed) return;
762
+ _classPrivateFieldSet2(_failed_effect, this, branch(() => {
763
+ failed(_classPrivateFieldGet2(_anchor, this), () => error, () => reset);
764
+ }));
765
+ }
766
+ /**
767
+ * Creates the `reset` function for a failed boundary, along with a function
768
+ * that invokes `onerror` with it (if provided)
769
+ * @param {unknown} error
770
+ * @returns {{ reset: () => void, invoke_onerror: () => void }}
771
+ */
772
+ function _create_reset(error) {
773
+ var did_reset = false;
774
+ var calling_on_error = false;
775
+ const reset = () => {
776
+ if (did_reset) {
777
+ svelte_boundary_reset_noop();
769
778
  return;
770
779
  }
771
- var e = effect;
772
- while (e.parent !== null) {
773
- e = e.parent;
774
- var flags = e.f;
775
- if (collected_effects !== null && e === active_effect) {
776
- if (async_mode_flag) return;
777
- if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
778
- }
779
- if ((flags & 96) !== 0) {
780
- if ((flags & 1024) === 0) return;
781
- e.f ^= CLEAN;
782
- }
780
+ did_reset = true;
781
+ if (calling_on_error) svelte_boundary_reset_onerror();
782
+ if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
783
+ _classPrivateFieldSet2(_failed_effect, this, null);
784
+ });
785
+ _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
786
+ _assertClassBrand(_Boundary_brand, this, _render).call(this);
787
+ });
788
+ };
789
+ const invoke_onerror = () => {
790
+ try {
791
+ calling_on_error = true;
792
+ _classPrivateFieldGet2(_props, this).onerror?.(error, reset);
793
+ calling_on_error = false;
794
+ } catch (err) {
795
+ invoke_error_boundary(err, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
783
796
  }
784
- _classPrivateFieldGet2(_roots, this).push(e);
785
- }
786
- };
787
- _Batch = Batch;
788
- function _is_deferred() {
789
- return this.is_fork || _classPrivateFieldGet2(_blocking_pending, this).size > 0;
797
+ };
798
+ return {
799
+ reset,
800
+ invoke_onerror
801
+ };
790
802
  }
791
- function _is_blocked() {
792
- for (const batch of _classPrivateFieldGet2(_blockers, this)) for (const effect of _classPrivateFieldGet2(_blocking_pending, batch).keys()) {
793
- var skipped = false;
794
- var e = effect;
795
- while (e.parent !== null) {
796
- if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
797
- skipped = true;
798
- break;
799
- }
800
- e = e.parent;
803
+ function _hydrate_pending_content() {
804
+ const pending = _classPrivateFieldGet2(_props, this).pending;
805
+ if (!pending) return;
806
+ this.is_pending = true;
807
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
808
+ queue_micro_task(() => {
809
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
810
+ var anchor = create_text();
811
+ fragment.append(anchor);
812
+ _classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
813
+ return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
814
+ }));
815
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
816
+ _classPrivateFieldGet2(_anchor, this).before(fragment);
817
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
818
+ pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
819
+ _classPrivateFieldSet2(_pending_effect, this, null);
820
+ });
821
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
801
822
  }
802
- if (!skipped) return true;
803
- }
804
- return false;
823
+ });
805
824
  }
806
- function _process() {
807
- if (flush_count++ > 1e3) {
808
- batches.delete(this);
809
- infinite_loop_guard();
810
- }
811
- if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
812
- for (const e of _classPrivateFieldGet2(_dirty_effects$1, this)) {
813
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).delete(e);
814
- set_signal_status(e, DIRTY);
815
- this.schedule(e);
816
- }
817
- for (const e of _classPrivateFieldGet2(_maybe_dirty_effects$1, this)) {
818
- set_signal_status(e, MAYBE_DIRTY);
819
- this.schedule(e);
820
- }
821
- }
822
- const roots = _classPrivateFieldGet2(_roots, this);
823
- _classPrivateFieldSet2(_roots, this, []);
824
- this.apply();
825
- /** @type {Effect[]} */
826
- var effects = collected_effects = [];
827
- /** @type {Effect[]} */
828
- var render_effects = [];
829
- /**
830
- * @type {Effect[]}
831
- * @deprecated when we get rid of legacy mode and stores, we can get rid of this
832
- */
833
- var updates = legacy_updates = [];
834
- for (const root of roots) try {
835
- _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
836
- } catch (e) {
837
- reset_all(root);
838
- throw e;
839
- }
840
- current_batch = null;
841
- if (updates.length > 0) {
842
- var batch = _Batch.ensure();
843
- for (const e of updates) batch.schedule(e);
844
- }
845
- collected_effects = null;
846
- legacy_updates = null;
847
- if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this) || _assertClassBrand(_Batch_brand, this, _is_blocked).call(this)) {
848
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
849
- _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
850
- for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
851
- } else {
852
- if (_classPrivateFieldGet2(_pending, this).size === 0) batches.delete(this);
853
- _classPrivateFieldGet2(_dirty_effects$1, this).clear();
854
- _classPrivateFieldGet2(_maybe_dirty_effects$1, this).clear();
855
- for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
856
- _classPrivateFieldGet2(_commit_callbacks, this).clear();
857
- flush_queued_effects(render_effects);
858
- flush_queued_effects(effects);
859
- _classPrivateFieldGet2(_deferred, this)?.resolve();
860
- }
861
- var next_batch = current_batch;
862
- if (_classPrivateFieldGet2(_roots, this).length > 0) {
863
- const batch = next_batch ?? (next_batch = this);
864
- _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
865
- }
866
- if (next_batch !== null) {
867
- batches.add(next_batch);
868
- _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
869
- }
870
- if (async_mode_flag && !batches.has(this)) _assertClassBrand(_Batch_brand, this, _commit).call(this);
871
- }
872
- /**
873
- * Traverse the effect tree, executing effects or stashing
874
- * them for later execution as appropriate
875
- * @param {Effect} root
876
- * @param {Effect[]} effects
877
- * @param {Effect[]} render_effects
878
- */
879
- function _traverse(root, effects, render_effects) {
880
- root.f ^= CLEAN;
881
- var effect = root.first;
882
- while (effect !== null) {
883
- var flags = effect.f;
884
- var is_branch = (flags & 96) !== 0;
885
- if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || _classPrivateFieldGet2(_skipped_branches, this).has(effect)) && effect.fn !== null) {
886
- if (is_branch) effect.f ^= CLEAN;
887
- else if ((flags & 4) !== 0) effects.push(effect);
888
- else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
889
- else if (is_dirty(effect)) {
890
- if ((flags & 16) !== 0) _classPrivateFieldGet2(_maybe_dirty_effects$1, this).add(effect);
891
- update_effect(effect);
892
- }
893
- var child = effect.first;
894
- if (child !== null) {
895
- effect = child;
896
- continue;
897
- }
898
- }
899
- while (effect !== null) {
900
- var next = effect.next;
901
- if (next !== null) {
902
- effect = next;
903
- break;
904
- }
905
- effect = effect.parent;
906
- }
825
+ function _render() {
826
+ try {
827
+ this.is_pending = this.has_pending_snippet();
828
+ _classPrivateFieldSet2(_pending_count, this, 0);
829
+ _classPrivateFieldSet2(_local_pending_count, this, 0);
830
+ _classPrivateFieldSet2(_main_effect, this, branch(() => {
831
+ _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
832
+ }));
833
+ if (_classPrivateFieldGet2(_pending_count, this) > 0) {
834
+ var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
835
+ move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
836
+ const pending = _classPrivateFieldGet2(_props, this).pending;
837
+ _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
838
+ } else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
839
+ } catch (error) {
840
+ this.error(error);
907
841
  }
908
842
  }
909
843
  /**
910
- * @param {Effect[]} effects
844
+ * @param {Batch} batch
911
845
  */
912
- function _defer_effects(effects) {
913
- for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
914
- }
915
- function _commit() {
916
- for (const batch of batches) {
917
- var is_earlier = batch.id < this.id;
918
- /** @type {Source[]} */
919
- var sources = [];
920
- for (const [source, [value, is_derived]] of this.current) {
921
- if (batch.current.has(source)) {
922
- var batch_value = batch.current.get(source)[0];
923
- if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
924
- else continue;
925
- }
926
- sources.push(source);
927
- }
928
- var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
929
- if (others.length === 0) {
930
- if (is_earlier) batch.discard();
931
- } else if (sources.length > 0) {
932
- if (is_earlier) for (const unskipped of _classPrivateFieldGet2(_unskipped_branches, this)) batch.unskip_effect(unskipped, (e) => {
933
- if ((e.f & 4194320) !== 0) batch.schedule(e);
934
- else _assertClassBrand(_Batch_brand, batch, _defer_effects).call(batch, [e]);
935
- });
936
- batch.activate();
937
- /** @type {Set<Value>} */
938
- var marked = /* @__PURE__ */ new Set();
939
- /** @type {Map<Reaction, boolean>} */
940
- var checked = /* @__PURE__ */ new Map();
941
- for (var source of sources) mark_effects(source, others, marked, checked);
942
- checked = /* @__PURE__ */ new Map();
943
- var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c : true);
944
- for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
945
- set_signal_status(effect, DIRTY);
946
- batch.schedule(effect);
947
- } else _classPrivateFieldGet2(_dirty_effects$1, batch).add(effect);
948
- if (_classPrivateFieldGet2(_roots, batch).length > 0) {
949
- batch.apply();
950
- for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
951
- _classPrivateFieldSet2(_roots, batch, []);
952
- }
953
- batch.deactivate();
954
- }
955
- }
956
- for (const batch of batches) if (_classPrivateFieldGet2(_blockers, batch).has(this)) {
957
- _classPrivateFieldGet2(_blockers, batch).delete(this);
958
- if (_classPrivateFieldGet2(_blockers, batch).size === 0 && !_assertClassBrand(_Batch_brand, batch, _is_deferred).call(batch)) {
959
- batch.activate();
960
- _assertClassBrand(_Batch_brand, batch, _process).call(batch);
961
- }
962
- }
846
+ function _resolve(batch) {
847
+ this.is_pending = false;
848
+ batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects$1, this), _classPrivateFieldGet2(_maybe_dirty_effects$1, this));
963
849
  }
964
850
  /**
965
- * Synchronously flush any pending updates.
966
- * Returns void if no callback is provided, otherwise returns the result of calling the callback.
967
- * @template [T=void]
968
- * @param {(() => T) | undefined} [fn]
969
- * @returns {T}
851
+ * @template T
852
+ * @param {() => T} fn
970
853
  */
971
- function flushSync(fn) {
972
- var was_flushing_sync = is_flushing_sync;
973
- is_flushing_sync = true;
854
+ function _run(fn) {
855
+ var previous_effect = active_effect;
856
+ var previous_reaction = active_reaction;
857
+ var previous_ctx = component_context;
858
+ set_active_effect(_classPrivateFieldGet2(_effect, this));
859
+ set_active_reaction(_classPrivateFieldGet2(_effect, this));
860
+ set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
974
861
  try {
975
- var result;
976
- if (fn) {
977
- if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
978
- result = fn();
979
- }
980
- while (true) {
981
- flush_tasks();
982
- if (current_batch === null) return result;
983
- current_batch.flush();
984
- }
862
+ Batch.ensure();
863
+ return fn();
864
+ } catch (e) {
865
+ handle_error(e);
866
+ return null;
985
867
  } finally {
986
- is_flushing_sync = was_flushing_sync;
987
- }
988
- }
989
- function infinite_loop_guard() {
990
- try {
991
- effect_update_depth_exceeded();
992
- } catch (error) {
993
- invoke_error_boundary(error, last_scheduled_effect);
868
+ set_active_effect(previous_effect);
869
+ set_active_reaction(previous_reaction);
870
+ set_component_context(previous_ctx);
994
871
  }
995
872
  }
996
- /** @type {Set<Effect> | null} */
997
- var eager_block_effects = null;
998
873
  /**
999
- * @param {Array<Effect>} effects
1000
- * @returns {void}
874
+ * Updates the pending count associated with the currently visible pending snippet,
875
+ * if any, such that we can replace the snippet with content once work is done
876
+ * @param {1 | -1} d
877
+ * @param {Batch} batch
1001
878
  */
1002
- function flush_queued_effects(effects) {
1003
- var length = effects.length;
1004
- if (length === 0) return;
1005
- var i = 0;
1006
- while (i < length) {
1007
- var effect = effects[i++];
1008
- if ((effect.f & 24576) === 0 && is_dirty(effect)) {
1009
- eager_block_effects = /* @__PURE__ */ new Set();
1010
- update_effect(effect);
1011
- if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
1012
- if (eager_block_effects?.size > 0) {
1013
- old_values.clear();
1014
- for (const e of eager_block_effects) {
1015
- if ((e.f & 24576) !== 0) continue;
1016
- /** @type {Effect[]} */
1017
- const ordered_effects = [e];
1018
- let ancestor = e.parent;
1019
- while (ancestor !== null) {
1020
- if (eager_block_effects.has(ancestor)) {
1021
- eager_block_effects.delete(ancestor);
1022
- ordered_effects.push(ancestor);
1023
- }
1024
- ancestor = ancestor.parent;
1025
- }
1026
- for (let j = ordered_effects.length - 1; j >= 0; j--) {
1027
- const e = ordered_effects[j];
1028
- if ((e.f & 24576) !== 0) continue;
1029
- update_effect(e);
1030
- }
1031
- }
1032
- eager_block_effects.clear();
1033
- }
879
+ function _update_pending_count(d, batch) {
880
+ if (!this.has_pending_snippet()) {
881
+ if (this.parent) {
882
+ var _this$parent;
883
+ _assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
1034
884
  }
885
+ return;
1035
886
  }
1036
- eager_block_effects = null;
1037
- }
1038
- /**
1039
- * This is similar to `mark_reactions`, but it only marks async/block effects
1040
- * depending on `value` and at least one of the other `sources`, so that
1041
- * these effects can re-run after another batch has been committed
1042
- * @param {Value} value
1043
- * @param {Source[]} sources
1044
- * @param {Set<Value>} marked
1045
- * @param {Map<Reaction, boolean>} checked
1046
- */
1047
- function mark_effects(value, sources, marked, checked) {
1048
- if (marked.has(value)) return;
1049
- marked.add(value);
1050
- if (value.reactions !== null) for (const reaction of value.reactions) {
1051
- const flags = reaction.f;
1052
- if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1053
- else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1054
- set_signal_status(reaction, DIRTY);
1055
- schedule_effect(reaction);
887
+ _classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
888
+ if (_classPrivateFieldGet2(_pending_count, this) === 0) {
889
+ _assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
890
+ if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
891
+ _classPrivateFieldSet2(_pending_effect, this, null);
892
+ });
893
+ if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
894
+ _classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
895
+ _classPrivateFieldSet2(_offscreen_fragment, this, null);
1056
896
  }
1057
897
  }
1058
898
  }
1059
899
  /**
1060
- * @param {Reaction} reaction
1061
- * @param {Source[]} sources
1062
- * @param {Map<Reaction, boolean>} checked
900
+ * @param {unknown} error
1063
901
  */
1064
- function depends_on(reaction, sources, checked) {
1065
- const depends = checked.get(reaction);
1066
- if (depends !== void 0) return depends;
1067
- if (reaction.deps !== null) for (const dep of reaction.deps) {
1068
- if (includes.call(sources, dep)) return true;
1069
- if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1070
- checked.set(dep, true);
1071
- return true;
1072
- }
902
+ function _handle_error(error) {
903
+ if (_classPrivateFieldGet2(_main_effect, this)) {
904
+ destroy_effect(_classPrivateFieldGet2(_main_effect, this));
905
+ _classPrivateFieldSet2(_main_effect, this, null);
1073
906
  }
1074
- checked.set(reaction, false);
1075
- return false;
907
+ if (_classPrivateFieldGet2(_pending_effect, this)) {
908
+ destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
909
+ _classPrivateFieldSet2(_pending_effect, this, null);
910
+ }
911
+ if (_classPrivateFieldGet2(_failed_effect, this)) {
912
+ destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
913
+ _classPrivateFieldSet2(_failed_effect, this, null);
914
+ }
915
+ if (hydrating) {
916
+ set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
917
+ next();
918
+ set_hydrate_node(skip_nodes());
919
+ }
920
+ let failed = _classPrivateFieldGet2(_props, this).failed;
921
+ /** @param {unknown} transformed_error */
922
+ const handle_error_result = (transformed_error) => {
923
+ const { reset, invoke_onerror } = _assertClassBrand(_Boundary_brand, this, _create_reset).call(this, transformed_error);
924
+ invoke_onerror();
925
+ if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
926
+ try {
927
+ return branch(() => {
928
+ var effect = active_effect;
929
+ effect.b = this;
930
+ effect.f |= 128;
931
+ failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
932
+ });
933
+ } catch (error) {
934
+ invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
935
+ return null;
936
+ }
937
+ }));
938
+ };
939
+ queue_micro_task(() => {
940
+ /** @type {unknown} */
941
+ var result;
942
+ try {
943
+ result = this.transform_error(error);
944
+ } catch (e) {
945
+ invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
946
+ return;
947
+ }
948
+ if (result !== null && typeof result === "object" && typeof result.then === "function")
949
+ /** @type {any} */ result.then(
950
+ handle_error_result,
951
+ /** @param {unknown} e */
952
+ (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
953
+ );
954
+ else handle_error_result(result);
955
+ });
1076
956
  }
1077
957
  /**
1078
- * @param {Effect} effect
1079
- * @returns {void}
958
+ * @template V
959
+ * @param {() => V} fn
960
+ * @returns {Derived<V>}
1080
961
  */
1081
- function schedule_effect(effect) {
1082
- /** @type {Batch} */ current_batch.schedule(effect);
962
+ /*#__NO_SIDE_EFFECTS__*/
963
+ function derived(fn) {
964
+ var flags = 2 | DIRTY;
965
+ if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
966
+ return {
967
+ ctx: component_context,
968
+ deps: null,
969
+ effects: null,
970
+ equals,
971
+ f: flags,
972
+ fn,
973
+ reactions: null,
974
+ rv: 0,
975
+ v: UNINITIALIZED,
976
+ wv: 0,
977
+ parent: active_effect,
978
+ ac: null
979
+ };
1083
980
  }
981
+ var OBSOLETE = Symbol("obsolete");
1084
982
  /**
1085
- * Mark all the effects inside a skipped branch CLEAN, so that
1086
- * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
1087
- * effects so they can be rescheduled if the branch survives.
1088
- * @param {Effect} effect
1089
- * @param {{ d: Effect[], m: Effect[] }} tracked
983
+ * @template V
984
+ * @param {() => V} fn
985
+ * @returns {Derived<V>}
1090
986
  */
1091
- function reset_branch(effect, tracked) {
1092
- if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
1093
- if ((effect.f & 2048) !== 0) tracked.d.push(effect);
1094
- else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
1095
- set_signal_status(effect, CLEAN);
1096
- var e = effect.first;
1097
- while (e !== null) {
1098
- reset_branch(e, tracked);
1099
- e = e.next;
987
+ /*#__NO_SIDE_EFFECTS__*/
988
+ function derived_safe_equal(fn) {
989
+ const signal = /* @__PURE__ */ derived(fn);
990
+ signal.equals = safe_equals;
991
+ return signal;
992
+ }
993
+ /**
994
+ * @param {Derived} derived
995
+ * @returns {void}
996
+ */
997
+ function destroy_derived_effects(derived) {
998
+ var effects = derived.effects;
999
+ if (effects !== null) {
1000
+ derived.effects = null;
1001
+ for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
1100
1002
  }
1101
1003
  }
1102
1004
  /**
1103
- * Mark an entire effect tree clean following an error
1104
- * @param {Effect} effect
1005
+ * @template T
1006
+ * @param {Derived} derived
1007
+ * @returns {T}
1105
1008
  */
1106
- function reset_all(effect) {
1107
- set_signal_status(effect, CLEAN);
1108
- var e = effect.first;
1109
- while (e !== null) {
1110
- reset_all(e);
1111
- e = e.next;
1009
+ function execute_derived(derived) {
1010
+ var value;
1011
+ var prev_active_effect = active_effect;
1012
+ var parent = derived.parent;
1013
+ if (!is_destroying_effect && parent !== null && derived.v !== UNINITIALIZED && (parent.f & 24576) !== 0) {
1014
+ derived_inert();
1015
+ return derived.v;
1016
+ }
1017
+ set_active_effect(parent);
1018
+ try {
1019
+ derived.f &= ~WAS_MARKED;
1020
+ destroy_derived_effects(derived);
1021
+ value = update_reaction(derived);
1022
+ } finally {
1023
+ set_active_effect(prev_active_effect);
1112
1024
  }
1025
+ return value;
1113
1026
  }
1114
- //#endregion
1115
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/reactivity/create-subscriber.js
1116
1027
  /**
1117
- * Returns a `subscribe` function that integrates external event-based systems with Svelte's reactivity.
1118
- * It's particularly useful for integrating with web APIs like `MediaQuery`, `IntersectionObserver`, or `WebSocket`.
1119
- *
1120
- * If `subscribe` is called inside an effect (including indirectly, for example inside a getter),
1121
- * the `start` callback will be called with an `update` function. Whenever `update` is called, the effect re-runs.
1122
- *
1123
- * If `start` returns a cleanup function, it will be called when the effect is destroyed.
1124
- *
1125
- * If `subscribe` is called in multiple effects, `start` will only be called once as long as the effects
1126
- * are active, and the returned teardown function will only be called when all effects are destroyed.
1127
- *
1128
- * It's best understood with an example. Here's an implementation of [`MediaQuery`](https://svelte.dev/docs/svelte/svelte-reactivity#MediaQuery):
1129
- *
1130
- * ```js
1131
- * import { createSubscriber } from 'svelte/reactivity';
1132
- * import { on } from 'svelte/events';
1133
- *
1134
- * export class MediaQuery {
1135
- * #query;
1136
- * #subscribe;
1137
- *
1138
- * constructor(query) {
1139
- * this.#query = window.matchMedia(`(${query})`);
1140
- *
1141
- * this.#subscribe = createSubscriber((update) => {
1142
- * // when the `change` event occurs, re-run any effects that read `this.current`
1143
- * const off = on(this.#query, 'change', update);
1144
- *
1145
- * // stop listening when all the effects are destroyed
1146
- * return () => off();
1147
- * });
1148
- * }
1149
- *
1150
- * get current() {
1151
- * // This makes the getter reactive, if read in an effect
1152
- * this.#subscribe();
1153
- *
1154
- * // Return the current state of the query, whether or not we're in an effect
1155
- * return this.#query.matches;
1156
- * }
1157
- * }
1158
- * ```
1159
- * @param {(update: () => void) => (() => void) | void} start
1160
- * @since 5.7.0
1028
+ * @param {Derived} derived
1029
+ * @returns {void}
1161
1030
  */
1162
- function createSubscriber(start) {
1163
- let subscribers = 0;
1164
- let version = source(0);
1165
- /** @type {(() => void) | void} */
1166
- let stop;
1167
- return () => {
1168
- if (effect_tracking()) {
1169
- get(version);
1170
- render_effect(() => {
1171
- if (subscribers === 0) stop = untrack(() => start(() => increment(version)));
1172
- subscribers += 1;
1173
- return () => {
1174
- queue_micro_task(() => {
1175
- subscribers -= 1;
1176
- if (subscribers === 0) {
1177
- stop?.();
1178
- stop = void 0;
1179
- increment(version);
1180
- }
1181
- });
1182
- };
1183
- });
1031
+ function update_derived(derived) {
1032
+ var value = execute_derived(derived);
1033
+ if (!derived.equals(value)) {
1034
+ derived.wv = increment_write_version();
1035
+ if (!current_batch?.is_fork || derived.deps === null) {
1036
+ if (current_batch !== null) {
1037
+ current_batch.capture(derived, value, true);
1038
+ previous_batch?.capture(derived, value, true);
1039
+ } else derived.v = value;
1040
+ if (derived.deps === null) {
1041
+ set_signal_status(derived, CLEAN);
1042
+ return;
1043
+ }
1184
1044
  }
1185
- };
1045
+ }
1046
+ if (is_destroying_effect) return;
1047
+ if (batch_values !== null) {
1048
+ if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
1049
+ } else update_derived_status(derived);
1186
1050
  }
1187
- //#endregion
1188
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1189
- /** @import { Effect, Source, TemplateNode, } from '#client' */
1190
1051
  /**
1191
- * @typedef {{
1192
- * onerror?: (error: unknown, reset: () => void) => void;
1193
- * failed?: (anchor: Node, error: () => unknown, reset: () => () => void) => void;
1194
- * pending?: (anchor: Node) => void;
1195
- * }} BoundaryProps
1052
+ * @param {Derived} derived
1196
1053
  */
1197
- var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
1054
+ function freeze_derived_effects(derived) {
1055
+ if (derived.effects === null) return;
1056
+ for (const e of derived.effects) if (e.teardown || e.ac) {
1057
+ e.teardown?.();
1058
+ if (e.ac !== null) without_reactive_context(() => {
1059
+ /** @type {AbortController} */ e.ac.abort(STALE_REACTION);
1060
+ e.ac = null;
1061
+ });
1062
+ if (e.fn !== null) e.teardown = noop;
1063
+ remove_reactions(e, 0);
1064
+ destroy_effect_children(e);
1065
+ }
1066
+ }
1198
1067
  /**
1199
- * @param {TemplateNode} node
1200
- * @param {BoundaryProps} props
1201
- * @param {((anchor: Node) => void)} children
1202
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
1203
- * @returns {void}
1068
+ * @param {Derived} derived
1204
1069
  */
1205
- function boundary(node, props, children, transform_error) {
1206
- new Boundary(node, props, children, transform_error);
1070
+ function unfreeze_derived_effects(derived) {
1071
+ if (derived.effects === null) return;
1072
+ for (const e of derived.effects) if (e.teardown && e.fn !== null) update_effect(e);
1207
1073
  }
1208
- var _anchor = /* @__PURE__ */ new WeakMap();
1209
- var _hydrate_open = /* @__PURE__ */ new WeakMap();
1210
- var _props = /* @__PURE__ */ new WeakMap();
1211
- var _children = /* @__PURE__ */ new WeakMap();
1212
- var _effect = /* @__PURE__ */ new WeakMap();
1213
- var _main_effect = /* @__PURE__ */ new WeakMap();
1214
- var _pending_effect = /* @__PURE__ */ new WeakMap();
1215
- var _failed_effect = /* @__PURE__ */ new WeakMap();
1216
- var _offscreen_fragment = /* @__PURE__ */ new WeakMap();
1217
- var _local_pending_count = /* @__PURE__ */ new WeakMap();
1218
- var _pending_count = /* @__PURE__ */ new WeakMap();
1219
- var _pending_count_update_queued = /* @__PURE__ */ new WeakMap();
1074
+ //#endregion
1075
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/batch.js
1076
+ /** @import { Fork } from 'svelte' */
1077
+ /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
1078
+ var _Batch;
1079
+ /** @type {Batch | null} */
1080
+ var first_batch = null;
1081
+ /** @type {Batch | null} */
1082
+ var last_batch = null;
1083
+ /** @type {Batch | null} */
1084
+ var current_batch = null;
1085
+ /**
1086
+ * This is needed to avoid overwriting inputs
1087
+ * @type {Batch | null}
1088
+ */
1089
+ var previous_batch = null;
1090
+ /**
1091
+ * When time travelling (i.e. working in one batch, while other batches
1092
+ * still have ongoing work), we ignore the real values of affected
1093
+ * signals in favour of their values within the batch
1094
+ * @type {Map<Value, any> | null}
1095
+ */
1096
+ var batch_values = null;
1097
+ /** @type {Effect | null} */
1098
+ var last_scheduled_effect = null;
1099
+ var is_flushing_sync = false;
1100
+ var is_processing = false;
1101
+ /**
1102
+ * During traversal, this is an array. Newly created effects are (if not immediately
1103
+ * executed) pushed to this array, rather than going through the scheduling
1104
+ * rigamarole that would cause another turn of the flush loop.
1105
+ * @type {Effect[] | null}
1106
+ */
1107
+ var collected_effects = null;
1108
+ /**
1109
+ * An array of effects that are marked during traversal as a result of a `set`
1110
+ * (not `internal_set`) call. These will be added to the next batch and
1111
+ * trigger another `batch.process()`
1112
+ * @type {Effect[] | null}
1113
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1114
+ */
1115
+ var legacy_updates = null;
1116
+ var flush_count = 0;
1117
+ var uid = 1;
1118
+ var _started = /* @__PURE__ */ new WeakMap();
1119
+ var _prev = /* @__PURE__ */ new WeakMap();
1120
+ var _next = /* @__PURE__ */ new WeakMap();
1121
+ var _commit_callbacks = /* @__PURE__ */ new WeakMap();
1122
+ var _discard_callbacks = /* @__PURE__ */ new WeakMap();
1123
+ var _pending = /* @__PURE__ */ new WeakMap();
1124
+ var _blocking_pending = /* @__PURE__ */ new WeakMap();
1125
+ var _deferred = /* @__PURE__ */ new WeakMap();
1126
+ var _roots = /* @__PURE__ */ new WeakMap();
1127
+ var _new_effects = /* @__PURE__ */ new WeakMap();
1220
1128
  var _dirty_effects = /* @__PURE__ */ new WeakMap();
1221
1129
  var _maybe_dirty_effects = /* @__PURE__ */ new WeakMap();
1222
- var _effect_pending = /* @__PURE__ */ new WeakMap();
1223
- var _effect_pending_subscriber = /* @__PURE__ */ new WeakMap();
1224
- var _Boundary_brand = /* @__PURE__ */ new WeakSet();
1225
- var Boundary = class {
1226
- /**
1227
- * @param {TemplateNode} node
1228
- * @param {BoundaryProps} props
1229
- * @param {((anchor: Node) => void)} children
1230
- * @param {((error: unknown) => unknown) | undefined} [transform_error]
1231
- */
1232
- constructor(node, props, children, transform_error) {
1233
- _classPrivateMethodInitSpec(this, _Boundary_brand);
1130
+ var _skipped_branches = /* @__PURE__ */ new WeakMap();
1131
+ var _unskipped_branches = /* @__PURE__ */ new WeakMap();
1132
+ var _decrement_queued = /* @__PURE__ */ new WeakMap();
1133
+ var _Batch_brand = /* @__PURE__ */ new WeakSet();
1134
+ var Batch = class Batch {
1135
+ constructor() {
1136
+ _classPrivateMethodInitSpec(this, _Batch_brand);
1137
+ _defineProperty(this, "id", uid++);
1138
+ _classPrivateFieldInitSpec(this, _started, false);
1139
+ _defineProperty(this, "linked", true);
1140
+ _classPrivateFieldInitSpec(this, _prev, null);
1141
+ _classPrivateFieldInitSpec(this, _next, null);
1234
1142
  _defineProperty(
1235
1143
  this,
1236
- /** @type {Boundary | null} */
1237
- "parent",
1238
- void 0
1144
+ /** @type {Map<Effect, ReturnType<typeof deferred<any>>>} */
1145
+ "async_deriveds",
1146
+ /* @__PURE__ */ new Map()
1239
1147
  );
1240
- _defineProperty(this, "is_pending", false);
1241
1148
  _defineProperty(
1242
1149
  this,
1243
1150
  /**
1244
- * API-level transformError transform function. Transforms errors before they reach the `failed` snippet.
1245
- * Inherited from parent boundary, or defaults to identity.
1246
- * @type {(error: unknown) => unknown}
1151
+ * The current values of any signals that are updated in this batch.
1152
+ * Tuple format: [value, is_derived] (note: is_derived is false for deriveds, too, if they were overridden via assignment)
1153
+ * They keys of this map are identical to `this.#previous`
1154
+ * @type {Map<Value, [any, boolean]>}
1247
1155
  */
1248
- "transform_error",
1249
- void 0
1156
+ "current",
1157
+ /* @__PURE__ */ new Map()
1250
1158
  );
1251
- _classPrivateFieldInitSpec(this, _anchor, void 0);
1252
- _classPrivateFieldInitSpec(this, _hydrate_open, hydrating ? hydrate_node : null);
1253
- _classPrivateFieldInitSpec(this, _props, void 0);
1254
- _classPrivateFieldInitSpec(this, _children, void 0);
1255
- _classPrivateFieldInitSpec(this, _effect, void 0);
1256
- _classPrivateFieldInitSpec(this, _main_effect, null);
1257
- _classPrivateFieldInitSpec(this, _pending_effect, null);
1258
- _classPrivateFieldInitSpec(this, _failed_effect, null);
1259
- _classPrivateFieldInitSpec(this, _offscreen_fragment, null);
1260
- _classPrivateFieldInitSpec(this, _local_pending_count, 0);
1261
- _classPrivateFieldInitSpec(this, _pending_count, 0);
1262
- _classPrivateFieldInitSpec(this, _pending_count_update_queued, false);
1159
+ _defineProperty(
1160
+ this,
1161
+ /**
1162
+ * The values of any signals (sources and deriveds) that are updated in this batch _before_ those updates took place.
1163
+ * They keys of this map are identical to `this.#current`
1164
+ * @type {Map<Value, any>}
1165
+ */
1166
+ "previous",
1167
+ /* @__PURE__ */ new Map()
1168
+ );
1169
+ _classPrivateFieldInitSpec(this, _commit_callbacks, /* @__PURE__ */ new Set());
1170
+ _classPrivateFieldInitSpec(this, _discard_callbacks, /* @__PURE__ */ new Set());
1171
+ _classPrivateFieldInitSpec(this, _pending, 0);
1172
+ _classPrivateFieldInitSpec(this, _blocking_pending, /* @__PURE__ */ new Map());
1173
+ _classPrivateFieldInitSpec(this, _deferred, null);
1174
+ _classPrivateFieldInitSpec(this, _roots, []);
1175
+ _classPrivateFieldInitSpec(this, _new_effects, []);
1263
1176
  _classPrivateFieldInitSpec(this, _dirty_effects, /* @__PURE__ */ new Set());
1264
1177
  _classPrivateFieldInitSpec(this, _maybe_dirty_effects, /* @__PURE__ */ new Set());
1265
- _classPrivateFieldInitSpec(this, _effect_pending, null);
1266
- _classPrivateFieldInitSpec(this, _effect_pending_subscriber, createSubscriber(() => {
1267
- _classPrivateFieldSet2(_effect_pending, this, source(_classPrivateFieldGet2(_local_pending_count, this)));
1268
- return () => {
1269
- _classPrivateFieldSet2(_effect_pending, this, null);
1270
- };
1271
- }));
1272
- _classPrivateFieldSet2(_anchor, this, node);
1273
- _classPrivateFieldSet2(_props, this, props);
1274
- _classPrivateFieldSet2(_children, this, (anchor) => {
1275
- var effect = active_effect;
1276
- effect.b = this;
1277
- effect.f |= 128;
1278
- children(anchor);
1279
- });
1280
- this.parent = active_effect.b;
1281
- this.transform_error = transform_error ?? this.parent?.transform_error ?? ((e) => e);
1282
- _classPrivateFieldSet2(_effect, this, block(() => {
1283
- if (hydrating) {
1284
- const comment = _classPrivateFieldGet2(_hydrate_open, this);
1285
- hydrate_next();
1286
- const server_rendered_pending = comment.data === "[!";
1287
- if (comment.data.startsWith("[?")) {
1288
- const serialized_error = JSON.parse(comment.data.slice(2));
1289
- _assertClassBrand(_Boundary_brand, this, _hydrate_failed_content).call(this, serialized_error);
1290
- } else if (server_rendered_pending) _assertClassBrand(_Boundary_brand, this, _hydrate_pending_content).call(this);
1291
- else _assertClassBrand(_Boundary_brand, this, _hydrate_resolved_content).call(this);
1292
- } else _assertClassBrand(_Boundary_brand, this, _render).call(this);
1293
- }, flags));
1294
- if (hydrating) _classPrivateFieldSet2(_anchor, this, hydrate_node);
1178
+ _classPrivateFieldInitSpec(this, _skipped_branches, /* @__PURE__ */ new Map());
1179
+ _classPrivateFieldInitSpec(this, _unskipped_branches, /* @__PURE__ */ new Set());
1180
+ _defineProperty(this, "is_fork", false);
1181
+ _classPrivateFieldInitSpec(this, _decrement_queued, false);
1182
+ if (last_batch === null) first_batch = last_batch = this;
1183
+ else {
1184
+ _classPrivateFieldSet2(_next, last_batch, this);
1185
+ _classPrivateFieldSet2(_prev, this, last_batch);
1186
+ }
1187
+ last_batch = this;
1295
1188
  }
1296
1189
  /**
1297
- * Defer an effect inside a pending boundary until the boundary resolves
1190
+ * Add an effect to the #skipped_branches map and reset its children
1298
1191
  * @param {Effect} effect
1299
1192
  */
1300
- defer_effect(effect) {
1301
- defer_effect(effect, _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1193
+ skip_effect(effect) {
1194
+ if (!_classPrivateFieldGet2(_skipped_branches, this).has(effect)) _classPrivateFieldGet2(_skipped_branches, this).set(effect, {
1195
+ d: [],
1196
+ m: []
1197
+ });
1198
+ _classPrivateFieldGet2(_unskipped_branches, this).delete(effect);
1302
1199
  }
1303
1200
  /**
1304
- * Returns `false` if the effect exists inside a boundary whose pending snippet is shown
1305
- * @returns {boolean}
1201
+ * Remove an effect from the #skipped_branches map and reschedule
1202
+ * any tracked dirty/maybe_dirty child effects
1203
+ * @param {Effect} effect
1204
+ * @param {(e: Effect) => void} callback
1306
1205
  */
1307
- is_rendered() {
1308
- return !this.is_pending && (!this.parent || this.parent.is_rendered());
1309
- }
1310
- has_pending_snippet() {
1311
- return !!_classPrivateFieldGet2(_props, this).pending;
1206
+ unskip_effect(effect, callback = (e) => this.schedule(e)) {
1207
+ var tracked = _classPrivateFieldGet2(_skipped_branches, this).get(effect);
1208
+ if (tracked) {
1209
+ _classPrivateFieldGet2(_skipped_branches, this).delete(effect);
1210
+ for (var e of tracked.d) {
1211
+ set_signal_status(e, DIRTY);
1212
+ callback(e);
1213
+ }
1214
+ for (e of tracked.m) {
1215
+ set_signal_status(e, MAYBE_DIRTY);
1216
+ callback(e);
1217
+ }
1218
+ }
1219
+ _classPrivateFieldGet2(_unskipped_branches, this).add(effect);
1312
1220
  }
1313
1221
  /**
1314
- * Update the source that powers `$effect.pending()` inside this boundary,
1315
- * and controls when the current `pending` snippet (if any) is removed.
1316
- * Do not call from inside the class
1317
- * @param {1 | -1} d
1318
- * @param {Batch} batch
1222
+ * Associate a change to a given source with the current
1223
+ * batch, noting its previous and current values
1224
+ * @param {Value} source
1225
+ * @param {any} value
1226
+ * @param {boolean} [is_derived]
1319
1227
  */
1320
- update_pending_count(d, batch) {
1321
- _assertClassBrand(_Boundary_brand, this, _update_pending_count).call(this, d, batch);
1322
- _classPrivateFieldSet2(_local_pending_count, this, _classPrivateFieldGet2(_local_pending_count, this) + d);
1323
- if (!_classPrivateFieldGet2(_effect_pending, this) || _classPrivateFieldGet2(_pending_count_update_queued, this)) return;
1324
- _classPrivateFieldSet2(_pending_count_update_queued, this, true);
1325
- queue_micro_task(() => {
1326
- _classPrivateFieldSet2(_pending_count_update_queued, this, false);
1327
- if (_classPrivateFieldGet2(_effect_pending, this)) internal_set(_classPrivateFieldGet2(_effect_pending, this), _classPrivateFieldGet2(_local_pending_count, this));
1328
- });
1228
+ capture(source, value, is_derived = false) {
1229
+ if (source.v !== UNINITIALIZED && !this.previous.has(source)) this.previous.set(source, source.v);
1230
+ if ((source.f & 8388608) === 0) {
1231
+ this.current.set(source, [value, is_derived]);
1232
+ batch_values?.set(source, value);
1233
+ }
1234
+ if (!this.is_fork) source.v = value;
1329
1235
  }
1330
- get_effect_pending() {
1331
- _classPrivateFieldGet2(_effect_pending_subscriber, this).call(this);
1332
- return get(_classPrivateFieldGet2(_effect_pending, this));
1236
+ activate() {
1237
+ current_batch = this;
1333
1238
  }
1334
- /** @param {unknown} error */
1335
- error(error) {
1336
- if (!_classPrivateFieldGet2(_props, this).onerror && !_classPrivateFieldGet2(_props, this).failed) throw error;
1337
- if (current_batch?.is_fork) {
1338
- if (_classPrivateFieldGet2(_main_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_main_effect, this));
1339
- if (_classPrivateFieldGet2(_pending_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_pending_effect, this));
1340
- if (_classPrivateFieldGet2(_failed_effect, this)) current_batch.skip_effect(_classPrivateFieldGet2(_failed_effect, this));
1341
- current_batch.on_fork_commit(() => {
1342
- _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1343
- });
1344
- } else _assertClassBrand(_Boundary_brand, this, _handle_error).call(this, error);
1239
+ deactivate() {
1240
+ current_batch = null;
1241
+ batch_values = null;
1345
1242
  }
1346
- };
1347
- function _hydrate_resolved_content() {
1348
- try {
1349
- _classPrivateFieldSet2(_main_effect, this, branch(() => _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this))));
1350
- } catch (error) {
1351
- this.error(error);
1243
+ flush() {
1244
+ try {
1245
+ is_processing = true;
1246
+ current_batch = this;
1247
+ _assertClassBrand(_Batch_brand, this, _process).call(this);
1248
+ } finally {
1249
+ flush_count = 0;
1250
+ last_scheduled_effect = null;
1251
+ collected_effects = null;
1252
+ legacy_updates = null;
1253
+ is_processing = false;
1254
+ current_batch = null;
1255
+ batch_values = null;
1256
+ old_values.clear();
1257
+ }
1352
1258
  }
1353
- }
1354
- /**
1355
- * @param {unknown} error The deserialized error from the server's hydration comment
1356
- */
1357
- function _hydrate_failed_content(error) {
1358
- const failed = _classPrivateFieldGet2(_props, this).failed;
1359
- if (!failed) return;
1360
- _classPrivateFieldSet2(_failed_effect, this, branch(() => {
1361
- failed(_classPrivateFieldGet2(_anchor, this), () => error, () => () => {});
1362
- }));
1363
- }
1364
- function _hydrate_pending_content() {
1365
- const pending = _classPrivateFieldGet2(_props, this).pending;
1366
- if (!pending) return;
1367
- this.is_pending = true;
1368
- _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1369
- queue_micro_task(() => {
1370
- var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1371
- var anchor = create_text();
1372
- fragment.append(anchor);
1373
- _classPrivateFieldSet2(_main_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1374
- return branch(() => _classPrivateFieldGet2(_children, this).call(this, anchor));
1375
- }));
1376
- if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1377
- _classPrivateFieldGet2(_anchor, this).before(fragment);
1378
- _classPrivateFieldSet2(_offscreen_fragment, this, null);
1379
- pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1380
- _classPrivateFieldSet2(_pending_effect, this, null);
1381
- });
1382
- _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1383
- }
1384
- });
1385
- }
1386
- function _render() {
1387
- try {
1388
- this.is_pending = this.has_pending_snippet();
1389
- _classPrivateFieldSet2(_pending_count, this, 0);
1390
- _classPrivateFieldSet2(_local_pending_count, this, 0);
1391
- _classPrivateFieldSet2(_main_effect, this, branch(() => {
1392
- _classPrivateFieldGet2(_children, this).call(this, _classPrivateFieldGet2(_anchor, this));
1393
- }));
1394
- if (_classPrivateFieldGet2(_pending_count, this) > 0) {
1395
- var fragment = _classPrivateFieldSet2(_offscreen_fragment, this, document.createDocumentFragment());
1396
- move_effect(_classPrivateFieldGet2(_main_effect, this), fragment);
1397
- const pending = _classPrivateFieldGet2(_props, this).pending;
1398
- _classPrivateFieldSet2(_pending_effect, this, branch(() => pending(_classPrivateFieldGet2(_anchor, this))));
1399
- } else _assertClassBrand(_Boundary_brand, this, _resolve).call(this, current_batch);
1400
- } catch (error) {
1401
- this.error(error);
1259
+ discard() {
1260
+ for (const fn of _classPrivateFieldGet2(_discard_callbacks, this)) fn(this);
1261
+ _classPrivateFieldGet2(_discard_callbacks, this).clear();
1262
+ for (const deferred of this.async_deriveds.values()) deferred.reject(OBSOLETE);
1263
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1264
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
1402
1265
  }
1403
- }
1404
- /**
1405
- * @param {Batch} batch
1406
- */
1407
- function _resolve(batch) {
1408
- this.is_pending = false;
1409
- batch.transfer_effects(_classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1410
- }
1411
- /**
1412
- * @template T
1413
- * @param {() => T} fn
1414
- */
1415
- function _run(fn) {
1416
- var previous_effect = active_effect;
1417
- var previous_reaction = active_reaction;
1418
- var previous_ctx = component_context;
1419
- set_active_effect(_classPrivateFieldGet2(_effect, this));
1420
- set_active_reaction(_classPrivateFieldGet2(_effect, this));
1421
- set_component_context(_classPrivateFieldGet2(_effect, this).ctx);
1422
- try {
1423
- Batch.ensure();
1424
- return fn();
1425
- } catch (e) {
1426
- handle_error(e);
1427
- return null;
1428
- } finally {
1429
- set_active_effect(previous_effect);
1430
- set_active_reaction(previous_reaction);
1431
- set_component_context(previous_ctx);
1266
+ /**
1267
+ * @param {Effect} effect
1268
+ */
1269
+ register_created_effect(effect) {
1270
+ _classPrivateFieldGet2(_new_effects, this).push(effect);
1432
1271
  }
1433
- }
1434
- /**
1435
- * Updates the pending count associated with the currently visible pending snippet,
1436
- * if any, such that we can replace the snippet with content once work is done
1437
- * @param {1 | -1} d
1438
- * @param {Batch} batch
1439
- */
1440
- function _update_pending_count(d, batch) {
1441
- if (!this.has_pending_snippet()) {
1442
- if (this.parent) {
1443
- var _this$parent;
1444
- _assertClassBrand(_Boundary_brand, _this$parent = this.parent, _update_pending_count).call(_this$parent, d, batch);
1272
+ /**
1273
+ * @param {boolean} blocking
1274
+ * @param {Effect} effect
1275
+ */
1276
+ increment(blocking, effect) {
1277
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) + 1);
1278
+ if (blocking) {
1279
+ let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
1280
+ _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count + 1);
1445
1281
  }
1446
- return;
1447
1282
  }
1448
- _classPrivateFieldSet2(_pending_count, this, _classPrivateFieldGet2(_pending_count, this) + d);
1449
- if (_classPrivateFieldGet2(_pending_count, this) === 0) {
1450
- _assertClassBrand(_Boundary_brand, this, _resolve).call(this, batch);
1451
- if (_classPrivateFieldGet2(_pending_effect, this)) pause_effect(_classPrivateFieldGet2(_pending_effect, this), () => {
1452
- _classPrivateFieldSet2(_pending_effect, this, null);
1453
- });
1454
- if (_classPrivateFieldGet2(_offscreen_fragment, this)) {
1455
- _classPrivateFieldGet2(_anchor, this).before(_classPrivateFieldGet2(_offscreen_fragment, this));
1456
- _classPrivateFieldSet2(_offscreen_fragment, this, null);
1283
+ /**
1284
+ * @param {boolean} blocking
1285
+ * @param {Effect} effect
1286
+ */
1287
+ decrement(blocking, effect) {
1288
+ _classPrivateFieldSet2(_pending, this, _classPrivateFieldGet2(_pending, this) - 1);
1289
+ if (blocking) {
1290
+ let blocking_pending_count = _classPrivateFieldGet2(_blocking_pending, this).get(effect) ?? 0;
1291
+ if (blocking_pending_count === 1) _classPrivateFieldGet2(_blocking_pending, this).delete(effect);
1292
+ else _classPrivateFieldGet2(_blocking_pending, this).set(effect, blocking_pending_count - 1);
1457
1293
  }
1294
+ if (_classPrivateFieldGet2(_decrement_queued, this)) return;
1295
+ _classPrivateFieldSet2(_decrement_queued, this, true);
1296
+ queue_micro_task(() => {
1297
+ _classPrivateFieldSet2(_decrement_queued, this, false);
1298
+ if (this.linked) this.flush();
1299
+ });
1458
1300
  }
1459
- }
1460
- /**
1461
- * @param {unknown} error
1462
- */
1463
- function _handle_error(error) {
1464
- if (_classPrivateFieldGet2(_main_effect, this)) {
1465
- destroy_effect(_classPrivateFieldGet2(_main_effect, this));
1466
- _classPrivateFieldSet2(_main_effect, this, null);
1301
+ /**
1302
+ * @param {Set<Effect>} dirty_effects
1303
+ * @param {Set<Effect>} maybe_dirty_effects
1304
+ */
1305
+ transfer_effects(dirty_effects, maybe_dirty_effects) {
1306
+ for (const e of dirty_effects) _classPrivateFieldGet2(_dirty_effects, this).add(e);
1307
+ for (const e of maybe_dirty_effects) _classPrivateFieldGet2(_maybe_dirty_effects, this).add(e);
1308
+ dirty_effects.clear();
1309
+ maybe_dirty_effects.clear();
1467
1310
  }
1468
- if (_classPrivateFieldGet2(_pending_effect, this)) {
1469
- destroy_effect(_classPrivateFieldGet2(_pending_effect, this));
1470
- _classPrivateFieldSet2(_pending_effect, this, null);
1311
+ /** @param {(batch: Batch) => void} fn */
1312
+ oncommit(fn) {
1313
+ _classPrivateFieldGet2(_commit_callbacks, this).add(fn);
1471
1314
  }
1472
- if (_classPrivateFieldGet2(_failed_effect, this)) {
1473
- destroy_effect(_classPrivateFieldGet2(_failed_effect, this));
1474
- _classPrivateFieldSet2(_failed_effect, this, null);
1315
+ /** @param {(batch: Batch) => void} fn */
1316
+ ondiscard(fn) {
1317
+ _classPrivateFieldGet2(_discard_callbacks, this).add(fn);
1475
1318
  }
1476
- if (hydrating) {
1477
- set_hydrate_node(_classPrivateFieldGet2(_hydrate_open, this));
1478
- next();
1479
- set_hydrate_node(skip_nodes());
1319
+ settled() {
1320
+ return (_classPrivateFieldGet2(_deferred, this) ?? _classPrivateFieldSet2(_deferred, this, deferred())).promise;
1480
1321
  }
1481
- var onerror = _classPrivateFieldGet2(_props, this).onerror;
1482
- let failed = _classPrivateFieldGet2(_props, this).failed;
1483
- var did_reset = false;
1484
- var calling_on_error = false;
1485
- const reset = () => {
1486
- if (did_reset) {
1487
- svelte_boundary_reset_noop();
1488
- return;
1322
+ static ensure() {
1323
+ if (current_batch === null) {
1324
+ const batch = current_batch = new Batch();
1325
+ if (!is_processing && !is_flushing_sync) queue_micro_task(() => {
1326
+ if (!_classPrivateFieldGet2(_started, batch)) batch.flush();
1327
+ });
1489
1328
  }
1490
- did_reset = true;
1491
- if (calling_on_error) svelte_boundary_reset_onerror();
1492
- if (_classPrivateFieldGet2(_failed_effect, this) !== null) pause_effect(_classPrivateFieldGet2(_failed_effect, this), () => {
1493
- _classPrivateFieldSet2(_failed_effect, this, null);
1494
- });
1495
- _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1496
- _assertClassBrand(_Boundary_brand, this, _render).call(this);
1497
- });
1498
- };
1499
- /** @param {unknown} transformed_error */
1500
- const handle_error_result = (transformed_error) => {
1501
- try {
1502
- calling_on_error = true;
1503
- onerror?.(transformed_error, reset);
1504
- calling_on_error = false;
1505
- } catch (error) {
1506
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1329
+ return current_batch;
1330
+ }
1331
+ apply() {
1332
+ if (!async_mode_flag || !this.is_fork && _classPrivateFieldGet2(_prev, this) === null && _classPrivateFieldGet2(_next, this) === null) {
1333
+ batch_values = null;
1334
+ return;
1507
1335
  }
1508
- if (failed) _classPrivateFieldSet2(_failed_effect, this, _assertClassBrand(_Boundary_brand, this, _run).call(this, () => {
1509
- try {
1510
- return branch(() => {
1511
- var effect = active_effect;
1512
- effect.b = this;
1513
- effect.f |= 128;
1514
- failed(_classPrivateFieldGet2(_anchor, this), () => transformed_error, () => reset);
1515
- });
1516
- } catch (error) {
1517
- invoke_error_boundary(error, _classPrivateFieldGet2(_effect, this).parent);
1518
- return null;
1336
+ batch_values = /* @__PURE__ */ new Map();
1337
+ for (const [source, [value]] of this.current) batch_values.set(source, value);
1338
+ for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
1339
+ if (batch === this || batch.is_fork) continue;
1340
+ var intersects = false;
1341
+ if (batch.id < this.id) for (const [source, [, is_derived]] of batch.current) {
1342
+ if (is_derived) continue;
1343
+ if (this.current.has(source)) {
1344
+ intersects = true;
1345
+ break;
1346
+ }
1519
1347
  }
1520
- }));
1521
- };
1522
- queue_micro_task(() => {
1523
- /** @type {unknown} */
1524
- var result;
1525
- try {
1526
- result = this.transform_error(error);
1527
- } catch (e) {
1528
- invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent);
1348
+ if (!intersects) {
1349
+ for (const [source, previous] of batch.previous) if (!batch_values.has(source)) batch_values.set(source, previous);
1350
+ }
1351
+ }
1352
+ }
1353
+ /**
1354
+ *
1355
+ * @param {Effect} effect
1356
+ */
1357
+ schedule(effect) {
1358
+ last_scheduled_effect = effect;
1359
+ if (effect.b?.is_pending && (effect.f & 16777228) !== 0 && (effect.f & 32768) === 0) {
1360
+ effect.b.defer_effect(effect);
1529
1361
  return;
1530
1362
  }
1531
- if (result !== null && typeof result === "object" && typeof result.then === "function")
1532
- /** @type {any} */ result.then(
1533
- handle_error_result,
1534
- /** @param {unknown} e */
1535
- (e) => invoke_error_boundary(e, _classPrivateFieldGet2(_effect, this) && _classPrivateFieldGet2(_effect, this).parent)
1536
- );
1537
- else handle_error_result(result);
1538
- });
1363
+ var e = effect;
1364
+ while (e.parent !== null) {
1365
+ e = e.parent;
1366
+ var flags = e.f;
1367
+ if (collected_effects !== null && e === active_effect) {
1368
+ if (async_mode_flag) return;
1369
+ if ((active_reaction === null || (active_reaction.f & 2) === 0) && !legacy_is_updating_store) return;
1370
+ }
1371
+ if ((flags & 96) !== 0) {
1372
+ if ((flags & 1024) === 0) return;
1373
+ e.f ^= CLEAN;
1374
+ }
1375
+ }
1376
+ _classPrivateFieldGet2(_roots, this).push(e);
1377
+ }
1378
+ };
1379
+ _Batch = Batch;
1380
+ function _is_deferred() {
1381
+ if (this.is_fork) return true;
1382
+ for (const effect of _classPrivateFieldGet2(_blocking_pending, this).keys()) {
1383
+ var e = effect;
1384
+ var skipped = false;
1385
+ while (e.parent !== null) {
1386
+ if (_classPrivateFieldGet2(_skipped_branches, this).has(e)) {
1387
+ skipped = true;
1388
+ break;
1389
+ }
1390
+ e = e.parent;
1391
+ }
1392
+ if (!skipped) return true;
1393
+ }
1394
+ return false;
1395
+ }
1396
+ function _process() {
1397
+ _classPrivateFieldSet2(_started, this, true);
1398
+ if (flush_count++ > 1e3) {
1399
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1400
+ infinite_loop_guard();
1401
+ }
1402
+ for (const e of _classPrivateFieldGet2(_dirty_effects, this)) {
1403
+ _classPrivateFieldGet2(_maybe_dirty_effects, this).delete(e);
1404
+ set_signal_status(e, DIRTY);
1405
+ this.schedule(e);
1406
+ }
1407
+ for (const e of _classPrivateFieldGet2(_maybe_dirty_effects, this)) {
1408
+ set_signal_status(e, MAYBE_DIRTY);
1409
+ this.schedule(e);
1410
+ }
1411
+ const roots = _classPrivateFieldGet2(_roots, this);
1412
+ _classPrivateFieldSet2(_roots, this, []);
1413
+ this.apply();
1414
+ /** @type {Effect[]} */
1415
+ var effects = collected_effects = [];
1416
+ /** @type {Effect[]} */
1417
+ var render_effects = [];
1418
+ /**
1419
+ * @type {Effect[]}
1420
+ * @deprecated when we get rid of legacy mode and stores, we can get rid of this
1421
+ */
1422
+ var updates = legacy_updates = [];
1423
+ for (const root of roots) try {
1424
+ _assertClassBrand(_Batch_brand, this, _traverse).call(this, root, effects, render_effects);
1425
+ } catch (e) {
1426
+ reset_all(root);
1427
+ if (!_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) this.discard();
1428
+ throw e;
1429
+ }
1430
+ current_batch = null;
1431
+ if (updates.length > 0) {
1432
+ var batch = _Batch.ensure();
1433
+ for (const e of updates) batch.schedule(e);
1434
+ }
1435
+ collected_effects = null;
1436
+ legacy_updates = null;
1437
+ if (_assertClassBrand(_Batch_brand, this, _is_deferred).call(this)) {
1438
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
1439
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
1440
+ for (const [e, t] of _classPrivateFieldGet2(_skipped_branches, this)) reset_branch(e, t);
1441
+ if (updates.length > 0)
1442
+ /** @type {Batch} */ _assertClassBrand(_Batch_brand, current_batch, _process).call(current_batch);
1443
+ return;
1444
+ }
1445
+ const earlier_batch = _assertClassBrand(_Batch_brand, this, _find_earlier_batch).call(this);
1446
+ if (earlier_batch) {
1447
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, render_effects);
1448
+ _assertClassBrand(_Batch_brand, this, _defer_effects).call(this, effects);
1449
+ _assertClassBrand(_Batch_brand, earlier_batch, _merge).call(earlier_batch, this);
1450
+ return;
1451
+ }
1452
+ _classPrivateFieldGet2(_dirty_effects, this).clear();
1453
+ _classPrivateFieldGet2(_maybe_dirty_effects, this).clear();
1454
+ for (const fn of _classPrivateFieldGet2(_commit_callbacks, this)) fn(this);
1455
+ _classPrivateFieldGet2(_commit_callbacks, this).clear();
1456
+ previous_batch = this;
1457
+ flush_queued_effects(render_effects);
1458
+ flush_queued_effects(effects);
1459
+ previous_batch = null;
1460
+ _classPrivateFieldGet2(_deferred, this)?.resolve();
1461
+ var next_batch = current_batch;
1462
+ if (_classPrivateFieldGet2(_pending, this) === 0 && (_classPrivateFieldGet2(_roots, this).length === 0 || next_batch !== null)) {
1463
+ _assertClassBrand(_Batch_brand, this, _unlink).call(this);
1464
+ if (async_mode_flag) {
1465
+ _assertClassBrand(_Batch_brand, this, _commit).call(this);
1466
+ current_batch = next_batch;
1467
+ }
1468
+ }
1469
+ if (_classPrivateFieldGet2(_roots, this).length > 0) if (next_batch !== null) {
1470
+ const batch = next_batch;
1471
+ _classPrivateFieldGet2(_roots, batch).push(..._classPrivateFieldGet2(_roots, this).filter((r) => !_classPrivateFieldGet2(_roots, batch).includes(r)));
1472
+ } else next_batch = this;
1473
+ if (next_batch !== null) _assertClassBrand(_Batch_brand, next_batch, _process).call(next_batch);
1539
1474
  }
1540
1475
  /**
1541
- * @template V
1542
- * @param {() => V} fn
1543
- * @returns {Derived<V>}
1476
+ * Traverse the effect tree, executing effects or stashing
1477
+ * them for later execution as appropriate
1478
+ * @param {Effect} root
1479
+ * @param {Effect[]} effects
1480
+ * @param {Effect[]} render_effects
1544
1481
  */
1545
- /* @__NO_SIDE_EFFECTS__ */
1546
- function derived(fn) {
1547
- var flags = 2 | DIRTY;
1548
- if (active_effect !== null) active_effect.f |= EFFECT_PRESERVED;
1549
- return {
1550
- ctx: component_context,
1551
- deps: null,
1552
- effects: null,
1553
- equals,
1554
- f: flags,
1555
- fn,
1556
- reactions: null,
1557
- rv: 0,
1558
- v: UNINITIALIZED,
1559
- wv: 0,
1560
- parent: active_effect,
1561
- ac: null
1562
- };
1482
+ function _traverse(root, effects, render_effects) {
1483
+ root.f ^= CLEAN;
1484
+ var effect = root.first;
1485
+ while (effect !== null) {
1486
+ var flags = effect.f;
1487
+ var is_branch = (flags & 96) !== 0;
1488
+ if (!(is_branch && (flags & 1024) !== 0 || (flags & 8192) !== 0 || _classPrivateFieldGet2(_skipped_branches, this).has(effect)) && effect.fn !== null) {
1489
+ if (is_branch) effect.f ^= CLEAN;
1490
+ else if ((flags & 4) !== 0) effects.push(effect);
1491
+ else if (async_mode_flag && (flags & 16777224) !== 0) render_effects.push(effect);
1492
+ else if (is_dirty(effect)) {
1493
+ if ((flags & 16) !== 0) _classPrivateFieldGet2(_maybe_dirty_effects, this).add(effect);
1494
+ update_effect(effect);
1495
+ }
1496
+ var child = effect.first;
1497
+ if (child !== null) {
1498
+ effect = child;
1499
+ continue;
1500
+ }
1501
+ }
1502
+ while (effect !== null) {
1503
+ var next = effect.next;
1504
+ if (next !== null) {
1505
+ effect = next;
1506
+ break;
1507
+ }
1508
+ effect = effect.parent;
1509
+ }
1510
+ }
1511
+ }
1512
+ function _find_earlier_batch() {
1513
+ var batch = _classPrivateFieldGet2(_prev, this);
1514
+ while (batch !== null) {
1515
+ if (!batch.is_fork) {
1516
+ for (const [value, [, is_derived]] of this.current) if (batch.current.has(value) && !is_derived) return batch;
1517
+ }
1518
+ batch = _classPrivateFieldGet2(_prev, batch);
1519
+ }
1520
+ return null;
1563
1521
  }
1564
1522
  /**
1565
- * @template V
1566
- * @param {() => V} fn
1567
- * @returns {Derived<V>}
1523
+ * @param {Batch} batch
1568
1524
  */
1569
- /* @__NO_SIDE_EFFECTS__ */
1570
- function derived_safe_equal(fn) {
1571
- const signal = /* @__PURE__ */ derived(fn);
1572
- signal.equals = safe_equals;
1573
- return signal;
1525
+ function _merge(batch) {
1526
+ for (const [source, value] of batch.current) {
1527
+ if (!this.previous.has(source) && batch.previous.has(source)) this.previous.set(source, batch.previous.get(source));
1528
+ this.current.set(source, value);
1529
+ }
1530
+ for (const [effect, deferred] of batch.async_deriveds) {
1531
+ const d = this.async_deriveds.get(effect);
1532
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
1533
+ }
1534
+ batch.async_deriveds.clear();
1535
+ this.transfer_effects(_classPrivateFieldGet2(_dirty_effects, batch), _classPrivateFieldGet2(_maybe_dirty_effects, batch));
1536
+ /**
1537
+ * mark all effects that depend on `batch.current`, except the
1538
+ * async effects that we just resolved (TODO unless they depend
1539
+ * on values in this batch that are NOT in the later batch?).
1540
+ * Through this we also will populate the correct #skipped_branches,
1541
+ * oncommit callbacks etc, so we don't need to merge them separately.
1542
+ * @param {Value} value
1543
+ */
1544
+ const mark = (value) => {
1545
+ var reactions = value.reactions;
1546
+ if (reactions === null) return;
1547
+ if ((value.f & 2) !== 0 && (value.f & 6144) === 0) return;
1548
+ for (const reaction of reactions) {
1549
+ var flags = reaction.f;
1550
+ if ((flags & 2) !== 0) mark(reaction);
1551
+ else {
1552
+ var effect = reaction;
1553
+ if (flags & 4194320 && !this.async_deriveds.has(effect)) {
1554
+ _classPrivateFieldGet2(_maybe_dirty_effects, this).delete(effect);
1555
+ set_signal_status(effect, DIRTY);
1556
+ this.schedule(effect);
1557
+ }
1558
+ }
1559
+ }
1560
+ };
1561
+ for (const source of this.current.keys()) mark(source);
1562
+ this.oncommit(() => batch.discard());
1563
+ _assertClassBrand(_Batch_brand, batch, _unlink).call(batch);
1564
+ current_batch = this;
1565
+ _assertClassBrand(_Batch_brand, this, _process).call(this);
1574
1566
  }
1575
1567
  /**
1576
- * @param {Derived} derived
1577
- * @returns {void}
1568
+ * @param {Effect[]} effects
1578
1569
  */
1579
- function destroy_derived_effects(derived) {
1580
- var effects = derived.effects;
1581
- if (effects !== null) {
1582
- derived.effects = null;
1583
- for (var i = 0; i < effects.length; i += 1) destroy_effect(effects[i]);
1570
+ function _defer_effects(effects) {
1571
+ for (var i = 0; i < effects.length; i += 1) defer_effect(effects[i], _classPrivateFieldGet2(_dirty_effects, this), _classPrivateFieldGet2(_maybe_dirty_effects, this));
1572
+ }
1573
+ function _commit() {
1574
+ for (let batch = first_batch; batch !== null; batch = _classPrivateFieldGet2(_next, batch)) {
1575
+ var is_earlier = batch.id < this.id;
1576
+ /** @type {Source[]} */
1577
+ var sources = [];
1578
+ for (const [source, [value, is_derived]] of this.current) {
1579
+ if (batch.current.has(source)) {
1580
+ var batch_value = batch.current.get(source)[0];
1581
+ if (is_earlier && value !== batch_value) batch.current.set(source, [value, is_derived]);
1582
+ else continue;
1583
+ }
1584
+ sources.push(source);
1585
+ }
1586
+ if (is_earlier) for (const [effect, deferred] of this.async_deriveds) {
1587
+ const d = batch.async_deriveds.get(effect);
1588
+ if (d) deferred.promise.then(d.resolve).catch(d.reject);
1589
+ }
1590
+ var current = [...batch.current.keys()].filter((source) => !batch.current.get(source)[1]);
1591
+ if (!_classPrivateFieldGet2(_started, batch) || current.length === 0) continue;
1592
+ var others = current.filter((source) => !this.current.has(source));
1593
+ if (others.length === 0) {
1594
+ if (is_earlier) batch.discard();
1595
+ } else if (sources.length > 0) {
1596
+ if (is_earlier) for (const unskipped of _classPrivateFieldGet2(_unskipped_branches, this)) batch.unskip_effect(unskipped, (e) => {
1597
+ if ((e.f & 4194320) !== 0) batch.schedule(e);
1598
+ else _assertClassBrand(_Batch_brand, batch, _defer_effects).call(batch, [e]);
1599
+ });
1600
+ batch.activate();
1601
+ /** @type {Set<Value>} */
1602
+ var marked = /* @__PURE__ */ new Set();
1603
+ /** @type {Map<Reaction, boolean>} */
1604
+ var checked = /* @__PURE__ */ new Map();
1605
+ for (var source of sources) mark_effects(source, others, marked, checked);
1606
+ checked = /* @__PURE__ */ new Map();
1607
+ var current_unequal = [...batch.current].filter(([c, v1]) => {
1608
+ const v2 = this.current.get(c);
1609
+ if (!v2) return true;
1610
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
1611
+ }).map(([c]) => c);
1612
+ if (current_unequal.length > 0) {
1613
+ for (const effect of _classPrivateFieldGet2(_new_effects, this)) if ((effect.f & 155648) === 0 && depends_on(effect, current_unequal, checked)) if ((effect.f & 4194320) !== 0) {
1614
+ set_signal_status(effect, DIRTY);
1615
+ batch.schedule(effect);
1616
+ } else _classPrivateFieldGet2(_dirty_effects, batch).add(effect);
1617
+ }
1618
+ if (_classPrivateFieldGet2(_roots, batch).length > 0 && !_classPrivateFieldGet2(_decrement_queued, batch)) {
1619
+ batch.apply();
1620
+ for (var root of _classPrivateFieldGet2(_roots, batch)) _assertClassBrand(_Batch_brand, batch, _traverse).call(batch, root, [], []);
1621
+ _classPrivateFieldSet2(_roots, batch, []);
1622
+ }
1623
+ batch.deactivate();
1624
+ }
1584
1625
  }
1585
1626
  }
1627
+ function _unlink() {
1628
+ if (!this.linked) return;
1629
+ var prev = _classPrivateFieldGet2(_prev, this);
1630
+ var next = _classPrivateFieldGet2(_next, this);
1631
+ if (prev === null) first_batch = next;
1632
+ else _classPrivateFieldSet2(_next, prev, next);
1633
+ if (next === null) last_batch = prev;
1634
+ else _classPrivateFieldSet2(_prev, next, prev);
1635
+ this.linked = false;
1636
+ }
1586
1637
  /**
1587
- * @template T
1588
- * @param {Derived} derived
1638
+ * Synchronously flush any pending updates.
1639
+ * Returns void if no callback is provided, otherwise returns the result of calling the callback.
1640
+ * @template [T=void]
1641
+ * @param {(() => T) | undefined} [fn]
1589
1642
  * @returns {T}
1590
1643
  */
1591
- function execute_derived(derived) {
1592
- var value;
1593
- var prev_active_effect = active_effect;
1594
- var parent = derived.parent;
1595
- if (!is_destroying_effect && parent !== null && (parent.f & 24576) !== 0) {
1596
- derived_inert();
1597
- return derived.v;
1598
- }
1599
- set_active_effect(parent);
1644
+ function flushSync(fn) {
1645
+ var was_flushing_sync = is_flushing_sync;
1646
+ is_flushing_sync = true;
1600
1647
  try {
1601
- derived.f &= ~WAS_MARKED;
1602
- destroy_derived_effects(derived);
1603
- value = update_reaction(derived);
1648
+ var result;
1649
+ if (fn) {
1650
+ if (current_batch !== null && !current_batch.is_fork) current_batch.flush();
1651
+ result = fn();
1652
+ }
1653
+ while (true) {
1654
+ flush_tasks();
1655
+ if (current_batch === null) return result;
1656
+ current_batch.flush();
1657
+ }
1604
1658
  } finally {
1605
- set_active_effect(prev_active_effect);
1659
+ is_flushing_sync = was_flushing_sync;
1660
+ }
1661
+ }
1662
+ function infinite_loop_guard() {
1663
+ try {
1664
+ effect_update_depth_exceeded();
1665
+ } catch (error) {
1666
+ invoke_error_boundary(error, last_scheduled_effect);
1606
1667
  }
1607
- return value;
1608
1668
  }
1669
+ /** @type {Set<Effect> | null} */
1670
+ var eager_block_effects = null;
1609
1671
  /**
1610
- * @param {Derived} derived
1672
+ * @param {Array<Effect>} effects
1611
1673
  * @returns {void}
1612
1674
  */
1613
- function update_derived(derived) {
1614
- var value = execute_derived(derived);
1615
- if (!derived.equals(value)) {
1616
- derived.wv = increment_write_version();
1617
- if (!current_batch?.is_fork || derived.deps === null) {
1618
- if (current_batch !== null) current_batch.capture(derived, value, true);
1619
- else derived.v = value;
1620
- if (derived.deps === null) {
1621
- set_signal_status(derived, CLEAN);
1622
- return;
1675
+ function flush_queued_effects(effects) {
1676
+ var length = effects.length;
1677
+ if (length === 0) return;
1678
+ var i = 0;
1679
+ while (i < length) {
1680
+ var effect = effects[i++];
1681
+ if ((effect.f & 24576) === 0 && is_dirty(effect)) {
1682
+ eager_block_effects = /* @__PURE__ */ new Set();
1683
+ update_effect(effect);
1684
+ if (effect.deps === null && effect.first === null && effect.nodes === null && effect.teardown === null && effect.ac === null) unlink_effect(effect);
1685
+ if (eager_block_effects?.size > 0) {
1686
+ old_values.clear();
1687
+ for (const e of eager_block_effects) {
1688
+ if ((e.f & 24576) !== 0) continue;
1689
+ /** @type {Effect[]} */
1690
+ const ordered_effects = [e];
1691
+ let ancestor = e.parent;
1692
+ while (ancestor !== null) {
1693
+ if (eager_block_effects.has(ancestor)) {
1694
+ eager_block_effects.delete(ancestor);
1695
+ ordered_effects.push(ancestor);
1696
+ }
1697
+ ancestor = ancestor.parent;
1698
+ }
1699
+ for (let j = ordered_effects.length - 1; j >= 0; j--) {
1700
+ const e = ordered_effects[j];
1701
+ if ((e.f & 24576) !== 0) continue;
1702
+ update_effect(e);
1703
+ }
1704
+ }
1705
+ eager_block_effects.clear();
1623
1706
  }
1624
1707
  }
1625
1708
  }
1626
- if (is_destroying_effect) return;
1627
- if (batch_values !== null) {
1628
- if (effect_tracking() || current_batch?.is_fork) batch_values.set(derived, value);
1629
- } else update_derived_status(derived);
1709
+ eager_block_effects = null;
1630
1710
  }
1631
1711
  /**
1632
- * @param {Derived} derived
1712
+ * This is similar to `mark_reactions`, but it only marks async/block effects
1713
+ * depending on `value` and at least one of the other `sources`, so that
1714
+ * these effects can re-run after another batch has been committed
1715
+ * @param {Value} value
1716
+ * @param {Source[]} sources
1717
+ * @param {Set<Value>} marked
1718
+ * @param {Map<Reaction, boolean>} checked
1633
1719
  */
1634
- function freeze_derived_effects(derived) {
1635
- if (derived.effects === null) return;
1636
- for (const e of derived.effects) if (e.teardown || e.ac) {
1637
- e.teardown?.();
1638
- e.ac?.abort(STALE_REACTION);
1639
- e.teardown = noop;
1640
- e.ac = null;
1641
- remove_reactions(e, 0);
1642
- destroy_effect_children(e);
1720
+ function mark_effects(value, sources, marked, checked) {
1721
+ if (marked.has(value)) return;
1722
+ marked.add(value);
1723
+ if (value.reactions !== null) for (const reaction of value.reactions) {
1724
+ const flags = reaction.f;
1725
+ if ((flags & 2) !== 0) mark_effects(reaction, sources, marked, checked);
1726
+ else if ((flags & 4194320) !== 0 && (flags & 2048) === 0 && depends_on(reaction, sources, checked)) {
1727
+ set_signal_status(reaction, DIRTY);
1728
+ schedule_effect(reaction);
1729
+ }
1643
1730
  }
1644
1731
  }
1645
1732
  /**
1646
- * @param {Derived} derived
1733
+ * @param {Reaction} reaction
1734
+ * @param {Source[]} sources
1735
+ * @param {Map<Reaction, boolean>} checked
1647
1736
  */
1648
- function unfreeze_derived_effects(derived) {
1649
- if (derived.effects === null) return;
1650
- for (const e of derived.effects) if (e.teardown) update_effect(e);
1737
+ function depends_on(reaction, sources, checked) {
1738
+ const depends = checked.get(reaction);
1739
+ if (depends !== void 0) return depends;
1740
+ if (reaction.deps !== null) for (const dep of reaction.deps) {
1741
+ if (includes.call(sources, dep)) return true;
1742
+ if ((dep.f & 2) !== 0 && depends_on(dep, sources, checked)) {
1743
+ checked.set(dep, true);
1744
+ return true;
1745
+ }
1746
+ }
1747
+ checked.set(reaction, false);
1748
+ return false;
1749
+ }
1750
+ /**
1751
+ * @param {Effect} effect
1752
+ * @returns {void}
1753
+ */
1754
+ function schedule_effect(effect) {
1755
+ /** @type {Batch} */ current_batch.schedule(effect);
1756
+ }
1757
+ /**
1758
+ * Mark all the effects inside a skipped branch CLEAN, so that
1759
+ * they can be correctly rescheduled later. Tracks dirty and maybe_dirty
1760
+ * effects so they can be rescheduled if the branch survives.
1761
+ * @param {Effect} effect
1762
+ * @param {{ d: Effect[], m: Effect[] }} tracked
1763
+ */
1764
+ function reset_branch(effect, tracked) {
1765
+ if ((effect.f & 32) !== 0 && (effect.f & 1024) !== 0) return;
1766
+ if ((effect.f & 2048) !== 0) tracked.d.push(effect);
1767
+ else if ((effect.f & 4096) !== 0) tracked.m.push(effect);
1768
+ set_signal_status(effect, CLEAN);
1769
+ var e = effect.first;
1770
+ while (e !== null) {
1771
+ reset_branch(e, tracked);
1772
+ e = e.next;
1773
+ }
1774
+ }
1775
+ /**
1776
+ * Mark an entire effect tree clean following an error
1777
+ * @param {Effect} effect
1778
+ */
1779
+ function reset_all(effect) {
1780
+ set_signal_status(effect, CLEAN);
1781
+ var e = effect.first;
1782
+ while (e !== null) {
1783
+ reset_all(e);
1784
+ e = e.next;
1785
+ }
1651
1786
  }
1652
1787
  //#endregion
1653
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/sources.js
1788
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/sources.js
1654
1789
  /** @import { Derived, Effect, Source, Value } from '#client' */
1655
- /** @type {Set<any>} */
1790
+ /** @type {Set<Effect>} */
1656
1791
  var eager_effects = /* @__PURE__ */ new Set();
1657
1792
  /** @type {Map<Source, any>} */
1658
1793
  var old_values = /* @__PURE__ */ new Map();
@@ -1678,7 +1813,7 @@ function source(v, stack) {
1678
1813
  * @param {V} v
1679
1814
  * @param {Error | null} [stack]
1680
1815
  */
1681
- /* @__NO_SIDE_EFFECTS__ */
1816
+ /*#__NO_SIDE_EFFECTS__*/
1682
1817
  function state(v, stack) {
1683
1818
  const s = source(v, stack);
1684
1819
  push_reaction_value(s);
@@ -1690,7 +1825,7 @@ function state(v, stack) {
1690
1825
  * @param {boolean} [immutable]
1691
1826
  * @returns {Source<V>}
1692
1827
  */
1693
- /* @__NO_SIDE_EFFECTS__ */
1828
+ /*#__NO_SIDE_EFFECTS__*/
1694
1829
  function mutable_source(initial_value, immutable = false, trackable = true) {
1695
1830
  const s = source(initial_value);
1696
1831
  if (!immutable) s.equals = safe_equals;
@@ -1708,7 +1843,7 @@ function mutable_source(initial_value, immutable = false, trackable = true) {
1708
1843
  * @returns {V}
1709
1844
  */
1710
1845
  function set(source, value, should_proxy = false) {
1711
- if (active_reaction !== null && (!untracking || (active_reaction.f & 131072) !== 0) && is_runes() && (active_reaction.f & 4325394) !== 0 && (current_sources === null || !includes.call(current_sources, source))) state_unsafe_mutation();
1846
+ 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();
1712
1847
  return internal_set(source, should_proxy ? proxy(value) : value, legacy_updates);
1713
1848
  }
1714
1849
  /**
@@ -1740,7 +1875,13 @@ function flush_eager_effects() {
1740
1875
  eager_effects_deferred = false;
1741
1876
  for (const effect of eager_effects) {
1742
1877
  if ((effect.f & 1024) !== 0) set_signal_status(effect, MAYBE_DIRTY);
1743
- if (is_dirty(effect)) update_effect(effect);
1878
+ let dirty;
1879
+ try {
1880
+ dirty = is_dirty(effect);
1881
+ } catch {
1882
+ dirty = true;
1883
+ }
1884
+ if (dirty) update_effect(effect);
1744
1885
  }
1745
1886
  eager_effects.clear();
1746
1887
  }
@@ -1768,7 +1909,8 @@ function mark_reactions(signal, status, updated_during_traversal) {
1768
1909
  if (!runes && reaction === active_effect) continue;
1769
1910
  var not_dirty = (flags & DIRTY) === 0;
1770
1911
  if (not_dirty) set_signal_status(reaction, status);
1771
- if ((flags & 2) !== 0) {
1912
+ if ((flags & 131072) !== 0) eager_effects.add(reaction);
1913
+ else if ((flags & 2) !== 0) {
1772
1914
  var derived = reaction;
1773
1915
  batch_values?.delete(derived);
1774
1916
  if ((flags & 65536) === 0) {
@@ -1942,7 +2084,7 @@ function proxy(value) {
1942
2084
  });
1943
2085
  }
1944
2086
  //#endregion
1945
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/operations.js
2087
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/operations.js
1946
2088
  /** @type {Window} */
1947
2089
  var $window;
1948
2090
  /** @type {boolean} */
@@ -1965,13 +2107,13 @@ function init_operations() {
1965
2107
  first_child_getter = get_descriptor(node_prototype, "firstChild").get;
1966
2108
  next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
1967
2109
  if (is_extensible(element_prototype)) {
1968
- element_prototype.__click = void 0;
1969
- element_prototype.__className = void 0;
1970
- element_prototype.__attributes = null;
1971
- element_prototype.__style = void 0;
2110
+ /** @type {any} */ element_prototype[CLASS_CACHE] = void 0;
2111
+ /** @type {any} */ element_prototype[ATTRIBUTES_CACHE] = null;
2112
+ /** @type {any} */ element_prototype[STYLE_CACHE] = void 0;
1972
2113
  element_prototype.__e = void 0;
1973
2114
  }
1974
- if (is_extensible(text_prototype)) text_prototype.__t = void 0;
2115
+ if (is_extensible(text_prototype))
2116
+ /** @type {any} */ text_prototype[TEXT_CACHE] = void 0;
1975
2117
  }
1976
2118
  /**
1977
2119
  * @param {string} value
@@ -1984,7 +2126,7 @@ function create_text(value = "") {
1984
2126
  * @template {Node} N
1985
2127
  * @param {N} node
1986
2128
  */
1987
- /* @__NO_SIDE_EFFECTS__ */
2129
+ /*@__NO_SIDE_EFFECTS__*/
1988
2130
  function get_first_child(node) {
1989
2131
  return first_child_getter.call(node);
1990
2132
  }
@@ -1992,7 +2134,7 @@ function get_first_child(node) {
1992
2134
  * @template {Node} N
1993
2135
  * @param {N} node
1994
2136
  */
1995
- /* @__NO_SIDE_EFFECTS__ */
2137
+ /*@__NO_SIDE_EFFECTS__*/
1996
2138
  function get_next_sibling(node) {
1997
2139
  return next_sibling_getter.call(node);
1998
2140
  }
@@ -2005,6 +2147,12 @@ function clear_text_content(node) {
2005
2147
  node.textContent = "";
2006
2148
  }
2007
2149
  /**
2150
+ * Branching here is intentional and load-bearing for perf. `createElement(tag)`
2151
+ * hits a fast path in Blink that `createElementNS(NAMESPACE_HTML, tag)` doesn't,
2152
+ * and passing an explicit `undefined` as the trailing options arg measurably
2153
+ * slows both APIs. Funnelling every case through a single `createElementNS(ns,
2154
+ * tag, options)` call would be smaller but slower on the HTML path.
2155
+ *
2008
2156
  * @template {keyof HTMLElementTagNameMap | string} T
2009
2157
  * @param {T} tag
2010
2158
  * @param {string} [namespace]
@@ -2012,29 +2160,11 @@ function clear_text_content(node) {
2012
2160
  * @returns {T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : Element}
2013
2161
  */
2014
2162
  function create_element(tag, namespace, is) {
2015
- let options = is ? { is } : void 0;
2016
- return document.createElementNS(namespace ?? "http://www.w3.org/1999/xhtml", tag, options);
2017
- }
2018
- //#endregion
2019
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2020
- /**
2021
- * @template T
2022
- * @param {() => T} fn
2023
- */
2024
- function without_reactive_context(fn) {
2025
- var previous_reaction = active_reaction;
2026
- var previous_effect = active_effect;
2027
- set_active_reaction(null);
2028
- set_active_effect(null);
2029
- try {
2030
- return fn();
2031
- } finally {
2032
- set_active_reaction(previous_reaction);
2033
- set_active_effect(previous_effect);
2034
- }
2163
+ if (namespace == null || namespace === "http://www.w3.org/1999/xhtml") return is ? document.createElement(tag, { is }) : document.createElement(tag);
2164
+ return is ? document.createElementNS(namespace, tag, { is }) : document.createElementNS(namespace, tag);
2035
2165
  }
2036
2166
  //#endregion
2037
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/effects.js
2167
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/effects.js
2038
2168
  /** @import { Blocker, ComponentContext, ComponentContextLegacy, Derived, Effect, TemplateNode, TransitionManager } from '#client' */
2039
2169
  /**
2040
2170
  * @param {Effect} effect
@@ -2234,7 +2364,7 @@ function destroy_effect(effect, remove_dom = true) {
2234
2364
  remove_effect_dom(effect.nodes.start, effect.nodes.end);
2235
2365
  removed = true;
2236
2366
  }
2237
- set_signal_status(effect, DESTROYING);
2367
+ effect.f |= DESTROYING;
2238
2368
  destroy_effect_children(effect, remove_dom && !removed);
2239
2369
  remove_reactions(effect, 0);
2240
2370
  var transitions = effect.nodes && effect.nodes.t;
@@ -2338,15 +2468,18 @@ function move_effect(effect, fragment) {
2338
2468
  }
2339
2469
  }
2340
2470
  //#endregion
2341
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/legacy.js
2471
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/legacy.js
2342
2472
  /**
2343
2473
  * @type {Set<Value> | null}
2344
2474
  * @deprecated
2345
2475
  */
2346
2476
  var captured_signals = null;
2347
2477
  //#endregion
2348
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/runtime.js
2478
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/runtime.js
2349
2479
  /** @import { Derived, Effect, Reaction, Source, Value } from '#client' */
2480
+ /**
2481
+ * True if updating in an effect context that is reactive (i.e. not branch/root effects)
2482
+ */
2350
2483
  var is_updating_effect = false;
2351
2484
  var is_destroying_effect = false;
2352
2485
  /** @param {boolean} value */
@@ -2369,13 +2502,12 @@ function set_active_effect(effect) {
2369
2502
  /**
2370
2503
  * When sources are created within a reaction, reading and writing
2371
2504
  * them within that reaction should not cause a re-run
2372
- * @type {null | Source[]}
2505
+ * @type {null | Set<Source>}
2373
2506
  */
2374
2507
  var current_sources = null;
2375
2508
  /** @param {Value} value */
2376
2509
  function push_reaction_value(value) {
2377
- if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) if (current_sources === null) current_sources = [value];
2378
- else current_sources.push(value);
2510
+ if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & 2) !== 0)) (current_sources ?? (current_sources = /* @__PURE__ */ new Set())).add(value);
2379
2511
  }
2380
2512
  /**
2381
2513
  * The dependencies of the reaction that is currently being executed. In many cases,
@@ -2440,7 +2572,7 @@ function is_dirty(reaction) {
2440
2572
  function schedule_possible_effect_self_invalidation(signal, effect, root = true) {
2441
2573
  var reactions = signal.reactions;
2442
2574
  if (reactions === null) return;
2443
- if (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) return;
2575
+ if (!async_mode_flag && current_sources !== null && current_sources.has(signal)) return;
2444
2576
  for (var i = 0; i < reactions.length; i++) {
2445
2577
  var reaction = reactions[i];
2446
2578
  if ((reaction.f & 2) !== 0) schedule_possible_effect_self_invalidation(reaction, effect, false);
@@ -2548,6 +2680,11 @@ function remove_reaction(signal, dependency) {
2548
2680
  derived.f &= ~WAS_MARKED;
2549
2681
  }
2550
2682
  if (derived.v !== UNINITIALIZED) update_derived_status(derived);
2683
+ if (derived.ac !== null) without_reactive_context(() => {
2684
+ /** @type {AbortController} */ derived.ac.abort(STALE_REACTION);
2685
+ derived.ac = null;
2686
+ set_signal_status(derived, DIRTY);
2687
+ });
2551
2688
  freeze_derived_effects(derived);
2552
2689
  remove_reactions(derived, 0);
2553
2690
  }
@@ -2573,7 +2710,7 @@ function update_effect(effect) {
2573
2710
  var previous_effect = active_effect;
2574
2711
  var was_updating_effect = is_updating_effect;
2575
2712
  active_effect = effect;
2576
- is_updating_effect = true;
2713
+ is_updating_effect = (flags & 96) === 0;
2577
2714
  try {
2578
2715
  if ((flags & 16777232) !== 0) destroy_block_effect_children(effect);
2579
2716
  else destroy_effect_children(effect);
@@ -2595,7 +2732,7 @@ function get(signal) {
2595
2732
  var is_derived = (signal.f & 2) !== 0;
2596
2733
  captured_signals?.add(signal);
2597
2734
  if (active_reaction !== null && !untracking) {
2598
- if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !includes.call(current_sources, signal))) {
2735
+ if (!(active_effect !== null && (active_effect.f & 16384) !== 0) && (current_sources === null || !current_sources.has(signal))) {
2599
2736
  var deps = active_reaction.deps;
2600
2737
  if ((active_reaction.f & 2097152) !== 0) {
2601
2738
  if (signal.rv < read_version) {
@@ -2606,7 +2743,8 @@ function get(signal) {
2606
2743
  }
2607
2744
  } else {
2608
2745
  var _active_reaction;
2609
- ((_active_reaction = active_reaction).deps ?? (_active_reaction.deps = [])).push(signal);
2746
+ (_active_reaction = active_reaction).deps ?? (_active_reaction.deps = []);
2747
+ if (!includes.call(active_reaction.deps, signal)) active_reaction.deps.push(signal);
2610
2748
  var reactions = signal.reactions;
2611
2749
  if (reactions === null) signal.reactions = [active_reaction];
2612
2750
  else if (!includes.call(reactions, active_reaction)) reactions.push(active_reaction);
@@ -2689,7 +2827,7 @@ function untrack(fn) {
2689
2827
  }
2690
2828
  }
2691
2829
  //#endregion
2692
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/events.js
2830
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/elements/events.js
2693
2831
  /**
2694
2832
  * Used on elements, as a map of event type -> event handler,
2695
2833
  * and on events themselves to track which element handled an event
@@ -2746,8 +2884,7 @@ function handle_event_propagation(event) {
2746
2884
  */
2747
2885
  var other_errors = [];
2748
2886
  while (current_target !== null) {
2749
- /** @type {null | Element} */
2750
- var parent_element = current_target.assignedSlot || current_target.parentNode || current_target.host || null;
2887
+ if (current_target === handler_element) break;
2751
2888
  try {
2752
2889
  var delegated = current_target[event_symbol]?.[event_name];
2753
2890
  if (delegated != null && (!current_target.disabled || event.target === current_target)) delegated.call(current_target, event);
@@ -2755,8 +2892,9 @@ function handle_event_propagation(event) {
2755
2892
  if (throw_error) other_errors.push(error);
2756
2893
  else throw_error = error;
2757
2894
  }
2758
- if (event.cancelBubble || parent_element === handler_element || parent_element === null) break;
2759
- current_target = parent_element;
2895
+ if (event.cancelBubble) break;
2896
+ path_idx++;
2897
+ current_target = path_idx < path.length ? path[path_idx] : null;
2760
2898
  }
2761
2899
  if (throw_error) {
2762
2900
  for (let error of other_errors) queueMicrotask(() => {
@@ -2772,7 +2910,7 @@ function handle_event_propagation(event) {
2772
2910
  }
2773
2911
  }
2774
2912
  //#endregion
2775
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/reconciler.js
2913
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/reconciler.js
2776
2914
  var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
2777
2915
  /** @param {string} html */
2778
2916
  createHTML: (html) => {
@@ -2791,7 +2929,7 @@ function create_fragment_from_html(html) {
2791
2929
  return elem.content;
2792
2930
  }
2793
2931
  //#endregion
2794
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/template.js
2932
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/template.js
2795
2933
  /** @import { Effect, EffectNodes, TemplateNode } from '#client' */
2796
2934
  /** @import { TemplateStructure } from './types' */
2797
2935
  /**
@@ -2812,7 +2950,7 @@ function assign_nodes(start, end) {
2812
2950
  * @param {number} flags
2813
2951
  * @returns {() => Node | Node[]}
2814
2952
  */
2815
- /* @__NO_SIDE_EFFECTS__ */
2953
+ /*#__NO_SIDE_EFFECTS__*/
2816
2954
  function from_html(content, flags) {
2817
2955
  var is_fragment = (flags & 1) !== 0;
2818
2956
  var use_import_node = (flags & 2) !== 0;
@@ -3050,7 +3188,7 @@ function unmount(component, options) {
3050
3188
  return Promise.resolve();
3051
3189
  }
3052
3190
  //#endregion
3053
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/css.js
3191
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/css.js
3054
3192
  /**
3055
3193
  * @param {Node} anchor
3056
3194
  * @param {{ hash: string, code: string }} css
@@ -3068,7 +3206,7 @@ function append_styles(anchor, css) {
3068
3206
  });
3069
3207
  }
3070
3208
  //#endregion
3071
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3209
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3072
3210
  var _ResizeObserverSingleton;
3073
3211
  var _listeners = /* @__PURE__ */ new WeakMap();
3074
3212
  var _observer = /* @__PURE__ */ new WeakMap();
@@ -3120,8 +3258,8 @@ function _getObserver() {
3120
3258
  }
3121
3259
  _defineProperty(ResizeObserverSingleton, "entries", /* @__PURE__ */ new WeakMap());
3122
3260
  //#endregion
3123
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/reactivity/props.js
3124
- /** @import { Effect, Source } from './types.js' */
3261
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/reactivity/props.js
3262
+ /** @import { Derived, Effect, Source } from './types.js' */
3125
3263
  /**
3126
3264
  * This function is responsible for synchronizing a possibly bound prop with the inner component state.
3127
3265
  * It is used whenever the compiler sees that the component writes to the prop, or when it has a default prop_value.
@@ -3138,7 +3276,12 @@ function prop(props, key, flags, fallback) {
3138
3276
  var lazy = (flags & 16) !== 0;
3139
3277
  var fallback_value = fallback;
3140
3278
  var fallback_dirty = true;
3279
+ var fallback_signal = void 0;
3141
3280
  var get_fallback = () => {
3281
+ if (lazy && runes) {
3282
+ fallback_signal ?? (fallback_signal = /* @__PURE__ */ derived(fallback));
3283
+ return get(fallback_signal);
3284
+ }
3142
3285
  if (fallback_dirty) {
3143
3286
  fallback_dirty = false;
3144
3287
  fallback_value = lazy ? untrack(fallback) : fallback;
@@ -3208,7 +3351,7 @@ function prop(props, key, flags, fallback) {
3208
3351
  });
3209
3352
  }
3210
3353
  //#endregion
3211
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/legacy/legacy-client.js
3354
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/legacy/legacy-client.js
3212
3355
  /** @import { ComponentConstructorOptions, ComponentType, SvelteComponent, Component } from 'svelte' */
3213
3356
  /**
3214
3357
  * Takes the same options as a Svelte 4 component and the component function and returns a Svelte 4 compatible component.
@@ -3327,7 +3470,7 @@ var Svelte4Component = class {
3327
3470
  }
3328
3471
  };
3329
3472
  //#endregion
3330
- //#region ../../../node_modules/.bun/svelte@5.55.5/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
3473
+ //#region ../../../node_modules/.bun/svelte@5.56.8/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
3331
3474
  /**
3332
3475
  * @typedef {Object} CustomElementPropDefinition
3333
3476
  * @property {string} [attribute]