@pie-players/pie-assessment-toolkit 1.0.0-beta.3 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -7
- package/custom-elements.json +19 -0
- package/dist/components/ItemScope.custom-element.js +1 -1
- package/dist/components/ItemToolBar.custom-element.js +1 -1
- package/dist/components/PieAssessmentToolkit.custom-element.js +7 -7
- package/dist/components/SectionToolBar.custom-element.js +1 -1
- package/dist/components/chunks/ItemToolBar-4vq9nbxz.js +2 -0
- package/dist/components/chunks/{ItemToolBar-jpac75fa.js → ItemToolBar-f971t0cw.js} +1 -1
- package/dist/components/chunks/{ItemToolBar-341vf20n.js → ItemToolBar-n05xjkp8.js} +2 -2
- package/dist/components/chunks/{ItemToolBar-66hcwmfw.js → ItemToolBar-pxan157g.js} +2 -2
- package/dist/components/chunks/ItemToolBar-rgmvw9sm.js +40 -0
- package/dist/components/chunks/{ItemToolBar-kkj69ptr.js → ItemToolBar-xwjrpdmz.js} +1 -1
- package/dist/components/chunks/sre-engine-dq0w45fv.js +1 -0
- package/dist/policy/core/ToolPolicyEngine.d.ts +8 -0
- package/dist/policy/core/ToolPolicyEngine.js +4 -2
- package/dist/policy/core/compose-decision.d.ts +7 -1
- package/dist/policy/core/compose-decision.js +29 -0
- package/dist/policy/core/decision-types.d.ts +20 -0
- package/dist/policy/core/feature-decision.d.ts +8 -1
- package/dist/policy/core/feature-decision.js +9 -2
- package/dist/policy/core/provenance.d.ts +1 -1
- package/dist/policy/engine.d.ts +2 -1
- package/dist/policy/sources/PnpPolicySource.d.ts +44 -2
- package/dist/policy/sources/PnpPolicySource.js +80 -11
- package/dist/runtime/core/engine-resolver.d.ts +17 -0
- package/dist/runtime/item-feature-decisions.d.ts +44 -0
- package/dist/runtime/item-feature-decisions.js +115 -0
- package/dist/services/ToolkitCoordinator.d.ts +9 -0
- package/dist/services/ToolkitCoordinator.js +23 -0
- package/dist/services/interfaces.d.ts +10 -0
- package/dist/services/support-conflicts.d.ts +10 -0
- package/dist/services/support-conflicts.js +11 -0
- package/dist/services/tool-config-validation.js +8 -2
- package/dist/services/tool-icons.js +1 -0
- package/package.json +6 -6
- package/dist/components/chunks/ItemToolBar-qvtpthc9.js +0 -40
- package/dist/components/chunks/ItemToolBar-vdkyn9f3.js +0 -2
- package/dist/components/chunks/sre-engine-bj997w4b.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunks/ItemToolBar-
|
|
1
|
+
import"./chunks/ItemToolBar-rgmvw9sm.js";import"./chunks/ItemToolBar-n05xjkp8.js";import{A as F,J as E,O as W,Q as X,aa as w,ca as G,da as Y,x as U,y as V}from"./chunks/ItemToolBar-f971t0cw.js";import"./chunks/ItemToolBar-xwjrpdmz.js";var x=(H,A)=>{if(customElements.get(H))return;try{customElements.define(H,A)}catch(C){if(!(C instanceof DOMException&&C.name==="NotSupportedError"||C&&typeof C==="object"&&C.name==="NotSupportedError")||!customElements.get(H))throw C}},D=W("<pie-item-toolbar></pie-item-toolbar>",2);function Z(H,A){U(A,!0);let C=G(A,"enabledTools",7,""),J=G(A,"position",7,"bottom"),K=G(A,"sectionId",7,""),L=G(A,"size",7,"md"),M=G(A,"language",7,""),O=G(A,"toolRegistry",7,null),P=G(A,"item",7,null),Q=G(A,"hostButtons",23,()=>[]);var j={get enabledTools(){return C()},set enabledTools(k){C(k),F()},get position(){return J()},set position(k){J(k),F()},get sectionId(){return K()},set sectionId(k){K(k),F()},get size(){return L()},set size(k){L(k),F()},get language(){return M()},set language(k){M(k),F()},get toolRegistry(){return O()},set toolRegistry(k){O(k),F()},get item(){return P()},set item(k){P(k),F()},get hostButtons(){return Q()},set hostButtons(k){Q(k),F()}},q=D();return w(q,"level","section"),E(()=>w(q,"scope-id",K())),E(()=>w(q,"section-id",K())),E(()=>w(q,"tools",C())),w(q,"content-kind","section"),E(()=>w(q,"position",J())),E(()=>w(q,"size",L())),E(()=>w(q,"language",M())),E(()=>w(q,"toolRegistry",O())),E(()=>w(q,"item",P())),E(()=>w(q,"hostButtons",Q())),X(H,q),V(j)}x("pie-section-toolbar",Y(Z,{enabledTools:{attribute:"enabled-tools",type:"String"},position:{attribute:"position",type:"String"},sectionId:{attribute:"section-id",type:"String"},size:{attribute:"size",type:"String"},language:{attribute:"language",type:"String"},toolRegistry:{type:"Object"},item:{type:"Object"},hostButtons:{type:"Object"}},[],[],{mode:"open"}));export{Z as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ContextProvider as z,FEATURE_DECISION_APPLIED_EVENT as q,itemFeatureDecisionsContext as B}from"@pie-players/pie-context";var J=["autoplayAudio"],I=Object.freeze({features:Object.freeze({})});function K(E){let R=E.canonicalItemId||E.itemId;return{level:"item",scopeId:R,itemId:E.itemId,canonicalItemId:R}}function P(E,R){if(!R||typeof E?.decideFeaturePolicy!=="function")return I;let V={};for(let _ of J){let N=E.decideFeaturePolicy(_,R);if(N.rule==="none")continue;V[_]={granted:N.granted,rule:N.rule}}return{features:V}}function Y(E){let R=new z(E,{context:B,initialValue:I});R.connect();let V=JSON.stringify(I.features),_=null,N=null,A=null,G=()=>{let T=P(_,N),M=JSON.stringify(T.features);if(M===V)return;V=M,R.setValue(T)},L=()=>{let T=A;A=null;try{T?.()}catch{}},j=(T)=>{let M=T.detail;if(!M||!N)return;_?.reportFeatureDecisionApplied?.(M,N)};return E.addEventListener(q,j),{setCoordinator(T){if(T===_)return;if(L(),_=T,T&&typeof T.onPolicyChange==="function")A=T.onPolicyChange((M)=>{if(M.reason==="disposed")L(),_=null;G()});G()},setItem(T){let M=T?.itemId?K(T):null;if(M?.scopeId===N?.scopeId&&M?.itemId===N?.itemId)return;N=M,G()},disconnect(){E.removeEventListener(q,j),L(),_=null,N=null,R.disconnect()}}}var $="pie-register",b="pie-unregister",U="pie-item-session-changed",k="item-session-changed",O="pie-content-loaded",m="pie-item-player-error",S="pie-formative-action",D="pie-media-time-source";var H=(E)=>Array.isArray(E)&&E.length>0;function Q(E){if(E.kind==="passage")return{ownerKind:"passage",assessmentId:E.assessmentId,sectionId:E.sectionId,passageId:E.canonicalItemId||E.itemId};return{ownerKind:"itemModel",assessmentId:E.assessmentId,sectionId:E.sectionId,itemId:E.itemId,canonicalItemId:E.canonicalItemId||E.itemId}}function W(E,R){if(!E)return[];let V=Q(R),_=[];if(H(E.accessibilityCatalogs))_.push({context:V,catalogs:E.accessibilityCatalogs});if(H(E.config?.extractedCatalogs))_.push({context:V,catalogs:E.config.extractedCatalogs});if(R.kind==="passage")return _;if(V.ownerKind!=="itemModel")return _;for(let N of E.config?.models??[]){if(!H(N.accessibilityCatalogs))continue;_.push({context:{...V,modelId:N.id},catalogs:N.accessibilityCatalogs})}return _}function C(E,R){let V=W(E,{kind:R,itemId:""});try{return JSON.stringify(V.map((_)=>[_.context.modelId??null,_.catalogs]))}catch{return null}}
|
|
2
|
+
export{J as a,Y as b,$ as c,b as d,U as e,k as f,O as g,m as h,S as i,D as j,Q as k,W as l,C as m};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
var y9="5";if(typeof window<"u")((window.__svelte??={}).v??=new Set).add(y9);var r7=Array.isArray,g9=Array.prototype.indexOf,JQ=Array.prototype.includes,RQ=Array.from,uQ=Object.keys,U7=Object.defineProperty,P7=Object.getOwnPropertyDescriptor,X0=Object.getOwnPropertyDescriptors,g0=Object.prototype,h9=Array.prototype,UQ=Object.getPrototypeOf,h0=Object.isExtensible;var m7=()=>{};function Z0(Q){for(var J=0;J<Q.length;J++)Q[J]()}function z0(){var Q,J,W=new Promise((K,X)=>{Q=K,J=X});return{promise:W,resolve:Q,reject:J}}var y=2,u7=4,WQ=8,PQ=16777216,n=16,o=32,H7=64,jQ=128,G0=256,z7=512,x=1024,R=2048,m=4096,d=8192,E=16384,G7=32768,p7=33554432,B7=65536,HQ=131072,v0=262144,f7=524288,v9=1048576,E7=33554432,pQ=2097152,R7=4194304,j7=8388608,V7=Symbol("$state"),V0=Symbol("component"),fQ=Symbol("legacy props"),m9=Symbol(""),m0=Symbol("proxy path"),q0=Symbol("attributes"),dQ=Symbol("class"),u0=Symbol("style"),_Q=Symbol("text"),p0=Symbol("form reset"),u9=Symbol("hmr anchor"),a7=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},f0=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");var TQ=3,w7=8;var p9=1,f9=2,d0=4,d9=8,_9=16,l9=1,i9=2,c9=4,o9=8,s9=16;var r9=1,a9=2;var xQ="[",KQ="[!",_0="[?",BQ="]",Y7={};var k=Symbol("uninitialized"),k7=Symbol("filename"),n9=Symbol("hmr"),$0="http://www.w3.org/1999/xhtml",lQ="http://www.w3.org/2000/svg",l0="http://www.w3.org/1998/Math/MathML";function t9(){console.warn("https://svelte.dev/e/derived_inert")}function e9(Q,J,W){console.warn("https://svelte.dev/e/hydration_attribute_changed")}function XQ(Q){console.warn("https://svelte.dev/e/hydration_mismatch")}function QJ(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function JJ(Q){var J=L;if(J===null)return O.f|=j7,Q;if((J.f&G7)===0&&(J.f&u7)===0)throw Q;M7(Q,J)}function M7(Q,J){if(Q===Y7)throw Q;if(J!==null&&(J.f&E)!==0)return;while(J!==null){if((J.f&jQ)!==0&&(J.f&(E|p7))===0){if((J.f&G7)===0)throw Q;try{J.b.error(Q);return}catch(W){Q=W}}J=J.parent}throw Q}function KJ(){throw Error("https://svelte.dev/e/async_derived_orphan")}function XJ(Q,J,W){throw Error("https://svelte.dev/e/each_key_duplicate")}function ZJ(Q){throw Error("https://svelte.dev/e/effect_in_teardown")}function zJ(){throw Error("https://svelte.dev/e/effect_in_unowned_derived")}function GJ(Q){throw Error("https://svelte.dev/e/effect_orphan")}function VJ(){throw Error("https://svelte.dev/e/effect_update_depth_exceeded")}function qJ(){throw Error("https://svelte.dev/e/hydration_failed")}function $J(Q){throw Error("https://svelte.dev/e/props_invalid_value")}function UJ(){throw Error("https://svelte.dev/e/state_descriptors_fixed")}function PJ(){throw Error("https://svelte.dev/e/state_prototype_fixed")}function HJ(){throw Error("https://svelte.dev/e/state_unsafe_mutation")}function BJ(){throw Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var Q7=!1,ZQ=!1;var C=null;function n7(Q){C=Q}function i0(Q,J=!1,W){C={p:C,i:!1,c:null,e:null,s:Q,x:null,r:L,l:ZQ&&!J?{s:null,u:null,$:[]}:null}}function c0(Q){var J=C,W=J.e;if(W!==null){J.e=null;for(var K of W)o0(K)}if(Q!==void 0)J.x=Q;return J.i=!0,C=J.p,iQ(Q)}function iQ(Q={}){return U7(Q,V0,{value:!0}),Q}function b7(){return!ZQ||C!==null&&C.l===null}var YQ=[];function MJ(){var Q=YQ;YQ=[],Z0(Q)}function s(Q){if(YQ.length===0&&!MQ){var J=YQ;queueMicrotask(()=>{if(J===YQ)MJ()})}YQ.push(Q)}function LJ(){while(YQ.length>0)MJ()}function P0(Q){return Q===this.v}function H0(Q,J){return Q!=Q?J==J:Q!==J||Q!==null&&typeof Q==="object"||typeof Q==="function"}function B0(Q){return!H0(Q,this.v)}function LQ(Q,J){return Q.label=J,s0(Q.v,J),Q}function s0(Q,J){return Q?.[m0]?.(J),Q}function y7(Q){var J=O,W=L;u(null),_(null);try{return Q()}finally{u(J),_(W)}}function L0(Q,J,W,K){let X=b7()?GQ:FQ;var Z=Q.filter((q)=>!q.settled),z=J.map(X);if(W.length===0&&Z.length===0){K(z);return}var G=L,V=OJ(),H=Z.length===1?Z[0].promise:Z.length>1?Promise.all(Z.map((q)=>q.promise)):null;function U(q){if((G.f&E)!==0)return;V();try{K([...z,...q])}catch(Y){M7(Y,G)}EQ()}var $=r0();if(W.length===0){H.then(()=>U([])).finally($);return}function P(){Promise.all(W.map((q)=>a0(q))).then(U).catch((q)=>M7(q,G)).finally($)}if(H)H.then(()=>{if((G.f&E)!==0){$();return}V(),P(),EQ()});else P()}function OJ(){var Q=L,J=O,W=C,K=S;if(!1)var X;return function(z=!0){if(_(Q),u(J),n7(W),z&&(Q.f&E)===0)K?.activate(),K?.apply()}}var A4=!1;function EQ(Q=!0){if(A4=!1,_(null),u(null),n7(null),Q)S?.deactivate()}function r0(){var Q=L,J=Q.b,W=S,K=!!J?.is_rendered();return J?.update_pending_count(1,W),W.increment(K,Q),()=>{J?.update_pending_count(-1,W),W.decrement(K,Q)}}var j4=~(R|m|x);function T(Q,J){Q.f=Q.f&j4|J}function kQ(Q){if((Q.f&z7)!==0||Q.deps===null)T(Q,x);else T(Q,m)}function GQ(Q){var J=y|R;if(L!==null)L.f|=f7;return{ctx:C,deps:null,effects:null,equals:P0,f:J,fn:Q,reactions:null,rv:0,v:k,wv:0,parent:L,ac:null}}var bQ=Symbol("obsolete");function a0(Q,J,W){let K=L;if(K===null)KJ();var X=void 0,Z=K7(k),z=!O,G=new Set;return wJ(()=>{var V=L,H=z0();X=H.promise;try{Promise.resolve(Q()).then(H.resolve,(q)=>{if(q!==a7)H.reject(q)}).finally(EQ)}catch(q){H.reject(q),EQ()}var U=S;if(z){if((V.f&G7)!==0)var $=r0();if(K.b?.is_rendered())U.async_deriveds.get(V)?.reject(bQ);else for(let q of G.values())q.reject(bQ);G.add(H),U.async_deriveds.set(V,H)}let P=(q,Y=void 0)=>{if($?.(),G.delete(H),Y===bQ)return;if(U.activate(),Y)Z.f|=j7,g7(Z,Y);else{if((Z.f&j7)!==0)Z.f^=j7;g7(Z,q)}U.deactivate()};H.promise.then(P,(q)=>P(null,q||"unknown"))}),W7(()=>{for(let V of G)V.reject(bQ)}),new Promise((V)=>{function H(U){function $(){if(U===X)V(Z);else H(X)}U.then($,$)}H(X)})}function T4(Q){let J=GQ(Q);if(!Q7)O0(J);return J}function FQ(Q){let J=GQ(Q);return J.equals=B0,J}function x4(Q){var J=Q.effects;if(J!==null){Q.effects=null;for(var W=0;W<J.length;W+=1)h(J[W])}}function oQ(Q){var J,W=L,K=Q.parent;if(!S7&&K!==null&&Q.v!==k&&(K.f&(E|d))!==0)return t9(),Q.v;_(K);try{x4(Q),J=Q9(Q)}finally{_(W)}return J}function t0(Q){var J=oQ(Q);if(!Q.equals(J)){if(Q.wv=aQ(),!S?.is_fork||Q.deps===null){if(S!==null)S.capture(Q,J,!0),d7?.capture(Q,J,!0);else Q.v=J;if(Q.deps===null){T(Q,x);return}}}if(S7)return;if(r!==null){if(zQ()||S?.is_fork)r.set(Q,J)}else kQ(Q)}function DJ(Q){if(Q.effects===null)return;for(let J of Q.effects)if(J.teardown||J.ac){if(J.teardown?.(),J.ac!==null)y7(()=>{J.ac.abort(a7),J.ac=null});if(J.fn!==null)J.teardown=m7;OQ(J,0),rQ(J)}}function e0(Q){if(Q.effects===null)return;for(let J of Q.effects)if(J.teardown&&J.fn!==null)_7(J)}var sQ=new Set,T7=new Map;var SJ=!1;function K7(Q,J){var W={f:0,v:Q,reactions:null,equals:P0,rv:0,wv:0};return W}function l7(Q,J){let W=K7(Q,J);return O0(W),W}function wQ(Q,J=!1,W=!0){let K=K7(Q);if(!J)K.equals=B0;if(ZQ&&W&&C!==null&&C.l!==null)(C.l.s??=[]).push(K);return K}function X7(Q,J,W=!1){if(O!==null&&(!I7||(O.f&HQ)!==0)&&b7()&&(O.f&(y|n|R7|HQ))!==0&&(h7===null||!h7.has(Q)))HJ();let K=W?t7(J):J;return g7(Q,K,nQ)}var DQ=null,J9=0;function g7(Q,J,W=null){if(!Q.equals(J)){if(S7)T7.set(Q,J);else if(!T7.has(Q))T7.set(Q,Q.v);var K=J7.ensure();if(K.capture(Q,J),(Q.f&y)!==0){let X=Q;if((Q.f&R)!==0)oQ(X);if(r===null)kQ(X)}if(Q.wv=aQ(),DQ=null,J9=0,CJ(Q,R,W),DQ=null,b7()&&L!==null&&(L.f&x)!==0&&(L.f&(o|H7))===0)if(C7===null)IJ([Q]);else C7.push(Q);if(!K.is_fork&&sQ.size>0&&!SJ)W9()}return J}function W9(){SJ=!1;for(let Q of sQ){if((Q.f&x)!==0)T(Q,m);let J;try{J=VQ(Q)}catch{J=!0}if(J)_7(Q)}sQ.clear()}function SQ(Q){X7(Q,Q.v+1)}function CJ(Q,J,W){var K=Q.reactions;if(K===null)return;var X=b7(),Z=K.length;if(J9+=Z,J9>1e5&&DQ===null)DQ=new Set;if(DQ!==null){if(DQ.has(Q))return;DQ.add(Q)}for(var z=0;z<Z;z++){var G=K[z],V=G.f;if(!X&&G===L)continue;var H=(V&R)===0;if(H)T(G,J);if((V&HQ)!==0)sQ.add(G);else if((V&y)!==0){var U=G;r?.delete(U),CJ(U,m,W)}else if(H){var $=G;if((V&n)!==0&&x7!==null)x7.add($);if(W!==null)W.push($);else tQ($)}}}function D0(Q,J,W){if((Q.f&R)!==0)J.add(Q);else if((Q.f&m)!==0)W.add(Q);T(Q,x)}var w0=null,yQ=null,S=null,d7=null,r=null,X9=null,MQ=!1,K9=!1,gQ=null,nQ=null,AJ=0;var b4=1;class J7{id=b4++;#Q=!1;linked=!0;#J=null;#W=null;async_deriveds=new Map;current=new Map;previous=new Map;#G=new Set;#X=new Set;#z=0;#K=new Map;#V=null;#Z=[];#M=[];#q=new Set;#$=new Set;#P=new Map;#L=new Set;is_fork=!1;#U=!1;constructor(){if(yQ===null)w0=yQ=this;else yQ.#W=this,this.#J=yQ;yQ=this}#w(){if(this.is_fork)return!0;for(let W of this.#K.keys()){var Q=W,J=!1;while(Q.parent!==null){if(this.#P.has(Q)){J=!0;break}Q=Q.parent}if(!J)return!0}return!1}skip_effect(Q){if(!this.#P.has(Q))this.#P.set(Q,{d:[],m:[]});this.#L.delete(Q)}unskip_effect(Q,J=(W)=>this.schedule(W)){var W=this.#P.get(Q);if(W){this.#P.delete(Q);for(var K of W.d)T(K,R),J(K);for(K of W.m)T(K,m),J(K)}this.#L.add(Q)}#S(){var Q=[];for(let X of this.#Z){if((X.f&E)!==0||(X.f&(R|m))===0)continue;var J=X,W=!1;while(J.parent!==null){J=J.parent;var K=J.f;if((K&(H7|o))!==0){if((K&x)===0){W=!0;break}J.f^=x}}if(!W)Q.push(J)}return this.#Z=[],Q}#F(){this.#Q=!0;for(let z of this.#q)this.#$.delete(z),T(z,R),this.schedule(z);for(let z of this.#$)T(z,m),this.schedule(z);this.apply();var Q=gQ=[],J=[],W=nQ=[];while(this.#Z.length>0){if(AJ++>1000)this.#Y(),y4();for(let z of this.#S())try{this.#D(z,Q,J)}catch(G){if(TJ(z),!this.#w())this.discard();throw G}}if(S=null,W.length>0){var K=J7.ensure();for(let z of W)K.schedule(z)}if(gQ=null,nQ=null,this.#w()){this.#B(J),this.#B(Q);for(let[z,G]of this.#P)jJ(z,G);if(W.length>0)S.#F();return}let X=this.#H();if(X){this.#B(J),this.#B(Q),X.#C(this);return}this.#q.clear(),this.#$.clear();for(let z of this.#G)z(this);this.#G.clear(),d7=this,NJ(J),NJ(Q),d7=null,this.#V?.resolve();var Z=S;if(this.#z===0&&(this.#Z.length===0||Z!==null)){if(this.#Y(),Q7)this.#O(),S=Z}if(this.#Z.length>0)if(Z!==null){for(let z of this.#Z)Z.#Z.push(z);this.#Z=[]}else Z=this;if(Z!==null)T7.clear(),Z.#F()}#D(Q,J,W){Q.f^=x;var K=Q.first;while(K!==null){var X=K.f,Z=(X&(o|H7))!==0,z=Z&&(X&x)!==0,G=z||(X&d)!==0||this.#P.has(K);if(!G&&K.fn!==null){if(Z)K.f^=x;else if((X&u7)!==0)J.push(K);else if(Q7&&(X&(WQ|PQ))!==0)W.push(K);else if(VQ(K)){if((X&n)!==0)this.#$.add(K);_7(K)}var V=K.first;if(V!==null){K=V;continue}}while(K!==null){var H=K.next;if(H!==null){K=H;break}K=K.parent}}}#H(){var Q=this.#J;while(Q!==null){if(!Q.is_fork){for(let[J,[,W]]of this.current)if(Q.current.has(J)&&!W)return Q}Q=Q.#J}return null}#C(Q){for(let[W,K]of Q.current){if(!this.previous.has(W)&&Q.previous.has(W))this.previous.set(W,Q.previous.get(W));this.current.set(W,K)}for(let[W,K]of Q.async_deriveds){let X=this.async_deriveds.get(W);if(X)K.promise.then(X.resolve).catch(X.reject)}Q.async_deriveds.clear(),this.transfer_effects(Q.#q,Q.#$);let J=(W)=>{var K=W.reactions;if(K===null)return;if((W.f&y)!==0&&(W.f&(R|m))===0)return;for(let z of K){var X=z.f;if((X&y)!==0)J(z);else{var Z=z;if(X&(R7|n)&&!this.async_deriveds.has(Z))this.#$.delete(Z),T(Z,R),this.schedule(Z)}}};for(let W of this.current.keys())J(W);this.oncommit(()=>Q.discard()),Q.#Y(),S=this,this.#F()}#B(Q){for(var J=0;J<Q.length;J+=1)D0(Q[J],this.#q,this.#$)}capture(Q,J,W=!1){if(Q.v!==k&&!this.previous.has(Q))this.previous.set(Q,Q.v);if((Q.f&j7)===0)this.current.set(Q,[J,W]),r?.set(Q,J);if(!this.is_fork)Q.v=J}activate(){S=this}deactivate(){S=null,r=null}flush(){try{K9=!0,S=this,this.#F()}finally{AJ=0,X9=null,gQ=null,nQ=null,K9=!1,S=null,r=null,T7.clear()}}discard(){for(let Q of this.#X)Q(this);this.#X.clear();for(let Q of this.async_deriveds.values())Q.reject(bQ);this.#Y(),this.#V?.resolve()}register_created_effect(Q){this.#M.push(Q)}#O(){for(let U=w0;U!==null;U=U.#W){var Q=U.id<this.id,J=[];for(let[$,[P,q]]of this.current){if(U.current.has($)){var W=U.current.get($)[0];if(Q&&P!==W)U.current.set($,[P,q]);else continue}J.push($)}if(Q)for(let[$,P]of this.async_deriveds){let q=U.async_deriveds.get($);if(q)P.promise.then(q.resolve).catch(q.reject)}var K=[...U.current.keys()].filter(($)=>!U.current.get($)[1]);if(!U.#Q||K.length===0)continue;var X=K.filter(($)=>!this.current.has($));if(X.length===0){if(Q)U.discard()}else if(J.length>0){if(Q)for(let $ of this.#L)U.unskip_effect($,(P)=>{if((P.f&(n|R7))!==0)U.schedule(P);else U.#B([P])});U.activate();var Z=new Set,z=new Map;for(var G of J)RJ(G,X,Z,z);z=new Map;var V=[...U.current].filter(([$,P])=>{let q=this.current.get($);if(!q)return!0;return q[0]!==P[0]||q[1]!==P[1]}).map(([$])=>$);if(V.length>0){for(let $ of this.#M)if(($.f&(E|d|HQ))===0&&Z9($,V,z))if(($.f&(R7|n))!==0)T($,R),U.schedule($);else U.#q.add($)}if(U.#Z.length>0&&!U.#U){U.apply();for(var H of U.#S())U.#D(H,[],[])}U.deactivate()}}}increment(Q,J){if(this.#z+=1,Q){let W=this.#K.get(J)??0;this.#K.set(J,W+1)}}decrement(Q,J){if(this.#z-=1,Q){let W=this.#K.get(J)??0;if(W===1)this.#K.delete(J);else this.#K.set(J,W-1)}if(this.#U)return;this.#U=!0,s(()=>{if(this.#U=!1,this.linked)this.flush()})}transfer_effects(Q,J){for(let W of Q)this.#q.add(W);for(let W of J)this.#$.add(W);Q.clear(),J.clear()}oncommit(Q){this.#G.add(Q)}ondiscard(Q){this.#X.add(Q)}settled(){return(this.#V??=z0()).promise}static ensure(){if(S===null){let Q=S=new J7;if(!K9&&!MQ)s(()=>{if(!Q.#Q)Q.flush()})}return S}apply(){if(!Q7||!this.is_fork&&this.#J===null&&this.#W===null){r=null;return}r=new Map;for(let[J,[W]]of this.current)r.set(J,W);for(let J=w0;J!==null;J=J.#W){if(J===this||J.is_fork)continue;var Q=!1;if(J.id<this.id)for(let[W,[,K]]of J.current){if(K)continue;if(this.current.has(W)){Q=!0;break}}if(!Q){for(let[W,K]of J.previous)if(!r.has(W))r.set(W,K)}}}schedule(Q){if(X9=Q,Q.b?.is_pending&&(Q.f&(u7|WQ|PQ))!==0&&(Q.f&G7)===0){Q.b.defer_effect(Q);return}this.#Z.push(Q)}#Y(){if(!this.linked)return;var Q=this.#J,J=this.#W;if(Q===null)w0=J;else Q.#W=J;if(J===null)yQ=Q;else J.#J=Q;this.linked=!1}}function CQ(Q){var J=MQ,W=d7;d7=null,MQ=!0;try{var K;if(Q)CQ(),K=Q();while(!0){if(LJ(),S===null)return K;S.flush()}}finally{MQ=J,d7=W}}function y4(){if(!1){var Q;for(let W of S.current.keys())for(let[K,X]of W.updated??[])var J}try{VJ()}catch(W){M7(W,X9)}}var x7=null;function NJ(Q){var J=Q.length;if(J===0)return;var W=0;while(W<J){var K=Q[W++];if((K.f&(E|d))===0&&VQ(K)){if(x7=new Set,_7(K),K.deps===null&&K.first===null&&K.nodes===null&&K.teardown===null&&K.ac===null)z9(K);if(x7?.size>0){T7.clear();for(let X of x7){if((X.f&(E|d))!==0)continue;let Z=[X],z=X.parent;while(z!==null){if(x7.has(z))x7.delete(z),Z.push(z);z=z.parent}for(let G=Z.length-1;G>=0;G--){let V=Z[G];if((V.f&(E|d))!==0)continue;_7(V)}}x7.clear()}}}x7=null}function RJ(Q,J,W,K){if(W.has(Q))return;if(W.add(Q),Q.reactions!==null)for(let X of Q.reactions){let Z=X.f;if((Z&y)!==0)RJ(X,J,W,K);else if((Z&(R7|n))!==0&&(Z&R)===0&&Z9(X,J,K))T(X,R),tQ(X)}}function Z9(Q,J,W){let K=W.get(Q);if(K!==void 0)return K;if(Q.deps!==null)for(let X of Q.deps){if(JQ.call(J,X))return!0;if((X.f&y)!==0&&Z9(X,J,W))return W.set(X,!0),!0}return W.set(Q,!1),!1}function tQ(Q){S.schedule(Q)}function jJ(Q,J){if((Q.f&o)!==0&&(Q.f&x)!==0)return;if((Q.f&R)!==0)J.d.push(Q);else if((Q.f&m)!==0)J.m.push(Q);T(Q,x);var W=Q.first;while(W!==null)jJ(W,J),W=W.next}function TJ(Q){T(Q,x);var J=Q.first;while(J!==null)TJ(J),J=J.next}function EJ(Q){if(L===null){if(O===null)GJ(Q);zJ()}if(S7)ZJ(Q)}function h4(Q,J){var W=J.last;if(W===null)J.last=J.first=Q;else W.next=Q,Q.prev=W,J.last=Q}function i7(Q,J){var W=L;if(W!==null&&(W.f&d)!==0)Q|=d;var K={ctx:C,deps:null,nodes:null,f:Q|R|z7,first:null,fn:J,last:null,next:null,parent:W,b:W&&W.b,prev:null,teardown:null,wv:0,ac:null};S?.register_created_effect(K);var X=K;if((Q&u7)!==0)if(gQ!==null)gQ.push(K);else J7.ensure().schedule(K);else if(J!==null){try{_7(K)}catch(z){throw h(K),z}if(X.deps===null&&X.teardown===null&&X.nodes===null&&X.first===X.last&&(X.f&f7)===0){if(X=X.first,(Q&n)!==0&&(Q&B7)!==0&&X!==null)X.f|=B7}}if(X!==null){if(X.parent=W,W!==null)h4(X,W);if(O!==null&&(O.f&y)!==0&&(Q&H7)===0){var Z=O;(Z.effects??=[]).push(X)}}return K}function zQ(){return O!==null&&!I7}function W7(Q){let J=i7(WQ,null);return T(J,x),J.teardown=Q,J}function V9(Q){EJ("$effect");var J=L.f,W=!O&&(J&o)!==0&&C!==null&&!C.i;if(W){var K=C;(K.e??=[]).push(Q)}else return o0(Q)}function o0(Q){return i7(u7|v9,Q)}function q9(Q){J7.ensure();let J=i7(H7|f7,Q);return()=>{h(J)}}function kJ(Q){J7.ensure();let J=i7(H7|f7,Q);return(W={})=>{return new Promise((K)=>{if(W.outro)c7(J,()=>{h(J),K(void 0)});else h(J),K(void 0)})}}function $7(Q){return i7(u7,Q)}function wJ(Q){return i7(R7|f7,Q)}function a(Q,J=0){return i7(WQ|J,Q)}function $9(Q,J=[],W=[],K=[]){L0(K,J,W,(X)=>{i7(WQ,()=>{Q(...X.map(I))})})}function F7(Q,J=0){var W=i7(n|J,Q);return W}function c(Q){return i7(o|f7,Q)}function U9(Q){var J=Q.teardown;if(J!==null){let W=S7,K=O;G9(!0),u(null);try{J.call(null)}catch(X){M7(X,Q.parent)}finally{G9(W),u(K)}}}function rQ(Q,J=!1){var W=Q.first;Q.first=Q.last=null;while(W!==null){let X=W.ac;if(X!==null)y7(()=>{X.abort(a7)});var K=W.next;if((W.f&H7)!==0)W.parent=null;else h(W,J);W=K}}function bJ(Q){var J=Q.first;while(J!==null){var W=J.next;if((J.f&o)===0)h(J);J=W}}function h(Q,J=!0){var W=!1;if((J||(Q.f&v0)!==0)&&Q.nodes!==null&&Q.nodes.end!==null)P9(Q.nodes.start,Q.nodes.end),W=!0;Q.f|=p7,rQ(Q,J&&!W),OQ(Q,0);var K=Q.nodes&&Q.nodes.t;if(K!==null)for(let Z of K)Z.stop();U9(Q),Q.f^=p7,Q.f|=E;var X=Q.parent;if(X!==null&&X.first!==null)z9(Q);Q.next=Q.prev=Q.teardown=Q.ctx=Q.deps=Q.fn=Q.nodes=Q.ac=Q.b=null}function P9(Q,J){while(Q!==null){var W=Q===J?null:i(Q);Q.remove(),Q=W}}function z9(Q){var{parent:J,prev:W,next:K}=Q;if(W!==null)W.next=K;if(K!==null)K.prev=W;if(J!==null){if(J.first===Q)J.first=K;if(J.last===Q)J.last=W}}function c7(Q,J,W=!0){var K=[];Q.f|=G0,yJ(Q,K,!0);var X=()=>{if(W)h(Q);if(J)J()},Z=K.length;if(Z>0){var z=()=>--Z||X();for(var G of K)G.out(z)}else X()}function yJ(Q,J,W){if((Q.f&d)!==0)return;Q.f^=d;var K=Q.nodes&&Q.nodes.t;if(K!==null){for(let G of K)if(G.is_global||W)J.push(G)}var X=Q.first;while(X!==null){var Z=X.next;if((X.f&H7)===0){var z=(X.f&B7)!==0||(X.f&o)!==0&&(Q.f&n)!==0;yJ(X,J,z?W:!1)}X=Z}}function hQ(Q){Q.f&=~G0,gJ(Q,!0)}function gJ(Q,J){if((Q.f&G0)!==0)return;if((Q.f&d)===0)return;if(Q.f^=d,(Q.f&x)===0)T(Q,R),J7.ensure().schedule(Q);var W=Q.first;while(W!==null){var K=W.next,X=(W.f&B7)!==0||(W.f&o)!==0;gJ(W,X?J:!1),W=K}var Z=Q.nodes&&Q.nodes.t;if(Z!==null){for(let z of Z)if(z.is_global||J)z.in()}}function vQ(Q,J){if(!Q.nodes)return;var W=Q.nodes.start,K=Q.nodes.end;while(W!==null){var X=W===K?null:i(W);J.append(W),W=X}}var hJ=null;var S7=!1;function G9(Q){S7=Q}var O=null,I7=!1;function u(Q){O=Q}var L=null;function _(Q){L=Q}var h7=null;function O0(Q){if(O!==null&&(!Q7&&(O.f&pQ)!==0||(O.f&y)!==0))(h7??=new Set).add(Q)}var q7=null,L7=0,C7=null;function IJ(Q){C7=Q}var mJ=1,IQ=0,qQ=IQ;function H9(Q){qQ=Q}function aQ(){return++mJ}function VQ(Q){var J=Q.f;if((J&R)!==0)return!0;if((J&m)!==0){var W=Q.deps,K=W.length;for(var X=0;X<K;X++){var Z=W[X];if(VQ(Z))t0(Z);if(Z.wv>Q.wv)return!0}if((J&z7)!==0&&r===null)T(Q,x)}return!1}function uJ(Q,J,W=!0){var K=Q.reactions;if(K===null)return;if(!Q7&&h7!==null&&h7.has(Q))return;for(var X=0;X<K.length;X++){var Z=K[X];if((Z.f&y)!==0)uJ(Z,J,!1);else if(J===Z){if(W)T(Z,R);else if((Z.f&x)!==0)T(Z,m);tQ(Z)}}}function Q9(Q){var J=q7,W=L7,K=C7,X=O,Z=h7,z=C,G=I7,V=qQ,H=Q.f;if(q7=null,L7=0,C7=null,O=(H&(o|H7))===0?Q:null,h7=null,n7(Q.ctx),I7=!1,qQ=++IQ,Q.ac!==null)y7(()=>{Q.ac.abort(a7)}),Q.ac=null;try{Q.f|=pQ;var U=Q.fn,$=U();Q.f|=G7;var P=vJ(Q);if(b7()&&C7!==null&&!I7&&P!==null&&(Q.f&(y|m|R))===0)for(var q=0;q<C7.length;q++)uJ(C7[q],Q);if(X!==null&&X!==Q){if(IQ++,X.deps!==null)for(let Y=0;Y<W;Y+=1)X.deps[Y].rv=IQ;if(J!==null)for(let Y of J)Y.rv=IQ;if(C7!==null)if(K===null)K=C7;else K.push(...C7)}if((Q.f&j7)!==0)Q.f^=j7;return $}catch(Y){return vJ(Q),JJ(Y)}finally{Q.f^=pQ,q7=J,L7=W,C7=K,O=X,h7=Z,n7(z),I7=G,qQ=V}}function vJ(Q){var J=Q.deps,W=S?.is_fork;if(q7!==null){var K;if(!W)OQ(Q,L7);if(J!==null&&L7>0){J.length=L7+q7.length;for(K=0;K<q7.length;K++)J[L7+K]=q7[K]}else Q.deps=J=q7;if(zQ()&&(Q.f&z7)!==0)for(K=L7;K<J.length;K++)(J[K].reactions??=[]).push(Q)}else if(!W&&J!==null&&L7<J.length)OQ(Q,L7),J.length=L7;return J}function m4(Q,J){let W=J.reactions;if(W!==null){var K=g9.call(W,Q);if(K!==-1){var X=W.length-1;if(X===0)W=J.reactions=null;else W[K]=W[X],W.pop()}}if(W===null&&(J.f&y)!==0&&(q7===null||!JQ.call(q7,J))){var Z=J;if((Z.f&z7)!==0)Z.f^=z7;if(Z.v!==k)kQ(Z);if(Z.ac!==null)y7(()=>{Z.ac.abort(a7),Z.ac=null,T(Z,R)});DJ(Z),OQ(Z,0)}}function OQ(Q,J){var W=Q.deps;if(W===null)return;for(var K=J;K<W.length;K++)m4(Q,W[K])}function _7(Q){var J=Q.f;if((J&E)!==0)return;T(Q,x);var W=L;if(L=Q,!1)var K,X;try{if((J&(n|PQ))!==0)bJ(Q);else rQ(Q);U9(Q);var Z=Q9(Q);if(Q.teardown=typeof Z==="function"?Z:null,Q.wv=mJ,!1)for(var z of Q.deps);}finally{L=W}}function I(Q){var J=Q.f,W=(J&y)!==0;if(hJ?.add(Q),O!==null&&!I7){var K=L!==null&&(L.f&E)!==0;if(!K&&(h7===null||!h7.has(Q))){var X=O.deps;if((O.f&pQ)!==0){if(Q.rv<IQ)if(Q.rv=IQ,q7===null&&X!==null&&X[L7]===Q)L7++;else if(q7===null)q7=[Q];else q7.push(Q)}else{if(O.deps??=[],!JQ.call(O.deps,Q))O.deps.push(Q);var Z=Q.reactions;if(Z===null)Q.reactions=[O];else if(!JQ.call(Z,O))Z.push(O)}}}if(!1){if(!I7&&N4&&S===null&&d7===null&&!N4.warned&&(N4.effect.f&pQ)===0&&!N4.effect_deps.has(Q))var z;if(n0&&!I7&&N5!==null&&O!==null&&N5.reaction===O){if(Q.trace);else if(z)var G,V}}if(S7&&T7.has(Q))return T7.get(Q);if(W){var H=Q;if(S7){var U=H.v;if((H.f&x)===0&&H.reactions!==null||fJ(H))U=oQ(H);return T7.set(H,U),U}var $=(H.f&z7)===0&&!I7&&O!==null&&(O.f&z7)!==0,P=(H.f&G7)===0;if(VQ(H)){if($)H.f|=z7;t0(H)}if($&&!P)e0(H),pJ(H)}if(r?.has(Q))return r.get(Q);if((Q.f&j7)!==0)throw Q.v;return Q.v}function pJ(Q){if(Q.f|=z7,Q.deps===null)return;for(let W of Q.deps){var J=W.reactions;if(J===null)W.reactions=[Q];else if(!JQ.call(J,Q))J.push(Q);if((W.f&y)!==0&&(W.f&z7)===0)e0(W),pJ(W)}}function fJ(Q){if(Q.v===k)return!0;if(Q.deps===null)return!1;for(let J of Q.deps){if(T7.has(J))return!0;if((J.f&y)!==0&&fJ(J))return!0}return!1}function b(Q){var J=I7;try{return I7=!0,Q()}finally{I7=J}}function C0(Q){if(typeof Q!=="object"||!Q||Q instanceof EventTarget)return;if(V7 in Q)S0(Q);else if(!Array.isArray(Q))for(let J in Q){let W=Q[J];if(typeof W==="object"&&W&&V7 in W)S0(W)}}function S0(Q,J=new Set){if(typeof Q==="object"&&Q!==null&&!(Q instanceof EventTarget)&&!J.has(Q)){if(J.add(Q),Q instanceof Date)Q.getTime();for(let K in Q)try{S0(Q[K],J)}catch(X){}let W=UQ(Q);if(W!==Object.prototype&&W!==Array.prototype&&W!==Map.prototype&&W!==Set.prototype&&W!==Date.prototype){let K=X0(W);for(let X in K){let Z=K[X].get;if(Z)try{Z.call(Q)}catch(z){}}}}}var u4=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function t7(Q){if(typeof Q!=="object"||Q===null||V7 in Q||V0 in Q)return Q;let J=UQ(Q);if(J!==g0&&J!==h9)return Q;var W=new Map,K=r7(Q),X=l7(0),Z=null,z=qQ,G=($)=>{if(qQ===z)return $();var P=O,q=qQ;u(null),H9(z);var Y=$();return u(P),H9(q),Y};if(K)W.set("length",l7(Q.length,Z));var V="";let H=!1;function U($){if(H)return;H=!0,V=$,LQ(X,`${V} version`);for(let[P,q]of W)LQ(q,p4(V,P));H=!1}return new Proxy(Q,{defineProperty($,P,q){if(!("value"in q)||q.configurable===!1||q.enumerable===!1||q.writable===!1)UJ();var Y=W.get(P);if(Y===void 0)G(()=>{var F=l7(q.value,Z);return W.set(P,F),F});else X7(Y,q.value,!0);return!0},deleteProperty($,P){var q=W.get(P);if(q===void 0){if(P in $){let Y=G(()=>l7(k,Z));W.set(P,Y),SQ(X)}}else X7(q,k),SQ(X);return!0},get($,P,q){if(P===V7)return Q;var Y=W.get(P),F=P in $;if(Y===void 0&&(!F||P7($,P)?.writable))Y=G(()=>{var w=t7(F?$[P]:k),N=l7(w,Z);return N}),W.set(P,Y);if(Y!==void 0){var B=I(Y);return B===k?void 0:B}return Reflect.get($,P,q)},getOwnPropertyDescriptor($,P){this.has?.($,P);var q=Reflect.getOwnPropertyDescriptor($,P),Y=W.get(P);if(Y!==void 0){var F=I(Y);if(F===k)return;if(q&&"value"in q)q.value=F;else return{enumerable:!0,configurable:!0,value:F,writable:!0}}return q},has($,P){if(P===V7)return!0;var q=W.get(P),Y=q!==void 0&&q.v!==k||Reflect.has($,P);if(q!==void 0||L!==null&&(!Y||P7($,P)?.writable)){if(q===void 0)q=G(()=>{var B=Y?t7($[P]):k,w=l7(B,Z);return w}),W.set(P,q);var F=I(q);if(F===k)return!1}return Y},set($,P,q,Y){var F=W.get(P),B=P in $;if(K&&P==="length")for(var w=q;w<F.v;w+=1){var N=W.get(w+"");if(N!==void 0)X7(N,k);else if(w in $)N=G(()=>l7(k,Z)),W.set(w+"",N)}if(F===void 0){if(!B||P7($,P)?.writable)F=G(()=>l7(void 0,Z)),X7(F,t7(q)),W.set(P,F)}else{B=F.v!==k;var v=G(()=>t7(q));X7(F,v)}var A=Reflect.getOwnPropertyDescriptor($,P);if(A?.set)A.set.call(Y,q);if(!B){if(K&&typeof P==="string"){var N7=W.get("length"),Z7=Number(P);if(Number.isInteger(Z7)&&Z7>=N7.v)X7(N7,Z7+1)}SQ(X)}return!0},ownKeys($){I(X);var P=Reflect.ownKeys($).filter((F)=>{var B=W.get(F);return B===void 0||B.v!==k});for(var[q,Y]of W)if(Y.v!==k&&!(q in $))P.push(q);return P},setPrototypeOf(){PJ()}})}function p4(Q,J){if(typeof J==="symbol")return`${Q}[Symbol(${J.description??""})]`;if(u4.test(J))return`${Q}.${J}`;return/^\d+$/.test(J)?`${Q}[${J}]`:`${Q}['${J}']`}var B9,dJ,U0,_J,lJ;function A0(){if(B9!==void 0)return;B9=window,dJ=document,U0=/Firefox/.test(navigator.userAgent);var Q=Element.prototype,J=Node.prototype,W=Text.prototype;if(_J=P7(J,"firstChild").get,lJ=P7(J,"nextSibling").get,h0(Q))Q[dQ]=void 0,Q[q0]=null,Q[u0]=void 0,Q.__e=void 0;if(h0(W))W[_Q]=void 0}function p(Q=""){return document.createTextNode(Q)}function g(Q){return _J.call(Q)}function i(Q){return lJ.call(Q)}function iJ(Q,J){if(!M)return g(Q);var W=g(D);if(W===null)W=D.appendChild(p());else if(J&&W.nodeType!==TQ){var K=p();return W?.before(K),j(K),K}if(J)R0(W);return j(W),W}function f4(Q,J=!1){if(!M){var W=g(Q);if(W instanceof Comment&&W.data==="")return i(W);return W}if(J){if(D?.nodeType!==TQ){var K=p();return D?.before(K),j(K),K}R0(D)}return D}function d4(Q,J=!1){if(!M)return g(Q);var W=iJ(Q,J);return I0(Q),W}function _4(Q,J=1,W=!1){let K=M?D:Q;var X;while(J--)X=K,K=i(K);if(!M)return K;if(W){if(K?.nodeType!==TQ){var Z=p();if(K===null)X?.after(Z);else K.before(Z);return j(Z),Z}R0(K)}return j(K),K}function cQ(Q){Q.textContent=""}function N0(){if(!Q7)return!1;if(x7!==null)return!1;var Q=L.f;return(Q&G7)!==0}function A7(Q,J,W){if(J==null||J===$0)return W?document.createElement(Q,{is:W}):document.createElement(Q);return W?document.createElementNS(J,Q,{is:W}):document.createElementNS(J,Q)}function R0(Q){if(Q.nodeValue.length<65536)return;let J=Q.nextSibling;while(J!==null&&J.nodeType===TQ)J.remove(),Q.nodeValue+=J.nodeValue,J=Q.nextSibling}var M=!1;function f(Q){M=Q}var D;function j(Q){if(Q===null)throw XQ(),Y7;return D=Q}function l(){return j(i(D))}function I0(Q){if(!M)return;if(i(D)!==null)throw XQ(),Y7;D=Q}function Y9(Q=1){if(M){var J=Q,W=D;while(J--)W=i(W);D=W}}function o7(Q=!0){var J=0,W=D;while(!0){if(W.nodeType===w7){var K=W.data;if(K===BQ){if(J===0)return W;J-=1}else if(K===xQ||K===KQ||K[0]==="["&&!isNaN(Number(K.slice(1))))J+=1}var X=i(W);if(Q)W.remove();W=X}}function AQ(Q){if(!Q||Q.nodeType!==w7)throw XQ(),Y7;return Q.data}var mQ=Symbol("events"),F9=new Set,j0=new Set;function cJ(Q,J,W){(J[mQ]??={})[Q]=W}function oJ(Q){for(var J=0;J<Q.length;J++)F9.add(Q[J]);for(var W of j0)W(Q)}var M9=null,L9=!1;function O9(Q){var J=this,W=J.ownerDocument,K=Q.type,X=Q.composedPath?.()||[],Z=X[0]||Q.target;if(M9=Q,!L9)L9=!0,setTimeout(()=>{L9=!1,M9=null});var z=0,G=M9===Q&&Q[mQ];if(G){var V=X.indexOf(G);if(V!==-1&&(J===document||J===window)){Q[mQ]=J;return}var H=X.indexOf(J);if(H===-1)return;if(V<=H)z=V}if(Z=X[z]||Q.target,Z===J)return;U7(Q,"currentTarget",{configurable:!0,get(){return Z||W}});var U=O,$=L;u(null),_(null);try{var P,q=[];while(Z!==null){if(Z===J)break;try{var Y=Z[mQ]?.[K];if(Y!=null&&(!Z.disabled||Q.target===Z))Y.call(Z,Q)}catch(F){if(P)q.push(F);else P=F}if(Q.cancelBubble)break;z++,Z=z<X.length?X[z]:null}if(P){for(let F of q)queueMicrotask(()=>{throw F});throw P}}finally{Q[mQ]=J,delete Q.currentTarget,u(U),_($)}}var l4=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:(Q)=>{return Q}});function sJ(Q){return l4?.createHTML(Q)??Q}function D9(Q){var J=A7("template");return J.innerHTML=sJ(Q.replaceAll("<!>","<!---->")),J.content}function O7(Q,J){var W=L;if(W.nodes===null)W.nodes={start:Q,end:J,a:null,t:null}}function o4(Q,J){var W=(J&r9)!==0,K=(J&a9)!==0,X,Z=!Q.startsWith("<!>");return()=>{if(M)return O7(D,null),D;if(X===void 0){if(X=D9(Z?Q:"<!>"+Q),!W)X=g(X)}var z=K||U0?document.importNode(X,!0):X.cloneNode(!0);if(W){var G=g(z),V=z.lastChild;O7(G,V)}else O7(z,z);return z}}function s4(){if(M)return O7(D,null),D;var Q=document.createDocumentFragment(),J=document.createComment(""),W=p();return Q.append(J,W),O7(J,W),Q}function Q0(Q,J){if(M){var W=L;if((W.f&G7)===0||W.nodes.end===null)W.nodes.end=D;l();return}if(Q===null)return;Q.before(J)}var r4=["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 pW=[...r4,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var a4=["touchstart","touchmove"];function rJ(Q){return a4.includes(Q)}var n4=["$state","$state.raw","$derived","$derived.by"],fW=[...n4,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];function aJ(Q){let J=0,W=K7(0),K;return()=>{if(zQ())I(W),a(()=>{if(J===0)K=b(()=>Q(()=>SQ(W)));return J+=1,()=>{s(()=>{if(J-=1,J===0)K?.(),K=void 0,SQ(W)})}})}}var t4=B7|f7;function S9(Q,J,W,K){new nJ(Q,J,W,K)}class nJ{parent;is_pending=!1;transform_error;#Q;#J=M?D:null;#W;#G;#X;#z=null;#K=null;#V=null;#Z=null;#M=0;#q=0;#$=!1;#P=new Set;#L=new Set;#U=null;#w=aJ(()=>{return this.#U=K7(this.#M),()=>{this.#U=null}});constructor(Q,J,W,K){if(this.#Q=Q,this.#W=J,this.#G=(X)=>{var Z=L;Z.b=this,Z.f|=jQ,W(X)},this.parent=L.b,this.transform_error=K??this.parent?.transform_error??((X)=>X),this.#X=F7(()=>{if(M){let X=AQ(this.#J);l();let Z=X===KQ;if(X.startsWith(_0)){let G=JSON.parse(X.slice(_0.length));this.#F(G)}else if(Z)this.#C();else this.#S()}else this.#B()},t4),M)this.#Q=D}#S(){try{this.#z=c(()=>this.#G(this.#Q))}catch(Q){this.error(Q)}}#F(Q){let J=this.#W.failed,{reset:W,invoke_onerror:K}=this.#D(Q);if(s(K),!J)return;this.#V=c(()=>{J(this.#Q,()=>Q,()=>W)})}#D(Q){var J=!1,W=!1;let K=()=>{if(this.#H())return;if(J){QJ();return}if(J=!0,W)BJ();if(this.#V!==null)c7(this.#V,()=>{this.#V=null});this.#Y(()=>{this.#B()})};return{reset:K,invoke_onerror:()=>{if(this.#H())return;try{W=!0,this.#W.onerror?.(Q,K),W=!1}catch(Z){M7(Z,this.#X&&this.#X.parent)}}}}#H(){return(this.#X.f&(E|p7))!==0}#C(){let Q=this.#W.pending;if(!Q)return;this.is_pending=!0,this.#K=c(()=>Q(this.#Q)),s(()=>{if(this.#H())return;var J=this.#Z=document.createDocumentFragment(),W=p(),K=!1;if(J.append(W),this.#z=this.#Y(()=>{try{return c(()=>this.#G(W))}catch(X){try{this.error(X),K=!0}catch(Z){M7(Z,this.#X.parent)}return null}}),this.#z===null){if(this.#Z=null,K)this.#O(S);return}if(this.#q===0)this.#Q.before(J),this.#Z=null,c7(this.#K,()=>{this.#K=null}),this.#O(S)})}#B(){try{if(this.is_pending=this.has_pending_snippet(),this.#q=0,this.#M=0,this.#z=c(()=>{this.#G(this.#Q)}),this.#q>0){var Q=this.#Z=document.createDocumentFragment();vQ(this.#z,Q);let J=this.#W.pending;this.#K=c(()=>J(this.#Q))}else this.#O(S)}catch(J){this.error(J)}}#O(Q){this.is_pending=!1,Q.transfer_effects(this.#P,this.#L)}defer_effect(Q){D0(Q,this.#P,this.#L)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#W.pending}#Y(Q){var J=L,W=O,K=C;_(this.#X),u(this.#X),n7(this.#X.ctx);try{return J7.ensure(),Q()}finally{_(J),u(W),n7(K)}}#I(Q,J){if(!this.has_pending_snippet()){if(this.parent)this.parent.#I(Q,J);return}if(this.#q+=Q,this.#q===0){if(this.#O(J),this.#K)c7(this.#K,()=>{this.#K=null});if(this.#Z)this.#Q.before(this.#Z),this.#Z=null}}update_pending_count(Q,J){if(this.#I(Q,J),this.#M+=Q,!this.#U||this.#$)return;this.#$=!0,s(()=>{if(this.#$=!1,this.#U)g7(this.#U,this.#M)})}get_effect_pending(){return this.#w(),I(this.#U)}error(Q){if(Q===Y7)throw Q;if(!this.#W.onerror&&!this.#W.failed)throw Q;if(S?.is_fork){if(this.#z)S.skip_effect(this.#z);if(this.#K)S.skip_effect(this.#K);if(this.#V)S.skip_effect(this.#V);S.oncommit(()=>{if(!this.#H())this.#A(Q)})}else this.#A(Q)}#A(Q){if(this.#z)h(this.#z),this.#z=null;if(this.#K)h(this.#K),this.#K=null;if(this.#V)h(this.#V),this.#V=null;if(M)j(this.#J),Y9(),j(o7());let J=this.#W.failed,W=(K)=>{if(this.#H())return;let{reset:X,invoke_onerror:Z}=this.#D(K);if(Z(),J&&!this.#H())this.#V=this.#Y(()=>{try{return c(()=>{var z=L;z.b=this,z.f|=jQ,J(this.#Q,()=>K,()=>X)})}catch(z){return M7(z,this.#X.parent),null}})};s(()=>{if(this.#H())return;var K;try{K=this.transform_error(Q)}catch(X){M7(X,this.#X&&this.#X.parent);return}if(K!==null&&typeof K==="object"&&typeof K.then==="function")K.then(W,(X)=>M7(X,this.#X&&this.#X.parent));else W(K)})}}var C9=!0;function e4(Q,J){var W=J==null?"":typeof J==="object"?`${J}`:J;if(W!==(Q[_Q]??=Q.nodeValue))Q[_Q]=W,Q.nodeValue=`${W}`}function x0(Q,J){return tJ(Q,J)}function A9(Q,J){A0(),J.intro=J.intro??!1;let W=J.target,K=M,X=D;try{var Z=g(W);while(Z&&(Z.nodeType!==w7||Z.data!==xQ))Z=i(Z);if(!Z)throw Y7;f(!0),j(Z);let z=tJ(Q,{...J,anchor:Z});return f(!1),z}catch(z){if(z instanceof Error&&z.message.split(`
|
|
2
2
|
`).some((G)=>G.startsWith("https://svelte.dev/e/")))throw z;if(z!==Y7)console.warn("Failed to hydrate: ",z);if(J.recover===!1)qJ();return A0(),cQ(W),f(!1),x0(Q,J)}finally{f(K),j(X)}}var T0=new Map;function tJ(Q,{target:J,anchor:W,props:K={},events:X,context:Z,intro:z=!0,transformError:G}){A0();var V=void 0,H=kJ(()=>{var U=W??J.appendChild(p());S9(U,{pending:()=>{}},(q)=>{i0({});var Y=C;if(Z)Y.c=Z;if(X)K.$$events=X;if(M)O7(q,null);if(C9=z,V=Q(q,K)||iQ(),C9=!0,M){if(L.nodes.end=D,D===null||D.nodeType!==w7||D.data!==BQ)throw XQ(),Y7}c0()},G);var $=new Set,P=(q)=>{for(var Y=0;Y<q.length;Y++){var F=q[Y];if($.has(F))continue;$.add(F);var B=rJ(F);for(let v of[J,document]){var w=T0.get(v);if(w===void 0)w=new Map,T0.set(v,w);var N=w.get(F);if(N===void 0)v.addEventListener(F,O9,{passive:B}),w.set(F,1);else w.set(F,N+1)}}};return P(RQ(F9)),j0.add(P),()=>{for(var q of $)for(let B of[J,document]){var Y=T0.get(B),F=Y.get(q);if(--F==0){if(B.removeEventListener(q,O9),Y.delete(q),Y.size===0)T0.delete(B)}else Y.set(q,F)}if(j0.delete(P),U!==W)U.parentNode?.removeChild(U)}});return I9.set(V,H),V}var I9=new WeakMap;function N9(Q,J){let W=I9.get(Q);if(W)return I9.delete(Q),W(J);return Promise.resolve()}class e7{anchor;#Q=new Map;#J=new Map;#W=new Map;#G=new Set;#X=!0;constructor(Q,J=!0){this.anchor=Q,this.#X=J}#z=(Q)=>{if(!this.#Q.has(Q))return;var J=this.#Q.get(Q),W=this.#J.get(J);if(W)hQ(W),this.#G.delete(J);else{var K=this.#W.get(J);if(K)hQ(K.effect),this.#J.set(J,K.effect),this.#W.delete(J),K.fragment.lastChild.remove(),this.anchor.before(K.fragment),W=K.effect}for(let[X,Z]of this.#Q){if(this.#Q.delete(X),X===Q)break;let z=this.#W.get(Z);if(z)h(z.effect),this.#W.delete(Z)}for(let[X,Z]of this.#J){if(X===J||this.#G.has(X))continue;let z=()=>{if(Array.from(this.#Q.values()).includes(X)){var V=document.createDocumentFragment();vQ(Z,V),V.append(p()),this.#W.set(X,{effect:Z,fragment:V})}else h(Z);this.#G.delete(X),this.#J.delete(X)};if(this.#X||!W)this.#G.add(X),c7(Z,z,!1);else z()}};#K=(Q)=>{this.#Q.delete(Q);let J=Array.from(this.#Q.values());for(let[W,K]of this.#W)if(!J.includes(W))h(K.effect),this.#W.delete(W)};ensure(Q,J){var W=S,K=N0();if(J&&!this.#J.has(Q)&&!this.#W.has(Q))if(K){var X=document.createDocumentFragment(),Z=p();X.append(Z),this.#W.set(Q,{effect:c(()=>J(Z)),fragment:X})}else this.#J.set(Q,c(()=>J(this.anchor)));if(this.#Q.set(W,Q),K){for(let[z,G]of this.#J)if(z===Q)W.unskip_effect(G);else W.skip_effect(G);for(let[z,G]of this.#W)if(z===Q)W.unskip_effect(G.effect);else W.skip_effect(G.effect);W.oncommit(this.#z),W.ondiscard(this.#K)}else{if(M)this.anchor=D;this.#z(W)}}}function W8(Q,J,W=!1){var K;if(M)K=D,l();var X=new e7(Q),Z=W?B7:0;function z(G,V){if(M){var H=AQ(K);if(G!==parseInt(H.substring(1))){var U=o7();j(U),X.anchor=U,f(!1),X.ensure(G,V),f(!0);return}}X.ensure(G,V)}F7(()=>{var G=!1;if(J((V,H=0)=>{G=!0,z(H,V)}),!G)z(-1,null)},Z)}var K8=Symbol("NaN");function X8(Q,J,W){if(M)l();var K=new e7(Q),X=!b7();F7(()=>{var Z=J();if(Z!==Z)Z=K8;if(X&&Z!==null&&typeof Z==="object")Z={};K.ensure(Z,W)})}function Z8(Q,J,W){var K=[],X=J.length,Z,z=J.length;for(var G=0;G<X;G++){let $=J[G];c7($,()=>{if(Z){if(Z.pending.delete($),Z.done.add($),Z.pending.size===0){var P=Q.outrogroups;if(R9(Q,RQ(Z.done)),P.delete(Z),P.size===0)Q.outrogroups=null}}else z-=1},!1)}if(z===0){var V=K.length===0&&W!==null&&Q.pending.size===0;if(V){var H=W,U=H.parentNode;cQ(U),U.append(H),Q.items.clear()}R9(Q,J,!V)}else Z={pending:new Set(J),done:new Set},(Q.outrogroups??=new Set).add(Z)}function R9(Q,J,W=!0){var K;if(Q.pending.size>0){K=new Set;for(let z of Q.pending.values())for(let G of z)K.add(Q.items.get(G).e)}for(var X=0;X<J.length;X++){var Z=J[X];if(K?.has(Z)){Z.f|=E7;let z=document.createDocumentFragment();vQ(Z,z)}else h(J[X],W)}}var J4;function z8(Q,J,W,K,X,Z=null){var z=Q,G=new Map,V=(J&d0)!==0;if(V){var H=Q;z=M?j(g(H)):H.appendChild(p())}if(M)l();var U=null,$=FQ(()=>{var N=W();return r7(N)?N:N==null?[]:RQ(N)}),P=new Map,q=!0;function Y(N){if((w.effect.f&E)!==0)return;w.pending.delete(N);var v=I($);if(w.fallback=U,G8(w,v,z,J,K),U!==null)if(v.length===0)if((U.f&E7)===0)hQ(U);else U.f^=E7,W0(U,null,z);else c7(U,()=>{U=null})}function F(N){w.pending.delete(N)}var B=F7(()=>{var N=I($),v=N.length;let A=!1;if(M){var N7=AQ(z)===KQ;if(N7!==(v===0))z=o7(),j(z),f(!1),A=!0}var Z7=new Set,D7=S,NQ=N0();for(var QQ=0;QQ<v;QQ+=1){if(M&&D.nodeType===w7&&D.data===BQ)z=D,A=!0,f(!1);var v7=N[QQ],K0=K(v7,QQ);if(!1)var e8;var s7=q?null:G.get(K0);if(s7){if(s7.v)g7(s7.v,v7);if(s7.i)g7(s7.i,QQ);if(NQ)D7.unskip_effect(s7.e)}else{if(s7=V8(G,q?z:J4??=p(),v7,K0,QQ,X,J,W),!q)s7.e.f|=E7;G.set(K0,s7)}Z7.add(K0)}if(v===0&&Z&&!U)if(q)U=c(()=>Z(z));else U=c(()=>Z(J4??=p())),U.f|=E7;if(v>Z7.size)XJ("","","");if(M&&v>0)j(o7());if(!q)if(P.set(D7,Z7),NQ){for(let[w4,S4]of G)if(!Z7.has(w4))D7.skip_effect(S4.e);D7.oncommit(Y),D7.ondiscard(F)}else Y(D7);if(A)f(!0);I($)}),w={effect:B,flags:J,items:G,pending:P,outrogroups:null,fallback:U};if(q=!1,M)z=D}function J0(Q){while(Q!==null&&(Q.f&o)===0)Q=Q.next;return Q}function G8(Q,J,W,K,X){var Z=(K&d9)!==0,z=J.length,G=Q.items,V=J0(Q.effect.first),H,U=null,$,P=[],q=[],Y,F,B,w;if(Z){for(w=0;w<z;w+=1)if(Y=J[w],F=X(Y,w),B=G.get(F).e,(B.f&E7)===0)B.nodes?.a?.measure(),($??=new Set).add(B)}for(w=0;w<z;w+=1){if(Y=J[w],F=X(Y,w),B=G.get(F).e,Q.outrogroups!==null)for(let v7 of Q.outrogroups)v7.pending.delete(B),v7.done.delete(B);if((B.f&d)!==0){if(hQ(B),Z)B.nodes?.a?.unfix(),($??=new Set).delete(B)}if((B.f&E7)!==0)if(B.f^=E7,B===V)W0(B,null,W);else{var N=U?U.next:V;if(B===Q.effect.last)Q.effect.last=B.prev;if(B.prev)B.prev.next=B.next;if(B.next)B.next.prev=B.prev;$Q(Q,U,B),$Q(Q,B,N),W0(B,N,W),U=B,P=[],q=[],V=J0(U.next);continue}if(B!==V){if(H!==void 0&&H.has(B)){if(P.length<q.length){var v=q[0],A;U=v.prev;var N7=P[0],Z7=P[P.length-1];for(A=0;A<P.length;A+=1)W0(P[A],v,W);for(A=0;A<q.length;A+=1)H.delete(q[A]);$Q(Q,N7.prev,Z7.next),$Q(Q,U,N7),$Q(Q,Z7,v),V=v,U=Z7,w-=1,P=[],q=[]}else H.delete(B),W0(B,V,W),$Q(Q,B.prev,B.next),$Q(Q,B,U===null?Q.effect.first:U.next),$Q(Q,U,B),U=B;continue}P=[],q=[];while(V!==null&&V!==B)(H??=new Set).add(V),q.push(V),V=J0(V.next);if(V===null)continue}if((B.f&E7)===0)P.push(B);U=B,V=J0(B.next)}if(Q.outrogroups!==null){for(let v7 of Q.outrogroups)if(v7.pending.size===0)R9(Q,RQ(v7.done)),Q.outrogroups?.delete(v7);if(Q.outrogroups.size===0)Q.outrogroups=null}if(V!==null||H!==void 0){var D7=[];if(H!==void 0){for(B of H)if((B.f&d)===0)D7.push(B)}while(V!==null){if((V.f&d)===0&&V!==Q.fallback)D7.push(V);V=J0(V.next)}var NQ=D7.length;if(NQ>0){var QQ=(K&d0)!==0&&z===0?W:null;if(Z){for(w=0;w<NQ;w+=1)D7[w].nodes?.a?.measure();for(w=0;w<NQ;w+=1)D7[w].nodes?.a?.fix()}Z8(Q,D7,QQ)}}if(Z)s(()=>{if($===void 0)return;for(B of $)B.nodes?.a?.apply()})}function V8(Q,J,W,K,X,Z,z,G){var V=(z&p9)!==0?(z&_9)===0?wQ(W,!1,!1):K7(W):null,H=(z&f9)!==0?K7(X):null;return{v:V,i:H,e:c(()=>{return Z(J,V??W,H??X,G),()=>{Q.delete(K)}})}}function W0(Q,J,W){if(!Q.nodes)return;var K=Q.nodes.start,X=Q.nodes.end,Z=J&&(J.f&E7)===0?J.nodes.start:W;while(K!==null){var z=i(K);if(Z.before(K),K===X)return;K=z}}function $Q(Q,J,W){if(J===null)Q.effect.first=W;else J.next=W;if(W===null)Q.effect.last=J;else W.prev=J}function q8(Q,J,W=!1,K=!1,X=!1,Z=!1){var z=Q,G="";if(W){var V=Q;if(M)z=j(g(V))}$9(()=>{var H=L;if(G===(G=J()??"")){if(M)l();return}if(W&&!M){if(H.nodes=null,V.innerHTML=G,G!=="")O7(g(V),V.lastChild);return}if(H.nodes!==null)P9(H.nodes.start,H.nodes.end),H.nodes=null;if(G==="")return;if(M){var U=D.data,$=l(),P=$;while($!==null&&($.nodeType!==w7||$.data!==""))P=$,$=i($);if($===null)throw XQ(),Y7;O7(D,P),z=j($);return}var q=K?lQ:X?l0:void 0,Y=A7(K?"svg":X?"math":"template",q);Y.innerHTML=G;var F=K||X?Y:Y.content;if(O7(g(F),F.lastChild),K||X)while(g(F))z.before(g(F));else z.before(F)})}function $8(Q,J,W,K,X){if(M)l();if(J.$$host?.$$shadowRoot){let G=A7("slot");if(W!=="default")G.name=W;if(Q0(Q,G),X!==null){let V=p();G.append(V),X(V)}return}var Z=J.$$slots?.[W],z=!1;if(Z===!0)Z=J[W==="default"?"children":W],z=!0;if(Z===void 0){if(X!==null)X(Q)}else Z(Q,z?()=>K:K)}function L8(Q,J){$7(()=>{Q=L?.parent?.nodes?.start??Q;var W=Q.getRootNode(),K=W.host?W:W.head??W.ownerDocument.head;if(!K.querySelector("#"+J.hash)){let X=A7("style");X.id=J.hash,X.textContent=J.code,K.appendChild(X)}})}function F8(Q,J,W){$7(()=>{var K=b(()=>J(Q,W?.())||{});if(W&&K?.update){var X=!1,Z={};a(()=>{var z=W();if(C0(z),X&&H0(Z,z))Z=z,K.update(z)}),X=!0}if(K?.destroy)return()=>K.destroy()})}function W4(Q){var J,W,K="";if(typeof Q=="string"||typeof Q=="number")K+=Q;else if(typeof Q=="object")if(Array.isArray(Q)){var X=Q.length;for(J=0;J<X;J++)Q[J]&&(W=W4(Q[J]))&&(K&&(K+=" "),K+=W)}else for(W in Q)Q[W]&&(K&&(K+=" "),K+=W);return K}function K4(){for(var Q,J,W=0,K="",X=arguments.length;W<X;W++)(Q=arguments[W])&&(J=W4(Q))&&(K&&(K+=" "),K+=J);return K}function Z4(Q){if(typeof Q==="object")return K4(Q);else return Q??""}var X4=[...`
|
|
3
3
|
\r\f \v\uFEFF`];function z4(Q,J,W){var K=Q==null?"":""+Q;if(J)K=K?K+" "+J:J;if(W){for(var X of Object.keys(W))if(W[X])K=K?K+" "+X:X;else if(K.length){var Z=X.length,z=0;while((z=K.indexOf(X,z))>=0){var G=z+Z;if((z===0||X4.includes(K[z-1]))&&(G===K.length||X4.includes(K[G])))K=(z===0?"":K.substring(0,z))+K.substring(G+1);else z=G}}}return K===""?null:K}function G4(Q,J,W,K,X,Z){var z=Q[dQ];if(M||z!==W||z===void 0){var G=z4(W,K,Z);if(!M||G!==Q.getAttribute("class"))if(G==null)Q.removeAttribute("class");else if(J)Q.className=G;else Q.setAttribute("class",G);Q[dQ]=W}else if(Z&&X!==Z)for(var V in Z){var H=!!Z[V];if(X==null||H!==!!X[V])Q.classList.toggle(V,H)}return Z}var T8=Symbol("class"),x8=Symbol("style"),E8=Symbol("is custom element"),k8=Symbol("is html"),b8=f0?"link":"LINK";function $4(Q,J,W,K){var X=g8(Q);if(M){if(X[J]=Q.getAttribute(J),J==="src"||J==="srcset"||J==="href"&&Q.nodeName===b8){if(!K)h8(Q,J,W??"");return}}if(X[J]===(X[J]=W))return;if(J==="loading")Q[m9]=W;if(W==null)Q.removeAttribute(J);else if(typeof W!=="string"&&U4(Q).has(J))Q[J]=W;else Q.setAttribute(J,W)}function y8(Q,J,W){var K=O,X=L;let Z=M;if(M)f(!1);u(null),_(null);try{if(J!=="style"&&(j9.has(Q.getAttribute("is")||Q.nodeName)||!customElements||customElements.get(Q.getAttribute("is")||Q.nodeName.toLowerCase())?U4(Q).has(J):W&&typeof W==="object"))Q[J]=W;else $4(Q,J,W==null?W:String(W))}finally{if(u(K),_(X),Z)f(!0)}}function g8(Q){return Q[q0]??={[E8]:Q.nodeName.includes("-"),[k8]:Q.namespaceURI===$0}}var j9=new Map;function U4(Q){var J=Q.getAttribute("is")||Q.nodeName,W=j9.get(J);if(W)return W;j9.set(J,W=new Set);var K,X=Q,Z=Element.prototype;while(Z!==X){K=X0(X);for(var z in K)if(K[z].set&&z!=="innerHTML"&&z!=="textContent"&&z!=="innerText")W.add(z);X=UQ(X)}return W}function h8(Q,J,W){return}function T9(Q,J){if(Q===J)return!0;return new URL(Q,document.baseURI).href===new URL(J,document.baseURI).href}function V4(Q){return Q.split(",").map((J)=>J.trim().split(" ").filter(Boolean))}function v8(Q,J){var W=V4(Q.srcset),K=V4(J);return K.length===W.length&&K.every(([X,Z],z)=>Z===W[z][1]&&(T9(W[z][0],X)||T9(X,W[z][0])))}class P4{#Q=new WeakMap;#J;#W;static entries=new WeakMap;constructor(Q){this.#W=Q}observe(Q,J){var W=this.#Q.get(Q)||new Set;return W.add(J),this.#Q.set(Q,W),this.#G().observe(Q,this.#W),()=>{var K=this.#Q.get(Q);if(K.delete(J),K.size===0)this.#Q.delete(Q),this.#J.unobserve(Q)}}#G(){return this.#J??(this.#J=new ResizeObserver((Q)=>{for(var J of Q){P4.entries.set(J.target,J);for(var W of this.#Q.get(J.target)||[])W(J)}}))}}function x9(Q,J){return Q===J||Q?.[V7]===J}function m8(Q=iQ(),J,W,K){var X=C.r,Z=L;return $7(()=>{var z,G;return a(()=>{z=G,G=K?.()||[],b(()=>{if(!x9(W(...G),Q)){if(J(Q,...G),z&&x9(W(...z),Q))J(null,...z)}})}),()=>{let V=Z;while(V!==X&&V.parent!==null&&V.parent.f&p7)V=V.parent;let H=()=>{if(G&&x9(W(...G),Q))J(null,...G)},U=V.teardown;V.teardown=()=>{H(),U?.()}}}),Q}var k0=!1,UG=Symbol("unmounted");function k9(Q){var J=k0;try{return k0=!1,[Q(),k0]}finally{k0=J}}function p8(Q,J,W,K){var X=!ZQ||(W&i9)!==0,Z=(W&o9)!==0,z=(W&s9)!==0,G=K,V=!0,H=void 0,U=()=>{if(z&&X)return H??=GQ(K),I(H);if(V)V=!1,G=z?b(K):K;return G};let $;if(Z){var P=V7 in Q||fQ in Q;$=P7(Q,J)?.set??(P&&J in Q?(A)=>Q[J]=A:void 0)}var q,Y=!1;if(Z)[q,Y]=k9(()=>Q[J]);else q=Q[J];if(q===void 0&&K!==void 0){if(q=U(),$){if(X)$J(J);$(q)}}var F;if(X)F=()=>{var A=Q[J];if(A===void 0)return U();return V=!0,A};else F=()=>{var A=Q[J];if(A!==void 0)G=void 0;return A===void 0?G:A};if(X&&(W&c9)===0)return F;if($){var B=Q.$$legacy;return function(A,N7){if(arguments.length>0){if(!X||!N7||B||Y)$(N7?F():A);return A}return F()}}var w=!1,N=((W&l9)!==0?GQ:FQ)(()=>{return w=!1,F()});if(Z)I(N);var v=L;return function(A,N7){if(arguments.length>0){let Z7=N7?I(N):X&&Z?t7(A):A;if(X7(N,Z7),w=!0,G!==void 0)G=Z7;return A}if(S7&&w||(v.f&E)!==0)return N.v;return I(N)}}function H4(Q){return new B4(Q)}class B4{#Q;#J;constructor(Q){var J=new Map,W=(X,Z)=>{var z=wQ(Z,!1,!1);return J.set(X,z),z};let K=new Proxy({...Q.props||{},$$events:{}},{get(X,Z){return I(J.get(Z)??W(Z,Reflect.get(X,Z)))},has(X,Z){if(Z===fQ)return!0;return I(J.get(Z)??W(Z,Reflect.get(X,Z))),Reflect.has(X,Z)},set(X,Z,z){return X7(J.get(Z)??W(Z,z),z),Reflect.set(X,Z,z)}});if(this.#J=(Q.hydrate?A9:x0)(Q.component,{target:Q.target,anchor:Q.anchor,props:K,context:Q.context,intro:Q.intro??!1,recover:Q.recover,transformError:Q.transformError}),!Q7&&(!Q?.props?.$$host||Q.sync===!1))CQ();this.#Q=K.$$events;for(let X of Object.keys(this.#J)){if(X==="$set"||X==="$destroy"||X==="$on")continue;U7(this,X,{get(){return this.#J[X]},set(Z){this.#J[X]=Z},enumerable:!0})}this.#J.$set=(X)=>{Object.assign(K,X)},this.#J.$destroy=()=>{N9(this.#J)}}$set(Q){this.#J.$set(Q)}$on(Q,J){this.#Q[Q]=this.#Q[Q]||[];let W=(...K)=>J.call(this,...K);return this.#Q[Q].push(W),()=>{this.#Q[Q]=this.#Q[Q].filter((K)=>K!==W)}}$destroy(){this.#J.$destroy()}}var Y4;if(typeof HTMLElement==="function")Y4=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(Q,J,W){super();if(this.$$ctor=Q,this.$$s=J,W)this.$$shadowRoot=this.attachShadow(W)}addEventListener(Q,J,W){if(this.$$l[Q]=this.$$l[Q]||[],this.$$l[Q].push(J),this.$$c){let K=this.$$c.$on(Q,J);this.$$l_u.set(J,K)}super.addEventListener(Q,J,W)}removeEventListener(Q,J,W){if(super.removeEventListener(Q,J,W),this.$$c){let K=this.$$l_u.get(J);if(K)K(),this.$$l_u.delete(J)}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let Q=function(K){return(X)=>{let Z=A7("slot");if(K!=="default")Z.name=K;Q0(X,Z)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let J={},W=s8(this);for(let K of this.$$s)if(K in W)if(K==="default"&&!this.$$d.children)this.$$d.children=Q(K),J.default=!0;else J[K]=Q(K);for(let K of this.attributes){let X=this.$$g_p(K.name);if(!(X in this.$$d))this.$$d[X]=b0(X,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=H4({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:J,$$host:this}}),this.$$me=q9(()=>{a(()=>{this.$$r=!0;for(let K of uQ(this.$$c)){if(!this.$$p_d[K]?.reflect)continue;this.$$d[K]=this.$$c[K];let X=b0(K,this.$$d[K],this.$$p_d,"toAttribute");if(X==null)this.removeAttribute(this.$$p_d[K].attribute||K);else this.setAttribute(this.$$p_d[K].attribute||K,X)}this.$$r=!1})});for(let K in this.$$l)for(let X of this.$$l[K]){let Z=this.$$c.$on(K,X);this.$$l_u.set(X,Z)}this.$$l={}}}attributeChangedCallback(Q,J,W){if(this.$$r)return;Q=this.$$g_p(Q),this.$$d[Q]=b0(Q,W,this.$$p_d,"toProp"),this.$$c?.$set({[Q]:this.$$d[Q]})}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{if(!this.$$cn&&this.$$c)this.$$c.$destroy(),this.$$me(),this.$$c=void 0})}$$g_p(Q){return uQ(this.$$p_d).find((J)=>this.$$p_d[J].attribute===Q||!this.$$p_d[J].attribute&&J.toLowerCase()===Q)||Q}};function b0(Q,J,W,K){let X=W[Q]?.type;if(J=X==="Boolean"&&typeof J!=="boolean"?J!=null:J,!K||!W[Q])return J;else if(K==="toAttribute")switch(X){case"Object":case"Array":return J==null?null:JSON.stringify(J);case"Boolean":return J?"":null;case"Number":return J==null?null:J;default:return J}else switch(X){case"Object":case"Array":return J&&JSON.parse(J);case"Boolean":return J;case"Number":return J!=null?+J:J;default:return J}}function s8(Q){let J={};return Q.childNodes.forEach((W)=>{J[W.slot||"default"]=!0}),J}function r8(Q,J,W,K,X,Z){let z=class extends Y4{constructor(){super(Q,W,X);this.$$p_d=J}static get observedAttributes(){return uQ(J).map((G)=>(J[G].attribute||G).toLowerCase())}};if(uQ(J).forEach((G)=>{U7(z.prototype,G,{get(){return this.$$c&&G in this.$$c?this.$$c[G]:this.$$d[G]},set(V){V=b0(G,V,J),this.$$d[G]=V;var H=this.$$c;if(H){var U=P7(H,G)?.get;if(U)H[G]=V;else H.$set({[G]:V})}}})}),K.forEach((G)=>{U7(z.prototype,G,{get(){return this.$$c?.[G]}})}),Z)z=Z(z);return Q.element=z,z}import{createContext as y0}from"@pie-players/pie-context";var M4=y0(Symbol.for("pie.assessmentToolkit.runtimeContext")),L4=y0(Symbol.for("pie.assessmentToolkit.hostRuntimeContext")),F4=y0(Symbol.for("pie.assessmentToolkit.shellContext")),a8=y0(Symbol.for("pie.assessmentToolkit.regionScopeContext"));import{connectContextWithRetry as b9}from"@pie-players/pie-context";var n8={bubbles:!0,composed:!0,cancelable:!1};function t8(Q,J,W={}){return new CustomEvent(Q,{detail:J,...n8,...W})}function UP(Q,J,W,K={}){return Q.dispatchEvent(t8(J,W,K))}function PP(Q,J){return b9(Q,M4,J)}function HP(Q,J){return b9(Q,F4,J)}function BP(Q,J){return b9(Q,L4,J)}var MP=1e4;function LP(Q,J,W){if(!Q)return;let K=Symbol.for(`pie.assessmentToolkit.warned.${J}`),X=Q;if(X[K])return;X[K]=!0,console.warn(W)}function OP(Q,J){return D4(Q,J,new WeakMap)}function D4(Q,J,W){if(Object.is(Q,J))return!0;let K=Array.isArray(Q);if(K!==Array.isArray(J))return!1;if(!K&&(!O4(Q)||!O4(J)))return!1;let X=Q,Z=J;if(K&&Q.length!==J.length)return!1;let z=W.get(X);if(z?.has(Z))return!0;if(!z)z=new Set,W.set(X,z);z.add(Z);let G=new Set([...Object.keys(X),...Object.keys(Z)]);for(let V of G)if(!D4(X[V],Z[V],W))return!1;return!0}function O4(Q){if(Q===null||typeof Q!=="object")return!1;let J=Object.getPrototypeOf(Q);return J===Object.prototype||J===null}
|
|
4
|
-
export{m7 as
|
|
4
|
+
export{m7 as v,I0 as w,i0 as x,c0 as y,T4 as z,CQ as A,l7 as B,X7 as C,t7 as D,iJ as E,f4 as F,d4 as G,_4 as H,V9 as I,$9 as J,I as K,b as L,cJ as M,oJ as N,o4 as O,s4 as P,Q0 as Q,e4 as R,W8 as S,X8 as T,z8 as U,q8 as V,$8 as W,L8 as X,F8 as Y,Z4 as Z,G4 as _,$4 as $,y8 as aa,m8 as ba,p8 as ca,r8 as da,M4 as ea,L4 as fa,F4 as ga,a8 as ha,UP as ia,PP as ja,HP as ka,BP as la,MP as ma,LP as na,OP as oa};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ka as D,la as z}from"./ItemToolBar-jpac75fa.js";var S=["assessment","section","item","passage","rubric"],b=new Set(S);function _(q){return b.has(q)}function d(q,J,Q){let X=q.trim(),$=Q.trim();if(!X||!$)throw Error("Tool instance ids require non-empty tool and scope ids");if(!_(J))throw Error(`Unknown tool scope level '${J}'.`);return`${X}:${J}:${$}`}function R(q){let J=q.split(":");if(J.length!==3)return null;let[Q,X,$]=J;if(!Q||!$)return null;if(!_(X))return null;return{baseToolId:Q,scopeLevel:X,scopeId:$}}import{createPieLogger as h,isGlobalDebugEnabled as P}from"@pie-players/pie-players-shared/pie";var V=h("ToolCoordinator",P),O;(function(q){q[q.BASE=0]="BASE",q[q.TOOL=1000]="TOOL",q[q.MODAL=2000]="MODAL",q[q.CONTROL=3000]="CONTROL",q[q.HIGHLIGHT=4000]="HIGHLIGHT"})(O||(O={}));function k(q,J){if(!J?.baseId)return!0;return(R(q)?.baseToolId??q)===J.baseId}function C(q){return{id:q.id,name:q.name,isVisible:q.isVisible,element:q.element,layer:q.layer}}class N{tools=new Map;listeners=new Set;subscribe(q){return this.listeners.add(q),()=>{this.listeners.delete(q)}}notifyListeners(){for(let q of this.listeners)try{q()}catch(J){console.warn("[ToolCoordinator] listener failed:",J)}}registerTool(q,J,Q,X){V.debug("registerTool called:",{id:q,name:J,hasElement:!!Q,layer:X});let $=this.tools.get(q);if($){$.name=J;let Y=$.registered;if($.registered=!0,X!==void 0&&!$.layerDeclared)$.layer=X,$.layerDeclared=!0,this.stackOnTop($);else if(!Y)this.stackOnTop($)}else $={id:q,name:J,registered:!0,element:null,layer:X??O.TOOL,layerDeclared:X!==void 0,isVisible:!1,baseZIndex:0},this.tools.set(q,$),this.stackOnTop($);if(Q)this.updateToolElement(q,Q)}unregisterTool(q){let J=this.tools.get(q);if(!J?.registered)return;this.detachElement(J),J.registered=!1}releaseTool(q){let J=this.tools.get(q);if(!J)return;if(this.detachElement(J),this.tools.delete(q),J.isVisible)this.notifyListeners()}showTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}if(J.element)this.bringToFront(J.element);this.setVisible(J,!0)}hideTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}this.setVisible(J,!1)}toggleTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}if(J.isVisible)this.hideTool(q);else this.showTool(q)}isToolVisible(q){return this.tools.get(q)?.isVisible??!1}bringToFront(q){let J=Array.from(this.tools.values()).find((Q)=>Q.element===q);if(!J)return;this.stackOnTop(J)}destroy(){let q=Array.from(this.tools.values()).some((J)=>J.isVisible);for(let J of this.tools.values())this.detachElement(J);if(this.tools.clear(),q)this.notifyListeners();this.listeners.clear()}setVisible(q,J){if(q.isVisible===J)return;q.isVisible=J,this.notifyListeners()}detachElement(q){if(q.element&&q.mouseDownHandler)q.element.removeEventListener("mousedown",q.mouseDownHandler);q.element=null,q.mouseDownHandler=void 0}stackOnTop(q){let J=Array.from(this.tools.values()).filter((X)=>X.registered&&X.layer===q.layer&&X!==q).sort((X,$)=>X.baseZIndex-$.baseZIndex),Q=q.layer+J.length+1;if(q.baseZIndex===Q&&J.every((X)=>X.baseZIndex<Q))return;[...J,q].forEach((X,$)=>{if(X.baseZIndex=q.layer+1+$,X.element)X.element.style.zIndex=String(X.baseZIndex)})}updateToolElement(q,J){let Q=this.tools.get(q);if(!Q?.registered){V.debug(`Tool ${q} not found`);return}if(Q.element===J)return;if(Q.element?.isConnected&&Q.element.contains(J))return;this.detachElement(Q);let X=()=>this.bringToFront(J);if(J.addEventListener("mousedown",X),Q.element=J,Q.mouseDownHandler=X,J.style.zIndex=String(Q.baseZIndex),Q.isVisible)this.bringToFront(J)}hideAllTools(q){let J=!1;for(let Q of this.tools.values()){if(!Q.isVisible||!k(Q.id,q))continue;Q.isVisible=!1,J=!0}if(J)this.notifyListeners()}getToolState(q){let J=this.tools.get(q);return J?.registered?C(J):void 0}getVisibleTools(q){return Array.from(this.tools.values()).filter((J)=>J.isVisible&&k(J.id,q)).map(C)}}import{dynamicMessageKey as t}from"@pie-players/pie-players-shared/i18n/provider";import{settleAll as f}from"@pie-players/pie-players-shared/promise";import{validateCustomElementTag as T}from"@pie-players/pie-players-shared/pie/tag-names";var E=(q,J)=>{let Q=J?.toolTagMap?.[q];if(Q===void 0&&!q.includes("-"))throw Error(`No element tag is mapped for tool "${q}". Install a tag map on the registry via setComponentOverrides({ toolTagMap }) — for the packaged capabilities, PACKAGED_TOOL_TAG_MAP from "@pie-players/pie-default-tool-loaders".`);return T(Q??q,`tool component tag for "${q}"`)};var w=(q,J,Q)=>console.error(`[ToolRegistry] Tool '${q}' ${J} check threw:`,Q);var x=["assessment","section","item","passage","rubric","element"];function G(q,J){if(typeof q!=="string"||q.trim().length===0)throw Error(`Invalid tool registration: "${J}" must be a non-empty string.`)}var L=[{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 p(q,J,Q){let X=J.trimStart(),$=X.toLowerCase().startsWith("<svg"),Y=/^https?:/i.test(X);if(/^data:/i.test(X))throw Error(`Invalid tool registration "${q}": "${Q}" may not be a data: URL.`);if(!$&&!Y)return;for(let{pattern:H,reason:W}of L)if(H.test(J))throw Error(`Invalid tool registration "${q}": "${Q}" ${W}. Inline SVG icons must not include scriptable content.`)}function Z(q){G(q.toolId,"toolId"),G(q.name,"name"),G(q.description,"description");let J=q.activation==="region";if(!J||q.icon!==void 0){if(typeof q.icon!=="string"&&typeof q.icon!=="function")throw Error(`Invalid tool registration "${q.toolId}": "icon" must be a string or function.`)}if(typeof q.icon==="string")p(q.toolId,q.icon,"icon");if(!Array.isArray(q.supportedLevels)||q.supportedLevels.length===0)throw Error(`Invalid tool registration "${q.toolId}": "supportedLevels" must be a non-empty array.`);let Q=q.supportedLevels.find((X)=>!x.includes(X));if(Q)throw Error(`Invalid tool registration "${q.toolId}": unsupported level "${Q}".`);if(q.activation!==void 0&&q.activation!=="toolbar-toggle"&&q.activation!=="selection-gateway"&&q.activation!=="region")throw Error(`Invalid tool registration "${q.toolId}": unsupported activation "${String(q.activation)}".`);if(q.surfaces!==void 0&&(!Array.isArray(q.surfaces)||q.surfaces.some((X)=>typeof X!=="string"||X.trim().length===0)))throw Error(`Invalid tool registration "${q.toolId}": "surfaces" must be an array of non-empty strings.`);if(J&&!q.surfaces?.length)throw Error(`Invalid tool registration "${q.toolId}": region tools must declare at least one host surface in "surfaces".`);if(J&&typeof q.renderSurface!=="function")throw Error(`Invalid tool registration "${q.toolId}": region tools must implement "renderSurface".`);if(q.resolvesWithoutGrant!==void 0&&typeof q.resolvesWithoutGrant!=="boolean")throw Error(`Invalid tool registration "${q.toolId}": "resolvesWithoutGrant" must be a boolean.`);if(q.resolvesWithoutGrant&&!q.requiresAuthoredContent)throw Error(`Invalid tool registration "${q.toolId}": "resolvesWithoutGrant" requires "requiresAuthoredContent".`);if(q.renderSurface!==void 0&&typeof q.renderSurface!=="function")throw Error(`Invalid tool registration "${q.toolId}": "renderSurface" must be a function.`);if(q.renderSurface&&!q.surfaces?.length)throw Error(`Invalid tool registration "${q.toolId}": "renderSurface" requires at least one entry in "surfaces".`);if(q.singletonScope!==void 0&&q.singletonScope!=="section")throw Error(`Invalid tool registration "${q.toolId}": unsupported singletonScope "${String(q.singletonScope)}".`);if(q.activation==="selection-gateway"&&q.singletonScope!=="section")throw Error(`Invalid tool registration "${q.toolId}": selection-gateway tools must declare singletonScope "section".`);if(q.activation!=="region"&&typeof q.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${q.toolId}": "isVisibleInContext" must be a function.`);if(q.isVisibleInContext!==void 0&&typeof q.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${q.toolId}": "isVisibleInContext" must be a function when present.`);if(q.isApplicableToContent!==void 0&&typeof q.isApplicableToContent!=="function")throw Error(`Invalid tool registration "${q.toolId}": "isApplicableToContent" must be a function when present.`);if(q.requiresAuthoredContent!==void 0){if(typeof q.requiresAuthoredContent!=="object"||q.requiresAuthoredContent===null||typeof q.requiresAuthoredContent.resolve!=="function")throw Error(`Invalid tool registration "${q.toolId}": "requiresAuthoredContent" must be an object with a "resolve" function.`)}if(q.renderToolbar!==void 0){if(typeof q.renderToolbar!=="function")throw Error(`Invalid tool registration "${q.toolId}": "renderToolbar" must be a function.`)}else if(!J)throw Error(`Invalid tool registration "${q.toolId}": "renderToolbar" must be a function.`)}class m{tools=new Map;componentOverrides={};watchedUndefinedToolElements=new Set;moduleLoaders=new Map;loadedToolModules=new Set;warnedLoaderReplacements=new Set;warnedUnregisteredAllowedTools=new Set;moduleLoadPromises=new Map;changeListeners=new Set;emitChange(q){for(let J of this.changeListeners)try{J(q)}catch(Q){console.warn("[ToolRegistry] change listener failed:",Q)}}onRegistryChange(q){this.changeListeners.add(q);let J=!0;return()=>{if(!J)return;J=!1,this.changeListeners.delete(q)}}normalizeToolId(q){return q.trim()}normalizeToolIds(q){return q.map((J)=>this.normalizeToolId(J))}register(q){if(Z(q),this.tools.has(q.toolId))throw Error(`Tool '${q.toolId}' is already registered`);this.tools.set(q.toolId,q),this.emitChange({kind:"register",toolIds:[q.toolId]})}override(q){if(Z(q),!this.tools.has(q.toolId))throw Error(`Cannot override non-existent tool '${q.toolId}'`);this.tools.set(q.toolId,q),this.emitChange({kind:"override",toolIds:[q.toolId]})}unregister(q){if(!this.tools.has(q))return;this.tools.delete(q),this.emitChange({kind:"unregister",toolIds:[q]})}get(q){return this.tools.get(q)}has(q){return this.tools.has(q)}getAllToolIds(){return Array.from(this.tools.keys())}getAllTools(){return Array.from(this.tools.values())}getToolsByLevel(q){return this.getAllTools().filter((J)=>J.supportedLevels.includes(q))}getToolActivation(q){return this.get(q)?.activation||"toolbar-toggle"}getToolSingletonScope(q){return this.get(q)?.singletonScope||null}getToolsBySurface(q){if(!q)return[];return this.getAllTools().filter((J)=>typeof J.renderSurface==="function"&&J.surfaces?.includes(q))}getContentDependentSupportIds(){return this.getAllTools().filter((q)=>q.requiresAuthoredContent).map((q)=>q.toolId).sort()}filterToolIdsByActivation(q,J){return q.filter((Q)=>this.getToolActivation(Q)===J)}filterVisibleInContext(q,J,Q=w){let X=[];for(let $ of q){let Y=this.get($);if(!Y){if(!this.warnedUnregisteredAllowedTools.has($))this.warnedUnregisteredAllowedTools.add($),console.warn(`Tool '${$}' is allowed but not registered`);continue}if(!Y.supportedLevels.includes(J.level))continue;try{if(Y.isVisibleInContext?.(J))X.push(Y)}catch(j){Q($,"tool-visibility",j)}}return X}isApplicableToAnyContext(q,J,Q=w){let X=this.get(q);if(!X?.isApplicableToContent)return!0;if(J.length===0)return!0;return J.some(($)=>{try{return X.isApplicableToContent?.($)??!0}catch(Y){return Q(q,"tool-applicability",Y),!0}})}filterDecidedToolIds(q,J,Q,X=w){let $=new Set,Y=[];for(let H of q){let W=this.normalizeToolId(H.toolId);if(!W)continue;if(H.required||H.alwaysAvailable)$.add(W);if(Y.includes(W))continue;if(!this.get(W)?.supportedLevels.includes(J))continue;Y.push(W)}if(J==="section")return Y;let j=new Set(Q.length===0?Y:Y.filter((H)=>$.has(H)));for(let H of Q){let W=Y.filter((U)=>!j.has(U));for(let U of this.filterVisibleInContext(W,H,X))j.add(U.toolId)}return Y.filter((H)=>j.has(H)&&this.isApplicableToAnyContext(H,Q,X))}getToolMetadata(){return this.getAllTools().map((q)=>({toolId:q.toolId,name:q.name,description:q.description,supportedLevels:q.supportedLevels,activation:q.activation||"toolbar-toggle",singletonScope:q.singletonScope||null,surfaces:q.surfaces||[],requiresAuthoredContent:Boolean(q.requiresAuthoredContent),contentDependencyDescription:q.requiresAuthoredContent?.description??null}))}clear(){let q=this.getAllToolIds();if(q.length===0)return;this.tools.clear(),this.emitChange({kind:"clear",toolIds:q})}setComponentOverrides(q){if(this.componentOverrides===q)return;this.componentOverrides=q,this.emitChange({kind:"component-overrides",toolIds:[]})}setToolModuleLoaders(q){let J=Object.entries(q).filter((X)=>X[1]!==void 0);for(let[X,$]of J)if(G(X,"tool module loader id"),typeof $!=="function")throw Error(`Invalid tool module loader for "${X}": expected a function.`);let Q=[];for(let[X,$]of J){if(this.moduleLoaders.get(X)===$)continue;if(this.loadedToolModules.has(X)||this.moduleLoadPromises.has(X)){this.warnLoaderReplacedAfterLoad(X);continue}this.moduleLoaders.set(X,$),Q.push(X)}if(Q.length>0)this.emitChange({kind:"module-loaders",toolIds:Q})}warnLoaderReplacedAfterLoad(q){if(this.warnedLoaderReplacements.has(q))return;this.warnedLoaderReplacements.add(q),console.warn(`[ToolRegistry] Ignored a new module loader for "${q}": its module already loaded, so the elements it defines stay in place. Register loaders before the tool first renders.`)}async ensureToolModuleLoaded(q){if(this.loadedToolModules.has(q))return;let J=this.moduleLoadPromises.get(q);if(J){await J;return}let Q=this.moduleLoaders.get(q);if(!Q){this.watchUndefinedToolElement(q);return}let X=(async()=>{await Q(),this.loadedToolModules.add(q),this.warnIfLoadedToolElementUndefined(q)})();this.moduleLoadPromises.set(q,X);try{await X}finally{this.moduleLoadPromises.delete(q)}}undefinedToolElementTag(q){if(typeof customElements>"u"||typeof document>"u")return null;let J=this.componentOverrides;if(J.toolComponentFactories?.[q])return null;let Q;try{Q=E(q,J)}catch{return null}return customElements.get(Q)?null:Q}warnIfLoadedToolElementUndefined(q){let J=this.undefinedToolElementTag(q);if(!J)return;z(document,`loadedToolElementUndefined.${q}.${J}`,`[ToolRegistry] Tool "${q}" renders <${J}>, but its module loader finished without defining it, so the tool renders blank. The tag map and the loader disagree: map "${q}" to the tag its loader defines, or register a loader that defines <${J}>. Reported once per page.`)}watchUndefinedToolElement(q){if(this.watchedUndefinedToolElements.has(q))return;let J=this.undefinedToolElementTag(q);if(!J)return;this.watchedUndefinedToolElements.add(q);let Q=document,X=setTimeout(()=>{if(customElements.get(J))return;z(Q,`undefinedToolElement.${q}`,`[ToolRegistry] Tool "${q}" renders <${J}>, which is still undefined after ${D/1000} s, and its registry has no module loader for it. Register one with setToolModuleLoaders or import the tool's package before it renders; a registry from createPackagedToolRegistry has the packaged loaders unless its toolModuleLoaders replaced them. Reported once per page.`)},D);customElements.whenDefined(J).then(()=>clearTimeout(X))}async ensureToolModulesLoaded(q){let J=await f(q.map((X)=>this.ensureToolModuleLoaded(X))),Q=new Map;return J.forEach((X,$)=>{if(X.status==="rejected")Q.set(q[$],X.reason)}),Q}isToolModuleLoaded(q){return this.loadedToolModules.has(q)}renderForToolbar(q,J,Q){let X=this.get(q);if(!X)throw Error(`Tool '${q}' is not registered`);if(typeof X.renderToolbar!=="function")throw Error(`Tool '${q}' has activation "${X.activation||"toolbar-toggle"}" and renders into a host surface, not a toolbar. Remove it from toolbar placement.`);let $={...Q,componentOverrides:this.mergeComponentOverrides(Q.componentOverrides)};return X.renderToolbar(J,$)}renderForSurface(q,J){let Q=this.get(q);if(!Q)throw Error(`Tool '${q}' is not registered`);if(typeof Q.renderSurface!=="function")throw Error(`Tool '${q}' does not render into a host surface. Surface capabilities declare "surfaces" and implement "renderSurface".`);return Q.renderSurface({...J,componentOverrides:this.mergeComponentOverrides(J.componentOverrides)})}mergeComponentOverrides(q){return{...this.componentOverrides||{},...q||{}}}}var K={assessment:[],section:[],item:[],passage:[],rubric:[],element:[]};import{isPlainRecord as B}from"@pie-players/pie-players-shared/object";var u={section:[...K.section],item:[...K.item],passage:[...K.passage]};function F(q,J){if(q==null)return[];if(!Array.isArray(q))throw Error(`Invalid tools config at "${J}": expected an array of tool ids.`);if(q.find((X)=>typeof X!=="string")!==void 0)throw Error(`Invalid tools config at "${J}": all entries must be strings.`);return q}function v(q){if(q==null)return;if(!B(q))throw Error('Invalid tools config at "placement": expected an object with section/item/passage arrays.');return q}function c(q){if(q==null)return;if(!B(q))throw Error('Invalid tools config at "policy": expected an object with allowed/blocked arrays.');return q}function y(q,J){if(J==null)return;if(!B(J))throw Error(`Invalid tools config at "providers.${q}": expected an object.`);let Q=J;if("enabled"in Q&&Q.enabled!==void 0&&typeof Q.enabled!=="boolean")throw Error(`Invalid tools config at "providers.${q}.enabled": expected a boolean.`);if("settings"in Q&&Q.settings!==void 0&&!B(Q.settings))throw Error(`Invalid tools config at "providers.${q}.settings": expected an object.`);if("provider"in Q&&Q.provider!==void 0&&!B(Q.provider))throw Error(`Invalid tools config at "providers.${q}.provider": expected an object.`);return Q}function I(q){if(q==null)return{};if(!B(q))throw Error('Invalid tools config at "providers": expected an object keyed by tool id.');let J={};for(let[Q,X]of Object.entries(q))J[Q]=y(Q,X);return J}function M(q){if(!q||q.length===0)return[];let J=new Set;for(let Q of q){if(typeof Q!=="string")throw Error("Invalid tools config: tool list entries must be strings.");let X=Q.trim();if(!X)continue;J.add(X)}return Array.from(J)}function Hq(q){if(!q)return[];return M(q.split(",").map((J)=>J.trim()).filter(Boolean))}function g(q,J){if(q==null)return;if(q==="on"||q==="off")return q;throw Error(`Invalid tools config at "${J}": expected "on" or "off", got ${JSON.stringify(q)}.`)}function A(q,J){let Q=M(F(q?.[J],`placement.${J}`));return Q.length?Q:[...u[J]]}function Wq(q){if(q!=null&&!B(q))throw Error('Invalid tools config: expected an object with "policy", "placement", and "providers".');let J=c(q?.policy),Q=v(q?.placement),X=I(q?.providers),$=g(q?.pnpEnforcement,"pnpEnforcement"),Y={policy:{allowed:M(F(J?.allowed,"policy.allowed")),blocked:M(F(J?.blocked,"policy.blocked"))},placement:{section:A(Q,"section"),item:A(Q,"item"),passage:A(Q,"passage")},providers:X};if($)Y.pnpEnforcement=$;return Y}
|
|
2
|
-
export{d as
|
|
1
|
+
import{ma as D,na as z}from"./ItemToolBar-f971t0cw.js";var S=["assessment","section","item","passage","rubric"],b=new Set(S);function _(q){return b.has(q)}function d(q,J,Q){let X=q.trim(),$=Q.trim();if(!X||!$)throw Error("Tool instance ids require non-empty tool and scope ids");if(!_(J))throw Error(`Unknown tool scope level '${J}'.`);return`${X}:${J}:${$}`}function R(q){let J=q.split(":");if(J.length!==3)return null;let[Q,X,$]=J;if(!Q||!$)return null;if(!_(X))return null;return{baseToolId:Q,scopeLevel:X,scopeId:$}}import{createPieLogger as h,isGlobalDebugEnabled as P}from"@pie-players/pie-players-shared/pie";var V=h("ToolCoordinator",P),O;(function(q){q[q.BASE=0]="BASE",q[q.TOOL=1000]="TOOL",q[q.MODAL=2000]="MODAL",q[q.CONTROL=3000]="CONTROL",q[q.HIGHLIGHT=4000]="HIGHLIGHT"})(O||(O={}));function k(q,J){if(!J?.baseId)return!0;return(R(q)?.baseToolId??q)===J.baseId}function C(q){return{id:q.id,name:q.name,isVisible:q.isVisible,element:q.element,layer:q.layer}}class N{tools=new Map;listeners=new Set;subscribe(q){return this.listeners.add(q),()=>{this.listeners.delete(q)}}notifyListeners(){for(let q of this.listeners)try{q()}catch(J){console.warn("[ToolCoordinator] listener failed:",J)}}registerTool(q,J,Q,X){V.debug("registerTool called:",{id:q,name:J,hasElement:!!Q,layer:X});let $=this.tools.get(q);if($){$.name=J;let Y=$.registered;if($.registered=!0,X!==void 0&&!$.layerDeclared)$.layer=X,$.layerDeclared=!0,this.stackOnTop($);else if(!Y)this.stackOnTop($)}else $={id:q,name:J,registered:!0,element:null,layer:X??O.TOOL,layerDeclared:X!==void 0,isVisible:!1,baseZIndex:0},this.tools.set(q,$),this.stackOnTop($);if(Q)this.updateToolElement(q,Q)}unregisterTool(q){let J=this.tools.get(q);if(!J?.registered)return;this.detachElement(J),J.registered=!1}releaseTool(q){let J=this.tools.get(q);if(!J)return;if(this.detachElement(J),this.tools.delete(q),J.isVisible)this.notifyListeners()}showTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}if(J.element)this.bringToFront(J.element);this.setVisible(J,!0)}hideTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}this.setVisible(J,!1)}toggleTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}if(J.isVisible)this.hideTool(q);else this.showTool(q)}isToolVisible(q){return this.tools.get(q)?.isVisible??!1}bringToFront(q){let J=Array.from(this.tools.values()).find((Q)=>Q.element===q);if(!J)return;this.stackOnTop(J)}destroy(){let q=Array.from(this.tools.values()).some((J)=>J.isVisible);for(let J of this.tools.values())this.detachElement(J);if(this.tools.clear(),q)this.notifyListeners();this.listeners.clear()}setVisible(q,J){if(q.isVisible===J)return;q.isVisible=J,this.notifyListeners()}detachElement(q){if(q.element&&q.mouseDownHandler)q.element.removeEventListener("mousedown",q.mouseDownHandler);q.element=null,q.mouseDownHandler=void 0}stackOnTop(q){let J=Array.from(this.tools.values()).filter((X)=>X.registered&&X.layer===q.layer&&X!==q).sort((X,$)=>X.baseZIndex-$.baseZIndex),Q=q.layer+J.length+1;if(q.baseZIndex===Q&&J.every((X)=>X.baseZIndex<Q))return;[...J,q].forEach((X,$)=>{if(X.baseZIndex=q.layer+1+$,X.element)X.element.style.zIndex=String(X.baseZIndex)})}updateToolElement(q,J){let Q=this.tools.get(q);if(!Q?.registered){V.debug(`Tool ${q} not found`);return}if(Q.element===J)return;if(Q.element?.isConnected&&Q.element.contains(J))return;this.detachElement(Q);let X=()=>this.bringToFront(J);if(J.addEventListener("mousedown",X),Q.element=J,Q.mouseDownHandler=X,J.style.zIndex=String(Q.baseZIndex),Q.isVisible)this.bringToFront(J)}hideAllTools(q){let J=!1;for(let Q of this.tools.values()){if(!Q.isVisible||!k(Q.id,q))continue;Q.isVisible=!1,J=!0}if(J)this.notifyListeners()}getToolState(q){let J=this.tools.get(q);return J?.registered?C(J):void 0}getVisibleTools(q){return Array.from(this.tools.values()).filter((J)=>J.isVisible&&k(J.id,q)).map(C)}}import{dynamicMessageKey as t}from"@pie-players/pie-players-shared/i18n/provider";import{settleAll as f}from"@pie-players/pie-players-shared/promise";import{validateCustomElementTag as T}from"@pie-players/pie-players-shared/pie/tag-names";var E=(q,J)=>{let Q=J?.toolTagMap?.[q];if(Q===void 0&&!q.includes("-"))throw Error(`No element tag is mapped for tool "${q}". Install a tag map on the registry via setComponentOverrides({ toolTagMap }) — for the packaged capabilities, PACKAGED_TOOL_TAG_MAP from "@pie-players/pie-default-tool-loaders".`);return T(Q??q,`tool component tag for "${q}"`)};var w=(q,J,Q)=>console.error(`[ToolRegistry] Tool '${q}' ${J} check threw:`,Q);var x=["assessment","section","item","passage","rubric","element"];function G(q,J){if(typeof q!=="string"||q.trim().length===0)throw Error(`Invalid tool registration: "${J}" must be a non-empty string.`)}var L=[{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 p(q,J,Q){let X=J.trimStart(),$=X.toLowerCase().startsWith("<svg"),Y=/^https?:/i.test(X);if(/^data:/i.test(X))throw Error(`Invalid tool registration "${q}": "${Q}" may not be a data: URL.`);if(!$&&!Y)return;for(let{pattern:H,reason:W}of L)if(H.test(J))throw Error(`Invalid tool registration "${q}": "${Q}" ${W}. Inline SVG icons must not include scriptable content.`)}function Z(q){G(q.toolId,"toolId"),G(q.name,"name"),G(q.description,"description");let J=q.activation==="region";if(!J||q.icon!==void 0){if(typeof q.icon!=="string"&&typeof q.icon!=="function")throw Error(`Invalid tool registration "${q.toolId}": "icon" must be a string or function.`)}if(typeof q.icon==="string")p(q.toolId,q.icon,"icon");if(!Array.isArray(q.supportedLevels)||q.supportedLevels.length===0)throw Error(`Invalid tool registration "${q.toolId}": "supportedLevels" must be a non-empty array.`);let Q=q.supportedLevels.find((X)=>!x.includes(X));if(Q)throw Error(`Invalid tool registration "${q.toolId}": unsupported level "${Q}".`);if(q.activation!==void 0&&q.activation!=="toolbar-toggle"&&q.activation!=="selection-gateway"&&q.activation!=="region")throw Error(`Invalid tool registration "${q.toolId}": unsupported activation "${String(q.activation)}".`);if(q.surfaces!==void 0&&(!Array.isArray(q.surfaces)||q.surfaces.some((X)=>typeof X!=="string"||X.trim().length===0)))throw Error(`Invalid tool registration "${q.toolId}": "surfaces" must be an array of non-empty strings.`);if(J&&!q.surfaces?.length)throw Error(`Invalid tool registration "${q.toolId}": region tools must declare at least one host surface in "surfaces".`);if(J&&typeof q.renderSurface!=="function")throw Error(`Invalid tool registration "${q.toolId}": region tools must implement "renderSurface".`);if(q.resolvesWithoutGrant!==void 0&&typeof q.resolvesWithoutGrant!=="boolean")throw Error(`Invalid tool registration "${q.toolId}": "resolvesWithoutGrant" must be a boolean.`);if(q.resolvesWithoutGrant&&!q.requiresAuthoredContent)throw Error(`Invalid tool registration "${q.toolId}": "resolvesWithoutGrant" requires "requiresAuthoredContent".`);if(q.renderSurface!==void 0&&typeof q.renderSurface!=="function")throw Error(`Invalid tool registration "${q.toolId}": "renderSurface" must be a function.`);if(q.renderSurface&&!q.surfaces?.length)throw Error(`Invalid tool registration "${q.toolId}": "renderSurface" requires at least one entry in "surfaces".`);if(q.singletonScope!==void 0&&q.singletonScope!=="section")throw Error(`Invalid tool registration "${q.toolId}": unsupported singletonScope "${String(q.singletonScope)}".`);if(q.activation==="selection-gateway"&&q.singletonScope!=="section")throw Error(`Invalid tool registration "${q.toolId}": selection-gateway tools must declare singletonScope "section".`);if(q.activation!=="region"&&typeof q.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${q.toolId}": "isVisibleInContext" must be a function.`);if(q.isVisibleInContext!==void 0&&typeof q.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${q.toolId}": "isVisibleInContext" must be a function when present.`);if(q.isApplicableToContent!==void 0&&typeof q.isApplicableToContent!=="function")throw Error(`Invalid tool registration "${q.toolId}": "isApplicableToContent" must be a function when present.`);if(q.requiresAuthoredContent!==void 0){if(typeof q.requiresAuthoredContent!=="object"||q.requiresAuthoredContent===null||typeof q.requiresAuthoredContent.resolve!=="function")throw Error(`Invalid tool registration "${q.toolId}": "requiresAuthoredContent" must be an object with a "resolve" function.`)}if(q.renderToolbar!==void 0){if(typeof q.renderToolbar!=="function")throw Error(`Invalid tool registration "${q.toolId}": "renderToolbar" must be a function.`)}else if(!J)throw Error(`Invalid tool registration "${q.toolId}": "renderToolbar" must be a function.`)}class m{tools=new Map;componentOverrides={};watchedUndefinedToolElements=new Set;moduleLoaders=new Map;loadedToolModules=new Set;warnedLoaderReplacements=new Set;warnedUnregisteredAllowedTools=new Set;moduleLoadPromises=new Map;changeListeners=new Set;emitChange(q){for(let J of this.changeListeners)try{J(q)}catch(Q){console.warn("[ToolRegistry] change listener failed:",Q)}}onRegistryChange(q){this.changeListeners.add(q);let J=!0;return()=>{if(!J)return;J=!1,this.changeListeners.delete(q)}}normalizeToolId(q){return q.trim()}normalizeToolIds(q){return q.map((J)=>this.normalizeToolId(J))}register(q){if(Z(q),this.tools.has(q.toolId))throw Error(`Tool '${q.toolId}' is already registered`);this.tools.set(q.toolId,q),this.emitChange({kind:"register",toolIds:[q.toolId]})}override(q){if(Z(q),!this.tools.has(q.toolId))throw Error(`Cannot override non-existent tool '${q.toolId}'`);this.tools.set(q.toolId,q),this.emitChange({kind:"override",toolIds:[q.toolId]})}unregister(q){if(!this.tools.has(q))return;this.tools.delete(q),this.emitChange({kind:"unregister",toolIds:[q]})}get(q){return this.tools.get(q)}has(q){return this.tools.has(q)}getAllToolIds(){return Array.from(this.tools.keys())}getAllTools(){return Array.from(this.tools.values())}getToolsByLevel(q){return this.getAllTools().filter((J)=>J.supportedLevels.includes(q))}getToolActivation(q){return this.get(q)?.activation||"toolbar-toggle"}getToolSingletonScope(q){return this.get(q)?.singletonScope||null}getToolsBySurface(q){if(!q)return[];return this.getAllTools().filter((J)=>typeof J.renderSurface==="function"&&J.surfaces?.includes(q))}getContentDependentSupportIds(){return this.getAllTools().filter((q)=>q.requiresAuthoredContent).map((q)=>q.toolId).sort()}filterToolIdsByActivation(q,J){return q.filter((Q)=>this.getToolActivation(Q)===J)}filterVisibleInContext(q,J,Q=w){let X=[];for(let $ of q){let Y=this.get($);if(!Y){if(!this.warnedUnregisteredAllowedTools.has($))this.warnedUnregisteredAllowedTools.add($),console.warn(`Tool '${$}' is allowed but not registered`);continue}if(!Y.supportedLevels.includes(J.level))continue;try{if(Y.isVisibleInContext?.(J))X.push(Y)}catch(j){Q($,"tool-visibility",j)}}return X}isApplicableToAnyContext(q,J,Q=w){let X=this.get(q);if(!X?.isApplicableToContent)return!0;if(J.length===0)return!0;return J.some(($)=>{try{return X.isApplicableToContent?.($)??!0}catch(Y){return Q(q,"tool-applicability",Y),!0}})}filterDecidedToolIds(q,J,Q,X=w){let $=new Set,Y=[];for(let H of q){let W=this.normalizeToolId(H.toolId);if(!W)continue;if(H.required||H.alwaysAvailable)$.add(W);if(Y.includes(W))continue;if(!this.get(W)?.supportedLevels.includes(J))continue;Y.push(W)}if(J==="section")return Y;let j=new Set(Q.length===0?Y:Y.filter((H)=>$.has(H)));for(let H of Q){let W=Y.filter((U)=>!j.has(U));for(let U of this.filterVisibleInContext(W,H,X))j.add(U.toolId)}return Y.filter((H)=>j.has(H)&&this.isApplicableToAnyContext(H,Q,X))}getToolMetadata(){return this.getAllTools().map((q)=>({toolId:q.toolId,name:q.name,description:q.description,supportedLevels:q.supportedLevels,activation:q.activation||"toolbar-toggle",singletonScope:q.singletonScope||null,surfaces:q.surfaces||[],requiresAuthoredContent:Boolean(q.requiresAuthoredContent),contentDependencyDescription:q.requiresAuthoredContent?.description??null}))}clear(){let q=this.getAllToolIds();if(q.length===0)return;this.tools.clear(),this.emitChange({kind:"clear",toolIds:q})}setComponentOverrides(q){if(this.componentOverrides===q)return;this.componentOverrides=q,this.emitChange({kind:"component-overrides",toolIds:[]})}setToolModuleLoaders(q){let J=Object.entries(q).filter((X)=>X[1]!==void 0);for(let[X,$]of J)if(G(X,"tool module loader id"),typeof $!=="function")throw Error(`Invalid tool module loader for "${X}": expected a function.`);let Q=[];for(let[X,$]of J){if(this.moduleLoaders.get(X)===$)continue;if(this.loadedToolModules.has(X)||this.moduleLoadPromises.has(X)){this.warnLoaderReplacedAfterLoad(X);continue}this.moduleLoaders.set(X,$),Q.push(X)}if(Q.length>0)this.emitChange({kind:"module-loaders",toolIds:Q})}warnLoaderReplacedAfterLoad(q){if(this.warnedLoaderReplacements.has(q))return;this.warnedLoaderReplacements.add(q),console.warn(`[ToolRegistry] Ignored a new module loader for "${q}": its module already loaded, so the elements it defines stay in place. Register loaders before the tool first renders.`)}async ensureToolModuleLoaded(q){if(this.loadedToolModules.has(q))return;let J=this.moduleLoadPromises.get(q);if(J){await J;return}let Q=this.moduleLoaders.get(q);if(!Q){this.watchUndefinedToolElement(q);return}let X=(async()=>{await Q(),this.loadedToolModules.add(q),this.warnIfLoadedToolElementUndefined(q)})();this.moduleLoadPromises.set(q,X);try{await X}finally{this.moduleLoadPromises.delete(q)}}undefinedToolElementTag(q){if(typeof customElements>"u"||typeof document>"u")return null;let J=this.componentOverrides;if(J.toolComponentFactories?.[q])return null;let Q;try{Q=E(q,J)}catch{return null}return customElements.get(Q)?null:Q}warnIfLoadedToolElementUndefined(q){let J=this.undefinedToolElementTag(q);if(!J)return;z(document,`loadedToolElementUndefined.${q}.${J}`,`[ToolRegistry] Tool "${q}" renders <${J}>, but its module loader finished without defining it, so the tool renders blank. The tag map and the loader disagree: map "${q}" to the tag its loader defines, or register a loader that defines <${J}>. Reported once per page.`)}watchUndefinedToolElement(q){if(this.watchedUndefinedToolElements.has(q))return;let J=this.undefinedToolElementTag(q);if(!J)return;this.watchedUndefinedToolElements.add(q);let Q=document,X=setTimeout(()=>{if(customElements.get(J))return;z(Q,`undefinedToolElement.${q}`,`[ToolRegistry] Tool "${q}" renders <${J}>, which is still undefined after ${D/1000} s, and its registry has no module loader for it. Register one with setToolModuleLoaders or import the tool's package before it renders; a registry from createPackagedToolRegistry has the packaged loaders unless its toolModuleLoaders replaced them. Reported once per page.`)},D);customElements.whenDefined(J).then(()=>clearTimeout(X))}async ensureToolModulesLoaded(q){let J=await f(q.map((X)=>this.ensureToolModuleLoaded(X))),Q=new Map;return J.forEach((X,$)=>{if(X.status==="rejected")Q.set(q[$],X.reason)}),Q}isToolModuleLoaded(q){return this.loadedToolModules.has(q)}renderForToolbar(q,J,Q){let X=this.get(q);if(!X)throw Error(`Tool '${q}' is not registered`);if(typeof X.renderToolbar!=="function")throw Error(`Tool '${q}' has activation "${X.activation||"toolbar-toggle"}" and renders into a host surface, not a toolbar. Remove it from toolbar placement.`);let $={...Q,componentOverrides:this.mergeComponentOverrides(Q.componentOverrides)};return X.renderToolbar(J,$)}renderForSurface(q,J){let Q=this.get(q);if(!Q)throw Error(`Tool '${q}' is not registered`);if(typeof Q.renderSurface!=="function")throw Error(`Tool '${q}' does not render into a host surface. Surface capabilities declare "surfaces" and implement "renderSurface".`);return Q.renderSurface({...J,componentOverrides:this.mergeComponentOverrides(J.componentOverrides)})}mergeComponentOverrides(q){return{...this.componentOverrides||{},...q||{}}}}var K={assessment:[],section:[],item:[],passage:[],rubric:[],element:[]};import{isPlainRecord as B}from"@pie-players/pie-players-shared/object";var u={section:[...K.section],item:[...K.item],passage:[...K.passage]};function F(q,J){if(q==null)return[];if(!Array.isArray(q))throw Error(`Invalid tools config at "${J}": expected an array of tool ids.`);if(q.find((X)=>typeof X!=="string")!==void 0)throw Error(`Invalid tools config at "${J}": all entries must be strings.`);return q}function v(q){if(q==null)return;if(!B(q))throw Error('Invalid tools config at "placement": expected an object with section/item/passage arrays.');return q}function c(q){if(q==null)return;if(!B(q))throw Error('Invalid tools config at "policy": expected an object with allowed/blocked arrays.');return q}function y(q,J){if(J==null)return;if(!B(J))throw Error(`Invalid tools config at "providers.${q}": expected an object.`);let Q=J;if("enabled"in Q&&Q.enabled!==void 0&&typeof Q.enabled!=="boolean")throw Error(`Invalid tools config at "providers.${q}.enabled": expected a boolean.`);if("settings"in Q&&Q.settings!==void 0&&!B(Q.settings))throw Error(`Invalid tools config at "providers.${q}.settings": expected an object.`);if("provider"in Q&&Q.provider!==void 0&&!B(Q.provider))throw Error(`Invalid tools config at "providers.${q}.provider": expected an object.`);return Q}function I(q){if(q==null)return{};if(!B(q))throw Error('Invalid tools config at "providers": expected an object keyed by tool id.');let J={};for(let[Q,X]of Object.entries(q))J[Q]=y(Q,X);return J}function M(q){if(!q||q.length===0)return[];let J=new Set;for(let Q of q){if(typeof Q!=="string")throw Error("Invalid tools config: tool list entries must be strings.");let X=Q.trim();if(!X)continue;J.add(X)}return Array.from(J)}function Hq(q){if(!q)return[];return M(q.split(",").map((J)=>J.trim()).filter(Boolean))}function g(q,J){if(q==null)return;if(q==="on"||q==="off")return q;throw Error(`Invalid tools config at "${J}": expected "on" or "off", got ${JSON.stringify(q)}.`)}function A(q,J){let Q=M(F(q?.[J],`placement.${J}`));return Q.length?Q:[...u[J]]}function Wq(q){if(q!=null&&!B(q))throw Error('Invalid tools config: expected an object with "policy", "placement", and "providers".');let J=c(q?.policy),Q=v(q?.placement),X=I(q?.providers),$=g(q?.pnpEnforcement,"pnpEnforcement"),Y={policy:{allowed:M(F(J?.allowed,"policy.allowed")),blocked:M(F(J?.blocked,"policy.blocked"))},placement:{section:A(Q,"section"),item:A(Q,"item"),passage:A(Q,"passage")},providers:X};if($)Y.pnpEnforcement=$;return Y}
|
|
2
|
+
export{d as o,O as p,N as q,m as r,M as s,Hq as t,Wq as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
export{z as
|
|
1
|
+
import{sa as w}from"./ItemToolBar-xwjrpdmz.js";var y={base:()=>import("speech-rule-engine/lib/mathmaps/base.json"),en:()=>import("speech-rule-engine/lib/mathmaps/en.json"),es:()=>import("speech-rule-engine/lib/mathmaps/es.json")},D=async(f)=>{if(!Object.hasOwn(y,f))throw Error(`no speech-rule-engine locale table is packaged for "${f}"; name a source with mathSpeech.engineOptions.json or .custom`);return(await y[f]()).default},G=()=>typeof window<"u"&&typeof window.document<"u"||typeof globalThis.DedicatedWorkerGlobalScope<"u",z=(f={})=>{let{json:q,custom:v}=f;if(q||v)return{...q?{json:q}:{},...v?{custom:v}:{}};return G()?{custom:D}:{}},x,H=(f)=>{x=z(f)},I=()=>{return x??=z(),x};
|
|
2
|
+
export{z as pa,H as qa,I as ra};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import{o as O6,p as G6,r as F6,t as P6}from"./ItemToolBar-n05xjkp8.js";import{$ as i,A as h,B as QJ,C as l,D as K6,E as sJ,F as yJ,H as SZ,I as $,J as o,K as J,M as UZ,N as X6,O as LJ,P as xJ,Q as y,S as NJ,T as V6,U as YZ,V as Q0,X as Q6,Y as LZ,Z as U0,_ as OJ,aa as BJ,ba as U6,ca as u,da as Y6,ea as L6,ja as q6,ka as D6,ma as Y0,na as N6,oa as l0,v as _Z,w as GJ,x as Z6,y as j6,z as N}from"./ItemToolBar-f971t0cw.js";import{ContextProvider as N9}from"@pie-players/pie-context";function K0(D,L,R,H){if(typeof D?.reportToolFailure==="function"){D.reportToolFailure(L,R,H);return}console.error(`[${L}] ${R} failed:`,H)}function X0(D){return typeof D.href==="string"}function a0(D){if(!D||typeof D!=="object"||Array.isArray(D))return!1;let L=D;if(typeof L.id!=="string"||L.id.trim().length===0)return!1;if(typeof L.label!=="string"||L.label.trim().length===0)return!1;if(L.ariaLabel!==void 0&&typeof L.ariaLabel!=="string")return!1;if(L.icon!==void 0&&typeof L.icon!=="string")return!1;if(L.tooltip!==void 0&&typeof L.tooltip!=="string")return!1;if(L.active!==void 0&&typeof L.active!=="boolean")return!1;if(L.disabled!==void 0&&typeof L.disabled!=="boolean")return!1;let R=typeof L.href==="string",H=typeof L.onClick==="function";return R!==H}function i0(D){return typeof D==="string"&&D.trimStart().startsWith("<svg")}function s0(D){return typeof D==="string"&&D.trimStart().startsWith("http")}import{resolveEsmPackageFileUrl as F9}from"@pie-players/pie-players-shared/loaders";import{sanitizeSvgIcon as n0}from"@pie-players/pie-players-shared/security";import{resolveInterfaceI18n as P9,stampInterfaceLocale as W9}from"@pie-players/pie-players-shared/i18n/provider";import{collectFocusable as M9,createFocusTrap as R9,createPointerGesture as k9,FOCUSABLE_SELECTOR as z9,isProgrammaticFocusTarget as H9}from"@pie-players/pie-players-shared";var K9={calculator:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 2h10a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm0 2v4h10V4H7Zm0 6v2h2v-2H7Zm4 0v2h2v-2h-2Zm4 0v2h2v-2h-2Zm-8 4v2h2v-2H7Zm4 0v2h2v-2h-2Zm4 0v2h2v-2h-2Zm-8 4v2h2v-2H7Zm4 0v2h2v-2h-2Zm4 0v2h2v-2h-2Z" fill="currentColor"/></svg>',"volume-up":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 3.23v2.06A7.002 7.002 0 0 1 19 12a7 7 0 0 1-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77Zm-2 17.75V3L7 8H3v8h4l5 5Zm4.5-9a4.5 4.5 0 0 0-2.5-4.03v8.05A4.5 4.5 0 0 0 16.5 12Z" fill="currentColor"/></svg>',swatch:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 3a9 9 0 1 0 9 9c0-.55-.45-1-1-1h-2.5a1.5 1.5 0 0 1 0-3H20a1 1 0 0 0 1-1 8.99 8.99 0 0 0-9-4Zm-5.5 9A1.5 1.5 0 1 1 8 13.5 1.5 1.5 0 0 1 6.5 12Zm3-4A1.5 1.5 0 1 1 11 9.5 1.5 1.5 0 0 1 9.5 8Zm5 0A1.5 1.5 0 1 1 16 9.5 1.5 1.5 0 0 1 14.5 8Z" fill="currentColor"/></svg>',"chart-bar":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4.75 5a.76.76 0 0 1 .75.75v11c0 .438.313.75.75.75h13a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-13C5 19 4 18 4 16.75v-11A.74.74 0 0 1 4.75 5ZM8 8.25a.74.74 0 0 1 .75-.75h6.5a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-6.5A.722.722 0 0 1 8 8.25Zm.75 2.25h4.5a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-4.5a.723.723 0 0 1-.75-.75.74.74 0 0 1 .75-.75Zm0 3h8.5a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-8.5a.723.723 0 0 1-.75-.75.74.74 0 0 1 .75-.75Z" fill="currentColor"/></svg>',beaker:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 21c-.85 0-1.454-.38-1.813-1.137-.358-.759-.27-1.463.263-2.113L9 11V5H8a.968.968 0 0 1-.713-.287A.968.968 0 0 1 7 4c0-.283.096-.52.287-.712A.968.968 0 0 1 8 3h8c.283 0 .52.096.712.288.192.191.288.429.288.712s-.096.52-.288.713A.968.968 0 0 1 16 5h-1v6l5.55 6.75c.533.65.62 1.354.262 2.113C20.454 20.62 19.85 21 19 21H5Zm2-3h10l-3.4-4h-3.2L7 18Zm-2 1h14l-6-7.3V5h-2v6.7L5 19Z" fill="currentColor"/></svg>',protractor:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m6.75 21-.25-2.2 2.85-7.85a3.95 3.95 0 0 0 1.75.95l-2.75 7.55L6.75 21Zm10.5 0-1.6-1.55-2.75-7.55a3.948 3.948 0 0 0 1.75-.95l2.85 7.85-.25 2.2ZM12 11a2.893 2.893 0 0 1-2.125-.875A2.893 2.893 0 0 1 9 8c0-.65.188-1.23.563-1.737A2.935 2.935 0 0 1 11 5.2V3h2v2.2c.583.2 1.063.554 1.438 1.063C14.812 6.77 15 7.35 15 8c0 .833-.292 1.542-.875 2.125A2.893 2.893 0 0 1 12 11Zm0-2c.283 0 .52-.096.713-.287A.967.967 0 0 0 13 8a.967.967 0 0 0-.287-.713A.968.968 0 0 0 12 7a.968.968 0 0 0-.713.287A.967.967 0 0 0 11 8c0 .283.096.52.287.713.192.191.43.287.713.287Z" fill="currentColor"/></svg>',"bars-3":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.85 15c.517 0 .98-.15 1.388-.45.408-.3.695-.692.862-1.175l.375-1.15c.267-.8.2-1.537-.2-2.213C8.875 9.337 8.3 9 7.55 9H4.025l.475 3.925c.083.583.346 1.075.787 1.475.442.4.963.6 1.563.6Zm10.3 0c.6 0 1.12-.2 1.563-.6.441-.4.704-.892.787-1.475L19.975 9h-3.5c-.75 0-1.325.342-1.725 1.025-.4.683-.467 1.425-.2 2.225l.35 1.125c.167.483.454.875.862 1.175.409.3.871.45 1.388.45Zm-10.3 2c-1.1 0-2.063-.363-2.887-1.088a4.198 4.198 0 0 1-1.438-2.737L2 9H1V7h6.55c.733 0 1.404.18 2.013.537A3.906 3.906 0 0 1 11 9h2.025c.35-.617.83-1.104 1.438-1.463A3.892 3.892 0 0 1 16.474 7H23v2h-1l-.525 4.175a4.198 4.198 0 0 1-1.438 2.737A4.238 4.238 0 0 1 17.15 17c-.95 0-1.804-.27-2.562-.813A4.234 4.234 0 0 1 13 14.026l-.375-1.125a21.35 21.35 0 0 1-.1-.363 4.926 4.926 0 0 1-.1-.537h-.85c-.033.2-.067.363-.1.488a21.35 21.35 0 0 1-.1.362L11 14a4.3 4.3 0 0 1-1.588 2.175A4.258 4.258 0 0 1 6.85 17Z" fill="currentColor"/></svg>',"magnifying-glass":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27A6.47 6.47 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16a6.47 6.47 0 0 0 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5Zm-6 0A4.5 4.5 0 1 1 14 9.5 4.49 4.49 0 0 1 9.5 14ZM12 10h-2v2H9v-2H7V9h2V7h1v2h2v1Z" fill="currentColor"/></svg>',ruler:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m8.8 10.95 2.15-2.175-1.4-1.425-1.1 1.1-1.4-1.4 1.075-1.1L7 4.825 4.825 7 8.8 10.95Zm8.2 8.225L19.175 17l-1.125-1.125-1.1 1.075-1.4-1.4 1.075-1.1-1.425-1.4-2.15 2.15L17 19.175ZM7.25 21H3v-4.25l4.375-4.375L2 7l5-5 5.4 5.4 3.775-3.8c.2-.2.425-.35.675-.45a2.068 2.068 0 0 1 1.55 0c.25.1.475.25.675.45L20.4 4.95c.2.2.35.425.45.675.1.25.15.508.15.775a1.975 1.975 0 0 1-.6 1.425l-3.775 3.8L22 17l-5 5-5.375-5.375L7.25 21ZM5 19h1.4l9.8-9.775L14.775 7.8 5 17.6V19Z" fill="currentColor"/></svg>',"book-open":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 6.25a6.6 6.6 0 0 0-2.3-1.32A8.6 8.6 0 0 0 7 4.5c-.63 0-1.25.06-1.85.18-.6.12-1.19.3-1.76.54a1.5 1.5 0 0 0-.93 1.4v10.1c0 .52.26.98.68 1.24.42.26.92.28 1.35.06.36-.18.75-.31 1.18-.4.42-.09.86-.13 1.33-.13.78 0 1.53.14 2.24.42.7.28 1.35.7 1.93 1.24l.83-.75.83.75c.58-.54 1.22-.96 1.93-1.24a6.1 6.1 0 0 1 2.24-.42c.47 0 .91.04 1.33.13.43.09.82.22 1.18.4.43.22.93.2 1.35-.06.42-.26.68-.72.68-1.24V6.62c0-.6-.36-1.15-.93-1.4a9.3 9.3 0 0 0-1.76-.54A9.8 9.8 0 0 0 17 4.5a8.6 8.6 0 0 0-2.7.43A6.6 6.6 0 0 0 12 6.25Zm1 10.06V8.02c.55-.5 1.16-.88 1.84-1.13A6 6 0 0 1 17 6.5c.45 0 .89.04 1.32.11.43.08.85.19 1.26.34v9.24a8.2 8.2 0 0 0-1.28-.24A10 10 0 0 0 17 15.85c-.72 0-1.42.09-2.09.26a7.7 7.7 0 0 0-1.91.8Zm-2 0a7.7 7.7 0 0 0-1.91-.8 8.4 8.4 0 0 0-2.09-.26c-.44 0-.87.02-1.3.07-.43.05-.86.13-1.28.24V6.95c.41-.15.83-.26 1.26-.34A7.7 7.7 0 0 1 7 6.5c.76 0 1.48.13 2.16.39.68.25 1.29.63 1.84 1.13Z" fill="currentColor"/></svg>',photo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 21c-.55 0-1.02-.2-1.41-.59A1.93 1.93 0 0 1 2 19V5c0-.55.2-1.02.59-1.41A1.93 1.93 0 0 1 4 3h16c.55 0 1.02.2 1.41.59.39.39.59.86.59 1.41v14c0 .55-.2 1.02-.59 1.41-.39.39-.86.59-1.41.59H4Zm0-2h16V5H4v14Zm1.5-2.5h13l-4.1-5.47-3.4 4.47-2.5-3.25L5.5 16.5ZM8.5 10a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z" fill="currentColor"/></svg>'};function d0(D){return K9[D]||null}import{runtimeElementTags as X9}from"@pie-players/pie-players-shared/pie";import{parseVersionedTagName as V9}from"@pie-players/pie-players-shared/pie/tag-names";function Q9(D){return D.level==="item"}function U9(D){return D.level==="passage"}function Y9(D){return D.level==="element"}function V0(D){if(Array.isArray(D))return D;if(D&&typeof D==="object")return Object.values(D);return[]}function L9(D,L){return V0(D).find((R)=>!!R&&typeof R==="object"&&R.id===L)}function q9(D,L){if(!L||typeof L!=="object")return;let R=L,H=R[D]??R[V9(D).baseName];return typeof H==="string"&&H?H:void 0}function D9(D){let L;try{L=D.pieSupports}catch{return}if(!Array.isArray(L))return;return L.filter((R)=>typeof R==="string")}function O9(D,L){if(!D||typeof D!=="object")return null;let{id:R,element:H}=D;if(typeof H!=="string"||!H)return null;let p=q9(H,L),FJ=X9(H,p),$J=typeof customElements>"u"?void 0:customElements;for(let IJ of FJ){let pJ=$J?.get(IJ);if(pJ)return{elementId:typeof R==="string"?R:void 0,tag:H,packageSpec:p,supports:D9(pJ),pendingTags:[]}}return{elementId:typeof R==="string"?R:void 0,tag:H,packageSpec:p,supports:void 0,pendingTags:$J?FJ:[]}}function r0(D){let L,R;if(Y9(D))L=D.item.config,R=[L9(L?.models,D.elementId)];else if(Q9(D))L=D.item?.config,R=V0(L?.models);else if(U9(D))L=D.passage?.config,R=V0(L?.models);else return[];return R.flatMap((H)=>{let p=O9(H,L?.elements);return p?[p]:[]})}function o0(){let D=null;return(L,R)=>{if(!L)return D=null,null;let H=L.visibleTools.map((p)=>({toolId:p.toolId,required:p.required,alwaysAvailable:p.alwaysAvailable,activateAtInit:p.activateAtInit,parameters:p.parameters}));if(D?.renderVersion===R&&l0(D.tools,H))return D.tools;return D={renderVersion:R,tools:H},H}}import"@pie-players/pie-players-shared/nds-icon-button";var G9=(D,L)=>{if(customElements.get(D))return;try{customElements.define(D,L)}catch(R){if(!(R instanceof DOMException&&R.name==="NotSupportedError"||R&&typeof R==="object"&&R.name==="NotSupportedError")||!customElements.get(D))throw R}},t0=(D,L=_Z)=>{var R=xJ(),H=yJ(R);{var p=(n)=>{var jJ=e0();Q0(jJ,()=>n0(L()),!0),GJ(jJ),y(n,jJ)},FJ=N(()=>i0(L())),$J=(n)=>{var jJ=w9();o(()=>i(jJ,"src",L())),y(n,jJ)},IJ=N(()=>s0(L())),pJ=(n)=>{let jJ=N(()=>d0(L()));var qZ=xJ(),DZ=yJ(qZ);{var EJ=(PJ)=>{var WJ=e0();Q0(WJ,()=>n0(J(jJ)),!0),GJ(WJ),y(PJ,WJ)},OZ=(PJ)=>{var WJ=B9();o(()=>OJ(WJ,1,`icon icon-${L()}`,"svelte-1c13522")),y(PJ,WJ)};NJ(DZ,(PJ)=>{if(J(jJ))PJ(EJ);else PJ(OZ,-1)})}y(n,qZ)};NJ(H,(n)=>{if(J(FJ))n(p);else if(J(IJ))n($J,1);else n(pJ,-1)})}y(D,R)},e0=LJ('<span aria-hidden="true"></span>'),w9=LJ('<img class="item-toolbar__icon-image svelte-1c13522" alt=""/>'),B9=LJ('<i aria-hidden="true"></i>'),J6=LJ("<span></span>"),I9=LJ('<span class="item-toolbar__nds-button-zoom svelte-1c13522"><nds-icon-button></nds-icon-button></span>',2),T9=LJ("<a><!></a>"),A9=LJ('<button type="button"><!></button>'),S9=LJ("<div></div>"),_9=LJ('<div><div class="item-toolbar__tools-row svelte-1c13522"><!> <!> <!></div> <!></div>'),C9={hash:"svelte-1c13522",code:`.item-toolbar.svelte-1c13522 {display:flex;flex-direction:column;align-items:flex-end;min-width:0;max-width:100%;gap:0;--pie-toolbar-tools-row-height: 2rem;--pie-tts-controls-row-height: 2.875rem;}.item-toolbar__tools-row.svelte-1c13522 {display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:0.5rem;max-width:100%;min-height:var(--pie-toolbar-tools-row-height);}
|
|
2
|
+
|
|
3
|
+
/* A granted section tool must stay reachable even when there isn't room for
|
|
4
|
+
every button: scroll the row rather than clipping items past the edge,
|
|
5
|
+
which left them impossible to focus, tab to, or click. \`min-width: 0\`
|
|
6
|
+
beats the flex default (\`auto\`, i.e. never shrink below content), which
|
|
7
|
+
would otherwise keep the row at full content width and make overflow-x
|
|
8
|
+
moot. Item and passage rows wrap without an overflow clip so an inline
|
|
9
|
+
reading-controls panel can still extend outside the row. */.item-toolbar[data-level="section"].svelte-1c13522 .item-toolbar__tools-row:where(.svelte-1c13522) {flex-wrap:nowrap;justify-content:flex-start;
|
|
10
|
+
/* Keep the focus outline inside the scrolling box on both axes. */padding:4px;scroll-padding:4px;box-sizing:border-box;overflow-x:auto;max-width:100%;min-width:0;}.item-toolbar__controls-row.svelte-1c13522 {display:flex;align-items:center;justify-content:flex-end;width:100%;min-height:0;height:auto;}.item-toolbar__controls-row--reserve.svelte-1c13522 {min-height:var(--pie-tts-controls-row-height);height:var(--pie-tts-controls-row-height);}.item-toolbar__controls-row--active.svelte-1c13522 {min-height:var(--pie-tts-controls-row-height);height:var(--pie-tts-controls-row-height);}.item-toolbar__controls-row--align-start.svelte-1c13522 {justify-content:flex-start;}.item-toolbar__controls-host.svelte-1c13522 {display:inline-flex;align-items:center;justify-content:flex-end;width:100%;}.item-toolbar--top.svelte-1c13522,
|
|
11
|
+
.item-toolbar--bottom.svelte-1c13522 {align-items:flex-end;}.item-toolbar--left.svelte-1c13522,
|
|
12
|
+
.item-toolbar--right.svelte-1c13522 {align-items:stretch;}.item-toolbar--left.svelte-1c13522 .item-toolbar__tools-row:where(.svelte-1c13522),
|
|
13
|
+
.item-toolbar--right.svelte-1c13522 .item-toolbar__tools-row:where(.svelte-1c13522) {flex-direction:column;align-items:center;justify-content:flex-start;flex-wrap:nowrap;}.item-toolbar--left.svelte-1c13522 .item-toolbar__controls-row:where(.svelte-1c13522),
|
|
14
|
+
.item-toolbar--right.svelte-1c13522 .item-toolbar__controls-row:where(.svelte-1c13522) {justify-content:flex-start;width:auto;min-height:0;height:auto;}.item-toolbar__button.svelte-1c13522 {display:flex;flex-shrink:0;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0.25rem;border:1px solid var(--pie-button-border, var(--pie-border, #ccc));border-radius:0.25rem;background-color:var(--pie-button-bg, var(--pie-background, white));color:var(--pie-button-color, var(--pie-text, #333));cursor:pointer;transition:all 0.15s ease;text-decoration:none;}
|
|
15
|
+
|
|
16
|
+
/* Drive the vendored NDS icon button's outer size via its own \`--height-32\`
|
|
17
|
+
custom property so its light-DOM inner button matches the toolbar's
|
|
18
|
+
md/sm/lg dimensions (32 / 44 / 40 px) without a layout shift. The glyph
|
|
19
|
+
keeps the NDS-native icon size (we render size="small"), so it isn't
|
|
20
|
+
oversized. */.item-toolbar__nds-button-zoom.svelte-1c13522 {display:inline-flex;flex-shrink:0;}.item-toolbar.svelte-1c13522 nds-icon-button:where(.svelte-1c13522) {
|
|
21
|
+
/* Host-settable button size per toolbar size (drives the NDS outer button
|
|
22
|
+
via its own --height-32). */--height-32: var(--pie-calculator-button-size, 2rem);
|
|
23
|
+
/* Host-settable accent for the calculator button: the NDS tertiary glyph
|
|
24
|
+
colour derives from --color-interactive-blue, remapped here to a
|
|
25
|
+
themeable variable. --pie-calculator-button-color is package-private, so
|
|
26
|
+
nothing sets it and the default is what ships: it now resolves through
|
|
27
|
+
--pie-button-color (DaisyUI base-content) instead of holding the Figma
|
|
28
|
+
blue on every theme, with the literal as the no-theme last resort.
|
|
29
|
+
Not --pie-primary or --pie-tertiary: both are \`direct\` mappings of
|
|
30
|
+
DaisyUI slots chosen to pair with their own -content colour, so a glyph
|
|
31
|
+
taken from either sits at 1.37:1 against the page under \`pastel\` and 11
|
|
32
|
+
of the 35 shipped themes fall under SC 1.4.11's 3:1. */--color-interactive-blue: var(--pie-calculator-button-color, var(--pie-button-color, var(--pie-text, #222)));
|
|
33
|
+
/* NDS palette bridge — keep in sync with the copies in tool-tts-inline
|
|
34
|
+
and section-player SectionItemsPane (asserted by
|
|
35
|
+
scripts/check-theme-tokens.mjs). The vendored button paints its fill,
|
|
36
|
+
its on-accent glyph, its hover ring and its focus ring from the NDS
|
|
37
|
+
design-system palette, which no PIE theme sets, so a tertiary button
|
|
38
|
+
kept a #f3f5f7 pill on every page — and once the glyph followed the
|
|
39
|
+
theme, a light glyph landed on that light pill. */--color-new-gray: var(--pie-background-dark, #f3f5f7);--color-primary-white: var(--pie-white, #ffffff);--color-primary-black: var(--pie-text, #000000);--color-focus-blue: var(--pie-button-focus-outline, #2b87ff);}.item-toolbar--sm.svelte-1c13522 nds-icon-button:where(.svelte-1c13522) {--height-32: var(--pie-calculator-button-size-sm, 2.75rem);}.item-toolbar--lg.svelte-1c13522 nds-icon-button:where(.svelte-1c13522) {--height-32: var(--pie-calculator-button-size-lg, 2.5rem);}.item-toolbar__element-host.svelte-1c13522 {display:contents;}.item-toolbar--sm.svelte-1c13522 .item-toolbar__button:where(.svelte-1c13522) {width:2.75rem;height:2.75rem;}.item-toolbar--sm.svelte-1c13522 {--pie-toolbar-tools-row-height: 2.75rem;--pie-tts-controls-row-height: 3.625rem;}.item-toolbar--lg.svelte-1c13522 .item-toolbar__button:where(.svelte-1c13522) {width:2.5rem;height:2.5rem;}.item-toolbar--lg.svelte-1c13522 {--pie-toolbar-tools-row-height: 2.5rem;--pie-tts-controls-row-height: 3.375rem;}.item-toolbar__button.svelte-1c13522:hover:not(:disabled) {background-color:var(--pie-button-hover-bg, var(--pie-secondary-background, #f5f5f5));border-color:var(--pie-button-hover-border, var(--pie-button-border, var(--pie-border, #ccc)));color:var(--pie-button-hover-color, var(--pie-button-color, var(--pie-text, #333)));transform:translateY(-1px);box-shadow:0 2px 4px color-mix(in srgb, var(--pie-black, #000) 10%, transparent);}.item-toolbar__button.svelte-1c13522:active:not(:disabled) {transform:translateY(0);box-shadow:none;}.item-toolbar__button--active.svelte-1c13522 {background-color:var(--pie-primary, #1976d2);color:var(--pie-white, #fff);border-color:var(--pie-primary, #1976d2);}.item-toolbar__button--active.svelte-1c13522:hover:not(:disabled) {background-color:var(--pie-primary-dark, #1565c0);}.item-toolbar__button.svelte-1c13522:focus-visible {outline:2px solid var(--pie-button-focus-outline, var(--pie-primary, #1976d2));outline-offset:2px;}.item-toolbar__button.svelte-1c13522:disabled {opacity:0.5;cursor:not-allowed;}.item-toolbar__button.svelte-1c13522 svg {width:100%;height:100%;}.item-toolbar__icon-image.svelte-1c13522 {width:100%;height:100%;object-fit:contain;}`};function W6(D,L){Z6(L,!0),Q6(D,C9);let R=(Z,j=_Z,K=_Z)=>{var X=xJ(),G=yJ(X);{var z=(W)=>{var S=xJ(),k=yJ(S);V6(k,()=>J(MZ),(O)=>{var e=J6();LZ(e,(JJ,d)=>a6?.(JJ,d),()=>({mounted:j(),active:J(iZ)[j().toolId]??!1,runtime:J(B),i18n:J(RZ)})),o(()=>OJ(e,1,U0(K()),"svelte-1c13522")),y(O,e)}),y(W,S)},q=(W)=>{var S=J6();LZ(S,(k,O)=>c6?.(k,O),()=>j().entry),o(()=>OJ(S,1,U0(K()),"svelte-1c13522")),y(W,S)};NJ(G,(W)=>{if(j().entry.shell)W(z);else W(q,-1)})}y(Z,X)},H=typeof window<"u",p="@fortawesome/fontawesome-free@6.5.2/css/all.min.css",FJ=/font.?awesome|fa-?pro/i,$J=/fontawesome-free/i,IJ=()=>Array.from(document.querySelectorAll('link[rel="stylesheet"][href]')),pJ=()=>IJ().some((Z)=>FJ.test(Z.href)&&!$J.test(Z.href)),n=(Z,j)=>{let K=pJ()?j:"fa-solid";if(K==="fa-light")return()=>{};let X=()=>{for(let z of Z.querySelectorAll("i.fa-light"))z.classList.remove("fa-light"),z.classList.add(K)};X();let G=new MutationObserver(X);return G.observe(Z,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),()=>G.disconnect()},jJ=(Z,j)=>{let K=()=>{for(let G of Z.querySelectorAll("i.nds-icon-button__icon"))G.style.rotate=j};K();let X=new MutationObserver(K);return X.observe(Z,{childList:!0,subtree:!0}),()=>X.disconnect()},qZ=(Z)=>{if(document.querySelector(`link[href="${Z}"]`))return;let j=document.createElement("link");j.rel="stylesheet",j.href=Z,j.addEventListener("error",()=>{j.dataset.pieLoadFailed=""},{once:!0}),document.head.appendChild(j)},DZ=!1,EJ=()=>{if(!H||DZ)return;if(DZ=!0,IJ().some((j)=>FJ.test(j.href)))return;qZ(F9(J(B)?.itemPlayer?.loaderOptions,p))},OZ="__pieFaToolbarShadowInstalled",PJ=(Z)=>{let j=Z.getRootNode();if(!(j instanceof ShadowRoot))return;let K=j;if(K[OZ])return;K[OZ]=!0;let X=new Set,G=(q)=>{if(!q||X.has(q))return;X.add(q);let W=document.createElement("link");W.rel="stylesheet",W.href=q,j.appendChild(W)},z=IJ().filter((q)=>FJ.test(q.href));for(let q of z){if("pieLoadFailed"in q.dataset)continue;if(q.sheet){G(q.href);continue}let W=(S)=>{if(q.removeEventListener("load",W),q.removeEventListener("error",W),S.type==="load")G(q.href)};q.addEventListener("load",W),q.addEventListener("error",W)}},WJ=(Z)=>{return EJ(),PJ(Z),{destroy:n(Z,"fa-light")}},M6=(Z,j)=>{let K=j,X=()=>{let z=Z.querySelector("button");if(z)z.setAttribute("aria-pressed",K?"true":"false")};X();let G=new MutationObserver(X);return G.observe(Z,{childList:!0,subtree:!0}),{update(z){K=z,X()},destroy(){G.disconnect()}}},L0=(Z)=>Z.faIconName||null,R6=new F6,TJ=QJ(K6({})),vJ=u(L,"level",7,"item"),GZ=u(L,"scopeId",7,""),CZ=u(L,"itemId",7,""),fZ=u(L,"sectionId",7,""),bZ=u(L,"catalogId",7,""),yZ=u(L,"tools",7,""),xZ=u(L,"contentKind",7,"assessment-item"),MJ=u(L,"position",7,"bottom"),NZ=u(L,"scopeElement",7,null),FZ=u(L,"toolRegistry",7,null),$Z=u(L,"item",7,null),PZ=u(L,"hostButtons",23,()=>[]),pZ=u(L,"class",7,""),WZ=u(L,"size",7,"md"),EZ=u(L,"language",7,""),KJ=QJ(null),B=QJ(null),MZ=N(()=>J(B)?.ndsIcons===!0),RZ=N(()=>P9(J(B))),k6=N(()=>EZ()||J(B)?.contentLanguage||void 0),gJ=QJ(null),dJ=QJ(0),rJ=QJ(0),vZ=QJ(0),gZ=QJ(0),mZ=QJ(0);$(()=>{if(!J(KJ))return;return q6(J(KJ),(Z)=>{l(B,Z,!0)})}),$(()=>{if(!J(KJ))return;return D6(J(KJ),(Z)=>{l(gJ,Z,!0)})}),$(()=>{let Z=J(B)?.toolkitCoordinator;if(!Z||typeof Z.onPolicyChange!=="function")return;let j=Z.onPolicyChange((K)=>{if(l(rJ,J(rJ)+1),K?.reason!=="item-settings")l(vZ,J(vZ)+1)});return()=>{try{j?.()}catch{}}}),$(()=>{let Z=J(B)?.toolkitCoordinator;if(!Z||typeof Z.onToolContextResolverChange!=="function")return;let j=Z.onToolContextResolverChange(()=>{l(gZ,J(gZ)+1)});return()=>{try{j?.()}catch{}}});let t=N(()=>J(B)?.toolCoordinator),z6=N(()=>J(B)?.ttsService),hZ=N(()=>J(B)?.elementToolStateStore),q0=N(()=>J(B)?.assessmentId??""),kZ=N(()=>CZ()||J(gJ)?.itemId||""),AJ=N(()=>J(gJ)?.canonicalItemId||J(kZ)),lJ=N(()=>fZ()||J(B)?.sectionId||""),oJ=N(()=>xZ()||J(gJ)?.contentKind||(vJ()==="section"?"section":"assessment-item")),A=N(()=>{if(vJ()&&vJ()!=="item")return vJ();if(J(oJ)==="rubric-block-stimulus")return"passage";return"item"}),RJ=N(()=>{if(GZ())return GZ();if(J(A)==="section")return J(lJ)||J(B)?.sectionId||"default-section";if(J(A)==="assessment")return J(B)?.assessmentId||"default-assessment";return J(AJ)||J(kZ)||"default-item"}),H6=N(()=>bZ()||J(RJ)),qJ=N(()=>$Z()||J(gJ)?.item||null),E=N(()=>{if(FZ())return FZ();return J(rJ),J(B)?.toolkitCoordinator?.getToolRegistry?.()||R6}),w6=N(()=>P6(yZ())),B6=N(()=>J(E).normalizeToolIds(J(w6)).filter(Boolean)),D0=N(()=>{if(J(A)==="section")return"section";if(J(A)==="passage"||J(oJ)==="rubric-block-stimulus")return"passage";return"item"}),O0=N(()=>{J(rJ);let Z=J(B)?.toolkitCoordinator;if(!Z||typeof Z.decideToolPolicy!=="function")return null;return Z.decideToolPolicy({level:J(D0),scope:{level:J(A),scopeId:J(RJ),assessmentId:J(B)?.assessmentId,sectionId:J(lJ)||void 0,itemId:J(kZ)||void 0,canonicalItemId:J(AJ)||void 0,contentKind:J(oJ)}})}),I6=o0(),nJ=N(()=>I6(J(O0),J(vZ))),tJ=N(()=>{let Z=(j)=>Array.from(new Set(j));if(J(nJ))return Z(J(E).normalizeToolIds(J(nJ).map((j)=>j.toolId)).filter(Boolean));return Z(J(B6))});$(()=>{if(!J(O0)||J(tJ).length===0)return;if(J(E).getAllTools().length>0)return;let Z=J(KJ)?.ownerDocument,j=J(tJ).join(", "),K=setTimeout(()=>{N6(Z,"toolbarWithoutRegistry",`[pie-item-toolbar] Policy places ${j} on this toolbar, but its tool registry is still empty after ${Y0/1000} s, so it renders no buttons. Pass a toolRegistry to <pie-assessment-toolkit> or its coordinator; @pie-players/pie-default-tool-loaders builds the stock one. Reported once per page.`)},Y0);return()=>clearTimeout(K)});let uZ=N(()=>{if(J(A)==="section"||J(A)==="assessment")return!0;let Z=J(qJ)?.config;return!!(J(qJ)&&Z&&typeof Z==="object")}),T6=N(()=>{J(rJ);let Z=J(B)?.toolkitCoordinator;if(!Z||typeof Z.getPolicyInputs!=="function")return null;return Z.getPolicyInputs()}),mJ=N(()=>J(T6)?.assessment??null),zZ=N(()=>({id:J(AJ)})),hJ=N(()=>{if(J(A)==="section")return{level:"section",assessment:J(mJ)||{},section:{}};if(J(A)==="assessment")return{level:"assessment",assessment:J(mJ)||{}};if(!J(uZ)||!J(qJ))return null;if(J(A)==="passage")return{level:"passage",assessment:J(mJ)||{},itemRef:J(zZ),passage:J(qJ)};return{level:"item",assessment:J(mJ)||{},itemRef:J(zZ),item:J(qJ)}}),G0=N(()=>{if(J(hJ))return J(hJ);return{level:"item",assessment:J(mJ)||{},itemRef:J(zZ),item:J(qJ)||{id:J(AJ),config:{}}}}),N0=N(()=>{if(J(A)!=="item"&&J(A)!=="passage")return[];if(!J(uZ)||!J(qJ))return[];let Z=J(qJ)?.config?.models;return(Array.isArray(Z)?Z:Z&&typeof Z==="object"?Object.values(Z):[]).filter((K)=>K&&typeof K==="object"&&typeof K.id==="string").map((K)=>({level:"element",assessment:J(mJ)||{},itemRef:J(zZ),item:J(qJ),elementId:K.id}))});function HZ(Z){return O6(Z,J(A),J(RJ))}let SJ=null;function F0(Z,j){if(SJ?.coordinator===Z)SJ.ids.add(j)}function cZ(Z,j){let K=HZ(j);if(!Z.getToolState(K))Z.registerTool(K,j);return F0(Z,K),K}$(()=>{let Z=J(t);if(J(A),J(RJ),!Z)return;let j={coordinator:Z,ids:new Set,activated:new Set};return SJ=j,()=>{if(SJ===j)SJ=null;for(let K of j.ids)Z.releaseTool(K)}});function A6(Z){if(!J(hZ)||!J(q0)||!J(lJ)||!J(AJ))return null;return J(hZ).getGlobalElementId({assessmentId:J(q0),sectionId:J(lJ),attemptId:J(B)?.attemptId??"",itemId:J(AJ),elementId:Z})}function S6(){if(NZ())return NZ();return J(gJ)?.scopeElement||null}function P0(){let Z=J(t)||null;return{scope:{level:J(A),scopeId:J(RJ),assessmentId:J(B)?.assessmentId,sectionId:J(lJ),itemId:J(kZ),canonicalItemId:J(AJ),contentKind:J(oJ)},itemId:J(RJ),catalogId:J(H6),language:J(k6),i18n:J(RZ),ui:{size:WZ()},getScopeElement:S6,getGlobalElementId:A6,toolCoordinator:Z,toolkitCoordinator:J(B)?.toolkitCoordinator||null,ttsService:J(z6)||null,elementToolStateStore:J(hZ)||null,toggleTool:(j)=>{if(!Z)return;Z.toggleTool(cZ(Z,j))},isToolVisible:(j)=>Z?.isToolVisible(HZ(j))??!1,subscribeVisibility:Z?(j)=>Z.subscribe(j):null}}let _6=N(P0),aZ=N(()=>{J(gZ);let Z=J(B)?.toolkitCoordinator;if(!Z||typeof Z.hasToolContextResolver!=="function"||typeof Z.resolveToolContext!=="function")return{};let j={};for(let K of J(tJ)){if(!J(E).get(K)?.supportedLevels.includes(J(A)))continue;if(!Z.hasToolContextResolver(K))continue;let G=Z.resolveToolContext({toolId:K,context:J(G0),toolbarContext:J(_6)});if(G)j[K]=G}return j}),C6=N(()=>{J(mZ);let Z=J(aZ),j=(J(nJ)??J(tJ).map((z)=>({toolId:z,required:!1,alwaysAvailable:!1,activateAtInit:!1}))).filter((z)=>!Z[J(E).normalizeToolId(z.toolId)]),K=!J(uZ)?[]:J(hJ)?[J(hJ),...J(N0)]:J(N0),X=(z,q,W)=>K0(J(B)?.toolkitCoordinator,z,q,W),G=new Set(J(E).filterDecidedToolIds(j,J(A),K,X));return J(tJ).filter((z)=>G.has(z)||Z[z]?.visible)});$(()=>{if(!H||!J(hJ)||typeof customElements>"u")return;let Z=new Set(r0(J(hJ)).flatMap((K)=>K.pendingTags));if(Z.size===0)return;let j=!1;for(let K of Z)customElements.whenDefined(K).then(()=>{if(!j)l(mZ,J(mZ)+1)},()=>{});return()=>{j=!0}});let eJ=QJ(null),uJ=N(()=>{let Z=J(eJ)?.registry===J(E)?J(eJ).toolIds:null,j=J(E).filterToolIdsByActivation(J(C6),"toolbar-toggle");return Z?j.filter((K)=>!Z.has(K)):j});$(()=>{if(!H)return;let Z=J(E),j=!1;return Z.ensureToolModulesLoaded(J(uJ)).then((K)=>{if(K.size>0){let X=J(eJ)?.registry===Z?J(eJ).toolIds:[];l(eJ,{registry:Z,toolIds:new Set([...X,...K.keys()])},!0);for(let[G,z]of K)K0(J(B)?.toolkitCoordinator,G,"tool-module-load",z)}if(!j)l(dJ,J(dJ)+1)}),()=>{j=!0}});let f6=N(()=>{let Z=new Map;for(let j of J(nJ)??[]){if(!j.parameters)continue;let[K]=J(E).normalizeToolIds([j.toolId]);if(K)Z.set(K,j.parameters)}return Z}),_J=N(()=>{let Z=J(f6);return{...P0(),getResolvedToolContext:(j)=>J(aZ)[j]??null,getToolParameters:(j)=>Z.get(J(E).normalizeToolId(j))??null,getToolRenderParams:(j)=>{let K=J(aZ)[j]?.params??null,X=W0.get(j);if(!X)return K;return{...K??{},...X}}}}),W0=new Map,M0=0,XJ=N(()=>{if(!H)return[];J(dJ);let Z=[];for(let j of J(uJ)){let K=J(E).renderForToolbar(j,J(G0),J(_J));if(K)Z.push(K)}return Z});$(()=>{let Z=J(t);if(!Z)return;for(let j of J(XJ))F0(Z,HZ(j.toolId))});let b6=N(()=>new Set(J(E).normalizeToolIds((J(nJ)??[]).filter((Z)=>Z.activateAtInit).map((Z)=>Z.toolId))));$(()=>{let Z=J(t),j=J(b6);J(A),J(RJ);let K=SJ;if(!Z||j.size===0||K?.coordinator!==Z)return;let X=J(XJ).filter((G)=>G.button&&j.has(G.toolId)).map((G)=>G.toolId).filter((G)=>!K.activated.has(G));if(X.length===0)return;for(let G of X)K.activated.add(G);queueMicrotask(()=>{if(SJ!==K)return;for(let G of X)Z.showTool(cZ(Z,G));CJ()})});let R0=N(()=>{if(!Array.isArray(PZ()))return[];let Z=[];return PZ().forEach((j,K)=>{if(a0(j)){Z.push(j);return}console.warn(`[ItemToolBar] Ignoring invalid host button at index ${K}. Expected { id, label, href | onClick } with valid types.`)}),Z}),y6=N(()=>J(XJ).filter((Z)=>!!Z.button).map((Z)=>{let j=Z.button;return{id:Z.toolId,label:j.label,ariaLabel:j.ariaLabel||j.label,icon:j.icon,faIconName:j.faIconName,tooltip:j.tooltip||j.label,disabled:j.disabled,active:J(TJ)[Z.toolId]??j.active??!1,onClick:()=>{j.onClick(),CJ()}}})),k0=N(()=>[...J(y6),...J(R0)]),iZ=N(()=>{let Z={};for(let j of J(XJ))Z[j.toolId]=J(TJ)[j.toolId]??j.button?.active??!1;return Z}),sZ=(Z,j,K)=>Z.flatMap((X)=>(X.elements||[]).filter((G)=>G.mount===j).filter((G)=>Boolean(G.element)).map((G,z)=>({key:`${K}-${X.toolId}-${z}`,toolId:X.toolId,entry:G}))),x6=N(()=>sZ(J(XJ),"before-buttons","before")),$6=N(()=>sZ(J(XJ),"after-buttons","after")),z0=N(()=>sZ(J(XJ),"controls-row","controls-row")),H0=N(()=>J(XJ).flatMap((Z)=>(Z.elements||[]).map((j)=>({toolId:Z.toolId,hint:j.layoutHints?.controlsRow})).filter((j)=>Boolean(j.hint)))),w0=N(()=>J(XJ).flatMap((Z)=>(Z.elements||[]).map((j)=>({toolId:Z.toolId,hint:j.layoutHints?.headerOverlay})).filter((j)=>Boolean(j.hint)))),B0=N(()=>J(H0).some((Z)=>Z.hint?.reserveSpace===!0)),I0=N(()=>J(H0).some((Z)=>Z.hint?.showWhenToolActive===!0&&(J(iZ)[Z.toolId]??!1))),p6=N(()=>MJ()==="left"||MJ()==="right"),T0=N(()=>J(w0).some((Z)=>Z.hint?.showWhenToolActive===!0&&(J(iZ)[Z.toolId]??!1))),E6=N(()=>J(z0).length>0||J(B0)||J(I0)),v6=N(()=>J(uJ).length===0&&J(R0).length===0);function g6(){if(!J(KJ))return null;let Z=J(KJ).getRootNode();if(Z instanceof ShadowRoot)return Z.host;return null}$(()=>{let Z=g6();if(!Z)return;let j=J(w0).length>0,K=J(T0);return Z.setAttribute("data-pie-header-overlay",j?"true":"false"),Z.setAttribute("data-pie-header-overlay-active",K?"true":"false"),Z.setAttribute("data-pie-toolbar-empty",J(v6)?"true":"false"),()=>{Z.removeAttribute("data-pie-header-overlay"),Z.removeAttribute("data-pie-header-overlay-active"),Z.removeAttribute("data-pie-toolbar-empty")}}),$(()=>{if(!H||!J(MZ))return;if(J(k0).some((Z)=>!!L0(Z)))EJ()});function wZ(Z){if(Z.id in J(TJ))return J(TJ)[Z.id]===!0;return Z.active===!0}function CJ(){let Z={};for(let j of J(XJ))if(j.sync?.(),j.button)Z[j.toolId]=j.button.active??!1;l(TJ,Z,!0)}$(()=>{let Z=[];CJ();for(let j of J(XJ))if(j.subscribeActive){let K=!1,X=j.subscribeActive((G)=>{queueMicrotask(()=>{if(K)return;l(TJ,{...J(TJ),[j.toolId]:G},!0),j.sync?.()})});Z.push(()=>{K=!0,X()})}return()=>{Z.forEach((j)=>j())}}),$(()=>{let Z=J(B)?.toolkitCoordinator;if(typeof Z?.registerToolRequestTarget!=="function")return;let j=J(D0);return Z.registerToolRequestTarget({level:j,get scopeId(){return J(RJ)},hostsTool:(K)=>J(uJ).includes(K),open:(K,X)=>{if(!J(t))return;if(!J(uJ).includes(K))return;if(X&&Object.keys(X).length>0)M0+=1,W0.set(K,{...X,toolRequestId:M0});let G=cZ(J(t),K);J(t).showTool(G),queueMicrotask(()=>CJ())}})}),$(()=>{if(!J(_J).subscribeVisibility)return;let Z=!1,j=J(_J).subscribeVisibility(()=>{queueMicrotask(()=>{if(Z)return;CJ()})});return()=>{Z=!0,j?.()}}),$(()=>{let Z=J(_J).toolkitCoordinator;if(typeof Z?.subscribeTelemetry!=="function")return;let j=!1,K=Z.subscribeTelemetry(({eventName:X,payload:G})=>{if(X!=="pie-toolkit-tool-config-updated")return;if(G?.toolId&&!J(uJ).includes(G.toolId))return;queueMicrotask(()=>{if(j)return;l(dJ,J(dJ)+1),CJ()})});return()=>{j=!0,K?.()}});let m6="[data-pie-tool-overlay-boundary]";function h6(Z,j){if(j.container!=="content-boundary")return Z;let K=Z;while(K){if(K instanceof HTMLElement&&K.matches(m6))return K;if(K instanceof HTMLElement&&K.parentElement){K=K.parentElement;continue}let X=K.getRootNode();K=X instanceof ShadowRoot?X.host:null}return Z}let u6="__pieToolElementUnmount";function dZ(Z){if(!Z)return;let j=Z[u6];if(typeof j==="function")j()}function c6(Z,j){let K=j,X=null,G=Z,z=(q)=>{if(X===q)return;if(X){if(dZ(X),X.parentNode===G)G.removeChild(X)}if(X=q,X){if(G=h6(Z,K),X.parentNode&&X.parentNode!==G)X.parentNode.removeChild(X);G.appendChild(X)}};return z(j.element),{update(q){K=q,z(q.element)},destroy(){z(null)}}}let A0=720,S0=560,_0=320,rZ=240,kJ=24,zJ=40;function a6(Z,j){let K=j,X=null,G=null,z=[],q=null,W=null,S=null,k=null,O=null,e=null,JJ=null,d=!1,DJ=!1,JZ=()=>K.mounted.entry.shell?.pageTabOrder===!0,UJ=()=>K.mounted.entry.shell?.ndsHeaderControls===!0,T=null,fJ=null,ZZ=k9({onMove:(V)=>j9(V),onEnd:()=>{fJ=null}}),ZJ=0,w=0,I=0,x=0,HJ=0,C=0,jZ=0,lZ=0,KZ=null,oZ=[],v=0,g=0,f=K.mounted.entry.shell?.initialWidth??A0,b=K.mounted.entry.shell?.initialHeight??S0,f0=f,b0=b,XZ=!1,cJ=null,YJ=null,BZ=!1,nZ=()=>{let V=K.mounted.entry.shell;if(!V)return null;return{toolId:K.mounted.toolId,toolbarContext:J(_J),shellConfig:V}},r6=(V)=>{let U=J(E).get(K.mounted.toolId),P=nZ();if(!U?.onHostedMount||!P)return;U.onHostedMount(V,P)},IZ=()=>{let V=J(E).get(K.mounted.toolId),U=nZ();if(!V?.onHostedResize||!U)return;V.onHostedResize({width:f,height:b},K.mounted.entry.element,U)},l6=()=>{let V=J(E).get(K.mounted.toolId),U=nZ();if(!V?.onHostedUnmount||!U)return;V.onHostedUnmount(K.mounted.entry.element,U)},s=(V,U,P)=>Math.max(U,Math.min(V,P)),bJ=(V)=>{try{V.focus()}catch{}},o6=()=>{let V=K.mounted.entry.shell,U=V?.minWidth??_0,P=V?.minHeight??rZ,Y=V?.maxWidth??window.innerWidth,Q=V?.maxHeight??window.innerHeight;return{minWidth:U,minHeight:P,maxWidth:Y,maxHeight:Q}},tZ=()=>{let V=K.mounted.entry.shell?.minWidth,U=typeof V==="number"&&V>0&&f<V,P=U?`${V}px`:"";if(T)T.style.minWidth=P;if(q)q.style.minWidth="0";if(W)W.style.minWidth="0",W.style.overflowX=U?"auto":"hidden"},y0=()=>K.mounted.entry.shell?.content?.overflowY==="auto"?"auto":"hidden",n6=()=>{if(!q)return 0;let V=q.getBoundingClientRect().height;if(V>0)return V;return q.offsetHeight||0},eZ=()=>{if(!W)return;let V=K.mounted.entry.shell;if(W.style.overflowY=y0(),!T)return;if(V?.content?.preserveMinHeight===!0){let U=n6(),P=V.minHeight??rZ,Y=Math.max(0,P-U),Q=Math.max(0,b-U),F=Math.max(Q,Y);T.style.height=`${F}px`,T.style.minHeight="0",T.style.flex=`0 0 ${F}px`;return}T.style.height="100%",T.style.minHeight="0",T.style.flex="1 1 auto"},t6=()=>{let V=K.mounted.entry.shell,U=V?.initialWidth??A0,P=V?.initialHeight??S0;if(U===f0&&P===b0)return;if(f0=U,b0=P,XZ)return;f=U,b=P,AZ()},TZ=()=>{let{minWidth:V,minHeight:U,maxWidth:P,maxHeight:Y}=o6(),Q=Math.min(V,window.innerWidth),F=Math.min(U,window.innerHeight);f=s(f,Q,Math.max(Q,Math.min(P,window.innerWidth))),b=s(b,F,Math.max(F,Math.min(Y,window.innerHeight))),v=s(v,0,Math.max(0,window.innerWidth-f)),g=s(g,0,Math.max(0,window.innerHeight-b)),VZ(),tZ(),eZ(),IZ()},wJ=(V,U)=>{XZ=!0,v+=V,g+=U,TZ()},aJ=(V,U)=>{XZ=!0,f+=V,b+=U,TZ()},x0=(V,U,P,Y="fa-regular",Q)=>{EJ();let F=document.createElement("nds-icon-button");if(F.setAttribute("variant","tertiary"),F.setAttribute("size","small"),F.setAttribute("type","circle"),F.setAttribute("icon-name",U),F.setAttribute("button-aria-label",V),F.title=V,F.addEventListener("click",(M)=>{M.stopPropagation(),P(),iJ()}),n(F,Y),Q)jJ(F,Q);return F},$0=(V,U,P)=>{let Y=document.createElement("button");return Y.type="button",Y.className="pie-tool-shell__control",Y.setAttribute("aria-label",V),Y.title=V,Y.textContent=U,Y.style.border="1px solid transparent",Y.style.background="color-mix(in srgb, var(--pie-white, #fff) 10%, transparent)",Y.style.color="inherit",Y.style.cursor="pointer",Y.style.display="inline-flex",Y.style.alignItems="center",Y.style.justifyContent="center",Y.style.width="28px",Y.style.height="28px",Y.style.padding="0",Y.style.fontSize="14px",Y.style.fontWeight="700",Y.style.borderRadius="8px",Y.style.lineHeight="1",Y.onclick=(Q)=>{Q.stopPropagation(),P(),iJ()},Y.onfocus=()=>{Y.style.outline="2px solid var(--pie-button-focus-outline, var(--pie-primary, #4A90E2))",Y.style.outlineOffset="2px"},Y.onblur=()=>{Y.style.outline="none",Y.style.outlineOffset="0"},Y},VZ=()=>{if(!X)return;X.style.left=`${v}px`,X.style.top=`${g}px`,X.style.width=`${f}px`,X.style.height=`${b}px`,X.style.display=K.active?"flex":"none"},p0=()=>{if(X)W9(X,K.i18n);if(S)S.textContent=K.mounted.entry.shell?.title||K.mounted.toolId;for(let{el:V,key:U}of z){let P=K.i18n.t(U);if(V.tagName==="NDS-ICON-BUTTON")V.setAttribute("button-aria-label",P);else V.setAttribute("aria-label",P);if(V.title)V.title=P}},E0=()=>{if(!W)return;let V=K.mounted.entry.element;if(V.style.display="block",V.style.width="100%",V.style.height="100%",V.style.flex="1 1 auto",V.style.minHeight="0",T&&T!==V){if(T.parentNode===W)dZ(T),W.removeChild(T);T=null}if(V.parentNode&&V.parentNode!==W)V.parentNode.removeChild(V);if(V.parentNode!==W)W.appendChild(V);T=V,tZ(),eZ(),r6(V)},iJ=()=>{if(J(t)&&X)J(t).bringToFront(X)},v0=()=>{if(!X||!J(t)||!K.active)return;let V=HZ(K.mounted.toolId);if(J(t).getToolState(V)?.element===X)return;J(t).updateToolElement(V,X)},AZ=()=>{let{innerWidth:V,innerHeight:U}=window,P=K.mounted.entry.shell,Y=P?.initialAlign??"center",Q=P?.initialMargin??16,F=Q+60;switch(Y){case"top-left":v=Q,g=F;break;case"top-right":v=Math.max(0,V-f-Q),g=F;break;case"bottom-left":v=Q,g=Math.max(0,U-b-F);break;case"bottom-right":v=Math.max(0,V-f-Q),g=Math.max(0,U-b-F);break;default:v=Math.max(0,Math.round((V-f)/2)),g=Math.max(0,Math.round((U-b)/2))}TZ()},e6=()=>{let V=YJ;if(!V)return;queueMicrotask(()=>{if(!V.isConnected)return;bJ(V)})},g0=()=>{if(typeof document>"u")return null;let V=document.activeElement;while(V){let U=V.shadowRoot;if(U&&U.activeElement&&U.activeElement!==V)V=U.activeElement;else break}return V??null},m0=()=>{if(!X||cJ)return;let V=g0();if(!YJ&&V&&!X.contains(V))YJ=V;if(JZ()&&!DJ)document.addEventListener("keydown",Z0,!0),DJ=!0;cJ=R9(X,{initialFocus:O,onEscape:()=>{j0()},wrap:!JZ(),onTabExit:JZ()?(U,P)=>{if(U==="backward"){if(YJ?.isConnected)P.preventDefault(),bJ(YJ);return}let Y=J0();if(Y)P.preventDefault(),bJ(Y)}:void 0})},J0=()=>{let V=J(_J).getScopeElement?.()??null;if(!V)return null;let U=(Y)=>{if(J(KJ)&&J(KJ).contains(Y))return!0;if(X&&X.contains(Y))return!0;return!1},P=(Y)=>{if(Y instanceof HTMLElement){if(U(Y))return null;if(Y.matches?.(z9)&&H9(Y))return Y}let Q=Y.shadowRoot;if(Q)for(let F=0;F<Q.children.length;F++){let M=P(Q.children[F]);if(M)return M}for(let F=0;F<Y.children.length;F++){let M=P(Y.children[F]);if(M)return M}return null};return P(V)},J9=()=>{if(!X)return[];return M9(X).filter((V)=>V!==e&&V!==JJ)},Z0=(V)=>{if(V.key!=="Tab")return;if(!X||!K.active)return;let U=g0();if(!U)return;if(X.contains(U))return;let P=J9();if(P.length===0)return;if(V.shiftKey){let Y=J0();if(U!==Y)return;V.preventDefault(),bJ(P[P.length-1]);return}if(U!==YJ)return;V.preventDefault(),bJ(P[0])},h0=()=>{if(DJ)document.removeEventListener("keydown",Z0,!0),DJ=!1;if(!cJ)return;let V=cJ;cJ=null;try{V()}catch{}e6()},j0=()=>{J(_J).toggleTool(K.mounted.toolId),CJ()},u0=(V)=>{if(!K.mounted.entry.shell?.draggable)return;if(V.target.closest("button")||!X)return;if(!ZZ.begin(V,X))return;fJ="drag",XZ=!0,ZJ=V.clientX-v,w=V.clientY-g,X.setPointerCapture(V.pointerId),iJ()},Z9=(V)=>(U)=>{if(!X||!K.mounted.entry.shell?.resizable)return;if(U.stopPropagation(),!ZZ.begin(U,X))return;fJ="resize",XZ=!0,KZ=V,I=f,x=b,HJ=U.clientX,C=U.clientY,jZ=v,lZ=g,X.setPointerCapture(U.pointerId),iJ()},j9=(V)=>{if(!X)return;if(fJ==="drag"){V.preventDefault();let U=Math.max(0,window.innerWidth-f),P=Math.max(0,window.innerHeight-b);v=s(V.clientX-ZJ,0,U),g=s(V.clientY-w,0,P),VZ();return}if(fJ==="resize"){V.preventDefault();let U=K.mounted.entry.shell,P=U?.minWidth??_0,Y=U?.minHeight??rZ,Q=Math.min(P,window.innerWidth),F=Math.min(Y,window.innerHeight),M=U?.maxWidth??window.innerWidth,m=U?.maxHeight??window.innerHeight,c=V.clientX-HJ,r=V.clientY-C;if(KZ==="se")f=s(I+c,Q,Math.max(Q,Math.min(M,window.innerWidth-v))),b=s(x+r,F,Math.max(F,Math.min(m,window.innerHeight-g)));else if(KZ==="sw"){let a=jZ+I,VJ=s(I-c,Q,Math.min(M,a));v=a-VJ,f=VJ,b=s(x+r,F,Math.max(F,Math.min(m,window.innerHeight-g)))}else if(KZ==="ne"){let a=lZ+x;f=s(I+c,Q,Math.max(Q,Math.min(M,window.innerWidth-v)));let VJ=s(x-r,F,Math.min(m,a));g=a-VJ,b=VJ}else if(KZ==="nw"){let a=jZ+I,VJ=lZ+x,_=s(I-c,Q,Math.min(M,a));v=a-_,f=_;let QZ=s(x-r,F,Math.min(m,VJ));g=VJ-QZ,b=QZ}VZ(),tZ(),eZ(),IZ()}},c0=()=>{TZ()};if(H&&K.mounted.entry.shell){let V=UJ()&&J(MZ);if(V)EJ();if(X=document.createElement("div"),X.className="pie-tool-shell",X.setAttribute("data-pie-tool-shell",K.mounted.toolId),X.style.position="fixed",X.style.zIndex=String(G6.TOOL),X.style.background="var(--pie-background, #fff)",X.style.border="1px solid var(--pie-border-light, #d1d5db)",X.style.borderRadius="12px",X.style.boxShadow="0 10px 40px color-mix(in srgb, var(--pie-black, #000) 25%, transparent)",X.style.setProperty("--color-interactive-blue","var(--pie-calculator-button-color, var(--pie-button-color, var(--pie-text, #222)))"),X.style.setProperty("--color-new-gray","var(--pie-background-dark, #f3f5f7)"),X.style.setProperty("--color-primary-white","var(--pie-white, #ffffff)"),X.style.setProperty("--color-primary-black","var(--pie-text, #000000)"),X.style.setProperty("--color-focus-blue","var(--pie-button-focus-outline, #2b87ff)"),X.style.overflow="visible",X.style.display=K.active?"flex":"none",X.style.flexDirection="column",X.style.userSelect="none",X.style.webkitUserSelect="none",X.style.touchAction="none",X.setAttribute("draggable","false"),X.addEventListener("dragstart",(Q)=>Q.preventDefault()),q=document.createElement("div"),q.className="pie-tool-shell__header",q.style.display="flex",q.style.flexWrap="wrap",q.style.alignItems="center",q.style.justifyContent="space-between",q.style.gap="6px",q.style.padding=UJ()?"12px 12px 12px 28px":"10px 12px",UJ())q.style.minHeight="48px",q.style.background="var(--pie-section-player-card-header-background, var(--pie-button-active-bg, #f3f4f6))",q.style.color="var(--pie-text, #111827)",q.style.borderBottom="1px solid var(--pie-border-light, #e5e7eb)";else q.style.background="var(--pie-primary-dark, #2c3e50)",q.style.color="var(--pie-white, #fff)";q.style.cursor=K.mounted.entry.shell.draggable===!1?"default":"move",q.style.flex="0 0 auto",q.style.borderRadius="12px 12px 0 0",q.style.overflow="hidden",q.style.userSelect="none",q.style.webkitUserSelect="none",q.style.touchAction="none",q.setAttribute("draggable","false"),q.addEventListener("dragstart",(Q)=>Q.preventDefault()),S=document.createElement("span"),S.className="pie-tool-shell__title",S.style.minWidth="0",S.style.overflowWrap="anywhere",S.textContent=K.mounted.entry.shell.title||K.mounted.toolId,q.appendChild(S),k=document.createElement("div"),k.className="pie-tool-shell__controls",k.style.display="inline-flex",k.style.flexWrap="wrap",k.style.minWidth="0",k.style.alignItems="center",k.style.gap=UJ()?"6px":"4px";let U=K.mounted.entry.shell,P=(Q,F,M,m,c)=>{if(!k)return;let r=K.i18n.t(Q),a=V?x0(r,M,m,"fa-regular",c):$0(r,F,m);z.push({el:a,key:Q}),k.appendChild(a)};if(U?.draggable!==!1)P("toolkit.window.moveLeftA11y","←","chevron-left",()=>wJ(-kJ,0)),P("toolkit.window.moveRightA11y","→","chevron-right",()=>wJ(kJ,0)),P("toolkit.window.moveUpA11y","↑","chevron-up",()=>wJ(0,-kJ)),P("toolkit.window.moveDownA11y","↓","chevron-down",()=>wJ(0,kJ));if(U?.resizable!==!1)P("toolkit.window.narrowerA11y","↔−","down-left-and-up-right-to-center",()=>aJ(-zJ,0),"45deg"),P("toolkit.window.widerA11y","↔+","up-right-and-down-left-from-center",()=>aJ(zJ,0),"45deg"),P("toolkit.window.shorterA11y","↕−","down-left-and-up-right-to-center",()=>aJ(0,-zJ),"-45deg"),P("toolkit.window.tallerA11y","↕+","up-right-and-down-left-from-center",()=>aJ(0,zJ),"-45deg");if(!UJ()){let Q=$0(K.i18n.t("toolkit.window.centerA11y"),"◎",AZ);z.push({el:Q,key:"toolkit.window.centerA11y"}),k.appendChild(Q)}let Y=null;if(UJ())Y=document.createElement("div"),Y.className="pie-tool-shell__header-right",Y.style.display="inline-flex",Y.style.flexWrap="wrap",Y.style.maxWidth="100%",Y.style.justifyContent="flex-end",Y.style.alignItems="center",Y.style.gap="6px",Y.appendChild(k),q.appendChild(Y);else q.appendChild(k);if(V)O=x0(K.i18n.t("toolkit.window.closeA11y"),"xmark",j0,"fa-regular"),z.push({el:O,key:"toolkit.window.closeA11y"}),O.style.display=K.mounted.entry.shell.closeable===!1?"none":"inline-block";else{let Q=document.createElement("button");Q.type="button",Q.className="pie-tool-shell__close",Q.setAttribute("aria-label",K.i18n.t("toolkit.window.closeA11y")),z.push({el:Q,key:"toolkit.window.closeA11y"});let F="http://www.w3.org/2000/svg",M=document.createElementNS(F,"svg");M.setAttribute("xmlns",F),M.setAttribute("viewBox","0 0 16 16"),M.setAttribute("aria-hidden","true");let m=document.createElementNS(F,"path");m.setAttribute("d","M3.5 3.5L12.5 12.5M12.5 3.5L3.5 12.5"),m.setAttribute("stroke","currentColor"),m.setAttribute("stroke-width","1.8"),m.setAttribute("stroke-linecap","round"),M.appendChild(m),Q.appendChild(M);let c=M.style;c.width="16px",c.height="16px",c.display="block",c.flexShrink="0",c.pointerEvents="none";let r="color-mix(in srgb, var(--pie-white, #fff) 8%, transparent)",a="color-mix(in srgb, var(--pie-white, #fff) 18%, transparent)";Q.style.border="1px solid transparent",Q.style.background=r,Q.style.color="inherit",Q.style.cursor="pointer",Q.style.display="inline-flex",Q.style.alignItems="center",Q.style.justifyItems="center",Q.style.width="28px",Q.style.height="28px",Q.style.padding="0",Q.style.borderRadius="8px",Q.style.lineHeight="0",Q.style.transition="background-color 0.15s ease, border-color 0.15s ease",Q.style.display=K.mounted.entry.shell.closeable===!1?"none":"inline-flex",Q.onmouseenter=()=>{Q.style.background=a},Q.onmouseleave=()=>{Q.style.background=r},Q.onfocus=()=>{Q.style.outline="2px solid var(--pie-button-focus-outline, var(--pie-primary, #4A90E2))",Q.style.outlineOffset="2px"},Q.onblur=()=>{Q.style.outline="none",Q.style.outlineOffset="0"},Q.onclick=j0,O=Q}if(Y)Y.appendChild(O);else q.appendChild(O);if(q.tabIndex=0,q.onkeydown=(Q)=>{if(Q.key==="Home"){Q.preventDefault(),AZ();return}let F=K.mounted.entry.shell;if(Q.shiftKey&&F?.resizable!==!1){if(Q.key==="ArrowLeft"||Q.key==="ArrowRight"){Q.preventDefault(),aJ(Q.key==="ArrowRight"?zJ:-zJ,0);return}if(Q.key==="ArrowUp"||Q.key==="ArrowDown"){Q.preventDefault(),aJ(0,Q.key==="ArrowDown"?zJ:-zJ);return}}if(F?.draggable!==!1){if(Q.key==="ArrowLeft")Q.preventDefault(),wJ(-kJ,0);else if(Q.key==="ArrowRight")Q.preventDefault(),wJ(kJ,0);else if(Q.key==="ArrowUp")Q.preventDefault(),wJ(0,-kJ);else if(Q.key==="ArrowDown")Q.preventDefault(),wJ(0,kJ)}},W=document.createElement("div"),W.className="pie-tool-shell__content",W.style.position="relative",W.style.width="100%",W.style.flex="1 1 auto",W.style.minHeight="0",W.style.overflowX="hidden",W.style.overflowY=y0(),W.style.borderRadius="0 0 12px 12px",UJ()){let Q=(F)=>{let M=document.createElement("div");return M.tabIndex=0,M.setAttribute("aria-hidden","true"),M.setAttribute("data-pie-tool-shell-focus-guard",F),M.style.position="absolute",M.style.width="1px",M.style.height="1px",M.style.padding="0",M.style.margin="-1px",M.style.overflow="hidden",M.style.clipPath="inset(50%)",M.style.whiteSpace="nowrap",M.style.border="0",M};e=Q("start"),JJ=Q("end"),e.addEventListener("focus",(F)=>{if(d)return;d=!0;try{if(F.stopPropagation(),YJ?.isConnected)bJ(YJ)}finally{queueMicrotask(()=>{d=!1})}}),JJ.addEventListener("focus",(F)=>{if(d)return;d=!0;try{F.stopPropagation();let M=J0();if(M)bJ(M)}finally{queueMicrotask(()=>{d=!1})}}),X.appendChild(e)}if(X.appendChild(q),X.appendChild(W),UJ()&&JJ)X.appendChild(JJ);if(K.mounted.entry.shell.resizable!==!1){let Q=(F,M,m,c,r,a,VJ)=>{let _=document.createElement("div");if(_.className="pie-tool-shell__resize",_.style.position="absolute",_.style.width="24px",_.style.height="24px",_.style.cursor=a,_.style.zIndex="10",_.style.touchAction="none",_.setAttribute("draggable","false"),M!==null)_.style.top=M;if(m!==null)_.style.right=m;if(c!==null)_.style.bottom=c;if(r!==null)_.style.left=r;if(VJ!==null)_.style.background=`linear-gradient(${VJ}, transparent 0%, transparent 40%, rgba(0,0,0,0.35) 40%, rgba(0,0,0,0.35) 60%, transparent 60%, transparent 100%)`;let QZ=Z9(F);_.addEventListener("pointerdown",QZ),X.appendChild(_),oZ.push({el:_,handler:QZ})};Q("se",null,"0","0",null,"nwse-resize",null),Q("nw","0",null,null,"0","nwse-resize","135deg"),Q("ne","0","0",null,null,"nesw-resize",null),Q("sw",null,null,"0","0","nesw-resize",null)}if(q.addEventListener("pointerdown",u0),X.addEventListener("pointerdown",iJ),window.addEventListener("resize",c0),document.body.appendChild(X),G=new N9(X,{context:L6,initialValue:K.runtime}),G.connect(),AZ(),VZ(),v0(),p0(),E0(),IZ(),K.active)m0();BZ=K.active}return{update(V){if(K=V,!X||!W||!S||!O)return;G?.setValue(K.runtime),p0(),t6();let U=O.tagName.toLowerCase()==="nds-icon-button"?"inline-block":"inline-flex";if(O.style.display=K.mounted.entry.shell?.closeable===!1?"none":U,VZ(),v0(),E0(),IZ(),!BZ&&K.active)m0();else if(BZ&&!K.active)h0(),YJ=null;BZ=K.active},destroy(){if(l6(),G?.disconnect(),G=null,z.length=0,cJ)h0();if(DJ)document.removeEventListener("keydown",Z0,!0),DJ=!1;for(let{el:V,handler:U}of oZ)V.removeEventListener("pointerdown",U);if(YJ=null,oZ.length=0,q)q.removeEventListener("pointerdown",u0),q.onkeydown=null;if(ZZ.release(),X)X.removeEventListener("pointerdown",iJ);if(window.removeEventListener("resize",c0),T&&W&&T.parentNode===W)dZ(T),W.removeChild(T);if(T=null,X&&X.parentElement)X.remove()}}}var i6={get level(){return vJ()},set level(Z){vJ(Z),h()},get scopeId(){return GZ()},set scopeId(Z){GZ(Z),h()},get itemId(){return CZ()},set itemId(Z){CZ(Z),h()},get sectionId(){return fZ()},set sectionId(Z){fZ(Z),h()},get catalogId(){return bZ()},set catalogId(Z){bZ(Z),h()},get tools(){return yZ()},set tools(Z){yZ(Z),h()},get contentKind(){return xZ()},set contentKind(Z){xZ(Z),h()},get position(){return MJ()},set position(Z){MJ(Z),h()},get scopeElement(){return NZ()},set scopeElement(Z){NZ(Z),h()},get toolRegistry(){return FZ()},set toolRegistry(Z){FZ(Z),h()},get item(){return $Z()},set item(Z){$Z(Z),h()},get hostButtons(){return PZ()},set hostButtons(Z){PZ(Z),h()},get class(){return pZ()},set class(Z){pZ(Z),h()},get size(){return WZ()},set size(Z){WZ(Z),h()},get language(){return EZ()},set language(Z){EZ(Z),h()}},C0=xJ(),s6=yJ(C0);{var d6=(Z)=>{var j=_9();let K;var X=sJ(j),G=sJ(X);YZ(G,17,()=>J(x6),(k)=>k.key,(k,O)=>{R(k,()=>J(O),()=>"item-toolbar__element-host")});var z=SZ(G,2);YZ(z,17,()=>J(k0),(k)=>k.id,(k,O,e,JJ)=>{let d=N(()=>J(MZ)&&!X0(J(O))?L0(J(O)):null);var DJ=xJ(),JZ=yJ(DJ);{var UJ=(ZJ)=>{var w=I9(),I=sJ(w);OJ(I,1,"item-toolbar__nds-button svelte-1c13522"),BJ(I,"type","circle"),BJ(I,"size","small"),BJ(I,"variant","tertiary"),o(()=>BJ(I,"icon-name",J(d))),o(()=>BJ(I,"button-aria-label",J(O).ariaLabel||J(O).label)),o(()=>BJ(I,"title",J(O).tooltip||J(O).label)),o(()=>BJ(I,"disabled",J(O).disabled)),LZ(I,(x)=>WJ?.(x)),LZ(I,(x,HJ)=>M6?.(x,HJ),()=>wZ(J(O))),GJ(w),UZ("click",I,function(...x){J(O).onClick?.apply(this,x)}),y(ZJ,w)},T=(ZJ)=>{var w=T9();let I;var x=sJ(w);{var HJ=(C)=>{t0(C,()=>J(O).icon)};NJ(x,(C)=>{if(J(O).icon)C(HJ)})}GJ(w),o((C)=>{I=OJ(w,1,"item-toolbar__button svelte-1c13522",null,I,{"item-toolbar__button--active":C}),i(w,"href",J(O).disabled?void 0:J(O).href),i(w,"target",J(O).target),i(w,"rel",J(O).rel),i(w,"aria-label",J(O).ariaLabel||J(O).label),i(w,"title",J(O).tooltip||J(O).label),i(w,"aria-disabled",J(O).disabled?"true":void 0)},[()=>wZ(J(O))]),UZ("click",w,(C)=>{if(J(O).disabled)C.preventDefault()}),y(ZJ,w)},fJ=N(()=>X0(J(O))),ZZ=(ZJ)=>{var w=A9();let I;var x=sJ(w);{var HJ=(C)=>{t0(C,()=>J(O).icon)};NJ(x,(C)=>{if(J(O).icon)C(HJ)})}GJ(w),o((C,jZ)=>{I=OJ(w,1,"item-toolbar__button svelte-1c13522",null,I,{"item-toolbar__button--active":C}),i(w,"aria-label",J(O).ariaLabel||J(O).label),i(w,"aria-pressed",jZ),i(w,"title",J(O).tooltip||J(O).label),w.disabled=J(O).disabled},[()=>wZ(J(O)),()=>wZ(J(O))]),UZ("click",w,function(...C){J(O).onClick?.apply(this,C)}),y(ZJ,w)};NJ(JZ,(ZJ)=>{if(J(d))ZJ(UJ);else if(J(fJ))ZJ(T,1);else ZJ(ZZ,-1)})}y(k,DJ)});var q=SZ(z,2);YZ(q,17,()=>J($6),(k)=>k.key,(k,O)=>{R(k,()=>J(O),()=>"item-toolbar__element-host")}),GJ(X);var W=SZ(X,2);{var S=(k)=>{var O=S9();let e;YZ(O,21,()=>J(z0),(JJ)=>JJ.key,(JJ,d)=>{R(JJ,()=>J(d),()=>"item-toolbar__controls-host")}),GJ(O),o(()=>e=OJ(O,1,"item-toolbar__controls-row svelte-1c13522",null,e,{"item-toolbar__controls-row--reserve":J(B0),"item-toolbar__controls-row--active":J(I0),"item-toolbar__controls-row--align-start":J(p6)})),y(k,O)};NJ(W,(k)=>{if(J(E6))k(S)})}GJ(j),U6(j,(k)=>l(KJ,k),()=>J(KJ)),o((k,O)=>{K=OJ(j,1,`item-toolbar ${pZ()??""} item-toolbar--${WZ()??""}`,"svelte-1c13522",K,{"item-toolbar--top":MJ()==="top","item-toolbar--right":MJ()==="right","item-toolbar--bottom":MJ()==="bottom","item-toolbar--left":MJ()==="left","item-toolbar--header-overlay-active":J(T0)}),i(j,"data-content-kind",J(oJ)),i(j,"data-level",J(A)),i(j,"lang",k),i(j,"dir",O),j.dir=j.dir},[()=>J(RZ).getLocale(),()=>J(RZ).getDirection?.()??"ltr"]),UZ("focusin",X,(k)=>{if(J(A)==="section"&&k.target instanceof HTMLElement&&!k.target.closest(".item-toolbar__element-host"))k.target.scrollIntoView({block:"nearest",inline:"nearest"})}),y(Z,j)};NJ(s6,(Z)=>{if(H)Z(d6)})}return y(D,C0),j6(i6)}X6(["focusin","click"]);G9("pie-item-toolbar",Y6(W6,{level:{attribute:"level",type:"String"},scopeId:{attribute:"scope-id",type:"String"},itemId:{attribute:"item-id",type:"String"},sectionId:{attribute:"section-id",type:"String"},catalogId:{attribute:"catalog-id",type:"String"},tools:{attribute:"tools",type:"String"},contentKind:{attribute:"content-kind",type:"String"},position:{attribute:"position",type:"String"},size:{attribute:"size",type:"String"},language:{attribute:"language",type:"String"},scopeElement:{type:"Object"},toolRegistry:{type:"Object"},item:{type:"Object"},hostButtons:{type:"Object"},class:{}},[],[],{mode:"open"}));
|
|
40
|
+
export{W6 as n};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
var d=((a)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});
|
|
2
|
-
export{d as
|
|
2
|
+
export{d as sa};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ra as v}from"./ItemToolBar-pxan157g.js";import"./ItemToolBar-xwjrpdmz.js";import*as q from"speech-rule-engine";var x=q.default??q;x.setupEngine(v());var B=x;export{B as default};
|
|
@@ -20,6 +20,7 @@ import type { ToolRegistry } from "../../services/ToolRegistry.js";
|
|
|
20
20
|
import type { ToolPolicyDecision, ToolPolicyDecisionRequest, ToolPolicyDiagnostic, ToolScope } from "./decision-types.js";
|
|
21
21
|
import type { PolicySource } from "./PolicySource.js";
|
|
22
22
|
import type { FeaturePolicyDecision } from "./feature-decision.js";
|
|
23
|
+
import { type SupportConflict } from "../sources/PnpPolicySource.js";
|
|
23
24
|
export type { PnpEnforcementMode };
|
|
24
25
|
export interface ToolPolicyEngineInputs {
|
|
25
26
|
tools?: CanonicalToolsConfig | null;
|
|
@@ -50,6 +51,12 @@ export interface ToolPolicyEngineArgs {
|
|
|
50
51
|
* Defaults to `false`.
|
|
51
52
|
*/
|
|
52
53
|
assessmentOptional?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Supports that withhold other ids while in effect, resolved at precedence 4
|
|
56
|
+
* under `support-conflict`. Defaults to none; `ToolkitCoordinator` passes
|
|
57
|
+
* the toolkit's own.
|
|
58
|
+
*/
|
|
59
|
+
supportConflicts?: readonly SupportConflict[];
|
|
53
60
|
}
|
|
54
61
|
export interface ToolPolicyChangeEvent {
|
|
55
62
|
/**
|
|
@@ -92,6 +99,7 @@ export declare class ToolPolicyEngine {
|
|
|
92
99
|
private readonly contextId;
|
|
93
100
|
private readonly assessmentOptional;
|
|
94
101
|
private pnpPolicySource;
|
|
102
|
+
private readonly supportConflicts;
|
|
95
103
|
private readonly customSources;
|
|
96
104
|
private readonly listeners;
|
|
97
105
|
private tools;
|
|
@@ -32,6 +32,7 @@ export class ToolPolicyEngine {
|
|
|
32
32
|
contextId;
|
|
33
33
|
assessmentOptional;
|
|
34
34
|
pnpPolicySource;
|
|
35
|
+
supportConflicts;
|
|
35
36
|
customSources;
|
|
36
37
|
listeners = new Set();
|
|
37
38
|
tools;
|
|
@@ -48,7 +49,8 @@ export class ToolPolicyEngine {
|
|
|
48
49
|
this.toolRegistry = args.toolRegistry;
|
|
49
50
|
this.contextId = args.contextId ?? "tool-policy";
|
|
50
51
|
this.assessmentOptional = args.assessmentOptional === true;
|
|
51
|
-
this.
|
|
52
|
+
this.supportConflicts = args.supportConflicts ?? [];
|
|
53
|
+
this.pnpPolicySource = new PnpPolicySource(this.toolRegistry, this.supportConflicts);
|
|
52
54
|
this.customSources = args.customSources ? [...args.customSources] : [];
|
|
53
55
|
const inputs = args.inputs ?? {};
|
|
54
56
|
this.tools = inputs.tools ?? DEFAULT_TOOLS;
|
|
@@ -284,7 +286,7 @@ export class ToolPolicyEngine {
|
|
|
284
286
|
this.assertNotDisposed();
|
|
285
287
|
this.unsubscribeRegistry();
|
|
286
288
|
this.toolRegistry = toolRegistry;
|
|
287
|
-
this.pnpPolicySource = new PnpPolicySource(toolRegistry);
|
|
289
|
+
this.pnpPolicySource = new PnpPolicySource(toolRegistry, this.supportConflicts);
|
|
288
290
|
this.unsubscribeRegistry = this.watchRegistry();
|
|
289
291
|
this.tools = tools;
|
|
290
292
|
this.refreshInputDiagnostics();
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import type { AssessmentEntity } from "@pie-players/pie-players-shared/types";
|
|
15
15
|
import { type CanonicalToolsConfig, type ToolPlacementLevel } from "../../services/tools-config-normalizer.js";
|
|
16
|
-
import type { OverrideBlockedDetails, ToolPolicyDecision, ToolPolicyDecisionRequest, ToolPolicyDiagnostic } from "./decision-types.js";
|
|
16
|
+
import type { OverrideBlockedDetails, SupportConflictServedBy, ToolPolicyDecision, ToolPolicyDecisionRequest, ToolPolicyDiagnostic } from "./decision-types.js";
|
|
17
17
|
import type { PolicySource } from "./PolicySource.js";
|
|
18
18
|
import { type PnpPolicySourceRule } from "./provenance.js";
|
|
19
19
|
import type { PnpPolicyItem, PnpPolicySource } from "../sources/PnpPolicySource.js";
|
|
@@ -50,6 +50,12 @@ export declare function composeDecision(inputs: ComposeDecisionInputs): ToolPoli
|
|
|
50
50
|
* feature decision, which has no toolbar level.
|
|
51
51
|
*/
|
|
52
52
|
export declare function overrideBlockedDiagnostic(toolId: string, rule: OverrideBlockedDetails["rule"], level?: ToolPlacementLevel): ToolPolicyDiagnostic;
|
|
53
|
+
/**
|
|
54
|
+
* A `tool-policy.supportConflict` diagnostic for an id `support` withholds
|
|
55
|
+
* although `servedBy` would have served it. `level` is absent on a feature
|
|
56
|
+
* decision, which has no toolbar level.
|
|
57
|
+
*/
|
|
58
|
+
export declare function supportConflictDiagnostic(toolId: string, support: string, servedBy: SupportConflictServedBy, level?: ToolPlacementLevel): ToolPolicyDiagnostic;
|
|
53
59
|
/**
|
|
54
60
|
* A `tool-policy.unknownSupportId` diagnostic for an id the registry lacks,
|
|
55
61
|
* naming every list that names it. It describes the engine's inputs rather
|
|
@@ -138,6 +138,13 @@ export function composeDecision(inputs) {
|
|
|
138
138
|
for (const [toolId, rule] of pnpPolicyResult.blockedOverrides) {
|
|
139
139
|
diagnostics.push(overrideBlockedDiagnostic(toolId, rule, request.level));
|
|
140
140
|
}
|
|
141
|
+
// A withheld tool this level would have shown: placed and past the host
|
|
142
|
+
// gates. One the host removed was never going to be served here.
|
|
143
|
+
for (const [toolId, conflict] of pnpPolicyResult.supportConflicts) {
|
|
144
|
+
if (!postHostCandidates.has(toolId))
|
|
145
|
+
continue;
|
|
146
|
+
diagnostics.push(supportConflictDiagnostic(toolId, conflict.support, conflict.grant ?? "placement", request.level));
|
|
147
|
+
}
|
|
141
148
|
// 5a — remove PNP/profile-blocked tools from the candidate set.
|
|
142
149
|
const { blockedToolIds } = pnpPolicyResult;
|
|
143
150
|
candidates = candidates.filter((toolId) => !blockedToolIds.has(toolId));
|
|
@@ -336,6 +343,7 @@ const PNP_RULE_FIELDS = {
|
|
|
336
343
|
"test-admin-override": "settings.testAdministration.toolOverrides",
|
|
337
344
|
"item-restriction": "item settings.restrictedTools",
|
|
338
345
|
"pnp-prohibited": "personalNeedsProfile.prohibitedSupports",
|
|
346
|
+
"support-conflict": "a withholding support in personalNeedsProfile.supports",
|
|
339
347
|
"item-requirement": "item settings.requiredTools",
|
|
340
348
|
"district-requirement": "settings.districtPolicy.requiredTools",
|
|
341
349
|
"pnp-support": "personalNeedsProfile.supports",
|
|
@@ -355,6 +363,27 @@ export function overrideBlockedDiagnostic(toolId, rule, level) {
|
|
|
355
363
|
details: { rule },
|
|
356
364
|
};
|
|
357
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* A `tool-policy.supportConflict` diagnostic for an id `support` withholds
|
|
368
|
+
* although `servedBy` would have served it. `level` is absent on a feature
|
|
369
|
+
* decision, which has no toolbar level.
|
|
370
|
+
*/
|
|
371
|
+
export function supportConflictDiagnostic(toolId, support, servedBy, level) {
|
|
372
|
+
const source = servedBy === "placement"
|
|
373
|
+
? "tools.placement"
|
|
374
|
+
: servedBy === "attribute"
|
|
375
|
+
? "The item player's attribute"
|
|
376
|
+
: servedBy === "authored"
|
|
377
|
+
? "The item's authored content"
|
|
378
|
+
: PNP_RULE_FIELDS[servedBy];
|
|
379
|
+
return {
|
|
380
|
+
code: "tool-policy.supportConflict",
|
|
381
|
+
...(level ? { level } : {}),
|
|
382
|
+
toolId,
|
|
383
|
+
message: `${source} serves "${toolId}", but the student's "${support}" support withholds it.`,
|
|
384
|
+
details: { support, servedBy },
|
|
385
|
+
};
|
|
386
|
+
}
|
|
358
387
|
/**
|
|
359
388
|
* A `tool-policy.unknownSupportId` diagnostic for an id the registry lacks,
|
|
360
389
|
* naming every list that names it. It describes the engine's inputs rather
|