@pie-players/pie-assessment-toolkit 1.0.0-beta.7 → 1.0.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/custom-elements.json +7 -0
  2. package/dist/components/ItemScope.custom-element.js +1 -1
  3. package/dist/components/ItemToolBar.custom-element.js +1 -1
  4. package/dist/components/PieAssessmentToolkit.custom-element.js +7 -7
  5. package/dist/components/SectionToolBar.custom-element.js +1 -1
  6. package/dist/components/chunks/ItemToolBar-bsww9e8f.js +4 -0
  7. package/dist/components/chunks/ItemToolBar-eg8jarh0.js +2 -0
  8. package/dist/components/chunks/{ItemToolBar-pxan157g.js → ItemToolBar-gsb96731.js} +2 -2
  9. package/dist/components/chunks/ItemToolBar-na4e5vwt.js +2 -0
  10. package/dist/components/chunks/{ItemToolBar-xwjrpdmz.js → ItemToolBar-wcw4yxjy.js} +1 -1
  11. package/dist/components/chunks/ItemToolBar-zvy0hskj.js +40 -0
  12. package/dist/components/chunks/sre-engine-wazxma67.js +1 -0
  13. package/dist/index.d.ts +2 -2
  14. package/dist/index.js +1 -1
  15. package/dist/runtime/SectionControllerBinding.d.ts +16 -5
  16. package/dist/runtime/SectionControllerBinding.js +14 -6
  17. package/dist/runtime/registration-events.d.ts +31 -4
  18. package/dist/runtime/registration-events.js +20 -1
  19. package/dist/runtime/shell-event-bridge.d.ts +7 -1
  20. package/dist/runtime/shell-event-bridge.js +44 -1
  21. package/dist/runtime/shell-scope.d.ts +2 -2
  22. package/dist/runtime/shell-scope.js +14 -5
  23. package/dist/services/SSMLExtractor.js +8 -23
  24. package/dist/services/ToolRegistry.d.ts +11 -3
  25. package/dist/services/ToolRegistry.js +8 -4
  26. package/dist/services/ToolkitCoordinator.d.ts +12 -47
  27. package/dist/services/ToolkitCoordinator.js +45 -284
  28. package/dist/services/section-controller-types.d.ts +71 -20
  29. package/dist/services/tool-config-validation.d.ts +1 -1
  30. package/dist/services/tool-context.js +94 -11
  31. package/dist/services/tool-icons.js +2 -0
  32. package/dist/services/tool-provider-defaults.d.ts +13 -0
  33. package/dist/services/tool-provider-defaults.js +20 -0
  34. package/dist/services/tts/browser-provider.js +3 -1
  35. package/dist/services/tts/tts-lifecycle.d.ts +142 -0
  36. package/dist/services/tts/tts-lifecycle.js +341 -0
  37. package/dist/tools/content-surfaces.d.ts +35 -0
  38. package/dist/tools/content-surfaces.js +35 -0
  39. package/dist/tools/registration.d.ts +2 -0
  40. package/dist/tools/registration.js +5 -0
  41. package/package.json +8 -8
  42. package/dist/components/chunks/ItemToolBar-4vq9nbxz.js +0 -2
  43. package/dist/components/chunks/ItemToolBar-f971t0cw.js +0 -4
  44. package/dist/components/chunks/ItemToolBar-n05xjkp8.js +0 -2
  45. package/dist/components/chunks/ItemToolBar-rgmvw9sm.js +0 -40
  46. package/dist/components/chunks/sre-engine-dq0w45fv.js +0 -1
@@ -1,2 +0,0 @@
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,40 +0,0 @@
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 +0,0 @@
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};