@pie-players/pie-assessment-toolkit 0.3.44 → 0.3.45

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 (191) hide show
  1. package/README.md +54 -69
  2. package/dist/components/ItemToolBar.custom-element.js +479 -324
  3. package/dist/components/PieAssessmentToolkit.custom-element.js +19498 -3590
  4. package/dist/components/SectionToolBar.custom-element.js +761 -507
  5. package/dist/index.d.ts +3 -6
  6. package/dist/index.js +1 -3
  7. package/dist/index.js.map +1 -1
  8. package/dist/policy/core/ToolPolicyEngine.d.ts +1 -2
  9. package/dist/policy/core/ToolPolicyEngine.js +1 -2
  10. package/dist/policy/core/ToolPolicyEngine.js.map +1 -1
  11. package/dist/policy/core/pnp-policy-inputs.d.ts +2 -3
  12. package/dist/policy/core/pnp-policy-inputs.js +2 -3
  13. package/dist/policy/core/pnp-policy-inputs.js.map +1 -1
  14. package/dist/policy/core/provenance.d.ts +7 -34
  15. package/dist/policy/core/provenance.js +4 -21
  16. package/dist/policy/core/provenance.js.map +1 -1
  17. package/dist/policy/sources/PnpPolicySource.d.ts +6 -19
  18. package/dist/policy/sources/PnpPolicySource.js +6 -19
  19. package/dist/policy/sources/PnpPolicySource.js.map +1 -1
  20. package/dist/runtime/SectionRuntimeEngine.d.ts +13 -28
  21. package/dist/runtime/SectionRuntimeEngine.js +13 -27
  22. package/dist/runtime/SectionRuntimeEngine.js.map +1 -1
  23. package/dist/runtime/adapter/SectionEngineAdapter.d.ts +2 -2
  24. package/dist/runtime/adapter/SectionEngineAdapter.js +2 -2
  25. package/dist/runtime/adapter/SectionEngineAdapter.js.map +1 -1
  26. package/dist/runtime/adapter/coordinator-bridge.d.ts +1 -1
  27. package/dist/runtime/adapter/coordinator-bridge.js +1 -1
  28. package/dist/runtime/adapter/coordinator-bridge.js.map +1 -1
  29. package/dist/runtime/adapter/dom-event-bridge.d.ts +1 -1
  30. package/dist/runtime/adapter/dom-event-bridge.js +1 -1
  31. package/dist/runtime/adapter/dom-event-bridge.js.map +1 -1
  32. package/dist/runtime/catalog-registration.d.ts +12 -0
  33. package/dist/runtime/catalog-registration.js +54 -0
  34. package/dist/runtime/catalog-registration.js.map +1 -0
  35. package/dist/runtime/core/engine-output.d.ts +2 -2
  36. package/dist/runtime/core/engine-output.js +2 -2
  37. package/dist/runtime/core/engine-output.js.map +1 -1
  38. package/dist/runtime/core/engine-readiness.d.ts +2 -2
  39. package/dist/runtime/core/engine-readiness.js.map +1 -1
  40. package/dist/runtime/core/engine-resolver.d.ts +13 -41
  41. package/dist/runtime/core/engine-resolver.js +19 -76
  42. package/dist/runtime/core/engine-resolver.js.map +1 -1
  43. package/dist/runtime/core/engine-transition.d.ts +1 -1
  44. package/dist/runtime/core/engine-transition.js +1 -1
  45. package/dist/runtime/core/engine-transition.js.map +1 -1
  46. package/dist/runtime/engine.d.ts +1 -1
  47. package/dist/runtime/engine.js.map +1 -1
  48. package/dist/runtime/section-runtime-engine-host-context.d.ts +22 -15
  49. package/dist/runtime/section-runtime-engine-host-context.js +10 -10
  50. package/dist/runtime/section-runtime-engine-host-context.js.map +1 -1
  51. package/dist/runtime/stage-emit-gate.d.ts +4 -4
  52. package/dist/runtime/stage-emit-gate.js +3 -3
  53. package/dist/runtime/stage-emit-gate.js.map +1 -1
  54. package/dist/services/AccessibilityCatalogResolver.d.ts +23 -0
  55. package/dist/services/AccessibilityCatalogResolver.js +200 -28
  56. package/dist/services/AccessibilityCatalogResolver.js.map +1 -1
  57. package/dist/services/HighlightCoordinator.d.ts +25 -0
  58. package/dist/services/HighlightCoordinator.js +125 -0
  59. package/dist/services/HighlightCoordinator.js.map +1 -1
  60. package/dist/services/SSMLExtractor.d.ts +16 -1
  61. package/dist/services/SSMLExtractor.js +86 -7
  62. package/dist/services/SSMLExtractor.js.map +1 -1
  63. package/dist/services/TTSService.d.ts +30 -4
  64. package/dist/services/TTSService.js +652 -159
  65. package/dist/services/TTSService.js.map +1 -1
  66. package/dist/services/ToolRegistry.d.ts +2 -2
  67. package/dist/services/ToolRegistry.js +1 -1
  68. package/dist/services/ToolRegistry.js.map +1 -1
  69. package/dist/services/ToolkitCoordinator.d.ts +16 -73
  70. package/dist/services/ToolkitCoordinator.js +34 -113
  71. package/dist/services/ToolkitCoordinator.js.map +1 -1
  72. package/dist/services/interfaces.d.ts +20 -2
  73. package/dist/services/interfaces.js.map +1 -1
  74. package/dist/services/tool-config-validation.d.ts +1 -1
  75. package/dist/services/tool-config-validation.js +7 -7
  76. package/dist/services/tool-config-validation.js.map +1 -1
  77. package/dist/services/tool-instance-id.js +1 -1
  78. package/dist/services/tool-instance-id.js.map +1 -1
  79. package/dist/services/tool-providers/TTSToolProvider.js +3 -3
  80. package/dist/services/tool-providers/TTSToolProvider.js.map +1 -1
  81. package/dist/services/tools-config-normalizer.d.ts +13 -2
  82. package/dist/services/tools-config-normalizer.js +3 -8
  83. package/dist/services/tools-config-normalizer.js.map +1 -1
  84. package/dist/services/tts/browser-provider.js +2 -0
  85. package/dist/services/tts/browser-provider.js.map +1 -1
  86. package/dist/services/tts/catalog-span-alignment.d.ts +39 -0
  87. package/dist/services/tts/catalog-span-alignment.js +300 -0
  88. package/dist/services/tts/catalog-span-alignment.js.map +1 -0
  89. package/dist/services/tts/generated-speech/assemble-plan.d.ts +33 -0
  90. package/dist/services/tts/generated-speech/assemble-plan.js +111 -0
  91. package/dist/services/tts/generated-speech/assemble-plan.js.map +1 -0
  92. package/dist/services/tts/generated-speech/dom/build-dom-plan.d.ts +25 -0
  93. package/dist/services/tts/generated-speech/dom/build-dom-plan.js +66 -0
  94. package/dist/services/tts/generated-speech/dom/build-dom-plan.js.map +1 -0
  95. package/dist/services/tts/generated-speech/dom/to-chunk-inputs.d.ts +19 -0
  96. package/dist/services/tts/generated-speech/dom/to-chunk-inputs.js +71 -0
  97. package/dist/services/tts/generated-speech/dom/to-chunk-inputs.js.map +1 -0
  98. package/dist/services/tts/generated-speech/dom/types.d.ts +37 -0
  99. package/dist/services/tts/generated-speech/dom/types.js +2 -0
  100. package/dist/services/tts/generated-speech/dom/types.js.map +1 -0
  101. package/dist/services/tts/generated-speech/index.d.ts +17 -0
  102. package/dist/services/tts/generated-speech/index.js +17 -0
  103. package/dist/services/tts/generated-speech/index.js.map +1 -0
  104. package/dist/services/tts/generated-speech/math-speech-cache.d.ts +15 -0
  105. package/dist/services/tts/generated-speech/math-speech-cache.js +78 -0
  106. package/dist/services/tts/generated-speech/math-speech-cache.js.map +1 -0
  107. package/dist/services/tts/generated-speech/types.d.ts +104 -0
  108. package/dist/services/tts/generated-speech/types.js +18 -0
  109. package/dist/services/tts/generated-speech/types.js.map +1 -0
  110. package/dist/services/tts/highlight-pipeline/boundary-normalizer.d.ts +2 -0
  111. package/dist/services/tts/highlight-pipeline/boundary-normalizer.js +106 -0
  112. package/dist/services/tts/highlight-pipeline/boundary-normalizer.js.map +1 -0
  113. package/dist/services/tts/highlight-pipeline/create-highlight-plan.d.ts +6 -0
  114. package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +217 -0
  115. package/dist/services/tts/highlight-pipeline/create-highlight-plan.js.map +1 -0
  116. package/dist/services/tts/highlight-pipeline/highlight-policy.d.ts +2 -0
  117. package/dist/services/tts/highlight-pipeline/highlight-policy.js +32 -0
  118. package/dist/services/tts/highlight-pipeline/highlight-policy.js.map +1 -0
  119. package/dist/services/tts/highlight-pipeline/index.d.ts +9 -0
  120. package/dist/services/tts/highlight-pipeline/index.js +9 -0
  121. package/dist/services/tts/highlight-pipeline/index.js.map +1 -0
  122. package/dist/services/tts/highlight-pipeline/math-semantic-resolver.d.ts +3 -0
  123. package/dist/services/tts/highlight-pipeline/math-semantic-resolver.js +32 -0
  124. package/dist/services/tts/highlight-pipeline/math-semantic-resolver.js.map +1 -0
  125. package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.d.ts +29 -0
  126. package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js +44 -0
  127. package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js.map +1 -0
  128. package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.d.ts +2 -0
  129. package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js +20 -0
  130. package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js.map +1 -0
  131. package/dist/services/tts/highlight-pipeline/readable-region.d.ts +1 -0
  132. package/dist/services/tts/highlight-pipeline/readable-region.js +19 -0
  133. package/dist/services/tts/highlight-pipeline/readable-region.js.map +1 -0
  134. package/dist/services/tts/highlight-pipeline/rendered-math-target-resolver.d.ts +6 -0
  135. package/dist/services/tts/highlight-pipeline/rendered-math-target-resolver.js +198 -0
  136. package/dist/services/tts/highlight-pipeline/rendered-math-target-resolver.js.map +1 -0
  137. package/dist/services/tts/highlight-pipeline/types.d.ts +72 -0
  138. package/dist/services/tts/highlight-pipeline/types.js +2 -0
  139. package/dist/services/tts/highlight-pipeline/types.js.map +1 -0
  140. package/dist/services/tts/highlight-pipeline/visible-map-range.d.ts +2 -0
  141. package/dist/services/tts/highlight-pipeline/visible-map-range.js +22 -0
  142. package/dist/services/tts/highlight-pipeline/visible-map-range.js.map +1 -0
  143. package/dist/services/tts/math-alignment/index.d.ts +30 -0
  144. package/dist/services/tts/math-alignment/index.js +66 -0
  145. package/dist/services/tts/math-alignment/index.js.map +1 -0
  146. package/dist/services/tts/math-alignment/mathml-tokenizer.d.ts +2 -0
  147. package/dist/services/tts/math-alignment/mathml-tokenizer.js +317 -0
  148. package/dist/services/tts/math-alignment/mathml-tokenizer.js.map +1 -0
  149. package/dist/services/tts/math-alignment/range-resolver.d.ts +10 -0
  150. package/dist/services/tts/math-alignment/range-resolver.js +13 -0
  151. package/dist/services/tts/math-alignment/range-resolver.js.map +1 -0
  152. package/dist/services/tts/math-alignment/sequence-aligner.d.ts +7 -0
  153. package/dist/services/tts/math-alignment/sequence-aligner.js +119 -0
  154. package/dist/services/tts/math-alignment/sequence-aligner.js.map +1 -0
  155. package/dist/services/tts/math-alignment/speech-tokenizer.d.ts +31 -0
  156. package/dist/services/tts/math-alignment/speech-tokenizer.js +143 -0
  157. package/dist/services/tts/math-alignment/speech-tokenizer.js.map +1 -0
  158. package/dist/services/tts/math-alignment/types.d.ts +58 -0
  159. package/dist/services/tts/math-alignment/types.js +2 -0
  160. package/dist/services/tts/math-alignment/types.js.map +1 -0
  161. package/dist/services/tts/math-aware-text-processing.d.ts +18 -0
  162. package/dist/services/tts/math-aware-text-processing.js +348 -0
  163. package/dist/services/tts/math-aware-text-processing.js.map +1 -0
  164. package/dist/services/tts/math-speech.d.ts +44 -0
  165. package/dist/services/tts/math-speech.js +147 -0
  166. package/dist/services/tts/math-speech.js.map +1 -0
  167. package/dist/services/tts/mathml-sanitization.d.ts +1 -0
  168. package/dist/services/tts/mathml-sanitization.js +170 -0
  169. package/dist/services/tts/mathml-sanitization.js.map +1 -0
  170. package/dist/services/tts/ssml/spoken-text.d.ts +33 -0
  171. package/dist/services/tts/ssml/spoken-text.js +159 -0
  172. package/dist/services/tts/ssml/spoken-text.js.map +1 -0
  173. package/dist/services/tts/text-processing.d.ts +3 -0
  174. package/dist/services/tts/text-processing.js +30 -4
  175. package/dist/services/tts/text-processing.js.map +1 -1
  176. package/dist/services/tts-runtime-config.d.ts +17 -1
  177. package/dist/services/tts-runtime-config.js +11 -1
  178. package/dist/services/tts-runtime-config.js.map +1 -1
  179. package/dist/tools/registrations/accessibility-tools.js +0 -1
  180. package/dist/tools/registrations/accessibility-tools.js.map +1 -1
  181. package/dist/tools/registrations/calculator.js +41 -2
  182. package/dist/tools/registrations/calculator.js.map +1 -1
  183. package/dist/tools/tool-tag-map.js +0 -1
  184. package/dist/tools/tool-tag-map.js.map +1 -1
  185. package/package.json +8 -11
  186. package/dist/services/PNPToolResolver.d.ts +0 -280
  187. package/dist/services/PNPToolResolver.js +0 -514
  188. package/dist/services/PNPToolResolver.js.map +0 -1
  189. package/dist/services/pnp-provenance.d.ts +0 -166
  190. package/dist/services/pnp-provenance.js +0 -231
  191. package/dist/services/pnp-provenance.js.map +0 -1
@@ -6,15 +6,15 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
6
6
  throw Error('Dynamic require of "' + x + '" is not supported');
7
7
  });
8
8
 
9
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/version.js
9
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/version.js
10
10
  var PUBLIC_VERSION = "5";
11
11
 
12
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/disclose-version.js
12
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/disclose-version.js
13
13
  if (typeof window !== "undefined") {
14
14
  ((window.__svelte ??= {}).v ??= new Set).add(PUBLIC_VERSION);
15
15
  }
16
16
 
17
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/constants.js
17
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/constants.js
18
18
  var EACH_INDEX_REACTIVE = 1 << 1;
19
19
  var EACH_IS_CONTROLLED = 1 << 2;
20
20
  var EACH_IS_ANIMATED = 1 << 3;
@@ -37,14 +37,14 @@ var HYDRATION_END = "]";
37
37
  var HYDRATION_ERROR = {};
38
38
  var ELEMENT_PRESERVE_ATTRIBUTE_CASE = 1 << 1;
39
39
  var ELEMENT_IS_INPUT = 1 << 2;
40
- var UNINITIALIZED = Symbol();
40
+ var UNINITIALIZED = Symbol("uninitialized");
41
41
  var FILENAME = Symbol("filename");
42
42
  var HMR = Symbol("hmr");
43
43
  var NAMESPACE_HTML = "http://www.w3.org/1999/xhtml";
44
44
 
45
45
  // ../../node_modules/.bun/esm-env@1.2.2/node_modules/esm-env/true.js
46
46
  var true_default = true;
47
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/shared/utils.js
47
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/shared/utils.js
48
48
  var is_array = Array.isArray;
49
49
  var index_of = Array.prototype.indexOf;
50
50
  var includes = Array.prototype.includes;
@@ -73,7 +73,7 @@ function deferred() {
73
73
  return { promise, resolve, reject };
74
74
  }
75
75
 
76
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/constants.js
76
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/constants.js
77
77
  var DERIVED = 1 << 1;
78
78
  var EFFECT = 1 << 2;
79
79
  var RENDER_EFFECT = 1 << 3;
@@ -104,6 +104,11 @@ var STATE_SYMBOL = Symbol("$state");
104
104
  var LEGACY_PROPS = Symbol("legacy props");
105
105
  var LOADING_ATTR_SYMBOL = Symbol("");
106
106
  var PROXY_PATH_SYMBOL = Symbol("proxy path");
107
+ var ATTRIBUTES_CACHE = Symbol("attributes");
108
+ var CLASS_CACHE = Symbol("class");
109
+ var STYLE_CACHE = Symbol("style");
110
+ var TEXT_CACHE = Symbol("text");
111
+ var FORM_RESET_HANDLER = Symbol("form reset");
107
112
  var HMR_ANCHOR = Symbol("hmr anchor");
