@pie-players/pie-assessment-toolkit 0.3.73 → 0.3.75

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 (274) hide show
  1. package/README.md +469 -318
  2. package/dist/attempt/AssessmentSession.d.ts +1 -5
  3. package/dist/attempt/AssessmentSession.js +0 -29
  4. package/dist/attempt/TestSession.d.ts +1 -20
  5. package/dist/attempt/TestSession.js +8 -99
  6. package/dist/components/ItemScope.custom-element.d.ts +1 -0
  7. package/dist/components/ItemScope.custom-element.js +1 -0
  8. package/dist/components/ItemToolBar.custom-element.d.ts +1 -0
  9. package/dist/components/ItemToolBar.custom-element.js +1 -1
  10. package/dist/components/PieAssessmentToolkit.custom-element.d.ts +1 -0
  11. package/dist/components/PieAssessmentToolkit.custom-element.js +13 -13
  12. package/dist/components/SectionToolBar.custom-element.d.ts +1 -0
  13. package/dist/components/SectionToolBar.custom-element.js +1 -1
  14. package/dist/components/chunks/ItemToolBar-7tt7v2xp.js +4 -0
  15. package/dist/components/chunks/ItemToolBar-97hx60z4.js +2 -0
  16. package/dist/components/chunks/ItemToolBar-bxwyhr5p.js +2 -0
  17. package/dist/components/chunks/ItemToolBar-jx38w99s.js +2 -0
  18. package/dist/components/chunks/ItemToolBar-rd2bb4p6.js +40 -0
  19. package/dist/components/chunks/ItemToolBar-vdkyn9f3.js +2 -0
  20. package/dist/components/chunks/sre-engine-jd8cc08x.js +1 -0
  21. package/dist/components/item-scope-element.d.ts +2 -0
  22. package/dist/components/item-scope-element.js +2 -0
  23. package/dist/context/assessment-toolkit-context.d.ts +32 -6
  24. package/dist/index.d.ts +23 -48
  25. package/dist/index.js +12 -37
  26. package/dist/policy/core/PolicySource.d.ts +1 -1
  27. package/dist/policy/core/ToolPolicyEngine.d.ts +85 -34
  28. package/dist/policy/core/ToolPolicyEngine.js +148 -46
  29. package/dist/policy/core/compose-decision.d.ts +28 -7
  30. package/dist/policy/core/compose-decision.js +75 -54
  31. package/dist/policy/core/decision-types.d.ts +65 -34
  32. package/dist/policy/core/feature-decision.d.ts +16 -9
  33. package/dist/policy/core/feature-decision.js +14 -8
  34. package/dist/policy/core/pnp-policy-inputs.d.ts +24 -33
  35. package/dist/policy/core/pnp-policy-inputs.js +28 -56
  36. package/dist/policy/core/provenance.d.ts +9 -4
  37. package/dist/policy/core/provenance.js +1 -1
  38. package/dist/policy/engine.d.ts +7 -23
  39. package/dist/policy/engine.js +5 -20
  40. package/dist/policy/sources/PnpPolicySource.d.ts +44 -61
  41. package/dist/policy/sources/PnpPolicySource.js +117 -118
  42. package/dist/runtime/SectionControllerBinding.d.ts +279 -0
  43. package/dist/runtime/SectionControllerBinding.js +450 -0
  44. package/dist/runtime/SectionRuntimeEngine.d.ts +26 -289
  45. package/dist/runtime/SectionRuntimeEngine.js +30 -372
  46. package/dist/runtime/adapter/SectionEngineAdapter.d.ts +19 -80
  47. package/dist/runtime/adapter/SectionEngineAdapter.js +19 -92
  48. package/dist/runtime/adapter/dom-event-bridge.d.ts +15 -30
  49. package/dist/runtime/adapter/dom-event-bridge.js +17 -44
  50. package/dist/runtime/adapter/subscriber-fanout.d.ts +1 -2
  51. package/dist/runtime/adapter/subscriber-fanout.js +1 -2
  52. package/dist/runtime/catalog-context.d.ts +19 -0
  53. package/dist/runtime/catalog-context.js +28 -0
  54. package/dist/runtime/composition-emit-scheduler.d.ts +9 -15
  55. package/dist/runtime/composition-emit-scheduler.js +9 -15
  56. package/dist/runtime/content-language.d.ts +32 -0
  57. package/dist/runtime/content-language.js +46 -0
  58. package/dist/runtime/content-region.d.ts +17 -0
  59. package/dist/runtime/content-region.js +29 -0
  60. package/dist/runtime/content-registration.d.ts +13 -0
  61. package/dist/runtime/content-registration.js +25 -0
  62. package/dist/runtime/core/SectionEngineCore.d.ts +2 -2
  63. package/dist/runtime/core/SectionEngineCore.js +2 -2
  64. package/dist/runtime/core/cohort.d.ts +1 -1
  65. package/dist/runtime/core/cohort.js +1 -1
  66. package/dist/runtime/core/engine-input.d.ts +18 -30
  67. package/dist/runtime/core/engine-input.js +11 -12
  68. package/dist/runtime/core/engine-output.d.ts +16 -40
  69. package/dist/runtime/core/engine-output.js +9 -21
  70. package/dist/runtime/core/engine-readiness.d.ts +5 -37
  71. package/dist/runtime/core/engine-readiness.js +8 -41
  72. package/dist/runtime/core/engine-resolver.d.ts +46 -74
  73. package/dist/runtime/core/engine-resolver.js +18 -43
  74. package/dist/runtime/core/engine-state.d.ts +28 -36
  75. package/dist/runtime/core/engine-state.js +18 -21
  76. package/dist/runtime/core/engine-transition.d.ts +14 -19
  77. package/dist/runtime/core/engine-transition.js +71 -51
  78. package/dist/runtime/engine.d.ts +16 -19
  79. package/dist/runtime/engine.js +12 -19
  80. package/dist/runtime/page-warnings.d.ts +13 -0
  81. package/dist/runtime/page-warnings.js +22 -0
  82. package/dist/runtime/policy-input-forwarding.d.ts +25 -0
  83. package/dist/runtime/policy-input-forwarding.js +25 -0
  84. package/dist/runtime/registration-events.d.ts +14 -0
  85. package/dist/runtime/runtime-event-claim.d.ts +8 -0
  86. package/dist/runtime/runtime-event-claim.js +15 -0
  87. package/dist/runtime/shell-event-bridge.d.ts +45 -0
  88. package/dist/runtime/shell-event-bridge.js +127 -0
  89. package/dist/runtime/shell-registration.d.ts +73 -0
  90. package/dist/runtime/shell-registration.js +95 -0
  91. package/dist/runtime/shell-scope.d.ts +68 -0
  92. package/dist/runtime/shell-scope.js +188 -0
  93. package/dist/runtime/tool-host-contract.d.ts +28 -10
  94. package/dist/runtime/tool-host-contract.js +31 -10
  95. package/dist/runtime/unclaimed-registration-watch.d.ts +7 -0
  96. package/dist/runtime/unclaimed-registration-watch.js +23 -0
  97. package/dist/services/ElementToolStateStore.d.ts +14 -10
  98. package/dist/services/ElementToolStateStore.js +37 -13
  99. package/dist/services/HighlightCoordinator.d.ts +22 -28
  100. package/dist/services/HighlightCoordinator.js +431 -327
  101. package/dist/services/RangeSerializer.d.ts +10 -1
  102. package/dist/services/RangeSerializer.js +87 -14
  103. package/dist/services/TTSService.d.ts +130 -69
  104. package/dist/services/TTSService.js +713 -570
  105. package/dist/services/ToolCoordinator.d.ts +43 -66
  106. package/dist/services/ToolCoordinator.js +164 -208
  107. package/dist/services/ToolRegistry.d.ts +78 -54
  108. package/dist/services/ToolRegistry.js +107 -105
  109. package/dist/services/ToolkitCoordinator.d.ts +261 -175
  110. package/dist/services/ToolkitCoordinator.js +667 -433
  111. package/dist/services/audio-handoff.d.ts +6 -7
  112. package/dist/services/audio-handoff.js +20 -14
  113. package/dist/services/catalog-owner.d.ts +11 -1
  114. package/dist/services/catalog-owner.js +25 -0
  115. package/dist/services/create-tools-config.d.ts +2 -2
  116. package/dist/services/framework-error-bus.d.ts +3 -6
  117. package/dist/services/framework-error-bus.js +3 -6
  118. package/dist/services/framework-error.d.ts +30 -8
  119. package/dist/services/framework-error.js +9 -7
  120. package/dist/services/interfaces.d.ts +158 -129
  121. package/dist/services/section-controller-types.d.ts +15 -0
  122. package/dist/services/section-session-assignment.d.ts +21 -0
  123. package/dist/services/section-session-assignment.js +82 -0
  124. package/dist/services/spoken-audio-cards.d.ts +0 -2
  125. package/dist/services/spoken-audio-cards.js +1 -3
  126. package/dist/services/tool-config-defaults.d.ts +3 -3
  127. package/dist/services/tool-config-defaults.js +3 -3
  128. package/dist/services/tool-config-validation.d.ts +14 -4
  129. package/dist/services/tool-config-validation.js +63 -71
  130. package/dist/services/tool-context.d.ts +0 -8
  131. package/dist/services/tool-context.js +29 -25
  132. package/dist/services/tool-icons.d.ts +4 -3
  133. package/dist/services/tool-icons.js +4 -3
  134. package/dist/services/tool-instance-id.d.ts +0 -1
  135. package/dist/services/tool-instance-id.js +0 -6
  136. package/dist/services/tool-providers/TTSToolProvider.d.ts +41 -80
  137. package/dist/services/tool-providers/TTSToolProvider.js +81 -40
  138. package/dist/services/tool-providers/ToolProviderApi.d.ts +10 -4
  139. package/dist/services/tool-providers/ToolProviderRegistry.d.ts +32 -28
  140. package/dist/services/tool-providers/ToolProviderRegistry.js +121 -107
  141. package/dist/services/tool-providers/index.d.ts +0 -9
  142. package/dist/services/tool-providers/index.js +2 -4
  143. package/dist/services/tool-request.d.ts +27 -12
  144. package/dist/services/tool-request.js +24 -14
  145. package/dist/services/toolbar-decided-tools.d.ts +15 -0
  146. package/dist/services/toolbar-decided-tools.js +28 -0
  147. package/dist/services/tools-config-normalizer.d.ts +37 -23
  148. package/dist/services/tools-config-normalizer.js +2 -10
  149. package/dist/services/tts/browser-provider.d.ts +38 -2
  150. package/dist/services/tts/browser-provider.js +276 -140
  151. package/dist/services/tts/catalog-span-alignment.d.ts +2 -17
  152. package/dist/services/tts/catalog-span-alignment.js +17 -142
  153. package/dist/services/tts/flat-tree.d.ts +71 -0
  154. package/dist/services/tts/flat-tree.js +269 -0
  155. package/dist/services/tts/generated-speech/assemble-plan.d.ts +3 -1
  156. package/dist/services/tts/generated-speech/assemble-plan.js +3 -1
  157. package/dist/services/tts/generated-speech/dom/build-dom-plan.d.ts +2 -0
  158. package/dist/services/tts/generated-speech/dom/build-dom-plan.js +1 -1
  159. package/dist/services/tts/generated-speech/math-speech-cache.d.ts +3 -1
  160. package/dist/services/tts/generated-speech/math-speech-cache.js +5 -1
  161. package/dist/services/tts/generated-speech/types.d.ts +0 -12
  162. package/dist/services/tts/highlight-pipeline/boundary-normalizer.js +12 -62
  163. package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +38 -5
  164. package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js +3 -6
  165. package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.js +6 -4
  166. package/dist/services/tts/highlight-pipeline/readable-region.js +3 -2
  167. package/dist/services/tts/highlight-pipeline/types.d.ts +5 -0
  168. package/dist/services/tts/highlight-pipeline/visible-map-range.d.ts +12 -0
  169. package/dist/services/tts/highlight-pipeline/visible-map-range.js +73 -7
  170. package/dist/services/tts/math-alignment/index.d.ts +0 -5
  171. package/dist/services/tts/math-alignment/index.js +5 -25
  172. package/dist/services/tts/math-alignment/speech-tokenizer.d.ts +9 -1
  173. package/dist/services/tts/math-alignment/speech-tokenizer.js +38 -36
  174. package/dist/services/tts/math-alignment/types.d.ts +4 -2
  175. package/dist/services/tts/math-aware-text-processing.d.ts +5 -1
  176. package/dist/services/tts/math-aware-text-processing.js +74 -18
  177. package/dist/services/tts/math-control-names.d.ts +21 -0
  178. package/dist/services/tts/math-control-names.js +142 -0
  179. package/dist/services/tts/math-speech.d.ts +16 -1
  180. package/dist/services/tts/math-speech.js +55 -19
  181. package/dist/services/tts/provider-options.d.ts +41 -0
  182. package/dist/services/tts/provider-options.js +1 -0
  183. package/dist/services/tts/sre-engine.d.ts +7 -0
  184. package/dist/services/tts/sre-engine.js +11 -0
  185. package/dist/services/tts/sre-locales.d.ts +14 -0
  186. package/dist/services/tts/sre-locales.js +57 -0
  187. package/dist/services/tts/ssml/spoken-text.d.ts +2 -26
  188. package/dist/services/tts/ssml/spoken-text.js +29 -0
  189. package/dist/services/tts/start-failure.d.ts +11 -0
  190. package/dist/services/tts/start-failure.js +19 -0
  191. package/dist/services/tts/text-processing.d.ts +9 -1
  192. package/dist/services/tts/text-processing.js +46 -34
  193. package/dist/services/tts/text-segmentation.d.ts +7 -0
  194. package/dist/services/tts/text-segmentation.js +47 -0
  195. package/dist/services/tts-runtime-config.d.ts +44 -18
  196. package/dist/services/tts-runtime-config.js +22 -93
  197. package/dist/tools/content-capability-resolution.d.ts +7 -9
  198. package/dist/tools/content-capability-resolution.js +8 -45
  199. package/dist/tools/registration.d.ts +58 -0
  200. package/dist/tools/registration.js +54 -0
  201. package/dist/tools/registrations/toolbar-registration-helpers.js +2 -2
  202. package/dist/tools/tool-surface-host.d.ts +6 -10
  203. package/dist/tools/tool-surface-host.js +44 -42
  204. package/dist/tools/tool-tag-map.d.ts +5 -15
  205. package/dist/tools/tool-tag-map.js +6 -20
  206. package/dist/utils/structural-equality.d.ts +11 -0
  207. package/dist/utils/structural-equality.js +47 -0
  208. package/package.json +24 -59
  209. package/dist/attempt/adapters/activity-to-test-attempt-session.d.ts +0 -49
  210. package/dist/attempt/adapters/activity-to-test-attempt-session.js +0 -138
  211. package/dist/components/chunks/ItemToolBar-byq80z42.js +0 -40
  212. package/dist/components/chunks/ItemToolBar-d36g3aw4.js +0 -49
  213. package/dist/context/runtime-context-consumer.d.ts +0 -13
  214. package/dist/context/runtime-context-consumer.js +0 -51
  215. package/dist/item-loader.d.ts +0 -44
  216. package/dist/item-loader.js +0 -61
  217. package/dist/policy/core/engine-context.d.ts +0 -29
  218. package/dist/policy/core/engine-context.js +0 -27
  219. package/dist/policy/core/policy-source-tag.d.ts +0 -31
  220. package/dist/policy/core/policy-source-tag.js +0 -28
  221. package/dist/policy/internal.d.ts +0 -25
  222. package/dist/policy/internal.js +0 -25
  223. package/dist/runtime/adapter/coordinator-bridge.d.ts +0 -92
  224. package/dist/runtime/adapter/coordinator-bridge.js +0 -126
  225. package/dist/runtime/adapter/framework-error-bridge.d.ts +0 -36
  226. package/dist/runtime/adapter/framework-error-bridge.js +0 -46
  227. package/dist/runtime/adapter/instrumentation-bridge.d.ts +0 -31
  228. package/dist/runtime/adapter/instrumentation-bridge.js +0 -38
  229. package/dist/runtime/core/engine-stage-derivation.d.ts +0 -18
  230. package/dist/runtime/core/engine-stage-derivation.js +0 -29
  231. package/dist/runtime/engine-context.d.ts +0 -39
  232. package/dist/runtime/engine-context.js +0 -31
  233. package/dist/runtime/internal.d.ts +0 -43
  234. package/dist/runtime/internal.js +0 -45
  235. package/dist/runtime/section-runtime-engine-host-context.d.ts +0 -80
  236. package/dist/runtime/section-runtime-engine-host-context.js +0 -95
  237. package/dist/runtime/stage-emit-gate.d.ts +0 -92
  238. package/dist/runtime/stage-emit-gate.js +0 -82
  239. package/dist/services/I18nService.d.ts +0 -47
  240. package/dist/services/I18nService.js +0 -84
  241. package/dist/services/ThemeProvider.d.ts +0 -95
  242. package/dist/services/ThemeProvider.js +0 -334
  243. package/dist/services/ToolConfigResolver.d.ts +0 -161
  244. package/dist/services/ToolConfigResolver.js +0 -229
  245. package/dist/services/catalog-media.d.ts +0 -56
  246. package/dist/services/catalog-media.js +0 -190
  247. package/dist/services/createDefaultToolRegistry.d.ts +0 -53
  248. package/dist/services/createDefaultToolRegistry.js +0 -45
  249. package/dist/services/defaultPersonalNeedsProfile.d.ts +0 -21
  250. package/dist/services/defaultPersonalNeedsProfile.js +0 -26
  251. package/dist/services/pnp-standard-features.d.ts +0 -238
  252. package/dist/services/pnp-standard-features.js +0 -338
  253. package/dist/services/tool-providers/CortexToolProvider.d.ts +0 -13
  254. package/dist/services/tool-providers/CortexToolProvider.js +0 -32
  255. package/dist/services/tool-providers/DesmosToolProvider.d.ts +0 -14
  256. package/dist/services/tool-providers/DesmosToolProvider.js +0 -32
  257. package/dist/services/tool-providers/GeoGebraToolProvider.d.ts +0 -16
  258. package/dist/services/tool-providers/GeoGebraToolProvider.js +0 -32
  259. package/dist/services/tool-providers/LazyCalculatorToolProvider.d.ts +0 -35
  260. package/dist/services/tool-providers/LazyCalculatorToolProvider.js +0 -95
  261. package/dist/services/tts/visual-line-ranges.d.ts +0 -18
  262. package/dist/services/tts/visual-line-ranges.js +0 -226
  263. package/dist/tools/client.d.ts +0 -12
  264. package/dist/tools/client.js +0 -14
  265. package/dist/tools/index.d.ts +0 -8
  266. package/dist/tools/index.js +0 -10
  267. package/dist/tools/internal.d.ts +0 -43
  268. package/dist/tools/internal.js +0 -41
  269. package/dist/tools/response-discovery.d.ts +0 -61
  270. package/dist/tools/response-discovery.js +0 -113
  271. package/dist/tools/types.d.ts +0 -337
  272. package/dist/tools/types.js +0 -12
  273. package/dist/tools/variant-resolver.d.ts +0 -41
  274. package/dist/tools/variant-resolver.js +0 -207
