@pie-players/pie-assessment-toolkit 0.3.63 → 0.3.64
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.
- package/README.md +63 -0
- package/dist/components/ItemToolBar.custom-element.js +1 -1
- package/dist/components/PieAssessmentToolkit.custom-element.js +11 -11
- package/dist/components/SectionToolBar.custom-element.js +1 -1
- package/dist/components/chunks/{ItemToolBar-843902tp.js → ItemToolBar-3cppre9r.js} +26 -26
- package/dist/components/chunks/{ItemToolBar-84nv78dy.js → ItemToolBar-7rq2gj8b.js} +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +5 -2
- package/dist/policy/core/ToolPolicyEngine.d.ts +21 -0
- package/dist/policy/core/ToolPolicyEngine.js +27 -0
- package/dist/policy/core/feature-decision.d.ts +57 -0
- package/dist/policy/core/feature-decision.js +40 -0
- package/dist/policy/engine.d.ts +1 -0
- package/dist/policy/sources/PnpPolicySource.d.ts +22 -0
- package/dist/policy/sources/PnpPolicySource.js +41 -11
- package/dist/runtime/catalog-registration.d.ts +56 -1
- package/dist/runtime/catalog-registration.js +64 -31
- package/dist/services/AccessibilityCatalogResolver.d.ts +100 -4
- package/dist/services/AccessibilityCatalogResolver.js +183 -58
- package/dist/services/SSMLExtractor.js +28 -18
- package/dist/services/TTSService.d.ts +25 -0
- package/dist/services/TTSService.js +241 -45
- package/dist/services/ToolkitCoordinator.d.ts +23 -2
- package/dist/services/ToolkitCoordinator.js +24 -0
- package/dist/services/catalog-media.d.ts +25 -0
- package/dist/services/catalog-media.js +101 -0
- package/dist/services/defaultPersonalNeedsProfile.d.ts +16 -0
- package/dist/services/defaultPersonalNeedsProfile.js +23 -0
- package/dist/services/interfaces.d.ts +29 -2
- package/dist/services/pnp-standard-features.d.ts +1 -1
- package/dist/services/sign-language-cards.d.ts +82 -0
- package/dist/services/sign-language-cards.js +133 -0
- package/dist/services/spoken-audio-cards.d.ts +54 -0
- package/dist/services/spoken-audio-cards.js +66 -0
- package/dist/services/tts/math-aware-text-processing.js +3 -3
- package/dist/services/tts/text-processing.d.ts +51 -0
- package/dist/services/tts/text-processing.js +117 -1
- package/package.json +9 -9
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
var L8=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:(Q,X)=>(typeof require<"u"?require:Q)[X]}):J)(function(J){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+J+'" is not supported')});var y9="5";if(typeof window<"u")((window.__svelte??={}).v??=new Set).add(y9);var b=2,s0=4,
|
|
1
|
+
var L8=((J)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(J,{get:(Q,X)=>(typeof require<"u"?require:Q)[X]}):J)(function(J){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+J+'" is not supported')});var y9="5";if(typeof window<"u")((window.__svelte??={}).v??=new Set).add(y9);var b=2,s0=4,PJ=8,CJ=16777216,X0=16,c=32,Y0=64,iJ=128,K0=512,k=1024,C=2048,v=4096,d=8192,g=16384,B0=32768,sJ=33554432,w0=65536,VJ=131072,w8=262144,o0=524288,h9=1048576,v0=33554432,j0=65536,IJ=2097152,R0=4194304,y0=8388608,i=Symbol("$state"),z7=Symbol("legacy props"),g9=Symbol(""),E7=Symbol("proxy path"),x7=Symbol("attributes"),q7=Symbol("class"),U7=Symbol("style"),H7=Symbol("text"),O8=Symbol("form reset"),S8=Symbol("hmr anchor"),GJ=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},A8=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");var oJ=3,C0=8;var m9=1,v9=2,N8=4,u9=8,f9=16,p9=1,_9=2,d9=4,l9=8,c9=16;var i9=1,s9=2;var aJ="[",MJ="[!",D8="[?",TJ="]",a0={};var y=Symbol("uninitialized"),O0=Symbol("filename"),o9=Symbol("hmr"),k7="http://www.w3.org/1999/xhtml",Y7="http://www.w3.org/2000/svg",j8="http://www.w3.org/1998/Math/MathML";var P=!0;var r0="font-weight: bold",n0="font-weight: normal";function a9(J){if(P)console.warn(`%c[svelte] await_reactivity_loss
|
|
2
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`,r0,n0);else console.warn("https://svelte.dev/e/await_reactivity_loss")}function r9(J,Q){if(
|
|
3
|
+
https://svelte.dev/e/await_reactivity_loss`,r0,n0);else console.warn("https://svelte.dev/e/await_reactivity_loss")}function r9(J,Q){if(P)console.warn(`%c[svelte] await_waterfall
|
|
4
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`,r0,n0);else console.warn("https://svelte.dev/e/await_waterfall")}function n9(){if(
|
|
5
|
+
https://svelte.dev/e/await_waterfall`,r0,n0);else console.warn("https://svelte.dev/e/await_waterfall")}function n9(){if(P)console.warn(`%c[svelte] derived_inert
|
|
6
6
|
%cReading a derived belonging to a now-destroyed effect may result in stale values
|
|
7
|
-
https://svelte.dev/e/derived_inert`,r0,n0);else console.warn("https://svelte.dev/e/derived_inert")}function t9(J,Q,X){if(
|
|
7
|
+
https://svelte.dev/e/derived_inert`,r0,n0);else console.warn("https://svelte.dev/e/derived_inert")}function t9(J,Q,X){if(P)console.warn(`%c[svelte] hydration_attribute_changed
|
|
8
8
|
%cThe \`${J}\` attribute on \`${Q}\` changed its value between server and client renders. The client value, \`${X}\`, will be ignored in favour of the server value
|
|
9
|
-
https://svelte.dev/e/hydration_attribute_changed`,r0,n0);else console.warn("https://svelte.dev/e/hydration_attribute_changed")}function e9(J){if(
|
|
9
|
+
https://svelte.dev/e/hydration_attribute_changed`,r0,n0);else console.warn("https://svelte.dev/e/hydration_attribute_changed")}function e9(J){if(P)console.warn(`%c[svelte] hydration_html_changed
|
|
10
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`,r0,n0);else console.warn("https://svelte.dev/e/hydration_html_changed")}function FJ(J){if(
|
|
11
|
+
https://svelte.dev/e/hydration_html_changed`,r0,n0);else console.warn("https://svelte.dev/e/hydration_html_changed")}function FJ(J){if(P)console.warn(`%c[svelte] hydration_mismatch
|
|
12
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`,r0,n0);else console.warn("https://svelte.dev/e/hydration_mismatch")}function J4(){if(
|
|
13
|
+
https://svelte.dev/e/hydration_mismatch`,r0,n0);else console.warn("https://svelte.dev/e/hydration_mismatch")}function J4(){if(P)console.warn(`%c[svelte] lifecycle_double_unmount
|
|
14
14
|
%cTried to unmount a component that was not mounted
|
|
15
|
-
https://svelte.dev/e/lifecycle_double_unmount`,r0,n0);else console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function b7(J){if(
|
|
15
|
+
https://svelte.dev/e/lifecycle_double_unmount`,r0,n0);else console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function b7(J){if(P)console.warn(`%c[svelte] state_proxy_equality_mismatch
|
|
16
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`,r0,n0);else console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function Q4(){if(
|
|
17
|
+
https://svelte.dev/e/state_proxy_equality_mismatch`,r0,n0);else console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function Q4(){if(P)console.warn(`%c[svelte] state_proxy_unmount
|
|
18
18
|
%cTried to unmount a state proxy, rather than a component
|
|
19
|
-
https://svelte.dev/e/state_proxy_unmount`,r0,n0);else console.warn("https://svelte.dev/e/state_proxy_unmount")}function X4(){if(
|
|
19
|
+
https://svelte.dev/e/state_proxy_unmount`,r0,n0);else console.warn("https://svelte.dev/e/state_proxy_unmount")}function X4(){if(P)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",r0,n0);else console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var zJ=Array.isArray,K4=Array.prototype.indexOf,LJ=Array.prototype.includes,rJ=Array.from,B7=Object.keys,n=Object.defineProperty,P0=Object.getOwnPropertyDescriptor,y7=Object.getOwnPropertyDescriptors,R8=Object.prototype,Z4=Array.prototype,EJ=Object.getPrototypeOf,C8=Object.isExtensible;var t0=()=>{};function h7(J){for(var Q=0;Q<J.length;Q++)J[Q]()}function g7(){var J,Q,X=new Promise((K,Z)=>{J=K,Q=Z});return{promise:X,resolve:J,reject:Q}}function W4(J){if(P){let Q=Error(`invariant_violation
|
|
20
20
|
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}"
|
|
21
|
-
https://svelte.dev/e/invariant_violation`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/invariant_violation")}function G4(){if(
|
|
21
|
+
https://svelte.dev/e/invariant_violation`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/invariant_violation")}function G4(){if(P){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 z4(){if(P){let J=Error(`derived_references_self
|
|
22
22
|
A derived value cannot reference itself recursively
|
|
23
|
-
https://svelte.dev/e/derived_references_self`);throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/derived_references_self")}function I8(J,Q,X){if(
|
|
23
|
+
https://svelte.dev/e/derived_references_self`);throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/derived_references_self")}function I8(J,Q,X){if(P){let K=Error(`each_key_duplicate
|
|
24
24
|
${X?`Keyed each block has duplicate key \`${X}\` at indexes ${J} and ${Q}`:`Keyed each block has duplicate key at indexes ${J} and ${Q}`}
|
|
25
|
-
https://svelte.dev/e/each_key_duplicate`);throw K.name="Svelte error",K}else throw Error("https://svelte.dev/e/each_key_duplicate")}function q4(J,Q,X){if(
|
|
25
|
+
https://svelte.dev/e/each_key_duplicate`);throw K.name="Svelte error",K}else throw Error("https://svelte.dev/e/each_key_duplicate")}function q4(J,Q,X){if(P){let K=Error(`each_key_volatile
|
|
26
26
|
Keyed each block has key that is not idempotent — the key for item at index ${J} was \`${Q}\` but is now \`${X}\`. Keys must be the same each time for a given item
|
|
27
|
-
https://svelte.dev/e/each_key_volatile`);throw K.name="Svelte error",K}else throw Error("https://svelte.dev/e/each_key_volatile")}function U4(J){if(
|
|
27
|
+
https://svelte.dev/e/each_key_volatile`);throw K.name="Svelte error",K}else throw Error("https://svelte.dev/e/each_key_volatile")}function U4(J){if(P){let Q=Error(`effect_in_teardown
|
|
28
28
|
\`${J}\` cannot be used inside an effect cleanup function
|
|
29
|
-
https://svelte.dev/e/effect_in_teardown`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/effect_in_teardown")}function H4(){if(
|
|
29
|
+
https://svelte.dev/e/effect_in_teardown`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/effect_in_teardown")}function H4(){if(P){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 Y4(J){if(P){let Q=Error(`effect_orphan
|
|
30
30
|
\`${J}\` can only be used inside an effect (e.g. during component initialisation)
|
|
31
|
-
https://svelte.dev/e/effect_orphan`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/effect_orphan")}function
|
|
31
|
+
https://svelte.dev/e/effect_orphan`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/effect_orphan")}function B4(){if(P){let J=Error(`effect_update_depth_exceeded
|
|
32
32
|
Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state
|
|
33
|
-
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
|
|
33
|
+
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 P4(){if(P){let J=Error(`hydration_failed
|
|
34
34
|
Failed to hydrate the application
|
|
35
|
-
https://svelte.dev/e/hydration_failed`);throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/hydration_failed")}function V4(J){if(
|
|
35
|
+
https://svelte.dev/e/hydration_failed`);throw J.name="Svelte error",J}else throw Error("https://svelte.dev/e/hydration_failed")}function V4(J){if(P){let Q=Error(`props_invalid_value
|
|
36
36
|
Cannot do \`bind:${J}={undefined}\` when \`${J}\` has a fallback value
|
|
37
|
-
https://svelte.dev/e/props_invalid_value`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/props_invalid_value")}function M4(J){if(
|
|
37
|
+
https://svelte.dev/e/props_invalid_value`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/props_invalid_value")}function M4(J){if(P){let Q=Error(`rune_outside_svelte
|
|
38
38
|
The \`${J}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files
|
|
39
|
-
https://svelte.dev/e/rune_outside_svelte`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/rune_outside_svelte")}function F4(){if(
|
|
39
|
+
https://svelte.dev/e/rune_outside_svelte`);throw Q.name="Svelte error",Q}else throw Error("https://svelte.dev/e/rune_outside_svelte")}function F4(){if(P){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 L4(){if(P){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 w4(){if(P){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 O4(){if(P){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 t=!1,wJ=!1,u0=!1;var D=null;function qJ(J){D=J}var e0=null;function nJ(J){e0=J}var I0=null;function m7(J){I0=J}function T8(J,Q=!1,X){if(D={p:D,i:!1,c:null,e:null,s:J,x:null,r:L,l:wJ&&!Q?{s:null,u:null,$:[]}:null},P)D.function=X,I0=X}function E8(J){var Q=D,X=Q.e;if(X!==null){Q.e=null;for(var K of X)x8(K)}if(J!==void 0)Q.x=J;if(Q.i=!0,D=Q.p,P)I0=D?.function??null;return J??{}}function f0(){return!wJ||D!==null&&D.l===null}var xJ=[];function A4(){var J=xJ;xJ=[],h7(J)}function s(J){if(xJ.length===0&&!kJ){var Q=xJ;queueMicrotask(()=>{if(Q===xJ)A4()})}xJ.push(J)}function N4(){while(xJ.length>0)A4()}var k8=new WeakMap;function v7(J){var Q=L;if(Q===null)return S.f|=y0,J;if(P&&J instanceof Error&&!k8.has(J))k8.set(J,w6(J,Q));if((Q.f&B0)===0&&(Q.f&s0)===0){if(P&&!Q.parent&&J instanceof Error)D4(J);throw J}p0(J,Q)}function p0(J,Q){if(Q!==null&&(Q.f&g)!==0)return;while(Q!==null){if((Q.f&iJ)!==0){if((Q.f&B0)===0)throw J;try{Q.b.error(J);return}catch(X){J=X}}Q=Q.parent}if(P&&J instanceof Error)D4(J);throw J}function w6(J,Q){let X=P0(J,"message");if(X&&!X.configurable)return;var K=P7?" ":"\t",Z=`
|
|
40
40
|
${K}in ${Q.fn?.name||"<unknown>"}`,W=Q.ctx;while(W!==null)Z+=`
|
|
41
41
|
${K}in ${W.function?.[O0].split("/").pop()}`,W=W.p;return{message:J.message+`
|
|
42
42
|
${Z}
|
|
43
43
|
`,stack:J.stack?.split(`
|
|
44
44
|
`).filter(($)=>!$.includes("svelte/src/internal")).join(`
|
|
45
|
-
`)}}function D4(J){let Q=k8.get(J);if(Q)n(J,"message",{value:Q.message}),n(J,"stack",{value:Q.stack})}function u7(J){return J===this.v}function f7(J,Q){return J!=J?Q==Q:J!==Q||J!==null&&typeof J==="object"||typeof J==="function"}function p7(J){return!f7(J,this.v)}var V7=null;function G0(J,Q){return J.label=Q,d7(J.v,Q),J}function d7(J,Q){return J?.[E7]?.(Q),J}function _0(J){let Q=Error(),X=
|
|
45
|
+
`)}}function D4(J){let Q=k8.get(J);if(Q)n(J,"message",{value:Q.message}),n(J,"stack",{value:Q.stack})}function u7(J){return J===this.v}function f7(J,Q){return J!=J?Q==Q:J!==Q||J!==null&&typeof J==="object"||typeof J==="function"}function p7(J){return!f7(J,this.v)}var V7=null;function G0(J,Q){return J.label=Q,d7(J.v,Q),J}function d7(J,Q){return J?.[E7]?.(Q),J}function _0(J){let Q=Error(),X=O6();if(X.length===0)return null;return X.unshift(`
|
|
46
46
|
`),n(Q,"stack",{value:X.join(`
|
|
47
|
-
`)}),n(Q,"name",{value:J}),Q}function
|
|
48
|
-
`),K=[];for(let Z=0;Z<X.length;Z++){let W=X[Z],$=W.replaceAll("\\","/");if(W.trim()==="Error")continue;if(W.includes("validate_each_keys"))return[];if($.includes("svelte/src/internal")||$.includes("node_modules/.vite"))continue;K.push(W)}return K}function R4(J,Q){if(!B)throw Error("invariant(...) was not guarded by if (DEV)");if(!J)W4(Q)}function JJ(J){var Q=S,X=L;f(null),p(null);try{return J()}finally{f(Q),p(X)}}function C4(J){let Q=0,X=q0(0),K;if(B)G0(X,"createSubscriber version");return()=>{if(OJ())I(X),e(()=>{if(Q===0)K=h(()=>J(()=>bJ(X)));return Q+=1,()=>{s(()=>{if(Q-=1,Q===0)K?.(),K=void 0,bJ(X)})}})}}var L6=~(C|v|k);function x(J,Q){J.f=J.f&L6|Q}function tJ(J){if((J.f&K0)!==0||J.deps===null)x(J,k);else x(J,v)}function I4(J){if(J===null)return;for(let Q of J){if((Q.f&b)===0||(Q.f&j0)===0)continue;Q.f^=j0,I4(Q.deps)}}function l7(J,Q,X){if((J.f&C)!==0)Q.add(J);else if((J.f&v)!==0)X.add(J);I4(J.deps),x(J,k)}var w6=w0|o0;function h8(J,Q,X,K){new g8(J,Q,X,K)}class g8{parent;is_pending=!1;transform_error;#J;#Q=w?N:null;#X;#G;#W;#$=null;#K=null;#z=null;#Z=null;#V=0;#U=0;#H=!1;#P=new Set;#M=new Set;#q=null;#w=C4(()=>{if(this.#q=q0(this.#V),B)G0(this.#q,"$effect.pending()");return()=>{this.#q=null}});constructor(J,Q,X,K){if(this.#J=J,this.#X=Q,this.#G=(Z)=>{var W=L;W.b=this,W.f|=iJ,X(Z)},this.parent=L.b,this.transform_error=K??this.parent?.transform_error??((Z)=>Z),this.#W=S0(()=>{if(w){let Z=this.#Q;l();let W=Z.data===MJ;if(Z.data.startsWith(D8)){let G=JSON.parse(Z.data.slice(D8.length));this.#O(G)}else if(W)this.#A();else this.#F()}else this.#Y()},w6),w)this.#J=N}#F(){try{this.#$=o(()=>this.#G(this.#J))}catch(J){this.error(J)}}#O(J){let Q=this.#X.failed,{reset:X,invoke_onerror:K}=this.#S(J);if(s(K),!Q)return;this.#z=o(()=>{Q(this.#J,()=>J,()=>X)})}#S(J){var Q=!1,X=!1;let K=()=>{if(Q){X4();return}if(Q=!0,X)O4();if(this.#z!==null)QJ(this.#z,()=>{this.#z=null});this.#B(()=>{this.#Y()})};return{reset:K,invoke_onerror:()=>{try{X=!0,this.#X.onerror?.(J,K),X=!1}catch(W){p0(W,this.#W&&this.#W.parent)}}}}#A(){let J=this.#X.pending;if(!J)return;this.is_pending=!0,this.#K=o(()=>J(this.#J)),s(()=>{var Q=this.#Z=document.createDocumentFragment(),X=a();if(Q.append(X),this.#$=this.#B(()=>{return o(()=>this.#G(X))}),this.#U===0)this.#J.before(Q),this.#Z=null,QJ(this.#K,()=>{this.#K=null}),this.#L(A)})}#Y(){try{if(this.is_pending=this.has_pending_snippet(),this.#U=0,this.#V=0,this.#$=o(()=>{this.#G(this.#J)}),this.#U>0){var J=this.#Z=document.createDocumentFragment();eJ(this.#$,J);let Q=this.#X.pending;this.#K=o(()=>Q(this.#J))}else this.#L(A)}catch(Q){this.error(Q)}}#L(J){this.is_pending=!1,J.transfer_effects(this.#P,this.#M)}defer_effect(J){l7(J,this.#P,this.#M)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#X.pending}#B(J){var Q=L,X=S,K=D;p(this.#W),f(this.#W),qJ(this.#W.ctx);try{return $0.ensure(),J()}catch(Z){return v7(Z),null}finally{p(Q),f(X),qJ(K)}}#N(J,Q){if(!this.has_pending_snippet()){if(this.parent)this.parent.#N(J,Q);return}if(this.#U+=J,this.#U===0){if(this.#L(Q),this.#K)QJ(this.#K,()=>{this.#K=null});if(this.#Z)this.#J.before(this.#Z),this.#Z=null}}update_pending_count(J,Q){if(this.#N(J,Q),this.#V+=J,!this.#q||this.#H)return;this.#H=!0,s(()=>{if(this.#H=!1,this.#q)d0(this.#q,this.#V)})}get_effect_pending(){return this.#w(),I(this.#q)}error(J){if(!this.#X.onerror&&!this.#X.failed)throw J;if(A?.is_fork){if(this.#$)A.skip_effect(this.#$);if(this.#K)A.skip_effect(this.#K);if(this.#z)A.skip_effect(this.#z);A.oncommit(()=>{this.#D(J)})}else this.#D(J)}#D(J){if(this.#$)m(this.#$),this.#$=null;if(this.#K)m(this.#K),this.#K=null;if(this.#z)m(this.#z),this.#z=null;if(w)E(this.#Q),y8(),E(XJ());let Q=this.#X.failed,X=(K)=>{let{reset:Z,invoke_onerror:W}=this.#S(K);if(W(),Q)this.#z=this.#B(()=>{try{return o(()=>{var $=L;$.b=this,$.f|=iJ,Q(this.#J,()=>K,()=>Z)})}catch($){return p0($,this.#W.parent),null}})};s(()=>{var K;try{K=this.transform_error(J)}catch(Z){p0(Z,this.#W&&this.#W.parent);return}if(K!==null&&typeof K==="object"&&typeof K.then==="function")K.then(X,(Z)=>p0(Z,this.#W&&this.#W.parent));else X(K)})}}function c7(J,Q,X,K){let Z=f0()?SJ:yJ;var W=J.filter((Y)=>!Y.settled),$=Q.map(Z);if(B)$.forEach((Y,V)=>{Y.label=Q[V].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(F,M)=>M)});if(X.length===0&&W.length===0){K($);return}var G=L,z=T4(),U=W.length===1?W[0].promise:W.length>1?Promise.all(W.map((Y)=>Y.promise)):null;function q(Y){if((G.f&g)!==0)return;z();try{K([...$,...Y])}catch(V){p0(V,G)}J7()}var P=m8();if(X.length===0){U.then(()=>q([])).finally(P);return}function H(){Promise.all(X.map((Y)=>u8(Y))).then(q).catch((Y)=>p0(Y,G)).finally(P)}if(U)U.then(()=>{z(),H(),J7()});else H()}function T4(){var J=L,Q=S,X=D,K=A;if(B)var Z=e0;return function($=!0){if(p(J),f(Q),qJ(X),$&&(J.f&g)===0)K?.activate(),K?.apply();if(B)v8(null),nJ(Z)}}function J7(J=!0){if(p(null),f(null),qJ(null),J)A?.deactivate();if(B)v8(null),nJ(null)}function m8(){var J=L,Q=J.b,X=A,K=!!Q?.is_rendered();return Q?.update_pending_count(1,X),X.increment(K,J),()=>{Q?.update_pending_count(-1,X),X.decrement(K,J)}}var A0=null;function v8(J){A0=J}var F7=new Set;function SJ(J){var Q=b|C;if(L!==null)L.f|=o0;let X={ctx:D,deps:null,effects:null,equals:u7,f:Q,fn:J,reactions:null,rv:0,v:y,wv:0,parent:L,ac:null};if(B&&u0)X.created=_0("created at");return X}var Q7=Symbol("obsolete");function u8(J,Q,X){let K=L;if(K===null)G4();var Z=void 0,W=q0(y);if(B)W.label=Q??J.toString();var $=!S,G=new Set;if(k4(()=>{var z=L;if(B)A0={effect:z,effect_deps:new Set,warned:!1};var U=g7();Z=U.promise;try{Promise.resolve(J()).then(U.resolve,(Y)=>{if(Y!==GJ)U.reject(Y)}).finally(J7)}catch(Y){U.reject(Y),J7()}if(B){if(A0){if(z.deps!==null)for(let Y=0;Y<V0;Y+=1)A0.effect_deps.add(z.deps[Y]);if(J0!==null)for(let Y=0;Y<J0.length;Y+=1)A0.effect_deps.add(J0[Y])}A0=null}var q=A;if($){if((z.f&Y0)!==0)var P=m8();if(K.b?.is_rendered())q.async_deriveds.get(z)?.reject(Q7);else for(let Y of G.values())Y.reject(Q7);G.add(U),q.async_deriveds.set(z,U)}let H=(Y,V=void 0)=>{if(B)A0=null;if(P?.(),G.delete(U),V===Q7)return;if(q.activate(),V)W.f|=y0,d0(W,V);else{if((W.f&y0)!==0)W.f^=y0;if(B&&X!==void 0&&!W.equals(Y))F7.add(W),setTimeout(()=>{if(F7.has(W)&&(z.f&g)===0)r9(W.label,X),F7.delete(W)});d0(W,Y)}q.deactivate()};U.promise.then(H,(Y)=>H(null,Y||"unknown"))}),z0(()=>{for(let z of G)z.reject(Q7)}),B)W.f|=R0;return new Promise((z)=>{function U(q){function P(){if(q===Z)z(W);else U(Z)}q.then(P,P)}U(Z)})}function S6(J){let Q=SJ(J);if(!t)o7(Q);return Q}function yJ(J){let Q=SJ(J);return Q.equals=p7,Q}function E4(J){var Q=J.effects;if(Q!==null){J.effects=null;for(var X=0;X<Q.length;X+=1)m(Q[X])}}var f8=[];function L7(J){var Q,X=L,K=J.parent;if(!T0&&K!==null&&J.v!==y&&(K.f&(g|d))!==0)return n9(),J.v;if(p(K),B){let Z=hJ;i7(new Set);try{if(LJ.call(f8,J))z4();f8.push(J),J.f&=~j0,E4(J),Q=s7(J)}finally{p(X),i7(Z),f8.pop()}}else try{J.f&=~j0,E4(J),Q=s7(J)}finally{p(X)}return Q}function p8(J){var Q=L7(J);if(!J.equals(Q)){if(J.wv=X7(),!A?.is_fork||J.deps===null){if(A!==null)A.capture(J,Q,!0),AJ?.capture(J,Q,!0);else J.v=Q;if(J.deps===null){x(J,k);return}}}if(T0)return;if(Q0!==null){if(OJ()||A?.is_fork)Q0.set(J,Q)}else tJ(J)}function x4(J){if(J.effects===null)return;for(let Q of J.effects)if(Q.teardown||Q.ac){if(Q.teardown?.(),Q.ac!==null)JJ(()=>{Q.ac.abort(GJ),Q.ac=null});if(Q.fn!==null)Q.teardown=t0;gJ(Q,0),w7(Q)}}function _8(J){if(J.effects===null)return;for(let Q of J.effects)if(Q.teardown&&Q.fn!==null)KJ(Q)}var hJ=new Set,UJ=new Map;function i7(J){hJ=J}var d8=!1;function b4(){d8=!0}function q0(J,Q){var X={f:0,v:J,reactions:null,equals:u7,rv:0,wv:0};if(B&&u0)X.created=Q??_0("created at"),X.updated=null,X.set_during_effect=!1,X.trace=null;return X}function ZJ(J,Q){let X=q0(J,Q);return o7(X),X}function mJ(J,Q=!1,X=!0){let K=q0(J);if(!Q)K.equals=p7;if(wJ&&X&&D!==null&&D.l!==null)(D.l.s??=[]).push(K);return K}function U0(J,Q,X=!1){if(S!==null&&(!M0||(S.f&VJ)!==0)&&f0()&&(S.f&(b|X0|R0|VJ))!==0&&(l0===null||!l0.has(J)))w4();let K=X?HJ(Q):Q;if(B)d7(K,J.label);return d0(J,K,O7)}function d0(J,Q,X=null){if(!J.equals(Q)){UJ.set(J,T0?Q:J.v);var K=$0.ensure();if(K.capture(J,Q),B){if(u0||L!==null){J.updated??=new Map;let Z=(J.updated.get("")?.count??0)+1;if(J.updated.set("",{error:null,count:Z}),u0||Z>5){let W=_0("updated at");if(W!==null){let $=J.updated.get(W.stack);if(!$)$={error:W,count:0},J.updated.set(W.stack,$);$.count++}}}if(L!==null)J.set_during_effect=!0}if((J.f&b)!==0){let Z=J;if((J.f&C)!==0)L7(Z);if(Q0===null)tJ(Z)}if(J.wv=X7(),y4(J,C,X),f0()&&L!==null&&(L.f&k)!==0&&(L.f&(c|P0))===0)if(E0===null)h4([J]);else E0.push(J);if(!K.is_fork&&hJ.size>0&&!d8)a7()}return Q}function a7(){d8=!1;for(let J of hJ){if((J.f&k)!==0)x(J,v);let Q;try{Q=NJ(J)}catch{Q=!0}if(Q)KJ(J)}hJ.clear()}function bJ(J){U0(J,J.v+1)}function y4(J,Q,X){var K=J.reactions;if(K===null)return;var Z=f0(),W=K.length;for(var $=0;$<W;$++){var G=K[$],z=G.f;if(!Z&&G===L)continue;var U=(z&C)===0;if(U)x(G,Q);if((z&VJ)!==0)hJ.add(G);else if((z&b)!==0){var q=G;if(Q0?.delete(q),(z&j0)===0){if(z&K0&&(L===null||(L.f&IJ)===0))G.f|=j0;y4(q,v,X)}}else if(U){var P=G;if((z&X0)!==0&&h0!==null)h0.add(P);if(X!==null)X.push(P);else S7(P)}}}var g4=!1,r7=!1,qK=Symbol("unmounted");function l8(J){var Q=r7;try{return r7=!1,[J(),r7]}finally{r7=Q}}var n7=null,K7=null,A=null,AJ=null,Q0=null,s8=null,kJ=!1,c8=!1,vJ=null,O7=null,m4=0,i8=new Set,D6=1;class $0{id=D6++;#J=!1;linked=!0;#Q=null;#X=null;async_deriveds=new Map;current=new Map;previous=new Map;#G=new Set;#W=new Set;#$=0;#K=new Map;#z=null;#Z=[];#V=[];#U=new Set;#H=new Set;#P=new Map;#M=new Set;is_fork=!1;#q=!1;constructor(){if(K7===null)n7=K7=this;else K7.#X=this,this.#Q=K7;K7=this}#w(){if(this.is_fork)return!0;for(let X of this.#K.keys()){var J=X,Q=!1;while(J.parent!==null){if(this.#P.has(J)){Q=!0;break}J=J.parent}if(!Q)return!0}return!1}skip_effect(J){if(!this.#P.has(J))this.#P.set(J,{d:[],m:[]});this.#M.delete(J)}unskip_effect(J,Q=(X)=>this.schedule(X)){var X=this.#P.get(J);if(X){this.#P.delete(J);for(var K of X.d)x(K,C),Q(K);for(K of X.m)x(K,v),Q(K)}this.#M.add(J)}#F(){if(this.#J=!0,m4++>1000)this.#B(),j6();if(B)for(let G of this.current.keys())i8.add(G);for(let G of this.#U)this.#H.delete(G),x(G,C),this.schedule(G);for(let G of this.#H)x(G,v),this.schedule(G);let J=this.#Z;this.#Z=[],this.apply();var Q=vJ=[],X=[],K=O7=[];for(let G of J)try{this.#O(G,Q,X)}catch(z){if(p4(G),!this.#w())this.discard();throw z}if(A=null,K.length>0){var Z=$0.ensure();for(let G of K)Z.schedule(G)}if(vJ=null,O7=null,this.#w()){this.#Y(X),this.#Y(Q);for(let[G,z]of this.#P)f4(G,z);if(K.length>0)A.#F();return}let W=this.#S();if(W){this.#Y(X),this.#Y(Q),W.#A(this);return}this.#U.clear(),this.#H.clear();for(let G of this.#G)G(this);this.#G.clear(),AJ=this,v4(X),v4(Q),AJ=null,this.#z?.resolve();var $=A;if(this.#$===0&&(this.#Z.length===0||$!==null)){if(this.#B(),t)this.#L(),A=$}if(this.#Z.length>0)if($!==null){let G=$;G.#Z.push(...this.#Z.filter((z)=>!G.#Z.includes(z)))}else $=this;if($!==null)$.#F()}#O(J,Q,X){J.f^=k;var K=J.first;while(K!==null){var Z=K.f,W=(Z&(c|P0))!==0,$=W&&(Z&k)!==0,G=$||(Z&d)!==0||this.#P.has(K);if(!G&&K.fn!==null){if(W)K.f^=k;else if((Z&s0)!==0)Q.push(K);else if(t&&(Z&(BJ|CJ))!==0)X.push(K);else if(NJ(K)){if((Z&X0)!==0)this.#H.add(K);KJ(K)}var z=K.first;if(z!==null){K=z;continue}}while(K!==null){var U=K.next;if(U!==null){K=U;break}K=K.parent}}}#S(){var J=this.#Q;while(J!==null){if(!J.is_fork){for(let[Q,[,X]]of this.current)if(J.current.has(Q)&&!X)return J}J=J.#Q}return null}#A(J){for(let[X,K]of J.current){if(!this.previous.has(X)&&J.previous.has(X))this.previous.set(X,J.previous.get(X));this.current.set(X,K)}for(let[X,K]of J.async_deriveds){let Z=this.async_deriveds.get(X);if(Z)K.promise.then(Z.resolve).catch(Z.reject)}J.async_deriveds.clear(),this.transfer_effects(J.#U,J.#H);let Q=(X)=>{var K=X.reactions;if(K===null)return;if((X.f&b)!==0&&(X.f&(C|v))===0)return;for(let $ of K){var Z=$.f;if((Z&b)!==0)Q($);else{var W=$;if(Z&(R0|X0)&&!this.async_deriveds.has(W))this.#H.delete(W),x(W,C),this.schedule(W)}}};for(let X of this.current.keys())Q(X);this.oncommit(()=>J.discard()),J.#B(),A=this,this.#F()}#Y(J){for(var Q=0;Q<J.length;Q+=1)l7(J[Q],this.#U,this.#H)}capture(J,Q,X=!1){if(J.v!==y&&!this.previous.has(J))this.previous.set(J,J.v);if((J.f&y0)===0)this.current.set(J,[Q,X]),Q0?.set(J,Q);if(!this.is_fork)J.v=Q}activate(){A=this}deactivate(){A=null,Q0=null}flush(){try{if(B)i8.clear();c8=!0,A=this,this.#F()}finally{if(m4=0,s8=null,vJ=null,O7=null,c8=!1,A=null,Q0=null,UJ.clear(),B)for(let J of i8)J.updated=null}}discard(){for(let J of this.#W)J(this);this.#W.clear();for(let J of this.async_deriveds.values())J.reject(Q7);this.#B(),this.#z?.resolve()}register_created_effect(J){this.#V.push(J)}#L(){for(let q=n7;q!==null;q=q.#X){var J=q.id<this.id,Q=[];for(let[P,[H,Y]]of this.current){if(q.current.has(P)){var X=q.current.get(P)[0];if(J&&H!==X)q.current.set(P,[H,Y]);else continue}Q.push(P)}if(J)for(let[P,H]of this.async_deriveds){let Y=q.async_deriveds.get(P);if(Y)H.promise.then(Y.resolve).catch(Y.reject)}var K=[...q.current.keys()].filter((P)=>!q.current.get(P)[1]);if(!q.#J||K.length===0)continue;var Z=K.filter((P)=>!this.current.has(P));if(Z.length===0){if(J)q.discard()}else if(Q.length>0){if(B&&!q.#q)R4(q.#Z.length===0,"Batch has scheduled roots");if(J)for(let P of this.#M)q.unskip_effect(P,(H)=>{if((H.f&(X0|R0))!==0)q.schedule(H);else q.#Y([H])});q.activate();var W=new Set,$=new Map;for(var G of Q)u4(G,Z,W,$);$=new Map;var z=[...q.current].filter(([P,H])=>{let Y=this.current.get(P);if(!Y)return!0;return Y[0]!==H[0]||Y[1]!==H[1]}).map(([P])=>P);if(z.length>0){for(let P of this.#V)if((P.f&(g|d|VJ))===0&&o8(P,z,$))if((P.f&(R0|X0))!==0)x(P,C),q.schedule(P);else q.#U.add(P)}if(q.#Z.length>0&&!q.#q){q.apply();for(var U of q.#Z)q.#O(U,[],[]);q.#Z=[]}q.deactivate()}}}increment(J,Q){if(this.#$+=1,J){let X=this.#K.get(Q)??0;this.#K.set(Q,X+1)}}decrement(J,Q){if(this.#$-=1,J){let X=this.#K.get(Q)??0;if(X===1)this.#K.delete(Q);else this.#K.set(Q,X-1)}if(this.#q)return;this.#q=!0,s(()=>{if(this.#q=!1,this.linked)this.flush()})}transfer_effects(J,Q){for(let X of J)this.#U.add(X);for(let X of Q)this.#H.add(X);J.clear(),Q.clear()}oncommit(J){this.#G.add(J)}ondiscard(J){this.#W.add(J)}settled(){return(this.#z??=g7()).promise}static ensure(){if(A===null){let J=A=new $0;if(!c8&&!kJ)s(()=>{if(!J.#J)J.flush()})}return A}apply(){if(!t||!this.is_fork&&this.#Q===null&&this.#X===null){Q0=null;return}Q0=new Map;for(let[Q,[X]]of this.current)Q0.set(Q,X);for(let Q=n7;Q!==null;Q=Q.#X){if(Q===this||Q.is_fork)continue;var J=!1;if(Q.id<this.id)for(let[X,[,K]]of Q.current){if(K)continue;if(this.current.has(X)){J=!0;break}}if(!J){for(let[X,K]of Q.previous)if(!Q0.has(X))Q0.set(X,K)}}}schedule(J){if(s8=J,J.b?.is_pending&&(J.f&(s0|BJ|CJ))!==0&&(J.f&Y0)===0){J.b.defer_effect(J);return}var Q=J;while(Q.parent!==null){Q=Q.parent;var X=Q.f;if(vJ!==null&&Q===L){if(t)return;if((S===null||(S.f&b)===0)&&!g4)return}if((X&(P0|c))!==0){if((X&k)===0)return;Q.f^=k}}this.#Z.push(Q)}#B(){if(!this.linked)return;var J=this.#Q,Q=this.#X;if(J===null)n7=Q;else J.#X=Q;if(Q===null)K7=J;else Q.#Q=J;this.linked=!1}}function Z7(J){var Q=kJ;kJ=!0;try{var X;if(J){if(A!==null&&!A.is_fork)A.flush();X=J()}while(!0){if(N4(),A===null)return X;A.flush()}}finally{kJ=Q}}function j6(){if(B){var J=new Map;for(let X of A.current.keys())for(let[K,Z]of X.updated??[]){var Q=J.get(K);if(!Q)Q={error:Z.error,count:0},J.set(K,Q);Q.count+=Z.count}for(let X of J.values())if(X.error)console.error(X.error)}try{Y4()}catch(X){if(B)n(X,"stack",{value:""});p0(X,s8)}}var h0=null;function v4(J){var Q=J.length;if(Q===0)return;var X=0;while(X<Q){var K=J[X++];if((K.f&(g|d))===0&&NJ(K)){if(h0=new Set,KJ(K),K.deps===null&&K.first===null&&K.nodes===null&&K.teardown===null&&K.ac===null)a8(K);if(h0?.size>0){UJ.clear();for(let Z of h0){if((Z.f&(g|d))!==0)continue;let W=[Z],$=Z.parent;while($!==null){if(h0.has($))h0.delete($),W.push($);$=$.parent}for(let G=W.length-1;G>=0;G--){let z=W[G];if((z.f&(g|d))!==0)continue;KJ(z)}}h0.clear()}}}h0=null}function u4(J,Q,X,K){if(X.has(J))return;if(X.add(J),J.reactions!==null)for(let Z of J.reactions){let W=Z.f;if((W&b)!==0)u4(Z,Q,X,K);else if((W&(R0|X0))!==0&&(W&C)===0&&o8(Z,Q,K))x(Z,C),S7(Z)}}function o8(J,Q,X){let K=X.get(J);if(K!==void 0)return K;if(J.deps!==null)for(let Z of J.deps){if(LJ.call(Q,Z))return!0;if((Z.f&b)!==0&&o8(Z,Q,X))return X.set(Z,!0),!0}return X.set(J,!1),!1}function S7(J){A.schedule(J)}function f4(J,Q){if((J.f&c)!==0&&(J.f&k)!==0)return;if((J.f&C)!==0)Q.d.push(J);else if((J.f&v)!==0)Q.m.push(J);x(J,k);var X=J.first;while(X!==null)f4(X,Q),X=X.next}function p4(J){x(J,k);var Q=J.first;while(Q!==null)p4(Q),Q=Q.next}function d4(J){if(L===null){if(S===null)P4(J);H4()}if(T0)U4(J)}function C6(J,Q){var X=Q.last;if(X===null)Q.last=Q.first=J;else X.next=J,J.prev=X,Q.last=J}function WJ(J,Q){var X=L;if(B)while(X!==null&&(X.f&VJ)!==0)X=X.parent;if(X!==null&&(X.f&d)!==0)J|=d;var K={ctx:D,deps:null,nodes:null,f:J|C|K0,first:null,fn:Q,last:null,next:null,parent:X,b:X&&X.b,prev:null,teardown:null,wv:0,ac:null};if(B)K.component_function=I0;A?.register_created_effect(K);var Z=K;if((J&s0)!==0)if(vJ!==null)vJ.push(K);else $0.ensure().schedule(K);else if(Q!==null){try{KJ(K)}catch($){throw m(K),$}if(Z.deps===null&&Z.teardown===null&&Z.nodes===null&&Z.first===Z.last&&(Z.f&o0)===0){if(Z=Z.first,(J&X0)!==0&&(J&w0)!==0&&Z!==null)Z.f|=w0}}if(Z!==null){if(Z.parent=X,X!==null)C6(Z,X);if(S!==null&&(S.f&b)!==0&&(J&P0)===0){var W=S;(W.effects??=[]).push(Z)}}return K}function OJ(){return S!==null&&!M0}function z0(J){let Q=WJ(BJ,null);return x(Q,k),Q.teardown=J,Q}function n8(J){if(d4("$effect"),B)n(J,"name",{value:"$effect"});var Q=L.f,X=!S&&(Q&c)!==0&&D!==null&&!D.i;if(X){var K=D;(K.e??=[]).push(J)}else return x8(J)}function x8(J){return WJ(s0|h9,J)}function t8(J){$0.ensure();let Q=WJ(P0|o0,J);return()=>{m(Q)}}function l4(J){$0.ensure();let Q=WJ(P0|o0,J);return(X={})=>{return new Promise((K)=>{if(X.outro)QJ(Q,()=>{m(Q),K(void 0)});else m(Q),K(void 0)})}}function F0(J){return WJ(s0,J)}function k4(J){return WJ(R0|o0,J)}function e(J,Q=0){return WJ(BJ|Q,J)}function e8(J,Q=[],X=[],K=[]){c7(K,Q,X,(Z)=>{WJ(BJ,()=>{J(...Z.map(I))})})}function S0(J,Q=0){var X=WJ(X0|Q,J);if(B)X.dev_stack=e0;return X}function o(J){return WJ(c|o0,J)}function J9(J){var Q=J.teardown;if(Q!==null){let X=T0,K=S;r8(!0),f(null);try{Q.call(null)}finally{r8(X),f(K)}}}function w7(J,Q=!1){var X=J.first;J.first=J.last=null;while(X!==null){let Z=X.ac;if(Z!==null)JJ(()=>{Z.abort(GJ)});var K=X.next;if((X.f&P0)!==0)X.parent=null;else m(X,Q);X=K}}function c4(J){var Q=J.first;while(Q!==null){var X=Q.next;if((Q.f&c)===0)m(Q);Q=X}}function m(J,Q=!0){var X=!1;if((Q||(J.f&w8)!==0)&&J.nodes!==null&&J.nodes.end!==null)Q9(J.nodes.start,J.nodes.end),X=!0;J.f|=sJ,w7(J,Q&&!X),gJ(J,0);var K=J.nodes&&J.nodes.t;if(K!==null)for(let W of K)W.stop();J9(J),J.f^=sJ,J.f|=g;var Z=J.parent;if(Z!==null&&Z.first!==null)a8(J);if(B)J.component_function=null;J.next=J.prev=J.teardown=J.ctx=J.deps=J.fn=J.nodes=J.ac=J.b=null}function Q9(J,Q){while(J!==null){var X=J===Q?null:r(J);J.remove(),J=X}}function a8(J){var{parent:Q,prev:X,next:K}=J;if(X!==null)X.next=K;if(K!==null)K.prev=X;if(Q!==null){if(Q.first===J)Q.first=K;if(Q.last===J)Q.last=X}}function QJ(J,Q,X=!0){var K=[];i4(J,K,!0);var Z=()=>{if(X)m(J);if(Q)Q()},W=K.length;if(W>0){var $=()=>--W||Z();for(var G of K)G.out($)}else Z()}function i4(J,Q,X){if((J.f&d)!==0)return;J.f^=d;var K=J.nodes&&J.nodes.t;if(K!==null){for(let G of K)if(G.is_global||X)Q.push(G)}var Z=J.first;while(Z!==null){var W=Z.next;if((Z.f&P0)===0){var $=(Z.f&w0)!==0||(Z.f&c)!==0&&(J.f&X0)!==0;i4(Z,Q,$?X:!1)}Z=W}}function W7(J){s4(J,!0)}function s4(J,Q){if((J.f&d)===0)return;if(J.f^=d,(J.f&k)===0)x(J,C),$0.ensure().schedule(J);var X=J.first;while(X!==null){var K=X.next,Z=(X.f&w0)!==0||(X.f&c)!==0;s4(X,Z?Q:!1),X=K}var W=J.nodes&&J.nodes.t;if(W!==null){for(let $ of W)if($.is_global||Q)$.in()}}function eJ(J,Q){if(!J.nodes)return;var X=J.nodes.start,K=J.nodes.end;while(X!==null){var Z=X===K?null:r(X);Q.append(X),X=Z}}var o4=null;var t7=!1,T0=!1;function r8(J){T0=J}var S=null,M0=!1;function f(J){S=J}var L=null;function p(J){L=J}var l0=null;function o7(J){if(S!==null&&(!t||(S.f&b)!==0))(l0??=new Set).add(J)}var J0=null,V0=0,E0=null;function h4(J){E0=J}var a4=1,uJ=0,DJ=uJ;function X9(J){DJ=J}function X7(){return++a4}function NJ(J){var Q=J.f;if((Q&C)!==0)return!0;if(Q&b)J.f&=~j0;if((Q&v)!==0){var X=J.deps,K=X.length;for(var Z=0;Z<K;Z++){var W=X[Z];if(NJ(W))p8(W);if(W.wv>J.wv)return!0}if((Q&K0)!==0&&Q0===null)x(J,k)}return!1}function r4(J,Q,X=!0){var K=J.reactions;if(K===null)return;if(!t&&l0!==null&&l0.has(J))return;for(var Z=0;Z<K.length;Z++){var W=K[Z];if((W.f&b)!==0)r4(W,Q,!1);else if(Q===W){if(X)x(W,C);else if((W.f&k)!==0)x(W,v);S7(W)}}}function s7(J){var Q=J0,X=V0,K=E0,Z=S,W=l0,$=D,G=M0,z=DJ,U=J.f;if(J0=null,V0=0,E0=null,S=(U&(c|P0))===0?J:null,l0=null,qJ(J.ctx),M0=!1,DJ=++uJ,J.ac!==null)JJ(()=>{J.ac.abort(GJ)}),J.ac=null;try{J.f|=IJ;var q=J.fn,P=q();J.f|=Y0;var H=J.deps,Y=A?.is_fork;if(J0!==null){var V;if(!Y)gJ(J,V0);if(H!==null&&V0>0){H.length=V0+J0.length;for(V=0;V<J0.length;V++)H[V0+V]=J0[V]}else J.deps=H=J0;if(OJ()&&(J.f&K0)!==0)for(V=V0;V<H.length;V++)(H[V].reactions??=[]).push(J)}else if(!Y&&H!==null&&V0<H.length)gJ(J,V0),H.length=V0;if(f0()&&E0!==null&&!M0&&H!==null&&(J.f&(b|v|C))===0)for(V=0;V<E0.length;V++)r4(E0[V],J);if(Z!==null&&Z!==J){if(uJ++,Z.deps!==null)for(let F=0;F<X;F+=1)Z.deps[F].rv=uJ;if(Q!==null)for(let F of Q)F.rv=uJ;if(E0!==null)if(K===null)K=E0;else K.push(...E0)}if((J.f&y0)!==0)J.f^=y0;return P}catch(F){return v7(F)}finally{J.f^=IJ,J0=Q,V0=X,E0=K,S=Z,l0=W,qJ($),M0=G,DJ=z}}function I6(J,Q){let X=Q.reactions;if(X!==null){var K=K4.call(X,J);if(K!==-1){var Z=X.length-1;if(Z===0)X=Q.reactions=null;else X[K]=X[Z],X.pop()}}if(X===null&&(Q.f&b)!==0&&(J0===null||!LJ.call(J0,Q))){var W=Q;if((W.f&K0)!==0)W.f^=K0,W.f&=~j0;if(W.v!==y)tJ(W);if(W.ac!==null)JJ(()=>{W.ac.abort(GJ),W.ac=null,x(W,C)});x4(W),gJ(W,0)}}function gJ(J,Q){var X=J.deps;if(X===null)return;for(var K=Q;K<X.length;K++)I6(J,X[K])}function KJ(J){var Q=J.f;if((Q&g)!==0)return;x(J,k);var X=L,K=t7;if(L=J,t7=(Q&(c|P0))===0,B){var Z=I0;m7(J.component_function);var W=e0;nJ(J.dev_stack??e0)}try{if((Q&(X0|CJ))!==0)c4(J);else w7(J);J9(J);var $=s7(J);if(J.teardown=typeof $==="function"?$:null,J.wv=a4,B&&u0&&(J.f&C)!==0&&J.deps!==null){for(var G of J.deps)if(G.set_during_effect)G.wv=X7(),G.set_during_effect=!1}}finally{if(t7=K,L=X,B)m7(Z),nJ(W)}}function I(J){var Q=J.f,X=(Q&b)!==0;if(o4?.add(J),S!==null&&!M0){var K=L!==null&&(L.f&g)!==0;if(!K&&(l0===null||!l0.has(J))){var Z=S.deps;if((S.f&IJ)!==0){if(J.rv<uJ)if(J.rv=uJ,J0===null&&Z!==null&&Z[V0]===J)V0++;else if(J0===null)J0=[J];else J0.push(J)}else{if(S.deps??=[],!LJ.call(S.deps,J))S.deps.push(J);var W=J.reactions;if(W===null)J.reactions=[S];else if(!LJ.call(W,S))W.push(S)}}}if(B){if(!M0&&A0&&A===null&&AJ===null&&!A0.warned&&(A0.effect.f&IJ)===0&&!A0.effect_deps.has(J)){A0.warned=!0,a9(J.label);var $=_0("traced at");if($)console.warn($)}if(F7.delete(J),u0&&!M0&&V7!==null&&S!==null&&V7.reaction===S){if(J.trace)J.trace();else if($=_0("traced at"),$){var G=V7.entries.get(J);if(G===void 0)G={traces:[]},V7.entries.set(J,G);var z=G.traces[G.traces.length-1];if($.stack!==z?.stack)G.traces.push($)}}}if(T0&&UJ.has(J))return UJ.get(J);if(X){var U=J;if(T0){var q=U.v;if((U.f&k)===0&&U.reactions!==null||t4(U))q=L7(U);return UJ.set(U,q),q}var P=(U.f&K0)===0&&!M0&&S!==null&&(t7||(S.f&K0)!==0),H=(U.f&Y0)===0;if(NJ(U)){if(P)U.f|=K0;p8(U)}if(P&&!H)_8(U),n4(U)}if(Q0?.has(J))return Q0.get(J);if((J.f&y0)!==0)throw J.v;return J.v}function n4(J){if(J.f|=K0,J.deps===null)return;for(let Q of J.deps)if((Q.reactions??=[]).push(J),(Q.f&b)!==0&&(Q.f&K0)===0)_8(Q),n4(Q)}function t4(J){if(J.v===y)return!0;if(J.deps===null)return!1;for(let Q of J.deps){if(UJ.has(Q))return!0;if((Q.f&b)!==0&&t4(Q))return!0}return!1}function h(J){var Q=M0;try{return M0=!0,J()}finally{M0=Q}}function J8(J){if(typeof J!=="object"||!J||J instanceof EventTarget)return;if(i in J)e7(J);else if(!Array.isArray(J))for(let Q in J){let X=J[Q];if(typeof X==="object"&&X&&i in X)e7(X)}}function e7(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 K in J)try{e7(J[K],Q)}catch(Z){}let X=EJ(J);if(X!==Object.prototype&&X!==Array.prototype&&X!==Map.prototype&&X!==Set.prototype&&X!==Date.prototype){let K=y7(X);for(let Z in K){let W=K[Z].get;if(W)try{W.call(J)}catch($){}}}}}var T6=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function HJ(J){if(typeof J!=="object"||J===null||i in J)return J;let Q=EJ(J);if(Q!==R8&&Q!==Z4)return J;var X=new Map,K=zJ(J),Z=ZJ(0),W=B&&u0?_0("created at"):null,$=DJ,G=(P)=>{if(DJ===$)return P();var H=S,Y=DJ;f(null),X9($);var V=P();return f(H),X9(Y),V};if(K){if(X.set("length",ZJ(J.length,W)),B)J=x6(J)}var z="";let U=!1;function q(P){if(U)return;U=!0,z=P,G0(Z,`${z} version`);for(let[H,Y]of X)G0(Y,fJ(z,H));U=!1}return new Proxy(J,{defineProperty(P,H,Y){if(!("value"in Y)||Y.configurable===!1||Y.enumerable===!1||Y.writable===!1)F4();var V=X.get(H);if(V===void 0)G(()=>{var F=ZJ(Y.value,W);if(X.set(H,F),B&&typeof H==="string")G0(F,fJ(z,H));return F});else U0(V,Y.value,!0);return!0},deleteProperty(P,H){var Y=X.get(H);if(Y===void 0){if(H in P){let V=G(()=>ZJ(y,W));if(X.set(H,V),bJ(Z),B)G0(V,fJ(z,H))}}else U0(Y,y),bJ(Z);return!0},get(P,H,Y){if(H===i)return J;if(B&&H===E7)return q;var V=X.get(H),F=H in P;if(V===void 0&&(!F||B0(P,H)?.writable))V=G(()=>{var O=HJ(F?P[H]:y),j=ZJ(O,W);if(B)G0(j,fJ(z,H));return j}),X.set(H,V);if(V!==void 0){var M=I(V);return M===y?void 0:M}return Reflect.get(P,H,Y)},getOwnPropertyDescriptor(P,H){var Y=Reflect.getOwnPropertyDescriptor(P,H);if(Y&&"value"in Y){var V=X.get(H);if(V)Y.value=I(V)}else if(Y===void 0){var F=X.get(H),M=F?.v;if(F!==void 0&&M!==y)return{enumerable:!0,configurable:!0,value:M,writable:!0}}return Y},has(P,H){if(H===i)return!0;var Y=X.get(H),V=Y!==void 0&&Y.v!==y||Reflect.has(P,H);if(Y!==void 0||L!==null&&(!V||B0(P,H)?.writable)){if(Y===void 0)Y=G(()=>{var M=V?HJ(P[H]):y,O=ZJ(M,W);if(B)G0(O,fJ(z,H));return O}),X.set(H,Y);var F=I(Y);if(F===y)return!1}return V},set(P,H,Y,V){var F=X.get(H),M=H in P;if(K&&H==="length")for(var O=Y;O<F.v;O+=1){var j=X.get(O+"");if(j!==void 0)U0(j,y);else if(O in P){if(j=G(()=>ZJ(y,W)),X.set(O+"",j),B)G0(j,fJ(z,O))}}if(F===void 0){if(!M||B0(P,H)?.writable){if(F=G(()=>ZJ(void 0,W)),B)G0(F,fJ(z,H));U0(F,HJ(Y)),X.set(H,F)}}else{M=F.v!==y;var T=G(()=>HJ(Y));U0(F,T)}var R=Reflect.getOwnPropertyDescriptor(P,H);if(R?.set)R.set.call(V,Y);if(!M){if(K&&typeof H==="string"){var b0=X.get("length"),H0=Number(H);if(Number.isInteger(H0)&&H0>=b0.v)U0(b0,H0+1)}bJ(Z)}return!0},ownKeys(P){I(Z);var H=Reflect.ownKeys(P).filter((F)=>{var M=X.get(F);return M===void 0||M.v!==y});for(var[Y,V]of X)if(V.v!==y&&!(Y in P))H.push(Y);return H},setPrototypeOf(){L4()}})}function fJ(J,Q){if(typeof Q==="symbol")return`${J}[Symbol(${Q.description??""})]`;if(T6.test(Q))return`${J}.${Q}`;return/^\d+$/.test(Q)?`${J}[${Q}]`:`${J}['${Q}']`}function Q8(J){try{if(J!==null&&typeof J==="object"&&i in J)return J[i]}catch{}return J}var E6=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function x6(J){return new Proxy(J,{get(Q,X,K){var Z=Reflect.get(Q,X,K);if(!E6.has(X))return Z;return function(...W){b4();var $=Z.apply(this,W);return a7(),$}}})}function e4(){let{prototype:J,__svelte_cleanup:Q}=Array;if(Q)Q();let{indexOf:X,lastIndexOf:K,includes:Z}=J;J.indexOf=function(W,$){let G=X.call(this,W,$);if(G===-1){for(let z=$??0;z<this.length;z+=1)if(Q8(this[z])===W){b7("array.indexOf(...)");break}}return G},J.lastIndexOf=function(W,$){let G=K.call(this,W,$??this.length-1);if(G===-1){for(let z=0;z<=($??this.length-1);z+=1)if(Q8(this[z])===W){b7("array.lastIndexOf(...)");break}}return G},J.includes=function(W,$){let G=Z.call(this,W,$);if(!G){for(let z=0;z<this.length;z+=1)if(Q8(this[z])===W){b7("array.includes(...)");break}}return G},Array.__svelte_cleanup=()=>{J.indexOf=X,J.lastIndexOf=K,J.includes=Z}}var K9,JQ,B7,QQ,XQ;function X8(){if(K9!==void 0)return;K9=window,JQ=document,B7=/Firefox/.test(navigator.userAgent);var J=Element.prototype,Q=Node.prototype,X=Text.prototype;if(QQ=B0(Q,"firstChild").get,XQ=B0(Q,"nextSibling").get,C8(J))J[q7]=void 0,J[x7]=null,J[U7]=void 0,J.__e=void 0;if(C8(X))X[H7]=void 0;if(B)J.__svelte_meta=null,e4()}function a(J=""){return document.createTextNode(J)}function u(J){return QQ.call(J)}function r(J){return XQ.call(J)}function k6(J,Q){if(!w)return u(J);var X=u(N);if(X===null)X=N.appendChild(a());else if(Q&&X.nodeType!==oJ){var K=a();return X?.before(K),E(K),K}if(Q)Z8(X);return E(X),X}function b6(J,Q=!1){if(!w){var X=u(J);if(X instanceof Comment&&X.data==="")return r(X);return X}if(Q){if(N?.nodeType!==oJ){var K=a();return N?.before(K),E(K),K}Z8(N)}return N}function y6(J,Q=1,X=!1){let K=w?N:J;var Z;while(Q--)Z=K,K=r(K);if(!w)return K;if(X){if(K?.nodeType!==oJ){var W=a();if(K===null)Z?.after(W);else K.before(W);return E(W),W}Z8(K)}return E(K),K}function M7(J){J.textContent=""}function K8(){if(!t)return!1;if(h0!==null)return!1;var J=L.f;return(J&Y0)!==0}function c0(J,Q,X){if(Q==null||Q===k7)return X?document.createElement(J,{is:X}):document.createElement(J);return X?document.createElementNS(Q,J,{is:X}):document.createElementNS(Q,J)}function Z8(J){if(J.nodeValue.length<65536)return;let Q=J.nextSibling;while(Q!==null&&Q.nodeType===oJ)Q.remove(),J.nodeValue+=Q.nodeValue,Q=J.nextSibling}var w=!1;function _(J){w=J}var N;function E(J){if(J===null)throw FJ(),a0;return N=J}function l(){return E(r(N))}function KQ(J){if(!w)return;if(r(N)!==null)throw FJ(),a0;N=J}function y8(J=1){if(w){var Q=J,X=N;while(Q--)X=r(X);N=X}}function XJ(J=!0){var Q=0,X=N;while(!0){if(X.nodeType===C0){var K=X.data;if(K===TJ){if(Q===0)return X;Q-=1}else if(K===aJ||K===MJ||K[0]==="["&&!isNaN(Number(K.slice(1))))Q+=1}var Z=r(X);if(J)X.remove();X=Z}}function A7(J){if(!J||J.nodeType!==C0)throw FJ(),a0;return J.data}var $7=Symbol("events"),Z9=new Set,W8=new Set;function WQ(J,Q,X){(Q[$7]??={})[J]=X}function $Q(J){for(var Q=0;Q<J.length;Q++)Z9.add(J[Q]);for(var X of W8)X(J)}var ZQ=null;function W9(J){var Q=this,X=Q.ownerDocument,K=J.type,Z=J.composedPath?.()||[],W=Z[0]||J.target;ZQ=J;var $=0,G=ZQ===J&&J[$7];if(G){var z=Z.indexOf(G);if(z!==-1&&(Q===document||Q===window)){J[$7]=Q;return}var U=Z.indexOf(Q);if(U===-1)return;if(z<=U)$=z}if(W=Z[$]||J.target,W===Q)return;n(J,"currentTarget",{configurable:!0,get(){return W||X}});var q=S,P=L;f(null),p(null);try{var H,Y=[];while(W!==null){if(W===Q)break;try{var V=W[$7]?.[K];if(V!=null&&(!W.disabled||J.target===W))V.call(W,J)}catch(F){if(H)Y.push(F);else H=F}if(J.cancelBubble)break;$++,W=$<Z.length?Z[$]:null}if(H){for(let F of Y)queueMicrotask(()=>{throw F});throw H}}finally{J[$7]=Q,delete J.currentTarget,f(q),p(P)}}var h6=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:(J)=>{return J}});function GQ(J){return h6?.createHTML(J)??J}function $9(J){var Q=c0("template");return Q.innerHTML=GQ(J.replaceAll("<!>","<!---->")),Q.content}function N0(J,Q){var X=L;if(X.nodes===null)X.nodes={start:J,end:Q,a:null,t:null}}function v6(J,Q){var X=(Q&i9)!==0,K=(Q&s9)!==0,Z,W=!J.startsWith("<!>");return()=>{if(w)return N0(N,null),N;if(Z===void 0){if(Z=$9(W?J:"<!>"+J),!X)Z=u(Z)}var $=K||B7?document.importNode(Z,!0):Z.cloneNode(!0);if(X){var G=u($),z=$.lastChild;N0(G,z)}else N0($,$);return $}}function u6(){if(w)return N0(N,null),N;var J=document.createDocumentFragment(),Q=document.createComment(""),X=a();return J.append(Q,X),N0(Q,X),J}function G9(J,Q){if(w){var X=L;if((X.f&Y0)===0||X.nodes.end===null)X.nodes.end=N;l();return}if(J===null)return;J.before(Q)}var f6=/\r/g;function zQ(J){J=J.replace(f6,"");let Q=5381,X=J.length;while(X--)Q=(Q<<5)-Q^J.charCodeAt(X);return(Q>>>0).toString(36)}var p6=["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 $Z=[...p6,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var _6=["touchstart","touchmove"];function qQ(J){return _6.includes(J)}var d6=["$state","$state.raw","$derived","$derived.by"],GZ=[...d6,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];function $8(J){return J?.replace(/\//g,"/")}var z9=!0;function l6(J,Q){var X=Q==null?"":typeof Q==="object"?`${Q}`:Q;if(X!==(J[H7]??=J.nodeValue))J[H7]=X,J.nodeValue=`${X}`}function z8(J,Q){return UQ(J,Q)}function U9(J,Q){X8(),Q.intro=Q.intro??!1;let X=Q.target,K=w,Z=N;try{var W=u(X);while(W&&(W.nodeType!==C0||W.data!==aJ))W=r(W);if(!W)throw a0;_(!0),E(W);let $=UQ(J,{...Q,anchor:W});return _(!1),$}catch($){if($ instanceof Error&&$.message.split(`
|
|
49
|
-
`).some((G)=>G.startsWith("https://svelte.dev/e/")))throw $;if($!==a0)console.warn("Failed to hydrate: ",$);if(Q.recover===!1)
|
|
50
|
-
\r\f \v\uFEFF`];function FQ(J,Q,X){var K=J==null?"":""+J;if(Q)K=K?K+" "+Q:Q;if(X){for(var Z of Object.keys(X))if(X[Z])K=K?K+" "+Z:Z;else if(K.length){var W=Z.length,$=0;while(($=K.indexOf(Z,$))>=0){var G=$+W;if(($===0||VQ.includes(K[$-1]))&&(G===K.length||VQ.includes(K[G])))K=($===0?"":K.substring(0,$))+K.substring(G+1);else $=G}}}return K===""?null:K}function MQ(J,Q=!1){var X=Q?" !important;":";",K="";for(var Z of Object.keys(J)){var W=J[Z];if(W!=null&&W!=="")K+=" "+Z+": "+W+X}return K}function Y9(J){if(J[0]!=="-"||J[1]!=="-")return J.toLowerCase();return J}function LQ(J,Q){if(Q){var X="",K,Z;if(Array.isArray(Q))K=Q[0],Z=Q[1];else K=Q;if(J){J=String(J).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var W=!1,$=0,G=!1,z=[];if(K)z.push(...Object.keys(K).map(Y9));if(Z)z.push(...Object.keys(Z).map(Y9));var U=0,q=-1;let F=J.length;for(var P=0;P<F;P++){var H=J[P];if(G){if(H==="/"&&J[P-1]==="*")G=!1}else if(W){if(W===H)W=!1}else if(H==="/"&&J[P+1]==="*")G=!0;else if(H==='"'||H==="'")W=H;else if(H==="(")$++;else if(H===")")$--;if(!G&&W===!1&&$===0){if(H===":"&&q===-1)q=P;else if(H===";"||P===F-1){if(q!==-1){var Y=Y9(J.substring(U,q).trim());if(!z.includes(Y)){if(H!==";")P++;var V=J.substring(U,P).trim();X+=" "+V+";"}}U=P+1,q=-1}}}}if(K)X+=MQ(K);if(Z)X+=MQ(Z,!0);return X=X.trim(),X===""?null:X}return J==null?null:String(J)}function wQ(J,Q,X,K,Z,W){var $=J[q7];if(w||$!==X||$===void 0){var G=FQ(X,K,W);if(!w||G!==J.getAttribute("class"))if(G==null)J.removeAttribute("class");else if(Q)J.className=G;else J.setAttribute("class",G);J[q7]=X}else if(W&&Z!==W)for(var z in W){var U=!!W[z];if(Z==null||U!==!!Z[z])J.classList.toggle(z,U)}return W}function B9(J,Q={},X,K){for(var Z in X){var W=X[Z];if(Q[Z]!==W)if(X[Z]==null)J.style.removeProperty(Z);else J.style.setProperty(Z,W,K)}}function OQ(J,Q,X,K){var Z=J[U7];if(w||Z!==Q){var W=LQ(Q,K);if(!w||W!==J.getAttribute("style"))if(W==null)J.removeAttribute("style");else J.style.cssText=W;J[U7]=Q}else if(K)if(Array.isArray(K))B9(J,X?.[0],K[0]),B9(J,X?.[1],K[1],"important");else B9(J,X,K);return K}var L1=Symbol("class"),w1=Symbol("style"),O1=Symbol("is custom element"),S1=Symbol("is html"),A1=A8?"link":"LINK";function NQ(J,Q,X,K){var Z=D1(J);if(w){if(Z[Q]=J.getAttribute(Q),Q==="src"||Q==="srcset"||Q==="href"&&J.nodeName===A1){if(!K)j1(J,Q,X??"");return}}if(Z[Q]===(Z[Q]=X))return;if(Q==="loading")J[g9]=X;if(X==null)J.removeAttribute(Q);else if(typeof X!=="string"&&DQ(J).includes(Q))J[Q]=X;else J.setAttribute(Q,X)}function N1(J,Q,X){var K=S,Z=L;let W=w;if(w)_(!1);f(null),p(null);try{if(Q!=="style"&&(V9.has(J.getAttribute("is")||J.nodeName)||!customElements||customElements.get(J.getAttribute("is")||J.nodeName.toLowerCase())?DQ(J).includes(Q):X&&typeof X==="object"))J[Q]=X;else NQ(J,Q,X==null?X:String(X))}finally{if(f(K),p(Z),W)_(!0)}}function D1(J){return J[x7]??={[O1]:J.nodeName.includes("-"),[S1]:J.namespaceURI===k7}}var V9=new Map;function DQ(J){var Q=J.getAttribute("is")||J.nodeName,X=V9.get(Q);if(X)return X;V9.set(Q,X=[]);var K,Z=J,W=Element.prototype;while(W!==Z){K=y7(Z);for(var $ in K)if(K[$].set&&$!=="innerHTML"&&$!=="textContent"&&$!=="innerText")X.push($);Z=EJ(Z)}return X}function j1(J,Q,X){if(!B)return;if(Q==="srcset"&&R1(J,X))return;if(M9(J.getAttribute(Q)??"",X))return;t9(Q,J.outerHTML.replace(J.innerHTML,J.innerHTML&&"..."),String(X))}function M9(J,Q){if(J===Q)return!0;return new URL(J,document.baseURI).href===new URL(Q,document.baseURI).href}function SQ(J){return J.split(",").map((Q)=>Q.trim().split(" ").filter(Boolean))}function R1(J,Q){var X=SQ(J.srcset),K=SQ(Q);return K.length===X.length&&K.every(([Z,W],$)=>W===X[$][1]&&(M9(X[$][0],Z)||M9(Z,X[$][0])))}class jQ{#J=new WeakMap;#Q;#X;static entries=new WeakMap;constructor(J){this.#X=J}observe(J,Q){var X=this.#J.get(J)||new Set;return X.add(Q),this.#J.set(J,X),this.#G().observe(J,this.#X),()=>{var K=this.#J.get(J);if(K.delete(Q),K.size===0)this.#J.delete(J),this.#Q.unobserve(J)}}#G(){return this.#Q??(this.#Q=new ResizeObserver((J)=>{for(var Q of J){jQ.entries.set(Q.target,Q);for(var X of this.#J.get(Q.target)||[])X(Q)}}))}}function F9(J,Q){return J===Q||J?.[i]===Q}function C1(J={},Q,X,K){var Z=D.r,W=L;return F0(()=>{var $,G;return e(()=>{$=G,G=K?.()||[],h(()=>{if(!F9(X(...G),J)){if(Q(J,...G),$&&F9(X(...$),J))Q(null,...$)}})}),()=>{let z=W;while(z!==Z&&z.parent!==null&&z.parent.f&sJ)z=z.parent;let U=()=>{if(G&&F9(X(...G),J))Q(null,...G)},q=z.teardown;z.teardown=()=>{U(),q?.()}}}),J}function I1(J,Q,X,K){var Z=!wJ||(X&_9)!==0,W=(X&l9)!==0,$=(X&c9)!==0,G=K,z=!0,U=void 0,q=()=>{if($&&Z)return U??=SJ(K),I(U);if(z)z=!1,G=$?h(K):K;return G};let P;if(W){var H=i in J||z7 in J;P=B0(J,Q)?.set??(H&&Q in J?(R)=>J[Q]=R:void 0)}var Y,V=!1;if(W)[Y,V]=l8(()=>J[Q]);else Y=J[Q];if(Y===void 0&&K!==void 0){if(Y=q(),P){if(Z)V4(Q);P(Y)}}var F;if(Z)F=()=>{var R=J[Q];if(R===void 0)return q();return z=!0,R};else F=()=>{var R=J[Q];if(R!==void 0)G=void 0;return R===void 0?G:R};if(Z&&(X&d9)===0)return F;if(P){var M=J.$$legacy;return function(R,b0){if(arguments.length>0){if(!Z||!b0||M||V)P(b0?F():R);return R}return F()}}var O=!1,j=((X&p9)!==0?SJ:yJ)(()=>{return O=!1,F()});if(B)j.label=Q;if(W)I(j);var T=L;return function(R,b0){if(arguments.length>0){let H0=b0?I(j):Z&&W?HJ(R):R;if(U0(j,H0),O=!0,G!==void 0)G=H0;return R}if(T0&&O||(T.f&g)!==0)return j.v;return I(j)}}function RQ(J){return new CQ(J)}class CQ{#J;#Q;constructor(J){var Q=new Map,X=(Z,W)=>{var $=mJ(W,!1,!1);return Q.set(Z,$),$};let K=new Proxy({...J.props||{},$$events:{}},{get(Z,W){return I(Q.get(W)??X(W,Reflect.get(Z,W)))},has(Z,W){if(W===z7)return!0;return I(Q.get(W)??X(W,Reflect.get(Z,W))),Reflect.has(Z,W)},set(Z,W,$){return U0(Q.get(W)??X(W,$),$),Reflect.set(Z,W,$)}});if(this.#Q=(J.hydrate?U9:z8)(J.component,{target:J.target,anchor:J.anchor,props:K,context:J.context,intro:J.intro??!1,recover:J.recover,transformError:J.transformError}),!t&&(!J?.props?.$$host||J.sync===!1))Z7();this.#J=K.$$events;for(let Z of Object.keys(this.#Q)){if(Z==="$set"||Z==="$destroy"||Z==="$on")continue;n(this,Z,{get(){return this.#Q[Z]},set(W){this.#Q[Z]=W},enumerable:!0})}this.#Q.$set=(Z)=>{Object.assign(K,Z)},this.#Q.$destroy=()=>{H9(this.#Q)}}$set(J){this.#Q.$set(J)}$on(J,Q){this.#J[J]=this.#J[J]||[];let X=(...K)=>Q.call(this,...K);return this.#J[J].push(X),()=>{this.#J[J]=this.#J[J].filter((K)=>K!==X)}}$destroy(){this.#Q.$destroy()}}var IQ;if(typeof HTMLElement==="function")IQ=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(J,Q,X){super();if(this.$$ctor=J,this.$$s=Q,X)this.$$shadowRoot=this.attachShadow(X)}addEventListener(J,Q,X){if(this.$$l[J]=this.$$l[J]||[],this.$$l[J].push(Q),this.$$c){let K=this.$$c.$on(J,Q);this.$$l_u.set(Q,K)}super.addEventListener(J,Q,X)}removeEventListener(J,Q,X){if(super.removeEventListener(J,Q,X),this.$$c){let K=this.$$l_u.get(Q);if(K)K(),this.$$l_u.delete(Q)}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let J=function(K){return(Z)=>{let W=c0("slot");if(K!=="default")W.name=K;G9(Z,W)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let Q={},X=g1(this);for(let K of this.$$s)if(K in X)if(K==="default"&&!this.$$d.children)this.$$d.children=J(K),Q.default=!0;else Q[K]=J(K);for(let K of this.attributes){let Z=this.$$g_p(K.name);if(!(Z in this.$$d))this.$$d[Z]=U8(Z,K.value,this.$$p_d,"toProp")}for(let K in this.$$p_d)if(!(K in this.$$d)&&this[K]!==void 0)this.$$d[K]=this[K],delete this[K];this.$$c=RQ({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:Q,$$host:this}}),this.$$me=t8(()=>{e(()=>{this.$$r=!0;for(let K of Y7(this.$$c)){if(!this.$$p_d[K]?.reflect)continue;this.$$d[K]=this.$$c[K];let Z=U8(K,this.$$d[K],this.$$p_d,"toAttribute");if(Z==null)this.removeAttribute(this.$$p_d[K].attribute||K);else this.setAttribute(this.$$p_d[K].attribute||K,Z)}this.$$r=!1})});for(let K in this.$$l)for(let Z of this.$$l[K]){let W=this.$$c.$on(K,Z);this.$$l_u.set(Z,W)}this.$$l={}}}attributeChangedCallback(J,Q,X){if(this.$$r)return;J=this.$$g_p(J),this.$$d[J]=U8(J,X,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 Y7(this.$$p_d).find((Q)=>this.$$p_d[Q].attribute===J||!this.$$p_d[Q].attribute&&Q.toLowerCase()===J)||J}};function U8(J,Q,X,K){let Z=X[J]?.type;if(Q=Z==="Boolean"&&typeof Q!=="boolean"?Q!=null:Q,!K||!X[J])return Q;else if(K==="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 g1(J){let Q={};return J.childNodes.forEach((X)=>{Q[X.slot||"default"]=!0}),Q}function m1(J,Q,X,K,Z,W){let $=class extends IQ{constructor(){super(J,X,Z);this.$$p_d=Q}static get observedAttributes(){return Y7(Q).map((G)=>(Q[G].attribute||G).toLowerCase())}};if(Y7(Q).forEach((G)=>{n($.prototype,G,{get(){return this.$$c&&G in this.$$c?this.$$c[G]:this.$$d[G]},set(z){z=U8(G,z,Q),this.$$d[G]=z;var U=this.$$c;if(U){var q=B0(U,G)?.get;if(q)U[G]=z;else U.$set({[G]:z})}}})}),K.forEach((G)=>{n($.prototype,G,{get(){return this.$$c?.[G]}})}),W)$=W($);return J.element=$,$}if(B){let J=function(Q){if(!(Q in globalThis)){let X;Object.defineProperty(globalThis,Q,{configurable:!0,get:()=>{if(X!==void 0)return X;M4(Q)},set:(K)=>{X=K}})}};J("$state"),J("$effect"),J("$derived"),J("$inspect"),J("$props"),J("$bindable")}import{createContext as H8}from"@pie-players/pie-context";var TQ=H8(Symbol.for("pie.assessmentToolkit.runtimeContext")),EQ=H8(Symbol.for("pie.assessmentToolkit.hostRuntimeContext")),xQ=H8(Symbol.for("pie.assessmentToolkit.shellContext")),v1=H8(Symbol.for("pie.assessmentToolkit.regionScopeContext"));import{ContextConsumer as u1}from"@pie-players/pie-context";function w9(J,Q,X){let K=!1,Z=new u1(J,{context:Q,subscribe:!0,onValue:(U)=>{K=!0,X(U)}});Z.connect();let W=(U)=>{if(U.context!==Q)return;Z.requestValue()};J.addEventListener("context-provider",W);let $=0,G=200,z=globalThis.setInterval(()=>{if(K||$>=G){globalThis.clearInterval(z);return}$+=1,Z.requestValue()},50);return()=>{globalThis.clearInterval(z),J.removeEventListener("context-provider",W),Z.disconnect()}}function iB(J,Q){return w9(J,TQ,Q)}function sB(J,Q){return w9(J,EQ,Q)}function oB(J,Q){return w9(J,xQ,Q)}var j7={assessment:[],section:[],item:[],passage:[],rubric:[],element:[]};var O9={section:[...j7.section],item:[...j7.item],passage:[...j7.passage]};function pJ(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}function RJ(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((K)=>typeof K!=="string")!==void 0)throw Error(`Invalid tools config at "${Q}": all entries must be strings.`);return J}function f1(J){if(J==null)return;if(!pJ(J))throw Error('Invalid tools config at "placement": expected an object with section/item/passage arrays.');return J}function p1(J){if(J==null)return;if(!pJ(J))throw Error('Invalid tools config at "policy": expected an object with allowed/blocked arrays.');return J}function _1(J,Q){if(Q==null)return;if(!pJ(Q))throw Error(`Invalid tools config at "providers.${J}": expected an object.`);let X=Q,K=(Z)=>Z==="polly"||Z==="google"||Z==="custom";if("enabled"in X&&X.enabled!==void 0&&typeof X.enabled!=="boolean")throw Error(`Invalid tools config at "providers.${J}.enabled": expected a boolean.`);if("settings"in X&&X.settings!==void 0&&!pJ(X.settings))throw Error(`Invalid tools config at "providers.${J}.settings": expected an object.`);if("provider"in X&&X.provider!==void 0&&!pJ(X.provider)&&!(J==="textToSpeech"&&K(X.provider)))throw Error(`Invalid tools config at "providers.${J}.provider": expected an object.`);return X}function d1(J){if(J==null)return{};if(!pJ(J))throw Error('Invalid tools config at "providers": expected an object keyed by tool id.');let Q={};for(let[X,K]of Object.entries(J))Q[X]=_1(X,K);return Q}function S9(J){let Q=J.trim();if(!Q)return"";return Q}function YJ(J){if(!J||J.length===0)return[];let Q=new Set;for(let X of J){if(typeof X!=="string")throw Error("Invalid tools config: tool list entries must be strings.");let K=S9(X);if(!K)continue;Q.add(K)}return Array.from(Q)}function tB(J){if(!J)return[];return YJ(J.split(",").map((Q)=>Q.trim()).filter(Boolean))}function l1(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 eB(J){if(J!=null&&!pJ(J))throw Error('Invalid tools config: expected an object with "policy", "placement", and "providers".');let Q=p1(J?.policy),X=f1(J?.placement),K=d1(J?.providers),Z=l1(J?.pnpEnforcement,"pnpEnforcement"),W={policy:{allowed:YJ(RJ(Q?.allowed,"policy.allowed")),blocked:YJ(RJ(Q?.blocked,"policy.blocked"))},placement:{section:YJ(RJ(X?.section,"placement.section")).length?YJ(RJ(X?.section,"placement.section")):[...O9.section],item:YJ(RJ(X?.item,"placement.item")).length?YJ(RJ(X?.item,"placement.item")):[...O9.item],passage:YJ(RJ(X?.passage,"placement.passage")).length?YJ(RJ(X?.passage,"placement.passage")):[...O9.passage]},providers:K};if(Z)W.pnpEnforcement=Z;return W}var c1=["assessment","section","item","passage","rubric"],i1=new Set(c1);function kQ(J){return i1.has(J)}function G7(J,Q,X){let K=J.trim(),Z=X.trim();if(!K||!Z)throw Error("Tool instance ids require non-empty tool and scope ids");if(!kQ(Q))throw Error(`Unknown tool scope level '${Q}'. Register custom levels with registerToolScopeLevel().`);return`${K}:${Q}:${Z}`}function QV(J){let Q=J.split(":");if(Q.length!==3)return null;let[X,K,Z]=Q;if(!X||!Z)return null;if(!kQ(K))return null;return{baseToolId:X,scopeLevel:K,scopeId:Z}}var s1=["assessment","section","item","passage","rubric","element"];function P8(J,Q){if(typeof J!=="string"||J.trim().length===0)throw Error(`Invalid tool registration: "${Q}" must be a non-empty string.`)}var o1=[{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 a1(J,Q,X){let K=Q.trimStart(),Z=K.toLowerCase().startsWith("<svg"),W=/^https?:/i.test(K);if(/^data:/i.test(K))throw Error(`Invalid tool registration "${J}": "${X}" may not be a data: URL.`);if(!Z&&!W)return;for(let{pattern:G,reason:z}of o1)if(G.test(Q))throw Error(`Invalid tool registration "${J}": "${X}" ${z}. Inline SVG icons must not include scriptable content.`)}function bQ(J){if(P8(J.toolId,"toolId"),P8(J.name,"name"),P8(J.description,"description"),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")a1(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 Q=J.supportedLevels.find((X)=>!s1.includes(X));if(Q)throw Error(`Invalid tool registration "${J.toolId}": unsupported level "${Q}".`);if(J.activation!==void 0&&J.activation!=="toolbar-toggle"&&J.activation!=="selection-gateway")throw Error(`Invalid tool registration "${J.toolId}": unsupported activation "${String(J.activation)}".`);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(typeof J.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${J.toolId}": "isVisibleInContext" must be a function.`);if(typeof J.renderToolbar!=="function")throw Error(`Invalid tool registration "${J.toolId}": "renderToolbar" must be a function.`)}class A9{tools=new Map;pnpIndex=new Map;componentOverrides={};moduleLoaders=new Map;loadedToolModules=new Set;moduleLoadPromises=new Map;normalizeToolId(J){return S9(J)}normalizeToolIds(J){return J.map((Q)=>this.normalizeToolId(Q))}register(J){if(bQ(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)}}override(J){if(bQ(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 X of Q.pnpSupportIds)this.pnpIndex.get(X)?.delete(J.toolId);if(this.tools.set(J.toolId,J),J.pnpSupportIds)for(let X of J.pnpSupportIds){if(!this.pnpIndex.has(X))this.pnpIndex.set(X,new Set);this.pnpIndex.get(X).add(J.toolId)}}unregister(J){let Q=this.tools.get(J);if(!Q)return;if(Q.pnpSupportIds)for(let X of Q.pnpSupportIds)this.pnpIndex.get(X)?.delete(J);this.tools.delete(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}filterToolIdsByActivation(J,Q){return J.filter((X)=>this.getToolActivation(X)===Q)}filterVisibleInContext(J,Q){let X=[];for(let K of J){let Z=this.get(K);if(!Z){console.warn(`Tool '${K}' is allowed but not registered`);continue}if(!Z.supportedLevels.includes(Q.level))continue;try{if(Z.isVisibleInContext(Q))X.push(Z)}catch(W){console.error(`Error evaluating visibility for tool '${K}':`,W)}}return X}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}))}generatePNPSupportsFromTools(J){let Q=new Set;for(let X of J){let K=this.get(X);if(K?.pnpSupportIds)for(let Z of K.pnpSupportIds)Q.add(Z)}return Array.from(Q)}clear(){this.tools.clear(),this.pnpIndex.clear()}setComponentOverrides(J){this.componentOverrides=J}setToolModuleLoaders(J){for(let[Q,X]of Object.entries(J)){if(!X)continue;if(P8(Q,"tool module loader id"),typeof X!=="function")throw Error(`Invalid tool module loader for "${Q}": expected a function.`);this.moduleLoaders.set(Q,X)}}async ensureToolModuleLoaded(J){if(this.loadedToolModules.has(J))return;let Q=this.moduleLoadPromises.get(J);if(Q){await Q;return}let X=this.moduleLoaders.get(J);if(!X)return;let K=(async()=>{await X(),this.loadedToolModules.add(J)})();this.moduleLoadPromises.set(J,K);try{await K}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,X){let K=this.get(J);if(!K)throw Error(`Tool '${J}' is not registered`);let Z={...X,componentOverrides:{...this.componentOverrides||{},...X.componentOverrides||{}}};return K.renderToolbar(Q,Z)}}function yQ(J){return J.level==="item"}function r1(J){return J.level==="passage"}function n1(J){return J.level==="rubric"}function hQ(J){return J.level==="element"}function N9(J){if(hQ(J)){let Q=J.item.config;if(!Q)return"";let X=[],K=(z)=>z.replace(/<[^>]*>/g," ").trim(),Z=Q.elements?.[J.elementId];if(Z){if(typeof Z==="string")X.push(K(Z))}let W=Q.models,G=(Array.isArray(W)?W:W&&typeof W==="object"?Object.values(W):[]).find((z)=>z&&typeof z==="object"&&z.id===J.elementId);if(G)for(let z of Object.values(G)){if(typeof z==="string")X.push(K(z));if(Array.isArray(z)){for(let U of z)if(U&&typeof U==="object"){for(let q of Object.values(U))if(typeof q==="string")X.push(K(q))}}}return X.filter(Boolean).join(" ").trim()}if(yQ(J)){let Q=J.item;if(!Q?.config)return"";let X=Q.config,K=[],Z=(z)=>z.replace(/<[^>]*>/g," ").trim();if(typeof X.markup==="string")K.push(Z(X.markup));let W=X.elements;if(W&&typeof W==="object"){for(let z of Object.values(W))if(typeof z==="string")K.push(Z(z))}let $=X.models,G=Array.isArray($)?$:$&&typeof $==="object"?Object.values($):[];for(let z of G){if(!z||typeof z!=="object")continue;for(let U of Object.values(z)){if(typeof U==="string")K.push(Z(U));if(Array.isArray(U)){for(let q of U)if(q&&typeof q==="object"){for(let P of Object.values(q))if(typeof P==="string")K.push(Z(P))}}}}return K.filter(Boolean).join(" ").trim()}if(r1(J)){let Q=J.passage;if(!Q?.config)return"";let X=Q.config,K=[],Z=(z)=>z.replace(/<[^>]*>/g," ").trim();if(typeof X.markup==="string")K.push(Z(X.markup));if(typeof X.content==="string")K.push(Z(X.content));if(typeof X.prompt==="string")K.push(Z(X.prompt));let W=X.elements;if(W&&typeof W==="object"){for(let z of Object.values(W))if(typeof z==="string")K.push(Z(z))}let $=X.models,G=Array.isArray($)?$:$&&typeof $==="object"?Object.values($):[];for(let z of G){if(!z||typeof z!=="object")continue;for(let U of Object.values(z)){if(typeof U==="string")K.push(Z(U));if(Array.isArray(U)){for(let q of U)if(q&&typeof q==="object"){for(let P of Object.values(q))if(typeof P==="string")K.push(Z(P))}}}}return K.filter(Boolean).join(" ").trim()}if(n1(J)){let Q=J.rubricBlock;if(Q.passage?.config)return(Q.passage.config.markup||"").replace(/<[^>]*>/g," ").trim();return(Q.content||"").replace(/<[^>]*>/g," ").trim()}return""}function _J(J){let Q=N9(J);return[/<math[>\s]/i,/\\\[([^\]]+)\\\]/,/\$\$[^$]+\$\$/,/\\\(/,/[+\-*/=<>≤≥∑∫√π]/,/\d+\s*[+\-*/=]\s*\d+/].some((K)=>K.test(Q))}function gQ(J){let Q=["pie-multiple-choice","pie-inline-choice","pie-select-text","pie-ebsr","multiple-choice","inline-choice","select-text","ebsr"];if(hQ(J)){let X=J.item.config;if(!X?.models)return!1;let Z=(Array.isArray(X.models)?X.models:Object.values(X.models)).find(($)=>$&&typeof $==="object"&&$.id===J.elementId);if(!Z)return!1;let W=Z.element||"";return Q.includes(W)}if(yQ(J)){let X=J.item.config?.models;return(Array.isArray(X)?X:X&&typeof X==="object"?Object.values(X):[]).some((Z)=>{if(!Z||typeof Z!=="object")return!1;let W=Z.element||"";if(Q.includes(W))return!0;return Array.isArray(Z.choices)&&Z.choices.length>0})}return!1}function dJ(J){return N9(J).trim().length>=10}function mQ(J){let Q=N9(J);return[/chemistry|chemical|element|atom|molecule|compound/i,/periodic\s+table/i,/H₂O|CO₂|NaCl|O₂|N₂/i,/\b[A-Z][a-z]?\d*\b/,/biology|organism|cell|DNA|RNA|protein/i,/physics|force|energy|velocity|acceleration/i].some((K)=>K.test(Q))}class vQ{providers=new Map;configs=new Map;initialized=new Map;initializationPromises=new Map;async emitTelemetry(J,Q,X){try{await J.onTelemetry?.(Q,X)}catch(K){console.warn("[ToolProviderRegistry] Telemetry callback failed:",K)}}register(J,Q){if(this.providers.has(J)){console.warn(`[ToolProviderRegistry] Provider "${J}" already registered, skipping`);return}if(this.providers.set(J,Q.provider),this.configs.set(J,Q),this.initialized.set(J,!1),console.log(`[ToolProviderRegistry] Registered provider "${J}" (${Q.provider.providerName})`),Q.lazy===!1)this.initialize(J).catch((X)=>{console.error(`[ToolProviderRegistry] Failed to initialize provider "${J}":`,X)})}async initialize(J){if(this.initialized.get(J))return;let Q=this.initializationPromises.get(J);if(Q)return Q;let X=this._doInitialize(J);this.initializationPromises.set(J,X);try{await X}finally{this.initializationPromises.delete(J)}}async _doInitialize(J){let Q=this.providers.get(J),X=this.configs.get(J);if(!Q||!X)throw Error(`[ToolProviderRegistry] Provider "${J}" not registered`);let K={...X.config},Z=($)=>{if(!$||typeof $!=="object")return"unknown";let G=$;return(typeof G.backend==="string"?G.backend:typeof G.provider==="string"?G.provider:typeof G.serverProvider==="string"?G.serverProvider:typeof G.providerId==="string"?G.providerId:"")||"unknown"},W=Date.now();if(await this.emitTelemetry(X,"pie-tool-init-start",{toolId:J,providerId:J,backend:Z(K),operation:"provider-initialize"}),Q.requiresAuth&&X.authFetcher){let $=Date.now();await this.emitTelemetry(X,"pie-tool-backend-call-start",{toolId:J,providerId:J,backend:Z(K),operation:"auth-fetch"}),console.log(`[ToolProviderRegistry] Fetching auth for "${J}"...`);try{let G=await X.authFetcher();K={...K,...G},await this.emitTelemetry(X,"pie-tool-backend-call-success",{toolId:J,providerId:J,backend:Z(K),operation:"auth-fetch",duration:Date.now()-$})}catch(G){throw await this.emitTelemetry(X,"pie-tool-backend-call-error",{toolId:J,providerId:J,backend:Z(K),operation:"auth-fetch",duration:Date.now()-$,errorType:"ProviderAuthFetchError",message:G instanceof Error?G.message:String(G)}),console.error(`[ToolProviderRegistry] Auth fetch failed for "${J}":`,G),Error(`Failed to fetch auth credentials for provider "${J}"`)}}try{await Q.initialize(K),this.initialized.set(J,!0),await this.emitTelemetry(X,"pie-tool-init-success",{toolId:J,providerId:J,backend:Z(K),operation:"provider-initialize",duration:Date.now()-W}),console.log(`[ToolProviderRegistry] Provider "${J}" initialized`)}catch($){throw await this.emitTelemetry(X,"pie-tool-init-error",{toolId:J,providerId:J,backend:Z(K),operation:"provider-initialize",duration:Date.now()-W,errorType:"ProviderInitializationError",message:$ instanceof Error?$.message:String($)}),console.error(`[ToolProviderRegistry] Initialization failed for "${J}":`,$),$}}async getProvider(J,Q=!0){console.log("[ToolProviderRegistry] getProvider called",{providerId:J,autoInitialize:Q,isRegistered:this.providers.has(J),isInitialized:this.initialized.get(J),allProviderIds:Array.from(this.providers.keys())});let X=this.providers.get(J);if(!X)throw console.error("[ToolProviderRegistry] Provider not found:",{requestedId:J,availableProviders:Array.from(this.providers.keys())}),Error(`[ToolProviderRegistry] Provider "${J}" not registered`);if(Q&&!this.initialized.get(J))console.log("[ToolProviderRegistry] Auto-initializing provider:",J),await this.initialize(J);return console.log("[ToolProviderRegistry] Returning provider:",{providerId:J,providerName:X.providerName,isReady:X.isReady()}),X}getProvidersByCategory(J){return Array.from(this.providers.entries()).filter(([Q,X])=>X.category===J).map(([Q])=>Q)}getProviderIds(){return Array.from(this.providers.keys())}has(J){return this.providers.has(J)}isInitialized(J){return this.initialized.get(J)===!0}isInitializing(J){return this.initializationPromises.has(J)}async unregister(J){let Q=this.providers.get(J);if(Q){let X=this.initializationPromises.get(J);if(X)try{await X}catch{}Q.destroy(),this.providers.delete(J),this.configs.delete(J),this.initialized.delete(J),this.initializationPromises.delete(J),console.log(`[ToolProviderRegistry] Unregistered provider "${J}"`)}}async destroy(){let J=Array.from(this.providers.keys());await Promise.all(J.map((Q)=>this.unregister(Q))),console.log("[ToolProviderRegistry] Registry destroyed")}}class Y8{providerId="desmos-calculator";providerName="Desmos Calculator";category="calculator";version="1.12";requiresAuth=!0;desmosProvider=null;config=null;async emitTelemetry(J,Q){try{await this.config?.onTelemetry?.(J,Q)}catch(X){console.warn("[DesmosToolProvider] telemetry callback failed:",X)}}async initialize(J){if(this.desmosProvider){console.warn("[DesmosToolProvider] Already initialized, skipping reinitialization");return}this.config=J;let Q=Date.now();await this.emitTelemetry("pie-tool-library-load-start",{toolId:"calculator",operation:"desmos-provider-module-import",backend:"desmos"});let X=await(async()=>{try{let K=await import("@pie-players/pie-calculator-desmos");return await this.emitTelemetry("pie-tool-library-load-success",{toolId:"calculator",operation:"desmos-provider-module-import",backend:"desmos",duration:Date.now()-Q}),K}catch(K){throw await this.emitTelemetry("pie-tool-library-load-error",{toolId:"calculator",operation:"desmos-provider-module-import",backend:"desmos",duration:Date.now()-Q,errorType:"ToolLibraryLoadError",message:K instanceof Error?K.message:String(K)}),K}})();this.desmosProvider=new X.DesmosCalculatorProvider;try{await this.desmosProvider.initialize({apiKey:J.apiKey,proxyEndpoint:J.proxyEndpoint,onTelemetry:J.onTelemetry}),console.log(`[DesmosToolProvider] Initialized successfully ${J.proxyEndpoint?"(using proxy)":J.apiKey?"(direct API key)":"(no auth)"}`)}catch(K){throw console.error("[DesmosToolProvider] Initialization failed:",K),Error("Failed to initialize Desmos calculator provider. Check API key or proxy endpoint.")}}async createInstance(J){if(!this.desmosProvider)throw Error("[DesmosToolProvider] Provider not initialized. Call initialize() first.");return this.desmosProvider}getCapabilities(){return{supportsOffline:!1,requiresAuth:!0,maxInstances:null,features:{basic:!0,scientific:!0,graphing:!0,fourFunction:!0}}}isReady(){return this.desmosProvider!==null}destroy(){if(this.desmosProvider)this.desmosProvider.destroy(),this.desmosProvider=null;this.config=null,console.log("[DesmosToolProvider] Destroyed")}}var uQ=(J,Q)=>{let X=Q?.useSentenceSegmenter!==!1;try{if(!X)throw Error("Segmenter disabled by policy");let G=globalThis.Intl?.Segmenter;if(typeof G==="function"){let z=new G(Q?.locale,{granularity:"sentence"}),U=Array.from(z.segment(J)).map((q)=>({text:q.segment,offset:q.index})).filter((q)=>q.text.trim().length>0);if(U.length>0)return U}}catch{}let K=/[^.!?]+(?:[.!?]+|$)/g,Z=J.match(K)||[J],W=[],$=0;for(let G of Z){let z=J.indexOf(G,$);if(z===-1)continue;W.push({text:G,offset:z}),$=z+G.length}return W.length>0?W:[{text:J,offset:0}]};var fQ=(J)=>String(J||"").trim().toLowerCase(),t1=()=>{let J=typeof navigator<"u"?navigator.language||navigator.languages?.[0]:"";return fQ(J||"en-US")},e1=(J,Q)=>{if(Q){let $=J.find((G)=>G.name===Q);if($)return $}let X=t1(),K=X.split("-")[0]||"en",Z=($)=>{let G=fQ($.lang);return G===X||G.startsWith(`${K}-`)},W=[($)=>$.localService&&Z($),($)=>$.default&&Z($),($)=>Z($),($)=>$.localService,($)=>$.default];for(let $ of W){let G=J.find($);if(G)return G}return J[0]||null},J5=(J)=>!J.default;class D9{providerId="browser";providerName="Browser Speech Synthesis";version="1.0.0";async initialize(J){if(typeof window>"u")throw Error("BrowserTTSProvider requires browser environment");if(!("speechSynthesis"in window))throw Error("Browser does not support Speech Synthesis API");return new pQ(J)}supportsFeature(J){return!0}getCapabilities(){return{supportsPause:!0,supportsResume:!0,supportsWordBoundary:!0,supportsVoiceSelection:!0,supportsRateControl:!0,supportsPitchControl:!0,supportsSSML:!1}}destroy(){}}class pQ{utterance=null;config=null;_isPlaying=!1;_isPaused=!1;speakRunId=0;constructor(J){this.config=J}async speak(J){if(!this.config)throw Error("TTS not initialized");this.stop();let Q=this.speakRunId,X=this.splitIntoChunks(J);for(let K of X){if(Q!==this.speakRunId)break;if(!await this.speakChunk(K.text,K.offset,Q))break}}async speakSegments(J){if(!this.config)throw Error("TTS not initialized");this.stop();let Q=this.speakRunId;for(let X of J){if(Q!==this.speakRunId)break;let K=this.splitIntoChunks(X.text);for(let W of K){if(Q!==this.speakRunId)break;if(!await this.speakChunk(W.text,X.startOffset+W.offset,Q))break}let Z=Math.max(0,Number(X.pauseMsAfter||0));if(Z>0&&Q===this.speakRunId){if(!await this.waitForPause(Z,Q))break}}}async waitForPause(J,Q){return await new Promise((X)=>setTimeout(X,J)),Q===this.speakRunId}splitIntoChunks(J){if(J.length<=260)return[{text:J,offset:0}];let X=this.segmentSentences(J),K=[],Z="",W=0;for(let $ of X){let G=$.text.trim();if(!G)continue;let z=$.text.search(/\S/),U=$.offset+(z===-1?0:z);if(!Z){Z=G,W=U;continue}let q=`${Z} ${G}`;if(q.length<=260)Z=q;else K.push({text:Z,offset:W}),Z=G,W=U}if(Z)K.push({text:Z,offset:W});return K.length?K:[{text:J,offset:0}]}getHighlightMode(){return(this.config?.providerOptions||{}).highlightMode==="word"?"word":"sentence"}getSegmentationPolicy(){let J=this.config?.providerOptions||{},Q=J.segmenter||{},K=Q.mode!=="regexOnly",Z=typeof Q.locale==="string"&&Q.locale.trim().length>0?Q.locale:typeof J.locale==="string"&&J.locale.trim().length>0?J.locale:void 0;return{useSentenceSegmenter:K,useWordSegmenter:K,locale:Z}}segmentSentences(J){let Q=this.getSegmentationPolicy();return uQ(J,{locale:Q.locale,useSentenceSegmenter:Q.useSentenceSegmenter})}inferWordLength(J,Q){let X=Math.max(0,Math.min(Q,Math.max(0,J.length-1)));return J.slice(X).match(/^\s*([^\s]+)/)?.[1]?.length||1}async speakChunk(J,Q,X){return new Promise((K,Z)=>{if(X!==this.speakRunId){K(!1);return}let W=new SpeechSynthesisUtterance(J);this.utterance=W;let $=e1(speechSynthesis.getVoices(),this.config?.voice);if($&&J5($))W.voice=$;if(this.config?.rate)W.rate=this.config.rate;if(this.config?.pitch)W.pitch=this.config.pitch;let G=()=>{if(this.utterance===W)this.utterance=null};W.onstart=()=>{if(X!==this.speakRunId)return;this._isPlaying=!0,this._isPaused=!1},W.onend=()=>{if(G(),X!==this.speakRunId){K(!1);return}this._isPlaying=!1,this._isPaused=!1,K(!0)},W.onerror=(z)=>{if(G(),X!==this.speakRunId){K(!1);return}if(this._isPlaying=!1,this._isPaused=!1,z.error==="interrupted"||z.error==="canceled"){K(!1);return}Z(Error(`Speech synthesis error: ${z.error}`))},W.onpause=()=>{if(X!==this.speakRunId)return;this._isPaused=!0},W.onresume=()=>{if(X!==this.speakRunId)return;this._isPaused=!1},W.onboundary=(z)=>{if(X!==this.speakRunId)return;if(console.log("[BrowserProvider] Boundary event:",z.name,"charIndex:",z.charIndex,"charLength:",z.charLength),z.name!=="word"||!this.onWordBoundary)return;if(this.getHighlightMode()==="sentence")return;let U=Math.max(0,Math.min(z.charIndex,Math.max(0,J.length-1))),q=Number(z.charLength||0),P=this.inferWordLength(J,U),H=Number.isFinite(q)&&q>0&&q<=80&&U+q<=J.length?q:P,Y=J.substring(U,Math.min(J.length,U+H)).trim(),V=Q+U;console.log("[BrowserProvider] Calling onWordBoundary with word:",Y,"at position:",V),this.onWordBoundary(Y,V,H)},speechSynthesis.speak(W)})}pause(){if(this._isPlaying&&!this._isPaused)speechSynthesis.pause()}resume(){if(this._isPlaying&&this._isPaused)speechSynthesis.resume()}stop(){if(this.speakRunId+=1,this._isPlaying||this.utterance)speechSynthesis.cancel();this.utterance=null,this._isPlaying=!1,this._isPaused=!1}isPlaying(){return this._isPlaying&&!this._isPaused}isPaused(){return this._isPaused}updateSettings(J){if(!this.config)this.config={};if(J.rate!==void 0)this.config.rate=J.rate;if(J.pitch!==void 0)this.config.pitch=J.pitch;if(J.voice!==void 0)this.config.voice=J.voice;if(J.providerOptions!==void 0)this.config.providerOptions={...this.config.providerOptions||{},...J.providerOptions||{}}}onWordBoundary}class B8{providerId="tts-service";providerName="Text-to-Speech";category="tts";version="1.0";requiresAuth;ttsProvider=null;config=null;async emitTelemetry(J,Q){try{await this.config?.onTelemetry?.(J,Q)}catch(X){console.warn("[TTSToolProvider] telemetry callback failed:",X)}}constructor(J="browser"){this.requiresAuth=J!=="browser"}async initialize(J){if(this.ttsProvider){console.warn("[TTSToolProvider] Already initialized, skipping reinitialization");return}switch(this.config=J,J.backend){case"browser":await this._initializeBrowserTTS(J);break;case"polly":case"google":case"server":await this._initializeServerTTS(J);break;default:throw Error(`[TTSToolProvider] Unknown backend: ${J.backend}`)}console.log(`[TTSToolProvider] Initialized successfully (backend: ${J.backend})`)}async _initializeBrowserTTS(J){if(typeof window>"u"||!("speechSynthesis"in window))throw Error("[TTSToolProvider] Browser TTS not supported (Web Speech API not available)");this.ttsProvider=new D9,console.log("[TTSToolProvider] Browser TTS initialized (Web Speech API)")}async _initializeServerTTS(J){if(!J.apiEndpoint)throw Error("[TTSToolProvider] apiEndpoint required for server-based TTS backends");let Q=Date.now();await this.emitTelemetry("pie-tool-library-load-start",{toolId:"textToSpeech",operation:"server-provider-module-import",backend:J.serverProvider||J.backend});let X=await(async()=>{try{let K=await import("@pie-players/tts-client-server");return await this.emitTelemetry("pie-tool-library-load-success",{toolId:"textToSpeech",operation:"server-provider-module-import",backend:J.serverProvider||J.backend,duration:Date.now()-Q}),K}catch(K){throw await this.emitTelemetry("pie-tool-library-load-error",{toolId:"textToSpeech",operation:"server-provider-module-import",backend:J.serverProvider||J.backend,duration:Date.now()-Q,errorType:"ToolLibraryLoadError",message:K instanceof Error?K.message:String(K)}),K}})();this.ttsProvider=new X.ServerTTSProvider,console.log(`[TTSToolProvider] Server TTS initialized (provider: ${J.serverProvider||J.backend})`)}async createInstance(J){if(!this.ttsProvider)throw Error("[TTSToolProvider] Provider not initialized. Call initialize() first.");return this.ttsProvider}getCapabilities(){let J=this.config?.backend==="browser";return{supportsOffline:J,requiresAuth:!J,maxInstances:1,features:{wordBoundary:!0,pause:!0,resume:!0,rateControl:!0,pitchControl:J,voiceSelection:!0}}}isReady(){return this.ttsProvider!==null}destroy(){if(this.ttsProvider)this.ttsProvider.destroy(),this.ttsProvider=null;this.config=null,console.log("[TTSToolProvider] Destroyed")}}import{validateCustomElementTag as Q5}from"@pie-players/pie-players-shared/pie/tag-names";var j9={calculator:"pie-tool-calculator",textToSpeech:"pie-tool-text-to-speech",ruler:"pie-tool-ruler",protractor:"pie-tool-protractor",answerEliminator:"pie-tool-answer-eliminator",highlighter:"pie-tool-annotation-toolbar",lineReader:"pie-tool-line-reader",theme:"pie-tool-theme",annotationToolbar:"pie-tool-annotation-toolbar",graph:"pie-tool-graph",periodicTable:"pie-tool-periodic-table"},X5=(J,Q)=>{let X=Q?.toolTagMap?.[J]??j9[J]??J;return Q5(X,`tool component tag for "${J}"`)},K5=(J)=>document.createElement(J),L0=(J,Q,X,K)=>{let Z=X5(J,K),$=K?.toolComponentFactories?.[J]??K?.toolComponentFactory;return $?$({toolId:J,tagName:Z,context:Q,toolbarContext:X}):K5(Z)};var R9=new WeakMap;function Z5(J,Q){if(!J)return null;let X=R9.get(J),K=X?.get(Q);if(!K)return null;if(!K.isConnected)return X?.delete(Q),null;return K}function W5(J,Q,X){if(!J)return;let K=R9.get(J);if(!K)K=new Map,R9.set(J,K);K.set(Q,X)}function _Q(J){return J==="basic"||J==="scientific"?J:null}function $5(J){let Q=J.getToolRenderParams?.("calculator")??{},X=_Q(Q.calculatorType),K=Q.availableTypes,Z=Array.isArray(K)?K.map((W)=>_Q(W)).filter((W)=>W!==null):X?[X]:null;return{calculatorType:X,availableTypes:Z,displayName:X==="scientific"?"Scientific Calculator":X==="basic"?"Basic Calculator":"Calculator"}}function dQ(J,Q,X){let K=J;if(Q)K.calculatorType=Q,J.setAttribute("calculator-type",Q);else delete K.calculatorType,J.removeAttribute("calculator-type");if(X&&X.length>0)K.availableTypes=X;else delete K.availableTypes}var lQ={toolId:"calculator",name:"Calculator",description:"Multi-type calculator (basic, scientific, graphing)",icon:"calculator",provider:{getProviderId:(J)=>typeof J?.provider?.id==="string"&&J.provider.id.length>0?J.provider.id:"calculator-desmos",createProvider:()=>new Y8,getInitConfig:(J)=>J?.provider?.init??{},getAuthFetcher:(J)=>{let Q=J?.provider?.runtime?.authFetcher;if(typeof Q==="function")return Q;return async()=>{let X=await fetch("/api/tools/desmos/auth",{method:"GET",credentials:"same-origin"});if(!X.ok)throw Error(`Failed to fetch Desmos auth config (${X.status})`);return await X.json()}},lazy:!0},supportedLevels:["item"],pnpSupportIds:["calculator","graphingCalculator","basicCalculator","scientificCalculator"],isVisibleInContext(J){return _J(J)},renderToolbar(J,Q){let{calculatorType:X,availableTypes:K,displayName:Z}=$5(Q),W=G7(this.toolId,Q.scope.level,Q.scope.scopeId),$=Q.componentOverrides,G=Z5(Q.toolCoordinator,W),z=G??L0(this.toolId,J,Q,$);if(!G)W5(Q.toolCoordinator,W,z);z.setAttribute("tool-id",W),z.toolkitCoordinator=Q.toolkitCoordinator,dQ(z,X,K);let U=X===null?"Open scientific calculator":`Open ${Z.toLowerCase()}`,q=X===null?"Close scientific calculator":`Close ${Z.toLowerCase()}`,P={toolId:this.toolId,label:Z,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:U,tooltip:Z,onClick:()=>Q.toggleTool(this.toolId),active:Q.isToolVisible(W)},H=P.active;if(z.visible!==P.active)z.visible=P.active;return{toolId:this.toolId,elements:[{element:z,mount:"after-buttons",shell:{title:this.name,draggable:!0,resizable:!0,closeable:!0,initialWidth:380,initialHeight:420,minWidth:380,minHeight:420,initialAlign:"bottom-right",initialMargin:16,content:{overflowY:"auto",preserveMinHeight:!0}}}],button:P,sync:()=>{let Y=Q.isToolVisible(W);if(P.active=Y,P.label=Z,P.ariaLabel=Y?q:U,P.tooltip=Y?`Close ${Z.toLowerCase()}`:Z,H!==Y)z.visible=Y,H=Y;if(z.toolkitCoordinator!==Q.toolkitCoordinator)z.toolkitCoordinator=Q.toolkitCoordinator;dQ(z,X,K)},subscribeActive:(Y)=>{if(!Q.subscribeVisibility)return()=>{};return Q.subscribeVisibility(()=>{Y(Q.isToolVisible(W))})}}}};var V8=(J)=>J.trim().replace(/\s+/g," "),DV=()=>/[\p{L}]+|\d+(?:\.\d+)?|[±√=+\-*/()²³^×÷≤≥≠≈<>|%°'′\u2062]/gu,G5=(J)=>{if(J.hidden)return!0;if(J.tagName?.toLowerCase()==="mjx-assistive-mml")return!0;if(J.getAttribute("aria-hidden")==="true")return!0;if(J.hasAttribute("inert"))return!0;let Q=J.classList;if(Q?.contains("sr-only")||Q?.contains("pie-sr-only")||Q?.contains("visually-hidden"))return!0;if(typeof window<"u"){let X=window.getComputedStyle(J);if(X.display==="none"||X.visibility==="hidden")return!0;let K=Number.parseFloat(X.width||"0"),Z=Number.parseFloat(X.height||"0"),W=Number.isFinite(K)&&Number.isFinite(Z)&&K<=1&&Z<=1,$=X.clipPath.includes("inset(50%")||X.clipPath.includes("inset(100%")||X.clip.includes("rect(0px, 0px, 0px, 0px)")||X.clip.includes("rect(0 0 0 0)");if((X.position==="absolute"||X.position==="fixed")&&W&&(X.overflow==="hidden"||$))return!0;if(X.opacity==="0"&&W)return!0}return!1},z5=(J,Q)=>{let X=J.nodeType===1?J:J.parentElement;while(X){if(G5(X))return!0;if(Q&&X===Q)break;X=X.parentElement}return!1},q5=(J,Q,X)=>{if(!J||!Q)return!1;if(/\s/.test(J)||/\s/.test(Q))return!1;let K=X?.boundarySpacingMode??"segmenterPreferred";if(K==="none")return!1;if(K==="segmenterPreferred")try{let $=globalThis.Intl?.Segmenter;if(typeof $==="function"){let G=new $(X?.locale,{granularity:"word"});if(Array.from(G.segment(`${J}${Q}`)).filter((q)=>q.isWordLike!==!1&&q.segment.trim().length>0).length>=2)return!0}}catch{}let Z=/[A-Za-z0-9]/.test(J),W=/[A-Za-z0-9]/.test(Q);return Z&&W},jV=(J,Q)=>{let X=new Map;if(typeof document>"u"||typeof document.createTreeWalker!=="function"||typeof NodeFilter>"u")return{text:"",map:X};let K=[],Z=0,W=!0,$=!1,G=null,z=null,U=document.createTreeWalker(J,NodeFilter.SHOW_TEXT),q=U.nextNode();while(q){let H=q;if(H.parentElement&&!z5(H,J)){let V=H.textContent||"",F=V.match(/\S/),M=F?F[0]:null;if(!W&&!$&&q5(z,M,Q)){if(K.push(" "),G)X.set(Z,G);Z++,$=!0}for(let O=0;O<V.length;O++){let j=V[O],T=/\s/.test(j);if(W){if(!T)W=!1,K.push(j),X.set(Z,{node:H,offset:O}),G={node:H,offset:O},Z++,$=!1,z=j}else if(T){if(!$)K.push(" "),X.set(Z,{node:H,offset:O}),G={node:H,offset:O},Z++;$=!0}else K.push(j),X.set(Z,{node:H,offset:O}),G={node:H,offset:O},Z++,$=!1,z=j}}q=U.nextNode()}let P=K.join("").trimEnd();while(X.has(P.length))X.delete(P.length);return{text:P,map:X}};var C9=null,cQ=Promise.resolve(),U5=(J)=>(J||"en").split("-")[0].toLowerCase()||"en",H5=async()=>{if(!C9)C9=import("speech-rule-engine").then((J)=>{let Q=J.default||J;if(!Q||typeof Q.toSpeech!=="function")throw Error("speech-rule-engine did not expose toSpeech");return Q});return C9},P5=(J)=>J==="en"?"clearspeak":"mathspeak",iQ=(J)=>!!J&&typeof J==="object"&&!Array.isArray(J),sQ=(J)=>typeof J==="string"&&J.trim()?J.trim():void 0,I9=(J)=>{if(!iQ(J))return;let Q=sQ(J.domain),X=sQ(J.style),K=iQ(J.engineOptions)?J.engineOptions:void 0;if(!Q&&!X&&!K)return;return{...Q?{domain:Q}:{},...X?{style:X}:{},...K?{engineOptions:K}:{}}},Y5=async(J,Q,X,K)=>{let Z=U5(Q),W=I9(K);await J.setupEngine?.({...W?.engineOptions||{},locale:Z,domain:W?.domain||P5(Z),...W?.style?{style:W.style}:{},modality:"speech",markup:X}),await J.engineReady?.()},B5=async(J)=>{let Q=cQ.then(J,J);return cQ=Q.then(()=>{return},()=>{return}),Q},oQ=async(J,Q,X,K,Z)=>B5(async()=>{return await Y5(J,X,K,Z),J.toSpeech(Q)}),V5=(J)=>J.replace(/^\s*<\?xml[^>]*\?>\s*/i,""),M5=async(J,Q,X,K)=>{try{let Z=V5(await oQ(J,Q,X,"ssml",K));return Z.includes("<speak")?Z:null}catch(Z){return console.debug("[TTSService] Math SSML generation failed; using plain",{message:Z instanceof Error?Z.message:String(Z)}),null}},IV=async(J,Q={})=>{if(!J.some((U)=>U.type==="math"))return{speechText:V8(J.map((U)=>U.type==="text"?U.text:U.fallbackText).join(" ")),usedMathSpeech:!1,usedFallback:!1};let X=null,K=!1,Z=!1,W=Q.loadSre||H5,$=[];for(let U of J){if(U.type==="text"){$.push(U.text);continue}try{if(!X)X=await W();let q=V8(await oQ(X,U.mathml,Q.language,"none",Q.mathSpeech));if(q){$.push(q),K=!0;continue}Z=!0,$.push(U.fallbackText)}catch(q){Z=!0,console.debug("[TTSService] Math speech generation failed; using visible fallback",{message:q instanceof Error?q.message:String(q)}),$.push(U.fallbackText)}}let G=V8($.join(" ")),z;if(Q.produceSsml&&X&&K&&J.length===1&&J[0].type==="math")z=await M5(X,J[0].mathml,Q.language,Q.mathSpeech)??void 0;return{speechText:G,usedMathSpeech:K,usedFallback:Z,ssml:z}};var F5=new Set(["reserved-row","expanding-row","floating-overlay","left-aligned"]),T9=(J)=>J&&typeof J==="object"?J:{},L5=(J)=>J==="polly"||J==="google"||J==="server",g0=(J,Q)=>J===void 0?Q:J,R7=(J,Q="left-aligned")=>typeof J==="string"&&F5.has(J)?J:Q,xV=Object.freeze([0.8,1.25]),aQ=Object.freeze([{rate:0.8,label:"Slow",ariaLabel:"Slow speed"},{rate:1,label:"Normal",ariaLabel:"Normal speed",default:!0},{rate:1.25,label:"Fast",ariaLabel:"Fast speed"}]);var rQ=(J)=>{if(typeof J!=="number"||!Number.isFinite(J)||J<=0)return;return Math.round(J*100)/100},nQ=(J)=>{if(typeof J!=="string")return;let Q=J.trim();return Q.length?Q:void 0},tQ=(J)=>`${J}x`,eQ=(J,Q)=>J.toLowerCase()==="normal"?"Normal speed":Q?`Speed ${J}`:`${J} speed`,w5=(J,Q,X)=>{if(!Q)return eQ(J,X);if(Q.toLowerCase().includes(J.toLowerCase()))return Q;return`${J} ${Q}`};var C7=(J)=>{let Q=Array.isArray(J)?J:[...aQ];if(Q.length===0)return[];let X=new Set,K=[];for(let $ of Q){let G=T9($),z=typeof $==="number"?rQ($):rQ(G.rate);if(z===void 0||X.has(z))continue;X.add(z);let U=z===1?"Normal":typeof $==="number"?tQ(z):tQ(z),q=typeof $==="number"?U:nQ(G.label)||U,P=typeof $==="number"?z===1?"Normal speed":eQ(q,!0):w5(q,nQ(G.ariaLabel),q===U);K.push({rate:z,label:q,ariaLabel:P,isDefault:!1,requestedDefault:G.default===!0||G.isDefault===!0})}if(!K.length)return C7(aQ);if(!X.has(1)){let $={rate:1,label:"Normal",ariaLabel:"Normal speed",isDefault:!1,requestedDefault:!1},G=K.findIndex((z)=>z.rate>1);if(G>=0)K.splice(G,0,$);else K.push($)}let Z=K.findIndex(($)=>$.requestedDefault),W=Z>=0?Z:K.findIndex(($)=>$.rate===1);return K.map(({requestedDefault:$,...G},z)=>({...G,isDefault:z===W}))};var kV=Object.freeze([0.8,1,1.25]);var O5=(J)=>{let Q={...J,layoutMode:R7(J.layoutMode)},X=J.backend||"browser";if(!L5(X))return Q;let K={...Q,apiEndpoint:g0(Q.apiEndpoint,"/api/tts"),transportMode:g0(Q.transportMode,"pie"),endpointValidationMode:g0(Q.endpointValidationMode,"voices"),validateEndpoint:g0(Q.validateEndpoint,!0),includeAuthOnAssetFetch:g0(Q.includeAuthOnAssetFetch,!1),rate:g0(Q.rate,1),language:g0(Q.language,"en-US")};if(X==="polly")return{...K,defaultVoice:g0(K.defaultVoice,"Joanna"),engine:g0(K.engine,"neural"),format:g0(K.format,"mp3"),speechMarksMode:g0(K.speechMarksMode,"word+sentence")};if(X==="google")return{...K,defaultVoice:g0(K.defaultVoice,"en-US-Wavenet-A")};return K},M8=(J)=>{let Q=T9(J),X=T9(Q.settings);return O5({...Q,...X})},F8=(J)=>J.backend||"browser",E9=(J,Q)=>{if(Q==="polly"||Q==="google")return Q;if(Q==="server")return J.serverProvider||J.provider;return J.serverProvider||J.provider},x9=(J,Q)=>J.transportMode||(Q==="custom"?"custom":"pie"),J6=(J)=>{let Q=F8(J),X=E9(J,Q),K=x9(J,X),Z=I9(J.mathSpeech);return{voice:J.defaultVoice,rate:J.rate,pitch:J.pitch,providerOptions:{...J.language?{locale:J.language}:{},...Q==="polly"&&J.engine?{engine:J.engine}:{},...Q==="polly"&&typeof J.sampleRate==="number"?{sampleRate:J.sampleRate}:{},...Q==="polly"&&J.format?{format:J.format}:{},...Q==="polly"?{speechMarkTypes:J.speechMarksMode==="word+sentence"?["word","sentence"]:["word"]}:{},...K==="custom"&&typeof J.cache==="boolean"?{cache:J.cache}:{},...K==="custom"&&J.speedRate?{speedRate:J.speedRate}:{},...K==="custom"&&J.lang_id?{lang_id:J.lang_id}:{},...Z?{mathSpeech:Z}:{}},apiEndpoint:J.apiEndpoint,provider:X,language:J.language,transportMode:K,endpointMode:J.endpointMode,endpointValidationMode:J.endpointValidationMode,includeAuthOnAssetFetch:J.includeAuthOnAssetFetch,validateEndpoint:J.validateEndpoint,...typeof J.mathTokenHighlighting==="boolean"?{mathTokenHighlighting:J.mathTokenHighlighting}:{}}},k9=(J)=>R7(J.layoutMode),Q6=(J)=>{switch(k9(J)){case"reserved-row":return{mount:"before-buttons",controlsRow:{reserveSpace:!0,expandWhenToolActive:!1},headerOverlay:{expandWhenToolActive:!1}};case"expanding-row":return{mount:"before-buttons",controlsRow:{reserveSpace:!1,expandWhenToolActive:!0},headerOverlay:{expandWhenToolActive:!1}};case"floating-overlay":return{mount:"before-buttons",controlsRow:{reserveSpace:!1,expandWhenToolActive:!1},headerOverlay:{expandWhenToolActive:!1}};case"left-aligned":default:return{mount:"before-buttons",controlsRow:{reserveSpace:!1,expandWhenToolActive:!1},headerOverlay:{expandWhenToolActive:!0}}}};var I7=new Map,S5="__pieToolElementUnmount",X6="pie-tool-active-change",K6={toolId:"textToSpeech",name:"Text to Speech",description:"Read content aloud",icon:"volume-up",provider:{getProviderId:()=>"tts",createProvider:(J)=>{let Q=M8(J);return new B8(F8(Q))},getInitConfig:(J)=>{let Q=M8(J),X=F8(Q),K=E9(Q,X),Z=x9(Q,K);return{backend:X,serverProvider:K,transportMode:Z,...J6(Q)}},getAuthFetcher:(J)=>{let Q=J?.provider?.runtime?.authFetcher;return typeof Q==="function"?Q:void 0},sanitizeConfig:(J)=>{let Q=J.settings&&typeof J.settings==="object"?{...J.settings}:void 0;if(Q&&"layoutMode"in Q)Q.layoutMode=R7(Q.layoutMode);if(Q&&"speedOptions"in Q)Q.speedOptions=C7(Q.speedOptions);let X={...J};if("layoutMode"in X)X.layoutMode=R7(X.layoutMode);if("speedOptions"in X)X.speedOptions=C7(X.speedOptions);if(Q)X.settings=Q;return X},lazy:!0},supportedLevels:["item","passage"],pnpSupportIds:["textToSpeech","readAloud","tts","speechOutput"],isVisibleInContext(J){return dJ(J)},renderToolbar(J,Q){let X=()=>M8(Q.toolkitCoordinator?.getToolConfig(this.toolId)||void 0),K=()=>{let q=X();return C7(q.speedOptions)},Z=()=>k9(X()),W=()=>Q6(X()),$=G7(this.toolId,Q.scope.level,Q.scope.scopeId),G=()=>{let q=Q.ui?.size;return q==="sm"||q==="lg"?q:"md"},z=()=>{let q=I7.get($);if(q&&typeof q.isConnected==="boolean"&&!q.isConnected)I7.delete($),q=void 0;if(!q)q=document.createElement("pie-tool-tts-inline"),q[S5]=()=>{if(I7.get($)===q)I7.delete($)},I7.set($,q);return q.setAttribute("tool-id",$),q.setAttribute("catalog-id",Q.catalogId||Q.itemId),q.setAttribute("language",Q.language||"en-US"),q.setAttribute("size",G()),q.setAttribute("layout-mode",Z()),q.speedOptions=K(),q.showSingleSpeedOption=X().showSingleSpeedOption===!0,q},U=W();return{toolId:this.toolId,button:null,elements:[{element:z(),mount:U.mount,layoutHints:{controlsRow:{reserveSpace:U.controlsRow.reserveSpace,showWhenToolActive:U.controlsRow.expandWhenToolActive},headerOverlay:{showWhenToolActive:U.headerOverlay.expandWhenToolActive}}}],subscribeActive:(q)=>{let P=z(),H=(Y)=>{let V=Y.detail;q(V?.active===!0)};return P.addEventListener(X6,H),()=>{P.removeEventListener(X6,H)}},sync:()=>{let q=z();q.setAttribute("tool-id",$),q.setAttribute("catalog-id",Q.catalogId||Q.itemId),q.setAttribute("language",Q.language||"en-US"),q.setAttribute("size",G()),q.setAttribute("layout-mode",Z()),q.speedOptions=K(),q.showSingleSpeedOption=X().showSingleSpeedOption===!0}}}};function x0(J,Q){let X=G7(J,Q.scope.level,Q.scope.scopeId);return{fullToolId:X,isActive:()=>Q.isToolVisible(X),subscribeActive:(K)=>{if(!Q.subscribeVisibility)return()=>{};return Q.subscribeVisibility(()=>{K(Q.isToolVisible(X))})}}}function k0(J){let Q=J.isActive();J.button.active=Q,J.overlay.visible=Q,J.onActiveChange?.(Q)}function T7(J,Q){J.setAttribute("data-pie-tool-surface",Q)}var Z6={toolId:"ruler",name:"Ruler",description:"On-screen ruler for measurements",icon:"ruler",supportedLevels:["section","item","element"],pnpSupportIds:["ruler","measurement"],isVisibleInContext(J){return _J(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Open ruler tool",tooltip:"Ruler",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),T7(W,"frameless"),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons"}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive}),Q.toolkitCoordinator)W.toolkitCoordinator=Q.toolkitCoordinator},subscribeActive:X.subscribeActive}}},W6={toolId:"protractor",name:"Protractor",description:"On-screen protractor for angle measurements",icon:"protractor",supportedLevels:["section","item","element"],pnpSupportIds:["protractor","angleMeasurement"],isVisibleInContext(J){return _J(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Open protractor tool",tooltip:"Protractor",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),T7(W,"frameless"),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons"}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive}),Q.toolkitCoordinator)W.toolkitCoordinator=Q.toolkitCoordinator},subscribeActive:X.subscribeActive}}};var $6={toolId:"answerEliminator",name:"Answer Eliminator",description:"Strike through answer choices",icon:"strikethrough",supportedLevels:["item"],pnpSupportIds:["answerMasking","answerEliminator","strikethrough","choiceMasking"],isVisibleInContext(J){return gQ(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K=Q.componentOverrides??{},Z=L0(this.toolId,J,Q,K);Z.setAttribute("tool-id",X.fullToolId),Z.setAttribute("strategy","strikethrough"),Z.setAttribute("button-alignment","inline");let W={toolId:this.toolId,label:this.name,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M19,3H16.3H7.7H5A2,2 0 0,0 3,5V7.7V16.4V19A2,2 0 0,0 5,21H7.7H16.4H19A2,2 0 0,0 21,19V16.3V7.7V5A2,2 0 0,0 19,3M15.6,17L12,13.4L8.4,17L7,15.6L10.6,12L7,8.4L8.4,7L12,10.6L15.6,7L17,8.4L13.4,12L17,15.6L15.6,17Z"/></svg>',disabled:!1,ariaLabel:"Answer eliminator - Strike through choices",tooltip:"Strike Through",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()};return{toolId:this.toolId,button:W,elements:[{element:Z,mount:"after-buttons"}],sync:()=>{if(k0({button:W,overlay:Z,isActive:X.isActive}),Q.toolCoordinator)Z.coordinator=Q.toolCoordinator;if(Z.scopeElement=Q.getScopeElement?.()||null,Q.elementToolStateStore)Z.elementToolStateStore=Q.elementToolStateStore;let $=Q.getGlobalElementId?.();if($)Z.globalElementId=$},subscribeActive:X.subscribeActive}}},G6={toolId:"highlighter",name:"Highlighter",description:"Highlight text",icon:"highlighter",activation:"toolbar-toggle",supportedLevels:["passage","rubric","item","element"],pnpSupportIds:["highlighter","textHighlight","annotation"],isVisibleInContext(J){return dJ(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Highlighter - Highlight text",tooltip:"Highlight",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons"}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive,onActiveChange:($)=>{W.enabled=$}}),Q.ttsService)W.ttsService=Q.ttsService},subscribeActive:X.subscribeActive}}};var z6={toolId:"lineReader",name:"Line Reader",description:"Reading guide overlay",icon:"bars-3",supportedLevels:["section","passage","rubric","item"],pnpSupportIds:["readingMask","readingGuide","readingRuler","lineReader","trackingGuide"],isVisibleInContext(J){return dJ(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Line reader - Reading guide",tooltip:"Line Reader",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),T7(W,"frameless"),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons"}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive}),Q.toolkitCoordinator)W.toolkitCoordinator=Q.toolkitCoordinator},subscribeActive:X.subscribeActive}}},q6={toolId:"theme",name:"Theme",description:"Accessible themes and contrast",icon:"swatch",supportedLevels:["assessment","section"],pnpSupportIds:["highContrastDisplay","colorContrast","invertColors","theme","highContrast","customColors"],isVisibleInContext(J){return!0},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Theme - Change colors and contrast",tooltip:"Theme",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons",shell:{title:this.name,draggable:!0,resizable:!1,closeable:!0,initialWidth:520,initialHeight:380,minWidth:420,minHeight:300}}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive}),Q.toolkitCoordinator)W.toolkitCoordinator=Q.toolkitCoordinator},subscribeActive:X.subscribeActive}}},U6={toolId:"annotationToolbar",name:"Highlighter",description:"Highlight and annotate text",icon:"highlighter",activation:"selection-gateway",singletonScope:"section",supportedLevels:["passage","rubric","item","element"],pnpSupportIds:["highlighting","annotations","highlighter","textHighlight","annotation"],isVisibleInContext(J){return dJ(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Annotation toolbar - Highlight text",tooltip:"Highlight",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons"}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive}),Q.toolkitCoordinator)W.toolkitCoordinator=Q.toolkitCoordinator},subscribeActive:X.subscribeActive}}};var H6={toolId:"graph",name:"Graph",description:"Graphing calculator and coordinate plane",icon:"chart-bar",supportedLevels:["section"],pnpSupportIds:["graph","graphingCalculator","coordinatePlane","graphingTool"],isVisibleInContext(J){return _J(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Graph - Graphing calculator",tooltip:"Graph",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons",shell:{title:this.name,draggable:!0,resizable:!0,closeable:!0,initialWidth:920,initialHeight:680,minWidth:640,minHeight:500}}],sync:()=>{k0({button:K,overlay:W,isActive:X.isActive})},subscribeActive:X.subscribeActive}}},P6={toolId:"periodicTable",name:"Periodic Table",description:"Chemistry periodic table reference",icon:"beaker",supportedLevels:["section"],pnpSupportIds:["periodicTable","chemistryReference","elementReference"],isVisibleInContext(J){return mQ(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Periodic table - Chemistry reference",tooltip:"Periodic Table",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons",shell:{title:this.name,draggable:!0,resizable:!0,closeable:!0,initialWidth:1160,initialHeight:760,minWidth:920,minHeight:620}}],sync:()=>{k0({button:K,overlay:W,isActive:X.isActive})},subscribeActive:X.subscribeActive}}};var A5=[lQ,K6,Z6,W6,$6,G6,z6,q6,U6,H6,P6];function N5(J={}){let Q=new A9,X={toolTagMap:{...j9,...J.toolTagMap||{}},toolComponentFactory:J.toolComponentFactory,toolComponentFactories:J.toolComponentFactories},K=(Z)=>J.overrides?.[Z.toolId]||Z;if(J.includePackagedTools)D5(Q,{toolIds:J.toolIds,applyOverrides:K});if(J.toolModuleLoaders&&Object.keys(J.toolModuleLoaders).length>0)Q.setToolModuleLoaders(J.toolModuleLoaders);return Q.setComponentOverrides(X),Q}function D5(J,Q={}){let X=Q.toolIds&&Q.toolIds.length>0?new Set(Q.toolIds):null,K=Q.applyOverrides||((Z)=>Z);for(let Z of A5){if(X&&!X.has(Z.toolId))continue;J.register(K(Z))}}function BM(J={}){return N5({...J,includePackagedTools:!0})}
|
|
51
|
-
export{KQ as b,T8 as c,E8 as d,
|
|
47
|
+
`)}),n(Q,"name",{value:J}),Q}function O6(){let J=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let Q=Error().stack;if(Error.stackTraceLimit=J,!Q)return[];let X=Q.split(`
|
|
48
|
+
`),K=[];for(let Z=0;Z<X.length;Z++){let W=X[Z],$=W.replaceAll("\\","/");if(W.trim()==="Error")continue;if(W.includes("validate_each_keys"))return[];if($.includes("svelte/src/internal")||$.includes("node_modules/.vite"))continue;K.push(W)}return K}function R4(J,Q){if(!P)throw Error("invariant(...) was not guarded by if (DEV)");if(!J)W4(Q)}function JJ(J){var Q=S,X=L;f(null),p(null);try{return J()}finally{f(Q),p(X)}}function C4(J){let Q=0,X=q0(0),K;if(P)G0(X,"createSubscriber version");return()=>{if(OJ())I(X),e(()=>{if(Q===0)K=h(()=>J(()=>bJ(X)));return Q+=1,()=>{s(()=>{if(Q-=1,Q===0)K?.(),K=void 0,bJ(X)})}})}}var A6=~(C|v|k);function x(J,Q){J.f=J.f&A6|Q}function tJ(J){if((J.f&K0)!==0||J.deps===null)x(J,k);else x(J,v)}function I4(J){if(J===null)return;for(let Q of J){if((Q.f&b)===0||(Q.f&j0)===0)continue;Q.f^=j0,I4(Q.deps)}}function l7(J,Q,X){if((J.f&C)!==0)Q.add(J);else if((J.f&v)!==0)X.add(J);I4(J.deps),x(J,k)}var N6=w0|o0;function h8(J,Q,X,K){new g8(J,Q,X,K)}class g8{parent;is_pending=!1;transform_error;#J;#Q=w?N:null;#X;#G;#W;#$=null;#K=null;#z=null;#Z=null;#V=0;#U=0;#H=!1;#Y=new Set;#M=new Set;#q=null;#w=C4(()=>{if(this.#q=q0(this.#V),P)G0(this.#q,"$effect.pending()");return()=>{this.#q=null}});constructor(J,Q,X,K){if(this.#J=J,this.#X=Q,this.#G=(Z)=>{var W=L;W.b=this,W.f|=iJ,X(Z)},this.parent=L.b,this.transform_error=K??this.parent?.transform_error??((Z)=>Z),this.#W=S0(()=>{if(w){let Z=this.#Q;l();let W=Z.data===MJ;if(Z.data.startsWith(D8)){let G=JSON.parse(Z.data.slice(D8.length));this.#O(G)}else if(W)this.#A();else this.#F()}else this.#B()},N6),w)this.#J=N}#F(){try{this.#$=o(()=>this.#G(this.#J))}catch(J){this.error(J)}}#O(J){let Q=this.#X.failed,{reset:X,invoke_onerror:K}=this.#S(J);if(s(K),!Q)return;this.#z=o(()=>{Q(this.#J,()=>J,()=>X)})}#S(J){var Q=!1,X=!1;let K=()=>{if(Q){X4();return}if(Q=!0,X)O4();if(this.#z!==null)QJ(this.#z,()=>{this.#z=null});this.#P(()=>{this.#B()})};return{reset:K,invoke_onerror:()=>{try{X=!0,this.#X.onerror?.(J,K),X=!1}catch(W){p0(W,this.#W&&this.#W.parent)}}}}#A(){let J=this.#X.pending;if(!J)return;this.is_pending=!0,this.#K=o(()=>J(this.#J)),s(()=>{var Q=this.#Z=document.createDocumentFragment(),X=a();if(Q.append(X),this.#$=this.#P(()=>{return o(()=>this.#G(X))}),this.#U===0)this.#J.before(Q),this.#Z=null,QJ(this.#K,()=>{this.#K=null}),this.#L(A)})}#B(){try{if(this.is_pending=this.has_pending_snippet(),this.#U=0,this.#V=0,this.#$=o(()=>{this.#G(this.#J)}),this.#U>0){var J=this.#Z=document.createDocumentFragment();eJ(this.#$,J);let Q=this.#X.pending;this.#K=o(()=>Q(this.#J))}else this.#L(A)}catch(Q){this.error(Q)}}#L(J){this.is_pending=!1,J.transfer_effects(this.#Y,this.#M)}defer_effect(J){l7(J,this.#Y,this.#M)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#X.pending}#P(J){var Q=L,X=S,K=D;p(this.#W),f(this.#W),qJ(this.#W.ctx);try{return $0.ensure(),J()}catch(Z){return v7(Z),null}finally{p(Q),f(X),qJ(K)}}#N(J,Q){if(!this.has_pending_snippet()){if(this.parent)this.parent.#N(J,Q);return}if(this.#U+=J,this.#U===0){if(this.#L(Q),this.#K)QJ(this.#K,()=>{this.#K=null});if(this.#Z)this.#J.before(this.#Z),this.#Z=null}}update_pending_count(J,Q){if(this.#N(J,Q),this.#V+=J,!this.#q||this.#H)return;this.#H=!0,s(()=>{if(this.#H=!1,this.#q)d0(this.#q,this.#V)})}get_effect_pending(){return this.#w(),I(this.#q)}error(J){if(!this.#X.onerror&&!this.#X.failed)throw J;if(A?.is_fork){if(this.#$)A.skip_effect(this.#$);if(this.#K)A.skip_effect(this.#K);if(this.#z)A.skip_effect(this.#z);A.oncommit(()=>{this.#D(J)})}else this.#D(J)}#D(J){if(this.#$)m(this.#$),this.#$=null;if(this.#K)m(this.#K),this.#K=null;if(this.#z)m(this.#z),this.#z=null;if(w)E(this.#Q),y8(),E(XJ());let Q=this.#X.failed,X=(K)=>{let{reset:Z,invoke_onerror:W}=this.#S(K);if(W(),Q)this.#z=this.#P(()=>{try{return o(()=>{var $=L;$.b=this,$.f|=iJ,Q(this.#J,()=>K,()=>Z)})}catch($){return p0($,this.#W.parent),null}})};s(()=>{var K;try{K=this.transform_error(J)}catch(Z){p0(Z,this.#W&&this.#W.parent);return}if(K!==null&&typeof K==="object"&&typeof K.then==="function")K.then(X,(Z)=>p0(Z,this.#W&&this.#W.parent));else X(K)})}}function c7(J,Q,X,K){let Z=f0()?SJ:yJ;var W=J.filter((B)=>!B.settled),$=Q.map(Z);if(P)$.forEach((B,V)=>{B.label=Q[V].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(F,M)=>M)});if(X.length===0&&W.length===0){K($);return}var G=L,z=T4(),U=W.length===1?W[0].promise:W.length>1?Promise.all(W.map((B)=>B.promise)):null;function q(B){if((G.f&g)!==0)return;z();try{K([...$,...B])}catch(V){p0(V,G)}J7()}var Y=m8();if(X.length===0){U.then(()=>q([])).finally(Y);return}function H(){Promise.all(X.map((B)=>u8(B))).then(q).catch((B)=>p0(B,G)).finally(Y)}if(U)U.then(()=>{z(),H(),J7()});else H()}function T4(){var J=L,Q=S,X=D,K=A;if(P)var Z=e0;return function($=!0){if(p(J),f(Q),qJ(X),$&&(J.f&g)===0)K?.activate(),K?.apply();if(P)v8(null),nJ(Z)}}function J7(J=!0){if(p(null),f(null),qJ(null),J)A?.deactivate();if(P)v8(null),nJ(null)}function m8(){var J=L,Q=J.b,X=A,K=!!Q?.is_rendered();return Q?.update_pending_count(1,X),X.increment(K,J),()=>{Q?.update_pending_count(-1,X),X.decrement(K,J)}}var A0=null;function v8(J){A0=J}var F7=new Set;function SJ(J){var Q=b|C;if(L!==null)L.f|=o0;let X={ctx:D,deps:null,effects:null,equals:u7,f:Q,fn:J,reactions:null,rv:0,v:y,wv:0,parent:L,ac:null};if(P&&u0)X.created=_0("created at");return X}var Q7=Symbol("obsolete");function u8(J,Q,X){let K=L;if(K===null)G4();var Z=void 0,W=q0(y);if(P)W.label=Q??J.toString();var $=!S,G=new Set;if(k4(()=>{var z=L;if(P)A0={effect:z,effect_deps:new Set,warned:!1};var U=g7();Z=U.promise;try{Promise.resolve(J()).then(U.resolve,(B)=>{if(B!==GJ)U.reject(B)}).finally(J7)}catch(B){U.reject(B),J7()}if(P){if(A0){if(z.deps!==null)for(let B=0;B<V0;B+=1)A0.effect_deps.add(z.deps[B]);if(J0!==null)for(let B=0;B<J0.length;B+=1)A0.effect_deps.add(J0[B])}A0=null}var q=A;if($){if((z.f&B0)!==0)var Y=m8();if(K.b?.is_rendered())q.async_deriveds.get(z)?.reject(Q7);else for(let B of G.values())B.reject(Q7);G.add(U),q.async_deriveds.set(z,U)}let H=(B,V=void 0)=>{if(P)A0=null;if(Y?.(),G.delete(U),V===Q7)return;if(q.activate(),V)W.f|=y0,d0(W,V);else{if((W.f&y0)!==0)W.f^=y0;if(P&&X!==void 0&&!W.equals(B))F7.add(W),setTimeout(()=>{if(F7.has(W)&&(z.f&g)===0)r9(W.label,X),F7.delete(W)});d0(W,B)}q.deactivate()};U.promise.then(H,(B)=>H(null,B||"unknown"))}),z0(()=>{for(let z of G)z.reject(Q7)}),P)W.f|=R0;return new Promise((z)=>{function U(q){function Y(){if(q===Z)z(W);else U(Z)}q.then(Y,Y)}U(Z)})}function j6(J){let Q=SJ(J);if(!t)o7(Q);return Q}function yJ(J){let Q=SJ(J);return Q.equals=p7,Q}function E4(J){var Q=J.effects;if(Q!==null){J.effects=null;for(var X=0;X<Q.length;X+=1)m(Q[X])}}var f8=[];function L7(J){var Q,X=L,K=J.parent;if(!T0&&K!==null&&J.v!==y&&(K.f&(g|d))!==0)return n9(),J.v;if(p(K),P){let Z=hJ;i7(new Set);try{if(LJ.call(f8,J))z4();f8.push(J),J.f&=~j0,E4(J),Q=s7(J)}finally{p(X),i7(Z),f8.pop()}}else try{J.f&=~j0,E4(J),Q=s7(J)}finally{p(X)}return Q}function p8(J){var Q=L7(J);if(!J.equals(Q)){if(J.wv=X7(),!A?.is_fork||J.deps===null){if(A!==null)A.capture(J,Q,!0),AJ?.capture(J,Q,!0);else J.v=Q;if(J.deps===null){x(J,k);return}}}if(T0)return;if(Q0!==null){if(OJ()||A?.is_fork)Q0.set(J,Q)}else tJ(J)}function x4(J){if(J.effects===null)return;for(let Q of J.effects)if(Q.teardown||Q.ac){if(Q.teardown?.(),Q.ac!==null)JJ(()=>{Q.ac.abort(GJ),Q.ac=null});if(Q.fn!==null)Q.teardown=t0;gJ(Q,0),w7(Q)}}function _8(J){if(J.effects===null)return;for(let Q of J.effects)if(Q.teardown&&Q.fn!==null)KJ(Q)}var hJ=new Set,UJ=new Map;function i7(J){hJ=J}var d8=!1;function b4(){d8=!0}function q0(J,Q){var X={f:0,v:J,reactions:null,equals:u7,rv:0,wv:0};if(P&&u0)X.created=Q??_0("created at"),X.updated=null,X.set_during_effect=!1,X.trace=null;return X}function ZJ(J,Q){let X=q0(J,Q);return o7(X),X}function mJ(J,Q=!1,X=!0){let K=q0(J);if(!Q)K.equals=p7;if(wJ&&X&&D!==null&&D.l!==null)(D.l.s??=[]).push(K);return K}function U0(J,Q,X=!1){if(S!==null&&(!M0||(S.f&VJ)!==0)&&f0()&&(S.f&(b|X0|R0|VJ))!==0&&(l0===null||!l0.has(J)))w4();let K=X?HJ(Q):Q;if(P)d7(K,J.label);return d0(J,K,O7)}function d0(J,Q,X=null){if(!J.equals(Q)){UJ.set(J,T0?Q:J.v);var K=$0.ensure();if(K.capture(J,Q),P){if(u0||L!==null){J.updated??=new Map;let Z=(J.updated.get("")?.count??0)+1;if(J.updated.set("",{error:null,count:Z}),u0||Z>5){let W=_0("updated at");if(W!==null){let $=J.updated.get(W.stack);if(!$)$={error:W,count:0},J.updated.set(W.stack,$);$.count++}}}if(L!==null)J.set_during_effect=!0}if((J.f&b)!==0){let Z=J;if((J.f&C)!==0)L7(Z);if(Q0===null)tJ(Z)}if(J.wv=X7(),y4(J,C,X),f0()&&L!==null&&(L.f&k)!==0&&(L.f&(c|Y0))===0)if(E0===null)h4([J]);else E0.push(J);if(!K.is_fork&&hJ.size>0&&!d8)a7()}return Q}function a7(){d8=!1;for(let J of hJ){if((J.f&k)!==0)x(J,v);let Q;try{Q=NJ(J)}catch{Q=!0}if(Q)KJ(J)}hJ.clear()}function bJ(J){U0(J,J.v+1)}function y4(J,Q,X){var K=J.reactions;if(K===null)return;var Z=f0(),W=K.length;for(var $=0;$<W;$++){var G=K[$],z=G.f;if(!Z&&G===L)continue;var U=(z&C)===0;if(U)x(G,Q);if((z&VJ)!==0)hJ.add(G);else if((z&b)!==0){var q=G;if(Q0?.delete(q),(z&j0)===0){if(z&K0&&(L===null||(L.f&IJ)===0))G.f|=j0;y4(q,v,X)}}else if(U){var Y=G;if((z&X0)!==0&&h0!==null)h0.add(Y);if(X!==null)X.push(Y);else S7(Y)}}}var g4=!1,r7=!1,VK=Symbol("unmounted");function l8(J){var Q=r7;try{return r7=!1,[J(),r7]}finally{r7=Q}}var n7=null,K7=null,A=null,AJ=null,Q0=null,s8=null,kJ=!1,c8=!1,vJ=null,O7=null,m4=0,i8=new Set,I6=1;class $0{id=I6++;#J=!1;linked=!0;#Q=null;#X=null;async_deriveds=new Map;current=new Map;previous=new Map;#G=new Set;#W=new Set;#$=0;#K=new Map;#z=null;#Z=[];#V=[];#U=new Set;#H=new Set;#Y=new Map;#M=new Set;is_fork=!1;#q=!1;constructor(){if(K7===null)n7=K7=this;else K7.#X=this,this.#Q=K7;K7=this}#w(){if(this.is_fork)return!0;for(let X of this.#K.keys()){var J=X,Q=!1;while(J.parent!==null){if(this.#Y.has(J)){Q=!0;break}J=J.parent}if(!Q)return!0}return!1}skip_effect(J){if(!this.#Y.has(J))this.#Y.set(J,{d:[],m:[]});this.#M.delete(J)}unskip_effect(J,Q=(X)=>this.schedule(X)){var X=this.#Y.get(J);if(X){this.#Y.delete(J);for(var K of X.d)x(K,C),Q(K);for(K of X.m)x(K,v),Q(K)}this.#M.add(J)}#F(){if(this.#J=!0,m4++>1000)this.#P(),T6();if(P)for(let G of this.current.keys())i8.add(G);for(let G of this.#U)this.#H.delete(G),x(G,C),this.schedule(G);for(let G of this.#H)x(G,v),this.schedule(G);let J=this.#Z;this.#Z=[],this.apply();var Q=vJ=[],X=[],K=O7=[];for(let G of J)try{this.#O(G,Q,X)}catch(z){if(p4(G),!this.#w())this.discard();throw z}if(A=null,K.length>0){var Z=$0.ensure();for(let G of K)Z.schedule(G)}if(vJ=null,O7=null,this.#w()){this.#B(X),this.#B(Q);for(let[G,z]of this.#Y)f4(G,z);if(K.length>0)A.#F();return}let W=this.#S();if(W){this.#B(X),this.#B(Q),W.#A(this);return}this.#U.clear(),this.#H.clear();for(let G of this.#G)G(this);this.#G.clear(),AJ=this,v4(X),v4(Q),AJ=null,this.#z?.resolve();var $=A;if(this.#$===0&&(this.#Z.length===0||$!==null)){if(this.#P(),t)this.#L(),A=$}if(this.#Z.length>0)if($!==null){let G=$;G.#Z.push(...this.#Z.filter((z)=>!G.#Z.includes(z)))}else $=this;if($!==null)$.#F()}#O(J,Q,X){J.f^=k;var K=J.first;while(K!==null){var Z=K.f,W=(Z&(c|Y0))!==0,$=W&&(Z&k)!==0,G=$||(Z&d)!==0||this.#Y.has(K);if(!G&&K.fn!==null){if(W)K.f^=k;else if((Z&s0)!==0)Q.push(K);else if(t&&(Z&(PJ|CJ))!==0)X.push(K);else if(NJ(K)){if((Z&X0)!==0)this.#H.add(K);KJ(K)}var z=K.first;if(z!==null){K=z;continue}}while(K!==null){var U=K.next;if(U!==null){K=U;break}K=K.parent}}}#S(){var J=this.#Q;while(J!==null){if(!J.is_fork){for(let[Q,[,X]]of this.current)if(J.current.has(Q)&&!X)return J}J=J.#Q}return null}#A(J){for(let[X,K]of J.current){if(!this.previous.has(X)&&J.previous.has(X))this.previous.set(X,J.previous.get(X));this.current.set(X,K)}for(let[X,K]of J.async_deriveds){let Z=this.async_deriveds.get(X);if(Z)K.promise.then(Z.resolve).catch(Z.reject)}J.async_deriveds.clear(),this.transfer_effects(J.#U,J.#H);let Q=(X)=>{var K=X.reactions;if(K===null)return;if((X.f&b)!==0&&(X.f&(C|v))===0)return;for(let $ of K){var Z=$.f;if((Z&b)!==0)Q($);else{var W=$;if(Z&(R0|X0)&&!this.async_deriveds.has(W))this.#H.delete(W),x(W,C),this.schedule(W)}}};for(let X of this.current.keys())Q(X);this.oncommit(()=>J.discard()),J.#P(),A=this,this.#F()}#B(J){for(var Q=0;Q<J.length;Q+=1)l7(J[Q],this.#U,this.#H)}capture(J,Q,X=!1){if(J.v!==y&&!this.previous.has(J))this.previous.set(J,J.v);if((J.f&y0)===0)this.current.set(J,[Q,X]),Q0?.set(J,Q);if(!this.is_fork)J.v=Q}activate(){A=this}deactivate(){A=null,Q0=null}flush(){try{if(P)i8.clear();c8=!0,A=this,this.#F()}finally{if(m4=0,s8=null,vJ=null,O7=null,c8=!1,A=null,Q0=null,UJ.clear(),P)for(let J of i8)J.updated=null}}discard(){for(let J of this.#W)J(this);this.#W.clear();for(let J of this.async_deriveds.values())J.reject(Q7);this.#P(),this.#z?.resolve()}register_created_effect(J){this.#V.push(J)}#L(){for(let q=n7;q!==null;q=q.#X){var J=q.id<this.id,Q=[];for(let[Y,[H,B]]of this.current){if(q.current.has(Y)){var X=q.current.get(Y)[0];if(J&&H!==X)q.current.set(Y,[H,B]);else continue}Q.push(Y)}if(J)for(let[Y,H]of this.async_deriveds){let B=q.async_deriveds.get(Y);if(B)H.promise.then(B.resolve).catch(B.reject)}var K=[...q.current.keys()].filter((Y)=>!q.current.get(Y)[1]);if(!q.#J||K.length===0)continue;var Z=K.filter((Y)=>!this.current.has(Y));if(Z.length===0){if(J)q.discard()}else if(Q.length>0){if(P&&!q.#q)R4(q.#Z.length===0,"Batch has scheduled roots");if(J)for(let Y of this.#M)q.unskip_effect(Y,(H)=>{if((H.f&(X0|R0))!==0)q.schedule(H);else q.#B([H])});q.activate();var W=new Set,$=new Map;for(var G of Q)u4(G,Z,W,$);$=new Map;var z=[...q.current].filter(([Y,H])=>{let B=this.current.get(Y);if(!B)return!0;return B[0]!==H[0]||B[1]!==H[1]}).map(([Y])=>Y);if(z.length>0){for(let Y of this.#V)if((Y.f&(g|d|VJ))===0&&o8(Y,z,$))if((Y.f&(R0|X0))!==0)x(Y,C),q.schedule(Y);else q.#U.add(Y)}if(q.#Z.length>0&&!q.#q){q.apply();for(var U of q.#Z)q.#O(U,[],[]);q.#Z=[]}q.deactivate()}}}increment(J,Q){if(this.#$+=1,J){let X=this.#K.get(Q)??0;this.#K.set(Q,X+1)}}decrement(J,Q){if(this.#$-=1,J){let X=this.#K.get(Q)??0;if(X===1)this.#K.delete(Q);else this.#K.set(Q,X-1)}if(this.#q)return;this.#q=!0,s(()=>{if(this.#q=!1,this.linked)this.flush()})}transfer_effects(J,Q){for(let X of J)this.#U.add(X);for(let X of Q)this.#H.add(X);J.clear(),Q.clear()}oncommit(J){this.#G.add(J)}ondiscard(J){this.#W.add(J)}settled(){return(this.#z??=g7()).promise}static ensure(){if(A===null){let J=A=new $0;if(!c8&&!kJ)s(()=>{if(!J.#J)J.flush()})}return A}apply(){if(!t||!this.is_fork&&this.#Q===null&&this.#X===null){Q0=null;return}Q0=new Map;for(let[Q,[X]]of this.current)Q0.set(Q,X);for(let Q=n7;Q!==null;Q=Q.#X){if(Q===this||Q.is_fork)continue;var J=!1;if(Q.id<this.id)for(let[X,[,K]]of Q.current){if(K)continue;if(this.current.has(X)){J=!0;break}}if(!J){for(let[X,K]of Q.previous)if(!Q0.has(X))Q0.set(X,K)}}}schedule(J){if(s8=J,J.b?.is_pending&&(J.f&(s0|PJ|CJ))!==0&&(J.f&B0)===0){J.b.defer_effect(J);return}var Q=J;while(Q.parent!==null){Q=Q.parent;var X=Q.f;if(vJ!==null&&Q===L){if(t)return;if((S===null||(S.f&b)===0)&&!g4)return}if((X&(Y0|c))!==0){if((X&k)===0)return;Q.f^=k}}this.#Z.push(Q)}#P(){if(!this.linked)return;var J=this.#Q,Q=this.#X;if(J===null)n7=Q;else J.#X=Q;if(Q===null)K7=J;else Q.#Q=J;this.linked=!1}}function Z7(J){var Q=kJ;kJ=!0;try{var X;if(J){if(A!==null&&!A.is_fork)A.flush();X=J()}while(!0){if(N4(),A===null)return X;A.flush()}}finally{kJ=Q}}function T6(){if(P){var J=new Map;for(let X of A.current.keys())for(let[K,Z]of X.updated??[]){var Q=J.get(K);if(!Q)Q={error:Z.error,count:0},J.set(K,Q);Q.count+=Z.count}for(let X of J.values())if(X.error)console.error(X.error)}try{B4()}catch(X){if(P)n(X,"stack",{value:""});p0(X,s8)}}var h0=null;function v4(J){var Q=J.length;if(Q===0)return;var X=0;while(X<Q){var K=J[X++];if((K.f&(g|d))===0&&NJ(K)){if(h0=new Set,KJ(K),K.deps===null&&K.first===null&&K.nodes===null&&K.teardown===null&&K.ac===null)a8(K);if(h0?.size>0){UJ.clear();for(let Z of h0){if((Z.f&(g|d))!==0)continue;let W=[Z],$=Z.parent;while($!==null){if(h0.has($))h0.delete($),W.push($);$=$.parent}for(let G=W.length-1;G>=0;G--){let z=W[G];if((z.f&(g|d))!==0)continue;KJ(z)}}h0.clear()}}}h0=null}function u4(J,Q,X,K){if(X.has(J))return;if(X.add(J),J.reactions!==null)for(let Z of J.reactions){let W=Z.f;if((W&b)!==0)u4(Z,Q,X,K);else if((W&(R0|X0))!==0&&(W&C)===0&&o8(Z,Q,K))x(Z,C),S7(Z)}}function o8(J,Q,X){let K=X.get(J);if(K!==void 0)return K;if(J.deps!==null)for(let Z of J.deps){if(LJ.call(Q,Z))return!0;if((Z.f&b)!==0&&o8(Z,Q,X))return X.set(Z,!0),!0}return X.set(J,!1),!1}function S7(J){A.schedule(J)}function f4(J,Q){if((J.f&c)!==0&&(J.f&k)!==0)return;if((J.f&C)!==0)Q.d.push(J);else if((J.f&v)!==0)Q.m.push(J);x(J,k);var X=J.first;while(X!==null)f4(X,Q),X=X.next}function p4(J){x(J,k);var Q=J.first;while(Q!==null)p4(Q),Q=Q.next}function d4(J){if(L===null){if(S===null)Y4(J);H4()}if(T0)U4(J)}function x6(J,Q){var X=Q.last;if(X===null)Q.last=Q.first=J;else X.next=J,J.prev=X,Q.last=J}function WJ(J,Q){var X=L;if(P)while(X!==null&&(X.f&VJ)!==0)X=X.parent;if(X!==null&&(X.f&d)!==0)J|=d;var K={ctx:D,deps:null,nodes:null,f:J|C|K0,first:null,fn:Q,last:null,next:null,parent:X,b:X&&X.b,prev:null,teardown:null,wv:0,ac:null};if(P)K.component_function=I0;A?.register_created_effect(K);var Z=K;if((J&s0)!==0)if(vJ!==null)vJ.push(K);else $0.ensure().schedule(K);else if(Q!==null){try{KJ(K)}catch($){throw m(K),$}if(Z.deps===null&&Z.teardown===null&&Z.nodes===null&&Z.first===Z.last&&(Z.f&o0)===0){if(Z=Z.first,(J&X0)!==0&&(J&w0)!==0&&Z!==null)Z.f|=w0}}if(Z!==null){if(Z.parent=X,X!==null)x6(Z,X);if(S!==null&&(S.f&b)!==0&&(J&Y0)===0){var W=S;(W.effects??=[]).push(Z)}}return K}function OJ(){return S!==null&&!M0}function z0(J){let Q=WJ(PJ,null);return x(Q,k),Q.teardown=J,Q}function n8(J){if(d4("$effect"),P)n(J,"name",{value:"$effect"});var Q=L.f,X=!S&&(Q&c)!==0&&D!==null&&!D.i;if(X){var K=D;(K.e??=[]).push(J)}else return x8(J)}function x8(J){return WJ(s0|h9,J)}function t8(J){$0.ensure();let Q=WJ(Y0|o0,J);return()=>{m(Q)}}function l4(J){$0.ensure();let Q=WJ(Y0|o0,J);return(X={})=>{return new Promise((K)=>{if(X.outro)QJ(Q,()=>{m(Q),K(void 0)});else m(Q),K(void 0)})}}function F0(J){return WJ(s0,J)}function k4(J){return WJ(R0|o0,J)}function e(J,Q=0){return WJ(PJ|Q,J)}function e8(J,Q=[],X=[],K=[]){c7(K,Q,X,(Z)=>{WJ(PJ,()=>{J(...Z.map(I))})})}function S0(J,Q=0){var X=WJ(X0|Q,J);if(P)X.dev_stack=e0;return X}function o(J){return WJ(c|o0,J)}function J9(J){var Q=J.teardown;if(Q!==null){let X=T0,K=S;r8(!0),f(null);try{Q.call(null)}finally{r8(X),f(K)}}}function w7(J,Q=!1){var X=J.first;J.first=J.last=null;while(X!==null){let Z=X.ac;if(Z!==null)JJ(()=>{Z.abort(GJ)});var K=X.next;if((X.f&Y0)!==0)X.parent=null;else m(X,Q);X=K}}function c4(J){var Q=J.first;while(Q!==null){var X=Q.next;if((Q.f&c)===0)m(Q);Q=X}}function m(J,Q=!0){var X=!1;if((Q||(J.f&w8)!==0)&&J.nodes!==null&&J.nodes.end!==null)Q9(J.nodes.start,J.nodes.end),X=!0;J.f|=sJ,w7(J,Q&&!X),gJ(J,0);var K=J.nodes&&J.nodes.t;if(K!==null)for(let W of K)W.stop();J9(J),J.f^=sJ,J.f|=g;var Z=J.parent;if(Z!==null&&Z.first!==null)a8(J);if(P)J.component_function=null;J.next=J.prev=J.teardown=J.ctx=J.deps=J.fn=J.nodes=J.ac=J.b=null}function Q9(J,Q){while(J!==null){var X=J===Q?null:r(J);J.remove(),J=X}}function a8(J){var{parent:Q,prev:X,next:K}=J;if(X!==null)X.next=K;if(K!==null)K.prev=X;if(Q!==null){if(Q.first===J)Q.first=K;if(Q.last===J)Q.last=X}}function QJ(J,Q,X=!0){var K=[];i4(J,K,!0);var Z=()=>{if(X)m(J);if(Q)Q()},W=K.length;if(W>0){var $=()=>--W||Z();for(var G of K)G.out($)}else Z()}function i4(J,Q,X){if((J.f&d)!==0)return;J.f^=d;var K=J.nodes&&J.nodes.t;if(K!==null){for(let G of K)if(G.is_global||X)Q.push(G)}var Z=J.first;while(Z!==null){var W=Z.next;if((Z.f&Y0)===0){var $=(Z.f&w0)!==0||(Z.f&c)!==0&&(J.f&X0)!==0;i4(Z,Q,$?X:!1)}Z=W}}function W7(J){s4(J,!0)}function s4(J,Q){if((J.f&d)===0)return;if(J.f^=d,(J.f&k)===0)x(J,C),$0.ensure().schedule(J);var X=J.first;while(X!==null){var K=X.next,Z=(X.f&w0)!==0||(X.f&c)!==0;s4(X,Z?Q:!1),X=K}var W=J.nodes&&J.nodes.t;if(W!==null){for(let $ of W)if($.is_global||Q)$.in()}}function eJ(J,Q){if(!J.nodes)return;var X=J.nodes.start,K=J.nodes.end;while(X!==null){var Z=X===K?null:r(X);Q.append(X),X=Z}}var o4=null;var t7=!1,T0=!1;function r8(J){T0=J}var S=null,M0=!1;function f(J){S=J}var L=null;function p(J){L=J}var l0=null;function o7(J){if(S!==null&&(!t||(S.f&b)!==0))(l0??=new Set).add(J)}var J0=null,V0=0,E0=null;function h4(J){E0=J}var a4=1,uJ=0,DJ=uJ;function X9(J){DJ=J}function X7(){return++a4}function NJ(J){var Q=J.f;if((Q&C)!==0)return!0;if(Q&b)J.f&=~j0;if((Q&v)!==0){var X=J.deps,K=X.length;for(var Z=0;Z<K;Z++){var W=X[Z];if(NJ(W))p8(W);if(W.wv>J.wv)return!0}if((Q&K0)!==0&&Q0===null)x(J,k)}return!1}function r4(J,Q,X=!0){var K=J.reactions;if(K===null)return;if(!t&&l0!==null&&l0.has(J))return;for(var Z=0;Z<K.length;Z++){var W=K[Z];if((W.f&b)!==0)r4(W,Q,!1);else if(Q===W){if(X)x(W,C);else if((W.f&k)!==0)x(W,v);S7(W)}}}function s7(J){var Q=J0,X=V0,K=E0,Z=S,W=l0,$=D,G=M0,z=DJ,U=J.f;if(J0=null,V0=0,E0=null,S=(U&(c|Y0))===0?J:null,l0=null,qJ(J.ctx),M0=!1,DJ=++uJ,J.ac!==null)JJ(()=>{J.ac.abort(GJ)}),J.ac=null;try{J.f|=IJ;var q=J.fn,Y=q();J.f|=B0;var H=J.deps,B=A?.is_fork;if(J0!==null){var V;if(!B)gJ(J,V0);if(H!==null&&V0>0){H.length=V0+J0.length;for(V=0;V<J0.length;V++)H[V0+V]=J0[V]}else J.deps=H=J0;if(OJ()&&(J.f&K0)!==0)for(V=V0;V<H.length;V++)(H[V].reactions??=[]).push(J)}else if(!B&&H!==null&&V0<H.length)gJ(J,V0),H.length=V0;if(f0()&&E0!==null&&!M0&&H!==null&&(J.f&(b|v|C))===0)for(V=0;V<E0.length;V++)r4(E0[V],J);if(Z!==null&&Z!==J){if(uJ++,Z.deps!==null)for(let F=0;F<X;F+=1)Z.deps[F].rv=uJ;if(Q!==null)for(let F of Q)F.rv=uJ;if(E0!==null)if(K===null)K=E0;else K.push(...E0)}if((J.f&y0)!==0)J.f^=y0;return Y}catch(F){return v7(F)}finally{J.f^=IJ,J0=Q,V0=X,E0=K,S=Z,l0=W,qJ($),M0=G,DJ=z}}function k6(J,Q){let X=Q.reactions;if(X!==null){var K=K4.call(X,J);if(K!==-1){var Z=X.length-1;if(Z===0)X=Q.reactions=null;else X[K]=X[Z],X.pop()}}if(X===null&&(Q.f&b)!==0&&(J0===null||!LJ.call(J0,Q))){var W=Q;if((W.f&K0)!==0)W.f^=K0,W.f&=~j0;if(W.v!==y)tJ(W);if(W.ac!==null)JJ(()=>{W.ac.abort(GJ),W.ac=null,x(W,C)});x4(W),gJ(W,0)}}function gJ(J,Q){var X=J.deps;if(X===null)return;for(var K=Q;K<X.length;K++)k6(J,X[K])}function KJ(J){var Q=J.f;if((Q&g)!==0)return;x(J,k);var X=L,K=t7;if(L=J,t7=(Q&(c|Y0))===0,P){var Z=I0;m7(J.component_function);var W=e0;nJ(J.dev_stack??e0)}try{if((Q&(X0|CJ))!==0)c4(J);else w7(J);J9(J);var $=s7(J);if(J.teardown=typeof $==="function"?$:null,J.wv=a4,P&&u0&&(J.f&C)!==0&&J.deps!==null){for(var G of J.deps)if(G.set_during_effect)G.wv=X7(),G.set_during_effect=!1}}finally{if(t7=K,L=X,P)m7(Z),nJ(W)}}function I(J){var Q=J.f,X=(Q&b)!==0;if(o4?.add(J),S!==null&&!M0){var K=L!==null&&(L.f&g)!==0;if(!K&&(l0===null||!l0.has(J))){var Z=S.deps;if((S.f&IJ)!==0){if(J.rv<uJ)if(J.rv=uJ,J0===null&&Z!==null&&Z[V0]===J)V0++;else if(J0===null)J0=[J];else J0.push(J)}else{if(S.deps??=[],!LJ.call(S.deps,J))S.deps.push(J);var W=J.reactions;if(W===null)J.reactions=[S];else if(!LJ.call(W,S))W.push(S)}}}if(P){if(!M0&&A0&&A===null&&AJ===null&&!A0.warned&&(A0.effect.f&IJ)===0&&!A0.effect_deps.has(J)){A0.warned=!0,a9(J.label);var $=_0("traced at");if($)console.warn($)}if(F7.delete(J),u0&&!M0&&V7!==null&&S!==null&&V7.reaction===S){if(J.trace)J.trace();else if($=_0("traced at"),$){var G=V7.entries.get(J);if(G===void 0)G={traces:[]},V7.entries.set(J,G);var z=G.traces[G.traces.length-1];if($.stack!==z?.stack)G.traces.push($)}}}if(T0&&UJ.has(J))return UJ.get(J);if(X){var U=J;if(T0){var q=U.v;if((U.f&k)===0&&U.reactions!==null||t4(U))q=L7(U);return UJ.set(U,q),q}var Y=(U.f&K0)===0&&!M0&&S!==null&&(t7||(S.f&K0)!==0),H=(U.f&B0)===0;if(NJ(U)){if(Y)U.f|=K0;p8(U)}if(Y&&!H)_8(U),n4(U)}if(Q0?.has(J))return Q0.get(J);if((J.f&y0)!==0)throw J.v;return J.v}function n4(J){if(J.f|=K0,J.deps===null)return;for(let Q of J.deps)if((Q.reactions??=[]).push(J),(Q.f&b)!==0&&(Q.f&K0)===0)_8(Q),n4(Q)}function t4(J){if(J.v===y)return!0;if(J.deps===null)return!1;for(let Q of J.deps){if(UJ.has(Q))return!0;if((Q.f&b)!==0&&t4(Q))return!0}return!1}function h(J){var Q=M0;try{return M0=!0,J()}finally{M0=Q}}function J8(J){if(typeof J!=="object"||!J||J instanceof EventTarget)return;if(i in J)e7(J);else if(!Array.isArray(J))for(let Q in J){let X=J[Q];if(typeof X==="object"&&X&&i in X)e7(X)}}function e7(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 K in J)try{e7(J[K],Q)}catch(Z){}let X=EJ(J);if(X!==Object.prototype&&X!==Array.prototype&&X!==Map.prototype&&X!==Set.prototype&&X!==Date.prototype){let K=y7(X);for(let Z in K){let W=K[Z].get;if(W)try{W.call(J)}catch($){}}}}}var b6=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function HJ(J){if(typeof J!=="object"||J===null||i in J)return J;let Q=EJ(J);if(Q!==R8&&Q!==Z4)return J;var X=new Map,K=zJ(J),Z=ZJ(0),W=P&&u0?_0("created at"):null,$=DJ,G=(Y)=>{if(DJ===$)return Y();var H=S,B=DJ;f(null),X9($);var V=Y();return f(H),X9(B),V};if(K){if(X.set("length",ZJ(J.length,W)),P)J=h6(J)}var z="";let U=!1;function q(Y){if(U)return;U=!0,z=Y,G0(Z,`${z} version`);for(let[H,B]of X)G0(B,fJ(z,H));U=!1}return new Proxy(J,{defineProperty(Y,H,B){if(!("value"in B)||B.configurable===!1||B.enumerable===!1||B.writable===!1)F4();var V=X.get(H);if(V===void 0)G(()=>{var F=ZJ(B.value,W);if(X.set(H,F),P&&typeof H==="string")G0(F,fJ(z,H));return F});else U0(V,B.value,!0);return!0},deleteProperty(Y,H){var B=X.get(H);if(B===void 0){if(H in Y){let V=G(()=>ZJ(y,W));if(X.set(H,V),bJ(Z),P)G0(V,fJ(z,H))}}else U0(B,y),bJ(Z);return!0},get(Y,H,B){if(H===i)return J;if(P&&H===E7)return q;var V=X.get(H),F=H in Y;if(V===void 0&&(!F||P0(Y,H)?.writable))V=G(()=>{var O=HJ(F?Y[H]:y),j=ZJ(O,W);if(P)G0(j,fJ(z,H));return j}),X.set(H,V);if(V!==void 0){var M=I(V);return M===y?void 0:M}return Reflect.get(Y,H,B)},getOwnPropertyDescriptor(Y,H){var B=Reflect.getOwnPropertyDescriptor(Y,H);if(B&&"value"in B){var V=X.get(H);if(V)B.value=I(V)}else if(B===void 0){var F=X.get(H),M=F?.v;if(F!==void 0&&M!==y)return{enumerable:!0,configurable:!0,value:M,writable:!0}}return B},has(Y,H){if(H===i)return!0;var B=X.get(H),V=B!==void 0&&B.v!==y||Reflect.has(Y,H);if(B!==void 0||L!==null&&(!V||P0(Y,H)?.writable)){if(B===void 0)B=G(()=>{var M=V?HJ(Y[H]):y,O=ZJ(M,W);if(P)G0(O,fJ(z,H));return O}),X.set(H,B);var F=I(B);if(F===y)return!1}return V},set(Y,H,B,V){var F=X.get(H),M=H in Y;if(K&&H==="length")for(var O=B;O<F.v;O+=1){var j=X.get(O+"");if(j!==void 0)U0(j,y);else if(O in Y){if(j=G(()=>ZJ(y,W)),X.set(O+"",j),P)G0(j,fJ(z,O))}}if(F===void 0){if(!M||P0(Y,H)?.writable){if(F=G(()=>ZJ(void 0,W)),P)G0(F,fJ(z,H));U0(F,HJ(B)),X.set(H,F)}}else{M=F.v!==y;var T=G(()=>HJ(B));U0(F,T)}var R=Reflect.getOwnPropertyDescriptor(Y,H);if(R?.set)R.set.call(V,B);if(!M){if(K&&typeof H==="string"){var b0=X.get("length"),H0=Number(H);if(Number.isInteger(H0)&&H0>=b0.v)U0(b0,H0+1)}bJ(Z)}return!0},ownKeys(Y){I(Z);var H=Reflect.ownKeys(Y).filter((F)=>{var M=X.get(F);return M===void 0||M.v!==y});for(var[B,V]of X)if(V.v!==y&&!(B in Y))H.push(B);return H},setPrototypeOf(){L4()}})}function fJ(J,Q){if(typeof Q==="symbol")return`${J}[Symbol(${Q.description??""})]`;if(b6.test(Q))return`${J}.${Q}`;return/^\d+$/.test(Q)?`${J}[${Q}]`:`${J}['${Q}']`}function Q8(J){try{if(J!==null&&typeof J==="object"&&i in J)return J[i]}catch{}return J}var y6=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function h6(J){return new Proxy(J,{get(Q,X,K){var Z=Reflect.get(Q,X,K);if(!y6.has(X))return Z;return function(...W){b4();var $=Z.apply(this,W);return a7(),$}}})}function e4(){let{prototype:J,__svelte_cleanup:Q}=Array;if(Q)Q();let{indexOf:X,lastIndexOf:K,includes:Z}=J;J.indexOf=function(W,$){let G=X.call(this,W,$);if(G===-1){for(let z=$??0;z<this.length;z+=1)if(Q8(this[z])===W){b7("array.indexOf(...)");break}}return G},J.lastIndexOf=function(W,$){let G=K.call(this,W,$??this.length-1);if(G===-1){for(let z=0;z<=($??this.length-1);z+=1)if(Q8(this[z])===W){b7("array.lastIndexOf(...)");break}}return G},J.includes=function(W,$){let G=Z.call(this,W,$);if(!G){for(let z=0;z<this.length;z+=1)if(Q8(this[z])===W){b7("array.includes(...)");break}}return G},Array.__svelte_cleanup=()=>{J.indexOf=X,J.lastIndexOf=K,J.includes=Z}}var K9,JQ,P7,QQ,XQ;function X8(){if(K9!==void 0)return;K9=window,JQ=document,P7=/Firefox/.test(navigator.userAgent);var J=Element.prototype,Q=Node.prototype,X=Text.prototype;if(QQ=P0(Q,"firstChild").get,XQ=P0(Q,"nextSibling").get,C8(J))J[q7]=void 0,J[x7]=null,J[U7]=void 0,J.__e=void 0;if(C8(X))X[H7]=void 0;if(P)J.__svelte_meta=null,e4()}function a(J=""){return document.createTextNode(J)}function u(J){return QQ.call(J)}function r(J){return XQ.call(J)}function g6(J,Q){if(!w)return u(J);var X=u(N);if(X===null)X=N.appendChild(a());else if(Q&&X.nodeType!==oJ){var K=a();return X?.before(K),E(K),K}if(Q)Z8(X);return E(X),X}function m6(J,Q=!1){if(!w){var X=u(J);if(X instanceof Comment&&X.data==="")return r(X);return X}if(Q){if(N?.nodeType!==oJ){var K=a();return N?.before(K),E(K),K}Z8(N)}return N}function v6(J,Q=1,X=!1){let K=w?N:J;var Z;while(Q--)Z=K,K=r(K);if(!w)return K;if(X){if(K?.nodeType!==oJ){var W=a();if(K===null)Z?.after(W);else K.before(W);return E(W),W}Z8(K)}return E(K),K}function M7(J){J.textContent=""}function K8(){if(!t)return!1;if(h0!==null)return!1;var J=L.f;return(J&B0)!==0}function c0(J,Q,X){if(Q==null||Q===k7)return X?document.createElement(J,{is:X}):document.createElement(J);return X?document.createElementNS(Q,J,{is:X}):document.createElementNS(Q,J)}function Z8(J){if(J.nodeValue.length<65536)return;let Q=J.nextSibling;while(Q!==null&&Q.nodeType===oJ)Q.remove(),J.nodeValue+=Q.nodeValue,Q=J.nextSibling}var w=!1;function _(J){w=J}var N;function E(J){if(J===null)throw FJ(),a0;return N=J}function l(){return E(r(N))}function KQ(J){if(!w)return;if(r(N)!==null)throw FJ(),a0;N=J}function y8(J=1){if(w){var Q=J,X=N;while(Q--)X=r(X);N=X}}function XJ(J=!0){var Q=0,X=N;while(!0){if(X.nodeType===C0){var K=X.data;if(K===TJ){if(Q===0)return X;Q-=1}else if(K===aJ||K===MJ||K[0]==="["&&!isNaN(Number(K.slice(1))))Q+=1}var Z=r(X);if(J)X.remove();X=Z}}function A7(J){if(!J||J.nodeType!==C0)throw FJ(),a0;return J.data}var $7=Symbol("events"),Z9=new Set,W8=new Set;function WQ(J,Q,X){(Q[$7]??={})[J]=X}function $Q(J){for(var Q=0;Q<J.length;Q++)Z9.add(J[Q]);for(var X of W8)X(J)}var ZQ=null;function W9(J){var Q=this,X=Q.ownerDocument,K=J.type,Z=J.composedPath?.()||[],W=Z[0]||J.target;ZQ=J;var $=0,G=ZQ===J&&J[$7];if(G){var z=Z.indexOf(G);if(z!==-1&&(Q===document||Q===window)){J[$7]=Q;return}var U=Z.indexOf(Q);if(U===-1)return;if(z<=U)$=z}if(W=Z[$]||J.target,W===Q)return;n(J,"currentTarget",{configurable:!0,get(){return W||X}});var q=S,Y=L;f(null),p(null);try{var H,B=[];while(W!==null){if(W===Q)break;try{var V=W[$7]?.[K];if(V!=null&&(!W.disabled||J.target===W))V.call(W,J)}catch(F){if(H)B.push(F);else H=F}if(J.cancelBubble)break;$++,W=$<Z.length?Z[$]:null}if(H){for(let F of B)queueMicrotask(()=>{throw F});throw H}}finally{J[$7]=Q,delete J.currentTarget,f(q),p(Y)}}var u6=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:(J)=>{return J}});function GQ(J){return u6?.createHTML(J)??J}function $9(J){var Q=c0("template");return Q.innerHTML=GQ(J.replaceAll("<!>","<!---->")),Q.content}function N0(J,Q){var X=L;if(X.nodes===null)X.nodes={start:J,end:Q,a:null,t:null}}function _6(J,Q){var X=(Q&i9)!==0,K=(Q&s9)!==0,Z,W=!J.startsWith("<!>");return()=>{if(w)return N0(N,null),N;if(Z===void 0){if(Z=$9(W?J:"<!>"+J),!X)Z=u(Z)}var $=K||P7?document.importNode(Z,!0):Z.cloneNode(!0);if(X){var G=u($),z=$.lastChild;N0(G,z)}else N0($,$);return $}}function d6(){if(w)return N0(N,null),N;var J=document.createDocumentFragment(),Q=document.createComment(""),X=a();return J.append(Q,X),N0(Q,X),J}function G9(J,Q){if(w){var X=L;if((X.f&B0)===0||X.nodes.end===null)X.nodes.end=N;l();return}if(J===null)return;J.before(Q)}var l6=/\r/g;function zQ(J){J=J.replace(l6,"");let Q=5381,X=J.length;while(X--)Q=(Q<<5)-Q^J.charCodeAt(X);return(Q>>>0).toString(36)}var c6=["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 YZ=[...c6,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var i6=["touchstart","touchmove"];function qQ(J){return i6.includes(J)}var s6=["$state","$state.raw","$derived","$derived.by"],BZ=[...s6,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];function $8(J){return J?.replace(/\//g,"/")}var z9=!0;function o6(J,Q){var X=Q==null?"":typeof Q==="object"?`${Q}`:Q;if(X!==(J[H7]??=J.nodeValue))J[H7]=X,J.nodeValue=`${X}`}function z8(J,Q){return UQ(J,Q)}function U9(J,Q){X8(),Q.intro=Q.intro??!1;let X=Q.target,K=w,Z=N;try{var W=u(X);while(W&&(W.nodeType!==C0||W.data!==aJ))W=r(W);if(!W)throw a0;_(!0),E(W);let $=UQ(J,{...Q,anchor:W});return _(!1),$}catch($){if($ instanceof Error&&$.message.split(`
|
|
49
|
+
`).some((G)=>G.startsWith("https://svelte.dev/e/")))throw $;if($!==a0)console.warn("Failed to hydrate: ",$);if(Q.recover===!1)P4();return X8(),M7(X),_(!1),z8(J,Q)}finally{_(K),E(Z)}}var G8=new Map;function UQ(J,{target:Q,anchor:X,props:K={},events:Z,context:W,intro:$=!0,transformError:G}){X8();var z=void 0,U=l4(()=>{var q=X??Q.appendChild(a());h8(q,{pending:()=>{}},(B)=>{T8({});var V=D;if(W)V.c=W;if(Z)K.$$events=Z;if(w)N0(B,null);if(z9=$,z=J(B,K)||{},z9=!0,w){if(L.nodes.end=N,N===null||N.nodeType!==C0||N.data!==TJ)throw FJ(),a0}E8()},G);var Y=new Set,H=(B)=>{for(var V=0;V<B.length;V++){var F=B[V];if(Y.has(F))continue;Y.add(F);var M=qQ(F);for(let T of[Q,document]){var O=G8.get(T);if(O===void 0)O=new Map,G8.set(T,O);var j=O.get(F);if(j===void 0)T.addEventListener(F,W9,{passive:M}),O.set(F,1);else O.set(F,j+1)}}};return H(rJ(Z9)),W8.add(H),()=>{for(var B of Y)for(let M of[Q,document]){var V=G8.get(M),F=V.get(B);if(--F==0){if(M.removeEventListener(B,W9),V.delete(B),V.size===0)G8.delete(M)}else V.set(B,F)}if(W8.delete(H),q!==X)q.parentNode?.removeChild(q)}});return q9.set(z,U),z}var q9=new WeakMap;function H9(J,Q){let X=q9.get(J);if(X)return q9.delete(J),X(Q);if(P)if(i in J)Q4();else J4();return Promise.resolve()}var HQ=new Map;function YQ(J,Q){var X=HQ.get(J);if(!X)X=new Set,HQ.set(J,X);X.add(Q)}class YJ{anchor;#J=new Map;#Q=new Map;#X=new Map;#G=new Set;#W=!0;constructor(J,Q=!0){this.anchor=J,this.#W=Q}#$=(J)=>{if(!this.#J.has(J))return;var Q=this.#J.get(J),X=this.#Q.get(Q);if(X)W7(X),this.#G.delete(Q);else{var K=this.#X.get(Q);if(K){if(W7(K.effect),this.#Q.set(Q,K.effect),this.#X.delete(Q),P)K.fragment.lastChild[S8]=this.anchor;K.fragment.lastChild.remove(),this.anchor.before(K.fragment),X=K.effect}}for(let[Z,W]of this.#J){if(this.#J.delete(Z),Z===J)break;let $=this.#X.get(W);if($)m($.effect),this.#X.delete(W)}for(let[Z,W]of this.#Q){if(Z===Q||this.#G.has(Z))continue;let $=()=>{if(Array.from(this.#J.values()).includes(Z)){var z=document.createDocumentFragment();eJ(W,z),z.append(a()),this.#X.set(Z,{effect:W,fragment:z})}else m(W);this.#G.delete(Z),this.#Q.delete(Z)};if(this.#W||!X)this.#G.add(Z),QJ(W,$,!1);else $()}};#K=(J)=>{this.#J.delete(J);let Q=Array.from(this.#J.values());for(let[X,K]of this.#X)if(!Q.includes(X))m(K.effect),this.#X.delete(X)};ensure(J,Q){var X=A,K=K8();if(Q&&!this.#Q.has(J)&&!this.#X.has(J))if(K){var Z=document.createDocumentFragment(),W=a();Z.append(W),this.#X.set(J,{effect:o(()=>Q(W)),fragment:Z})}else this.#Q.set(J,o(()=>Q(this.anchor)));if(this.#J.set(X,J),K){for(let[$,G]of this.#Q)if($===J)X.unskip_effect(G);else X.skip_effect(G);for(let[$,G]of this.#X)if($===J)X.unskip_effect(G.effect);else X.skip_effect(G.effect);X.oncommit(this.#$),X.ondiscard(this.#K)}else{if(w)this.anchor=N;this.#$(X)}}}function n6(J,Q,X=!1){var K;if(w)K=N,l();var Z=new YJ(J),W=X?w0:0;function $(G,z){if(w){var U=A7(K);if(G!==parseInt(U.substring(1))){var q=XJ();E(q),Z.anchor=q,_(!1),Z.ensure(G,z),_(!0);return}}Z.ensure(G,z)}S0(()=>{var G=!1;if(Q((z,U=0)=>{G=!0,$(U,z)}),!G)$(-1,null)},W)}var t6=Symbol("NaN");function e6(J,Q,X){if(w)l();var K=new YJ(J),Z=!f0();S0(()=>{var W=Q();if(W!==W)W=t6;if(Z&&W!==null&&typeof W==="object")W={};K.ensure(W,X)})}function J1(J,Q,X){var K=[],Z=Q.length,W,$=Q.length;for(var G=0;G<Z;G++){let Y=Q[G];QJ(Y,()=>{if(W){if(W.pending.delete(Y),W.done.add(Y),W.pending.size===0){var H=J.outrogroups;if(Y9(J,rJ(W.done)),H.delete(W),H.size===0)J.outrogroups=null}}else $-=1},!1)}if($===0){var z=K.length===0&&X!==null;if(z){var U=X,q=U.parentNode;M7(q),q.append(U),J.items.clear()}Y9(J,Q,!z)}else W={pending:new Set(Q),done:new Set},(J.outrogroups??=new Set).add(W)}function Y9(J,Q,X=!0){var K;if(J.pending.size>0){K=new Set;for(let $ of J.pending.values())for(let G of $)K.add(J.items.get(G).e)}for(var Z=0;Z<Q.length;Z++){var W=Q[Z];if(K?.has(W)){W.f|=v0;let $=document.createDocumentFragment();eJ(W,$)}else m(Q[Z],X)}}var PQ;function Q1(J,Q,X,K,Z,W=null){var $=J,G=new Map,z=(Q&N8)!==0;if(z){var U=J;$=w?E(u(U)):U.appendChild(a())}if(w)l();var q=null,Y=yJ(()=>{var T=X();return zJ(T)?T:T==null?[]:rJ(T)});if(P)G0(Y,"{#each ...}");var H,B=new Map,V=!0;function F(T){if((j.effect.f&g)!==0)return;if(j.pending.delete(T),j.fallback=q,X1(j,H,$,Q,K),q!==null)if(H.length===0)if((q.f&v0)===0)W7(q);else q.f^=v0,D7(q,null,$);else QJ(q,()=>{q=null})}function M(T){j.pending.delete(T)}var O=S0(()=>{H=I(Y);var T=H.length;let R=!1;if(w){var b0=A7($)===MJ;if(b0!==(T===0))$=XJ(),E($),_(!1),R=!0}var H0=new Set,D0=A,lJ=K8();for(var i0=0;i0<T;i0+=1){if(w&&N.nodeType===C0&&N.data===TJ)$=N,R=!0,_(!1);var m0=H[i0],cJ=K(m0,i0);if(P){var b9=K(m0,i0);if(cJ!==b9)q4(String(i0),String(cJ),String(b9))}var $J=V?null:G.get(cJ);if($J){if($J.v)d0($J.v,m0);if($J.i)d0($J.i,i0);if(lJ)D0.unskip_effect($J.e)}else{if($J=K1(G,V?$:PQ??=a(),m0,cJ,i0,Z,Q,X),!V)$J.e.f|=v0;G.set(cJ,$J)}H0.add(cJ)}if(T===0&&W&&!q)if(V)q=o(()=>W($));else q=o(()=>W(PQ??=a())),q.f|=v0;if(T>H0.size)if(P)Z1(H,K);else I8("","","");if(w&&T>0)E(XJ());if(!V)if(B.set(D0,H0),lJ){for(let[F6,L6]of G)if(!H0.has(F6))D0.skip_effect(L6.e);D0.oncommit(F),D0.ondiscard(M)}else F(D0);if(R)_(!0);I(Y)}),j={effect:O,flags:Q,items:G,pending:B,outrogroups:null,fallback:q};if(V=!1,w)$=N}function N7(J){while(J!==null&&(J.f&c)===0)J=J.next;return J}function X1(J,Q,X,K,Z){var W=(K&u9)!==0,$=Q.length,G=J.items,z=N7(J.effect.first),U,q=null,Y,H=[],B=[],V,F,M,O;if(W){for(O=0;O<$;O+=1)if(V=Q[O],F=Z(V,O),M=G.get(F).e,(M.f&v0)===0)M.nodes?.a?.measure(),(Y??=new Set).add(M)}for(O=0;O<$;O+=1){if(V=Q[O],F=Z(V,O),M=G.get(F).e,J.outrogroups!==null)for(let m0 of J.outrogroups)m0.pending.delete(M),m0.done.delete(M);if((M.f&d)!==0){if(W7(M),W)M.nodes?.a?.unfix(),(Y??=new Set).delete(M)}if((M.f&v0)!==0)if(M.f^=v0,M===z)D7(M,null,X);else{var j=q?q.next:z;if(M===J.effect.last)J.effect.last=M.prev;if(M.prev)M.prev.next=M.next;if(M.next)M.next.prev=M.prev;jJ(J,q,M),jJ(J,M,j),D7(M,j,X),q=M,H=[],B=[],z=N7(q.next);continue}if(M!==z){if(U!==void 0&&U.has(M)){if(H.length<B.length){var T=B[0],R;q=T.prev;var b0=H[0],H0=H[H.length-1];for(R=0;R<H.length;R+=1)D7(H[R],T,X);for(R=0;R<B.length;R+=1)U.delete(B[R]);jJ(J,b0.prev,H0.next),jJ(J,q,b0),jJ(J,H0,T),z=T,q=H0,O-=1,H=[],B=[]}else U.delete(M),D7(M,z,X),jJ(J,M.prev,M.next),jJ(J,M,q===null?J.effect.first:q.next),jJ(J,q,M),q=M;continue}H=[],B=[];while(z!==null&&z!==M)(U??=new Set).add(z),B.push(z),z=N7(z.next);if(z===null)continue}if((M.f&v0)===0)H.push(M);q=M,z=N7(M.next)}if(J.outrogroups!==null){for(let m0 of J.outrogroups)if(m0.pending.size===0)Y9(J,rJ(m0.done)),J.outrogroups?.delete(m0);if(J.outrogroups.size===0)J.outrogroups=null}if(z!==null||U!==void 0){var D0=[];if(U!==void 0){for(M of U)if((M.f&d)===0)D0.push(M)}while(z!==null){if((z.f&d)===0&&z!==J.fallback)D0.push(z);z=N7(z.next)}var lJ=D0.length;if(lJ>0){var i0=(K&N8)!==0&&$===0?X:null;if(W){for(O=0;O<lJ;O+=1)D0[O].nodes?.a?.measure();for(O=0;O<lJ;O+=1)D0[O].nodes?.a?.fix()}J1(J,D0,i0)}}if(W)s(()=>{if(Y===void 0)return;for(M of Y)M.nodes?.a?.apply()})}function K1(J,Q,X,K,Z,W,$,G){var z=($&m9)!==0?($&f9)===0?mJ(X,!1,!1):q0(X):null,U=($&v9)!==0?q0(Z):null;if(P&&z)z.trace=()=>{G()[U?.v??Z]};return{v:z,i:U,e:o(()=>{return W(Q,z??X,U??Z,G),()=>{J.delete(K)}})}}function D7(J,Q,X){if(!J.nodes)return;var K=J.nodes.start,Z=J.nodes.end,W=Q&&(Q.f&v0)===0?Q.nodes.start:X;while(K!==null){var $=r(K);if(W.before(K),K===Z)return;K=$}}function jJ(J,Q,X){if(Q===null)J.effect.first=X;else Q.next=X;if(X===null)J.effect.last=Q;else X.prev=Q}function Z1(J,Q){let X=new Map,K=J.length;for(let Z=0;Z<K;Z++){let W=Q(J[Z],Z);if(X.has(W)){let $=String(X.get(W)),G=String(Z),z=String(W);if(z.startsWith("[object "))z=null;I8($,G,z)}X.set(W,Z)}}function W1(J,Q,X){if(!Q||Q===zQ(String(X??"")))return;let K,Z=J.__svelte_meta?.loc;if(Z)K=`near ${Z.file}:${Z.line}:${Z.column}`;else if(I0?.[O0])K=`in ${I0[O0]}`;e9($8(K))}function $1(J,Q,X=!1,K=!1,Z=!1,W=!1){var $=J,G="";if(X){var z=J;if(w)$=E(u(z))}e8(()=>{var U=L;if(G===(G=Q()??"")){if(w)l();return}if(X&&!w){if(U.nodes=null,z.innerHTML=G,G!=="")N0(u(z),z.lastChild);return}if(U.nodes!==null)Q9(U.nodes.start,U.nodes.end),U.nodes=null;if(G==="")return;if(w){var q=N.data,Y=l(),H=Y;while(Y!==null&&(Y.nodeType!==C0||Y.data!==""))H=Y,Y=r(Y);if(Y===null)throw FJ(),a0;if(P&&!W)W1(Y.parentNode,q,G);N0(N,H),$=E(Y);return}var B=K?Y7:Z?j8:void 0,V=c0(K?"svg":Z?"math":"template",B);V.innerHTML=G;var F=K||Z?V:V.content;if(N0(u(F),F.lastChild),K||Z)while(u(F))$.before(u(F));else $.before(F)})}function G1(J,Q,X,K,Z){if(w)l();var W=Q.$$slots?.[X],$=!1;if(W===!0)W=Q[X==="default"?"children":X],$=!0;if(W===void 0){if(Z!==null)Z(J)}else W(J,$?()=>K:K)}function Y1(J,Q){F0(()=>{var X=J.getRootNode(),K=X.host?X:X.head??X.ownerDocument.head;if(!K.querySelector("#"+Q.hash)){let Z=c0("style");if(Z.id=Q.hash,Z.textContent=Q.code,K.appendChild(Z),P)YQ(Q.hash,Z)}})}function B1(J,Q,X){F0(()=>{var K=h(()=>Q(J,X?.())||{});if(X&&K?.update){var Z=!1,W={};e(()=>{var $=X();if(J8($),Z&&f7(W,$))W=$,K.update($)}),Z=!0}if(K?.destroy)return()=>K.destroy()})}var VQ=[...`
|
|
50
|
+
\r\f \v\uFEFF`];function FQ(J,Q,X){var K=J==null?"":""+J;if(Q)K=K?K+" "+Q:Q;if(X){for(var Z of Object.keys(X))if(X[Z])K=K?K+" "+Z:Z;else if(K.length){var W=Z.length,$=0;while(($=K.indexOf(Z,$))>=0){var G=$+W;if(($===0||VQ.includes(K[$-1]))&&(G===K.length||VQ.includes(K[G])))K=($===0?"":K.substring(0,$))+K.substring(G+1);else $=G}}}return K===""?null:K}function MQ(J,Q=!1){var X=Q?" !important;":";",K="";for(var Z of Object.keys(J)){var W=J[Z];if(W!=null&&W!=="")K+=" "+Z+": "+W+X}return K}function B9(J){if(J[0]!=="-"||J[1]!=="-")return J.toLowerCase();return J}function LQ(J,Q){if(Q){var X="",K,Z;if(Array.isArray(Q))K=Q[0],Z=Q[1];else K=Q;if(J){J=String(J).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var W=!1,$=0,G=!1,z=[];if(K)z.push(...Object.keys(K).map(B9));if(Z)z.push(...Object.keys(Z).map(B9));var U=0,q=-1;let F=J.length;for(var Y=0;Y<F;Y++){var H=J[Y];if(G){if(H==="/"&&J[Y-1]==="*")G=!1}else if(W){if(W===H)W=!1}else if(H==="/"&&J[Y+1]==="*")G=!0;else if(H==='"'||H==="'")W=H;else if(H==="(")$++;else if(H===")")$--;if(!G&&W===!1&&$===0){if(H===":"&&q===-1)q=Y;else if(H===";"||Y===F-1){if(q!==-1){var B=B9(J.substring(U,q).trim());if(!z.includes(B)){if(H!==";")Y++;var V=J.substring(U,Y).trim();X+=" "+V+";"}}U=Y+1,q=-1}}}}if(K)X+=MQ(K);if(Z)X+=MQ(Z,!0);return X=X.trim(),X===""?null:X}return J==null?null:String(J)}function wQ(J,Q,X,K,Z,W){var $=J[q7];if(w||$!==X||$===void 0){var G=FQ(X,K,W);if(!w||G!==J.getAttribute("class"))if(G==null)J.removeAttribute("class");else if(Q)J.className=G;else J.setAttribute("class",G);J[q7]=X}else if(W&&Z!==W)for(var z in W){var U=!!W[z];if(Z==null||U!==!!Z[z])J.classList.toggle(z,U)}return W}function P9(J,Q={},X,K){for(var Z in X){var W=X[Z];if(Q[Z]!==W)if(X[Z]==null)J.style.removeProperty(Z);else J.style.setProperty(Z,W,K)}}function OQ(J,Q,X,K){var Z=J[U7];if(w||Z!==Q){var W=LQ(Q,K);if(!w||W!==J.getAttribute("style"))if(W==null)J.removeAttribute("style");else J.style.cssText=W;J[U7]=Q}else if(K)if(Array.isArray(K))P9(J,X?.[0],K[0]),P9(J,X?.[1],K[1],"important");else P9(J,X,K);return K}var A1=Symbol("class"),N1=Symbol("style"),D1=Symbol("is custom element"),j1=Symbol("is html"),R1=A8?"link":"LINK";function NQ(J,Q,X,K){var Z=I1(J);if(w){if(Z[Q]=J.getAttribute(Q),Q==="src"||Q==="srcset"||Q==="href"&&J.nodeName===R1){if(!K)T1(J,Q,X??"");return}}if(Z[Q]===(Z[Q]=X))return;if(Q==="loading")J[g9]=X;if(X==null)J.removeAttribute(Q);else if(typeof X!=="string"&&DQ(J).includes(Q))J[Q]=X;else J.setAttribute(Q,X)}function C1(J,Q,X){var K=S,Z=L;let W=w;if(w)_(!1);f(null),p(null);try{if(Q!=="style"&&(V9.has(J.getAttribute("is")||J.nodeName)||!customElements||customElements.get(J.getAttribute("is")||J.nodeName.toLowerCase())?DQ(J).includes(Q):X&&typeof X==="object"))J[Q]=X;else NQ(J,Q,X==null?X:String(X))}finally{if(f(K),p(Z),W)_(!0)}}function I1(J){return J[x7]??={[D1]:J.nodeName.includes("-"),[j1]:J.namespaceURI===k7}}var V9=new Map;function DQ(J){var Q=J.getAttribute("is")||J.nodeName,X=V9.get(Q);if(X)return X;V9.set(Q,X=[]);var K,Z=J,W=Element.prototype;while(W!==Z){K=y7(Z);for(var $ in K)if(K[$].set&&$!=="innerHTML"&&$!=="textContent"&&$!=="innerText")X.push($);Z=EJ(Z)}return X}function T1(J,Q,X){if(!P)return;if(Q==="srcset"&&E1(J,X))return;if(M9(J.getAttribute(Q)??"",X))return;t9(Q,J.outerHTML.replace(J.innerHTML,J.innerHTML&&"..."),String(X))}function M9(J,Q){if(J===Q)return!0;return new URL(J,document.baseURI).href===new URL(Q,document.baseURI).href}function SQ(J){return J.split(",").map((Q)=>Q.trim().split(" ").filter(Boolean))}function E1(J,Q){var X=SQ(J.srcset),K=SQ(Q);return K.length===X.length&&K.every(([Z,W],$)=>W===X[$][1]&&(M9(X[$][0],Z)||M9(Z,X[$][0])))}class jQ{#J=new WeakMap;#Q;#X;static entries=new WeakMap;constructor(J){this.#X=J}observe(J,Q){var X=this.#J.get(J)||new Set;return X.add(Q),this.#J.set(J,X),this.#G().observe(J,this.#X),()=>{var K=this.#J.get(J);if(K.delete(Q),K.size===0)this.#J.delete(J),this.#Q.unobserve(J)}}#G(){return this.#Q??(this.#Q=new ResizeObserver((J)=>{for(var Q of J){jQ.entries.set(Q.target,Q);for(var X of this.#J.get(Q.target)||[])X(Q)}}))}}function F9(J,Q){return J===Q||J?.[i]===Q}function x1(J={},Q,X,K){var Z=D.r,W=L;return F0(()=>{var $,G;return e(()=>{$=G,G=K?.()||[],h(()=>{if(!F9(X(...G),J)){if(Q(J,...G),$&&F9(X(...$),J))Q(null,...$)}})}),()=>{let z=W;while(z!==Z&&z.parent!==null&&z.parent.f&sJ)z=z.parent;let U=()=>{if(G&&F9(X(...G),J))Q(null,...G)},q=z.teardown;z.teardown=()=>{U(),q?.()}}}),J}function k1(J,Q,X,K){var Z=!wJ||(X&_9)!==0,W=(X&l9)!==0,$=(X&c9)!==0,G=K,z=!0,U=void 0,q=()=>{if($&&Z)return U??=SJ(K),I(U);if(z)z=!1,G=$?h(K):K;return G};let Y;if(W){var H=i in J||z7 in J;Y=P0(J,Q)?.set??(H&&Q in J?(R)=>J[Q]=R:void 0)}var B,V=!1;if(W)[B,V]=l8(()=>J[Q]);else B=J[Q];if(B===void 0&&K!==void 0){if(B=q(),Y){if(Z)V4(Q);Y(B)}}var F;if(Z)F=()=>{var R=J[Q];if(R===void 0)return q();return z=!0,R};else F=()=>{var R=J[Q];if(R!==void 0)G=void 0;return R===void 0?G:R};if(Z&&(X&d9)===0)return F;if(Y){var M=J.$$legacy;return function(R,b0){if(arguments.length>0){if(!Z||!b0||M||V)Y(b0?F():R);return R}return F()}}var O=!1,j=((X&p9)!==0?SJ:yJ)(()=>{return O=!1,F()});if(P)j.label=Q;if(W)I(j);var T=L;return function(R,b0){if(arguments.length>0){let H0=b0?I(j):Z&&W?HJ(R):R;if(U0(j,H0),O=!0,G!==void 0)G=H0;return R}if(T0&&O||(T.f&g)!==0)return j.v;return I(j)}}function RQ(J){return new CQ(J)}class CQ{#J;#Q;constructor(J){var Q=new Map,X=(Z,W)=>{var $=mJ(W,!1,!1);return Q.set(Z,$),$};let K=new Proxy({...J.props||{},$$events:{}},{get(Z,W){return I(Q.get(W)??X(W,Reflect.get(Z,W)))},has(Z,W){if(W===z7)return!0;return I(Q.get(W)??X(W,Reflect.get(Z,W))),Reflect.has(Z,W)},set(Z,W,$){return U0(Q.get(W)??X(W,$),$),Reflect.set(Z,W,$)}});if(this.#Q=(J.hydrate?U9:z8)(J.component,{target:J.target,anchor:J.anchor,props:K,context:J.context,intro:J.intro??!1,recover:J.recover,transformError:J.transformError}),!t&&(!J?.props?.$$host||J.sync===!1))Z7();this.#J=K.$$events;for(let Z of Object.keys(this.#Q)){if(Z==="$set"||Z==="$destroy"||Z==="$on")continue;n(this,Z,{get(){return this.#Q[Z]},set(W){this.#Q[Z]=W},enumerable:!0})}this.#Q.$set=(Z)=>{Object.assign(K,Z)},this.#Q.$destroy=()=>{H9(this.#Q)}}$set(J){this.#Q.$set(J)}$on(J,Q){this.#J[J]=this.#J[J]||[];let X=(...K)=>Q.call(this,...K);return this.#J[J].push(X),()=>{this.#J[J]=this.#J[J].filter((K)=>K!==X)}}$destroy(){this.#Q.$destroy()}}var IQ;if(typeof HTMLElement==="function")IQ=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(J,Q,X){super();if(this.$$ctor=J,this.$$s=Q,X)this.$$shadowRoot=this.attachShadow(X)}addEventListener(J,Q,X){if(this.$$l[J]=this.$$l[J]||[],this.$$l[J].push(Q),this.$$c){let K=this.$$c.$on(J,Q);this.$$l_u.set(Q,K)}super.addEventListener(J,Q,X)}removeEventListener(J,Q,X){if(super.removeEventListener(J,Q,X),this.$$c){let K=this.$$l_u.get(Q);if(K)K(),this.$$l_u.delete(Q)}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let J=function(K){return(Z)=>{let W=c0("slot");if(K!=="default")W.name=K;G9(Z,W)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let Q={},X=f1(this);for(let K of this.$$s)if(K in X)if(K==="default"&&!this.$$d.children)this.$$d.children=J(K),Q.default=!0;else Q[K]=J(K);for(let K of this.attributes){let Z=this.$$g_p(K.name);if(!(Z in this.$$d))this.$$d[Z]=U8(Z,K.value,this.$$p_d,"toProp")}for(let K in this.$$p_d)if(!(K in this.$$d)&&this[K]!==void 0)this.$$d[K]=this[K],delete this[K];this.$$c=RQ({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:Q,$$host:this}}),this.$$me=t8(()=>{e(()=>{this.$$r=!0;for(let K of B7(this.$$c)){if(!this.$$p_d[K]?.reflect)continue;this.$$d[K]=this.$$c[K];let Z=U8(K,this.$$d[K],this.$$p_d,"toAttribute");if(Z==null)this.removeAttribute(this.$$p_d[K].attribute||K);else this.setAttribute(this.$$p_d[K].attribute||K,Z)}this.$$r=!1})});for(let K in this.$$l)for(let Z of this.$$l[K]){let W=this.$$c.$on(K,Z);this.$$l_u.set(Z,W)}this.$$l={}}}attributeChangedCallback(J,Q,X){if(this.$$r)return;J=this.$$g_p(J),this.$$d[J]=U8(J,X,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 B7(this.$$p_d).find((Q)=>this.$$p_d[Q].attribute===J||!this.$$p_d[Q].attribute&&Q.toLowerCase()===J)||J}};function U8(J,Q,X,K){let Z=X[J]?.type;if(Q=Z==="Boolean"&&typeof Q!=="boolean"?Q!=null:Q,!K||!X[J])return Q;else if(K==="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 f1(J){let Q={};return J.childNodes.forEach((X)=>{Q[X.slot||"default"]=!0}),Q}function p1(J,Q,X,K,Z,W){let $=class extends IQ{constructor(){super(J,X,Z);this.$$p_d=Q}static get observedAttributes(){return B7(Q).map((G)=>(Q[G].attribute||G).toLowerCase())}};if(B7(Q).forEach((G)=>{n($.prototype,G,{get(){return this.$$c&&G in this.$$c?this.$$c[G]:this.$$d[G]},set(z){z=U8(G,z,Q),this.$$d[G]=z;var U=this.$$c;if(U){var q=P0(U,G)?.get;if(q)U[G]=z;else U.$set({[G]:z})}}})}),K.forEach((G)=>{n($.prototype,G,{get(){return this.$$c?.[G]}})}),W)$=W($);return J.element=$,$}if(P){let J=function(Q){if(!(Q in globalThis)){let X;Object.defineProperty(globalThis,Q,{configurable:!0,get:()=>{if(X!==void 0)return X;M4(Q)},set:(K)=>{X=K}})}};J("$state"),J("$effect"),J("$derived"),J("$inspect"),J("$props"),J("$bindable")}import{createContext as H8}from"@pie-players/pie-context";var TQ=H8(Symbol.for("pie.assessmentToolkit.runtimeContext")),EQ=H8(Symbol.for("pie.assessmentToolkit.hostRuntimeContext")),xQ=H8(Symbol.for("pie.assessmentToolkit.shellContext")),_1=H8(Symbol.for("pie.assessmentToolkit.regionScopeContext"));import{ContextConsumer as d1}from"@pie-players/pie-context";function w9(J,Q,X){let K=!1,Z=new d1(J,{context:Q,subscribe:!0,onValue:(U)=>{K=!0,X(U)}});Z.connect();let W=(U)=>{if(U.context!==Q)return;Z.requestValue()};J.addEventListener("context-provider",W);let $=0,G=200,z=globalThis.setInterval(()=>{if(K||$>=G){globalThis.clearInterval(z);return}$+=1,Z.requestValue()},50);return()=>{globalThis.clearInterval(z),J.removeEventListener("context-provider",W),Z.disconnect()}}function tP(J,Q){return w9(J,TQ,Q)}function eP(J,Q){return w9(J,EQ,Q)}function JV(J,Q){return w9(J,xQ,Q)}var j7={assessment:[],section:[],item:[],passage:[],rubric:[],element:[]};var O9={section:[...j7.section],item:[...j7.item],passage:[...j7.passage]};function pJ(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}function RJ(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((K)=>typeof K!=="string")!==void 0)throw Error(`Invalid tools config at "${Q}": all entries must be strings.`);return J}function l1(J){if(J==null)return;if(!pJ(J))throw Error('Invalid tools config at "placement": expected an object with section/item/passage arrays.');return J}function c1(J){if(J==null)return;if(!pJ(J))throw Error('Invalid tools config at "policy": expected an object with allowed/blocked arrays.');return J}function i1(J,Q){if(Q==null)return;if(!pJ(Q))throw Error(`Invalid tools config at "providers.${J}": expected an object.`);let X=Q,K=(Z)=>Z==="polly"||Z==="google"||Z==="custom";if("enabled"in X&&X.enabled!==void 0&&typeof X.enabled!=="boolean")throw Error(`Invalid tools config at "providers.${J}.enabled": expected a boolean.`);if("settings"in X&&X.settings!==void 0&&!pJ(X.settings))throw Error(`Invalid tools config at "providers.${J}.settings": expected an object.`);if("provider"in X&&X.provider!==void 0&&!pJ(X.provider)&&!(J==="textToSpeech"&&K(X.provider)))throw Error(`Invalid tools config at "providers.${J}.provider": expected an object.`);return X}function s1(J){if(J==null)return{};if(!pJ(J))throw Error('Invalid tools config at "providers": expected an object keyed by tool id.');let Q={};for(let[X,K]of Object.entries(J))Q[X]=i1(X,K);return Q}function S9(J){let Q=J.trim();if(!Q)return"";return Q}function BJ(J){if(!J||J.length===0)return[];let Q=new Set;for(let X of J){if(typeof X!=="string")throw Error("Invalid tools config: tool list entries must be strings.");let K=S9(X);if(!K)continue;Q.add(K)}return Array.from(Q)}function ZV(J){if(!J)return[];return BJ(J.split(",").map((Q)=>Q.trim()).filter(Boolean))}function o1(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 WV(J){if(J!=null&&!pJ(J))throw Error('Invalid tools config: expected an object with "policy", "placement", and "providers".');let Q=c1(J?.policy),X=l1(J?.placement),K=s1(J?.providers),Z=o1(J?.pnpEnforcement,"pnpEnforcement"),W={policy:{allowed:BJ(RJ(Q?.allowed,"policy.allowed")),blocked:BJ(RJ(Q?.blocked,"policy.blocked"))},placement:{section:BJ(RJ(X?.section,"placement.section")).length?BJ(RJ(X?.section,"placement.section")):[...O9.section],item:BJ(RJ(X?.item,"placement.item")).length?BJ(RJ(X?.item,"placement.item")):[...O9.item],passage:BJ(RJ(X?.passage,"placement.passage")).length?BJ(RJ(X?.passage,"placement.passage")):[...O9.passage]},providers:K};if(Z)W.pnpEnforcement=Z;return W}var a1=["assessment","section","item","passage","rubric"],r1=new Set(a1);function kQ(J){return r1.has(J)}function G7(J,Q,X){let K=J.trim(),Z=X.trim();if(!K||!Z)throw Error("Tool instance ids require non-empty tool and scope ids");if(!kQ(Q))throw Error(`Unknown tool scope level '${Q}'. Register custom levels with registerToolScopeLevel().`);return`${K}:${Q}:${Z}`}function GV(J){let Q=J.split(":");if(Q.length!==3)return null;let[X,K,Z]=Q;if(!X||!Z)return null;if(!kQ(K))return null;return{baseToolId:X,scopeLevel:K,scopeId:Z}}var n1=["assessment","section","item","passage","rubric","element"];function Y8(J,Q){if(typeof J!=="string"||J.trim().length===0)throw Error(`Invalid tool registration: "${Q}" must be a non-empty string.`)}var t1=[{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 e1(J,Q,X){let K=Q.trimStart(),Z=K.toLowerCase().startsWith("<svg"),W=/^https?:/i.test(K);if(/^data:/i.test(K))throw Error(`Invalid tool registration "${J}": "${X}" may not be a data: URL.`);if(!Z&&!W)return;for(let{pattern:G,reason:z}of t1)if(G.test(Q))throw Error(`Invalid tool registration "${J}": "${X}" ${z}. Inline SVG icons must not include scriptable content.`)}function bQ(J){if(Y8(J.toolId,"toolId"),Y8(J.name,"name"),Y8(J.description,"description"),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")e1(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 Q=J.supportedLevels.find((X)=>!n1.includes(X));if(Q)throw Error(`Invalid tool registration "${J.toolId}": unsupported level "${Q}".`);if(J.activation!==void 0&&J.activation!=="toolbar-toggle"&&J.activation!=="selection-gateway")throw Error(`Invalid tool registration "${J.toolId}": unsupported activation "${String(J.activation)}".`);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(typeof J.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${J.toolId}": "isVisibleInContext" must be a function.`);if(typeof J.renderToolbar!=="function")throw Error(`Invalid tool registration "${J.toolId}": "renderToolbar" must be a function.`)}class A9{tools=new Map;pnpIndex=new Map;componentOverrides={};moduleLoaders=new Map;loadedToolModules=new Set;moduleLoadPromises=new Map;normalizeToolId(J){return S9(J)}normalizeToolIds(J){return J.map((Q)=>this.normalizeToolId(Q))}register(J){if(bQ(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)}}override(J){if(bQ(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 X of Q.pnpSupportIds)this.pnpIndex.get(X)?.delete(J.toolId);if(this.tools.set(J.toolId,J),J.pnpSupportIds)for(let X of J.pnpSupportIds){if(!this.pnpIndex.has(X))this.pnpIndex.set(X,new Set);this.pnpIndex.get(X).add(J.toolId)}}unregister(J){let Q=this.tools.get(J);if(!Q)return;if(Q.pnpSupportIds)for(let X of Q.pnpSupportIds)this.pnpIndex.get(X)?.delete(J);this.tools.delete(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}filterToolIdsByActivation(J,Q){return J.filter((X)=>this.getToolActivation(X)===Q)}filterVisibleInContext(J,Q){let X=[];for(let K of J){let Z=this.get(K);if(!Z){console.warn(`Tool '${K}' is allowed but not registered`);continue}if(!Z.supportedLevels.includes(Q.level))continue;try{if(Z.isVisibleInContext(Q))X.push(Z)}catch(W){console.error(`Error evaluating visibility for tool '${K}':`,W)}}return X}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}))}generatePNPSupportsFromTools(J){let Q=new Set;for(let X of J){let K=this.get(X);if(K?.pnpSupportIds)for(let Z of K.pnpSupportIds)Q.add(Z)}return Array.from(Q)}clear(){this.tools.clear(),this.pnpIndex.clear()}setComponentOverrides(J){this.componentOverrides=J}setToolModuleLoaders(J){for(let[Q,X]of Object.entries(J)){if(!X)continue;if(Y8(Q,"tool module loader id"),typeof X!=="function")throw Error(`Invalid tool module loader for "${Q}": expected a function.`);this.moduleLoaders.set(Q,X)}}async ensureToolModuleLoaded(J){if(this.loadedToolModules.has(J))return;let Q=this.moduleLoadPromises.get(J);if(Q){await Q;return}let X=this.moduleLoaders.get(J);if(!X)return;let K=(async()=>{await X(),this.loadedToolModules.add(J)})();this.moduleLoadPromises.set(J,K);try{await K}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,X){let K=this.get(J);if(!K)throw Error(`Tool '${J}' is not registered`);let Z={...X,componentOverrides:{...this.componentOverrides||{},...X.componentOverrides||{}}};return K.renderToolbar(Q,Z)}}function yQ(J){return J.level==="item"}function J5(J){return J.level==="passage"}function Q5(J){return J.level==="rubric"}function hQ(J){return J.level==="element"}function N9(J){if(hQ(J)){let Q=J.item.config;if(!Q)return"";let X=[],K=(z)=>z.replace(/<[^>]*>/g," ").trim(),Z=Q.elements?.[J.elementId];if(Z){if(typeof Z==="string")X.push(K(Z))}let W=Q.models,G=(Array.isArray(W)?W:W&&typeof W==="object"?Object.values(W):[]).find((z)=>z&&typeof z==="object"&&z.id===J.elementId);if(G)for(let z of Object.values(G)){if(typeof z==="string")X.push(K(z));if(Array.isArray(z)){for(let U of z)if(U&&typeof U==="object"){for(let q of Object.values(U))if(typeof q==="string")X.push(K(q))}}}return X.filter(Boolean).join(" ").trim()}if(yQ(J)){let Q=J.item;if(!Q?.config)return"";let X=Q.config,K=[],Z=(z)=>z.replace(/<[^>]*>/g," ").trim();if(typeof X.markup==="string")K.push(Z(X.markup));let W=X.elements;if(W&&typeof W==="object"){for(let z of Object.values(W))if(typeof z==="string")K.push(Z(z))}let $=X.models,G=Array.isArray($)?$:$&&typeof $==="object"?Object.values($):[];for(let z of G){if(!z||typeof z!=="object")continue;for(let U of Object.values(z)){if(typeof U==="string")K.push(Z(U));if(Array.isArray(U)){for(let q of U)if(q&&typeof q==="object"){for(let Y of Object.values(q))if(typeof Y==="string")K.push(Z(Y))}}}}return K.filter(Boolean).join(" ").trim()}if(J5(J)){let Q=J.passage;if(!Q?.config)return"";let X=Q.config,K=[],Z=(z)=>z.replace(/<[^>]*>/g," ").trim();if(typeof X.markup==="string")K.push(Z(X.markup));if(typeof X.content==="string")K.push(Z(X.content));if(typeof X.prompt==="string")K.push(Z(X.prompt));let W=X.elements;if(W&&typeof W==="object"){for(let z of Object.values(W))if(typeof z==="string")K.push(Z(z))}let $=X.models,G=Array.isArray($)?$:$&&typeof $==="object"?Object.values($):[];for(let z of G){if(!z||typeof z!=="object")continue;for(let U of Object.values(z)){if(typeof U==="string")K.push(Z(U));if(Array.isArray(U)){for(let q of U)if(q&&typeof q==="object"){for(let Y of Object.values(q))if(typeof Y==="string")K.push(Z(Y))}}}}return K.filter(Boolean).join(" ").trim()}if(Q5(J)){let Q=J.rubricBlock;if(Q.passage?.config)return(Q.passage.config.markup||"").replace(/<[^>]*>/g," ").trim();return(Q.content||"").replace(/<[^>]*>/g," ").trim()}return""}function _J(J){let Q=N9(J);return[/<math[>\s]/i,/\\\[([^\]]+)\\\]/,/\$\$[^$]+\$\$/,/\\\(/,/[+\-*/=<>≤≥∑∫√π]/,/\d+\s*[+\-*/=]\s*\d+/].some((K)=>K.test(Q))}function gQ(J){let Q=["pie-multiple-choice","pie-inline-choice","pie-select-text","pie-ebsr","multiple-choice","inline-choice","select-text","ebsr"];if(hQ(J)){let X=J.item.config;if(!X?.models)return!1;let Z=(Array.isArray(X.models)?X.models:Object.values(X.models)).find(($)=>$&&typeof $==="object"&&$.id===J.elementId);if(!Z)return!1;let W=Z.element||"";return Q.includes(W)}if(yQ(J)){let X=J.item.config?.models;return(Array.isArray(X)?X:X&&typeof X==="object"?Object.values(X):[]).some((Z)=>{if(!Z||typeof Z!=="object")return!1;let W=Z.element||"";if(Q.includes(W))return!0;return Array.isArray(Z.choices)&&Z.choices.length>0})}return!1}function dJ(J){return N9(J).trim().length>=10}function mQ(J){let Q=N9(J);return[/chemistry|chemical|element|atom|molecule|compound/i,/periodic\s+table/i,/H₂O|CO₂|NaCl|O₂|N₂/i,/\b[A-Z][a-z]?\d*\b/,/biology|organism|cell|DNA|RNA|protein/i,/physics|force|energy|velocity|acceleration/i].some((K)=>K.test(Q))}class vQ{providers=new Map;configs=new Map;initialized=new Map;initializationPromises=new Map;async emitTelemetry(J,Q,X){try{await J.onTelemetry?.(Q,X)}catch(K){console.warn("[ToolProviderRegistry] Telemetry callback failed:",K)}}register(J,Q){if(this.providers.has(J)){console.warn(`[ToolProviderRegistry] Provider "${J}" already registered, skipping`);return}if(this.providers.set(J,Q.provider),this.configs.set(J,Q),this.initialized.set(J,!1),console.log(`[ToolProviderRegistry] Registered provider "${J}" (${Q.provider.providerName})`),Q.lazy===!1)this.initialize(J).catch((X)=>{console.error(`[ToolProviderRegistry] Failed to initialize provider "${J}":`,X)})}async initialize(J){if(this.initialized.get(J))return;let Q=this.initializationPromises.get(J);if(Q)return Q;let X=this._doInitialize(J);this.initializationPromises.set(J,X);try{await X}finally{this.initializationPromises.delete(J)}}async _doInitialize(J){let Q=this.providers.get(J),X=this.configs.get(J);if(!Q||!X)throw Error(`[ToolProviderRegistry] Provider "${J}" not registered`);let K={...X.config},Z=($)=>{if(!$||typeof $!=="object")return"unknown";let G=$;return(typeof G.backend==="string"?G.backend:typeof G.provider==="string"?G.provider:typeof G.serverProvider==="string"?G.serverProvider:typeof G.providerId==="string"?G.providerId:"")||"unknown"},W=Date.now();if(await this.emitTelemetry(X,"pie-tool-init-start",{toolId:J,providerId:J,backend:Z(K),operation:"provider-initialize"}),Q.requiresAuth&&X.authFetcher){let $=Date.now();await this.emitTelemetry(X,"pie-tool-backend-call-start",{toolId:J,providerId:J,backend:Z(K),operation:"auth-fetch"}),console.log(`[ToolProviderRegistry] Fetching auth for "${J}"...`);try{let G=await X.authFetcher();K={...K,...G},await this.emitTelemetry(X,"pie-tool-backend-call-success",{toolId:J,providerId:J,backend:Z(K),operation:"auth-fetch",duration:Date.now()-$})}catch(G){throw await this.emitTelemetry(X,"pie-tool-backend-call-error",{toolId:J,providerId:J,backend:Z(K),operation:"auth-fetch",duration:Date.now()-$,errorType:"ProviderAuthFetchError",message:G instanceof Error?G.message:String(G)}),console.error(`[ToolProviderRegistry] Auth fetch failed for "${J}":`,G),Error(`Failed to fetch auth credentials for provider "${J}"`)}}try{await Q.initialize(K),this.initialized.set(J,!0),await this.emitTelemetry(X,"pie-tool-init-success",{toolId:J,providerId:J,backend:Z(K),operation:"provider-initialize",duration:Date.now()-W}),console.log(`[ToolProviderRegistry] Provider "${J}" initialized`)}catch($){throw await this.emitTelemetry(X,"pie-tool-init-error",{toolId:J,providerId:J,backend:Z(K),operation:"provider-initialize",duration:Date.now()-W,errorType:"ProviderInitializationError",message:$ instanceof Error?$.message:String($)}),console.error(`[ToolProviderRegistry] Initialization failed for "${J}":`,$),$}}async getProvider(J,Q=!0){console.log("[ToolProviderRegistry] getProvider called",{providerId:J,autoInitialize:Q,isRegistered:this.providers.has(J),isInitialized:this.initialized.get(J),allProviderIds:Array.from(this.providers.keys())});let X=this.providers.get(J);if(!X)throw console.error("[ToolProviderRegistry] Provider not found:",{requestedId:J,availableProviders:Array.from(this.providers.keys())}),Error(`[ToolProviderRegistry] Provider "${J}" not registered`);if(Q&&!this.initialized.get(J))console.log("[ToolProviderRegistry] Auto-initializing provider:",J),await this.initialize(J);return console.log("[ToolProviderRegistry] Returning provider:",{providerId:J,providerName:X.providerName,isReady:X.isReady()}),X}getProvidersByCategory(J){return Array.from(this.providers.entries()).filter(([Q,X])=>X.category===J).map(([Q])=>Q)}getProviderIds(){return Array.from(this.providers.keys())}has(J){return this.providers.has(J)}isInitialized(J){return this.initialized.get(J)===!0}isInitializing(J){return this.initializationPromises.has(J)}async unregister(J){let Q=this.providers.get(J);if(Q){let X=this.initializationPromises.get(J);if(X)try{await X}catch{}Q.destroy(),this.providers.delete(J),this.configs.delete(J),this.initialized.delete(J),this.initializationPromises.delete(J),console.log(`[ToolProviderRegistry] Unregistered provider "${J}"`)}}async destroy(){let J=Array.from(this.providers.keys());await Promise.all(J.map((Q)=>this.unregister(Q))),console.log("[ToolProviderRegistry] Registry destroyed")}}class B8{providerId="desmos-calculator";providerName="Desmos Calculator";category="calculator";version="1.12";requiresAuth=!0;desmosProvider=null;config=null;async emitTelemetry(J,Q){try{await this.config?.onTelemetry?.(J,Q)}catch(X){console.warn("[DesmosToolProvider] telemetry callback failed:",X)}}async initialize(J){if(this.desmosProvider){console.warn("[DesmosToolProvider] Already initialized, skipping reinitialization");return}this.config=J;let Q=Date.now();await this.emitTelemetry("pie-tool-library-load-start",{toolId:"calculator",operation:"desmos-provider-module-import",backend:"desmos"});let X=await(async()=>{try{let K=await import("@pie-players/pie-calculator-desmos");return await this.emitTelemetry("pie-tool-library-load-success",{toolId:"calculator",operation:"desmos-provider-module-import",backend:"desmos",duration:Date.now()-Q}),K}catch(K){throw await this.emitTelemetry("pie-tool-library-load-error",{toolId:"calculator",operation:"desmos-provider-module-import",backend:"desmos",duration:Date.now()-Q,errorType:"ToolLibraryLoadError",message:K instanceof Error?K.message:String(K)}),K}})();this.desmosProvider=new X.DesmosCalculatorProvider;try{await this.desmosProvider.initialize({apiKey:J.apiKey,proxyEndpoint:J.proxyEndpoint,onTelemetry:J.onTelemetry}),console.log(`[DesmosToolProvider] Initialized successfully ${J.proxyEndpoint?"(using proxy)":J.apiKey?"(direct API key)":"(no auth)"}`)}catch(K){throw console.error("[DesmosToolProvider] Initialization failed:",K),Error("Failed to initialize Desmos calculator provider. Check API key or proxy endpoint.")}}async createInstance(J){if(!this.desmosProvider)throw Error("[DesmosToolProvider] Provider not initialized. Call initialize() first.");return this.desmosProvider}getCapabilities(){return{supportsOffline:!1,requiresAuth:!0,maxInstances:null,features:{basic:!0,scientific:!0,graphing:!0,fourFunction:!0}}}isReady(){return this.desmosProvider!==null}destroy(){if(this.desmosProvider)this.desmosProvider.destroy(),this.desmosProvider=null;this.config=null,console.log("[DesmosToolProvider] Destroyed")}}var uQ=(J,Q)=>{let X=Q?.useSentenceSegmenter!==!1;try{if(!X)throw Error("Segmenter disabled by policy");let G=globalThis.Intl?.Segmenter;if(typeof G==="function"){let z=new G(Q?.locale,{granularity:"sentence"}),U=Array.from(z.segment(J)).map((q)=>({text:q.segment,offset:q.index})).filter((q)=>q.text.trim().length>0);if(U.length>0)return U}}catch{}let K=/[^.!?]+(?:[.!?]+|$)/g,Z=J.match(K)||[J],W=[],$=0;for(let G of Z){let z=J.indexOf(G,$);if(z===-1)continue;W.push({text:G,offset:z}),$=z+G.length}return W.length>0?W:[{text:J,offset:0}]};var fQ=(J)=>String(J||"").trim().toLowerCase(),X5=()=>{let J=typeof navigator<"u"?navigator.language||navigator.languages?.[0]:"";return fQ(J||"en-US")},K5=(J,Q)=>{if(Q){let $=J.find((G)=>G.name===Q);if($)return $}let X=X5(),K=X.split("-")[0]||"en",Z=($)=>{let G=fQ($.lang);return G===X||G.startsWith(`${K}-`)},W=[($)=>$.localService&&Z($),($)=>$.default&&Z($),($)=>Z($),($)=>$.localService,($)=>$.default];for(let $ of W){let G=J.find($);if(G)return G}return J[0]||null},Z5=(J)=>!J.default;class D9{providerId="browser";providerName="Browser Speech Synthesis";version="1.0.0";async initialize(J){if(typeof window>"u")throw Error("BrowserTTSProvider requires browser environment");if(!("speechSynthesis"in window))throw Error("Browser does not support Speech Synthesis API");return new pQ(J)}supportsFeature(J){return!0}getCapabilities(){return{supportsPause:!0,supportsResume:!0,supportsWordBoundary:!0,supportsVoiceSelection:!0,supportsRateControl:!0,supportsPitchControl:!0,supportsSSML:!1}}destroy(){}}class pQ{utterance=null;config=null;_isPlaying=!1;_isPaused=!1;speakRunId=0;constructor(J){this.config=J}async speak(J){if(!this.config)throw Error("TTS not initialized");this.stop();let Q=this.speakRunId,X=this.splitIntoChunks(J);for(let K of X){if(Q!==this.speakRunId)break;if(!await this.speakChunk(K.text,K.offset,Q))break}}async speakSegments(J){if(!this.config)throw Error("TTS not initialized");this.stop();let Q=this.speakRunId;for(let X of J){if(Q!==this.speakRunId)break;let K=this.splitIntoChunks(X.text);for(let W of K){if(Q!==this.speakRunId)break;if(!await this.speakChunk(W.text,X.startOffset+W.offset,Q))break}let Z=Math.max(0,Number(X.pauseMsAfter||0));if(Z>0&&Q===this.speakRunId){if(!await this.waitForPause(Z,Q))break}}}async waitForPause(J,Q){return await new Promise((X)=>setTimeout(X,J)),Q===this.speakRunId}splitIntoChunks(J){if(J.length<=260)return[{text:J,offset:0}];let X=this.segmentSentences(J),K=[],Z="",W=0;for(let $ of X){let G=$.text.trim();if(!G)continue;let z=$.text.search(/\S/),U=$.offset+(z===-1?0:z);if(!Z){Z=G,W=U;continue}let q=`${Z} ${G}`;if(q.length<=260)Z=q;else K.push({text:Z,offset:W}),Z=G,W=U}if(Z)K.push({text:Z,offset:W});return K.length?K:[{text:J,offset:0}]}getHighlightMode(){return(this.config?.providerOptions||{}).highlightMode==="word"?"word":"sentence"}getSegmentationPolicy(){let J=this.config?.providerOptions||{},Q=J.segmenter||{},K=Q.mode!=="regexOnly",Z=typeof Q.locale==="string"&&Q.locale.trim().length>0?Q.locale:typeof J.locale==="string"&&J.locale.trim().length>0?J.locale:void 0;return{useSentenceSegmenter:K,useWordSegmenter:K,locale:Z}}segmentSentences(J){let Q=this.getSegmentationPolicy();return uQ(J,{locale:Q.locale,useSentenceSegmenter:Q.useSentenceSegmenter})}inferWordLength(J,Q){let X=Math.max(0,Math.min(Q,Math.max(0,J.length-1)));return J.slice(X).match(/^\s*([^\s]+)/)?.[1]?.length||1}async speakChunk(J,Q,X){return new Promise((K,Z)=>{if(X!==this.speakRunId){K(!1);return}let W=new SpeechSynthesisUtterance(J);this.utterance=W;let $=K5(speechSynthesis.getVoices(),this.config?.voice);if($&&Z5($))W.voice=$;if(this.config?.rate)W.rate=this.config.rate;if(this.config?.pitch)W.pitch=this.config.pitch;let G=()=>{if(this.utterance===W)this.utterance=null};W.onstart=()=>{if(X!==this.speakRunId)return;this._isPlaying=!0,this._isPaused=!1},W.onend=()=>{if(G(),X!==this.speakRunId){K(!1);return}this._isPlaying=!1,this._isPaused=!1,K(!0)},W.onerror=(z)=>{if(G(),X!==this.speakRunId){K(!1);return}if(this._isPlaying=!1,this._isPaused=!1,z.error==="interrupted"||z.error==="canceled"){K(!1);return}Z(Error(`Speech synthesis error: ${z.error}`))},W.onpause=()=>{if(X!==this.speakRunId)return;this._isPaused=!0},W.onresume=()=>{if(X!==this.speakRunId)return;this._isPaused=!1},W.onboundary=(z)=>{if(X!==this.speakRunId)return;if(console.log("[BrowserProvider] Boundary event:",z.name,"charIndex:",z.charIndex,"charLength:",z.charLength),z.name!=="word"||!this.onWordBoundary)return;if(this.getHighlightMode()==="sentence")return;let U=Math.max(0,Math.min(z.charIndex,Math.max(0,J.length-1))),q=Number(z.charLength||0),Y=this.inferWordLength(J,U),H=Number.isFinite(q)&&q>0&&q<=80&&U+q<=J.length?q:Y,B=J.substring(U,Math.min(J.length,U+H)).trim(),V=Q+U;console.log("[BrowserProvider] Calling onWordBoundary with word:",B,"at position:",V),this.onWordBoundary(B,V,H)},speechSynthesis.speak(W)})}pause(){if(this._isPlaying&&!this._isPaused)speechSynthesis.pause()}resume(){if(this._isPlaying&&this._isPaused)speechSynthesis.resume()}stop(){if(this.speakRunId+=1,this._isPlaying||this.utterance)speechSynthesis.cancel();this.utterance=null,this._isPlaying=!1,this._isPaused=!1}isPlaying(){return this._isPlaying&&!this._isPaused}isPaused(){return this._isPaused}updateSettings(J){if(!this.config)this.config={};if(J.rate!==void 0)this.config.rate=J.rate;if(J.pitch!==void 0)this.config.pitch=J.pitch;if(J.voice!==void 0)this.config.voice=J.voice;if(J.providerOptions!==void 0)this.config.providerOptions={...this.config.providerOptions||{},...J.providerOptions||{}}}onWordBoundary}class P8{providerId="tts-service";providerName="Text-to-Speech";category="tts";version="1.0";requiresAuth;ttsProvider=null;config=null;async emitTelemetry(J,Q){try{await this.config?.onTelemetry?.(J,Q)}catch(X){console.warn("[TTSToolProvider] telemetry callback failed:",X)}}constructor(J="browser"){this.requiresAuth=J!=="browser"}async initialize(J){if(this.ttsProvider){console.warn("[TTSToolProvider] Already initialized, skipping reinitialization");return}switch(this.config=J,J.backend){case"browser":await this._initializeBrowserTTS(J);break;case"polly":case"google":case"server":await this._initializeServerTTS(J);break;default:throw Error(`[TTSToolProvider] Unknown backend: ${J.backend}`)}console.log(`[TTSToolProvider] Initialized successfully (backend: ${J.backend})`)}async _initializeBrowserTTS(J){if(typeof window>"u"||!("speechSynthesis"in window))throw Error("[TTSToolProvider] Browser TTS not supported (Web Speech API not available)");this.ttsProvider=new D9,console.log("[TTSToolProvider] Browser TTS initialized (Web Speech API)")}async _initializeServerTTS(J){if(!J.apiEndpoint)throw Error("[TTSToolProvider] apiEndpoint required for server-based TTS backends");let Q=Date.now();await this.emitTelemetry("pie-tool-library-load-start",{toolId:"textToSpeech",operation:"server-provider-module-import",backend:J.serverProvider||J.backend});let X=await(async()=>{try{let K=await import("@pie-players/tts-client-server");return await this.emitTelemetry("pie-tool-library-load-success",{toolId:"textToSpeech",operation:"server-provider-module-import",backend:J.serverProvider||J.backend,duration:Date.now()-Q}),K}catch(K){throw await this.emitTelemetry("pie-tool-library-load-error",{toolId:"textToSpeech",operation:"server-provider-module-import",backend:J.serverProvider||J.backend,duration:Date.now()-Q,errorType:"ToolLibraryLoadError",message:K instanceof Error?K.message:String(K)}),K}})();this.ttsProvider=new X.ServerTTSProvider,console.log(`[TTSToolProvider] Server TTS initialized (provider: ${J.serverProvider||J.backend})`)}async createInstance(J){if(!this.ttsProvider)throw Error("[TTSToolProvider] Provider not initialized. Call initialize() first.");return this.ttsProvider}getCapabilities(){let J=this.config?.backend==="browser";return{supportsOffline:J,requiresAuth:!J,maxInstances:1,features:{wordBoundary:!0,pause:!0,resume:!0,rateControl:!0,pitchControl:J,voiceSelection:!0}}}isReady(){return this.ttsProvider!==null}destroy(){if(this.ttsProvider)this.ttsProvider.destroy(),this.ttsProvider=null;this.config=null,console.log("[TTSToolProvider] Destroyed")}}import{validateCustomElementTag as W5}from"@pie-players/pie-players-shared/pie/tag-names";var j9={calculator:"pie-tool-calculator",textToSpeech:"pie-tool-text-to-speech",ruler:"pie-tool-ruler",protractor:"pie-tool-protractor",answerEliminator:"pie-tool-answer-eliminator",highlighter:"pie-tool-annotation-toolbar",lineReader:"pie-tool-line-reader",theme:"pie-tool-theme",annotationToolbar:"pie-tool-annotation-toolbar",graph:"pie-tool-graph",periodicTable:"pie-tool-periodic-table"},$5=(J,Q)=>{let X=Q?.toolTagMap?.[J]??j9[J]??J;return W5(X,`tool component tag for "${J}"`)},G5=(J)=>document.createElement(J),L0=(J,Q,X,K)=>{let Z=$5(J,K),$=K?.toolComponentFactories?.[J]??K?.toolComponentFactory;return $?$({toolId:J,tagName:Z,context:Q,toolbarContext:X}):G5(Z)};var R9=new WeakMap;function z5(J,Q){if(!J)return null;let X=R9.get(J),K=X?.get(Q);if(!K)return null;if(!K.isConnected)return X?.delete(Q),null;return K}function q5(J,Q,X){if(!J)return;let K=R9.get(J);if(!K)K=new Map,R9.set(J,K);K.set(Q,X)}function _Q(J){return J==="basic"||J==="scientific"?J:null}function U5(J){let Q=J.getToolRenderParams?.("calculator")??{},X=_Q(Q.calculatorType),K=Q.availableTypes,Z=Array.isArray(K)?K.map((W)=>_Q(W)).filter((W)=>W!==null):X?[X]:null;return{calculatorType:X,availableTypes:Z,displayName:X==="scientific"?"Scientific Calculator":X==="basic"?"Basic Calculator":"Calculator"}}function dQ(J,Q,X){let K=J;if(Q)K.calculatorType=Q,J.setAttribute("calculator-type",Q);else delete K.calculatorType,J.removeAttribute("calculator-type");if(X&&X.length>0)K.availableTypes=X;else delete K.availableTypes}var lQ={toolId:"calculator",name:"Calculator",description:"Multi-type calculator (basic, scientific, graphing)",icon:"calculator",provider:{getProviderId:(J)=>typeof J?.provider?.id==="string"&&J.provider.id.length>0?J.provider.id:"calculator-desmos",createProvider:()=>new B8,getInitConfig:(J)=>J?.provider?.init??{},getAuthFetcher:(J)=>{let Q=J?.provider?.runtime?.authFetcher;if(typeof Q==="function")return Q;return async()=>{let X=await fetch("/api/tools/desmos/auth",{method:"GET",credentials:"same-origin"});if(!X.ok)throw Error(`Failed to fetch Desmos auth config (${X.status})`);return await X.json()}},lazy:!0},supportedLevels:["item"],pnpSupportIds:["calculator","graphingCalculator","basicCalculator","scientificCalculator"],isVisibleInContext(J){return _J(J)},renderToolbar(J,Q){let{calculatorType:X,availableTypes:K,displayName:Z}=U5(Q),W=G7(this.toolId,Q.scope.level,Q.scope.scopeId),$=Q.componentOverrides,G=z5(Q.toolCoordinator,W),z=G??L0(this.toolId,J,Q,$);if(!G)q5(Q.toolCoordinator,W,z);z.setAttribute("tool-id",W),z.toolkitCoordinator=Q.toolkitCoordinator,dQ(z,X,K);let U=X===null?"Open scientific calculator":`Open ${Z.toLowerCase()}`,q=X===null?"Close scientific calculator":`Close ${Z.toLowerCase()}`,Y={toolId:this.toolId,label:Z,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:U,tooltip:Z,onClick:()=>Q.toggleTool(this.toolId),active:Q.isToolVisible(W)},H=Y.active;if(z.visible!==Y.active)z.visible=Y.active;return{toolId:this.toolId,elements:[{element:z,mount:"after-buttons",shell:{title:this.name,draggable:!0,resizable:!0,closeable:!0,initialWidth:380,initialHeight:420,minWidth:380,minHeight:420,initialAlign:"bottom-right",initialMargin:16,content:{overflowY:"auto",preserveMinHeight:!0}}}],button:Y,sync:()=>{let B=Q.isToolVisible(W);if(Y.active=B,Y.label=Z,Y.ariaLabel=B?q:U,Y.tooltip=B?`Close ${Z.toLowerCase()}`:Z,H!==B)z.visible=B,H=B;if(z.toolkitCoordinator!==Q.toolkitCoordinator)z.toolkitCoordinator=Q.toolkitCoordinator;dQ(z,X,K)},subscribeActive:(B)=>{if(!Q.subscribeVisibility)return()=>{};return Q.subscribeVisibility(()=>{B(Q.isToolVisible(W))})}}}};var V8=(J)=>J.trim().replace(/\s+/g," "),EV=()=>/[\p{L}]+|\d+(?:\.\d+)?|[±√=+\-*/()²³^×÷≤≥≠≈<>|%°'′\u2062]/gu,H5=(J)=>{if(J.hidden)return!0;if(J.tagName?.toLowerCase()==="mjx-assistive-mml")return!0;if(J.getAttribute("aria-hidden")==="true")return!0;if(J.hasAttribute("inert"))return!0;let Q=J.classList;if(Q?.contains("sr-only")||Q?.contains("pie-sr-only")||Q?.contains("visually-hidden"))return!0;if(typeof window<"u"){let X=window.getComputedStyle(J);if(X.display==="none"||X.visibility==="hidden")return!0;let K=Number.parseFloat(X.width||"0"),Z=Number.parseFloat(X.height||"0"),W=Number.isFinite(K)&&Number.isFinite(Z)&&K<=1&&Z<=1,$=X.clipPath.includes("inset(50%")||X.clipPath.includes("inset(100%")||X.clip.includes("rect(0px, 0px, 0px, 0px)")||X.clip.includes("rect(0 0 0 0)");if((X.position==="absolute"||X.position==="fixed")&&W&&(X.overflow==="hidden"||$))return!0;if(X.opacity==="0"&&W)return!0}return!1},Y5=(J,Q)=>{let X=J.nodeType===1?J:J.parentElement;while(X){if(H5(X))return!0;if(Q&&X===Q)break;X=X.parentElement}return!1};var sQ=new Set(["computer-read-aloud","all"]),cQ=new Set([...sQ,"screen-reader"]),iQ=new Set,B5=(J)=>{let Q=J.getAttribute?.("data-tts-suppress");if(Q===null||Q===void 0)return!1;let X=Q.trim().toLowerCase();if(sQ.has(X))return!0;if(cQ.has(X))return!1;if(!iQ.has(X))iQ.add(X),console.warn(`[tts] data-tts-suppress="${Q}" is not one of ${Array.from(cQ).join(", ")}; suppressing read-aloud for this content anyway, because a suppression attribute that fails open would leak the answer to items where reading is the construct. Correct the value to silence this.`);return!0},P5=(J,Q)=>{let X=J.nodeType===1?J:J.parentElement;while(X){if(B5(X))return!0;if(Q&&X===Q)break;X=X.parentElement}return!1},oQ=(J,Q)=>Y5(J,Q)||P5(J),xV=(J,Q)=>{if(typeof document>"u"||typeof document.createTreeWalker!=="function"||typeof NodeFilter>"u"||typeof J.intersectsNode!=="function")return{text:J.toString(),filtered:!1};let X=[],K=!1,Z=document.createTreeWalker(Q,NodeFilter.SHOW_TEXT),W=Z.nextNode();while(W){let $=W;if(J.intersectsNode($))if(oQ($,Q))K=!0;else{let G=$.textContent||"",z=$===J.startContainer?J.startOffset:0,U=$===J.endContainer?J.endOffset:G.length;X.push(G.slice(z,U))}W=Z.nextNode()}return{text:X.join(""),filtered:K}},V5=(J,Q,X)=>{if(!J||!Q)return!1;if(/\s/.test(J)||/\s/.test(Q))return!1;let K=X?.boundarySpacingMode??"segmenterPreferred";if(K==="none")return!1;if(K==="segmenterPreferred")try{let $=globalThis.Intl?.Segmenter;if(typeof $==="function"){let G=new $(X?.locale,{granularity:"word"});if(Array.from(G.segment(`${J}${Q}`)).filter((q)=>q.isWordLike!==!1&&q.segment.trim().length>0).length>=2)return!0}}catch{}let Z=/[A-Za-z0-9]/.test(J),W=/[A-Za-z0-9]/.test(Q);return Z&&W},kV=(J,Q)=>{let X=new Map;if(typeof document>"u"||typeof document.createTreeWalker!=="function"||typeof NodeFilter>"u")return{text:"",map:X};let K=[],Z=0,W=!0,$=!1,G=null,z=null,U=document.createTreeWalker(J,NodeFilter.SHOW_TEXT),q=U.nextNode();while(q){let H=q;if(H.parentElement&&!oQ(H,J)){let V=H.textContent||"",F=V.match(/\S/),M=F?F[0]:null;if(!W&&!$&&V5(z,M,Q)){if(K.push(" "),G)X.set(Z,G);Z++,$=!0}for(let O=0;O<V.length;O++){let j=V[O],T=/\s/.test(j);if(W){if(!T)W=!1,K.push(j),X.set(Z,{node:H,offset:O}),G={node:H,offset:O},Z++,$=!1,z=j}else if(T){if(!$)K.push(" "),X.set(Z,{node:H,offset:O}),G={node:H,offset:O},Z++;$=!0}else K.push(j),X.set(Z,{node:H,offset:O}),G={node:H,offset:O},Z++,$=!1,z=j}}q=U.nextNode()}let Y=K.join("").trimEnd();while(X.has(Y.length))X.delete(Y.length);return{text:Y,map:X}};var C9=null,aQ=Promise.resolve(),M5=(J)=>(J||"en").split("-")[0].toLowerCase()||"en",F5=async()=>{if(!C9)C9=import("speech-rule-engine").then((J)=>{let Q=J.default||J;if(!Q||typeof Q.toSpeech!=="function")throw Error("speech-rule-engine did not expose toSpeech");return Q});return C9},L5=(J)=>J==="en"?"clearspeak":"mathspeak",rQ=(J)=>!!J&&typeof J==="object"&&!Array.isArray(J),nQ=(J)=>typeof J==="string"&&J.trim()?J.trim():void 0,I9=(J)=>{if(!rQ(J))return;let Q=nQ(J.domain),X=nQ(J.style),K=rQ(J.engineOptions)?J.engineOptions:void 0;if(!Q&&!X&&!K)return;return{...Q?{domain:Q}:{},...X?{style:X}:{},...K?{engineOptions:K}:{}}},w5=async(J,Q,X,K)=>{let Z=M5(Q),W=I9(K);await J.setupEngine?.({...W?.engineOptions||{},locale:Z,domain:W?.domain||L5(Z),...W?.style?{style:W.style}:{},modality:"speech",markup:X}),await J.engineReady?.()},O5=async(J)=>{let Q=aQ.then(J,J);return aQ=Q.then(()=>{return},()=>{return}),Q},tQ=async(J,Q,X,K,Z)=>O5(async()=>{return await w5(J,X,K,Z),J.toSpeech(Q)}),S5=(J)=>J.replace(/^\s*<\?xml[^>]*\?>\s*/i,""),A5=async(J,Q,X,K)=>{try{let Z=S5(await tQ(J,Q,X,"ssml",K));return Z.includes("<speak")?Z:null}catch(Z){return console.debug("[TTSService] Math SSML generation failed; using plain",{message:Z instanceof Error?Z.message:String(Z)}),null}},hV=async(J,Q={})=>{if(!J.some((U)=>U.type==="math"))return{speechText:V8(J.map((U)=>U.type==="text"?U.text:U.fallbackText).join(" ")),usedMathSpeech:!1,usedFallback:!1};let X=null,K=!1,Z=!1,W=Q.loadSre||F5,$=[];for(let U of J){if(U.type==="text"){$.push(U.text);continue}try{if(!X)X=await W();let q=V8(await tQ(X,U.mathml,Q.language,"none",Q.mathSpeech));if(q){$.push(q),K=!0;continue}Z=!0,$.push(U.fallbackText)}catch(q){Z=!0,console.debug("[TTSService] Math speech generation failed; using visible fallback",{message:q instanceof Error?q.message:String(q)}),$.push(U.fallbackText)}}let G=V8($.join(" ")),z;if(Q.produceSsml&&X&&K&&J.length===1&&J[0].type==="math")z=await A5(X,J[0].mathml,Q.language,Q.mathSpeech)??void 0;return{speechText:G,usedMathSpeech:K,usedFallback:Z,ssml:z}};var N5=new Set(["reserved-row","expanding-row","floating-overlay","left-aligned"]),T9=(J)=>J&&typeof J==="object"?J:{},D5=(J)=>J==="polly"||J==="google"||J==="server",g0=(J,Q)=>J===void 0?Q:J,R7=(J,Q="left-aligned")=>typeof J==="string"&&N5.has(J)?J:Q,vV=Object.freeze([0.8,1.25]),eQ=Object.freeze([{rate:0.8,label:"Slow",ariaLabel:"Slow speed"},{rate:1,label:"Normal",ariaLabel:"Normal speed",default:!0},{rate:1.25,label:"Fast",ariaLabel:"Fast speed"}]);var J6=(J)=>{if(typeof J!=="number"||!Number.isFinite(J)||J<=0)return;return Math.round(J*100)/100},Q6=(J)=>{if(typeof J!=="string")return;let Q=J.trim();return Q.length?Q:void 0},X6=(J)=>`${J}x`,K6=(J,Q)=>J.toLowerCase()==="normal"?"Normal speed":Q?`Speed ${J}`:`${J} speed`,j5=(J,Q,X)=>{if(!Q)return K6(J,X);if(Q.toLowerCase().includes(J.toLowerCase()))return Q;return`${J} ${Q}`};var C7=(J)=>{let Q=Array.isArray(J)?J:[...eQ];if(Q.length===0)return[];let X=new Set,K=[];for(let $ of Q){let G=T9($),z=typeof $==="number"?J6($):J6(G.rate);if(z===void 0||X.has(z))continue;X.add(z);let U=z===1?"Normal":typeof $==="number"?X6(z):X6(z),q=typeof $==="number"?U:Q6(G.label)||U,Y=typeof $==="number"?z===1?"Normal speed":K6(q,!0):j5(q,Q6(G.ariaLabel),q===U);K.push({rate:z,label:q,ariaLabel:Y,isDefault:!1,requestedDefault:G.default===!0||G.isDefault===!0})}if(!K.length)return C7(eQ);if(!X.has(1)){let $={rate:1,label:"Normal",ariaLabel:"Normal speed",isDefault:!1,requestedDefault:!1},G=K.findIndex((z)=>z.rate>1);if(G>=0)K.splice(G,0,$);else K.push($)}let Z=K.findIndex(($)=>$.requestedDefault),W=Z>=0?Z:K.findIndex(($)=>$.rate===1);return K.map(({requestedDefault:$,...G},z)=>({...G,isDefault:z===W}))};var uV=Object.freeze([0.8,1,1.25]);var R5=(J)=>{let Q={...J,layoutMode:R7(J.layoutMode)},X=J.backend||"browser";if(!D5(X))return Q;let K={...Q,apiEndpoint:g0(Q.apiEndpoint,"/api/tts"),transportMode:g0(Q.transportMode,"pie"),endpointValidationMode:g0(Q.endpointValidationMode,"voices"),validateEndpoint:g0(Q.validateEndpoint,!0),includeAuthOnAssetFetch:g0(Q.includeAuthOnAssetFetch,!1),rate:g0(Q.rate,1),language:g0(Q.language,"en-US")};if(X==="polly")return{...K,defaultVoice:g0(K.defaultVoice,"Joanna"),engine:g0(K.engine,"neural"),format:g0(K.format,"mp3"),speechMarksMode:g0(K.speechMarksMode,"word+sentence")};if(X==="google")return{...K,defaultVoice:g0(K.defaultVoice,"en-US-Wavenet-A")};return K},M8=(J)=>{let Q=T9(J),X=T9(Q.settings);return R5({...Q,...X})},F8=(J)=>J.backend||"browser",E9=(J,Q)=>{if(Q==="polly"||Q==="google")return Q;if(Q==="server")return J.serverProvider||J.provider;return J.serverProvider||J.provider},x9=(J,Q)=>J.transportMode||(Q==="custom"?"custom":"pie"),Z6=(J)=>{let Q=F8(J),X=E9(J,Q),K=x9(J,X),Z=I9(J.mathSpeech);return{voice:J.defaultVoice,rate:J.rate,pitch:J.pitch,providerOptions:{...J.language?{locale:J.language}:{},...Q==="polly"&&J.engine?{engine:J.engine}:{},...Q==="polly"&&typeof J.sampleRate==="number"?{sampleRate:J.sampleRate}:{},...Q==="polly"&&J.format?{format:J.format}:{},...Q==="polly"?{speechMarkTypes:J.speechMarksMode==="word+sentence"?["word","sentence"]:["word"]}:{},...K==="custom"&&typeof J.cache==="boolean"?{cache:J.cache}:{},...K==="custom"&&J.speedRate?{speedRate:J.speedRate}:{},...K==="custom"&&J.lang_id?{lang_id:J.lang_id}:{},...Z?{mathSpeech:Z}:{}},apiEndpoint:J.apiEndpoint,provider:X,language:J.language,transportMode:K,endpointMode:J.endpointMode,endpointValidationMode:J.endpointValidationMode,includeAuthOnAssetFetch:J.includeAuthOnAssetFetch,validateEndpoint:J.validateEndpoint,...typeof J.mathTokenHighlighting==="boolean"?{mathTokenHighlighting:J.mathTokenHighlighting}:{}}},k9=(J)=>R7(J.layoutMode),W6=(J)=>{switch(k9(J)){case"reserved-row":return{mount:"before-buttons",controlsRow:{reserveSpace:!0,expandWhenToolActive:!1},headerOverlay:{expandWhenToolActive:!1}};case"expanding-row":return{mount:"before-buttons",controlsRow:{reserveSpace:!1,expandWhenToolActive:!0},headerOverlay:{expandWhenToolActive:!1}};case"floating-overlay":return{mount:"before-buttons",controlsRow:{reserveSpace:!1,expandWhenToolActive:!1},headerOverlay:{expandWhenToolActive:!1}};case"left-aligned":default:return{mount:"before-buttons",controlsRow:{reserveSpace:!1,expandWhenToolActive:!1},headerOverlay:{expandWhenToolActive:!0}}}};var I7=new Map,C5="__pieToolElementUnmount",$6="pie-tool-active-change",G6={toolId:"textToSpeech",name:"Text to Speech",description:"Read content aloud",icon:"volume-up",provider:{getProviderId:()=>"tts",createProvider:(J)=>{let Q=M8(J);return new P8(F8(Q))},getInitConfig:(J)=>{let Q=M8(J),X=F8(Q),K=E9(Q,X),Z=x9(Q,K);return{backend:X,serverProvider:K,transportMode:Z,...Z6(Q)}},getAuthFetcher:(J)=>{let Q=J?.provider?.runtime?.authFetcher;return typeof Q==="function"?Q:void 0},sanitizeConfig:(J)=>{let Q=J.settings&&typeof J.settings==="object"?{...J.settings}:void 0;if(Q&&"layoutMode"in Q)Q.layoutMode=R7(Q.layoutMode);if(Q&&"speedOptions"in Q)Q.speedOptions=C7(Q.speedOptions);let X={...J};if("layoutMode"in X)X.layoutMode=R7(X.layoutMode);if("speedOptions"in X)X.speedOptions=C7(X.speedOptions);if(Q)X.settings=Q;return X},lazy:!0},supportedLevels:["item","passage"],pnpSupportIds:["textToSpeech","readAloud","tts","speechOutput"],isVisibleInContext(J){return dJ(J)},renderToolbar(J,Q){let X=()=>M8(Q.toolkitCoordinator?.getToolConfig(this.toolId)||void 0),K=()=>{let q=X();return C7(q.speedOptions)},Z=()=>k9(X()),W=()=>W6(X()),$=G7(this.toolId,Q.scope.level,Q.scope.scopeId),G=()=>{let q=Q.ui?.size;return q==="sm"||q==="lg"?q:"md"},z=()=>{let q=I7.get($);if(q&&typeof q.isConnected==="boolean"&&!q.isConnected)I7.delete($),q=void 0;if(!q)q=document.createElement("pie-tool-tts-inline"),q[C5]=()=>{if(I7.get($)===q)I7.delete($)},I7.set($,q);return q.setAttribute("tool-id",$),q.setAttribute("catalog-id",Q.catalogId||Q.itemId),q.setAttribute("language",Q.language||"en-US"),q.setAttribute("size",G()),q.setAttribute("layout-mode",Z()),q.speedOptions=K(),q.showSingleSpeedOption=X().showSingleSpeedOption===!0,q},U=W();return{toolId:this.toolId,button:null,elements:[{element:z(),mount:U.mount,layoutHints:{controlsRow:{reserveSpace:U.controlsRow.reserveSpace,showWhenToolActive:U.controlsRow.expandWhenToolActive},headerOverlay:{showWhenToolActive:U.headerOverlay.expandWhenToolActive}}}],subscribeActive:(q)=>{let Y=z(),H=(B)=>{let V=B.detail;q(V?.active===!0)};return Y.addEventListener($6,H),()=>{Y.removeEventListener($6,H)}},sync:()=>{let q=z();q.setAttribute("tool-id",$),q.setAttribute("catalog-id",Q.catalogId||Q.itemId),q.setAttribute("language",Q.language||"en-US"),q.setAttribute("size",G()),q.setAttribute("layout-mode",Z()),q.speedOptions=K(),q.showSingleSpeedOption=X().showSingleSpeedOption===!0}}}};function x0(J,Q){let X=G7(J,Q.scope.level,Q.scope.scopeId);return{fullToolId:X,isActive:()=>Q.isToolVisible(X),subscribeActive:(K)=>{if(!Q.subscribeVisibility)return()=>{};return Q.subscribeVisibility(()=>{K(Q.isToolVisible(X))})}}}function k0(J){let Q=J.isActive();J.button.active=Q,J.overlay.visible=Q,J.onActiveChange?.(Q)}function T7(J,Q){J.setAttribute("data-pie-tool-surface",Q)}var z6={toolId:"ruler",name:"Ruler",description:"On-screen ruler for measurements",icon:"ruler",supportedLevels:["section","item","element"],pnpSupportIds:["ruler","measurement"],isVisibleInContext(J){return _J(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Open ruler tool",tooltip:"Ruler",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),T7(W,"frameless"),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons"}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive}),Q.toolkitCoordinator)W.toolkitCoordinator=Q.toolkitCoordinator},subscribeActive:X.subscribeActive}}},q6={toolId:"protractor",name:"Protractor",description:"On-screen protractor for angle measurements",icon:"protractor",supportedLevels:["section","item","element"],pnpSupportIds:["protractor","angleMeasurement"],isVisibleInContext(J){return _J(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Open protractor tool",tooltip:"Protractor",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),T7(W,"frameless"),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons"}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive}),Q.toolkitCoordinator)W.toolkitCoordinator=Q.toolkitCoordinator},subscribeActive:X.subscribeActive}}};var U6={toolId:"answerEliminator",name:"Answer Eliminator",description:"Strike through answer choices",icon:"strikethrough",supportedLevels:["item"],pnpSupportIds:["answerMasking","answerEliminator","strikethrough","choiceMasking"],isVisibleInContext(J){return gQ(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K=Q.componentOverrides??{},Z=L0(this.toolId,J,Q,K);Z.setAttribute("tool-id",X.fullToolId),Z.setAttribute("strategy","strikethrough"),Z.setAttribute("button-alignment","inline");let W={toolId:this.toolId,label:this.name,icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true"><path d="M19,3H16.3H7.7H5A2,2 0 0,0 3,5V7.7V16.4V19A2,2 0 0,0 5,21H7.7H16.4H19A2,2 0 0,0 21,19V16.3V7.7V5A2,2 0 0,0 19,3M15.6,17L12,13.4L8.4,17L7,15.6L10.6,12L7,8.4L8.4,7L12,10.6L15.6,7L17,8.4L13.4,12L17,15.6L15.6,17Z"/></svg>',disabled:!1,ariaLabel:"Answer eliminator - Strike through choices",tooltip:"Strike Through",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()};return{toolId:this.toolId,button:W,elements:[{element:Z,mount:"after-buttons"}],sync:()=>{if(k0({button:W,overlay:Z,isActive:X.isActive}),Q.toolCoordinator)Z.coordinator=Q.toolCoordinator;if(Z.scopeElement=Q.getScopeElement?.()||null,Q.elementToolStateStore)Z.elementToolStateStore=Q.elementToolStateStore;let $=Q.getGlobalElementId?.();if($)Z.globalElementId=$},subscribeActive:X.subscribeActive}}},H6={toolId:"highlighter",name:"Highlighter",description:"Highlight text",icon:"highlighter",activation:"toolbar-toggle",supportedLevels:["passage","rubric","item","element"],pnpSupportIds:["highlighter","textHighlight","annotation"],isVisibleInContext(J){return dJ(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Highlighter - Highlight text",tooltip:"Highlight",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons"}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive,onActiveChange:($)=>{W.enabled=$}}),Q.ttsService)W.ttsService=Q.ttsService},subscribeActive:X.subscribeActive}}};var Y6={toolId:"lineReader",name:"Line Reader",description:"Reading guide overlay",icon:"bars-3",supportedLevels:["section","passage","rubric","item"],pnpSupportIds:["readingMask","readingGuide","readingRuler","lineReader","trackingGuide"],isVisibleInContext(J){return dJ(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Line reader - Reading guide",tooltip:"Line Reader",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),T7(W,"frameless"),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons"}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive}),Q.toolkitCoordinator)W.toolkitCoordinator=Q.toolkitCoordinator},subscribeActive:X.subscribeActive}}},B6={toolId:"theme",name:"Theme",description:"Accessible themes and contrast",icon:"swatch",supportedLevels:["assessment","section"],pnpSupportIds:["highContrastDisplay","colorContrast","invertColors","theme","highContrast","customColors"],isVisibleInContext(J){return!0},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Theme - Change colors and contrast",tooltip:"Theme",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons",shell:{title:this.name,draggable:!0,resizable:!1,closeable:!0,initialWidth:520,initialHeight:380,minWidth:420,minHeight:300}}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive}),Q.toolkitCoordinator)W.toolkitCoordinator=Q.toolkitCoordinator},subscribeActive:X.subscribeActive}}},P6={toolId:"annotationToolbar",name:"Highlighter",description:"Highlight and annotate text",icon:"highlighter",activation:"selection-gateway",singletonScope:"section",supportedLevels:["passage","rubric","item","element"],pnpSupportIds:["highlighting","annotations","highlighter","textHighlight","annotation"],isVisibleInContext(J){return dJ(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Annotation toolbar - Highlight text",tooltip:"Highlight",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons"}],sync:()=>{if(k0({button:K,overlay:W,isActive:X.isActive}),Q.toolkitCoordinator)W.toolkitCoordinator=Q.toolkitCoordinator},subscribeActive:X.subscribeActive}}};var V6={toolId:"graph",name:"Graph",description:"Graphing calculator and coordinate plane",icon:"chart-bar",supportedLevels:["section"],pnpSupportIds:["graph","graphingCalculator","coordinatePlane","graphingTool"],isVisibleInContext(J){return _J(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Graph - Graphing calculator",tooltip:"Graph",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons",shell:{title:this.name,draggable:!0,resizable:!0,closeable:!0,initialWidth:920,initialHeight:680,minWidth:640,minHeight:500}}],sync:()=>{k0({button:K,overlay:W,isActive:X.isActive})},subscribeActive:X.subscribeActive}}},M6={toolId:"periodicTable",name:"Periodic Table",description:"Chemistry periodic table reference",icon:"beaker",supportedLevels:["section"],pnpSupportIds:["periodicTable","chemistryReference","elementReference"],isVisibleInContext(J){return mQ(J)},renderToolbar(J,Q){let X=x0(this.toolId,Q),K={toolId:this.toolId,label:this.name,icon:typeof this.icon==="function"?this.icon(J):this.icon,disabled:!1,ariaLabel:"Periodic table - Chemistry reference",tooltip:"Periodic Table",onClick:()=>Q.toggleTool(this.toolId),active:X.isActive()},Z=Q.componentOverrides??{},W=L0(this.toolId,J,Q,Z);return W.setAttribute("tool-id",X.fullToolId),{toolId:this.toolId,button:K,elements:[{element:W,mount:"after-buttons",shell:{title:this.name,draggable:!0,resizable:!0,closeable:!0,initialWidth:1160,initialHeight:760,minWidth:920,minHeight:620}}],sync:()=>{k0({button:K,overlay:W,isActive:X.isActive})},subscribeActive:X.subscribeActive}}};var I5=[lQ,G6,z6,q6,U6,H6,Y6,B6,P6,V6,M6];function T5(J={}){let Q=new A9,X={toolTagMap:{...j9,...J.toolTagMap||{}},toolComponentFactory:J.toolComponentFactory,toolComponentFactories:J.toolComponentFactories},K=(Z)=>J.overrides?.[Z.toolId]||Z;if(J.includePackagedTools)E5(Q,{toolIds:J.toolIds,applyOverrides:K});if(J.toolModuleLoaders&&Object.keys(J.toolModuleLoaders).length>0)Q.setToolModuleLoaders(J.toolModuleLoaders);return Q.setComponentOverrides(X),Q}function E5(J,Q={}){let X=Q.toolIds&&Q.toolIds.length>0?new Set(Q.toolIds):null,K=Q.applyOverrides||((Z)=>Z);for(let Z of I5){if(X&&!X.has(Z.toolId))continue;J.register(K(Z))}}function SM(J={}){return T5({...J,includePackagedTools:!0})}
|
|
51
|
+
export{KQ as b,T8 as c,E8 as d,j6 as e,Z7 as f,ZJ as g,U0 as h,HJ as i,g6 as j,m6 as k,v6 as l,n8 as m,e8 as n,I as o,h as p,WQ as q,$Q as r,_6 as s,d6 as t,G9 as u,o6 as v,n6 as w,e6 as x,Q1 as y,$1 as z,G1 as A,Y1 as B,B1 as C,wQ as D,OQ as E,NQ as F,C1 as G,x1 as H,k1 as I,p1 as J,TQ as K,EQ as L,tP as M,eP as N,JV as O,BJ as P,ZV as Q,WV as R,G7 as S,GV as T,vQ as U,uQ as V,D9 as W,V8 as X,EV as Y,H5 as Z,Y5 as _,P5 as $,oQ as aa,xV as ba,V5 as ca,kV as da,I9 as ea,hV as fa,M8 as ga,F8 as ha,Z6 as ia,SM as ja};
|