108
113
  var STALE_REACTION = new class StaleReactionError extends Error {
109
114
  name = "StaleReactionError";
@@ -112,7 +117,7 @@ var STALE_REACTION = new class StaleReactionError extends Error {
112
117
  var IS_XHTML = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
113
118
  var COMMENT_NODE = 8;
114
119
 
115
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/shared/errors.js
120
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/shared/errors.js
116
121
  function invariant_violation(message) {
117
122
  if (true_default) {
118
123
  const error = new Error(`invariant_violation
@@ -125,7 +130,7 @@ https://svelte.dev/e/invariant_violation`);
125
130
  }
126
131
  }
127
132
 
128
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/errors.js
133
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/errors.js
129
134
  function async_derived_orphan() {
130
135
  if (true_default) {
131
136
  const error = new Error(`async_derived_orphan
@@ -237,7 +242,7 @@ https://svelte.dev/e/svelte_boundary_reset_onerror`);
237
242
  }
238
243
  }
239
244
 
240
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/warnings.js
245
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/warnings.js
241
246
  var bold = "font-weight: bold";
242
247
  var normal = "font-weight: normal";
243
248
  function await_reactivity_loss(name) {
@@ -322,7 +327,7 @@ https://svelte.dev/e/svelte_boundary_reset_noop`, bold, normal);
322
327
  }
323
328
  }
324
329
 
325
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/hydration.js
330
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/hydration.js
326
331
  var hydrating = false;
327
332
  function set_hydrating(value) {
328
333
  hydrating = value;
@@ -369,7 +374,7 @@ function skip_nodes(remove = true) {
369
374
  }
370
375
  }
371
376
 
372
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/equality.js
377
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/equality.js
373
378
  function equals(value) {
374
379
  return value === this.v;
375
380
  }
@@ -380,12 +385,12 @@ function safe_equals(value) {
380
385
  return !safe_not_equal(value, this.v);
381
386
  }
382
387
 
383
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/flags/index.js
388
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/flags/index.js
384
389
  var async_mode_flag = false;
385
390
  var legacy_mode_flag = false;
386
391
  var tracing_mode_flag = false;
387
392
 
388
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dev/tracing.js
393
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dev/tracing.js
389
394
  var tracing_expressions = null;
390
395
  function tag(source, label) {
391
396
  source.label = label;
@@ -397,7 +402,7 @@ function tag_proxy(value, label) {
397
402
  return value;
398
403
  }
399
404
 
400
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/shared/dev.js
405
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/shared/dev.js
401
406
  function get_error(label) {
402
407
  const error = new Error;
403
408
  const stack = get_stack();
@@ -449,7 +454,7 @@ function invariant(condition, message) {
449
454
  invariant_violation(message);
450
455
  }
451
456
 
452
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/context.js
457
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/context.js
453
458
  var component_context = null;
454
459
  function set_component_context(context) {
455
460
  component_context = context;
@@ -501,7 +506,7 @@ function is_runes() {
501
506
  return !legacy_mode_flag || component_context !== null && component_context.l === null;
502
507
  }
503
508
 
504
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/task.js
509
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/task.js
505
510
  var micro_tasks = [];
506
511
  function run_micro_tasks() {
507
512
  var tasks = micro_tasks;
@@ -524,7 +529,7 @@ function flush_tasks() {
524
529
  }
525
530
  }
526
531
 
527
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/error-handling.js
532
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/error-handling.js
528
533
  var adjustments = new WeakMap;
529
534
  function handle_error(error) {
530
535
  var effect = active_effect;
@@ -597,7 +602,7 @@ function apply_adjustments(error) {
597
602
  }
598
603
  }
599
604
 
600
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/status.js
605
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/status.js
601
606
  var STATUS_MASK = ~(DIRTY | MAYBE_DIRTY | CLEAN);
602
607
  function set_signal_status(signal, status) {
603
608
  signal.f = signal.f & STATUS_MASK | status;
@@ -610,7 +615,7 @@ function update_derived_status(derived) {
610
615
  }
611
616
  }
612
617
 
613
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/utils.js
618
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/utils.js
614
619
  function clear_marked(deps) {
615
620
  if (deps === null)
616
621
  return;
@@ -632,10 +637,10 @@ function defer_effect(effect, dirty_effects, maybe_dirty_effects) {
632
637
  set_signal_status(effect, CLEAN);
633
638
  }
634
639
 
635
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/store.js
640
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/store.js
636
641
  var legacy_is_updating_store = false;
637
642
  var is_store_binding = false;
638
- var IS_UNMOUNTED = Symbol();
643
+ var IS_UNMOUNTED = Symbol("unmounted");
639
644
  function capture_store_binding(fn) {
640
645
  var previous_is_store_binding = is_store_binding;
641
646
  try {
@@ -646,8 +651,9 @@ function capture_store_binding(fn) {
646
651
  }
647
652
  }
648
653
 
649
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/batch.js
650
- var batches = new Set;
654
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/batch.js
655
+ var first_batch = null;
656
+ var last_batch = null;
651
657
  var current_batch = null;
652
658
  var previous_batch = null;
653
659
  var batch_values = null;
@@ -657,17 +663,21 @@ var is_processing = false;
657
663
  var collected_effects = null;
658
664
  var legacy_updates = null;
659
665
  var flush_count = 0;
660
- var source_stacks = true_default ? new Set : null;
666
+ var source_stacks = new Set;
661
667
  var uid = 1;
662
668
 
663
669
  class Batch {
664
670
  id = uid++;
671
+ #started = false;
672
+ linked = true;
673
+ #prev = null;
674
+ #next = null;
675
+ async_deriveds = new Map;
665
676
  current = new Map;
666
677
  previous = new Map;
667
678
  #commit_callbacks = new Set;
668
679
  #discard_callbacks = new Set;
669
- #fork_commit_callbacks = new Set;
670
- #pending = new Map;
680
+ #pending = 0;
671
681
  #blocking_pending = new Map;
672
682
  #deferred = null;
673
683
  #roots = [];
@@ -678,25 +688,30 @@ class Batch {
678
688
  #unskipped_branches = new Set;
679
689
  is_fork = false;
680
690
  #decrement_queued = false;
681
- #blockers = new Set;
691
+ constructor() {
692
+ if (last_batch === null) {
693
+ first_batch = last_batch = this;
694
+ } else {
695
+ last_batch.#next = this;
696
+ this.#prev = last_batch;
697
+ }
698
+ last_batch = this;
699
+ }
682
700
  #is_deferred() {
683
- return this.is_fork || this.#blocking_pending.size > 0;
684
- }
685
- #is_blocked() {
686
- for (const batch of this.#blockers) {
687
- for (const effect of batch.#blocking_pending.keys()) {
688
- var skipped = false;
689
- var e = effect;
690
- while (e.parent !== null) {
691
- if (this.#skipped_branches.has(e)) {
692
- skipped = true;
693
- break;
694
- }
695
- e = e.parent;
696
- }
697
- if (!skipped) {
698
- return true;
701
+ if (this.is_fork)
702
+ return true;
703
+ for (const effect of this.#blocking_pending.keys()) {
704
+ var e = effect;
705
+ var skipped = false;
706
+ while (e.parent !== null) {
707
+ if (this.#skipped_branches.has(e)) {
708
+ skipped = true;
709
+ break;
699
710
  }
711
+ e = e.parent;
712
+ }
713
+ if (!skipped) {
714
+ return true;
700
715
  }
701
716
  }
702
717
  return false;
@@ -723,21 +738,25 @@ class Batch {
723
738
  this.#unskipped_branches.add(effect);
724
739
  }
725
740
  #process() {
741
+ this.#started = true;
726
742
  if (flush_count++ > 1000) {
727
- batches.delete(this);
743
+ this.#unlink();
728
744
  infinite_loop_guard();
729
745
  }
730
- if (!this.#is_deferred()) {
731
- for (const e of this.#dirty_effects) {
732
- this.#maybe_dirty_effects.delete(e);
733
- set_signal_status(e, DIRTY);
734
- this.schedule(e);
735
- }
736
- for (const e of this.#maybe_dirty_effects) {
737
- set_signal_status(e, MAYBE_DIRTY);
738
- this.schedule(e);
746
+ if (true_default) {
747
+ for (const value of this.current.keys()) {
748
+ source_stacks.add(value);
739
749
  }
740
750
  }
751
+ for (const e of this.#dirty_effects) {
752
+ this.#maybe_dirty_effects.delete(e);
753
+ set_signal_status(e, DIRTY);
754
+ this.schedule(e);
755
+ }
756
+ for (const e of this.#maybe_dirty_effects) {
757
+ set_signal_status(e, MAYBE_DIRTY);
758
+ this.schedule(e);
759
+ }
741
760
  const roots = this.#roots;
742
761
  this.#roots = [];
743
762
  this.apply();
@@ -749,6 +768,8 @@ class Batch {
749
768
  this.#traverse(root, effects, render_effects);
750
769
  } catch (e) {
751
770
  reset_all(root);
771
+ if (!this.#is_deferred())
772
+ this.discard();
752
773
  throw e;
753
774
  }
754
775
  }
@@ -761,44 +782,53 @@ class Batch {
761
782
  }
762
783
  collected_effects = null;
763
784
  legacy_updates = null;
764
- if (this.#is_deferred() || this.#is_blocked()) {
785
+ if (this.#is_deferred()) {
765
786
  this.#defer_effects(render_effects);
766
787
  this.#defer_effects(effects);
767
788
  for (const [e, t] of this.#skipped_branches) {
768
789
  reset_branch(e, t);
769
790
  }
770
- } else {
771
- if (this.#pending.size === 0) {
772
- batches.delete(this);
773
- }
774
- this.#dirty_effects.clear();
775
- this.#maybe_dirty_effects.clear();
776
- for (const fn of this.#commit_callbacks)
777
- fn(this);
778
- this.#commit_callbacks.clear();
779
- previous_batch = this;
780
- flush_queued_effects(render_effects);
781
- flush_queued_effects(effects);
782
- previous_batch = null;
783
- this.#deferred?.resolve();
791
+ if (updates.length > 0) {
792
+ current_batch.#process();
793
+ }
794
+ return;
795
+ }
796
+ const earlier_batch = this.#find_earlier_batch();
797
+ if (earlier_batch) {
798
+ this.#defer_effects(render_effects);
799
+ this.#defer_effects(effects);
800
+ earlier_batch.#merge(this);
801
+ return;
784
802
  }
803
+ this.#dirty_effects.clear();
804
+ this.#maybe_dirty_effects.clear();
805
+ for (const fn of this.#commit_callbacks)
806
+ fn(this);
807
+ this.#commit_callbacks.clear();
808
+ previous_batch = this;
809
+ flush_queued_effects(render_effects);
810
+ flush_queued_effects(effects);
811
+ previous_batch = null;
812
+ this.#deferred?.resolve();
785
813
  var next_batch = current_batch;
814
+ if (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) {
815
+ this.#unlink();
816
+ if (async_mode_flag) {
817
+ this.#commit();
818
+ current_batch = next_batch;
819
+ }
820
+ }
786
821
  if (this.#roots.length > 0) {
787
- const batch2 = next_batch ??= this;
788
- batch2.#roots.push(...this.#roots.filter((r) => !batch2.#roots.includes(r)));
822
+ if (next_batch !== null) {
823
+ const batch2 = next_batch;
824
+ batch2.#roots.push(...this.#roots.filter((r) => !batch2.#roots.includes(r)));
825
+ } else {
826
+ next_batch = this;
827
+ }
789
828
  }
790
829
  if (next_batch !== null) {
791
- batches.add(next_batch);
792
- if (true_default) {
793
- for (const source2 of this.current.keys()) {
794
- source_stacks.add(source2);
795
- }
796
- }
797
830
  next_batch.#process();
798
831
  }
799
- if (async_mode_flag && !batches.has(this)) {
800
- this.#commit();
801
- }
802
832
  }
803
833
  #traverse(root, effects, render_effects) {
804
834
  root.f ^= CLEAN;
@@ -836,6 +866,59 @@ class Batch {
836
866
  }
837
867
  }
838
868
  }
869
+ #find_earlier_batch() {
870
+ var batch = this.#prev;
871
+ while (batch !== null) {
872
+ if (!batch.is_fork) {
873
+ for (const [value, [, is_derived]] of this.current) {
874
+ if (batch.current.has(value) && !is_derived) {
875
+ return batch;
876
+ }
877
+ }
878
+ }
879
+ batch = batch.#prev;
880
+ }
881
+ return null;
882
+ }
883
+ #merge(batch) {
884
+ for (const [source2, value] of batch.current) {
885
+ if (!this.previous.has(source2) && batch.previous.has(source2)) {
886
+ this.previous.set(source2, batch.previous.get(source2));
887
+ }
888
+ this.current.set(source2, value);
889
+ }
890
+ for (const [effect, deferred2] of batch.async_deriveds) {
891
+ const d = this.async_deriveds.get(effect);
892
+ if (d)
893
+ deferred2.promise.then(d.resolve).catch(d.reject);
894
+ }
895
+ this.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects);
896
+ const mark = (value) => {
897
+ var reactions = value.reactions;
898
+ if (reactions === null)
899
+ return;
900
+ for (const reaction of reactions) {
901
+ var flags = reaction.f;
902
+ if ((flags & DERIVED) !== 0) {
903
+ mark(reaction);
904
+ } else {
905
+ var effect = reaction;
906
+ if (flags & (ASYNC | BLOCK_EFFECT) && !this.async_deriveds.has(effect)) {
907
+ this.#maybe_dirty_effects.delete(effect);
908
+ set_signal_status(effect, DIRTY);
909
+ this.schedule(effect);
910
+ }
911
+ }
912
+ }
913
+ };
914
+ for (const source2 of this.current.keys()) {
915
+ mark(source2);
916
+ }
917
+ this.oncommit(() => batch.discard());
918
+ batch.#unlink();
919
+ current_batch = this;
920
+ this.#process();
921
+ }
839
922
  #defer_effects(effects) {
840
923
  for (var i = 0;i < effects.length; i += 1) {
841
924
  defer_effect(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
@@ -861,8 +944,10 @@ class Batch {
861
944
  batch_values = null;
862
945
  }
863
946
  flush() {
864
- var source_stacks2 = true_default ? new Set : null;
865
947
  try {
948
+ if (true_default) {
949
+ source_stacks.clear();
950
+ }
866
951
  is_processing = true;
867
952
  current_batch = this;
868
953
  this.#process();
@@ -876,7 +961,7 @@ class Batch {
876
961
  batch_values = null;
877
962
  old_values.clear();
878
963
  if (true_default) {
879
- for (const source2 of source_stacks2) {
964
+ for (const source2 of source_stacks) {
880
965
  source2.updated = null;
881
966
  }
882
967
  }
@@ -886,14 +971,14 @@ class Batch {
886
971
  for (const fn of this.#discard_callbacks)
887
972
  fn(this);
888
973
  this.#discard_callbacks.clear();
889
- this.#fork_commit_callbacks.clear();
890
- batches.delete(this);
974
+ this.#unlink();
975
+ this.#deferred?.resolve();
891
976
  }
892
977
  register_created_effect(effect) {
893
978
  this.#new_effects.push(effect);
894
979
  }
895
980
  #commit() {
896
- for (const batch of batches) {
981
+ for (let batch = first_batch;batch !== null; batch = batch.#next) {
897
982
  var is_earlier = batch.id < this.id;
898
983
  var sources = [];
899
984
  for (const [source3, [value, is_derived]] of this.current) {
@@ -907,13 +992,22 @@ class Batch {
907
992
  }
908
993
  sources.push(source3);
909
994
  }
910
- var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
995
+ if (is_earlier) {
996
+ for (const [effect, deferred2] of this.async_deriveds) {
997
+ const d = batch.async_deriveds.get(effect);
998
+ if (d)
999
+ deferred2.promise.then(d.resolve).catch(d.reject);
1000
+ }
1001
+ }
1002
+ if (!batch.#started)
1003
+ continue;
1004
+ var others = [...batch.current.keys()].filter((s) => !batch.current.get(s)[1] && !this.current.has(s));
911
1005
  if (others.length === 0) {
912
1006
  if (is_earlier) {
913
1007
  batch.discard();
914
1008
  }
915
1009
  } else if (sources.length > 0) {
916
- if (true_default) {
1010
+ if (true_default && !batch.#decrement_queued) {
917
1011
  invariant(batch.#roots.length === 0, "Batch has scheduled roots");
918
1012
  }
919
1013
  if (is_earlier) {
@@ -934,18 +1028,25 @@ class Batch {
934
1028
  mark_effects(source2, others, marked, checked);
935
1029
  }
936
1030
  checked = new Map;
937
- var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c : true);
938
- for (const effect of this.#new_effects) {
939
- if ((effect.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 && depends_on(effect, current_unequal, checked)) {
940
- if ((effect.f & (ASYNC | BLOCK_EFFECT)) !== 0) {
941
- set_signal_status(effect, DIRTY);
942
- batch.schedule(effect);
943
- } else {
944
- batch.#dirty_effects.add(effect);
1031
+ var current_unequal = [...batch.current].filter(([c, v1]) => {
1032
+ const v2 = this.current.get(c);
1033
+ if (!v2)
1034
+ return true;
1035
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
1036
+ }).map(([c]) => c);
1037
+ if (current_unequal.length > 0) {
1038
+ for (const effect of this.#new_effects) {
1039
+ if ((effect.f & (DESTROYED | INERT | EAGER_EFFECT)) === 0 && depends_on(effect, current_unequal, checked)) {
1040
+ if ((effect.f & (ASYNC | BLOCK_EFFECT)) !== 0) {
1041
+ set_signal_status(effect, DIRTY);
1042
+ batch.schedule(effect);
1043
+ } else {
1044
+ batch.#dirty_effects.add(effect);
1045
+ }
945
1046
  }
946
1047
  }
947
1048
  }
948
- if (batch.#roots.length > 0) {
1049
+ if (batch.#roots.length > 0 && !batch.#decrement_queued) {
949
1050
  batch.apply();
950
1051
  for (var root of batch.#roots) {
951
1052
  batch.#traverse(root, [], []);
@@ -955,31 +1056,16 @@ class Batch {
955
1056
  batch.deactivate();
956
1057
  }
957
1058
  }
958
- for (const batch of batches) {
959
- if (batch.#blockers.has(this)) {
960
- batch.#blockers.delete(this);
961
- if (batch.#blockers.size === 0 && !batch.#is_deferred()) {
962
- batch.activate();
963
- batch.#process();
964
- }
965
- }
966
- }
967
1059
  }
968
1060
  increment(blocking, effect) {
969
- let pending_count = this.#pending.get(effect) ?? 0;
970
- this.#pending.set(effect, pending_count + 1);
1061
+ this.#pending += 1;
971
1062
  if (blocking) {
972
1063
  let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
973
1064
  this.#blocking_pending.set(effect, blocking_pending_count + 1);
974
1065
  }
975
1066
  }
976
- decrement(blocking, effect, skip) {
977
- let pending_count = this.#pending.get(effect) ?? 0;
978
- if (pending_count === 1) {
979
- this.#pending.delete(effect);
980
- } else {
981
- this.#pending.set(effect, pending_count - 1);
982
- }
1067
+ decrement(blocking, effect) {
1068
+ this.#pending -= 1;
983
1069
  if (blocking) {
984
1070
  let blocking_pending_count = this.#blocking_pending.get(effect) ?? 0;
985
1071
  if (blocking_pending_count === 1) {
@@ -988,12 +1074,14 @@ class Batch {
988
1074
  this.#blocking_pending.set(effect, blocking_pending_count - 1);
989
1075
  }
990
1076
  }
991
- if (this.#decrement_queued || skip)
1077
+ if (this.#decrement_queued)
992
1078
  return;
993
1079
  this.#decrement_queued = true;
994
1080
  queue_micro_task(() => {
995
1081
  this.#decrement_queued = false;
996
- this.flush();
1082
+ if (this.linked) {
1083
+ this.flush();
1084
+ }
997
1085
  });
998
1086
  }
999
1087
  transfer_effects(dirty_effects, maybe_dirty_effects) {
@@ -1012,36 +1100,24 @@ class Batch {
1012
1100
  ondiscard(fn) {
1013
1101
  this.#discard_callbacks.add(fn);
1014
1102
  }
1015
- on_fork_commit(fn) {
1016
- this.#fork_commit_callbacks.add(fn);
1017
- }
1018
- run_fork_commit_callbacks() {
1019
- for (const fn of this.#fork_commit_callbacks)
1020
- fn(this);
1021
- this.#fork_commit_callbacks.clear();
1022
- }
1023
1103
  settled() {
1024
1104
  return (this.#deferred ??= deferred()).promise;
1025
1105
  }
1026
1106
  static ensure() {
1027
1107
  if (current_batch === null) {
1028
1108
  const batch = current_batch = new Batch;
1029
- if (!is_processing) {
1030
- batches.add(current_batch);
1031
- if (!is_flushing_sync) {
1032
- queue_micro_task(() => {
1033
- if (current_batch !== batch) {
1034
- return;
1035
- }
1109
+ if (!is_processing && !is_flushing_sync) {
1110
+ queue_micro_task(() => {
1111
+ if (!batch.#started) {
1036
1112
  batch.flush();
1037
- });
1038
- }
1113
+ }
1114
+ });
1039
1115
  }
1040
1116
  }
1041
1117
  return current_batch;
1042
1118
  }
1043
1119
  apply() {
1044
- if (!async_mode_flag || !this.is_fork && batches.size === 1) {
1120
+ if (!async_mode_flag || !this.is_fork && this.#prev === null && this.#next === null) {
1045
1121
  batch_values = null;
1046
1122
  return;
1047
1123
  }
@@ -1049,22 +1125,21 @@ class Batch {
1049
1125
  for (const [source2, [value]] of this.current) {
1050
1126
  batch_values.set(source2, value);
1051
1127
  }
1052
- for (const batch of batches) {
1128
+ for (let batch = first_batch;batch !== null; batch = batch.#next) {
1053
1129
  if (batch === this || batch.is_fork)
1054
1130
  continue;
1055
1131
  var intersects = false;
1056
- var differs = false;
1057
1132
  if (batch.id < this.id) {
1058
1133
  for (const [source2, [, is_derived]] of batch.current) {
1059
1134
  if (is_derived)
1060
1135
  continue;
1061
- intersects ||= this.current.has(source2);
1062
- differs ||= !this.current.has(source2);
1136
+ if (this.current.has(source2)) {
1137
+ intersects = true;
1138
+ break;
1139
+ }
1063
1140
  }
1064
1141
  }
1065
- if (intersects && differs) {
1066
- this.#blockers.add(batch);
1067
- } else {
1142
+ if (!intersects) {
1068
1143
  for (const [source2, previous] of batch.previous) {
1069
1144
  if (!batch_values.has(source2)) {
1070
1145
  batch_values.set(source2, previous);
@@ -1099,6 +1174,23 @@ class Batch {
1099
1174
  }
1100
1175
  this.#roots.push(e);
1101
1176
  }
1177
+ #unlink() {
1178
+ if (!this.linked)
1179
+ return;
1180
+ var prev = this.#prev;
1181
+ var next2 = this.#next;
1182
+ if (prev === null) {
1183
+ first_batch = next2;
1184
+ } else {
1185
+ prev.#next = next2;
1186
+ }
1187
+ if (next2 === null) {
1188
+ last_batch = prev;
1189
+ } else {
1190
+ next2.#prev = prev;
1191
+ }
1192
+ this.linked = false;
1193
+ }
1102
1194
  }
1103
1195
  function flushSync(fn) {
1104
1196
  var was_flushing_sync = is_flushing_sync;
@@ -1228,6 +1320,7 @@ function depends_on(reaction, sources, checked) {
1228
1320
  function schedule_effect(effect) {
1229
1321
  current_batch.schedule(effect);
1230
1322
  }
1323
+ var version_map = new Map;
1231
1324
  function reset_branch(effect, tracked) {
1232
1325
  if ((effect.f & BRANCH_EFFECT) !== 0 && (effect.f & CLEAN) !== 0) {
1233
1326
  return;
@@ -1253,7 +1346,7 @@ function reset_all(effect) {
1253
1346
  }
1254
1347
  }
1255
1348
 
1256
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/reactivity/create-subscriber.js
1349
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/reactivity/create-subscriber.js
1257
1350
  function createSubscriber(start) {
1258
1351
  let subscribers = 0;
1259
1352
  let version = source(0);
@@ -1284,7 +1377,7 @@ function createSubscriber(start) {
1284
1377
  };
1285
1378
  }
1286
1379
 
1287
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1380
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/blocks/boundary.js
1288
1381
  var flags = EFFECT_TRANSPARENT | EFFECT_PRESERVED;
1289
1382
  function boundary(node, props, children, transform_error) {
1290
1383
  new Boundary(node, props, children, transform_error);
@@ -1490,7 +1583,7 @@ class Boundary {
1490
1583
  current_batch.skip_effect(this.#pending_effect);
1491
1584
  if (this.#failed_effect)
1492
1585
  current_batch.skip_effect(this.#failed_effect);
1493
- current_batch.on_fork_commit(() => {
1586
+ current_batch.oncommit(() => {
1494
1587
  this.#handle_error(error);
1495
1588
  });
1496
1589
  } else {
@@ -1578,7 +1671,7 @@ class Boundary {
1578
1671
  }
1579
1672
  }
1580
1673
 
1581
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/async.js
1674
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/async.js
1582
1675
  function flatten(blockers, sync, async, fn) {
1583
1676
  const d = is_runes() ? derived : derived_safe_equal;
1584
1677
  var pending = blockers.filter((b) => !b.settled);
@@ -1590,23 +1683,24 @@ function flatten(blockers, sync, async, fn) {
1590
1683
  var restore = capture();
1591
1684
  var blocker_promise = pending.length === 1 ? pending[0].promise : pending.length > 1 ? Promise.all(pending.map((b) => b.promise)) : null;
1592
1685
  function finish(values) {
1686
+ if ((parent.f & DESTROYED) !== 0) {
1687
+ return;
1688
+ }
1593
1689
  restore();
1594
1690
  try {
1595
1691
  fn(values);
1596
1692
  } catch (error) {
1597
- if ((parent.f & DESTROYED) === 0) {
1598
- invoke_error_boundary(error, parent);
1599
- }
1693
+ invoke_error_boundary(error, parent);
1600
1694
  }
1601
1695
  unset_context();
1602
1696
  }
1697
+ var decrement_pending = increment_pending();
1603
1698
  if (async.length === 0) {
1604
- blocker_promise.then(() => finish(sync.map(d)));
1699
+ blocker_promise.then(() => finish(sync.map(d))).finally(decrement_pending);
1605
1700
  return;
1606
1701
  }
1607
- var decrement_pending = increment_pending();
1608
1702
  function run() {
1609
- Promise.all(async.map((expression) => async_derived(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary(error, parent)).finally(() => decrement_pending());
1703
+ Promise.all(async.map((expression) => async_derived(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary(error, parent)).finally(decrement_pending);
1610
1704
  }
1611
1705
  if (blocker_promise) {
1612
1706
  blocker_promise.then(() => {
@@ -1655,16 +1749,16 @@ function increment_pending() {
1655
1749
  var effect = active_effect;
1656
1750
  var boundary2 = effect.b;
1657
1751
  var batch = current_batch;
1658
- var blocking = boundary2.is_rendered();
1659
- boundary2.update_pending_count(1, batch);
1752
+ var blocking = !!boundary2?.is_rendered();
1753
+ boundary2?.update_pending_count(1, batch);
1660
1754
  batch.increment(blocking, effect);
1661
- return (skip = false) => {
1662
- boundary2.update_pending_count(-1, batch);
1663
- batch.decrement(blocking, effect, skip);
1755
+ return () => {
1756
+ boundary2?.update_pending_count(-1, batch);
1757
+ batch.decrement(blocking, effect);
1664
1758
  };
1665
1759
  }
1666
1760
 
1667
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/deriveds.js
1761
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/deriveds.js
1668
1762
  var reactivity_loss_tracker = null;
1669
1763
  function set_reactivity_loss_tracker(v) {
1670
1764
  reactivity_loss_tracker = v;
@@ -1694,6 +1788,7 @@ function derived(fn) {
1694
1788
  }
1695
1789
  return signal;
1696
1790
  }
1791
+ var OBSOLETE = Symbol("obsolete");
1697
1792
  function async_derived(fn, label, location) {
1698
1793
  let parent = active_effect;
1699
1794
  if (parent === null) {
@@ -1702,9 +1797,9 @@ function async_derived(fn, label, location) {
1702
1797
  var promise = undefined;
1703
1798
  var signal = source(UNINITIALIZED);
1704
1799
  if (true_default)
1705
- signal.label = label;
1800
+ signal.label = label ?? fn.toString();
1706
1801
  var should_suspend = !active_reaction;
1707
- var deferreds = new Map;
1802
+ var deferreds = new Set;
1708
1803
  async_effect(() => {
1709
1804
  var effect = active_effect;
1710
1805
  if (true_default) {
@@ -1713,7 +1808,10 @@ function async_derived(fn, label, location) {
1713
1808
  var d = deferred();
1714
1809
  promise = d.promise;
1715
1810
  try {
1716
- Promise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context);
1811
+ Promise.resolve(fn()).then(d.resolve, (e) => {
1812
+ if (e !== STALE_REACTION)
1813
+ d.reject(e);
1814
+ }).finally(unset_context);
1717
1815
  } catch (error) {
1718
1816
  d.reject(error);
1719
1817
  unset_context();
@@ -1738,28 +1836,24 @@ function async_derived(fn, label, location) {
1738
1836
  if ((effect.f & REACTION_RAN) !== 0) {
1739
1837
  var decrement_pending = increment_pending();
1740
1838
  }
1741
- if (parent.b.is_rendered()) {
1742
- deferreds.get(batch)?.reject(STALE_REACTION);
1743
- deferreds.delete(batch);
1839
+ if (parent.b?.is_rendered()) {
1840
+ batch.async_deriveds.get(effect)?.reject(OBSOLETE);
1744
1841
  } else {
1745
1842
  for (const d2 of deferreds.values()) {
1746
- d2.reject(STALE_REACTION);
1843
+ d2.reject(OBSOLETE);
1747
1844
  }
1748
- deferreds.clear();
1749
1845
  }
1750
- deferreds.set(batch, d);
1846
+ deferreds.add(d);
1847
+ batch.async_deriveds.set(effect, d);
1751
1848
  }
1752
1849
  const handler = (value, error = undefined) => {
1753
1850
  if (true_default) {
1754
1851
  reactivity_loss_tracker = null;
1755
1852
  }
1756
- if (decrement_pending) {
1757
- var skip = error === STALE_REACTION;
1758
- decrement_pending(skip);
1759
- }
1760
- if (error === STALE_REACTION || (effect.f & DESTROYED) !== 0) {
1853
+ decrement_pending?.();
1854
+ deferreds.delete(d);
1855
+ if (error === OBSOLETE)
1761
1856
  return;
1762
- }
1763
1857
  batch.activate();
1764
1858
  if (error) {
1765
1859
  signal.f |= ERROR_VALUE;
@@ -1768,30 +1862,24 @@ function async_derived(fn, label, location) {
1768
1862
  if ((signal.f & ERROR_VALUE) !== 0) {
1769
1863
  signal.f ^= ERROR_VALUE;
1770
1864
  }
1771
- internal_set(signal, value);
1772
- for (const [b, d2] of deferreds) {
1773
- deferreds.delete(b);
1774
- if (b === batch)
1775
- break;
1776
- d2.reject(STALE_REACTION);
1777
- }
1778
- if (true_default && location !== undefined) {
1865
+ if (true_default && location !== undefined && !signal.equals(value)) {
1779
1866
  recent_async_deriveds.add(signal);
1780
1867
  setTimeout(() => {
1781
- if (recent_async_deriveds.has(signal)) {
1868
+ if (recent_async_deriveds.has(signal) && (effect.f & DESTROYED) === 0) {
1782
1869
  await_waterfall(signal.label, location);
1783
1870
  recent_async_deriveds.delete(signal);
1784
1871
  }
1785
1872
  });
1786
1873
  }
1874
+ internal_set(signal, value);
1787
1875
  }
1788
1876
  batch.deactivate();
1789
1877
  };
1790
1878
  d.promise.then(handler, (e) => handler(null, e || "unknown"));
1791
1879
  });
1792
1880
  teardown(() => {
1793
- for (const d of deferreds.values()) {
1794
- d.reject(STALE_REACTION);
1881
+ for (const d of deferreds) {
1882
+ d.reject(OBSOLETE);
1795
1883
  }
1796
1884
  });
1797
1885
  if (true_default) {
@@ -1830,7 +1918,7 @@ function execute_derived(derived2) {
1830
1918
  var value;
1831
1919
  var prev_active_effect = active_effect;
1832
1920
  var parent = derived2.parent;
1833
- if (!is_destroying_effect && parent !== null && (parent.f & (DESTROYED | INERT)) !== 0) {
1921
+ if (!is_destroying_effect && parent !== null && derived2.v !== UNINITIALIZED && (parent.f & (DESTROYED | INERT)) !== 0) {
1834
1922
  derived_inert();
1835
1923
  return derived2.v;
1836
1924
  }
@@ -1869,6 +1957,7 @@ function update_derived(derived2) {
1869
1957
  if (!current_batch?.is_fork || derived2.deps === null) {
1870
1958
  if (current_batch !== null) {
1871
1959
  current_batch.capture(derived2, value, true);
1960
+ previous_batch?.capture(derived2, value, true);
1872
1961
  } else {
1873
1962
  derived2.v = value;
1874
1963
  }
@@ -1896,7 +1985,8 @@ function freeze_derived_effects(derived2) {
1896
1985
  if (e.teardown || e.ac) {
1897
1986
  e.teardown?.();
1898
1987
  e.ac?.abort(STALE_REACTION);
1899
- e.teardown = noop;
1988
+ if (e.fn !== null)
1989
+ e.teardown = noop;
1900
1990
  e.ac = null;
1901
1991
  remove_reactions(e, 0);
1902
1992
  destroy_effect_children(e);
@@ -1907,13 +1997,13 @@ function unfreeze_derived_effects(derived2) {
1907
1997
  if (derived2.effects === null)
1908
1998
  return;
1909
1999
  for (const e of derived2.effects) {
1910
- if (e.teardown) {
2000
+ if (e.teardown && e.fn !== null) {
1911
2001
  update_effect(e);
1912
2002
  }
1913
2003
  }
1914
2004
  }
1915
2005
 
1916
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/sources.js
2006
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/sources.js
1917
2007
  var eager_effects = new Set;
1918
2008
  var old_values = new Map;
1919
2009
  function set_eager_effects(v) {
@@ -1956,7 +2046,7 @@ function mutable_source(initial_value, immutable = false, trackable = true) {
1956
2046
  return s;
1957
2047
  }
1958
2048
  function set(source2, value, should_proxy = false) {
1959
- if (active_reaction !== null && (!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 && (current_sources === null || !includes.call(current_sources, source2))) {
2049
+ if (active_reaction !== null && (!untracking || (active_reaction.f & EAGER_EFFECT) !== 0) && is_runes() && (active_reaction.f & (DERIVED | BLOCK_EFFECT | ASYNC | EAGER_EFFECT)) !== 0 && (current_sources === null || !current_sources.has(source2))) {
1960
2050
  state_unsafe_mutation();
1961
2051
  }
1962
2052
  let new_value = should_proxy ? proxy(value) : value;
@@ -2021,7 +2111,13 @@ function flush_eager_effects() {
2021
2111
  if ((effect.f & CLEAN) !== 0) {
2022
2112
  set_signal_status(effect, MAYBE_DIRTY);
2023
2113
  }
2024
- if (is_dirty(effect)) {
2114
+ let dirty;
2115
+ try {
2116
+ dirty = is_dirty(effect);
2117
+ } catch {
2118
+ dirty = true;
2119
+ }
2120
+ if (dirty) {
2025
2121
  update_effect(effect);
2026
2122
  }
2027
2123
  }
@@ -2041,19 +2137,17 @@ function mark_reactions(signal, status, updated_during_traversal) {
2041
2137
  var flags2 = reaction.f;
2042
2138
  if (!runes && reaction === active_effect)
2043
2139
  continue;
2044
- if (true_default && (flags2 & EAGER_EFFECT) !== 0) {
2045
- eager_effects.add(reaction);
2046
- continue;
2047
- }
2048
2140
  var not_dirty = (flags2 & DIRTY) === 0;
2049
2141
  if (not_dirty) {
2050
2142
  set_signal_status(reaction, status);
2051
2143
  }
2052
- if ((flags2 & DERIVED) !== 0) {
2144
+ if ((flags2 & EAGER_EFFECT) !== 0) {
2145
+ eager_effects.add(reaction);
2146
+ } else if ((flags2 & DERIVED) !== 0) {
2053
2147
  var derived2 = reaction;
2054
2148
  batch_values?.delete(derived2);
2055
2149
  if ((flags2 & WAS_MARKED) === 0) {
2056
- if (flags2 & CONNECTED) {
2150
+ if (flags2 & CONNECTED && (active_effect === null || (active_effect.f & REACTION_IS_UPDATING) === 0)) {
2057
2151
  reaction.f |= WAS_MARKED;
2058
2152
  }
2059
2153
  mark_reactions(derived2, MAYBE_DIRTY, updated_during_traversal);
@@ -2072,7 +2166,7 @@ function mark_reactions(signal, status, updated_during_traversal) {
2072
2166
  }
2073
2167
  }
2074
2168
 
2075
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/proxy.js
2169
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/proxy.js
2076
2170
  var regex_is_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
2077
2171
  function proxy(value) {
2078
2172
  if (typeof value !== "object" || value === null || STATE_SYMBOL in value) {
@@ -2335,7 +2429,7 @@ function inspectable_array(array) {
2335
2429
  });
2336
2430
  }
2337
2431
 
2338
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dev/equality.js
2432
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dev/equality.js
2339
2433
  function init_array_prototype_warnings() {
2340
2434
  const array_prototype2 = Array.prototype;
2341
2435
  const cleanup = Array.__svelte_cleanup;
@@ -2386,7 +2480,7 @@ function init_array_prototype_warnings() {
2386
2480
  };
2387
2481
  }
2388
2482
 
2389
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/operations.js
2483
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/operations.js
2390
2484
  var $window;
2391
2485
  var $document;
2392
2486
  var is_firefox;
@@ -2405,14 +2499,13 @@ function init_operations() {
2405
2499
  first_child_getter = get_descriptor(node_prototype, "firstChild").get;
2406
2500
  next_sibling_getter = get_descriptor(node_prototype, "nextSibling").get;
2407
2501
  if (is_extensible(element_prototype)) {
2408
- element_prototype.__click = undefined;
2409
- element_prototype.__className = undefined;
2410
- element_prototype.__attributes = null;
2411
- element_prototype.__style = undefined;
2502
+ element_prototype[CLASS_CACHE] = undefined;
2503
+ element_prototype[ATTRIBUTES_CACHE] = null;
2504
+ element_prototype[STYLE_CACHE] = undefined;
2412
2505
  element_prototype.__e = undefined;
2413
2506
  }
2414
2507
  if (is_extensible(text_prototype)) {
2415
- text_prototype.__t = undefined;
2508
+ text_prototype[TEXT_CACHE] = undefined;
2416
2509
  }
2417
2510
  if (true_default) {
2418
2511
  element_prototype.__svelte_meta = null;
@@ -2440,11 +2533,13 @@ function should_defer_append() {
2440
2533
  return (flags2 & REACTION_RAN) !== 0;
2441
2534
  }
2442
2535
  function create_element(tag2, namespace, is) {
2443
- let options = is ? { is } : undefined;
2444
- return document.createElementNS(namespace ?? NAMESPACE_HTML, tag2, options);
2536
+ if (namespace == null || namespace === NAMESPACE_HTML) {
2537
+ return is ? document.createElement(tag2, { is }) : document.createElement(tag2);
2538
+ }
2539
+ return is ? document.createElementNS(namespace, tag2, { is }) : document.createElementNS(namespace, tag2);
2445
2540
  }
2446
2541
 
2447
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2542
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
2448
2543
  function without_reactive_context(fn) {
2449
2544
  var previous_reaction = active_reaction;
2450
2545
  var previous_effect = active_effect;
@@ -2458,7 +2553,7 @@ function without_reactive_context(fn) {
2458
2553
  }
2459
2554
  }
2460
2555
 
2461
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/effects.js
2556
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/effects.js
2462
2557
  function push_effect(effect, parent_effect) {
2463
2558
  var parent_last = parent_effect.last;
2464
2559
  if (parent_last === null) {
@@ -2762,10 +2857,10 @@ function move_effect(effect, fragment) {
2762
2857
  }
2763
2858
  }
2764
2859
 
2765
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/legacy.js
2860
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/legacy.js
2766
2861
  var captured_signals = null;
2767
2862
 
2768
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/runtime.js
2863
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/runtime.js
2769
2864
  var is_updating_effect = false;
2770
2865
  var is_destroying_effect = false;
2771
2866
  function set_is_destroying_effect(value) {
@@ -2783,11 +2878,7 @@ function set_active_effect(effect) {
2783
2878
  var current_sources = null;
2784
2879
  function push_reaction_value(value) {
2785
2880
  if (active_reaction !== null && (!async_mode_flag || (active_reaction.f & DERIVED) !== 0)) {
2786
- if (current_sources === null) {
2787
- current_sources = [value];
2788
- } else {
2789
- current_sources.push(value);
2790
- }
2881
+ (current_sources ??= new Set).add(value);
2791
2882
  }
2792
2883
  }
2793
2884
  var new_deps = null;
@@ -2835,7 +2926,7 @@ function schedule_possible_effect_self_invalidation(signal, effect, root = true)
2835
2926
  var reactions = signal.reactions;
2836
2927
  if (reactions === null)
2837
2928
  return;
2838
- if (!async_mode_flag && current_sources !== null && includes.call(current_sources, signal)) {
2929
+ if (!async_mode_flag && current_sources !== null && current_sources.has(signal)) {
2839
2930
  return;
2840
2931
  }
2841
2932
  for (var i = 0;i < reactions.length; i++) {
@@ -3032,7 +3123,7 @@ function get2(signal) {
3032
3123
  captured_signals?.add(signal);
3033
3124
  if (active_reaction !== null && !untracking) {
3034
3125
  var destroyed = active_effect !== null && (active_effect.f & DESTROYED) !== 0;
3035
- if (!destroyed && (current_sources === null || !includes.call(current_sources, signal))) {
3126
+ if (!destroyed && (current_sources === null || !current_sources.has(signal))) {
3036
3127
  var deps = active_reaction.deps;
3037
3128
  if ((active_reaction.f & REACTION_IS_UPDATING) !== 0) {
3038
3129
  if (signal.rv < read_version) {
@@ -3046,7 +3137,10 @@ function get2(signal) {
3046
3137
  }
3047
3138
  }
3048
3139
  } else {
3049
- (active_reaction.deps ??= []).push(signal);
3140
+ active_reaction.deps ??= [];
3141
+ if (!includes.call(active_reaction.deps, signal)) {
3142
+ active_reaction.deps.push(signal);
3143
+ }
3050
3144
  var reactions = signal.reactions;
3051
3145
  if (reactions === null) {
3052
3146
  signal.reactions = [active_reaction];
@@ -3154,7 +3248,7 @@ function untrack(fn) {
3154
3248
  untracking = previous_untracking;
3155
3249
  }
3156
3250
  }
3157
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/events.js
3251
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/events.js
3158
3252
  var event_symbol = Symbol("events");
3159
3253
  var all_registered_events = new Set;
3160
3254
  var root_event_handles = new Set;
@@ -3199,7 +3293,8 @@ function handle_event_propagation(event) {
3199
3293
  var throw_error;
3200
3294
  var other_errors = [];
3201
3295
  while (current_target !== null) {
3202
- var parent_element = current_target.assignedSlot || current_target.parentNode || current_target.host || null;
3296
+ if (current_target === handler_element)
3297
+ break;
3203
3298
  try {
3204
3299
  var delegated = current_target[event_symbol]?.[event_name];
3205
3300
  if (delegated != null && (!current_target.disabled || event.target === current_target)) {
@@ -3212,10 +3307,10 @@ function handle_event_propagation(event) {
3212
3307
  throw_error = error;
3213
3308
  }
3214
3309
  }
3215
- if (event.cancelBubble || parent_element === handler_element || parent_element === null) {
3310
+ if (event.cancelBubble)
3216
3311
  break;
3217
- }
3218
- current_target = parent_element;
3312
+ path_idx++;
3313
+ current_target = path_idx < path.length ? path[path_idx] : null;
3219
3314
  }
3220
3315
  if (throw_error) {
3221
3316
  for (let error of other_errors) {
@@ -3233,7 +3328,7 @@ function handle_event_propagation(event) {
3233
3328
  }
3234
3329
  }
3235
3330
 
3236
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/reconciler.js
3331
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/reconciler.js
3237
3332
  var policy = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", {
3238
3333
  createHTML: (html) => {
3239
3334
  return html;
@@ -3248,7 +3343,7 @@ function create_fragment_from_html(html) {
3248
3343
  return elem.content;
3249
3344
  }
3250
3345
 
3251
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/template.js
3346
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/template.js
3252
3347
  function assign_nodes(start, end) {
3253
3348
  var effect = active_effect;
3254
3349
  if (effect.nodes === null) {
@@ -3296,7 +3391,7 @@ function append(anchor, dom) {
3296
3391
  anchor.before(dom);
3297
3392
  }
3298
3393
 
3299
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/utils.js
3394
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/utils.js
3300
3395
  var DOM_BOOLEAN_ATTRIBUTES = [
3301
3396
  "allowfullscreen",
3302
3397
  "async",
@@ -3372,7 +3467,7 @@ var RUNES = [
3372
3467
  "$host"
3373
3468
  ];
3374
3469
 
3375
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/render.js
3470
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/render.js
3376
3471
  var should_intro = true;
3377
3472
  function mount(component, options) {
3378
3473
  return _mount(component, options);
@@ -3514,7 +3609,7 @@ function unmount(component, options) {
3514
3609
  }
3515
3610
  return Promise.resolve();
3516
3611
  }
3517
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3612
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/blocks/branches.js
3518
3613
  class BranchManager {
3519
3614
  anchor;
3520
3615
  #batches = new Map;
@@ -3537,6 +3632,7 @@ class BranchManager {
3537
3632
  } else {
3538
3633
  var offscreen = this.#offscreen.get(key);
3539
3634
  if (offscreen) {
3635
+ resume_effect(offscreen.effect);
3540
3636
  this.#onscreen.set(key, offscreen.effect);
3541
3637
  this.#offscreen.delete(key);
3542
3638
  if (true_default) {
@@ -3635,7 +3731,7 @@ class BranchManager {
3635
3731
  }
3636
3732
  }
3637
3733
 
3638
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/index-client.js
3734
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/index-client.js
3639
3735
  if (true_default) {
3640
3736
  let throw_rune_error = function(rune) {
3641
3737
  if (!(rune in globalThis)) {
@@ -3661,18 +3757,18 @@ if (true_default) {
3661
3757
  throw_rune_error("$props");
3662
3758
  throw_rune_error("$bindable");
3663
3759
  }
3664
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dev/css.js
3760
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dev/css.js
3665
3761
  var all_styles = new Map;
3666
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/blocks/key.js
3762
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/blocks/key.js
3667
3763
  var NAN = Symbol("NaN");
3668
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/timing.js
3764
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/timing.js
3669
3765
  var now = true_default ? () => performance.now() : () => Date.now();
3670
3766
  var raf = {
3671
3767
  tick: (_) => (true_default ? requestAnimationFrame : noop)(_),
3672
3768
  now: () => now(),
3673
3769
  tasks: new Set
3674
3770
  };
3675
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/shared/attributes.js
3771
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/shared/attributes.js
3676
3772
  var replacements = {
3677
3773
  translate: new Map([
3678
3774
  [true, "yes"],
@@ -3682,7 +3778,7 @@ var replacements = {
3682
3778
  var whitespace = [...`
3683
3779
  \r\f \v\uFEFF`];
3684
3780
 
3685
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/attributes.js
3781
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/attributes.js
3686
3782
  var CLASS = Symbol("class");
3687
3783
  var STYLE = Symbol("style");
3688
3784
  var IS_CUSTOM_ELEMENT = Symbol("is custom element");
@@ -3736,7 +3832,7 @@ function set_custom_element_data(node, prop, value) {
3736
3832
  }
3737
3833
  }
3738
3834
  function get_attributes(element) {
3739
- return element.__attributes ??= {
3835
+ return element[ATTRIBUTES_CACHE] ??= {
3740
3836
  [IS_CUSTOM_ELEMENT]: element.nodeName.includes("-"),
3741
3837
  [IS_HTML]: element.namespaceURI === NAMESPACE_HTML
3742
3838
  };
@@ -3754,7 +3850,7 @@ function get_setters(element) {
3754
3850
  while (element_proto !== proto) {
3755
3851
  descriptors = get_descriptors(proto);
3756
3852
  for (var key in descriptors) {
3757
- if (descriptors[key].set) {
3853
+ if (descriptors[key].set && key !== "innerHTML" && key !== "textContent" && key !== "innerText") {
3758
3854
  setters.push(key);
3759
3855
  }
3760
3856
  }
@@ -3784,9 +3880,9 @@ function srcset_url_equal(element, srcset) {
3784
3880
  var urls = split_srcset(srcset);
3785
3881
  return urls.length === element_urls.length && urls.every(([url, width], i) => width === element_urls[i][1] && (src_url_equal(element_urls[i][0], url) || src_url_equal(url, element_urls[i][0])));
3786
3882
  }
3787
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/bindings/input.js
3883
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/bindings/input.js
3788
3884
  var pending = new Set;
3789
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3885
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/bindings/size.js
3790
3886
  class ResizeObserverSingleton {
3791
3887
  #listeners = new WeakMap;
3792
3888
  #observer;
@@ -3820,14 +3916,19 @@ class ResizeObserverSingleton {
3820
3916
  }));
3821
3917
  }
3822
3918
  }
3823
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/reactivity/props.js
3919
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/reactivity/props.js
3824
3920
  function prop(props, key, flags2, fallback) {
3825
3921
  var runes = !legacy_mode_flag || (flags2 & PROPS_IS_RUNES) !== 0;
3826
3922
  var bindable = (flags2 & PROPS_IS_BINDABLE) !== 0;
3827
3923
  var lazy = (flags2 & PROPS_IS_LAZY_INITIAL) !== 0;
3828
3924
  var fallback_value = fallback;
3829
3925
  var fallback_dirty = true;
3926
+ var fallback_signal = undefined;
3830
3927
  var get_fallback = () => {
3928
+ if (lazy && runes) {
3929
+ fallback_signal ??= derived(fallback);
3930
+ return get2(fallback_signal);
3931
+ }
3831
3932
  if (fallback_dirty) {
3832
3933
  fallback_dirty = false;
3833
3934
  fallback_value = lazy ? untrack(fallback) : fallback;
@@ -3914,7 +4015,7 @@ function prop(props, key, flags2, fallback) {
3914
4015
  return get2(d);
3915
4016
  };
3916
4017
  }
3917
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/legacy/legacy-client.js
4018
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/legacy/legacy-client.js
3918
4019
  function createClassComponent(options) {
3919
4020
  return new Svelte4Component(options);
3920
4021
  }
@@ -3992,7 +4093,7 @@ class Svelte4Component {
3992
4093
  }
3993
4094
  }
3994
4095
 
3995
- // ../../node_modules/.bun/svelte@5.55.4/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
4096
+ // ../../node_modules/.bun/svelte@5.56.0/node_modules/svelte/src/internal/client/dom/elements/custom-element.js
3996
4097
  var SvelteElement;
3997
4098
  if (typeof HTMLElement === "function") {
3998
4099
  SvelteElement = class extends HTMLElement {
@@ -4244,7 +4345,7 @@ var HYDRATION_END2 = "]";
4244
4345
  var HYDRATION_ERROR2 = {};
4245
4346
  var ELEMENT_PRESERVE_ATTRIBUTE_CASE2 = 1 << 1;
4246
4347
  var ELEMENT_IS_INPUT2 = 1 << 2;
4247
- var UNINITIALIZED2 = Symbol();
4348
+ var UNINITIALIZED2 = Symbol("uninitialized");
4248
4349
  var FILENAME2 = Symbol("filename");
4249
4350
  var HMR2 = Symbol("hmr");
4250
4351
  var NAMESPACE_HTML2 = "http://www.w3.org/1999/xhtml";
@@ -4308,6 +4409,11 @@ var STATE_SYMBOL2 = Symbol("$state");
4308
4409
  var LEGACY_PROPS2 = Symbol("legacy props");
4309
4410
  var LOADING_ATTR_SYMBOL2 = Symbol("");
4310
4411
  var PROXY_PATH_SYMBOL2 = Symbol("proxy path");
4412
+ var ATTRIBUTES_CACHE2 = Symbol("attributes");
4413
+ var CLASS_CACHE2 = Symbol("class");
4414
+ var STYLE_CACHE2 = Symbol("style");
4415
+ var TEXT_CACHE2 = Symbol("text");
4416
+ var FORM_RESET_HANDLER2 = Symbol("form reset");
4311
4417
  var HMR_ANCHOR2 = Symbol("hmr anchor");
4312
4418
  var STALE_REACTION2 = new class StaleReactionError2 extends Error {
4313
4419
  name = "StaleReactionError";
@@ -4892,7 +4998,7 @@ function defer_effect2(effect2, dirty_effects, maybe_dirty_effects) {
4892
4998
  }
4893
4999
  var legacy_is_updating_store2 = false;
4894
5000
  var is_store_binding2 = false;
4895
- var IS_UNMOUNTED2 = Symbol();
5001
+ var IS_UNMOUNTED2 = Symbol("unmounted");
4896
5002
  function capture_store_binding2(fn) {
4897
5003
  var previous_is_store_binding = is_store_binding2;
4898
5004
  try {
@@ -4902,7 +5008,8 @@ function capture_store_binding2(fn) {
4902
5008
  is_store_binding2 = previous_is_store_binding;
4903
5009
  }
4904
5010
  }
4905
- var batches2 = new Set;
5011
+ var first_batch2 = null;
5012
+ var last_batch2 = null;
4906
5013
  var current_batch2 = null;
4907
5014
  var previous_batch2 = null;
4908
5015
  var batch_values2 = null;
@@ -4912,17 +5019,21 @@ var is_processing2 = false;
4912
5019
  var collected_effects2 = null;
4913
5020
  var legacy_updates2 = null;
4914
5021
  var flush_count2 = 0;
4915
- var source_stacks2 = true_default2 ? new Set : null;
5022
+ var source_stacks2 = new Set;
4916
5023
  var uid2 = 1;
4917
5024
 
4918
5025
  class Batch2 {
4919
5026
  id = uid2++;
5027
+ #started = false;
5028
+ linked = true;
5029
+ #prev = null;
5030
+ #next = null;
5031
+ async_deriveds = new Map;
4920
5032
  current = new Map;
4921
5033
  previous = new Map;
4922
5034
  #commit_callbacks = new Set;
4923
5035
  #discard_callbacks = new Set;
4924
- #fork_commit_callbacks = new Set;
4925
- #pending = new Map;
5036
+ #pending = 0;
4926
5037
  #blocking_pending = new Map;
4927
5038
  #deferred = null;
4928
5039
  #roots = [];
@@ -4933,25 +5044,30 @@ class Batch2 {
4933
5044
  #unskipped_branches = new Set;
4934
5045
  is_fork = false;
4935
5046
  #decrement_queued = false;
4936
- #blockers = new Set;
5047
+ constructor() {
5048
+ if (last_batch2 === null) {
5049
+ first_batch2 = last_batch2 = this;
5050
+ } else {
5051
+ last_batch2.#next = this;
5052
+ this.#prev = last_batch2;
5053
+ }
5054
+ last_batch2 = this;
5055
+ }
4937
5056
  #is_deferred() {
4938
- return this.is_fork || this.#blocking_pending.size > 0;
4939
- }
4940
- #is_blocked() {
4941
- for (const batch of this.#blockers) {
4942
- for (const effect2 of batch.#blocking_pending.keys()) {
4943
- var skipped = false;
4944
- var e = effect2;
4945
- while (e.parent !== null) {
4946
- if (this.#skipped_branches.has(e)) {
4947
- skipped = true;
4948
- break;
4949
- }
4950
- e = e.parent;
4951
- }
4952
- if (!skipped) {
4953
- return true;
5057
+ if (this.is_fork)
5058
+ return true;
5059
+ for (const effect2 of this.#blocking_pending.keys()) {
5060
+ var e = effect2;
5061
+ var skipped = false;
5062
+ while (e.parent !== null) {
5063
+ if (this.#skipped_branches.has(e)) {
5064
+ skipped = true;
5065
+ break;
4954
5066
  }
5067
+ e = e.parent;
5068
+ }
5069
+ if (!skipped) {
5070
+ return true;
4955
5071
  }
4956
5072
  }
4957
5073
  return false;
@@ -4978,21 +5094,25 @@ class Batch2 {
4978
5094
  this.#unskipped_branches.add(effect2);
4979
5095
  }
4980
5096
  #process() {
5097
+ this.#started = true;
4981
5098
  if (flush_count2++ > 1000) {
4982
- batches2.delete(this);
5099
+ this.#unlink();
4983
5100
  infinite_loop_guard2();
4984
5101
  }
4985
- if (!this.#is_deferred()) {
4986
- for (const e of this.#dirty_effects) {
4987
- this.#maybe_dirty_effects.delete(e);
4988
- set_signal_status2(e, DIRTY2);
4989
- this.schedule(e);
4990
- }
4991
- for (const e of this.#maybe_dirty_effects) {
4992
- set_signal_status2(e, MAYBE_DIRTY2);
4993
- this.schedule(e);
5102
+ if (true_default2) {
5103
+ for (const value of this.current.keys()) {
5104
+ source_stacks2.add(value);
4994
5105
  }
4995
5106
  }
5107
+ for (const e of this.#dirty_effects) {
5108
+ this.#maybe_dirty_effects.delete(e);
5109
+ set_signal_status2(e, DIRTY2);
5110
+ this.schedule(e);
5111
+ }
5112
+ for (const e of this.#maybe_dirty_effects) {
5113
+ set_signal_status2(e, MAYBE_DIRTY2);
5114
+ this.schedule(e);
5115
+ }
4996
5116
  const roots = this.#roots;
4997
5117
  this.#roots = [];
4998
5118
  this.apply();
@@ -5004,6 +5124,8 @@ class Batch2 {
5004
5124
  this.#traverse(root, effects, render_effects);
5005
5125
  } catch (e) {
5006
5126
  reset_all2(root);
5127
+ if (!this.#is_deferred())
5128
+ this.discard();
5007
5129
  throw e;
5008
5130
  }
5009
5131
  }
@@ -5016,44 +5138,53 @@ class Batch2 {
5016
5138
  }
5017
5139
  collected_effects2 = null;
5018
5140
  legacy_updates2 = null;
5019
- if (this.#is_deferred() || this.#is_blocked()) {
5141
+ if (this.#is_deferred()) {
5020
5142
  this.#defer_effects(render_effects);
5021
5143
  this.#defer_effects(effects);
5022
5144
  for (const [e, t] of this.#skipped_branches) {
5023
5145
  reset_branch2(e, t);
5024
5146
  }
5025
- } else {
5026
- if (this.#pending.size === 0) {
5027
- batches2.delete(this);
5028
- }
5029
- this.#dirty_effects.clear();
5030
- this.#maybe_dirty_effects.clear();
5031
- for (const fn of this.#commit_callbacks)
5032
- fn(this);
5033
- this.#commit_callbacks.clear();
5034
- previous_batch2 = this;
5035
- flush_queued_effects2(render_effects);
5036
- flush_queued_effects2(effects);
5037
- previous_batch2 = null;
5038
- this.#deferred?.resolve();
5147
+ if (updates.length > 0) {
5148
+ current_batch2.#process();
5149
+ }
5150
+ return;
5039
5151
  }
5152
+ const earlier_batch = this.#find_earlier_batch();
5153
+ if (earlier_batch) {
5154
+ this.#defer_effects(render_effects);
5155
+ this.#defer_effects(effects);
5156
+ earlier_batch.#merge(this);
5157
+ return;
5158
+ }
5159
+ this.#dirty_effects.clear();
5160
+ this.#maybe_dirty_effects.clear();
5161
+ for (const fn of this.#commit_callbacks)
5162
+ fn(this);
5163
+ this.#commit_callbacks.clear();
5164
+ previous_batch2 = this;
5165
+ flush_queued_effects2(render_effects);
5166
+ flush_queued_effects2(effects);
5167
+ previous_batch2 = null;
5168
+ this.#deferred?.resolve();
5040
5169
  var next_batch = current_batch2;
5170
+ if (this.#pending === 0 && (this.#roots.length === 0 || next_batch !== null)) {
5171
+ this.#unlink();
5172
+ if (async_mode_flag2) {
5173
+ this.#commit();
5174
+ current_batch2 = next_batch;
5175
+ }
5176
+ }
5041
5177
  if (this.#roots.length > 0) {
5042
- const batch2 = next_batch ??= this;
5043
- batch2.#roots.push(...this.#roots.filter((r) => !batch2.#roots.includes(r)));
5178
+ if (next_batch !== null) {
5179
+ const batch2 = next_batch;
5180
+ batch2.#roots.push(...this.#roots.filter((r) => !batch2.#roots.includes(r)));
5181
+ } else {
5182
+ next_batch = this;
5183
+ }
5044
5184
  }
5045
5185
  if (next_batch !== null) {
5046
- batches2.add(next_batch);
5047
- if (true_default2) {
5048
- for (const source2 of this.current.keys()) {
5049
- source_stacks2.add(source2);
5050
- }
5051
- }
5052
5186
  next_batch.#process();
5053
5187
  }
5054
- if (async_mode_flag2 && !batches2.has(this)) {
5055
- this.#commit();
5056
- }
5057
5188
  }
5058
5189
  #traverse(root, effects, render_effects) {
5059
5190
  root.f ^= CLEAN2;
@@ -5091,6 +5222,59 @@ class Batch2 {
5091
5222
  }
5092
5223
  }
5093
5224
  }
5225
+ #find_earlier_batch() {
5226
+ var batch = this.#prev;
5227
+ while (batch !== null) {
5228
+ if (!batch.is_fork) {
5229
+ for (const [value, [, is_derived]] of this.current) {
5230
+ if (batch.current.has(value) && !is_derived) {
5231
+ return batch;
5232
+ }
5233
+ }
5234
+ }
5235
+ batch = batch.#prev;
5236
+ }
5237
+ return null;
5238
+ }
5239
+ #merge(batch) {
5240
+ for (const [source2, value] of batch.current) {
5241
+ if (!this.previous.has(source2) && batch.previous.has(source2)) {
5242
+ this.previous.set(source2, batch.previous.get(source2));
5243
+ }
5244
+ this.current.set(source2, value);
5245
+ }
5246
+ for (const [effect2, deferred22] of batch.async_deriveds) {
5247
+ const d = this.async_deriveds.get(effect2);
5248
+ if (d)
5249
+ deferred22.promise.then(d.resolve).catch(d.reject);
5250
+ }
5251
+ this.transfer_effects(batch.#dirty_effects, batch.#maybe_dirty_effects);
5252
+ const mark = (value) => {
5253
+ var reactions = value.reactions;
5254
+ if (reactions === null)
5255
+ return;
5256
+ for (const reaction of reactions) {
5257
+ var flags2 = reaction.f;
5258
+ if ((flags2 & DERIVED2) !== 0) {
5259
+ mark(reaction);
5260
+ } else {
5261
+ var effect2 = reaction;
5262
+ if (flags2 & (ASYNC2 | BLOCK_EFFECT2) && !this.async_deriveds.has(effect2)) {
5263
+ this.#maybe_dirty_effects.delete(effect2);
5264
+ set_signal_status2(effect2, DIRTY2);
5265
+ this.schedule(effect2);
5266
+ }
5267
+ }
5268
+ }
5269
+ };
5270
+ for (const source2 of this.current.keys()) {
5271
+ mark(source2);
5272
+ }
5273
+ this.oncommit(() => batch.discard());
5274
+ batch.#unlink();
5275
+ current_batch2 = this;
5276
+ this.#process();
5277
+ }
5094
5278
  #defer_effects(effects) {
5095
5279
  for (var i = 0;i < effects.length; i += 1) {
5096
5280
  defer_effect2(effects[i], this.#dirty_effects, this.#maybe_dirty_effects);
@@ -5116,8 +5300,10 @@ class Batch2 {
5116
5300
  batch_values2 = null;
5117
5301
  }
5118
5302
  flush() {
5119
- var source_stacks22 = true_default2 ? new Set : null;
5120
5303
  try {
5304
+ if (true_default2) {
5305
+ source_stacks2.clear();
5306
+ }
5121
5307
  is_processing2 = true;
5122
5308
  current_batch2 = this;
5123
5309
  this.#process();
@@ -5131,7 +5317,7 @@ class Batch2 {
5131
5317
  batch_values2 = null;
5132
5318
  old_values2.clear();
5133
5319
  if (true_default2) {
5134
- for (const source2 of source_stacks22) {
5320
+ for (const source2 of source_stacks2) {
5135
5321
  source2.updated = null;
5136
5322
  }
5137
5323
  }
@@ -5141,14 +5327,14 @@ class Batch2 {
5141
5327
  for (const fn of this.#discard_callbacks)
5142
5328
  fn(this);
5143
5329
  this.#discard_callbacks.clear();
5144
- this.#fork_commit_callbacks.clear();
5145
- batches2.delete(this);
5330
+ this.#unlink();
5331
+ this.#deferred?.resolve();
5146
5332
  }
5147
5333
  register_created_effect(effect2) {
5148
5334
  this.#new_effects.push(effect2);
5149
5335
  }
5150
5336
  #commit() {
5151
- for (const batch of batches2) {
5337
+ for (let batch = first_batch2;batch !== null; batch = batch.#next) {
5152
5338
  var is_earlier = batch.id < this.id;
5153
5339
  var sources = [];
5154
5340
  for (const [source3, [value, is_derived]] of this.current) {
@@ -5162,13 +5348,22 @@ class Batch2 {
5162
5348
  }
5163
5349
  sources.push(source3);
5164
5350
  }
5165
- var others = [...batch.current.keys()].filter((s) => !this.current.has(s));
5351
+ if (is_earlier) {
5352
+ for (const [effect2, deferred22] of this.async_deriveds) {
5353
+ const d = batch.async_deriveds.get(effect2);
5354
+ if (d)
5355
+ deferred22.promise.then(d.resolve).catch(d.reject);
5356
+ }
5357
+ }
5358
+ if (!batch.#started)
5359
+ continue;
5360
+ var others = [...batch.current.keys()].filter((s) => !batch.current.get(s)[1] && !this.current.has(s));
5166
5361
  if (others.length === 0) {
5167
5362
  if (is_earlier) {
5168
5363
  batch.discard();
5169
5364
  }
5170
5365
  } else if (sources.length > 0) {
5171
- if (true_default2) {
5366
+ if (true_default2 && !batch.#decrement_queued) {
5172
5367
  invariant2(batch.#roots.length === 0, "Batch has scheduled roots");
5173
5368
  }
5174
5369
  if (is_earlier) {
@@ -5189,18 +5384,25 @@ class Batch2 {
5189
5384
  mark_effects2(source2, others, marked, checked);
5190
5385
  }
5191
5386
  checked = new Map;
5192
- var current_unequal = [...batch.current.keys()].filter((c) => this.current.has(c) ? this.current.get(c)[0] !== c : true);
5193
- for (const effect2 of this.#new_effects) {
5194
- if ((effect2.f & (DESTROYED2 | INERT2 | EAGER_EFFECT2)) === 0 && depends_on2(effect2, current_unequal, checked)) {
5195
- if ((effect2.f & (ASYNC2 | BLOCK_EFFECT2)) !== 0) {
5196
- set_signal_status2(effect2, DIRTY2);
5197
- batch.schedule(effect2);
5198
- } else {
5199
- batch.#dirty_effects.add(effect2);
5387
+ var current_unequal = [...batch.current].filter(([c, v1]) => {
5388
+ const v2 = this.current.get(c);
5389
+ if (!v2)
5390
+ return true;
5391
+ return v2[0] !== v1[0] || v2[1] !== v1[1];
5392
+ }).map(([c]) => c);
5393
+ if (current_unequal.length > 0) {
5394
+ for (const effect2 of this.#new_effects) {
5395
+ if ((effect2.f & (DESTROYED2 | INERT2 | EAGER_EFFECT2)) === 0 && depends_on2(effect2, current_unequal, checked)) {
5396
+ if ((effect2.f & (ASYNC2 | BLOCK_EFFECT2)) !== 0) {
5397
+ set_signal_status2(effect2, DIRTY2);
5398
+ batch.schedule(effect2);
5399
+ } else {
5400
+ batch.#dirty_effects.add(effect2);
5401
+ }
5200
5402
  }
5201
5403
  }
5202
5404
  }
5203
- if (batch.#roots.length > 0) {
5405
+ if (batch.#roots.length > 0 && !batch.#decrement_queued) {
5204
5406
  batch.apply();
5205
5407
  for (var root of batch.#roots) {
5206
5408
  batch.#traverse(root, [], []);
@@ -5210,31 +5412,16 @@ class Batch2 {
5210
5412
  batch.deactivate();
5211
5413
  }
5212
5414
  }
5213
- for (const batch of batches2) {
5214
- if (batch.#blockers.has(this)) {
5215
- batch.#blockers.delete(this);
5216
- if (batch.#blockers.size === 0 && !batch.#is_deferred()) {
5217
- batch.activate();
5218
- batch.#process();
5219
- }
5220
- }
5221
- }
5222
5415
  }
5223
5416
  increment(blocking, effect2) {
5224
- let pending_count = this.#pending.get(effect2) ?? 0;
5225
- this.#pending.set(effect2, pending_count + 1);
5417
+ this.#pending += 1;
5226
5418
  if (blocking) {
5227
5419
  let blocking_pending_count = this.#blocking_pending.get(effect2) ?? 0;
5228
5420
  this.#blocking_pending.set(effect2, blocking_pending_count + 1);
5229
5421
  }
5230
5422
  }
5231
- decrement(blocking, effect2, skip) {
5232
- let pending_count = this.#pending.get(effect2) ?? 0;
5233
- if (pending_count === 1) {
5234
- this.#pending.delete(effect2);
5235
- } else {
5236
- this.#pending.set(effect2, pending_count - 1);
5237
- }
5423
+ decrement(blocking, effect2) {
5424
+ this.#pending -= 1;
5238
5425
  if (blocking) {
5239
5426
  let blocking_pending_count = this.#blocking_pending.get(effect2) ?? 0;
5240
5427
  if (blocking_pending_count === 1) {
@@ -5243,12 +5430,14 @@ class Batch2 {
5243
5430
  this.#blocking_pending.set(effect2, blocking_pending_count - 1);
5244
5431
  }
5245
5432
  }
5246
- if (this.#decrement_queued || skip)
5433
+ if (this.#decrement_queued)
5247
5434
  return;
5248
5435
  this.#decrement_queued = true;
5249
5436
  queue_micro_task2(() => {
5250
5437
  this.#decrement_queued = false;
5251
- this.flush();
5438
+ if (this.linked) {
5439
+ this.flush();
5440
+ }
5252
5441
  });
5253
5442
  }
5254
5443
  transfer_effects(dirty_effects, maybe_dirty_effects) {
@@ -5267,36 +5456,24 @@ class Batch2 {
5267
5456
  ondiscard(fn) {
5268
5457
  this.#discard_callbacks.add(fn);
5269
5458
  }
5270
- on_fork_commit(fn) {
5271
- this.#fork_commit_callbacks.add(fn);
5272
- }
5273
- run_fork_commit_callbacks() {
5274
- for (const fn of this.#fork_commit_callbacks)
5275
- fn(this);
5276
- this.#fork_commit_callbacks.clear();
5277
- }
5278
5459
  settled() {
5279
5460
  return (this.#deferred ??= deferred2()).promise;
5280
5461
  }
5281
5462
  static ensure() {
5282
5463
  if (current_batch2 === null) {
5283
5464
  const batch = current_batch2 = new Batch2;
5284
- if (!is_processing2) {
5285
- batches2.add(current_batch2);
5286
- if (!is_flushing_sync2) {
5287
- queue_micro_task2(() => {
5288
- if (current_batch2 !== batch) {
5289
- return;
5290
- }
5465
+ if (!is_processing2 && !is_flushing_sync2) {
5466
+ queue_micro_task2(() => {
5467
+ if (!batch.#started) {
5291
5468
  batch.flush();
5292
- });
5293
- }
5469
+ }
5470
+ });
5294
5471
  }
5295
5472
  }
5296
5473
  return current_batch2;
5297
5474
  }
5298
5475
  apply() {
5299
- if (!async_mode_flag2 || !this.is_fork && batches2.size === 1) {
5476
+ if (!async_mode_flag2 || !this.is_fork && this.#prev === null && this.#next === null) {
5300
5477
  batch_values2 = null;
5301
5478
  return;
5302
5479
  }
@@ -5304,22 +5481,21 @@ class Batch2 {
5304
5481
  for (const [source2, [value]] of this.current) {
5305
5482
  batch_values2.set(source2, value);
5306
5483
  }
5307
- for (const batch of batches2) {
5484
+ for (let batch = first_batch2;batch !== null; batch = batch.#next) {
5308
5485
  if (batch === this || batch.is_fork)
5309
5486
  continue;
5310
5487
  var intersects = false;
5311
- var differs = false;
5312
5488
  if (batch.id < this.id) {
5313
5489
  for (const [source2, [, is_derived]] of batch.current) {
5314
5490
  if (is_derived)
5315
5491
  continue;
5316
- intersects ||= this.current.has(source2);
5317
- differs ||= !this.current.has(source2);
5492
+ if (this.current.has(source2)) {
5493
+ intersects = true;
5494
+ break;
5495
+ }
5318
5496
  }
5319
5497
  }
5320
- if (intersects && differs) {
5321
- this.#blockers.add(batch);
5322
- } else {
5498
+ if (!intersects) {
5323
5499
  for (const [source2, previous] of batch.previous) {
5324
5500
  if (!batch_values2.has(source2)) {
5325
5501
  batch_values2.set(source2, previous);
@@ -5354,6 +5530,23 @@ class Batch2 {
5354
5530
  }
5355
5531
  this.#roots.push(e);
5356
5532
  }
5533
+ #unlink() {
5534
+ if (!this.linked)
5535
+ return;
5536
+ var prev = this.#prev;
5537
+ var next22 = this.#next;
5538
+ if (prev === null) {
5539
+ first_batch2 = next22;
5540
+ } else {
5541
+ prev.#next = next22;
5542
+ }
5543
+ if (next22 === null) {
5544
+ last_batch2 = prev;
5545
+ } else {
5546
+ next22.#prev = prev;
5547
+ }
5548
+ this.linked = false;
5549
+ }
5357
5550
  }
5358
5551
  function flushSync2(fn) {
5359
5552
  var was_flushing_sync = is_flushing_sync2;
@@ -5483,6 +5676,7 @@ function depends_on2(reaction, sources, checked) {
5483
5676
  function schedule_effect2(effect2) {
5484
5677
  current_batch2.schedule(effect2);
5485
5678
  }
5679
+ var version_map2 = new Map;
5486
5680
  function reset_branch2(effect2, tracked) {
5487
5681
  if ((effect2.f & BRANCH_EFFECT2) !== 0 && (effect2.f & CLEAN2) !== 0) {
5488
5682
  return;
@@ -5741,7 +5935,7 @@ class Boundary2 {
5741
5935
  current_batch2.skip_effect(this.#pending_effect);
5742
5936
  if (this.#failed_effect)
5743
5937
  current_batch2.skip_effect(this.#failed_effect);
5744
- current_batch2.on_fork_commit(() => {
5938
+ current_batch2.oncommit(() => {
5745
5939
  this.#handle_error(error);
5746
5940
  });
5747
5941
  } else {
@@ -5839,23 +6033,24 @@ function flatten2(blockers, sync, async2, fn) {
5839
6033
  var restore = capture2();
5840
6034
  var blocker_promise = pending3.length === 1 ? pending3[0].promise : pending3.length > 1 ? Promise.all(pending3.map((b) => b.promise)) : null;
5841
6035
  function finish(values) {
6036
+ if ((parent.f & DESTROYED2) !== 0) {
6037
+ return;
6038
+ }
5842
6039
  restore();
5843
6040
  try {
5844
6041
  fn(values);
5845
6042
  } catch (error) {
5846
- if ((parent.f & DESTROYED2) === 0) {
5847
- invoke_error_boundary2(error, parent);
5848
- }
6043
+ invoke_error_boundary2(error, parent);
5849
6044
  }
5850
6045
  unset_context2();
5851
6046
  }
6047
+ var decrement_pending = increment_pending2();
5852
6048
  if (async2.length === 0) {
5853
- blocker_promise.then(() => finish(sync.map(d)));
6049
+ blocker_promise.then(() => finish(sync.map(d))).finally(decrement_pending);
5854
6050
  return;
5855
6051
  }
5856
- var decrement_pending = increment_pending2();
5857
6052
  function run3() {
5858
- Promise.all(async2.map((expression) => async_derived2(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary2(error, parent)).finally(() => decrement_pending());
6053
+ Promise.all(async2.map((expression) => async_derived2(expression))).then((result) => finish([...sync.map(d), ...result])).catch((error) => invoke_error_boundary2(error, parent)).finally(decrement_pending);
5859
6054
  }
5860
6055
  if (blocker_promise) {
5861
6056
  blocker_promise.then(() => {
@@ -5904,12 +6099,12 @@ function increment_pending2() {
5904
6099
  var effect2 = active_effect2;
5905
6100
  var boundary22 = effect2.b;
5906
6101
  var batch = current_batch2;
5907
- var blocking = boundary22.is_rendered();
5908
- boundary22.update_pending_count(1, batch);
6102
+ var blocking = !!boundary22?.is_rendered();
6103
+ boundary22?.update_pending_count(1, batch);
5909
6104
  batch.increment(blocking, effect2);
5910
- return (skip = false) => {
5911
- boundary22.update_pending_count(-1, batch);
5912
- batch.decrement(blocking, effect2, skip);
6105
+ return () => {
6106
+ boundary22?.update_pending_count(-1, batch);
6107
+ batch.decrement(blocking, effect2);
5913
6108
  };
5914
6109
  }
5915
6110
  var reactivity_loss_tracker2 = null;
@@ -5941,6 +6136,7 @@ function derived2(fn) {
5941
6136
  }
5942
6137
  return signal;
5943
6138
  }
6139
+ var OBSOLETE2 = Symbol("obsolete");
5944
6140
  function async_derived2(fn, label, location) {
5945
6141
  let parent = active_effect2;
5946
6142
  if (parent === null) {
@@ -5949,9 +6145,9 @@ function async_derived2(fn, label, location) {
5949
6145
  var promise = undefined;
5950
6146
  var signal = source2(UNINITIALIZED2);
5951
6147
  if (true_default2)
5952
- signal.label = label;
6148
+ signal.label = label ?? fn.toString();
5953
6149
  var should_suspend = !active_reaction2;
5954
- var deferreds = new Map;
6150
+ var deferreds = new Set;
5955
6151
  async_effect2(() => {
5956
6152
  var effect2 = active_effect2;
5957
6153
  if (true_default2) {
@@ -5960,7 +6156,10 @@ function async_derived2(fn, label, location) {
5960
6156
  var d = deferred2();
5961
6157
  promise = d.promise;
5962
6158
  try {
5963
- Promise.resolve(fn()).then(d.resolve, d.reject).finally(unset_context2);
6159
+ Promise.resolve(fn()).then(d.resolve, (e) => {
6160
+ if (e !== STALE_REACTION2)
6161
+ d.reject(e);
6162
+ }).finally(unset_context2);
5964
6163
  } catch (error) {
5965
6164
  d.reject(error);
5966
6165
  unset_context2();
@@ -5985,28 +6184,24 @@ function async_derived2(fn, label, location) {
5985
6184
  if ((effect2.f & REACTION_RAN2) !== 0) {
5986
6185
  var decrement_pending = increment_pending2();
5987
6186
  }
5988
- if (parent.b.is_rendered()) {
5989
- deferreds.get(batch)?.reject(STALE_REACTION2);
5990
- deferreds.delete(batch);
6187
+ if (parent.b?.is_rendered()) {
6188
+ batch.async_deriveds.get(effect2)?.reject(OBSOLETE2);
5991
6189
  } else {
5992
6190
  for (const d2 of deferreds.values()) {
5993
- d2.reject(STALE_REACTION2);
6191
+ d2.reject(OBSOLETE2);
5994
6192
  }
5995
- deferreds.clear();
5996
6193
  }
5997
- deferreds.set(batch, d);
6194
+ deferreds.add(d);
6195
+ batch.async_deriveds.set(effect2, d);
5998
6196
  }
5999
6197
  const handler = (value, error = undefined) => {
6000
6198
  if (true_default2) {
6001
6199
  reactivity_loss_tracker2 = null;
6002
6200
  }
6003
- if (decrement_pending) {
6004
- var skip = error === STALE_REACTION2;
6005
- decrement_pending(skip);
6006
- }
6007
- if (error === STALE_REACTION2 || (effect2.f & DESTROYED2) !== 0) {
6201
+ decrement_pending?.();
6202
+ deferreds.delete(d);
6203
+ if (error === OBSOLETE2)
6008
6204
  return;
6009
- }
6010
6205
  batch.activate();
6011
6206
  if (error) {
6012
6207
  signal.f |= ERROR_VALUE2;
@@ -6015,30 +6210,24 @@ function async_derived2(fn, label, location) {
6015
6210
  if ((signal.f & ERROR_VALUE2) !== 0) {
6016
6211
  signal.f ^= ERROR_VALUE2;
6017
6212
  }
6018
- internal_set2(signal, value);
6019
- for (const [b, d2] of deferreds) {
6020
- deferreds.delete(b);
6021
- if (b === batch)
6022
- break;
6023
- d2.reject(STALE_REACTION2);
6024
- }
6025
- if (true_default2 && location !== undefined) {
6213
+ if (true_default2 && location !== undefined && !signal.equals(value)) {
6026
6214
  recent_async_deriveds2.add(signal);
6027
6215
  setTimeout(() => {
6028
- if (recent_async_deriveds2.has(signal)) {
6216
+ if (recent_async_deriveds2.has(signal) && (effect2.f & DESTROYED2) === 0) {
6029
6217
  await_waterfall2(signal.label, location);
6030
6218
  recent_async_deriveds2.delete(signal);
6031
6219
  }
6032
6220
  });
6033
6221
  }
6222
+ internal_set2(signal, value);
6034
6223
  }
6035
6224
  batch.deactivate();
6036
6225
  };
6037
6226
  d.promise.then(handler, (e) => handler(null, e || "unknown"));
6038
6227
  });
6039
6228
  teardown2(() => {
6040
- for (const d of deferreds.values()) {
6041
- d.reject(STALE_REACTION2);
6229
+ for (const d of deferreds) {
6230
+ d.reject(OBSOLETE2);
6042
6231
  }
6043
6232
  });
6044
6233
  if (true_default2) {
@@ -6083,7 +6272,7 @@ function execute_derived2(derived22) {
6083
6272
  var value;
6084
6273
  var prev_active_effect = active_effect2;
6085
6274
  var parent = derived22.parent;
6086
- if (!is_destroying_effect2 && parent !== null && (parent.f & (DESTROYED2 | INERT2)) !== 0) {
6275
+ if (!is_destroying_effect2 && parent !== null && derived22.v !== UNINITIALIZED2 && (parent.f & (DESTROYED2 | INERT2)) !== 0) {
6087
6276
  derived_inert2();
6088
6277
  return derived22.v;
6089
6278
  }
@@ -6122,6 +6311,7 @@ function update_derived2(derived22) {
6122
6311
  if (!current_batch2?.is_fork || derived22.deps === null) {
6123
6312
  if (current_batch2 !== null) {
6124
6313
  current_batch2.capture(derived22, value, true);
6314
+ previous_batch2?.capture(derived22, value, true);
6125
6315
  } else {
6126
6316
  derived22.v = value;
6127
6317
  }
@@ -6149,7 +6339,8 @@ function freeze_derived_effects2(derived22) {
6149
6339
  if (e.teardown || e.ac) {
6150
6340
  e.teardown?.();
6151
6341
  e.ac?.abort(STALE_REACTION2);
6152
- e.teardown = noop2;
6342
+ if (e.fn !== null)
6343
+ e.teardown = noop2;
6153
6344
  e.ac = null;
6154
6345
  remove_reactions2(e, 0);
6155
6346
  destroy_effect_children2(e);
@@ -6160,7 +6351,7 @@ function unfreeze_derived_effects2(derived22) {
6160
6351
  if (derived22.effects === null)
6161
6352
  return;
6162
6353
  for (const e of derived22.effects) {
6163
- if (e.teardown) {
6354
+ if (e.teardown && e.fn !== null) {
6164
6355
  update_effect2(e);
6165
6356
  }
6166
6357
  }
@@ -6207,7 +6398,7 @@ function mutable_source2(initial_value, immutable = false, trackable = true) {
6207
6398
  return s;
6208
6399
  }
6209
6400
  function set2(source22, value, should_proxy = false) {
6210
- if (active_reaction2 !== null && (!untracking2 || (active_reaction2.f & EAGER_EFFECT2) !== 0) && is_runes2() && (active_reaction2.f & (DERIVED2 | BLOCK_EFFECT2 | ASYNC2 | EAGER_EFFECT2)) !== 0 && (current_sources2 === null || !includes2.call(current_sources2, source22))) {
6401
+ if (active_reaction2 !== null && (!untracking2 || (active_reaction2.f & EAGER_EFFECT2) !== 0) && is_runes2() && (active_reaction2.f & (DERIVED2 | BLOCK_EFFECT2 | ASYNC2 | EAGER_EFFECT2)) !== 0 && (current_sources2 === null || !current_sources2.has(source22))) {
6211
6402
  state_unsafe_mutation2();
6212
6403
  }
6213
6404
  let new_value = should_proxy ? proxy2(value) : value;
@@ -6272,7 +6463,13 @@ function flush_eager_effects2() {
6272
6463
  if ((effect2.f & CLEAN2) !== 0) {
6273
6464
  set_signal_status2(effect2, MAYBE_DIRTY2);
6274
6465
  }
6275
- if (is_dirty2(effect2)) {
6466
+ let dirty;
6467
+ try {
6468
+ dirty = is_dirty2(effect2);
6469
+ } catch {
6470
+ dirty = true;
6471
+ }
6472
+ if (dirty) {
6276
6473
  update_effect2(effect2);
6277
6474
  }
6278
6475
  }
@@ -6292,19 +6489,17 @@ function mark_reactions2(signal, status, updated_during_traversal) {
6292
6489
  var flags22 = reaction.f;
6293
6490
  if (!runes && reaction === active_effect2)
6294
6491
  continue;
6295
- if (true_default2 && (flags22 & EAGER_EFFECT2) !== 0) {
6296
- eager_effects2.add(reaction);
6297
- continue;
6298
- }
6299
6492
  var not_dirty = (flags22 & DIRTY2) === 0;
6300
6493
  if (not_dirty) {
6301
6494
  set_signal_status2(reaction, status);
6302
6495
  }
6303
- if ((flags22 & DERIVED2) !== 0) {
6496
+ if ((flags22 & EAGER_EFFECT2) !== 0) {
6497
+ eager_effects2.add(reaction);
6498
+ } else if ((flags22 & DERIVED2) !== 0) {
6304
6499
  var derived22 = reaction;
6305
6500
  batch_values2?.delete(derived22);
6306
6501
  if ((flags22 & WAS_MARKED2) === 0) {
6307
- if (flags22 & CONNECTED2) {
6502
+ if (flags22 & CONNECTED2 && (active_effect2 === null || (active_effect2.f & REACTION_IS_UPDATING2) === 0)) {
6308
6503
  reaction.f |= WAS_MARKED2;
6309
6504
  }
6310
6505
  mark_reactions2(derived22, MAYBE_DIRTY2, updated_during_traversal);
@@ -6650,14 +6845,13 @@ function init_operations2() {
6650
6845
  first_child_getter2 = get_descriptor2(node_prototype, "firstChild").get;
6651
6846
  next_sibling_getter2 = get_descriptor2(node_prototype, "nextSibling").get;
6652
6847
  if (is_extensible2(element_prototype)) {
6653
- element_prototype.__click = undefined;
6654
- element_prototype.__className = undefined;
6655
- element_prototype.__attributes = null;
6656
- element_prototype.__style = undefined;
6848
+ element_prototype[CLASS_CACHE2] = undefined;
6849
+ element_prototype[ATTRIBUTES_CACHE2] = null;
6850
+ element_prototype[STYLE_CACHE2] = undefined;
6657
6851
  element_prototype.__e = undefined;
6658
6852
  }
6659
6853
  if (is_extensible2(text_prototype)) {
6660
- text_prototype.__t = undefined;
6854
+ text_prototype[TEXT_CACHE2] = undefined;
6661
6855
  }
6662
6856
  if (true_default2) {
6663
6857
  element_prototype.__svelte_meta = null;
@@ -6748,8 +6942,10 @@ function should_defer_append2() {
6748
6942
  return (flags22 & REACTION_RAN2) !== 0;
6749
6943
  }
6750
6944
  function create_element2(tag22, namespace, is2) {
6751
- let options = is2 ? { is: is2 } : undefined;
6752
- return document.createElementNS(namespace ?? NAMESPACE_HTML2, tag22, options);
6945
+ if (namespace == null || namespace === NAMESPACE_HTML2) {
6946
+ return is2 ? document.createElement(tag22, { is: is2 }) : document.createElement(tag22);
6947
+ }
6948
+ return is2 ? document.createElementNS(namespace, tag22, { is: is2 }) : document.createElementNS(namespace, tag22);
6753
6949
  }
6754
6950
  function merge_text_nodes2(text2) {
6755
6951
  if (text2.nodeValue.length < 65536) {
@@ -6875,7 +7071,7 @@ function user_effect2(fn) {
6875
7071
  });
6876
7072
  }
6877
7073
  var flags22 = active_effect2.f;
6878
- var defer = !active_reaction2 && (flags22 & BRANCH_EFFECT2) !== 0 && (flags22 & REACTION_RAN2) === 0;
7074
+ var defer = !active_reaction2 && (flags22 & BRANCH_EFFECT2) !== 0 && component_context2 !== null && !component_context2.i;
6879
7075
  if (defer) {
6880
7076
  var context = component_context2;
6881
7077
  (context.e ??= []).push(fn);
@@ -7124,11 +7320,7 @@ function set_active_effect2(effect22) {
7124
7320
  var current_sources2 = null;
7125
7321
  function push_reaction_value2(value) {
7126
7322
  if (active_reaction2 !== null && (!async_mode_flag2 || (active_reaction2.f & DERIVED2) !== 0)) {
7127
- if (current_sources2 === null) {
7128
- current_sources2 = [value];
7129
- } else {
7130
- current_sources2.push(value);
7131
- }
7323
+ (current_sources2 ??= new Set).add(value);
7132
7324
  }
7133
7325
  }
7134
7326
  var new_deps2 = null;
@@ -7176,7 +7368,7 @@ function schedule_possible_effect_self_invalidation2(signal, effect22, root = tr
7176
7368
  var reactions = signal.reactions;
7177
7369
  if (reactions === null)
7178
7370
  return;
7179
- if (!async_mode_flag2 && current_sources2 !== null && includes2.call(current_sources2, signal)) {
7371
+ if (!async_mode_flag2 && current_sources2 !== null && current_sources2.has(signal)) {
7180
7372
  return;
7181
7373
  }
7182
7374
  for (var i = 0;i < reactions.length; i++) {
@@ -7373,7 +7565,7 @@ function get22(signal) {
7373
7565
  captured_signals2?.add(signal);
7374
7566
  if (active_reaction2 !== null && !untracking2) {
7375
7567
  var destroyed = active_effect2 !== null && (active_effect2.f & DESTROYED2) !== 0;
7376
- if (!destroyed && (current_sources2 === null || !includes2.call(current_sources2, signal))) {
7568
+ if (!destroyed && (current_sources2 === null || !current_sources2.has(signal))) {
7377
7569
  var deps = active_reaction2.deps;
7378
7570
  if ((active_reaction2.f & REACTION_IS_UPDATING2) !== 0) {
7379
7571
  if (signal.rv < read_version2) {
@@ -7387,7 +7579,10 @@ function get22(signal) {
7387
7579
  }
7388
7580
  }
7389
7581
  } else {
7390
- (active_reaction2.deps ??= []).push(signal);
7582
+ active_reaction2.deps ??= [];
7583
+ if (!includes2.call(active_reaction2.deps, signal)) {
7584
+ active_reaction2.deps.push(signal);
7585
+ }
7391
7586
  var reactions = signal.reactions;
7392
7587
  if (reactions === null) {
7393
7588
  signal.reactions = [active_reaction2];
@@ -7590,7 +7785,8 @@ function handle_event_propagation2(event2) {
7590
7785
  var throw_error;
7591
7786
  var other_errors = [];
7592
7787
  while (current_target !== null) {
7593
- var parent_element = current_target.assignedSlot || current_target.parentNode || current_target.host || null;
7788
+ if (current_target === handler_element)
7789
+ break;
7594
7790
  try {
7595
7791
  var delegated22 = current_target[event_symbol2]?.[event_name];
7596
7792
  if (delegated22 != null && (!current_target.disabled || event2.target === current_target)) {
@@ -7603,10 +7799,10 @@ function handle_event_propagation2(event2) {
7603
7799
  throw_error = error;
7604
7800
  }
7605
7801
  }
7606
- if (event2.cancelBubble || parent_element === handler_element || parent_element === null) {
7802
+ if (event2.cancelBubble)
7607
7803
  break;
7608
- }
7609
- current_target = parent_element;
7804
+ path_idx++;
7805
+ current_target = path_idx < path.length ? path[path_idx] : null;
7610
7806
  }
7611
7807
  if (throw_error) {
7612
7808
  for (let error of other_errors) {
@@ -7944,6 +8140,7 @@ class BranchManager2 {
7944
8140
  } else {
7945
8141
  var offscreen = this.#offscreen.get(key2);
7946
8142
  if (offscreen) {
8143
+ resume_effect2(offscreen.effect);
7947
8144
  this.#onscreen.set(key2, offscreen.effect);
7948
8145
  this.#offscreen.delete(key2);
7949
8146
  if (true_default2) {
@@ -8695,7 +8892,7 @@ function to_class2(value, hash22, directives) {
8695
8892
  return classname === "" ? null : classname;
8696
8893
  }
8697
8894
  function set_class2(dom, is_html, value, hash22, prev_classes, next_classes) {
8698
- var prev = dom.__className;
8895
+ var prev = dom[CLASS_CACHE2];
8699
8896
  if (hydrating2 || prev !== value || prev === undefined) {
8700
8897
  var next_class_name = to_class2(value, hash22, next_classes);
8701
8898
  if (!hydrating2 || next_class_name !== dom.getAttribute("class")) {
@@ -8707,7 +8904,7 @@ function set_class2(dom, is_html, value, hash22, prev_classes, next_classes) {
8707
8904
  dom.setAttribute("class", next_class_name);
8708
8905
  }
8709
8906
  }
8710
- dom.__className = value;
8907
+ dom[CLASS_CACHE2] = value;
8711
8908
  } else if (next_classes && prev_classes !== next_classes) {
8712
8909
  for (var key2 in next_classes) {
8713
8910
  var is_present = !!next_classes[key2];
@@ -8748,7 +8945,7 @@ function set_attribute22(element2, attribute, value, skip_warning) {
8748
8945
  }
8749
8946
  }
8750
8947
  function get_attributes2(element2) {
8751
- return element2.__attributes ??= {
8948
+ return element2[ATTRIBUTES_CACHE2] ??= {
8752
8949
  [IS_CUSTOM_ELEMENT2]: element2.nodeName.includes("-"),
8753
8950
  [IS_HTML2]: element2.namespaceURI === NAMESPACE_HTML2
8754
8951
  };
@@ -8766,7 +8963,7 @@ function get_setters2(element2) {
8766
8963
  while (element_proto !== proto) {
8767
8964
  descriptors = get_descriptors2(proto);
8768
8965
  for (var key2 in descriptors) {
8769
- if (descriptors[key2].set) {
8966
+ if (descriptors[key2].set && key2 !== "innerHTML" && key2 !== "textContent" && key2 !== "innerText") {
8770
8967
  setters.push(key2);
8771
8968
  }
8772
8969
  }
@@ -8844,7 +9041,7 @@ function bind_this2(element_or_component = {}, update2, get_value, get_parts) {
8844
9041
  old_parts = parts;
8845
9042
  parts = get_parts?.() || [];
8846
9043
  untrack2(() => {
8847
- if (element_or_component !== get_value(...parts)) {
9044
+ if (!is_bound_this(get_value(...parts), element_or_component)) {
8848
9045
  update2(element_or_component, ...parts);
8849
9046
  if (old_parts && is_bound_this(get_value(...old_parts), element_or_component)) {
8850
9047
  update2(null, ...old_parts);
@@ -8877,7 +9074,12 @@ function prop2(props, key2, flags22, fallback2) {
8877
9074
  var lazy = (flags22 & PROPS_IS_LAZY_INITIAL2) !== 0;
8878
9075
  var fallback_value = fallback2;
8879
9076
  var fallback_dirty = true;
9077
+ var fallback_signal = undefined;
8880
9078
  var get_fallback = () => {
9079
+ if (lazy && runes) {
9080
+ fallback_signal ??= derived2(fallback2);
9081
+ return get22(fallback_signal);
9082
+ }
8881
9083
  if (fallback_dirty) {
8882
9084
  fallback_dirty = false;
8883
9085
  fallback_value = lazy ? untrack2(fallback2) : fallback2;
@@ -9881,7 +10083,7 @@ function createScopedToolId(baseToolId, scopeLevel, scopeId) {
9881
10083
  }
9882
10084
  function parseScopedToolId(id) {
9883
10085
  const parts = id.split(":");
9884
- if (parts.length !== 3 && parts.length !== 4)
10086
+ if (parts.length !== 3)
9885
10087
  return null;
9886
10088
  const [baseToolId, scopeLevelRaw, scopeId] = parts;
9887
10089
  if (!baseToolId || !scopeId)
@@ -10233,7 +10435,8 @@ class BrowserTTSProvider {
10233
10435
  supportsWordBoundary: true,
10234
10436
  supportsVoiceSelection: true,
10235
10437
  supportsRateControl: true,
10236
- supportsPitchControl: true
10438
+ supportsPitchControl: true,
10439
+ supportsSSML: false
10237
10440
  };
10238
10441
  }
10239
10442
  destroy() {}
@@ -10531,7 +10734,7 @@ class TTSToolProvider {
10531
10734
  }
10532
10735
  const moduleLoadStartedAt = Date.now();
10533
10736
  await this.emitTelemetry("pie-tool-library-load-start", {
10534
- toolId: "tts",
10737
+ toolId: "textToSpeech",
10535
10738
  operation: "server-provider-module-import",
10536
10739
  backend: config.serverProvider || config.backend
10537
10740
  });
@@ -10539,7 +10742,7 @@ class TTSToolProvider {
10539
10742
  try {
10540
10743
  const loaded = await import("@pie-players/tts-client-server");
10541
10744
  await this.emitTelemetry("pie-tool-library-load-success", {
10542
- toolId: "tts",
10745
+ toolId: "textToSpeech",
10543
10746
  operation: "server-provider-module-import",
10544
10747
  backend: config.serverProvider || config.backend,
10545
10748
  duration: Date.now() - moduleLoadStartedAt
@@ -10547,7 +10750,7 @@ class TTSToolProvider {
10547
10750
  return loaded;
10548
10751
  } catch (error) {
10549
10752
  await this.emitTelemetry("pie-tool-library-load-error", {
10550
- toolId: "tts",
10753
+ toolId: "textToSpeech",
10551
10754
  operation: "server-provider-module-import",
10552
10755
  backend: config.serverProvider || config.backend,
10553
10756
  duration: Date.now() - moduleLoadStartedAt,
@@ -10603,7 +10806,6 @@ var DEFAULT_TOOL_TAG_MAP = {
10603
10806
  highlighter: "pie-tool-annotation-toolbar",
10604
10807
  lineReader: "pie-tool-line-reader",
10605
10808
  theme: "pie-tool-theme",
10606
- colorScheme: "pie-tool-theme",
10607
10809
  annotationToolbar: "pie-tool-annotation-toolbar",
10608
10810
  graph: "pie-tool-graph",
10609
10811
  periodicTable: "pie-tool-periodic-table"
@@ -10619,6 +10821,30 @@ var createToolElement = (toolId, context, toolbarContext, overrides) => {
10619
10821
  const factory = factoryForTool ?? overrides?.toolComponentFactory;
10620
10822
  return factory ? factory({ toolId, tagName, context, toolbarContext }) : createDefaultToolElement(tagName);
10621
10823
  };
10824
+ var overlayElementCache = new WeakMap;
10825
+ function getCachedOverlay(coordinator, fullToolId) {
10826
+ if (!coordinator)
10827
+ return null;
10828
+ const scoped = overlayElementCache.get(coordinator);
10829
+ const element2 = scoped?.get(fullToolId);
10830
+ if (!element2)
10831
+ return null;
10832
+ if (!element2.isConnected) {
10833
+ scoped?.delete(fullToolId);
10834
+ return null;
10835
+ }
10836
+ return element2;
10837
+ }
10838
+ function setCachedOverlay(coordinator, fullToolId, element2) {
10839
+ if (!coordinator)
10840
+ return;
10841
+ let scoped = overlayElementCache.get(coordinator);
10842
+ if (!scoped) {
10843
+ scoped = new Map;
10844
+ overlayElementCache.set(coordinator, scoped);
10845
+ }
10846
+ scoped.set(fullToolId, element2);
10847
+ }
10622
10848
  function normalizeCalculatorType(value) {
10623
10849
  return value === "basic" || value === "scientific" ? value : null;
10624
10850
  }
@@ -10688,7 +10914,11 @@ var calculatorToolRegistration = {
10688
10914
  const { calculatorType, availableTypes, displayName } = getCalculatorRenderParams(toolbarContext);
10689
10915
  const fullToolId = createScopedToolId(this.toolId, toolbarContext.scope.level, toolbarContext.scope.scopeId);
10690
10916
  const componentOverrides = toolbarContext.componentOverrides;
10691
- const overlay = createToolElement(this.toolId, context, toolbarContext, componentOverrides);
10917
+ const cachedOverlay = getCachedOverlay(toolbarContext.toolCoordinator, fullToolId);
10918
+ const overlay = cachedOverlay ?? createToolElement(this.toolId, context, toolbarContext, componentOverrides);
10919
+ if (!cachedOverlay) {
10920
+ setCachedOverlay(toolbarContext.toolCoordinator, fullToolId, overlay);
10921
+ }
10692
10922
  overlay.setAttribute("tool-id", fullToolId);
10693
10923
  overlay.toolkitCoordinator = toolbarContext.toolkitCoordinator;
10694
10924
  applyCalculatorParamsToElement(overlay, calculatorType, availableTypes);
@@ -10705,7 +10935,9 @@ var calculatorToolRegistration = {
10705
10935
  active: toolbarContext.isToolVisible(fullToolId)
10706
10936
  };
10707
10937
  let lastVisibleState = button.active;
10708
- overlay.visible = button.active;
10938
+ if (overlay.visible !== button.active) {
10939
+ overlay.visible = button.active;
10940
+ }
10709
10941
  return {
10710
10942
  toolId: this.toolId,
10711
10943
  elements: [
@@ -10750,6 +10982,23 @@ var calculatorToolRegistration = {
10750
10982
  };
10751
10983
  }
10752
10984
  };
10985
+ var sreOperationQueue = Promise.resolve();
10986
+ var isPlainRecord = (value) => !!value && typeof value === "object" && !Array.isArray(value);
10987
+ var trimOption = (value) => typeof value === "string" && value.trim() ? value.trim() : undefined;
10988
+ var normalizeSREMathSpeechOptions = (options) => {
10989
+ if (!isPlainRecord(options))
10990
+ return;
10991
+ const domain = trimOption(options.domain);
10992
+ const style = trimOption(options.style);
10993
+ const engineOptions = isPlainRecord(options.engineOptions) ? options.engineOptions : undefined;
10994
+ if (!domain && !style && !engineOptions)
10995
+ return;
10996
+ return {
10997
+ ...domain ? { domain } : {},
10998
+ ...style ? { style } : {},
10999
+ ...engineOptions ? { engineOptions } : {}
11000
+ };
11001
+ };
10753
11002
  var VALID_TTS_LAYOUT_MODES = new Set([
10754
11003
  "reserved-row",
10755
11004
  "expanding-row",
@@ -10814,7 +11063,7 @@ var applyRuntimeDefaults = (config) => {
10814
11063
  };
10815
11064
  var resolveTTSRuntimeSettings = (config) => {
10816
11065
  const configRecord = toRecord(config);
10817
- const settingsRecord = toRecord(config?.settings);
11066
+ const settingsRecord = toRecord(configRecord.settings);
10818
11067
  return applyRuntimeDefaults({
10819
11068
  ...configRecord,
10820
11069
  ...settingsRecord
@@ -10834,6 +11083,7 @@ var buildRuntimeTTSConfig = (config) => {
10834
11083
  const backend = resolveTTSBackend(config);
10835
11084
  const runtimeProvider = resolveRuntimeProvider(config, backend);
10836
11085
  const transportMode = resolveTransportMode(config, runtimeProvider);
11086
+ const mathSpeech = normalizeSREMathSpeechOptions(config.mathSpeech);
10837
11087
  return {
10838
11088
  voice: config.defaultVoice,
10839
11089
  rate: config.rate,
@@ -10848,7 +11098,8 @@ var buildRuntimeTTSConfig = (config) => {
10848
11098
  } : {},
10849
11099
  ...transportMode === "custom" && typeof config.cache === "boolean" ? { cache: config.cache } : {},
10850
11100
  ...transportMode === "custom" && config.speedRate ? { speedRate: config.speedRate } : {},
10851
- ...transportMode === "custom" && config.lang_id ? { lang_id: config.lang_id } : {}
11101
+ ...transportMode === "custom" && config.lang_id ? { lang_id: config.lang_id } : {},
11102
+ ...mathSpeech ? { mathSpeech } : {}
10852
11103
  },
10853
11104
  apiEndpoint: config.apiEndpoint,
10854
11105
  provider: runtimeProvider,
@@ -10857,7 +11108,8 @@ var buildRuntimeTTSConfig = (config) => {
10857
11108
  endpointMode: config.endpointMode,
10858
11109
  endpointValidationMode: config.endpointValidationMode,
10859
11110
  includeAuthOnAssetFetch: config.includeAuthOnAssetFetch,
10860
- validateEndpoint: config.validateEndpoint
11111
+ validateEndpoint: config.validateEndpoint,
11112
+ ...typeof config.mathTokenHighlighting === "boolean" ? { mathTokenHighlighting: config.mathTokenHighlighting } : {}
10861
11113
  };
10862
11114
  };
10863
11115
  var resolveTTSLayoutMode = (config) => normalizeTTSLayoutMode(config.layoutMode);
@@ -11313,7 +11565,6 @@ var themeToolRegistration = {
11313
11565
  "highContrastDisplay",
11314
11566
  "colorContrast",
11315
11567
  "invertColors",
11316
- "colorScheme",
11317
11568
  "theme",
11318
11569
  "highContrast",
11319
11570
  "customColors"
@@ -12487,26 +12738,16 @@ var __pieDefineSafely = (tagName, ctor) => {
12487
12738
  }
12488
12739
  }
12489
12740
  };
12490
- var root_4 = from_html2(`<span class="item-toolbar__element-host svelte-rnx3ie"></span>`);
12491
- var root_5 = from_html2(`<span class="item-toolbar__element-host svelte-rnx3ie"></span>`);
12492
- var root_9 = from_html2(`<span class="item-toolbar__calculator-icon svelte-rnx3ie" aria-hidden="true"><i class="fa-light fa-calculator"></i></span>`);
12493
- var root_10 = from_html2(`<span aria-hidden="true"></span>`);
12494
- var root_11 = from_html2(`<img class="item-toolbar__icon-image svelte-rnx3ie" alt=""/>`);
12495
- var root_13 = from_html2(`<span aria-hidden="true"></span>`);
12496
- var root_14 = from_html2(`<i aria-hidden="true"></i>`);
12497
- var root_7 = from_html2(`<a><!></a>`);
12498
- var root_17 = from_html2(`<span class="item-toolbar__calculator-icon svelte-rnx3ie" aria-hidden="true"><i class="fa-light fa-calculator"></i></span>`);
12499
- var root_18 = from_html2(`<span aria-hidden="true"></span>`);
12500
- var root_19 = from_html2(`<img class="item-toolbar__icon-image svelte-rnx3ie" alt=""/>`);
12501
- var root_21 = from_html2(`<span aria-hidden="true"></span>`);
12502
- var root_22 = from_html2(`<i aria-hidden="true"></i>`);
12503
- var root_15 = from_html2(`<button type="button"><!></button>`);
12504
- var root_24 = from_html2(`<span class="item-toolbar__element-host svelte-rnx3ie"></span>`);
12505
- var root_25 = from_html2(`<span class="item-toolbar__element-host svelte-rnx3ie"></span>`);
12506
- var root_28 = from_html2(`<span class="item-toolbar__controls-host svelte-rnx3ie"></span>`);
12507
- var root_29 = from_html2(`<span class="item-toolbar__controls-host svelte-rnx3ie"></span>`);
12508
- var root_26 = from_html2(`<div></div>`);
12509
- var root_2 = from_html2(`<div><div class="item-toolbar__tools-row svelte-rnx3ie"><!> <!> <!></div> <!></div>`);
12741
+ var root_1 = from_html2(`<span class="item-toolbar__element-host svelte-rnx3ie"></span>`);
12742
+ var root_2 = from_html2(`<span class="item-toolbar__calculator-icon svelte-rnx3ie" aria-hidden="true"><i class="fa-regular fa-calculator svelte-rnx3ie"></i></span>`);
12743
+ var root_3 = from_html2(`<span aria-hidden="true"></span>`);
12744
+ var root_4 = from_html2(`<img class="item-toolbar__icon-image svelte-rnx3ie" alt=""/>`);
12745
+ var root_5 = from_html2(`<i aria-hidden="true"></i>`);
12746
+ var root_6 = from_html2(`<a><!></a>`);
12747
+ var root_7 = from_html2(`<button type="button"><!></button>`);
12748
+ var root_8 = from_html2(`<span class="item-toolbar__controls-host svelte-rnx3ie"></span>`);
12749
+ var root_9 = from_html2(`<div></div>`);
12750
+ var root_10 = from_html2(`<div><div class="item-toolbar__tools-row svelte-rnx3ie"><!> <!> <!></div> <!></div>`);
12510
12751
  var $$css = {
12511
12752
  hash: "svelte-rnx3ie",
12512
12753
  code: `.item-toolbar.svelte-rnx3ie {display:flex;flex-direction:column;align-items:flex-end;gap:0;--pie-toolbar-tools-row-height: 2rem;--pie-tts-controls-row-height: 2.875rem;}.item-toolbar__tools-row.svelte-rnx3ie {display:flex;align-items:center;justify-content:flex-end;flex-wrap:nowrap;gap:0.5rem;min-height:var(--pie-toolbar-tools-row-height);}.item-toolbar__controls-row.svelte-rnx3ie {display:flex;align-items:center;justify-content:flex-end;width:100%;min-height:0;height:auto;}.item-toolbar__controls-row--reserve.svelte-rnx3ie {min-height:var(--pie-tts-controls-row-height);height:var(--pie-tts-controls-row-height);}.item-toolbar__controls-row--active.svelte-rnx3ie {min-height:var(--pie-tts-controls-row-height);height:var(--pie-tts-controls-row-height);}.item-toolbar__controls-row--align-start.svelte-rnx3ie {justify-content:flex-start;}.item-toolbar__controls-host.svelte-rnx3ie {display:inline-flex;align-items:center;justify-content:flex-end;width:100%;}.item-toolbar--top.svelte-rnx3ie,
@@ -12515,7 +12756,10 @@ var $$css = {
12515
12756
  .item-toolbar--right.svelte-rnx3ie .item-toolbar__tools-row:where(.svelte-rnx3ie) {flex-direction:column;align-items:center;justify-content:flex-start;flex-wrap:nowrap;}.item-toolbar--left.svelte-rnx3ie .item-toolbar__controls-row:where(.svelte-rnx3ie),
12516
12757
  .item-toolbar--right.svelte-rnx3ie .item-toolbar__controls-row:where(.svelte-rnx3ie) {justify-content:flex-start;width:auto;min-height:0;height:auto;}.item-toolbar__button.svelte-rnx3ie {display:flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0.25rem;border:1px solid var(--pie-button-border, var(--pie-border, #ccc));border-radius:0.25rem;background-color:var(--pie-button-bg, var(--pie-background, white));color:var(--pie-button-color, var(--pie-text, #333));cursor:pointer;transition:all 0.15s ease;text-decoration:none;}.item-toolbar__element-host.svelte-rnx3ie {display:contents;}.item-toolbar--sm.svelte-rnx3ie .item-toolbar__button:where(.svelte-rnx3ie) {width:2.75rem;height:2.75rem;}.item-toolbar--sm.svelte-rnx3ie {--pie-toolbar-tools-row-height: 2.75rem;--pie-tts-controls-row-height: 3.625rem;}.item-toolbar--lg.svelte-rnx3ie .item-toolbar__button:where(.svelte-rnx3ie) {width:2.5rem;height:2.5rem;}.item-toolbar--lg.svelte-rnx3ie {--pie-toolbar-tools-row-height: 2.5rem;--pie-tts-controls-row-height: 3.375rem;}.item-toolbar__button.svelte-rnx3ie:hover:not(:disabled) {background-color:var(--pie-button-hover-bg, var(--pie-secondary-background, #f5f5f5));border-color:var(--pie-button-hover-border, var(--pie-button-border, var(--pie-border, #ccc)));color:var(--pie-button-hover-color, var(--pie-button-color, var(--pie-text, #333)));transform:translateY(-1px);box-shadow:0 2px 4px color-mix(in srgb, var(--pie-black, #000) 10%, transparent);}.item-toolbar__button.svelte-rnx3ie:active:not(:disabled) {transform:translateY(0);box-shadow:none;}.item-toolbar__button--active.svelte-rnx3ie {background-color:var(--pie-primary, #1976d2);color:var(--pie-white, #fff);border-color:var(--pie-primary, #1976d2);}.item-toolbar__button--active.svelte-rnx3ie:hover:not(:disabled) {background-color:var(--pie-primary-dark, #1565c0);}.item-toolbar__button.svelte-rnx3ie:focus-visible {outline:2px solid var(--pie-button-focus-outline, var(--pie-primary, #1976d2));outline-offset:2px;}.item-toolbar__button.svelte-rnx3ie:disabled {opacity:0.5;cursor:not-allowed;}.item-toolbar__button.svelte-rnx3ie svg {width:100%;height:100%;}.item-toolbar__icon-image.svelte-rnx3ie {width:100%;height:100%;object-fit:contain;}
12517
12758
 
12518
- /* Decorative only — the outer link/button owns focus and aria semantics. */.item-toolbar__calculator-icon.svelte-rnx3ie {pointer-events:none;display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;}`
12759
+ /* Decorative only — the outer link/button owns focus and aria semantics. */.item-toolbar__calculator-icon.svelte-rnx3ie {pointer-events:none;display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;}
12760
+
12761
+ /* Defensive: if FA fails to load (shadow injection misses, CSP blocks the
12762
+ stylesheet, etc.), the <i> would otherwise render as italic text. */.item-toolbar__calculator-icon.svelte-rnx3ie > i:where(.svelte-rnx3ie) {font-style:normal;}`
12519
12763
  };
12520
12764
  function ItemToolBar($$anchor, $$props) {
12521
12765
  push2($$props, true);
@@ -12524,7 +12768,6 @@ function ItemToolBar($$anchor, $$props) {
12524
12768
  const FA_PRO_HREFS = ["/_fa-pro/fontawesome.min.css", "/_fa-pro/light.min.css"];
12525
12769
  const FA_FREE_HREF = "https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css";
12526
12770
  const ROBOTO_HREF = "https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap";
12527
- const FA_LIGHT_SHIM_ID = "pie-nds-fa-light-shim";
12528
12771
  let ndsAssetsInstalled = false;
12529
12772
  const ensureNdsAssets = () => {
12530
12773
  if (!isBrowser || ndsAssetsInstalled)
@@ -12550,14 +12793,9 @@ function ItemToolBar($$anchor, $$props) {
12550
12793
  link2.href = href;
12551
12794
  document.head.appendChild(link2);
12552
12795
  }
12553
- if (!document.getElementById(FA_LIGHT_SHIM_ID)) {
12554
- const style = document.createElement("style");
12555
- style.id = FA_LIGHT_SHIM_ID;
12556
- style.textContent = '.fa-light{font-family:"Font Awesome 6 Free";font-weight:900;}';
12557
- document.head.appendChild(style);
12558
- }
12559
12796
  };
12560
12797
  const FA_TOOLBAR_SHADOW_INSTALLED = "__pieFaToolbarShadowInstalled";
12798
+ const FA_HREF_PATTERN = /font.?awesome|fa-?pro/i;
12561
12799
  const installFaInToolbarShadow = (root) => {
12562
12800
  const shadow = root.getRootNode();
12563
12801
  if (!(shadow instanceof ShadowRoot))
@@ -12566,15 +12804,19 @@ function ItemToolBar($$anchor, $$props) {
12566
12804
  if (marker[FA_TOOLBAR_SHADOW_INSTALLED])
12567
12805
  return;
12568
12806
  marker[FA_TOOLBAR_SHADOW_INSTALLED] = true;
12807
+ const seenHrefs = new Set;
12569
12808
  const appendLink = (href) => {
12809
+ if (!href || seenHrefs.has(href))
12810
+ return;
12811
+ seenHrefs.add(href);
12570
12812
  const link2 = document.createElement("link");
12571
12813
  link2.rel = "stylesheet";
12572
12814
  link2.href = href;
12573
12815
  shadow.appendChild(link2);
12574
12816
  };
12575
- appendLink(FA_FREE_HREF);
12576
- for (const href of FA_PRO_HREFS)
12577
- appendLink(href);
12817
+ const documentFaLinks = Array.from(document.querySelectorAll('link[rel="stylesheet"][href]')).filter((link2) => FA_HREF_PATTERN.test(link2.href));
12818
+ for (const link2 of documentFaLinks)
12819
+ appendLink(link2.href);
12578
12820
  const shim = document.createElement("style");
12579
12821
  shim.textContent = '.fa-light{font-family:"Font Awesome 6 Free";font-weight:900;}';
12580
12822
  shadow.appendChild(shim);
@@ -13237,7 +13479,7 @@ function ItemToolBar($$anchor, $$props) {
13237
13479
  height += dh;
13238
13480
  applyPositionAndSize();
13239
13481
  };
13240
- const createShellIconButton = (label, iconName, onActivate) => {
13482
+ const createShellIconButton = (label, iconName, onActivate, faVariant = "fa-regular") => {
13241
13483
  const button = document.createElement("nds-icon-button");
13242
13484
  button.setAttribute("variant", "tertiary");
13243
13485
  button.setAttribute("size", "small");
@@ -13250,6 +13492,25 @@ function ItemToolBar($$anchor, $$props) {
13250
13492
  onActivate();
13251
13493
  bringToFront();
13252
13494
  });
13495
+ if (faVariant !== "fa-light") {
13496
+ const swapVariant = (icon) => {
13497
+ icon.classList.remove("fa-light");
13498
+ icon.classList.add(faVariant);
13499
+ };
13500
+ const existing = button.querySelector("i.fa-light");
13501
+ if (existing) {
13502
+ swapVariant(existing);
13503
+ } else {
13504
+ const observer = new MutationObserver(() => {
13505
+ const target = button.querySelector("i.fa-light");
13506
+ if (target) {
13507
+ swapVariant(target);
13508
+ observer.disconnect();
13509
+ }
13510
+ });
13511
+ observer.observe(button, { childList: true, subtree: true });
13512
+ }
13513
+ }
13253
13514
  return button;
13254
13515
  };
13255
13516
  const createShellControlButton = (label, glyph, onActivate) => {
@@ -13497,10 +13758,10 @@ function ItemToolBar($$anchor, $$props) {
13497
13758
  controlsEl.style.alignItems = "center";
13498
13759
  controlsEl.style.gap = isCalculatorShell ? "6px" : "4px";
13499
13760
  const shellConfig = currentArgs.mounted.entry.shell;
13500
- const appendControl = (label, glyph, iconName, onActivate) => {
13761
+ const appendControl = (label, glyph, iconName, onActivate, faVariant = "fa-regular") => {
13501
13762
  if (!controlsEl)
13502
13763
  return;
13503
- controlsEl.appendChild(isCalculatorShell ? createShellIconButton(label, iconName, onActivate) : createShellControlButton(label, glyph, onActivate));
13764
+ controlsEl.appendChild(isCalculatorShell ? createShellIconButton(label, iconName, onActivate, faVariant) : createShellControlButton(label, glyph, onActivate));
13504
13765
  };
13505
13766
  if (shellConfig?.draggable !== false) {
13506
13767
  appendControl("Move tool left", "←", "chevron-left", () => moveBy(-24, 0));
@@ -13528,15 +13789,8 @@ function ItemToolBar($$anchor, $$props) {
13528
13789
  headerEl.appendChild(controlsEl);
13529
13790
  }
13530
13791
  if (isCalculatorShell) {
13531
- closeButtonEl = document.createElement("nds-icon-button");
13532
- closeButtonEl.setAttribute("variant", "tertiary");
13533
- closeButtonEl.setAttribute("size", "small");
13534
- closeButtonEl.setAttribute("type", "circle");
13535
- closeButtonEl.setAttribute("icon-name", "xmark");
13536
- closeButtonEl.setAttribute("button-aria-label", "Close tool");
13537
- closeButtonEl.title = "Close tool";
13792
+ closeButtonEl = createShellIconButton("Close tool", "xmark", closeShell, "fa-regular");
13538
13793
  closeButtonEl.style.display = currentArgs.mounted.entry.shell.closeable === false ? "none" : "inline-block";
13539
- closeButtonEl.addEventListener("click", closeShell);
13540
13794
  } else {
13541
13795
  const closeButton = document.createElement("button");
13542
13796
  closeButton.type = "button";
@@ -13830,7 +14084,7 @@ function ItemToolBar($$anchor, $$props) {
13830
14084
  var node_1 = first_child2(fragment);
13831
14085
  {
13832
14086
  var consequent_15 = ($$anchor2) => {
13833
- var div = root_2();
14087
+ var div = root_10();
13834
14088
  let classes;
13835
14089
  var div_1 = child2(div);
13836
14090
  var node_2 = child2(div_1);
@@ -13839,7 +14093,7 @@ function ItemToolBar($$anchor, $$props) {
13839
14093
  var node_3 = first_child2(fragment_1);
13840
14094
  {
13841
14095
  var consequent = ($$anchor4) => {
13842
- var span = root_4();
14096
+ var span = root_1();
13843
14097
  action2(span, ($$node, $$action_arg) => mountElementWithShell?.($$node, $$action_arg), () => ({
13844
14098
  mounted: get22(mounted),
13845
14099
  active: get22(renderedToolActiveById)[get22(mounted).toolId] ?? false
@@ -13847,7 +14101,7 @@ function ItemToolBar($$anchor, $$props) {
13847
14101
  append2($$anchor4, span);
13848
14102
  };
13849
14103
  var alternate = ($$anchor4) => {
13850
- var span_1 = root_5();
14104
+ var span_1 = root_1();
13851
14105
  action2(span_1, ($$node, $$action_arg) => mountElement?.($$node, $$action_arg), () => get22(mounted).entry.element);
13852
14106
  append2($$anchor4, span_1);
13853
14107
  };
@@ -13866,7 +14120,7 @@ function ItemToolBar($$anchor, $$props) {
13866
14120
  var node_5 = first_child2(fragment_2);
13867
14121
  {
13868
14122
  var consequent_6 = ($$anchor4) => {
13869
- var a = root_7();
14123
+ var a = root_6();
13870
14124
  let classes_1;
13871
14125
  var node_6 = child2(a);
13872
14126
  {
@@ -13875,19 +14129,19 @@ function ItemToolBar($$anchor, $$props) {
13875
14129
  var node_7 = first_child2(fragment_3);
13876
14130
  {
13877
14131
  var consequent_1 = ($$anchor6) => {
13878
- var span_2 = root_9();
14132
+ var span_2 = root_2();
13879
14133
  action2(span_2, ($$node) => ndsIconButtonAction?.($$node));
13880
14134
  append2($$anchor6, span_2);
13881
14135
  };
13882
14136
  var consequent_2 = ($$anchor6) => {
13883
- var span_3 = root_10();
14137
+ var span_3 = root_3();
13884
14138
  html2(span_3, () => sanitizeSvgIcon(get22(item2).icon), true);
13885
14139
  reset2(span_3);
13886
14140
  append2($$anchor6, span_3);
13887
14141
  };
13888
14142
  var d2 = user_derived2(() => isInlineSvgIcon(get22(item2).icon));
13889
14143
  var consequent_3 = ($$anchor6) => {
13890
- var img = root_11();
14144
+ var img = root_4();
13891
14145
  template_effect2(() => set_attribute22(img, "src", get22(item2).icon));
13892
14146
  append2($$anchor6, img);
13893
14147
  };
@@ -13898,13 +14152,13 @@ function ItemToolBar($$anchor, $$props) {
13898
14152
  var node_8 = first_child2(fragment_4);
13899
14153
  {
13900
14154
  var consequent_4 = ($$anchor7) => {
13901
- var span_4 = root_13();
14155
+ var span_4 = root_3();
13902
14156
  html2(span_4, () => sanitizeSvgIcon(get22(fallbackIcon)), true);
13903
14157
  reset2(span_4);
13904
14158
  append2($$anchor7, span_4);
13905
14159
  };
13906
14160
  var alternate_1 = ($$anchor7) => {
13907
- var i = root_14();
14161
+ var i = root_5();
13908
14162
  template_effect2(() => set_class2(i, 1, `icon icon-${get22(item2).icon}`, "svelte-rnx3ie"));
13909
14163
  append2($$anchor7, i);
13910
14164
  };
@@ -13958,7 +14212,7 @@ function ItemToolBar($$anchor, $$props) {
13958
14212
  };
13959
14213
  var d_2 = user_derived2(() => isToolbarLinkItem(get22(item2)));
13960
14214
  var alternate_5 = ($$anchor4) => {
13961
- var button_1 = root_15();
14215
+ var button_1 = root_7();
13962
14216
  let classes_2;
13963
14217
  var node_9 = child2(button_1);
13964
14218
  {
@@ -13967,19 +14221,19 @@ function ItemToolBar($$anchor, $$props) {
13967
14221
  var node_10 = first_child2(fragment_5);
13968
14222
  {
13969
14223
  var consequent_7 = ($$anchor6) => {
13970
- var span_5 = root_17();
14224
+ var span_5 = root_2();
13971
14225
  action2(span_5, ($$node) => ndsIconButtonAction?.($$node));
13972
14226
  append2($$anchor6, span_5);
13973
14227
  };
13974
14228
  var consequent_8 = ($$anchor6) => {
13975
- var span_6 = root_18();
14229
+ var span_6 = root_3();
13976
14230
  html2(span_6, () => sanitizeSvgIcon(get22(item2).icon), true);
13977
14231
  reset2(span_6);
13978
14232
  append2($$anchor6, span_6);
13979
14233
  };
13980
14234
  var d_3 = user_derived2(() => isInlineSvgIcon(get22(item2).icon));
13981
14235
  var consequent_9 = ($$anchor6) => {
13982
- var img_1 = root_19();
14236
+ var img_1 = root_4();
13983
14237
  template_effect2(() => set_attribute22(img_1, "src", get22(item2).icon));
13984
14238
  append2($$anchor6, img_1);
13985
14239
  };
@@ -13990,13 +14244,13 @@ function ItemToolBar($$anchor, $$props) {
13990
14244
  var node_11 = first_child2(fragment_6);
13991
14245
  {
13992
14246
  var consequent_10 = ($$anchor7) => {
13993
- var span_7 = root_21();
14247
+ var span_7 = root_3();
13994
14248
  html2(span_7, () => sanitizeSvgIcon(get22(fallbackIcon)), true);
13995
14249
  reset2(span_7);
13996
14250
  append2($$anchor7, span_7);
13997
14251
  };
13998
14252
  var alternate_3 = ($$anchor7) => {
13999
- var i_1 = root_22();
14253
+ var i_1 = root_5();
14000
14254
  template_effect2(() => set_class2(i_1, 1, `icon icon-${get22(item2).icon}`, "svelte-rnx3ie"));
14001
14255
  append2($$anchor7, i_1);
14002
14256
  };
@@ -14060,7 +14314,7 @@ function ItemToolBar($$anchor, $$props) {
14060
14314
  var node_13 = first_child2(fragment_7);
14061
14315
  {
14062
14316
  var consequent_12 = ($$anchor4) => {
14063
- var span_8 = root_24();
14317
+ var span_8 = root_1();
14064
14318
  action2(span_8, ($$node, $$action_arg) => mountElementWithShell?.($$node, $$action_arg), () => ({
14065
14319
  mounted: get22(mounted),
14066
14320
  active: get22(renderedToolActiveById)[get22(mounted).toolId] ?? false
@@ -14068,7 +14322,7 @@ function ItemToolBar($$anchor, $$props) {
14068
14322
  append2($$anchor4, span_8);
14069
14323
  };
14070
14324
  var alternate_6 = ($$anchor4) => {
14071
- var span_9 = root_25();
14325
+ var span_9 = root_1();
14072
14326
  action2(span_9, ($$node, $$action_arg) => mountElement?.($$node, $$action_arg), () => get22(mounted).entry.element);
14073
14327
  append2($$anchor4, span_9);
14074
14328
  };
@@ -14085,14 +14339,14 @@ function ItemToolBar($$anchor, $$props) {
14085
14339
  var node_14 = sibling2(div_1, 2);
14086
14340
  {
14087
14341
  var consequent_14 = ($$anchor3) => {
14088
- var div_2 = root_26();
14342
+ var div_2 = root_9();
14089
14343
  let classes_3;
14090
14344
  each2(div_2, 21, () => get22(mountedElementsControlsRow), (mounted) => mounted.key, ($$anchor4, mounted) => {
14091
14345
  var fragment_8 = comment2();
14092
14346
  var node_15 = first_child2(fragment_8);
14093
14347
  {
14094
14348
  var consequent_13 = ($$anchor5) => {
14095
- var span_10 = root_28();
14349
+ var span_10 = root_8();
14096
14350
  action2(span_10, ($$node, $$action_arg) => mountElementWithShell?.($$node, $$action_arg), () => ({
14097
14351
  mounted: get22(mounted),
14098
14352
  active: get22(renderedToolActiveById)[get22(mounted).toolId] ?? false
@@ -14100,7 +14354,7 @@ function ItemToolBar($$anchor, $$props) {
14100
14354
  append2($$anchor5, span_10);
14101
14355
  };
14102
14356
  var alternate_7 = ($$anchor5) => {
14103
- var span_11 = root_29();
14357
+ var span_11 = root_8();
14104
14358
  action2(span_11, ($$node, $$action_arg) => mountElement?.($$node, $$action_arg), () => get22(mounted).entry.element);
14105
14359
  append2($$anchor5, span_11);
14106
14360
  };