@@ -1,49 +0,0 @@
1
- var c1=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:(Q,W)=>(typeof require<"u"?require:Q)[W]}):J)(function(J){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+J+'" is not supported')});var $4="5";if(typeof window<"u")((window.__svelte??={}).v??=new Set).add($4);var b=2,l0=4,P7=8,A7=16777216,Q0=16,o=32,B0=64,p7=128,OJ=256,W0=512,x=1024,R=2048,_=4096,l=8192,g=16384,H0=32768,U7=33554432,F0=65536,B7=131072,ZQ=262144,c0=524288,q4=1048576,v0=33554432,D0=65536,D7=2097152,I0=4194304,b0=8388608,X0=Symbol("$state"),wJ=Symbol("component"),QJ=Symbol("legacy props"),P4=Symbol(""),CJ=Symbol("proxy path"),SJ=Symbol("attributes"),WJ=Symbol("class"),KQ=Symbol("style"),XJ=Symbol("text"),GQ=Symbol("form reset"),$Q=Symbol("hmr anchor"),W7=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},qQ=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");var d7=3,R0=8;var U4=1,B4=2,PQ=4,H4=8,Y4=16,M4=1,V4=2,L4=4,F4=8,O4=16;var w4=1,C4=2;var _7="[",H7="[!",UQ="[?",I7="]",i0={};var y=Symbol("uninitialized"),O0=Symbol("filename"),S4=Symbol("hmr"),NJ="http://www.w3.org/1999/xhtml",zJ="http://www.w3.org/2000/svg",BQ="http://www.w3.org/1998/Math/MathML";var q=!0;var X7="font-weight: bold",z7="font-weight: normal";function N4(J){if(q)console.warn(`%c[svelte] await_reactivity_loss
2
- %cDetected reactivity loss when reading \`${J}\`. This happens when state is read in an async function after an earlier \`await\`
3
- https://svelte.dev/e/await_reactivity_loss`,X7,z7);else console.warn("https://svelte.dev/e/await_reactivity_loss")}function A4(J,Q){if(q)console.warn(`%c[svelte] await_waterfall
4
- %cAn async derived, \`${J}\` (${Q}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app
5
- https://svelte.dev/e/await_waterfall`,X7,z7);else console.warn("https://svelte.dev/e/await_waterfall")}function D4(){if(q)console.warn(`%c[svelte] derived_inert
6
- %cReading a derived belonging to a now-destroyed effect may result in stale values
7
- https://svelte.dev/e/derived_inert`,X7,z7);else console.warn("https://svelte.dev/e/derived_inert")}function I4(J,Q,W){if(q)console.warn(`%c[svelte] hydration_attribute_changed
8
- %cThe \`${J}\` attribute on \`${Q}\` changed its value between server and client renders. The client value, \`${W}\`, will be ignored in favour of the server value
9
- https://svelte.dev/e/hydration_attribute_changed`,X7,z7);else console.warn("https://svelte.dev/e/hydration_attribute_changed")}function R4(J){if(q)console.warn(`%c[svelte] hydration_html_changed
10
- %c${J?`The value of an \`{@html ...}\` block ${J} changed between server and client renders. The client value will be ignored in favour of the server value`:"The value of an `{@html ...}` block changed between server and client renders. The client value will be ignored in favour of the server value"}
11
- https://svelte.dev/e/hydration_html_changed`,X7,z7);else console.warn("https://svelte.dev/e/hydration_html_changed")}function Y7(J){if(q)console.warn(`%c[svelte] hydration_mismatch
12
- %c${J?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${J}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
13
- https://svelte.dev/e/hydration_mismatch`,X7,z7);else console.warn("https://svelte.dev/e/hydration_mismatch")}function j4(){if(q)console.warn(`%c[svelte] lifecycle_double_unmount
14
- %cTried to unmount a component that was not mounted
15
- https://svelte.dev/e/lifecycle_double_unmount`,X7,z7);else console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function AJ(J){if(q)console.warn(`%c[svelte] state_proxy_equality_mismatch
16
- %cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${J}\` will produce unexpected results
17
- https://svelte.dev/e/state_proxy_equality_mismatch`,X7,z7);else console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function T4(){if(q)console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",X7,z7);else console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var Z7=Array.isArray,x4=Array.prototype.indexOf,M7=Array.prototype.includes,l7=Array.from,ZJ=Object.keys,c=Object.defineProperty,Y0=Object.getOwnPropertyDescriptor,DJ=Object.getOwnPropertyDescriptors,HQ=Object.prototype,k4=Array.prototype,R7=Object.getPrototypeOf,YQ=Object.isExtensible;var o0=()=>{};function IJ(J){for(var Q=0;Q<J.length;Q++)J[Q]()}function RJ(){var J,Q,W=new Promise((X,z)=>{J=X,Q=z});return{promise:W,resolve:J,reject:Q}}var MQ=new WeakMap;function E4(J){var Q=L;if(Q===null)return w.f|=b0,J;if(q&&J instanceof Error&&!MQ.has(J))MQ.set(J,G6(J,Q));if((Q.f&H0)===0&&(Q.f&l0)===0){if(q&&!Q.parent&&J instanceof Error)b4(J);throw J}w0(J,Q)}function w0(J,Q){if(Q!==null&&(Q.f&g)!==0)return;while(Q!==null){if((Q.f&p7)!==0&&(Q.f&(g|U7))===0){if((Q.f&H0)===0)throw J;try{Q.b.error(J);return}catch(W){J=W}}Q=Q.parent}if(q&&J instanceof Error)b4(J);throw J}function G6(J,Q){let W=Y0(J,"message");if(W&&!W.configurable)return;var X=KJ?" ":"\t",z=`
18
- ${X}in ${Q.fn?.name||"<unknown>"}`,Z=Q.ctx;while(Z!==null)z+=`
19
- ${X}in ${Z.function?.[O0].split("/").pop()}`,Z=Z.p;return{message:J.message+`
20
- ${z}
21
- `,stack:J.stack?.split(`
22
- `).filter((K)=>!K.includes("svelte/src/internal")).join(`
23
- `)}}function b4(J){let Q=MQ.get(J);if(Q)c(J,"message",{value:Q.message}),c(J,"stack",{value:Q.stack})}function y4(J){if(q){let Q=Error(`invariant_violation
24
- An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app — please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${J}"
25
- https://svelte.dev/e/invariant_violation`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/invariant_violation")}function g4(){if(q){let J=Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/async_derived_orphan")}function v4(){if(q){let J=Error(`derived_references_self
26
- A derived value cannot reference itself recursively
27
- https://svelte.dev/e/derived_references_self`);throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/derived_references_self")}function VQ(J,Q,W){if(q){let X=Error(`each_key_duplicate
28
- ${W?`Keyed each block has duplicate key \`${W}\` at indexes ${J} and ${Q}`:`Keyed each block has duplicate key at indexes ${J} and ${Q}`}
29
- https://svelte.dev/e/each_key_duplicate`);throw X.name="Svelte error",X}else throw Error("https://svelte.dev/e/each_key_duplicate")}function m4(J,Q,W){if(q){let X=Error(`each_key_volatile
30
- Keyed each block has key that is not idempotent — the key for item at index ${J} was \`${Q}\` but is now \`${W}\`. Keys must be the same each time for a given item
31
- https://svelte.dev/e/each_key_volatile`);throw X.name="Svelte error",X}else throw Error("https://svelte.dev/e/each_key_volatile")}function u4(J){if(q){let Q=Error(`effect_in_teardown
32
- \`${J}\` cannot be used inside an effect cleanup function
33
- https://svelte.dev/e/effect_in_teardown`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/effect_in_teardown")}function f4(){if(q){let J=Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/effect_in_unowned_derived")}function p4(J){if(q){let Q=Error(`effect_orphan
34
- \`${J}\` can only be used inside an effect (e.g. during component initialisation)
35
- https://svelte.dev/e/effect_orphan`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/effect_orphan")}function d4(){if(q){let J=Error(`effect_update_depth_exceeded
36
- Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
37
- https://svelte.dev/e/effect_update_depth_exceeded`);throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/effect_update_depth_exceeded")}function _4(){if(q){let J=Error(`hydration_failed
38
- Failed to hydrate the application
39
- https://svelte.dev/e/hydration_failed`);throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/hydration_failed")}function l4(J){if(q){let Q=Error(`props_invalid_value
40
- Cannot do \`bind:${J}={undefined}\` when \`${J}\` has a fallback value
41
- https://svelte.dev/e/props_invalid_value`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/props_invalid_value")}function c4(J){if(q){let Q=Error(`rune_outside_svelte
42
- The \`${J}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
43
- https://svelte.dev/e/rune_outside_svelte`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/rune_outside_svelte")}function i4(){if(q){let J=Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/state_descriptors_fixed")}function o4(){if(q){let J=Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/state_prototype_fixed")}function s4(){if(q){let J=Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/state_unsafe_mutation")}function a4(){if(q){let J=Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var r=!1,V7=!1,m0=!1;var A=null;function K7(J){A=J}var s0=null;function c7(J){s0=J}var j0=null;function jJ(J){j0=J}function LQ(J,Q=!1,W){if(A={p:A,i:!1,c:null,e:null,s:J,x:null,r:L,l:V7&&!Q?{s:null,u:null,$:[]}:null},q)A.function=W,j0=W}function FQ(J){var Q=A,W=Q.e;if(W!==null){Q.e=null;for(var X of W)OQ(X)}if(J!==void 0)Q.x=J;if(Q.i=!0,A=Q.p,q)j0=A?.function??null;return GJ(J)}function GJ(J={}){return c(J,wJ,{value:!0}),J}function u0(){return!V7||A!==null&&A.l===null}var j7=[];function n4(){var J=j7;j7=[],IJ(J)}function n(J){if(j7.length===0&&!T7){var Q=j7;queueMicrotask(()=>{if(Q===j7)n4()})}j7.push(J)}function t4(){while(j7.length>0)n4()}function TJ(J){return J===this.v}function xJ(J,Q){return J!=J?Q==Q:J!==Q||J!==null&&typeof J==="object"||typeof J==="function"}function kJ(J){return!xJ(J,this.v)}var $J=null;function G0(J,Q){return J.label=Q,bJ(J.v,Q),J}function bJ(J,Q){return J?.[CJ]?.(Q),J}function f0(J){let Q=Error(),W=$6();if(W.length===0)return null;return W.unshift(`
44
- `),c(Q,"stack",{value:W.join(`
45
- `)}),c(Q,"name",{value:J}),Q}function $6(){let J=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let Q=Error().stack;if(Error.stackTraceLimit=J,!Q)return[];let W=Q.split(`
46
- `),X=[];for(let z=0;z<W.length;z++){let Z=W[z],K=Z.replaceAll("\\","/");if(Z.trim()==="Error")continue;if(Z.includes("validate_each_keys"))return[];if(K.includes("svelte/src/internal")||K.includes("node_modules/.vite"))continue;X.push(Z)}return X}function J8(J,Q){if(!q)throw Error("invariant(...) was not guarded by if (DEV)");if(!J)y4(Q)}function a0(J){var Q=w,W=L;u(null),f(null);try{return J()}finally{u(Q),f(W)}}function yJ(J,Q,W,X){let z=u0()?F7:x7;var Z=J.filter((P)=>!P.settled),K=Q.map(z);if(q)K.forEach((P,M)=>{P.label=Q[M].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(O,V)=>V)});if(W.length===0&&Z.length===0){X(K);return}var G=L,$=Q8(),Y=Z.length===1?Z[0].promise:Z.length>1?Promise.all(Z.map((P)=>P.promise)):null;function H(P){if((G.f&g)!==0)return;$();try{X([...K,...P])}catch(M){w0(M,G)}i7()}var B=wQ();if(W.length===0){Y.then(()=>H([])).finally(B);return}function U(){Promise.all(W.map((P)=>SQ(P))).then(H).catch((P)=>w0(P,G)).finally(B)}if(Y)Y.then(()=>{$(),U(),i7()});else U()}function Q8(){var J=L,Q=w,W=A,X=C;if(q)var z=s0;return function(K=!0){if(f(J),u(Q),K7(W),K&&(J.f&g)===0)X?.activate(),X?.apply();if(q)CQ(null),c7(z)}}var P6=!1;function i7(J=!0){if(P6=!1,f(null),u(null),K7(null),J)C?.deactivate();if(q)CQ(null),c7(null)}function wQ(){var J=L,Q=J.b,W=C,X=!!Q?.is_rendered();return Q?.update_pending_count(1,W),W.increment(X,J),()=>{Q?.update_pending_count(-1,W),W.decrement(X,J)}}var B6=~(R|_|x);function T(J,Q){J.f=J.f&B6|Q}function o7(J){if((J.f&W0)!==0||J.deps===null)T(J,x);else T(J,_)}var C0=null;function CQ(J){C0=J}var PJ=new Set;function F7(J){var Q=b|R;if(L!==null)L.f|=c0;let W={ctx:A,deps:null,effects:null,equals:TJ,f:Q,fn:J,reactions:null,rv:0,v:y,wv:0,parent:L,ac:null};if(q&&m0)W.created=f0("created at");return W}var s7=Symbol("obsolete");function SQ(J,Q,W){let X=L;if(X===null)g4();var z=void 0,Z=q0(y);if(q)Z.label=Q??J.toString();var K=!w,G=new Set;if(z8(()=>{var $=L;if(q)C0={effect:$,effect_deps:new Set,warned:!1};var Y=RJ();z=Y.promise;try{Promise.resolve(J()).then(Y.resolve,(P)=>{if(P!==W7)Y.reject(P)}).finally(i7)}catch(P){Y.reject(P),i7()}if(q){if(C0){if($.deps!==null)for(let P=0;P<M0;P+=1)C0.effect_deps.add($.deps[P]);if(t!==null)for(let P=0;P<t.length;P+=1)C0.effect_deps.add(t[P])}C0=null}var H=C;if(K){if(($.f&H0)!==0)var B=wQ();if(X.b?.is_rendered())H.async_deriveds.get($)?.reject(s7);else for(let P of G.values())P.reject(s7);G.add(Y),H.async_deriveds.set($,Y)}let U=(P,M=void 0)=>{if(q)C0=null;if(B?.(),G.delete(Y),M===s7)return;if(H.activate(),M)Z.f|=b0,p0(Z,M);else{if((Z.f&b0)!==0)Z.f^=b0;if(q&&W!==void 0&&!Z.equals(P))PJ.add(Z),setTimeout(()=>{if(PJ.has(Z)&&($.f&g)===0)A4(Z.label,W),PJ.delete(Z)});p0(Z,P)}H.deactivate()};Y.promise.then(U,(P)=>U(null,P||"unknown"))}),$0(()=>{for(let $ of G)$.reject(s7)}),q)Z.f|=I0;return new Promise(($)=>{function Y(H){function B(){if(H===z)$(Z);else Y(z)}H.then(B,B)}Y(z)})}function H6(J){let Q=F7(J);if(!r)vJ(Q);return Q}function x7(J){let Q=F7(J);return Q.equals=kJ,Q}function W8(J){var Q=J.effects;if(Q!==null){J.effects=null;for(var W=0;W<Q.length;W+=1)m(Q[W])}}var NQ=[];function UJ(J){var Q,W=L,X=J.parent;if(!T0&&X!==null&&J.v!==y&&(X.f&(g|l))!==0)return D4(),J.v;if(f(X),q){let z=k7;hJ(new Set);try{if(M7.call(NQ,J))v4();NQ.push(J),J.f&=~D0,W8(J),Q=gJ(J)}finally{f(W),hJ(z),NQ.pop()}}else try{J.f&=~D0,W8(J),Q=gJ(J)}finally{f(W)}return Q}function AQ(J){var Q=UJ(J);if(!J.equals(Q)){if(J.wv=a7(),!C?.is_fork||J.deps===null){if(C!==null)C.capture(J,Q,!0),O7?.capture(J,Q,!0);else J.v=Q;if(J.deps===null){T(J,x);return}}}if(T0)return;if(e!==null){if(L7()||C?.is_fork)e.set(J,Q)}else o7(J)}function X8(J){if(J.effects===null)return;for(let Q of J.effects)if(Q.teardown||Q.ac){if(Q.teardown?.(),Q.ac!==null)a0(()=>{Q.ac.abort(W7),Q.ac=null});if(Q.fn!==null)Q.teardown=o0;E7(Q,0),BJ(Q)}}function DQ(J){if(J.effects===null)return;for(let Q of J.effects)if(Q.teardown&&Q.fn!==null)r0(Q)}var k7=new Set,y0=new Map;function hJ(J){k7=J}var IQ=!1;function Z8(){IQ=!0}function q0(J,Q){var W={f:0,v:J,reactions:null,equals:TJ,rv:0,wv:0};if(q&&m0)W.created=Q??f0("created at"),W.updated=null,W.set_during_effect=!1,W.trace=null;return W}function n0(J,Q){let W=q0(J,Q);return vJ(W),W}function b7(J,Q=!1,W=!0){let X=q0(J);if(!Q)X.equals=kJ;if(V7&&W&&A!==null&&A.l!==null)(A.l.s??=[]).push(X);return X}function P0(J,Q,W=!1){if(w!==null&&(!V0||(w.f&B7)!==0)&&u0()&&(w.f&(b|Q0|I0|B7))!==0&&(d0===null||!d0.has(J)))s4();let X=W?G7(Q):Q;if(q)bJ(X,J.label);return p0(J,X,HJ)}function p0(J,Q,W=null){if(!J.equals(Q)){if(T0)y0.set(J,Q);else if(!y0.has(J))y0.set(J,J.v);var X=K0.ensure();if(X.capture(J,Q),q){if(m0||L!==null){J.updated??=new Map;let z=(J.updated.get("")?.count??0)+1;if(J.updated.set("",{error:null,count:z}),m0||z>5){let Z=f0("updated at");if(Z!==null){let K=J.updated.get(Z.stack);if(!K)K={error:Z,count:0},J.updated.set(Z.stack,K);K.count++}}}if(L!==null)J.set_during_effect=!0}if((J.f&b)!==0){let z=J;if((J.f&R)!==0)UJ(z);if(e===null)o7(z)}if(J.wv=a7(),K8(J,R,W),u0()&&L!==null&&(L.f&x)!==0&&(L.f&(o|B0))===0)if(x0===null)G8([J]);else x0.push(J);if(!X.is_fork&&k7.size>0&&!IQ)mJ()}return Q}function mJ(){IQ=!1;for(let J of k7){if((J.f&x)!==0)T(J,_);let Q;try{Q=w7(J)}catch{Q=!0}if(Q)r0(J)}k7.clear()}function y7(J){P0(J,J.v+1)}function K8(J,Q,W){var X=J.reactions;if(X===null)return;var z=u0(),Z=X.length;for(var K=0;K<Z;K++){var G=X[K],$=G.f;if(!z&&G===L)continue;var Y=($&R)===0;if(Y)T(G,Q);if(($&B7)!==0)k7.add(G);else if(($&b)!==0){var H=G;if(e?.delete(H),($&D0)===0){if($&W0&&(L===null||(L.f&D7)===0))G.f|=D0;K8(H,_,W)}}else if(Y){var B=G;if(($&Q0)!==0&&h0!==null)h0.add(B);if(W!==null)W.push(B);else YJ(B)}}}function $8(J){if(J===null)return;for(let Q of J){if((Q.f&b)===0||(Q.f&D0)===0)continue;Q.f^=D0,$8(Q.deps)}}function uJ(J,Q,W){if((J.f&R)!==0)Q.add(J);else if((J.f&_)!==0)W.add(J);$8(J.deps),T(J,x)}var q8=!1,fJ=!1,PW=Symbol("unmounted");function RQ(J){var Q=fJ;try{return fJ=!1,[J(),fJ]}finally{fJ=Q}}var pJ=null,r7=null,C=null,O7=null,e=null,xQ=null,T7=!1,jQ=!1,h7=null,HJ=null,P8=0,TQ=new Set,V6=1;class K0{id=V6++;#J=!1;linked=!0;#Q=null;#W=null;async_deriveds=new Map;current=new Map;previous=new Map;#G=new Set;#Z=new Set;#K=0;#X=new Map;#$=null;#z=[];#M=[];#P=new Set;#U=new Set;#B=new Map;#V=new Set;is_fork=!1;#q=!1;constructor(){if(r7===null)pJ=r7=this;else r7.#W=this,this.#Q=r7;r7=this}#O(){if(this.is_fork)return!0;for(let W of this.#X.keys()){var J=W,Q=!1;while(J.parent!==null){if(this.#B.has(J)){Q=!0;break}J=J.parent}if(!Q)return!0}return!1}skip_effect(J){if(!this.#B.has(J))this.#B.set(J,{d:[],m:[]});this.#V.delete(J)}unskip_effect(J,Q=(W)=>this.schedule(W)){var W=this.#B.get(J);if(W){this.#B.delete(J);for(var X of W.d)T(X,R),Q(X);for(X of W.m)T(X,_),Q(X)}this.#V.add(J)}#L(){if(this.#J=!0,P8++>1000)this.#Y(),L6();if(q)for(let G of this.current.keys())TQ.add(G);for(let G of this.#P)this.#U.delete(G),T(G,R),this.schedule(G);for(let G of this.#U)T(G,_),this.schedule(G);let J=this.#z;this.#z=[],this.apply();var Q=h7=[],W=[],X=HJ=[];for(let G of J)try{this.#w(G,Q,W)}catch($){if(Y8(G),!this.#O())this.discard();throw $}if(C=null,X.length>0){var z=K0.ensure();for(let G of X)z.schedule(G)}if(h7=null,HJ=null,this.#O()){this.#H(W),this.#H(Q);for(let[G,$]of this.#B)H8(G,$);if(X.length>0)C.#L();return}let Z=this.#C();if(Z){this.#H(W),this.#H(Q),Z.#S(this);return}this.#P.clear(),this.#U.clear();for(let G of this.#G)G(this);this.#G.clear(),O7=this,U8(W),U8(Q),O7=null,this.#$?.resolve();var K=C;if(this.#K===0&&(this.#z.length===0||K!==null)){if(this.#Y(),r)this.#F(),C=K}if(this.#z.length>0)if(K!==null){let G=K;G.#z.push(...this.#z.filter(($)=>!G.#z.includes($)))}else K=this;if(K!==null)y0.clear(),K.#L()}#w(J,Q,W){J.f^=x;var X=J.first;while(X!==null){var z=X.f,Z=(z&(o|B0))!==0,K=Z&&(z&x)!==0,G=K||(z&l)!==0||this.#B.has(X);if(!G&&X.fn!==null){if(Z)X.f^=x;else if((z&l0)!==0)Q.push(X);else if(r&&(z&(P7|A7))!==0)W.push(X);else if(w7(X)){if((z&Q0)!==0)this.#U.add(X);r0(X)}var $=X.first;if($!==null){X=$;continue}}while(X!==null){var Y=X.next;if(Y!==null){X=Y;break}X=X.parent}}}#C(){var J=this.#Q;while(J!==null){if(!J.is_fork){for(let[Q,[,W]]of this.current)if(J.current.has(Q)&&!W)return J}J=J.#Q}return null}#S(J){for(let[W,X]of J.current){if(!this.previous.has(W)&&J.previous.has(W))this.previous.set(W,J.previous.get(W));this.current.set(W,X)}for(let[W,X]of J.async_deriveds){let z=this.async_deriveds.get(W);if(z)X.promise.then(z.resolve).catch(z.reject)}J.async_deriveds.clear(),this.transfer_effects(J.#P,J.#U);let Q=(W)=>{var X=W.reactions;if(X===null)return;if((W.f&b)!==0&&(W.f&(R|_))===0)return;for(let K of X){var z=K.f;if((z&b)!==0)Q(K);else{var Z=K;if(z&(I0|Q0)&&!this.async_deriveds.has(Z))this.#U.delete(Z),T(Z,R),this.schedule(Z)}}};for(let W of this.current.keys())Q(W);this.oncommit(()=>J.discard()),J.#Y(),C=this,this.#L()}#H(J){for(var Q=0;Q<J.length;Q+=1)uJ(J[Q],this.#P,this.#U)}capture(J,Q,W=!1){if(J.v!==y&&!this.previous.has(J))this.previous.set(J,J.v);if((J.f&b0)===0)this.current.set(J,[Q,W]),e?.set(J,Q);if(!this.is_fork)J.v=Q}activate(){C=this}deactivate(){C=null,e=null}flush(){try{if(q)TQ.clear();jQ=!0,C=this,this.#L()}finally{if(P8=0,xQ=null,h7=null,HJ=null,jQ=!1,C=null,e=null,y0.clear(),q)for(let J of TQ)J.updated=null}}discard(){for(let J of this.#Z)J(this);this.#Z.clear();for(let J of this.async_deriveds.values())J.reject(s7);this.#Y(),this.#$?.resolve()}register_created_effect(J){this.#M.push(J)}#F(){for(let H=pJ;H!==null;H=H.#W){var J=H.id<this.id,Q=[];for(let[B,[U,P]]of this.current){if(H.current.has(B)){var W=H.current.get(B)[0];if(J&&U!==W)H.current.set(B,[U,P]);else continue}Q.push(B)}if(J)for(let[B,U]of this.async_deriveds){let P=H.async_deriveds.get(B);if(P)U.promise.then(P.resolve).catch(P.reject)}var X=[...H.current.keys()].filter((B)=>!H.current.get(B)[1]);if(!H.#J||X.length===0)continue;var z=X.filter((B)=>!this.current.has(B));if(z.length===0){if(J)H.discard()}else if(Q.length>0){if(q&&!H.#q)J8(H.#z.length===0,"Batch has scheduled roots");if(J)for(let B of this.#V)H.unskip_effect(B,(U)=>{if((U.f&(Q0|I0))!==0)H.schedule(U);else H.#H([U])});H.activate();var Z=new Set,K=new Map;for(var G of Q)B8(G,z,Z,K);K=new Map;var $=[...H.current].filter(([B,U])=>{let P=this.current.get(B);if(!P)return!0;return P[0]!==U[0]||P[1]!==U[1]}).map(([B])=>B);if($.length>0){for(let B of this.#M)if((B.f&(g|l|B7))===0&&kQ(B,$,K))if((B.f&(I0|Q0))!==0)T(B,R),H.schedule(B);else H.#P.add(B)}if(H.#z.length>0&&!H.#q){H.apply();for(var Y of H.#z)H.#w(Y,[],[]);H.#z=[]}H.deactivate()}}}increment(J,Q){if(this.#K+=1,J){let W=this.#X.get(Q)??0;this.#X.set(Q,W+1)}}decrement(J,Q){if(this.#K-=1,J){let W=this.#X.get(Q)??0;if(W===1)this.#X.delete(Q);else this.#X.set(Q,W-1)}if(this.#q)return;this.#q=!0,n(()=>{if(this.#q=!1,this.linked)this.flush()})}transfer_effects(J,Q){for(let W of J)this.#P.add(W);for(let W of Q)this.#U.add(W);J.clear(),Q.clear()}oncommit(J){this.#G.add(J)}ondiscard(J){this.#Z.add(J)}settled(){return(this.#$??=RJ()).promise}static ensure(){if(C===null){let J=C=new K0;if(!jQ&&!T7)n(()=>{if(!J.#J)J.flush()})}return C}apply(){if(!r||!this.is_fork&&this.#Q===null&&this.#W===null){e=null;return}e=new Map;for(let[Q,[W]]of this.current)e.set(Q,W);for(let Q=pJ;Q!==null;Q=Q.#W){if(Q===this||Q.is_fork)continue;var J=!1;if(Q.id<this.id)for(let[W,[,X]]of Q.current){if(X)continue;if(this.current.has(W)){J=!0;break}}if(!J){for(let[W,X]of Q.previous)if(!e.has(W))e.set(W,X)}}}schedule(J){if(xQ=J,J.b?.is_pending&&(J.f&(l0|P7|A7))!==0&&(J.f&H0)===0){J.b.defer_effect(J);return}var Q=J;while(Q.parent!==null){Q=Q.parent;var W=Q.f;if(h7!==null&&Q===L){if(r)return;if((w===null||(w.f&b)===0)&&!q8)return}if((W&(B0|o))!==0){if((W&x)===0)return;Q.f^=x}}this.#z.push(Q)}#Y(){if(!this.linked)return;var J=this.#Q,Q=this.#W;if(J===null)pJ=Q;else J.#W=Q;if(Q===null)r7=J;else Q.#Q=J;this.linked=!1}}function n7(J){var Q=T7;T7=!0;try{var W;if(J){if(C!==null&&!C.is_fork)C.flush();W=J()}while(!0){if(t4(),C===null)return W;C.flush()}}finally{T7=Q}}function L6(){if(q){var J=new Map;for(let W of C.current.keys())for(let[X,z]of W.updated??[]){var Q=J.get(X);if(!Q)Q={error:z.error,count:0},J.set(X,Q);Q.count+=z.count}for(let W of J.values())if(W.error)console.error(W.error)}try{d4()}catch(W){if(q)c(W,"stack",{value:""});w0(W,xQ)}}var h0=null;function U8(J){var Q=J.length;if(Q===0)return;var W=0;while(W<Q){var X=J[W++];if((X.f&(g|l))===0&&w7(X)){if(h0=new Set,r0(X),X.deps===null&&X.first===null&&X.nodes===null&&X.teardown===null&&X.ac===null)EQ(X);if(h0?.size>0){y0.clear();for(let z of h0){if((z.f&(g|l))!==0)continue;let Z=[z],K=z.parent;while(K!==null){if(h0.has(K))h0.delete(K),Z.push(K);K=K.parent}for(let G=Z.length-1;G>=0;G--){let $=Z[G];if(($.f&(g|l))!==0)continue;r0($)}}h0.clear()}}}h0=null}function B8(J,Q,W,X){if(W.has(J))return;if(W.add(J),J.reactions!==null)for(let z of J.reactions){let Z=z.f;if((Z&b)!==0)B8(z,Q,W,X);else if((Z&(I0|Q0))!==0&&(Z&R)===0&&kQ(z,Q,X))T(z,R),YJ(z)}}function kQ(J,Q,W){let X=W.get(J);if(X!==void 0)return X;if(J.deps!==null)for(let z of J.deps){if(M7.call(Q,z))return!0;if((z.f&b)!==0&&kQ(z,Q,W))return W.set(z,!0),!0}return W.set(J,!1),!1}function YJ(J){C.schedule(J)}function H8(J,Q){if((J.f&o)!==0&&(J.f&x)!==0)return;if((J.f&R)!==0)Q.d.push(J);else if((J.f&_)!==0)Q.m.push(J);T(J,x);var W=J.first;while(W!==null)H8(W,Q),W=W.next}function Y8(J){T(J,x);var Q=J.first;while(Q!==null)Y8(Q),Q=Q.next}function V8(J){if(L===null){if(w===null)p4(J);f4()}if(T0)u4(J)}function O6(J,Q){var W=Q.last;if(W===null)Q.last=Q.first=J;else W.next=J,J.prev=W,Q.last=J}function t0(J,Q){var W=L;if(q)while(W!==null&&(W.f&B7)!==0)W=W.parent;if(W!==null&&(W.f&l)!==0)J|=l;var X={ctx:A,deps:null,nodes:null,f:J|R|W0,first:null,fn:Q,last:null,next:null,parent:W,b:W&&W.b,prev:null,teardown:null,wv:0,ac:null};if(q)X.component_function=j0;C?.register_created_effect(X);var z=X;if((J&l0)!==0)if(h7!==null)h7.push(X);else K0.ensure().schedule(X);else if(Q!==null){try{r0(X)}catch(K){throw m(X),K}if(z.deps===null&&z.teardown===null&&z.nodes===null&&z.first===z.last&&(z.f&c0)===0){if(z=z.first,(J&Q0)!==0&&(J&F0)!==0&&z!==null)z.f|=F0}}if(z!==null){if(z.parent=W,W!==null)O6(z,W);if(w!==null&&(w.f&b)!==0&&(J&B0)===0){var Z=w;(Z.effects??=[]).push(z)}}return X}function L7(){return w!==null&&!V0}function $0(J){let Q=t0(P7,null);return T(Q,x),Q.teardown=J,Q}function yQ(J){if(V8("$effect"),q)c(J,"name",{value:"$effect"});var Q=L.f,W=!w&&(Q&o)!==0&&A!==null&&!A.i;if(W){var X=A;(X.e??=[]).push(J)}else return OQ(J)}function OQ(J){return t0(l0|q4,J)}function hQ(J){K0.ensure();let Q=t0(B0|c0,J);return()=>{m(Q)}}function L8(J){K0.ensure();let Q=t0(B0|c0,J);return(W={})=>{return new Promise((X)=>{if(W.outro)e0(Q,()=>{m(Q),X(void 0)});else m(Q),X(void 0)})}}function L0(J){return t0(l0,J)}function z8(J){return t0(I0|c0,J)}function J0(J,Q=0){return t0(P7|Q,J)}function gQ(J,Q=[],W=[],X=[]){yJ(X,Q,W,(z)=>{t0(P7,()=>{J(...z.map(I))})})}function S0(J,Q=0){var W=t0(Q0|Q,J);if(q)W.dev_stack=s0;return W}function a(J){return t0(o|c0,J)}function vQ(J){var Q=J.teardown;if(Q!==null){let W=T0,X=w;bQ(!0),u(null);try{Q.call(null)}catch(z){w0(z,J.parent)}finally{bQ(W),u(X)}}}function BJ(J,Q=!1){var W=J.first;J.first=J.last=null;while(W!==null){let z=W.ac;if(z!==null)a0(()=>{z.abort(W7)});var X=W.next;if((W.f&B0)!==0)W.parent=null;else m(W,Q);W=X}}function F8(J){var Q=J.first;while(Q!==null){var W=Q.next;if((Q.f&o)===0)m(Q);Q=W}}function m(J,Q=!0){var W=!1;if((Q||(J.f&ZQ)!==0)&&J.nodes!==null&&J.nodes.end!==null)mQ(J.nodes.start,J.nodes.end),W=!0;J.f|=U7,BJ(J,Q&&!W),E7(J,0);var X=J.nodes&&J.nodes.t;if(X!==null)for(let Z of X)Z.stop();vQ(J),J.f^=U7,J.f|=g;var z=J.parent;if(z!==null&&z.first!==null)EQ(J);if(q)J.component_function=null;J.next=J.prev=J.teardown=J.ctx=J.deps=J.fn=J.nodes=J.ac=J.b=null}function mQ(J,Q){while(J!==null){var W=J===Q?null:s(J);J.remove(),J=W}}function EQ(J){var{parent:Q,prev:W,next:X}=J;if(W!==null)W.next=X;if(X!==null)X.prev=W;if(Q!==null){if(Q.first===J)Q.first=X;if(Q.last===J)Q.last=W}}function e0(J,Q,W=!0){var X=[];J.f|=OJ,O8(J,X,!0);var z=()=>{if(W)m(J);if(Q)Q()},Z=X.length;if(Z>0){var K=()=>--Z||z();for(var G of X)G.out(K)}else z()}function O8(J,Q,W){if((J.f&l)!==0)return;J.f^=l;var X=J.nodes&&J.nodes.t;if(X!==null){for(let G of X)if(G.is_global||W)Q.push(G)}var z=J.first;while(z!==null){var Z=z.next;if((z.f&B0)===0){var K=(z.f&F0)!==0||(z.f&o)!==0&&(J.f&Q0)!==0;O8(z,Q,K?W:!1)}z=Z}}function t7(J){J.f&=~OJ,w8(J,!0)}function w8(J,Q){if((J.f&OJ)!==0)return;if((J.f&l)===0)return;if(J.f^=l,(J.f&x)===0)T(J,R),K0.ensure().schedule(J);var W=J.first;while(W!==null){var X=W.next,z=(W.f&F0)!==0||(W.f&o)!==0;w8(W,z?Q:!1),W=X}var Z=J.nodes&&J.nodes.t;if(Z!==null){for(let K of Z)if(K.is_global||Q)K.in()}}function e7(J,Q){if(!J.nodes)return;var W=J.nodes.start,X=J.nodes.end;while(W!==null){var z=W===X?null:s(W);Q.append(W),W=z}}var C8=null;var dJ=!1,T0=!1;function bQ(J){T0=J}var w=null,V0=!1;function u(J){w=J}var L=null;function f(J){L=J}var d0=null;function vJ(J){if(w!==null&&(!r||(w.f&b)!==0))(d0??=new Set).add(J)}var t=null,M0=0,x0=null;function G8(J){x0=J}var N8=1,g7=0,C7=g7;function uQ(J){C7=J}function a7(){return++N8}function w7(J){var Q=J.f;if((Q&R)!==0)return!0;if(Q&b)J.f&=~D0;if((Q&_)!==0){var W=J.deps,X=W.length;for(var z=0;z<X;z++){var Z=W[z];if(w7(Z))AQ(Z);if(Z.wv>J.wv)return!0}if((Q&W0)!==0&&e===null)T(J,x)}return!1}function A8(J,Q,W=!0){var X=J.reactions;if(X===null)return;if(!r&&d0!==null&&d0.has(J))return;for(var z=0;z<X.length;z++){var Z=X[z];if((Z.f&b)!==0)A8(Z,Q,!1);else if(Q===Z){if(W)T(Z,R);else if((Z.f&x)!==0)T(Z,_);YJ(Z)}}}function gJ(J){var Q=t,W=M0,X=x0,z=w,Z=d0,K=A,G=V0,$=C7,Y=J.f;if(t=null,M0=0,x0=null,w=(Y&(o|B0))===0?J:null,d0=null,K7(J.ctx),V0=!1,C7=++g7,J.ac!==null)a0(()=>{J.ac.abort(W7)}),J.ac=null;try{J.f|=D7;var H=J.fn,B=H();J.f|=H0;var U=S8(J);if(u0()&&x0!==null&&!V0&&U!==null&&(J.f&(b|_|R))===0)for(var P=0;P<x0.length;P++)A8(x0[P],J);if(z!==null&&z!==J){if(g7++,z.deps!==null)for(let M=0;M<W;M+=1)z.deps[M].rv=g7;if(Q!==null)for(let M of Q)M.rv=g7;if(x0!==null)if(X===null)X=x0;else X.push(...x0)}if((J.f&b0)!==0)J.f^=b0;return B}catch(M){return S8(J),E4(M)}finally{J.f^=D7,t=Q,M0=W,x0=X,w=z,d0=Z,K7(K),V0=G,C7=$}}function S8(J){var Q=J.deps,W=C?.is_fork;if(t!==null){var X;if(!W)E7(J,M0);if(Q!==null&&M0>0){Q.length=M0+t.length;for(X=0;X<t.length;X++)Q[M0+X]=t[X]}else J.deps=Q=t;if(L7()&&(J.f&W0)!==0)for(X=M0;X<Q.length;X++)(Q[X].reactions??=[]).push(J)}else if(!W&&Q!==null&&M0<Q.length)E7(J,M0),Q.length=M0;return Q}function w6(J,Q){let W=Q.reactions;if(W!==null){var X=x4.call(W,J);if(X!==-1){var z=W.length-1;if(z===0)W=Q.reactions=null;else W[X]=W[z],W.pop()}}if(W===null&&(Q.f&b)!==0&&(t===null||!M7.call(t,Q))){var Z=Q;if((Z.f&W0)!==0)Z.f^=W0,Z.f&=~D0;if(Z.v!==y)o7(Z);if(Z.ac!==null)a0(()=>{Z.ac.abort(W7),Z.ac=null,T(Z,R)});X8(Z),E7(Z,0)}}function E7(J,Q){var W=J.deps;if(W===null)return;for(var X=Q;X<W.length;X++)w6(J,W[X])}function r0(J){var Q=J.f;if((Q&g)!==0)return;T(J,x);var W=L,X=dJ;if(L=J,dJ=(Q&(o|B0))===0,q){var z=j0;jJ(J.component_function);var Z=s0;c7(J.dev_stack??s0)}try{if((Q&(Q0|A7))!==0)F8(J);else BJ(J);vQ(J);var K=gJ(J);if(J.teardown=typeof K==="function"?K:null,J.wv=N8,q&&m0&&(J.f&R)!==0&&J.deps!==null){for(var G of J.deps)if(G.set_during_effect)G.wv=a7(),G.set_during_effect=!1}}finally{if(dJ=X,L=W,q)jJ(z),c7(Z)}}function I(J){var Q=J.f,W=(Q&b)!==0;if(C8?.add(J),w!==null&&!V0){var X=L!==null&&(L.f&g)!==0;if(!X&&(d0===null||!d0.has(J))){var z=w.deps;if((w.f&D7)!==0){if(J.rv<g7)if(J.rv=g7,t===null&&z!==null&&z[M0]===J)M0++;else if(t===null)t=[J];else t.push(J)}else{if(w.deps??=[],!M7.call(w.deps,J))w.deps.push(J);var Z=J.reactions;if(Z===null)J.reactions=[w];else if(!M7.call(Z,w))Z.push(w)}}}if(q){if(!V0&&C0&&C===null&&O7===null&&!C0.warned&&(C0.effect.f&D7)===0&&!C0.effect_deps.has(J)){C0.warned=!0,N4(J.label);var K=f0("traced at");if(K)console.warn(K)}if(PJ.delete(J),m0&&!V0&&$J!==null&&w!==null&&$J.reaction===w){if(J.trace)J.trace();else if(K=f0("traced at"),K){var G=$J.entries.get(J);if(G===void 0)G={traces:[]},$J.entries.set(J,G);var $=G.traces[G.traces.length-1];if(K.stack!==$?.stack)G.traces.push(K)}}}if(T0&&y0.has(J))return y0.get(J);if(W){var Y=J;if(T0){var H=Y.v;if((Y.f&x)===0&&Y.reactions!==null||I8(Y))H=UJ(Y);return y0.set(Y,H),H}var B=(Y.f&W0)===0&&!V0&&w!==null&&(dJ||(w.f&W0)!==0),U=(Y.f&H0)===0;if(w7(Y)){if(B)Y.f|=W0;AQ(Y)}if(B&&!U)DQ(Y),D8(Y)}if(e?.has(J))return e.get(J);if((J.f&b0)!==0)throw J.v;return J.v}function D8(J){if(J.f|=W0,J.deps===null)return;for(let Q of J.deps)if((Q.reactions??=[]).push(J),(Q.f&b)!==0&&(Q.f&W0)===0)DQ(Q),D8(Q)}function I8(J){if(J.v===y)return!0;if(J.deps===null)return!1;for(let Q of J.deps){if(y0.has(Q))return!0;if((Q.f&b)!==0&&I8(Q))return!0}return!1}function h(J){var Q=V0;try{return V0=!0,J()}finally{V0=Q}}function lJ(J){if(typeof J!=="object"||!J||J instanceof EventTarget)return;if(X0 in J)_J(J);else if(!Array.isArray(J))for(let Q in J){let W=J[Q];if(typeof W==="object"&&W&&X0 in W)_J(W)}}function _J(J,Q=new Set){if(typeof J==="object"&&J!==null&&!(J instanceof EventTarget)&&!Q.has(J)){if(Q.add(J),J instanceof Date)J.getTime();for(let X in J)try{_J(J[X],Q)}catch(z){}let W=R7(J);if(W!==Object.prototype&&W!==Array.prototype&&W!==Map.prototype&&W!==Set.prototype&&W!==Date.prototype){let X=DJ(W);for(let z in X){let Z=X[z].get;if(Z)try{Z.call(J)}catch(K){}}}}}var C6=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function G7(J){if(typeof J!=="object"||J===null||X0 in J||wJ in J)return J;let Q=R7(J);if(Q!==HQ&&Q!==k4)return J;var W=new Map,X=Z7(J),z=n0(0),Z=q&&m0?f0("created at"):null,K=C7,G=(B)=>{if(C7===K)return B();var U=w,P=C7;u(null),uQ(K);var M=B();return u(U),uQ(P),M};if(X){if(W.set("length",n0(J.length,Z)),q)J=N6(J)}var $="";let Y=!1;function H(B){if(Y)return;Y=!0,$=B,G0(z,`${$} version`);for(let[U,P]of W)G0(P,v7($,U));Y=!1}return new Proxy(J,{defineProperty(B,U,P){if(!("value"in P)||P.configurable===!1||P.enumerable===!1||P.writable===!1)i4();var M=W.get(U);if(M===void 0)G(()=>{var O=n0(P.value,Z);if(W.set(U,O),q&&typeof U==="string")G0(O,v7($,U));return O});else P0(M,P.value,!0);return!0},deleteProperty(B,U){var P=W.get(U);if(P===void 0){if(U in B){let M=G(()=>n0(y,Z));if(W.set(U,M),y7(z),q)G0(M,v7($,U))}}else P0(P,y),y7(z);return!0},get(B,U,P){if(U===X0)return J;if(q&&U===CJ)return H;var M=W.get(U),O=U in B;if(M===void 0&&(!O||Y0(B,U)?.writable))M=G(()=>{var N=G7(O?B[U]:y),k=n0(N,Z);if(q)G0(k,v7($,U));return k}),W.set(U,M);if(M!==void 0){var V=I(M);return V===y?void 0:V}return Reflect.get(B,U,P)},getOwnPropertyDescriptor(B,U){var P=Reflect.getOwnPropertyDescriptor(B,U);if(P&&"value"in P){var M=W.get(U);if(M)P.value=I(M)}else if(P===void 0){var O=W.get(U),V=O?.v;if(O!==void 0&&V!==y)return{enumerable:!0,configurable:!0,value:V,writable:!0}}return P},has(B,U){if(U===X0)return!0;var P=W.get(U),M=P!==void 0&&P.v!==y||Reflect.has(B,U);if(P!==void 0||L!==null&&(!M||Y0(B,U)?.writable)){if(P===void 0)P=G(()=>{var V=M?G7(B[U]):y,N=n0(V,Z);if(q)G0(N,v7($,U));return N}),W.set(U,P);var O=I(P);if(O===y)return!1}return M},set(B,U,P,M){var O=W.get(U),V=U in B;if(X&&U==="length")for(var N=P;N<O.v;N+=1){var k=W.get(N+"");if(k!==void 0)P0(k,y);else if(N in B){if(k=G(()=>n0(y,Z)),W.set(N+"",k),q)G0(k,v7($,N))}}if(O===void 0){if(!V||Y0(B,U)?.writable){if(O=G(()=>n0(void 0,Z)),q)G0(O,v7($,U));P0(O,G7(P)),W.set(U,O)}}else{V=O.v!==y;var E=G(()=>G7(P));P0(O,E)}var D=Reflect.getOwnPropertyDescriptor(B,U);if(D?.set)D.set.call(M,P);if(!V){if(X&&typeof U==="string"){var E0=W.get("length"),U0=Number(U);if(Number.isInteger(U0)&&U0>=E0.v)P0(E0,U0+1)}y7(z)}return!0},ownKeys(B){I(z);var U=Reflect.ownKeys(B).filter((O)=>{var V=W.get(O);return V===void 0||V.v!==y});for(var[P,M]of W)if(M.v!==y&&!(P in B))U.push(P);return U},setPrototypeOf(){o4()}})}function v7(J,Q){if(typeof Q==="symbol")return`${J}[Symbol(${Q.description??""})]`;if(C6.test(Q))return`${J}.${Q}`;return/^\d+$/.test(Q)?`${J}[${Q}]`:`${J}['${Q}']`}function cJ(J){try{if(J!==null&&typeof J==="object"&&X0 in J)return J[X0]}catch{}return J}var S6=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function N6(J){return new Proxy(J,{get(Q,W,X){var z=Reflect.get(Q,W,X);if(!S6.has(W))return z;return function(...Z){Z8();var K=z.apply(this,Z);return mJ(),K}}})}function R8(){let{prototype:J,__svelte_cleanup:Q}=Array;if(Q)Q();let{indexOf:W,lastIndexOf:X,includes:z}=J;J.indexOf=function(Z,K){let G=W.call(this,Z,K);if(G===-1){for(let $=K??0;$<this.length;$+=1)if(cJ(this[$])===Z){AJ("array.indexOf(...)");break}}return G},J.lastIndexOf=function(Z,K){let G=X.call(this,Z,K??this.length-1);if(G===-1){for(let $=0;$<=(K??this.length-1);$+=1)if(cJ(this[$])===Z){AJ("array.lastIndexOf(...)");break}}return G},J.includes=function(Z,K){let G=z.call(this,Z,K);if(!G){for(let $=0;$<this.length;$+=1)if(cJ(this[$])===Z){AJ("array.includes(...)");break}}return G},Array.__svelte_cleanup=()=>{J.indexOf=W,J.lastIndexOf=X,J.includes=z}}var fQ,j8,KJ,T8,x8;function oJ(){if(fQ!==void 0)return;fQ=window,j8=document,KJ=/Firefox/.test(navigator.userAgent);var J=Element.prototype,Q=Node.prototype,W=Text.prototype;if(T8=Y0(Q,"firstChild").get,x8=Y0(Q,"nextSibling").get,YQ(J))J[WJ]=void 0,J[SJ]=null,J[KQ]=void 0,J.__e=void 0;if(YQ(W))W[XJ]=void 0;if(q)J.__svelte_meta=null,R8()}function p(J=""){return document.createTextNode(J)}function v(J){return T8.call(J)}function s(J){return x8.call(J)}function k8(J,Q){if(!F)return v(J);var W=v(S);if(W===null)W=S.appendChild(p());else if(Q&&W.nodeType!==d7){var X=p();return W?.before(X),j(X),X}if(Q)aJ(W);return j(W),W}function A6(J,Q=!1){if(!F){var W=v(J);if(W instanceof Comment&&W.data==="")return s(W);return W}if(Q){if(S?.nodeType!==d7){var X=p();return S?.before(X),j(X),X}aJ(S)}return S}function D6(J,Q=!1){if(!F)return v(J);var W=k8(J,Q);return iJ(J),W}function I6(J,Q=1,W=!1){let X=F?S:J;var z;while(Q--)z=X,X=s(X);if(!F)return X;if(W){if(X?.nodeType!==d7){var Z=p();if(X===null)z?.after(Z);else X.before(Z);return j(Z),Z}aJ(X)}return j(X),X}function qJ(J){J.textContent=""}function sJ(){if(!r)return!1;if(h0!==null)return!1;var J=L.f;return(J&H0)!==0}function k0(J,Q,W){if(Q==null||Q===NJ)return W?document.createElement(J,{is:W}):document.createElement(J);return W?document.createElementNS(Q,J,{is:W}):document.createElementNS(Q,J)}function aJ(J){if(J.nodeValue.length<65536)return;let Q=J.nextSibling;while(Q!==null&&Q.nodeType===d7)Q.remove(),J.nodeValue+=Q.nodeValue,Q=J.nextSibling}var F=!1;function d(J){F=J}var S;function j(J){if(J===null)throw Y7(),i0;return S=J}function i(){return j(s(S))}function iJ(J){if(!F)return;if(s(S)!==null)throw Y7(),i0;S=J}function pQ(J=1){if(F){var Q=J,W=S;while(Q--)W=s(W);S=W}}function J7(J=!0){var Q=0,W=S;while(!0){if(W.nodeType===R0){var X=W.data;if(X===I7){if(Q===0)return W;Q-=1}else if(X===_7||X===H7||X[0]==="["&&!isNaN(Number(X.slice(1))))Q+=1}var z=s(W);if(J)W.remove();W=z}}function MJ(J){if(!J||J.nodeType!==R0)throw Y7(),i0;return J.data}var JJ=Symbol("events"),lQ=new Set,rJ=new Set;function E8(J,Q,W){(Q[JJ]??={})[J]=W}function b8(J){for(var Q=0;Q<J.length;Q++)lQ.add(J[Q]);for(var W of rJ)W(J)}var dQ=null,_Q=!1;function cQ(J){var Q=this,W=Q.ownerDocument,X=J.type,z=J.composedPath?.()||[],Z=z[0]||J.target;if(dQ=J,!_Q)_Q=!0,setTimeout(()=>{_Q=!1,dQ=null});var K=0,G=dQ===J&&J[JJ];if(G){var $=z.indexOf(G);if($!==-1&&(Q===document||Q===window)){J[JJ]=Q;return}var Y=z.indexOf(Q);if(Y===-1)return;if($<=Y)K=$}if(Z=z[K]||J.target,Z===Q)return;c(J,"currentTarget",{configurable:!0,get(){return Z||W}});var H=w,B=L;u(null),f(null);try{var U,P=[];while(Z!==null){if(Z===Q)break;try{var M=Z[JJ]?.[X];if(M!=null&&(!Z.disabled||J.target===Z))M.call(Z,J)}catch(O){if(U)P.push(O);else U=O}if(J.cancelBubble)break;K++,Z=K<z.length?z[K]:null}if(U){for(let O of P)queueMicrotask(()=>{throw O});throw U}}finally{J[JJ]=Q,delete J.currentTarget,u(H),f(B)}}var R6=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:(J)=>{return J}});function y8(J){return R6?.createHTML(J)??J}function iQ(J){var Q=k0("template");return Q.innerHTML=y8(J.replaceAll("<!>","<!---->")),Q.content}function N0(J,Q){var W=L;if(W.nodes===null)W.nodes={start:J,end:Q,a:null,t:null}}function x6(J,Q){var W=(Q&w4)!==0,X=(Q&C4)!==0,z,Z=!J.startsWith("<!>");return()=>{if(F)return N0(S,null),S;if(z===void 0){if(z=iQ(Z?J:"<!>"+J),!W)z=v(z)}var K=X||KJ?document.importNode(z,!0):z.cloneNode(!0);if(W){var G=v(K),$=K.lastChild;N0(G,$)}else N0(K,K);return K}}function k6(){if(F)return N0(S,null),S;var J=document.createDocumentFragment(),Q=document.createComment(""),W=p();return J.append(Q,W),N0(Q,W),J}function VJ(J,Q){if(F){var W=L;if((W.f&H0)===0||W.nodes.end===null)W.nodes.end=S;i();return}if(J===null)return;J.before(Q)}var E6=/\r/g;function h8(J){J=J.replace(E6,"");let Q=5381,W=J.length;while(W--)Q=(Q<<5)-Q^J.charCodeAt(W);return(Q>>>0).toString(36)}var b6=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var $2=[...b6,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var y6=["touchstart","touchmove"];function g8(J){return y6.includes(J)}var h6=["$state","$state.raw","$derived","$derived.by"],q2=[...h6,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];function nJ(J){return J?.replace(/\//g,"/​")}function v8(J){let Q=0,W=q0(0),X;if(q)G0(W,"createSubscriber version");return()=>{if(L7())I(W),J0(()=>{if(Q===0)X=h(()=>J(()=>y7(W)));return Q+=1,()=>{n(()=>{if(Q-=1,Q===0)X?.(),X=void 0,y7(W)})}})}}var g6=F0|c0;function sQ(J,Q,W,X){new m8(J,Q,W,X)}class m8{parent;is_pending=!1;transform_error;#J;#Q=F?S:null;#W;#G;#Z;#K=null;#X=null;#$=null;#z=null;#M=0;#P=0;#U=!1;#B=new Set;#V=new Set;#q=null;#O=v8(()=>{if(this.#q=q0(this.#M),q)G0(this.#q,"$effect.pending()");return()=>{this.#q=null}});constructor(J,Q,W,X){if(this.#J=J,this.#W=Q,this.#G=(z)=>{var Z=L;Z.b=this,Z.f|=p7,W(z)},this.parent=L.b,this.transform_error=X??this.parent?.transform_error??((z)=>z),this.#Z=S0(()=>{if(F){let z=this.#Q;i();let Z=z.data===H7;if(z.data.startsWith(UQ)){let G=JSON.parse(z.data.slice(UQ.length));this.#w(G)}else if(Z)this.#S();else this.#L()}else this.#H()},g6),F)this.#J=S}#L(){try{this.#K=a(()=>this.#G(this.#J))}catch(J){this.error(J)}}#w(J){let Q=this.#W.failed,{reset:W,invoke_onerror:X}=this.#C(J);if(n(X),!Q)return;this.#$=a(()=>{Q(this.#J,()=>J,()=>W)})}#C(J){var Q=!1,W=!1;let X=()=>{if(Q){T4();return}if(Q=!0,W)a4();if(this.#$!==null)e0(this.#$,()=>{this.#$=null});this.#Y(()=>{this.#H()})};return{reset:X,invoke_onerror:()=>{try{W=!0,this.#W.onerror?.(J,X),W=!1}catch(Z){w0(Z,this.#Z&&this.#Z.parent)}}}}#S(){let J=this.#W.pending;if(!J)return;this.is_pending=!0,this.#X=a(()=>J(this.#J)),n(()=>{var Q=this.#z=document.createDocumentFragment(),W=p(),X=!1;if(Q.append(W),this.#K=this.#Y(()=>{try{return a(()=>this.#G(W))}catch(z){try{this.error(z),X=!0}catch(Z){w0(Z,this.#Z.parent)}return null}}),this.#K===null){if(this.#z=null,X)this.#F(C);return}if(this.#P===0)this.#J.before(Q),this.#z=null,e0(this.#X,()=>{this.#X=null}),this.#F(C)})}#H(){try{if(this.is_pending=this.has_pending_snippet(),this.#P=0,this.#M=0,this.#K=a(()=>{this.#G(this.#J)}),this.#P>0){var J=this.#z=document.createDocumentFragment();e7(this.#K,J);let Q=this.#W.pending;this.#X=a(()=>Q(this.#J))}else this.#F(C)}catch(Q){this.error(Q)}}#F(J){this.is_pending=!1,J.transfer_effects(this.#B,this.#V)}defer_effect(J){uJ(J,this.#B,this.#V)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#W.pending}#Y(J){var Q=L,W=w,X=A;f(this.#Z),u(this.#Z),K7(this.#Z.ctx);try{return K0.ensure(),J()}finally{f(Q),u(W),K7(X)}}#N(J,Q){if(!this.has_pending_snippet()){if(this.parent)this.parent.#N(J,Q);return}if(this.#P+=J,this.#P===0){if(this.#F(Q),this.#X)e0(this.#X,()=>{this.#X=null});if(this.#z)this.#J.before(this.#z),this.#z=null}}update_pending_count(J,Q){if(this.#N(J,Q),this.#M+=J,!this.#q||this.#U)return;this.#U=!0,n(()=>{if(this.#U=!1,this.#q)p0(this.#q,this.#M)})}get_effect_pending(){return this.#O(),I(this.#q)}error(J){if(!this.#W.onerror&&!this.#W.failed)throw J;if(C?.is_fork){if(this.#K)C.skip_effect(this.#K);if(this.#X)C.skip_effect(this.#X);if(this.#$)C.skip_effect(this.#$);C.oncommit(()=>{this.#A(J)})}else this.#A(J)}#A(J){if(this.#K)m(this.#K),this.#K=null;if(this.#X)m(this.#X),this.#X=null;if(this.#$)m(this.#$),this.#$=null;if(F)j(this.#Q),pQ(),j(J7());let Q=this.#W.failed,W=(X)=>{let{reset:z,invoke_onerror:Z}=this.#C(X);if(Z(),Q)this.#$=this.#Y(()=>{try{return a(()=>{var K=L;K.b=this,K.f|=p7,Q(this.#J,()=>X,()=>z)})}catch(K){return w0(K,this.#Z.parent),null}})};n(()=>{var X;try{X=this.transform_error(J)}catch(z){w0(z,this.#Z&&this.#Z.parent);return}if(X!==null&&typeof X==="object"&&typeof X.then==="function")X.then(W,(z)=>w0(z,this.#Z&&this.#Z.parent));else W(X)})}}var aQ=!0;function v6(J,Q){var W=Q==null?"":typeof Q==="object"?`${Q}`:Q;if(W!==(J[XJ]??=J.nodeValue))J[XJ]=W,J.nodeValue=`${W}`}function eJ(J,Q){return u8(J,Q)}function nQ(J,Q){oJ(),Q.intro=Q.intro??!1;let W=Q.target,X=F,z=S;try{var Z=v(W);while(Z&&(Z.nodeType!==R0||Z.data!==_7))Z=s(Z);if(!Z)throw i0;d(!0),j(Z);let K=u8(J,{...Q,anchor:Z});return d(!1),K}catch(K){if(K instanceof Error&&K.message.split(`
47
- `).some((G)=>G.startsWith("https://svelte.dev/e/")))throw K;if(K!==i0)console.warn("Failed to hydrate: ",K);if(Q.recover===!1)_4();return oJ(),qJ(W),d(!1),eJ(J,Q)}finally{d(X),j(z)}}var tJ=new Map;function u8(J,{target:Q,anchor:W,props:X={},events:z,context:Z,intro:K=!0,transformError:G}){oJ();var $=void 0,Y=L8(()=>{var H=W??Q.appendChild(p());sQ(H,{pending:()=>{}},(P)=>{LQ({});var M=A;if(Z)M.c=Z;if(z)X.$$events=z;if(F)N0(P,null);if(aQ=K,$=J(P,X)||GJ(),aQ=!0,F){if(L.nodes.end=S,S===null||S.nodeType!==R0||S.data!==I7)throw Y7(),i0}FQ()},G);var B=new Set,U=(P)=>{for(var M=0;M<P.length;M++){var O=P[M];if(B.has(O))continue;B.add(O);var V=g8(O);for(let E of[Q,document]){var N=tJ.get(E);if(N===void 0)N=new Map,tJ.set(E,N);var k=N.get(O);if(k===void 0)E.addEventListener(O,cQ,{passive:V}),N.set(O,1);else N.set(O,k+1)}}};return U(l7(lQ)),rJ.add(U),()=>{for(var P of B)for(let V of[Q,document]){var M=tJ.get(V),O=M.get(P);if(--O==0){if(V.removeEventListener(P,cQ),M.delete(P),M.size===0)tJ.delete(V)}else M.set(P,O)}if(rJ.delete(U),H!==W)H.parentNode?.removeChild(H)}});return rQ.set($,Y),$}var rQ=new WeakMap;function tQ(J,Q){let W=rQ.get(J);if(W)return rQ.delete(J),W(Q);if(q)j4();return Promise.resolve()}var f8=new Map;function p8(J,Q){var W=f8.get(J);if(!W)W=new Set,f8.set(J,W);W.add(Q)}class $7{anchor;#J=new Map;#Q=new Map;#W=new Map;#G=new Set;#Z=!0;constructor(J,Q=!0){this.anchor=J,this.#Z=Q}#K=(J)=>{if(!this.#J.has(J))return;var Q=this.#J.get(J),W=this.#Q.get(Q);if(W)t7(W),this.#G.delete(Q);else{var X=this.#W.get(Q);if(X){if(t7(X.effect),this.#Q.set(Q,X.effect),this.#W.delete(Q),q)X.fragment.lastChild[$Q]=this.anchor;X.fragment.lastChild.remove(),this.anchor.before(X.fragment),W=X.effect}}for(let[z,Z]of this.#J){if(this.#J.delete(z),z===J)break;let K=this.#W.get(Z);if(K)m(K.effect),this.#W.delete(Z)}for(let[z,Z]of this.#Q){if(z===Q||this.#G.has(z))continue;let K=()=>{if(Array.from(this.#J.values()).includes(z)){var $=document.createDocumentFragment();e7(Z,$),$.append(p()),this.#W.set(z,{effect:Z,fragment:$})}else m(Z);this.#G.delete(z),this.#Q.delete(z)};if(this.#Z||!W)this.#G.add(z),e0(Z,K,!1);else K()}};#X=(J)=>{this.#J.delete(J);let Q=Array.from(this.#J.values());for(let[W,X]of this.#W)if(!Q.includes(W))m(X.effect),this.#W.delete(W)};ensure(J,Q){var W=C,X=sJ();if(Q&&!this.#Q.has(J)&&!this.#W.has(J))if(X){var z=document.createDocumentFragment(),Z=p();z.append(Z),this.#W.set(J,{effect:a(()=>Q(Z)),fragment:z})}else this.#Q.set(J,a(()=>Q(this.anchor)));if(this.#J.set(W,J),X){for(let[K,G]of this.#Q)if(K===J)W.unskip_effect(G);else W.skip_effect(G);for(let[K,G]of this.#W)if(K===J)W.unskip_effect(G.effect);else W.skip_effect(G.effect);W.oncommit(this.#K),W.ondiscard(this.#X)}else{if(F)this.anchor=S;this.#K(W)}}}function f6(J,Q,W=!1){var X;if(F)X=S,i();var z=new $7(J),Z=W?F0:0;function K(G,$){if(F){var Y=MJ(X);if(G!==parseInt(Y.substring(1))){var H=J7();j(H),z.anchor=H,d(!1),z.ensure(G,$),d(!0);return}}z.ensure(G,$)}S0(()=>{var G=!1;if(Q(($,Y=0)=>{G=!0,K(Y,$)}),!G)K(-1,null)},Z)}var p6=Symbol("NaN");function d6(J,Q,W){if(F)i();var X=new $7(J),z=!u0();S0(()=>{var Z=Q();if(Z!==Z)Z=p6;if(z&&Z!==null&&typeof Z==="object")Z={};X.ensure(Z,W)})}function _6(J,Q,W){var X=[],z=Q.length,Z,K=Q.length;for(var G=0;G<z;G++){let B=Q[G];e0(B,()=>{if(Z){if(Z.pending.delete(B),Z.done.add(B),Z.pending.size===0){var U=J.outrogroups;if(eQ(J,l7(Z.done)),U.delete(Z),U.size===0)J.outrogroups=null}}else K-=1},!1)}if(K===0){var $=X.length===0&&W!==null&&J.pending.size===0;if($){var Y=W,H=Y.parentNode;qJ(H),H.append(Y),J.items.clear()}eQ(J,Q,!$)}else Z={pending:new Set(Q),done:new Set},(J.outrogroups??=new Set).add(Z)}function eQ(J,Q,W=!0){var X;if(J.pending.size>0){X=new Set;for(let K of J.pending.values())for(let G of K)X.add(J.items.get(G).e)}for(var z=0;z<Q.length;z++){var Z=Q[z];if(X?.has(Z)){Z.f|=v0;let K=document.createDocumentFragment();e7(Z,K)}else m(Q[z],W)}}var _8;function l6(J,Q,W,X,z,Z=null){var K=J,G=new Map,$=(Q&PQ)!==0;if($){var Y=J;K=F?j(v(Y)):Y.appendChild(p())}if(F)i();var H=null,B=x7(()=>{var E=W();return Z7(E)?E:E==null?[]:l7(E)});if(q)G0(B,"{#each ...}");var U,P=new Map,M=!0;function O(E){if((k.effect.f&g)!==0)return;if(k.pending.delete(E),k.fallback=H,c6(k,U,K,Q,X),H!==null)if(U.length===0)if((H.f&v0)===0)t7(H);else H.f^=v0,FJ(H,null,K);else e0(H,()=>{H=null})}function V(E){k.pending.delete(E)}var N=S0(()=>{U=I(B);var E=U.length;let D=!1;if(F){var E0=MJ(K)===H7;if(E0!==(E===0))K=J7(),j(K),d(!1),D=!0}var U0=new Set,A0=C,u7=sJ();for(var _0=0;_0<E;_0+=1){if(F&&S.nodeType===R0&&S.data===I7)K=S,D=!0,d(!1);var g0=U[_0],f7=X(g0,_0);if(q){var G4=X(g0,_0);if(f7!==G4)m4(String(_0),String(f7),String(G4))}var Q7=M?null:G.get(f7);if(Q7){if(Q7.v)p0(Q7.v,g0);if(Q7.i)p0(Q7.i,_0);if(u7)A0.unskip_effect(Q7.e)}else{if(Q7=i6(G,M?K:_8??=p(),g0,f7,_0,z,Q,W),!M)Q7.e.f|=v0;G.set(f7,Q7)}U0.add(f7)}if(E===0&&Z&&!H)if(M)H=a(()=>Z(K));else H=a(()=>Z(_8??=p())),H.f|=v0;if(E>U0.size)if(q)o6(U,X);else VQ("","","");if(F&&E>0)j(J7());if(!M)if(P.set(A0,U0),u7){for(let[Z6,K6]of G)if(!U0.has(Z6))A0.skip_effect(K6.e);A0.oncommit(O),A0.ondiscard(V)}else O(A0);if(D)d(!0);I(B)}),k={effect:N,flags:Q,items:G,pending:P,outrogroups:null,fallback:H};if(M=!1,F)K=S}function LJ(J){while(J!==null&&(J.f&o)===0)J=J.next;return J}function c6(J,Q,W,X,z){var Z=(X&H4)!==0,K=Q.length,G=J.items,$=LJ(J.effect.first),Y,H=null,B,U=[],P=[],M,O,V,N;if(Z){for(N=0;N<K;N+=1)if(M=Q[N],O=z(M,N),V=G.get(O).e,(V.f&v0)===0)V.nodes?.a?.measure(),(B??=new Set).add(V)}for(N=0;N<K;N+=1){if(M=Q[N],O=z(M,N),V=G.get(O).e,J.outrogroups!==null)for(let g0 of J.outrogroups)g0.pending.delete(V),g0.done.delete(V);if((V.f&l)!==0){if(t7(V),Z)V.nodes?.a?.unfix(),(B??=new Set).delete(V)}if((V.f&v0)!==0)if(V.f^=v0,V===$)FJ(V,null,W);else{var k=H?H.next:$;if(V===J.effect.last)J.effect.last=V.prev;if(V.prev)V.prev.next=V.next;if(V.next)V.next.prev=V.prev;S7(J,H,V),S7(J,V,k),FJ(V,k,W),H=V,U=[],P=[],$=LJ(H.next);continue}if(V!==$){if(Y!==void 0&&Y.has(V)){if(U.length<P.length){var E=P[0],D;H=E.prev;var E0=U[0],U0=U[U.length-1];for(D=0;D<U.length;D+=1)FJ(U[D],E,W);for(D=0;D<P.length;D+=1)Y.delete(P[D]);S7(J,E0.prev,U0.next),S7(J,H,E0),S7(J,U0,E),$=E,H=U0,N-=1,U=[],P=[]}else Y.delete(V),FJ(V,$,W),S7(J,V.prev,V.next),S7(J,V,H===null?J.effect.first:H.next),S7(J,H,V),H=V;continue}U=[],P=[];while($!==null&&$!==V)(Y??=new Set).add($),P.push($),$=LJ($.next);if($===null)continue}if((V.f&v0)===0)U.push(V);H=V,$=LJ(V.next)}if(J.outrogroups!==null){for(let g0 of J.outrogroups)if(g0.pending.size===0)eQ(J,l7(g0.done)),J.outrogroups?.delete(g0);if(J.outrogroups.size===0)J.outrogroups=null}if($!==null||Y!==void 0){var A0=[];if(Y!==void 0){for(V of Y)if((V.f&l)===0)A0.push(V)}while($!==null){if(($.f&l)===0&&$!==J.fallback)A0.push($);$=LJ($.next)}var u7=A0.length;if(u7>0){var _0=(X&PQ)!==0&&K===0?W:null;if(Z){for(N=0;N<u7;N+=1)A0[N].nodes?.a?.measure();for(N=0;N<u7;N+=1)A0[N].nodes?.a?.fix()}_6(J,A0,_0)}}if(Z)n(()=>{if(B===void 0)return;for(V of B)V.nodes?.a?.apply()})}function i6(J,Q,W,X,z,Z,K,G){var $=(K&U4)!==0?(K&Y4)===0?b7(W,!1,!1):q0(W):null,Y=(K&B4)!==0?q0(z):null;if(q&&$)$.trace=()=>{G()[Y?.v??z]};return{v:$,i:Y,e:a(()=>{return Z(Q,$??W,Y??z,G),()=>{J.delete(X)}})}}function FJ(J,Q,W){if(!J.nodes)return;var X=J.nodes.start,z=J.nodes.end,Z=Q&&(Q.f&v0)===0?Q.nodes.start:W;while(X!==null){var K=s(X);if(Z.before(X),X===z)return;X=K}}function S7(J,Q,W){if(Q===null)J.effect.first=W;else Q.next=W;if(W===null)J.effect.last=Q;else W.prev=Q}function o6(J,Q){let W=new Map,X=J.length;for(let z=0;z<X;z++){let Z=Q(J[z],z);if(W.has(Z)){let K=String(W.get(Z)),G=String(z),$=String(Z);if($.startsWith("[object "))$=null;VQ(K,G,$)}W.set(Z,z)}}function s6(J,Q,W){if(!Q||Q===h8(String(W??"")))return;let X,z=J.__svelte_meta?.loc;if(z)X=`near ${z.file}:${z.line}:${z.column}`;else if(j0?.[O0])X=`in ${j0[O0]}`;R4(nJ(X))}function a6(J,Q,W=!1,X=!1,z=!1,Z=!1){var K=J,G="";if(W){var $=J;if(F)K=j(v($))}gQ(()=>{var Y=L;if(G===(G=Q()??"")){if(F)i();return}if(W&&!F){if(Y.nodes=null,$.innerHTML=G,G!=="")N0(v($),$.lastChild);return}if(Y.nodes!==null)mQ(Y.nodes.start,Y.nodes.end),Y.nodes=null;if(G==="")return;if(F){var H=S.data,B=i(),U=B;while(B!==null&&(B.nodeType!==R0||B.data!==""))U=B,B=s(B);if(B===null)throw Y7(),i0;if(q&&!Z)s6(B.parentNode,H,G);N0(S,U),K=j(B);return}var P=X?zJ:z?BQ:void 0,M=k0(X?"svg":z?"math":"template",P);M.innerHTML=G;var O=X||z?M:M.content;if(N0(v(O),O.lastChild),X||z)while(v(O))K.before(v(O));else K.before(O)})}function r6(J,Q,W,X,z){if(F)i();if(Q.$$host?.$$shadowRoot){let G=k0("slot");if(W!=="default")G.name=W;if(VJ(J,G),z!==null){let $=p();G.append($),z($)}return}var Z=Q.$$slots?.[W],K=!1;if(Z===!0)Z=Q[W==="default"?"children":W],K=!0;if(Z===void 0){if(z!==null)z(J)}else Z(J,K?()=>X:X)}function Q1(J,Q){L0(()=>{J=L?.parent?.nodes?.start??J;var W=J.getRootNode(),X=W.host?W:W.head??W.ownerDocument.head;if(!X.querySelector("#"+Q.hash)){let z=k0("style");if(z.id=Q.hash,z.textContent=Q.code,X.appendChild(z),q)p8(Q.hash,z)}})}function W1(J,Q,W){L0(()=>{var X=h(()=>Q(J,W?.())||{});if(W&&X?.update){var z=!1,Z={};J0(()=>{var K=W();if(lJ(K),z&&xJ(Z,K))Z=K,X.update(K)}),z=!0}if(X?.destroy)return()=>X.destroy()})}var l8=[...`
48
- \r\f \v\uFEFF`];function c8(J,Q,W){var X=J==null?"":""+J;if(Q)X=X?X+" "+Q:Q;if(W){for(var z of Object.keys(W))if(W[z])X=X?X+" "+z:z;else if(X.length){var Z=z.length,K=0;while((K=X.indexOf(z,K))>=0){var G=K+Z;if((K===0||l8.includes(X[K-1]))&&(G===X.length||l8.includes(X[G])))X=(K===0?"":X.substring(0,K))+X.substring(G+1);else K=G}}}return X===""?null:X}function i8(J,Q,W,X,z,Z){var K=J[WJ];if(F||K!==W||K===void 0){var G=c8(W,X,Z);if(!F||G!==J.getAttribute("class"))if(G==null)J.removeAttribute("class");else if(Q)J.className=G;else J.setAttribute("class",G);J[WJ]=W}else if(Z&&z!==Z)for(var $ in Z){var Y=!!Z[$];if(z==null||Y!==!!z[$])J.classList.toggle($,Y)}return Z}var Y1=Symbol("class"),M1=Symbol("style"),V1=Symbol("is custom element"),L1=Symbol("is html"),F1=qQ?"link":"LINK";function a8(J,Q,W,X){var z=w1(J);if(F){if(z[Q]=J.getAttribute(Q),Q==="src"||Q==="srcset"||Q==="href"&&J.nodeName===F1){if(!X)C1(J,Q,W??"");return}}if(z[Q]===(z[Q]=W))return;if(Q==="loading")J[P4]=W;if(W==null)J.removeAttribute(Q);else if(typeof W!=="string"&&r8(J).has(Q))J[Q]=W;else J.setAttribute(Q,W)}function O1(J,Q,W){var X=w,z=L;let Z=F;if(F)d(!1);u(null),f(null);try{if(Q!=="style"&&(J4.has(J.getAttribute("is")||J.nodeName)||!customElements||customElements.get(J.getAttribute("is")||J.nodeName.toLowerCase())?r8(J).has(Q):W&&typeof W==="object"))J[Q]=W;else a8(J,Q,W==null?W:String(W))}finally{if(u(X),f(z),Z)d(!0)}}function w1(J){return J[SJ]??={[V1]:J.nodeName.includes("-"),[L1]:J.namespaceURI===NJ}}var J4=new Map;function r8(J){var Q=J.getAttribute("is")||J.nodeName,W=J4.get(Q);if(W)return W;J4.set(Q,W=new Set);var X,z=J,Z=Element.prototype;while(Z!==z){X=DJ(z);for(var K in X)if(X[K].set&&K!=="innerHTML"&&K!=="textContent"&&K!=="innerText")W.add(K);z=R7(z)}return W}function C1(J,Q,W){if(!q)return;if(Q==="srcset"&&S1(J,W))return;if(Q4(J.getAttribute(Q)??"",W))return;I4(Q,J.outerHTML.replace(J.innerHTML,J.innerHTML&&"..."),String(W))}function Q4(J,Q){if(J===Q)return!0;return new URL(J,document.baseURI).href===new URL(Q,document.baseURI).href}function o8(J){return J.split(",").map((Q)=>Q.trim().split(" ").filter(Boolean))}function S1(J,Q){var W=o8(J.srcset),X=o8(Q);return X.length===W.length&&X.every(([z,Z],K)=>Z===W[K][1]&&(Q4(W[K][0],z)||Q4(z,W[K][0])))}class n8{#J=new WeakMap;#Q;#W;static entries=new WeakMap;constructor(J){this.#W=J}observe(J,Q){var W=this.#J.get(J)||new Set;return W.add(Q),this.#J.set(J,W),this.#G().observe(J,this.#W),()=>{var X=this.#J.get(J);if(X.delete(Q),X.size===0)this.#J.delete(J),this.#Q.unobserve(J)}}#G(){return this.#Q??(this.#Q=new ResizeObserver((J)=>{for(var Q of J){n8.entries.set(Q.target,Q);for(var W of this.#J.get(Q.target)||[])W(Q)}}))}}function W4(J,Q){return J===Q||J?.[X0]===Q}function N1(J=GJ(),Q,W,X){var z=A.r,Z=L;return L0(()=>{var K,G;return J0(()=>{K=G,G=X?.()||[],h(()=>{if(!W4(W(...G),J)){if(Q(J,...G),K&&W4(W(...K),J))Q(null,...K)}})}),()=>{let $=Z;while($!==z&&$.parent!==null&&$.parent.f&U7)$=$.parent;let Y=()=>{if(G&&W4(W(...G),J))Q(null,...G)},H=$.teardown;$.teardown=()=>{Y(),H?.()}}}),J}function A1(J,Q,W,X){var z=!V7||(W&V4)!==0,Z=(W&F4)!==0,K=(W&O4)!==0,G=X,$=!0,Y=void 0,H=()=>{if(K&&z)return Y??=F7(X),I(Y);if($)$=!1,G=K?h(X):X;return G};let B;if(Z){var U=X0 in J||QJ in J;B=Y0(J,Q)?.set??(U&&Q in J?(D)=>J[Q]=D:void 0)}var P,M=!1;if(Z)[P,M]=RQ(()=>J[Q]);else P=J[Q];if(P===void 0&&X!==void 0){if(P=H(),B){if(z)l4(Q);B(P)}}var O;if(z)O=()=>{var D=J[Q];if(D===void 0)return H();return $=!0,D};else O=()=>{var D=J[Q];if(D!==void 0)G=void 0;return D===void 0?G:D};if(z&&(W&L4)===0)return O;if(B){var V=J.$$legacy;return function(D,E0){if(arguments.length>0){if(!z||!E0||V||M)B(E0?O():D);return D}return O()}}var N=!1,k=((W&M4)!==0?F7:x7)(()=>{return N=!1,O()});if(q)k.label=Q;if(Z)I(k);var E=L;return function(D,E0){if(arguments.length>0){let U0=E0?I(k):z&&Z?G7(D):D;if(P0(k,U0),N=!0,G!==void 0)G=U0;return D}if(T0&&N||(E.f&g)!==0)return k.v;return I(k)}}function t8(J){return new e8(J)}class e8{#J;#Q;constructor(J){var Q=new Map,W=(z,Z)=>{var K=b7(Z,!1,!1);return Q.set(z,K),K};let X=new Proxy({...J.props||{},$$events:{}},{get(z,Z){return I(Q.get(Z)??W(Z,Reflect.get(z,Z)))},has(z,Z){if(Z===QJ)return!0;return I(Q.get(Z)??W(Z,Reflect.get(z,Z))),Reflect.has(z,Z)},set(z,Z,K){return P0(Q.get(Z)??W(Z,K),K),Reflect.set(z,Z,K)}});if(this.#Q=(J.hydrate?nQ:eJ)(J.component,{target:J.target,anchor:J.anchor,props:X,context:J.context,intro:J.intro??!1,recover:J.recover,transformError:J.transformError}),!r&&(!J?.props?.$$host||J.sync===!1))n7();this.#J=X.$$events;for(let z of Object.keys(this.#Q)){if(z==="$set"||z==="$destroy"||z==="$on")continue;c(this,z,{get(){return this.#Q[z]},set(Z){this.#Q[z]=Z},enumerable:!0})}this.#Q.$set=(z)=>{Object.assign(X,z)},this.#Q.$destroy=()=>{tQ(this.#Q)}}$set(J){this.#Q.$set(J)}$on(J,Q){this.#J[J]=this.#J[J]||[];let W=(...X)=>Q.call(this,...X);return this.#J[J].push(W),()=>{this.#J[J]=this.#J[J].filter((X)=>X!==W)}}$destroy(){this.#Q.$destroy()}}var J6;if(typeof HTMLElement==="function")J6=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(J,Q,W){super();if(this.$$ctor=J,this.$$s=Q,W)this.$$shadowRoot=this.attachShadow(W)}addEventListener(J,Q,W){if(this.$$l[J]=this.$$l[J]||[],this.$$l[J].push(Q),this.$$c){let X=this.$$c.$on(J,Q);this.$$l_u.set(Q,X)}super.addEventListener(J,Q,W)}removeEventListener(J,Q,W){if(super.removeEventListener(J,Q,W),this.$$c){let X=this.$$l_u.get(Q);if(X)X(),this.$$l_u.delete(Q)}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let J=function(X){return(z)=>{let Z=k0("slot");if(X!=="default")Z.name=X;VJ(z,Z)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let Q={},W=E1(this);for(let X of this.$$s)if(X in W)if(X==="default"&&!this.$$d.children)this.$$d.children=J(X),Q.default=!0;else Q[X]=J(X);for(let X of this.attributes){let z=this.$$g_p(X.name);if(!(z in this.$$d))this.$$d[z]=QQ(z,X.value,this.$$p_d,"toProp")}for(let X in this.$$p_d)if(!(X in this.$$d)&&this[X]!==void 0)this.$$d[X]=this[X],delete this[X];this.$$c=t8({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:Q,$$host:this}}),this.$$me=hQ(()=>{J0(()=>{this.$$r=!0;for(let X of ZJ(this.$$c)){if(!this.$$p_d[X]?.reflect)continue;this.$$d[X]=this.$$c[X];let z=QQ(X,this.$$d[X],this.$$p_d,"toAttribute");if(z==null)this.removeAttribute(this.$$p_d[X].attribute||X);else this.setAttribute(this.$$p_d[X].attribute||X,z)}this.$$r=!1})});for(let X in this.$$l)for(let z of this.$$l[X]){let Z=this.$$c.$on(X,z);this.$$l_u.set(z,Z)}this.$$l={}}}attributeChangedCallback(J,Q,W){if(this.$$r)return;J=this.$$g_p(J),this.$$d[J]=QQ(J,W,this.$$p_d,"toProp"),this.$$c?.$set({[J]:this.$$d[J]})}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{if(!this.$$cn&&this.$$c)this.$$c.$destroy(),this.$$me(),this.$$c=void 0})}$$g_p(J){return ZJ(this.$$p_d).find((Q)=>this.$$p_d[Q].attribute===J||!this.$$p_d[Q].attribute&&Q.toLowerCase()===J)||J}};function QQ(J,Q,W,X){let z=W[J]?.type;if(Q=z==="Boolean"&&typeof Q!=="boolean"?Q!=null:Q,!X||!W[J])return Q;else if(X==="toAttribute")switch(z){case"Object":case"Array":return Q==null?null:JSON.stringify(Q);case"Boolean":return Q?"":null;case"Number":return Q==null?null:Q;default:return Q}else switch(z){case"Object":case"Array":return Q&&JSON.parse(Q);case"Boolean":return Q;case"Number":return Q!=null?+Q:Q;default:return Q}}function E1(J){let Q={};return J.childNodes.forEach((W)=>{Q[W.slot||"default"]=!0}),Q}function b1(J,Q,W,X,z,Z){let K=class extends J6{constructor(){super(J,W,z);this.$$p_d=Q}static get observedAttributes(){return ZJ(Q).map((G)=>(Q[G].attribute||G).toLowerCase())}};if(ZJ(Q).forEach((G)=>{c(K.prototype,G,{get(){return this.$$c&&G in this.$$c?this.$$c[G]:this.$$d[G]},set($){$=QQ(G,$,Q),this.$$d[G]=$;var Y=this.$$c;if(Y){var H=Y0(Y,G)?.get;if(H)Y[G]=$;else Y.$set({[G]:$})}}})}),X.forEach((G)=>{c(K.prototype,G,{get(){return this.$$c?.[G]}})}),Z)K=Z(K);return J.element=K,K}if(q){let J=function(Q){if(!(Q in globalThis)){let W;Object.defineProperty(globalThis,Q,{configurable:!0,get:()=>{if(W!==void 0)return W;c4(Q)},set:(X)=>{W=X}})}};J("$state"),J("$effect"),J("$derived"),J("$inspect"),J("$props"),J("$bindable")}import{createContext as WQ}from"@pie-players/pie-context";var Q6=WQ(Symbol.for("pie.assessmentToolkit.runtimeContext")),W6=WQ(Symbol.for("pie.assessmentToolkit.hostRuntimeContext")),X6=WQ(Symbol.for("pie.assessmentToolkit.shellContext")),y1=WQ(Symbol.for("pie.assessmentToolkit.regionScopeContext"));import{ContextConsumer as h1}from"@pie-players/pie-context";function z4(J,Q,W){let X=!1,z=new h1(J,{context:Q,subscribe:!0,onValue:(Y)=>{X=!0,W(Y)}});z.connect();let Z=(Y)=>{if(Y.context!==Q)return;z.requestValue()};J.addEventListener("context-provider",Z);let K=0,G=200,$=globalThis.setInterval(()=>{if(X||K>=G){globalThis.clearInterval($);return}K+=1,z.requestValue()},50);return()=>{globalThis.clearInterval($),J.removeEventListener("context-provider",Z),z.disconnect()}}function SH(J,Q){return z4(J,Q6,Q)}function NH(J,Q){return z4(J,W6,Q)}function AH(J,Q){return z4(J,X6,Q)}var XQ={assessment:[],section:[],item:[],passage:[],rubric:[],element:[]};var Z4={section:[...XQ.section],item:[...XQ.item],passage:[...XQ.passage]};function m7(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}function N7(J,Q){if(J==null)return[];if(!Array.isArray(J))throw Error(`Invalid tools config at "${Q}": expected an array of tool ids.`);if(J.find((X)=>typeof X!=="string")!==void 0)throw Error(`Invalid tools config at "${Q}": all entries must be strings.`);return J}function g1(J){if(J==null)return;if(!m7(J))throw Error('Invalid tools config at "placement": expected an object with section/item/passage arrays.');return J}function v1(J){if(J==null)return;if(!m7(J))throw Error('Invalid tools config at "policy": expected an object with allowed/blocked arrays.');return J}function m1(J,Q){if(Q==null)return;if(!m7(Q))throw Error(`Invalid tools config at "providers.${J}": expected an object.`);let W=Q,X=(z)=>z==="polly"||z==="google"||z==="custom";if("enabled"in W&&W.enabled!==void 0&&typeof W.enabled!=="boolean")throw Error(`Invalid tools config at "providers.${J}.enabled": expected a boolean.`);if("settings"in W&&W.settings!==void 0&&!m7(W.settings))throw Error(`Invalid tools config at "providers.${J}.settings": expected an object.`);if("provider"in W&&W.provider!==void 0&&!m7(W.provider)&&!(J==="textToSpeech"&&X(W.provider)))throw Error(`Invalid tools config at "providers.${J}.provider": expected an object.`);return W}function u1(J){if(J==null)return{};if(!m7(J))throw Error('Invalid tools config at "providers": expected an object keyed by tool id.');let Q={};for(let[W,X]of Object.entries(J))Q[W]=m1(W,X);return Q}function K4(J){let Q=J.trim();if(!Q)return"";return Q}function q7(J){if(!J||J.length===0)return[];let Q=new Set;for(let W of J){if(typeof W!=="string")throw Error("Invalid tools config: tool list entries must be strings.");let X=K4(W);if(!X)continue;Q.add(X)}return Array.from(Q)}function jH(J){if(!J)return[];return q7(J.split(",").map((Q)=>Q.trim()).filter(Boolean))}function f1(J,Q){if(J==null)return;if(J==="on"||J==="off")return J;throw Error(`Invalid tools config at "${Q}": expected "on" or "off", got ${JSON.stringify(J)}.`)}function TH(J){if(J!=null&&!m7(J))throw Error('Invalid tools config: expected an object with "policy", "placement", and "providers".');let Q=v1(J?.policy),W=g1(J?.placement),X=u1(J?.providers),z=f1(J?.pnpEnforcement,"pnpEnforcement"),Z={policy:{allowed:q7(N7(Q?.allowed,"policy.allowed")),blocked:q7(N7(Q?.blocked,"policy.blocked"))},placement:{section:q7(N7(W?.section,"placement.section")).length?q7(N7(W?.section,"placement.section")):[...Z4.section],item:q7(N7(W?.item,"placement.item")).length?q7(N7(W?.item,"placement.item")):[...Z4.item],passage:q7(N7(W?.passage,"placement.passage")).length?q7(N7(W?.passage,"placement.passage")):[...Z4.passage]},providers:X};if(z)Z.pnpEnforcement=z;return Z}import{dynamicMessageKey as EH}from"@pie-players/pie-players-shared/i18n/provider";var p1=["assessment","section","item","passage","rubric","element"];function zQ(J,Q){if(typeof J!=="string"||J.trim().length===0)throw Error(`Invalid tool registration: "${Q}" must be a non-empty string.`)}var d1=[{pattern:/<script\b/i,reason:"contains a <script> tag"},{pattern:/\son[a-z]+\s*=/i,reason:"contains an inline event handler (on*=) attribute"},{pattern:/javascript:/i,reason:"contains a javascript: URL"},{pattern:/<foreignObject\b/i,reason:"contains a <foreignObject> element"}];function _1(J,Q,W){let X=Q.trimStart(),z=X.toLowerCase().startsWith("<svg"),Z=/^https?:/i.test(X);if(/^data:/i.test(X))throw Error(`Invalid tool registration "${J}": "${W}" may not be a data: URL.`);if(!z&&!Z)return;for(let{pattern:G,reason:$}of d1)if(G.test(Q))throw Error(`Invalid tool registration "${J}": "${W}" ${$}. Inline SVG icons must not include scriptable content.`)}function z6(J){zQ(J.toolId,"toolId"),zQ(J.name,"name"),zQ(J.description,"description");let Q=J.activation==="region";if(!Q||J.icon!==void 0){if(typeof J.icon!=="string"&&typeof J.icon!=="function")throw Error(`Invalid tool registration "${J.toolId}": "icon" must be a string or function.`)}if(typeof J.icon==="string")_1(J.toolId,J.icon,"icon");if(!Array.isArray(J.supportedLevels)||J.supportedLevels.length===0)throw Error(`Invalid tool registration "${J.toolId}": "supportedLevels" must be a non-empty array.`);let W=J.supportedLevels.find((X)=>!p1.includes(X));if(W)throw Error(`Invalid tool registration "${J.toolId}": unsupported level "${W}".`);if(J.activation!==void 0&&J.activation!=="toolbar-toggle"&&J.activation!=="selection-gateway"&&J.activation!=="region")throw Error(`Invalid tool registration "${J.toolId}": unsupported activation "${String(J.activation)}".`);if(J.surfaces!==void 0&&(!Array.isArray(J.surfaces)||J.surfaces.some((X)=>typeof X!=="string"||X.trim().length===0)))throw Error(`Invalid tool registration "${J.toolId}": "surfaces" must be an array of non-empty strings.`);if(Q&&!J.surfaces?.length)throw Error(`Invalid tool registration "${J.toolId}": region tools must declare at least one host surface in "surfaces".`);if(Q&&typeof J.renderSurface!=="function")throw Error(`Invalid tool registration "${J.toolId}": region tools must implement "renderSurface".`);if(J.resolvesWithoutGrant!==void 0&&typeof J.resolvesWithoutGrant!=="boolean")throw Error(`Invalid tool registration "${J.toolId}": "resolvesWithoutGrant" must be a boolean.`);if(J.resolvesWithoutGrant&&!J.requiresAuthoredContent)throw Error(`Invalid tool registration "${J.toolId}": "resolvesWithoutGrant" requires "requiresAuthoredContent".`);if(J.renderSurface!==void 0&&typeof J.renderSurface!=="function")throw Error(`Invalid tool registration "${J.toolId}": "renderSurface" must be a function.`);if(J.renderSurface&&!J.surfaces?.length)throw Error(`Invalid tool registration "${J.toolId}": "renderSurface" requires at least one entry in "surfaces".`);if(J.singletonScope!==void 0&&J.singletonScope!=="section")throw Error(`Invalid tool registration "${J.toolId}": unsupported singletonScope "${String(J.singletonScope)}".`);if(J.activation==="selection-gateway"&&J.singletonScope!=="section")throw Error(`Invalid tool registration "${J.toolId}": selection-gateway tools must declare singletonScope "section".`);if(J.pnpSupportIds!==void 0&&(!Array.isArray(J.pnpSupportIds)||J.pnpSupportIds.some((X)=>typeof X!=="string"||X.trim().length===0)))throw Error(`Invalid tool registration "${J.toolId}": "pnpSupportIds" must be an array of non-empty strings.`);if(J.activation!=="region"&&typeof J.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${J.toolId}": "isVisibleInContext" must be a function.`);if(J.isVisibleInContext!==void 0&&typeof J.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${J.toolId}": "isVisibleInContext" must be a function when present.`);if(J.isApplicableToContent!==void 0&&typeof J.isApplicableToContent!=="function")throw Error(`Invalid tool registration "${J.toolId}": "isApplicableToContent" must be a function when present.`);if(J.requiresAuthoredContent!==void 0){if(typeof J.requiresAuthoredContent!=="object"||J.requiresAuthoredContent===null||typeof J.requiresAuthoredContent.resolve!=="function")throw Error(`Invalid tool registration "${J.toolId}": "requiresAuthoredContent" must be an object with a "resolve" function.`);if(!J.pnpSupportIds?.length)throw Error(`Invalid tool registration "${J.toolId}": "requiresAuthoredContent" requires at least one entry in "pnpSupportIds", which is what a host filters a default grant list on.`)}if(J.renderToolbar!==void 0){if(typeof J.renderToolbar!=="function")throw Error(`Invalid tool registration "${J.toolId}": "renderToolbar" must be a function.`)}else if(!Q)throw Error(`Invalid tool registration "${J.toolId}": "renderToolbar" must be a function.`)}class l1{tools=new Map;pnpIndex=new Map;componentOverrides={};moduleLoaders=new Map;loadedToolModules=new Set;moduleLoadPromises=new Map;changeListeners=new Set;emitChange(J){for(let Q of this.changeListeners)try{Q(J)}catch(W){console.warn("[ToolRegistry] change listener failed:",W)}}onRegistryChange(J){this.changeListeners.add(J);let Q=!0;return()=>{if(!Q)return;Q=!1,this.changeListeners.delete(J)}}normalizeToolId(J){return K4(J)}normalizeToolIds(J){return J.map((Q)=>this.normalizeToolId(Q))}register(J){if(z6(J),this.tools.has(J.toolId))throw Error(`Tool '${J.toolId}' is already registered`);if(this.tools.set(J.toolId,J),J.pnpSupportIds)for(let Q of J.pnpSupportIds){if(!this.pnpIndex.has(Q))this.pnpIndex.set(Q,new Set);this.pnpIndex.get(Q).add(J.toolId)}this.emitChange({kind:"register",toolIds:[J.toolId]})}override(J){if(z6(J),!this.tools.has(J.toolId))throw Error(`Cannot override non-existent tool '${J.toolId}'`);let Q=this.tools.get(J.toolId);if(Q.pnpSupportIds)for(let W of Q.pnpSupportIds)this.pnpIndex.get(W)?.delete(J.toolId);if(this.tools.set(J.toolId,J),J.pnpSupportIds)for(let W of J.pnpSupportIds){if(!this.pnpIndex.has(W))this.pnpIndex.set(W,new Set);this.pnpIndex.get(W).add(J.toolId)}this.emitChange({kind:"override",toolIds:[J.toolId]})}unregister(J){let Q=this.tools.get(J);if(!Q)return;if(Q.pnpSupportIds)for(let W of Q.pnpSupportIds)this.pnpIndex.get(W)?.delete(J);this.tools.delete(J),this.emitChange({kind:"unregister",toolIds:[J]})}get(J){return this.tools.get(J)}has(J){return this.tools.has(J)}getAllToolIds(){return Array.from(this.tools.keys())}getAllTools(){return Array.from(this.tools.values())}getToolsByPNPSupport(J){return this.pnpIndex.get(J)||new Set}getToolsByLevel(J){return this.getAllTools().filter((Q)=>Q.supportedLevels.includes(J))}getToolActivation(J){return this.get(J)?.activation||"toolbar-toggle"}getToolSingletonScope(J){return this.get(J)?.singletonScope||null}getToolsBySurface(J){if(!J)return[];return this.getAllTools().filter((Q)=>typeof Q.renderSurface==="function"&&Q.surfaces?.includes(J))}getContentDependentSupportIds(){let J=new Set;for(let Q of this.getAllTools()){if(!Q.requiresAuthoredContent)continue;for(let W of Q.pnpSupportIds||[])J.add(W)}return[...J].sort()}filterToolIdsByActivation(J,Q){return J.filter((W)=>this.getToolActivation(W)===Q)}filterVisibleInContext(J,Q){let W=[];for(let X of J){let z=this.get(X);if(!z){console.warn(`Tool '${X}' is allowed but not registered`);continue}if(!z.supportedLevels.includes(Q.level))continue;try{if(z.isVisibleInContext?.(Q))W.push(z)}catch(Z){console.error(`Error evaluating visibility for tool '${X}':`,Z)}}return W}isApplicableToAnyContext(J,Q){let W=this.get(J);if(!W?.isApplicableToContent)return!0;if(Q.length===0)return!0;return Q.some((X)=>{try{return W.isApplicableToContent?.(X)??!0}catch(z){return console.error(`Error evaluating applicability for tool '${J}':`,z),!0}})}getToolMetadata(){return this.getAllTools().map((J)=>({toolId:J.toolId,name:J.name,description:J.description,pnpSupportIds:J.pnpSupportIds||[],supportedLevels:J.supportedLevels,activation:J.activation||"toolbar-toggle",singletonScope:J.singletonScope||null,surfaces:J.surfaces||[],requiresAuthoredContent:Boolean(J.requiresAuthoredContent),contentDependencyDescription:J.requiresAuthoredContent?.description??null}))}generatePNPSupportsFromTools(J){let Q=new Set;for(let W of J){let X=this.get(W);if(X?.pnpSupportIds)for(let z of X.pnpSupportIds)Q.add(z)}return Array.from(Q)}clear(){let J=this.getAllToolIds();if(J.length===0)return;this.tools.clear(),this.pnpIndex.clear(),this.emitChange({kind:"clear",toolIds:J})}setComponentOverrides(J){if(this.componentOverrides===J)return;this.componentOverrides=J,this.emitChange({kind:"component-overrides",toolIds:[]})}setToolModuleLoaders(J){let Q=Object.entries(J).filter((X)=>X[1]!==void 0);for(let[X,z]of Q)if(zQ(X,"tool module loader id"),typeof z!=="function")throw Error(`Invalid tool module loader for "${X}": expected a function.`);let W=[];for(let[X,z]of Q){if(this.moduleLoaders.get(X)===z)continue;this.moduleLoaders.set(X,z),W.push(X)}if(W.length>0)this.emitChange({kind:"module-loaders",toolIds:W})}async ensureToolModuleLoaded(J){if(this.loadedToolModules.has(J))return;let Q=this.moduleLoadPromises.get(J);if(Q){await Q;return}let W=this.moduleLoaders.get(J);if(!W)return;let X=(async()=>{await W(),this.loadedToolModules.add(J)})();this.moduleLoadPromises.set(J,X);try{await X}finally{this.moduleLoadPromises.delete(J)}}async ensureToolModulesLoaded(J){await Promise.all(J.map((Q)=>this.ensureToolModuleLoaded(Q)))}isToolModuleLoaded(J){return this.loadedToolModules.has(J)}renderForToolbar(J,Q,W){let X=this.get(J);if(!X)throw Error(`Tool '${J}' is not registered`);if(typeof X.renderToolbar!=="function")throw Error(`Tool '${J}' has activation "${X.activation||"toolbar-toggle"}" and renders into a host surface, not a toolbar. Remove it from toolbar placement.`);let z={...W,componentOverrides:{...this.componentOverrides||{},...W.componentOverrides||{}}};return X.renderToolbar(Q,z)}renderForSurface(J,Q){let W=this.get(J);if(!W)throw Error(`Tool '${J}' is not registered`);if(typeof W.renderSurface!=="function")throw Error(`Tool '${J}' does not render into a host surface. Surface capabilities declare "surfaces" and implement "renderSurface".`);return W.renderSurface({...Q,componentOverrides:{...this.componentOverrides||{},...Q.componentOverrides||{}}})}}
49
- export{c1 as b,iJ as c,LQ as d,FQ as e,H6 as f,n7 as g,n0 as h,P0 as i,G7 as j,k8 as k,A6 as l,D6 as m,I6 as n,yQ as o,gQ as p,I as q,h as r,E8 as s,b8 as t,x6 as u,k6 as v,VJ as w,v6 as x,f6 as y,d6 as z,l6 as A,a6 as B,r6 as C,Q1 as D,W1 as E,i8 as F,a8 as G,O1 as H,N1 as I,A1 as J,b1 as K,Q6 as L,W6 as M,SH as N,NH as O,AH as P,q7 as Q,jH as R,TH as S,l1 as T};
@@ -1,13 +0,0 @@
1
- import { type AssessmentToolkitHostRuntimeContext, type AssessmentToolkitRegionScopeContext, type AssessmentToolkitShellContext, type AssessmentToolkitRuntimeContext } from "./assessment-toolkit-context.js";
2
- export type RuntimeContextListener = (value: AssessmentToolkitRuntimeContext) => void;
3
- export type HostRuntimeContextListener = (value: AssessmentToolkitHostRuntimeContext) => void;
4
- export type ShellContextListener = (value: AssessmentToolkitShellContext) => void;
5
- export type RegionScopeContextListener = (value: AssessmentToolkitRegionScopeContext) => void;
6
- /**
7
- * Connect a DOM host element to the shared assessment toolkit runtime context.
8
- * Returns a cleanup function that disconnects the underlying consumer.
9
- */
10
- export declare function connectAssessmentToolkitRuntimeContext(host: HTMLElement, onValue: RuntimeContextListener): () => void;
11
- export declare function connectAssessmentToolkitHostRuntimeContext(host: HTMLElement, onValue: HostRuntimeContextListener): () => void;
12
- export declare function connectAssessmentToolkitShellContext(host: HTMLElement, onValue: ShellContextListener): () => void;
13
- export declare function connectAssessmentToolkitRegionScopeContext(host: HTMLElement, onValue: RegionScopeContextListener): () => void;
@@ -1,51 +0,0 @@
1
- import { ContextConsumer } from "@pie-players/pie-context";
2
- import { assessmentToolkitHostRuntimeContext, assessmentToolkitRegionScopeContext, assessmentToolkitShellContext, assessmentToolkitRuntimeContext, } from "./assessment-toolkit-context.js";
3
- function connectConsumerWithProviderRetry(host, context, onValue) {
4
- let hasValue = false;
5
- const consumer = new ContextConsumer(host, {
6
- context,
7
- subscribe: true,
8
- onValue: (value) => {
9
- hasValue = true;
10
- onValue(value);
11
- },
12
- });
13
- consumer.connect();
14
- const onContextProvider = (event) => {
15
- if (event.context !== context)
16
- return;
17
- consumer.requestValue();
18
- };
19
- host.addEventListener("context-provider", onContextProvider);
20
- let attempts = 0;
21
- const maxAttempts = 200;
22
- const retryTimer = globalThis.setInterval(() => {
23
- if (hasValue || attempts >= maxAttempts) {
24
- globalThis.clearInterval(retryTimer);
25
- return;
26
- }
27
- attempts += 1;
28
- consumer.requestValue();
29
- }, 50);
30
- return () => {
31
- globalThis.clearInterval(retryTimer);
32
- host.removeEventListener("context-provider", onContextProvider);
33
- consumer.disconnect();
34
- };
35
- }
36
- /**
37
- * Connect a DOM host element to the shared assessment toolkit runtime context.
38
- * Returns a cleanup function that disconnects the underlying consumer.
39
- */
40
- export function connectAssessmentToolkitRuntimeContext(host, onValue) {
41
- return connectConsumerWithProviderRetry(host, assessmentToolkitRuntimeContext, onValue);
42
- }
43
- export function connectAssessmentToolkitHostRuntimeContext(host, onValue) {
44
- return connectConsumerWithProviderRetry(host, assessmentToolkitHostRuntimeContext, onValue);
45
- }
46
- export function connectAssessmentToolkitShellContext(host, onValue) {
47
- return connectConsumerWithProviderRetry(host, assessmentToolkitShellContext, onValue);
48
- }
49
- export function connectAssessmentToolkitRegionScopeContext(host, onValue) {
50
- return connectConsumerWithProviderRetry(host, assessmentToolkitRegionScopeContext, onValue);
51
- }
@@ -1,44 +0,0 @@
1
- import type { ItemEntity } from "@pie-players/pie-players-shared";
2
- export type LoadItemOptions = {
3
- organizationId?: string | null;
4
- };
5
- export type LoadItem = (itemVId: string, opts?: LoadItemOptions) => Promise<ItemEntity>;
6
- export declare class ItemLoadError extends Error {
7
- readonly code: "ITEM_NOT_FOUND" | "NO_ITEM_BANK_OR_FETCH_CONFIG" | "FETCH_NOT_AVAILABLE" | "FETCH_FAILED";
8
- constructor(code: ItemLoadError["code"], message: string);
9
- }
10
- export type CreateLoadItemOptions = {
11
- /**
12
- * Optional in-memory item bank. Keys are itemVId.
13
- * This enables a no-backend default for demos/tests.
14
- */
15
- itemBank?: Record<string, ItemEntity>;
16
- /**
17
- * Optional base URL for an item API. If set, `createLoadItem` will fetch when
18
- * an item is not present in `itemBank`.
19
- *
20
- * Example: `https://host.example.com`
21
- */
22
- fetchBaseUrl?: string;
23
- /**
24
- * Optional endpoint builder.
25
- * Defaults to `/api/item/:itemVId` (and appends `?organizationId=...` if provided).
26
- */
27
- itemEndpoint?: string | ((itemVId: string, opts?: LoadItemOptions) => string);
28
- /**
29
- * Custom fetch implementation (useful for tests or hosts).
30
- * Defaults to `globalThis.fetch`.
31
- */
32
- fetchImpl?: typeof fetch;
33
- };
34
- export declare function createFetchItemLoader(opts: {
35
- baseUrl: string;
36
- itemEndpoint?: CreateLoadItemOptions["itemEndpoint"];
37
- fetchImpl?: typeof fetch;
38
- }): LoadItem;
39
- /**
40
- * Client-resolvable default loader:
41
- * - resolve from `itemBank` first (no backend required)
42
- * - optionally fallback to fetch (encouraged backend hook)
43
- */
44
- export declare function createLoadItem(opts: CreateLoadItemOptions): LoadItem;
@@ -1,61 +0,0 @@
1
- export class ItemLoadError extends Error {
2
- code;
3
- constructor(code, message) {
4
- super(message);
5
- this.name = "ItemLoadError";
6
- this.code = code;
7
- }
8
- }
9
- function defaultItemEndpoint(itemVId, opts) {
10
- const url = new URL(`/api/item/${itemVId}`, "https://placeholder.invalid");
11
- if (opts?.organizationId)
12
- url.searchParams.set("organizationId", opts.organizationId);
13
- return url.pathname + url.search;
14
- }
15
- export function createFetchItemLoader(opts) {
16
- const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
17
- if (!fetchImpl) {
18
- throw new ItemLoadError("FETCH_NOT_AVAILABLE", "globalThis.fetch is not available in this environment");
19
- }
20
- return async (itemVId, loadOpts) => {
21
- const endpointBuilder = typeof opts.itemEndpoint === "function"
22
- ? opts.itemEndpoint
23
- : typeof opts.itemEndpoint === "string"
24
- ? () => opts.itemEndpoint
25
- : defaultItemEndpoint;
26
- const endpoint = endpointBuilder(itemVId, loadOpts);
27
- const url = new URL(endpoint, opts.baseUrl);
28
- const res = await fetchImpl(url.toString());
29
- if (!res.ok) {
30
- throw new ItemLoadError("FETCH_FAILED", `Failed to load item ${itemVId}: ${res.status} ${res.statusText}`);
31
- }
32
- return (await res.json());
33
- };
34
- }
35
- /**
36
- * Client-resolvable default loader:
37
- * - resolve from `itemBank` first (no backend required)
38
- * - optionally fallback to fetch (encouraged backend hook)
39
- */
40
- export function createLoadItem(opts) {
41
- const itemBank = opts.itemBank;
42
- const fetchBaseUrl = opts.fetchBaseUrl;
43
- const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
44
- const fetchLoader = fetchBaseUrl && typeof fetchImpl === "function"
45
- ? createFetchItemLoader({
46
- baseUrl: fetchBaseUrl,
47
- itemEndpoint: opts.itemEndpoint,
48
- fetchImpl,
49
- })
50
- : null;
51
- return async (itemVId, loadOpts) => {
52
- if (itemBank?.[itemVId])
53
- return itemBank[itemVId];
54
- if (fetchLoader)
55
- return await fetchLoader(itemVId, loadOpts);
56
- if (fetchBaseUrl && typeof fetchImpl !== "function") {
57
- throw new ItemLoadError("FETCH_NOT_AVAILABLE", "fetchBaseUrl was provided but globalThis.fetch is not available");
58
- }
59
- throw new ItemLoadError("NO_ITEM_BANK_OR_FETCH_CONFIG", "No itemBank entry and no fetchBaseUrl configured for item loading");
60
- };
61
- }
@@ -1,29 +0,0 @@
1
- /**
2
- * Svelte context key for the tool policy engine (M8 PR 1).
3
- *
4
- * Components inside an assessment toolkit subtree consume the engine
5
- * through Svelte's native `getContext(TOOL_POLICY_ENGINE_KEY)`. The
6
- * canonical provider is the `ToolkitCoordinator` wiring (M8 PR 2):
7
- * the toolkit CE constructs a `ToolPolicyEngine`, attaches it to the
8
- * coordinator, and exposes it to descendants via
9
- * `setContext(TOOL_POLICY_ENGINE_KEY, engine)`.
10
- *
11
- * Mirrors the M7 `SECTION_RUNTIME_ENGINE_KEY` pattern. As with the
12
- * runtime engine, the key is a `Symbol` so it cannot collide with
13
- * userland context keys and so descendants are forced to import this
14
- * module rather than guess a string id.
15
- *
16
- * **No cross-CE bridge.** Unlike the runtime engine, there is no
17
- * `connectToolPolicyEngineHostContext` helper — see M8 design Q8.
18
- * Every CE in the tree gets its engine from its own coordinator
19
- * (the toolkit element). This avoids subscription-bridge overhead
20
- * for a function-style engine that hosts can simply re-call after
21
- * an input swap.
22
- *
23
- * **Stability.** This export is part of the stable `policy/engine`
24
- * surface; renaming or replacing the symbol is a major breaking
25
- * change.
26
- */
27
- import type { ToolPolicyEngine } from "./ToolPolicyEngine.js";
28
- export declare const TOOL_POLICY_ENGINE_KEY: unique symbol;
29
- export type ToolPolicyEngineContext = ToolPolicyEngine;
@@ -1,27 +0,0 @@
1
- /**
2
- * Svelte context key for the tool policy engine (M8 PR 1).
3
- *
4
- * Components inside an assessment toolkit subtree consume the engine
5
- * through Svelte's native `getContext(TOOL_POLICY_ENGINE_KEY)`. The
6
- * canonical provider is the `ToolkitCoordinator` wiring (M8 PR 2):
7
- * the toolkit CE constructs a `ToolPolicyEngine`, attaches it to the
8
- * coordinator, and exposes it to descendants via
9
- * `setContext(TOOL_POLICY_ENGINE_KEY, engine)`.
10
- *
11
- * Mirrors the M7 `SECTION_RUNTIME_ENGINE_KEY` pattern. As with the
12
- * runtime engine, the key is a `Symbol` so it cannot collide with
13
- * userland context keys and so descendants are forced to import this
14
- * module rather than guess a string id.
15
- *
16
- * **No cross-CE bridge.** Unlike the runtime engine, there is no
17
- * `connectToolPolicyEngineHostContext` helper — see M8 design Q8.
18
- * Every CE in the tree gets its engine from its own coordinator
19
- * (the toolkit element). This avoids subscription-bridge overhead
20
- * for a function-style engine that hosts can simply re-call after
21
- * an input swap.
22
- *
23
- * **Stability.** This export is part of the stable `policy/engine`
24
- * surface; renaming or replacing the symbol is a major breaking
25
- * change.
26
- */
27
- export const TOOL_POLICY_ENGINE_KEY = Symbol("@pie-players/tool-policy-engine");
@@ -1,31 +0,0 @@
1
- /**
2
- * Policy source tag — attribution for `ToolPolicyEntry.sources`.
3
- *
4
- * The engine attaches a `PolicySourceTag` to every `ToolPolicyEntry` it
5
- * emits, capturing every step from `compose-decision.ts` that contributed
6
- * to the entry being kept (or, in the case of `required-tool-blocked`,
7
- * the step that surfaced the conflict).
8
- *
9
- * Tag vocabulary maps onto the six composition steps in
10
- * `m8-design.md` § 3:
11
- *
12
- * 1. Membership filter → `"placement"`
13
- * 2. Provider veto → `"provider"` (negative; only present when
14
- * the entry survived a
15
- * non-`enabled: false` check)
16
- * 3. Host whitelist → `"policy"`
17
- * 4. Host blocklist → `"policy"` (negative)
18
- * 5. PNP/profile gates → `"pnp.${rule}"` (e.g. `"pnp.pnp-support"`,
19
- * `"pnp.item-requirement"`)
20
- * 6. Custom PolicySources → `"custom.${source.id}"`
21
- *
22
- * Negative tags do not appear on surviving entries — they are reflected
23
- * only in `ToolPolicyProvenance` decisions. The tag union therefore
24
- * tracks contributors that *kept* a tool, not contributors that
25
- * *removed* one. Diagnostic surfacing of removals is the
26
- * provenance/diagnostic channel's job.
27
- */
28
- export type PnpPolicySourceRule = "district-block" | "test-admin-override" | "item-restriction" | "item-requirement" | "district-requirement" | "pnp-support" | "pnp-prohibited";
29
- export type PnpPolicySourceTag = `pnp.${PnpPolicySourceRule}`;
30
- export type CustomPolicySourceTag = `custom.${string}`;
31
- export type PolicySourceTag = "placement" | "policy" | "provider" | PnpPolicySourceTag | CustomPolicySourceTag;
@@ -1,28 +0,0 @@
1
- /**
2
- * Policy source tag — attribution for `ToolPolicyEntry.sources`.
3
- *
4
- * The engine attaches a `PolicySourceTag` to every `ToolPolicyEntry` it
5
- * emits, capturing every step from `compose-decision.ts` that contributed
6
- * to the entry being kept (or, in the case of `required-tool-blocked`,
7
- * the step that surfaced the conflict).
8
- *
9
- * Tag vocabulary maps onto the six composition steps in
10
- * `m8-design.md` § 3:
11
- *
12
- * 1. Membership filter → `"placement"`
13
- * 2. Provider veto → `"provider"` (negative; only present when
14
- * the entry survived a
15
- * non-`enabled: false` check)
16
- * 3. Host whitelist → `"policy"`
17
- * 4. Host blocklist → `"policy"` (negative)
18
- * 5. PNP/profile gates → `"pnp.${rule}"` (e.g. `"pnp.pnp-support"`,
19
- * `"pnp.item-requirement"`)
20
- * 6. Custom PolicySources → `"custom.${source.id}"`
21
- *
22
- * Negative tags do not appear on surviving entries — they are reflected
23
- * only in `ToolPolicyProvenance` decisions. The tag union therefore
24
- * tracks contributors that *kept* a tool, not contributors that
25
- * *removed* one. Diagnostic surfacing of removals is the
26
- * provenance/diagnostic channel's job.
27
- */
28
- export {};
@@ -1,25 +0,0 @@
1
- /**
2
- * Tool policy engine — **internal** entry point (M8 PR 1).
3
- *
4
- * Re-exports the composition pipeline, the PNP policy source, and the
5
- * provenance builder for advanced hosts that want to drive the engine
6
- * components directly, and for the engine's own tests.
7
- *
8
- * **Stability posture.** This module is **not** part of the stable
9
- * public API. Symbols here are subject to change between minor
10
- * versions with only a changeset note. Hosts that need long-term
11
- * stability should depend on the facade (`ToolPolicyEngine` exported
12
- * from `./policy/engine`) instead.
13
- *
14
- * The split is intentional:
15
- * - `./policy/engine` — narrow, stable facade for common host
16
- * wiring and Svelte context.
17
- * - `./policy/internal` — wide, evolving surface for the
18
- * composition pipeline, PNP policy source, and
19
- * any host that wants to reach past the
20
- * facade.
21
- */
22
- export { composeDecision, type ComposeDecisionInputs, } from "./core/compose-decision.js";
23
- export { PnpPolicySource, type PnpPolicyApplyArgs, type PnpPolicyDecisionEvent, type PnpPolicyResult, type PnpPolicyToolFlags, } from "./sources/PnpPolicySource.js";
24
- export { ToolPolicyProvenanceBuilder } from "./core/provenance.js";
25
- export { assessmentHasPnpPolicyInputs, itemRefHasPnpPolicyInputs, resolveDefaultPnpEnforcement, } from "./core/pnp-policy-inputs.js";
@@ -1,25 +0,0 @@
1
- /**
2
- * Tool policy engine — **internal** entry point (M8 PR 1).
3
- *
4
- * Re-exports the composition pipeline, the PNP policy source, and the
5
- * provenance builder for advanced hosts that want to drive the engine
6
- * components directly, and for the engine's own tests.
7
- *
8
- * **Stability posture.** This module is **not** part of the stable
9
- * public API. Symbols here are subject to change between minor
10
- * versions with only a changeset note. Hosts that need long-term
11
- * stability should depend on the facade (`ToolPolicyEngine` exported
12
- * from `./policy/engine`) instead.
13
- *
14
- * The split is intentional:
15
- * - `./policy/engine` — narrow, stable facade for common host
16
- * wiring and Svelte context.
17
- * - `./policy/internal` — wide, evolving surface for the
18
- * composition pipeline, PNP policy source, and
19
- * any host that wants to reach past the
20
- * facade.
21
- */
22
- export { composeDecision, } from "./core/compose-decision.js";
23
- export { PnpPolicySource, } from "./sources/PnpPolicySource.js";
24
- export { ToolPolicyProvenanceBuilder } from "./core/provenance.js";
25
- export { assessmentHasPnpPolicyInputs, itemRefHasPnpPolicyInputs, resolveDefaultPnpEnforcement, } from "./core/pnp-policy-inputs.js";