@citolab/qti-components 10.0.0-next.16 → 10.0.0-next.18

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 (67) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +233 -459
  3. package/dist/base.d.ts +12 -10
  4. package/dist/base.js +1 -0
  5. package/dist/chunk-DJ7PB252.js +7 -0
  6. package/dist/chunk-DJ7PB252.js.map +1 -0
  7. package/dist/{chunk-7MYZHZWV.js → chunk-DUKQ53E7.js} +46 -3
  8. package/dist/chunk-DUKQ53E7.js.map +1 -0
  9. package/dist/chunk-J6VX4N7M.js +197 -0
  10. package/dist/chunk-J6VX4N7M.js.map +1 -0
  11. package/dist/{chunk-J3F3JSCW.js → chunk-N453PANH.js} +2 -2
  12. package/dist/chunk-PZ5AY32C.js +10 -0
  13. package/dist/chunk-PZ5AY32C.js.map +1 -0
  14. package/dist/{chunk-NWSDBYK7.js → chunk-QLGUI5VG.js} +2 -2
  15. package/dist/{chunk-H3Z3TMFB.js → chunk-SUPLA6QQ.js} +9 -19
  16. package/dist/chunk-SUPLA6QQ.js.map +1 -0
  17. package/dist/chunk-UCXLDQYA.js +56 -0
  18. package/dist/chunk-UCXLDQYA.js.map +1 -0
  19. package/dist/{chunk-LQ65RILE.js → chunk-UURHLJVM.js} +66 -1803
  20. package/dist/chunk-UURHLJVM.js.map +1 -0
  21. package/dist/{chunk-4DC5Z2LQ.js → chunk-V5GL7PTC.js} +2 -2
  22. package/dist/{chunk-M4TZIB3W.js → chunk-WGUQCB2Z.js} +4 -54
  23. package/dist/chunk-WGUQCB2Z.js.map +1 -0
  24. package/dist/{computed.types.d-n3K2VvB0.d.ts → computed.types.d-D4wskgi0.d.ts} +1 -1
  25. package/dist/corrections.d.ts +13 -14
  26. package/dist/corrections.js +7 -7
  27. package/dist/corrections.js.map +1 -1
  28. package/dist/elements.d.ts +5 -105
  29. package/dist/elements.js +7 -4
  30. package/dist/index.d.ts +17 -13
  31. package/dist/index.js +17 -57
  32. package/dist/interactions.d.ts +5 -4
  33. package/dist/interactions.js +3 -2
  34. package/dist/item.d.ts +6 -4
  35. package/dist/item.js +1 -0
  36. package/dist/item.types.d-Zc6ZQDhu.d.ts +25 -0
  37. package/dist/loader.d.ts +4 -2
  38. package/dist/loader.js +1 -0
  39. package/dist/processing.d.ts +4 -3
  40. package/dist/processing.js +1 -0
  41. package/dist/public-events.d-3dGip9pd.d.ts +105 -0
  42. package/dist/qti-components-jsx.d.ts +2686 -4046
  43. package/dist/{qti-condition-expression.d-B-T1NNl0.d.ts → qti-condition-expression.d-7Kd4LBxn.d.ts} +1 -1
  44. package/dist/{qti-expression.d-B-Cfbqlb.d.ts → qti-expression.d-iH3w6mqf.d.ts} +2 -1
  45. package/dist/{qti-feedback.d-1JL_qHjc.d.ts → qti-feedback.d-CT0W-8Gm.d.ts} +1 -1
  46. package/dist/{qti-item.d-DDMDjWIk.d.ts → qti-item.d-CLChmRvB.d.ts} +2 -1
  47. package/dist/qti-test-state-BAf5AmJ2.d.ts +68 -0
  48. package/dist/qti-test-state.d-D8Q89RzZ.d.ts +57 -0
  49. package/dist/{qti-test.d-CDdyCp6e.d.ts → qti-test.d-COzv7YZG.d.ts} +9 -546
  50. package/dist/{qti-text-entry-interaction.d-BTAKmr4b.d.ts → qti-text-entry-interaction.d-DsUyecBC.d.ts} +3 -2
  51. package/dist/{record.d-Bojj6_LW.d.ts → record.d-BfZhFr0L.d.ts} +1 -1
  52. package/dist/{session.context.d-BNxGeyh9.d.ts → session.context.d-9gRdGK4T.d.ts} +1 -1
  53. package/dist/test-plugin-api.d.ts +134 -0
  54. package/dist/test-plugin-api.js +19 -0
  55. package/dist/test-plugin-api.js.map +1 -0
  56. package/dist/test.d.ts +16 -158
  57. package/dist/test.js +11 -50
  58. package/dist/transformers.js +1 -0
  59. package/dist/{item.types.d-DuVR0ZVK.d.ts → variables.d-DWHlTszN.d.ts} +1 -23
  60. package/package.json +7 -3
  61. package/dist/chunk-7MYZHZWV.js.map +0 -1
  62. package/dist/chunk-H3Z3TMFB.js.map +0 -1
  63. package/dist/chunk-LQ65RILE.js.map +0 -1
  64. package/dist/chunk-M4TZIB3W.js.map +0 -1
  65. /package/dist/{chunk-J3F3JSCW.js.map → chunk-N453PANH.js.map} +0 -0
  66. /package/dist/{chunk-NWSDBYK7.js.map → chunk-QLGUI5VG.js.map} +0 -0
  67. /package/dist/{chunk-4DC5Z2LQ.js.map → chunk-V5GL7PTC.js.map} +0 -0
package/cdn/index.js CHANGED
@@ -1,8 +1,8 @@
1
- var Hc=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Qt=function(o,t,e,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(o,e):r?r.value=e:t.set(o,e),e},it=function(o,t,e,i){if(e==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?i:e==="a"?i.call(o):i?i.value:t.get(o)},Ni,Wn,Qn,Ir,Ha,Tr,Xn,ii,Mr,Se,Gn,Wc;var Q={__proto__:null};Q.enumerable=!0;Object.freeze(Q);var Wa=(Se=class{constructor(t,e={}){if(Ni.set(this,!1),Wn.set(this,!1),Qn.set(this,!1),Ir.set(this,!1),Ha.set(this,Date.now()),Tr.set(this,!1),Xn.set(this,void 0),ii.set(this,void 0),Mr.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:i,cancelable:r,composed:n}=e;Qt(this,Ni,!!r,"f"),Qt(this,Wn,!!i,"f"),Qt(this,Qn,!!n,"f"),Qt(this,Xn,`${t}`,"f"),Qt(this,ii,null,"f"),Qt(this,Mr,!1,"f")}initEvent(t,e,i){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Qt(this,Ir,!0,"f")}get target(){return it(this,ii,"f")}get currentTarget(){return it(this,ii,"f")}get srcElement(){return it(this,ii,"f")}get type(){return it(this,Xn,"f")}get cancelable(){return it(this,Ni,"f")}get defaultPrevented(){return it(this,Ni,"f")&&it(this,Ir,"f")}get timeStamp(){return it(this,Ha,"f")}composedPath(){return it(this,Mr,"f")?[it(this,ii,"f")]:[]}get returnValue(){return!it(this,Ni,"f")||!it(this,Ir,"f")}get bubbles(){return it(this,Wn,"f")}get composed(){return it(this,Qn,"f")}get eventPhase(){return it(this,Mr,"f")?Se.AT_TARGET:Se.NONE}get cancelBubble(){return it(this,Tr,"f")}set cancelBubble(t){t&&Qt(this,Tr,!0,"f")}stopPropagation(){Qt(this,Tr,!0,"f")}get isTrusted(){return!1}},Ni=new WeakMap,Wn=new WeakMap,Qn=new WeakMap,Ir=new WeakMap,Ha=new WeakMap,Tr=new WeakMap,Xn=new WeakMap,ii=new WeakMap,Mr=new WeakMap,Se.NONE=0,Se.CAPTURING_PHASE=1,Se.AT_TARGET=2,Se.BUBBLING_PHASE=3,Se);Object.defineProperties(Wa.prototype,{initEvent:Q,stopImmediatePropagation:Q,preventDefault:Q,target:Q,currentTarget:Q,srcElement:Q,type:Q,cancelable:Q,defaultPrevented:Q,timeStamp:Q,composedPath:Q,returnValue:Q,bubbles:Q,composed:Q,eventPhase:Q,cancelBubble:Q,stopPropagation:Q,isTrusted:Q});var Qc=(Wc=class extends Wa{constructor(t,e={}){super(t,e),Gn.set(this,void 0),Qt(this,Gn,e?.detail??null,"f")}initCustomEvent(t,e,i,r){throw new Error("Method not implemented.")}get detail(){return it(this,Gn,"f")}},Gn=new WeakMap,Wc);Object.defineProperties(Qc.prototype,{detail:Q});var le=Wa,Qa=Qc;var lt;var Hg=(lt=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},lt.STYLE_RULE=1,lt.CHARSET_RULE=2,lt.IMPORT_RULE=3,lt.MEDIA_RULE=4,lt.FONT_FACE_RULE=5,lt.PAGE_RULE=6,lt.NAMESPACE_RULE=10,lt.KEYFRAMES_RULE=7,lt.KEYFRAME_RULE=8,lt.SUPPORTS_RULE=12,lt.COUNTER_STYLE_RULE=11,lt.FONT_FEATURE_VALUES_RULE=14,lt.MARGIN_RULE=9,lt);globalThis.Event??=le;globalThis.CustomEvent??=Qa;var Ga=Symbol(),Xc=o=>typeof o=="boolean"?o:o?.capture??!1,ce={__proto__:null};ce.enumerable=!0;Object.freeze(ce);var Jn=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,i){if(e==null)return;let r=Xc(i)?this.__captureEventListeners:this.__eventListeners,n=r.get(t);if(n===void 0)n=new Map,r.set(t,n);else if(n.has(e))return;let s=typeof i=="object"&&i?i:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,i)),n.set(e,s??{})}removeEventListener(t,e,i){if(e==null)return;let r=Xc(i)?this.__captureEventListeners:this.__eventListeners,n=r.get(t);n!==void 0&&(n.delete(e),n.size||r.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let i=!1,r=!1,n=le.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...ce},srcElement:{get(){return t.target},...ce},currentTarget:{get(){return l},...ce},eventPhase:{get(){return n},...ce},composedPath:{value:()=>e,...ce},stopPropagation:{value:()=>{i=!0,c.call(t)},...ce},stopImmediatePropagation:{value:()=>{r=!0,d.call(t)},...ce}});let h=(u,g,b)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&b.delete(u)},f=()=>(l=null,n=le.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),l=u,n=u===t.target?le.AT_TARGET:le.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),r)return f()}if(i)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&y(x.slice(0,x.indexOf(u)+1)),l=u,n=u===t.target?le.AT_TARGET:le.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),r)return f()}if(i)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,Yc,Uu]}};var Gc=new WeakMap,Pr=o=>{let t=Gc.get(o);return t===void 0&&Gc.set(o,t=new Map),t},Or=class extends Jn{getRootNode(t){return t?.composed?Xa:this.__host?.__shadowRoot??Xa}};var Jc=class extends Or{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var Yc=new Jc,Xa=Yc;var Kc=class extends Or{constructor(t){if(super(),t!==Ga)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Yn,customElements:Ya,document:Xa,Document:Jc,Element:Zc,EventTarget:Jn,HTMLElement:td,Node:Or,ShadowRoot:ed,window:this,Window:Kc})}};var Zc=class extends Or{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Pr(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){Pr(this).set(t,String(e))}removeAttribute(t){Pr(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return Pr(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new ed(Ga,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new Hc(this);return this.__internals=t,t}getAttribute(t){return Pr(this).get(t)??null}};var td=class extends Zc{},Ja=td;var ed=class extends Or{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new Ja,"localName",{get(){return"lit-server-root"}});function zu(){let o,t;return{promise:new Promise((i,r)=>{o=i,t=r}),resolve:o,reject:t}}var Yn=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
2
- Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let i=this.__pendingWhenDefineds.get(t);return i||(i=zu(),this.__pendingWhenDefineds.set(t,i)),i.promise}},Bu=Yn;var Ya=new Bu,Uu=new Kc(Ga);var Dr=globalThis,Kn=Dr.ShadowRoot&&(Dr.ShadyCSS===void 0||Dr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ka=Symbol(),id=new WeakMap,$r=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==Ka)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Kn&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=id.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&id.set(e,t))}return t}toString(){return this.cssText}},rd=o=>new $r(typeof o=="string"?o:o+"",void 0,Ka),w=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((i,r,n)=>i+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+o[n+1],o[0]);return new $r(e,o,Ka)},nd=(o,t)=>{if(Kn)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let i=document.createElement("style"),r=Dr.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=e.cssText,o.appendChild(i)}},Za=Kn||Dr.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return rd(e)})(o):o;var{is:Hu,defineProperty:Wu,getOwnPropertyDescriptor:Qu,getOwnPropertyNames:Xu,getOwnPropertySymbols:Gu,getPrototypeOf:Ju}=Object,Vr=globalThis;Vr.customElements??=Ya;var od=Vr.trustedTypes,Yu=od?od.emptyScript:"",Ku=Vr.reactiveElementPolyfillSupport,Nr=(o,t)=>o,Lr={toAttribute(o,t){switch(t){case Boolean:o=o?Yu:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},Zn=(o,t)=>!Hu(o,t),sd={attribute:!0,type:String,converter:Lr,reflect:!1,useDefault:!1,hasChanged:Zn};Symbol.metadata??=Symbol("metadata"),Vr.litPropertyMetadata??=new WeakMap;var de=class extends(globalThis.HTMLElement??Ja){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=sd){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let i=Symbol(),r=this.getPropertyDescriptor(t,i,e);r!==void 0&&Wu(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){let{get:r,set:n}=Qu(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:r,set(s){let a=r?.call(this);n?.call(this,s),this.requestUpdate(t,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??sd}static _$Ei(){if(this.hasOwnProperty(Nr("elementProperties")))return;let t=Ju(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Nr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Nr("properties"))){let e=this.properties,i=[...Xu(e),...Gu(e)];for(let r of i)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,r]of e)this.elementProperties.set(i,r)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let r=this._$Eu(e,i);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let r of i)e.unshift(Za(r))}else t!==void 0&&e.push(Za(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return nd(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){let i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){let n=(i.converter?.toAttribute!==void 0?i.converter:Lr).toAttribute(e,i.type);this._$Em=t,n==null?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){let i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let n=i.getPropertyOptions(r),s=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Lr;this._$Em=r;let a=s.fromAttribute(e,n.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(t,e,i,r=!1,n){if(t!==void 0){let s=this.constructor;if(r===!1&&(n=this[t]),i??=s.getPropertyOptions(t),!((i.hasChanged??Zn)(n,e)||i.useDefault&&i.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:r,wrapped:n},s){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),n!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),r===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,n]of this._$Ep)this[r]=n;this._$Ep=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[r,n]of i){let{wrapped:s}=n,a=this[r];s!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};de.elementStyles=[],de.shadowRootOptions={mode:"open"},de[Nr("elementProperties")]=new Map,de[Nr("finalized")]=new Map,Ku?.({ReactiveElement:de}),(Vr.reactiveElementVersions??=[]).push("2.1.2");var so=globalThis,ad=o=>o,to=so.trustedTypes,ld=to?to.createPolicy("lit-html",{createHTML:o=>o}):void 0,el="$lit$",he=`lit$${Math.random().toFixed(9).slice(2)}$`,il="?"+he,Zu=`<${il}>`,oi=so.document===void 0?{createTreeWalker:()=>({})}:document,Fr=()=>oi.createComment(""),zr=o=>o===null||typeof o!="object"&&typeof o!="function",rl=Array.isArray,md=o=>rl(o)||typeof o?.[Symbol.iterator]=="function",tl=`[
3
- \f\r]`,jr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,cd=/-->/g,dd=/>/g,ri=RegExp(`>|${tl}(?:([^\\s"'>=/]+)(${tl}*=${tl}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),hd=/'/g,pd=/"/g,fd=/^(?:script|style|textarea|title)$/i,nl=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=nl(1),Ur=nl(2),kb=nl(3),ot=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),ud=new WeakMap,ni=oi.createTreeWalker(oi,129);function gd(o,t){if(!rl(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return ld!==void 0?ld.createHTML(t):t}var bd=(o,t)=>{let e=o.length-1,i=[],r,n=t===2?"<svg>":t===3?"<math>":"",s=jr;for(let a=0;a<e;a++){let l=o[a],c,d,h=-1,f=0;for(;f<l.length&&(s.lastIndex=f,d=s.exec(l),d!==null);)f=s.lastIndex,s===jr?d[1]==="!--"?s=cd:d[1]!==void 0?s=dd:d[2]!==void 0?(fd.test(d[2])&&(r=RegExp("</"+d[2],"g")),s=ri):d[3]!==void 0&&(s=ri):s===ri?d[0]===">"?(s=r??jr,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?ri:d[3]==='"'?pd:hd):s===pd||s===hd?s=ri:s===cd||s===dd?s=jr:(s=ri,r=void 0);let m=s===ri&&o[a+1].startsWith("/>")?" ":"";n+=s===jr?l+Zu:h>=0?(i.push(c),l.slice(0,h)+el+l.slice(h)+he+m):l+he+(h===-2?a:m)}return[gd(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},Br=class o{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let n=0,s=0,a=t.length-1,l=this.parts,[c,d]=bd(t,e);if(this.el=o.createElement(c,i),ni.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=ni.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(el)){let f=d[s++],m=r.getAttribute(h).split(he),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?io:y[1]==="?"?ro:y[1]==="@"?no:ai}),r.removeAttribute(h)}else h.startsWith(he)&&(l.push({type:6,index:n}),r.removeAttribute(h));if(fd.test(r.tagName)){let h=r.textContent.split(he),f=h.length-1;if(f>0){r.textContent=to?to.emptyScript:"";for(let m=0;m<f;m++)r.append(h[m],Fr()),ni.nextNode(),l.push({type:2,index:++n});r.append(h[f],Fr())}}}else if(r.nodeType===8)if(r.data===il)l.push({type:2,index:n});else{let h=-1;for(;(h=r.data.indexOf(he,h+1))!==-1;)l.push({type:7,index:n}),h+=he.length-1}n++}}static createElement(t,e){let i=oi.createElement("template");return i.innerHTML=t,i}};function si(o,t,e=o,i){if(t===ot)return t;let r=i!==void 0?e._$Co?.[i]:e._$Cl,n=zr(t)?void 0:t._$litDirective$;return r?.constructor!==n&&(r?._$AO?.(!1),n===void 0?r=void 0:(r=new n(o),r._$AT(o,e,i)),i!==void 0?(e._$Co??=[])[i]=r:e._$Cl=r),r!==void 0&&(t=si(o,r._$AS(o,t.values),r,i)),t}var eo=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:i}=this._$AD,r=(t?.creationScope??oi).importNode(e,!0);ni.currentNode=r;let n=ni.nextNode(),s=0,a=0,l=i[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Li(n,n.nextSibling,this,t):l.type===1?c=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(c=new oo(n,this,t)),this._$AV.push(c),l=i[++a]}s!==l?.index&&(n=ni.nextNode(),s++)}return ni.currentNode=oi,r}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},Li=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=si(this,t,e),zr(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==ot&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):md(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==P&&zr(this._$AH)?this._$AA.nextSibling.data=t:this.T(oi.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=Br.createElement(gd(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(e);else{let n=new eo(r,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(t){let e=ud.get(t.strings);return e===void 0&&ud.set(t.strings,e=new Br(t)),e}k(t){rl(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,r=0;for(let n of t)r===e.length?e.push(i=new o(this.O(Fr()),this.O(Fr()),this,this.options)):i=e[r],i._$AI(n),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let i=ad(t).nextSibling;ad(t).remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ai=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,n){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=P}_$AI(t,e=this,i,r){let n=this.strings,s=!1;if(n===void 0)t=si(this,t,e,0),s=!zr(t)||t!==this._$AH&&t!==ot,s&&(this._$AH=t);else{let a=t,l,c;for(t=n[0],l=0;l<n.length-1;l++)c=si(this,a[i+l],e,l),c===ot&&(c=this._$AH[l]),s||=!zr(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+n[l+1]),this._$AH[l]=c}s&&!r&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},io=class extends ai{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},ro=class extends ai{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},no=class extends ai{constructor(t,e,i,r,n){super(t,e,i,r,n),this.type=5}_$AI(t,e=this){if((t=si(this,t,e,0)??P)===ot)return;let i=this._$AH,r=t===P&&i!==P||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,n=t!==P&&(i===P||r);r&&this.element.removeEventListener(this.name,this,i),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},oo=class{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){si(this,t)}},rt={M:el,P:he,A:il,C:1,L:bd,R:eo,D:md,V:si,I:Li,H:ai,N:ro,U:no,B:io,F:oo},tm=so.litHtmlPolyfillSupport;tm?.(Br,Li),(so.litHtmlVersions??=[]).push("3.3.3");var ol=(o,t,e)=>{let i=e?.renderBefore??t,r=i._$litPart$;if(r===void 0){let n=e?.renderBefore??null;i._$litPart$=r=new Li(t.insertBefore(Fr(),n),n,void 0,e??{})}return r._$AI(o),r};var sl=globalThis,C=class extends de{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ol(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return ot}};C._$litElement$=!0,C.finalized=!0,sl.litElementHydrateSupport?.({LitElement:C});var em=sl.litElementPolyfillSupport;em?.({LitElement:C});(sl.litElementVersions??=[]).push("4.2.2");var im={attribute:!0,type:String,converter:Lr,reflect:!1,hasChanged:Zn},rm=(o=im,t,e)=>{let{kind:i,metadata:r}=e,n=globalThis.litPropertyMetadata.get(r);if(n===void 0&&globalThis.litPropertyMetadata.set(r,n=new Map),i==="setter"&&((o=Object.create(o)).wrapped=!0),n.set(e.name,o),i==="accessor"){let{name:s}=e;return{set(a){let l=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,l,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(i==="setter"){let{name:s}=e;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,o,!0,a)}}throw Error("Unsupported decorator location: "+i)};function p(o){return(t,e)=>typeof e=="object"?rm(o,t,e):((i,r,n)=>{let s=r.hasOwnProperty(n);return r.constructor.createProperty(n,i),s?Object.getOwnPropertyDescriptor(r,n):void 0})(o,t,e)}function R(o){return p({...o,state:!0,attribute:!1})}var Ee=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Vi(o,t){return(e,i,r)=>{let n=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof i=="object"?e:r??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return Ee(e,i,{get(){let l=s.call(this);return l===void 0&&(l=n(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return Ee(e,i,{get(){return n(this)}})}}function vd(o){return(t,e)=>{let{slot:i,selector:r}=o??{},n="slot"+(i?`[name=${i}]`:":not([name])");return Ee(t,e,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(o)??[];return r===void 0?a:a.filter(l=>l.matches(r))}})}}var pe=class extends Event{constructor(t,e,i,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=i,this.subscribe=r??!1}};var dt=class{constructor(t,e,i,r){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=i,this.subscribe=r??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new pe(this.context,this.host,this.t,this.subscribe))}};var ao=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let i=e||!Object.is(t,this.o);this.o=t,i&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:i}]of this.subscriptions)e(this.o,i)},t!==void 0&&(this.value=t)}addCallback(t,e,i){if(!i)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:r}=this.subscriptions.get(t);t(this.value,r)}clearCallbacks(){this.subscriptions.clear()}};var al=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},Xt=class extends ao{constructor(t,e,i){super(e.context!==void 0?e.initialValue:i),this.onContextRequest=r=>{if(r.context!==this.context)return;let n=r.contextTarget??r.composedPath()[0];n!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,n,r.subscribe))},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.composedPath()[0])===this.host)return;let n=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)n.has(s)||(n.add(s),a.dispatchEvent(new pe(this.context,a,s,!0)));r.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new al(this.context,this.host))}};var Hr=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:i}=e;for(let{elementRef:r,callbackRef:n}of i){let s=r.deref(),a=n.deref();s===void 0||a===void 0||s.dispatchEvent(new pe(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],i=t.callback,r=this.pendingContextRequests.get(t.context);r===void 0&&this.pendingContextRequests.set(t.context,r={callbacks:new WeakMap,requests:[]});let n=r.callbacks.get(e);n===void 0&&r.callbacks.set(e,n=new WeakSet),n.has(i)||(n.add(i),r.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(i)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function X({context:o}){return(t,e)=>{let i=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(r){return i.get(this).setValue(r),t.set.call(this,r)},init(r){return i.set(this,new Xt(this,{context:o,initialValue:r})),r}};{t.constructor.addInitializer((s=>{i.set(s,new Xt(s,{context:o}))}));let r=Object.getOwnPropertyDescriptor(t,e),n;if(r===void 0){let s=new WeakMap;n={get(){return s.get(this)},set(a){i.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=r.set;n={...r,set(a){i.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}function I({context:o,subscribe:t}){return(e,i)=>{typeof i=="object"?i.addInitializer((function(){new dt(this,{context:o,callback:r=>{e.set.call(this,r)},subscribe:t})})):e.constructor.addInitializer((r=>{new dt(r,{context:o,callback:n=>{r[i]=n},subscribe:t})}))}}var lo=["this"],yd=["+","-","!"],qd=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],ll={"!":0,":":0,",":0,")":0,"]":0,"}":0,"|>":1,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"{":13},co=13;var nm=["==","!=","<=",">=","||","&&","??","|>"],om=["===","!=="],O;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(O||(O={}));var Gt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),sm=o=>o===9||o===10||o===13||o===32,xd=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),am=o=>xd(o)||Wr(o),lm=o=>lo.indexOf(o)!==-1,cm=o=>o===34||o===39,Wr=o=>48<=o&&o<=57,dm=o=>o===43||o===45||o===42||o===47||o===33||o===38||o===37||o===60||o===61||o===62||o===63||o===94||o===124,hm=o=>o===40||o===41||o===91||o===93||o===123||o===125,pm=o=>o.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
5
- `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),ho=class{#t;#e=-1;#i=0;#r;constructor(t){this.#t=t,this.#n()}nextToken(){for(;sm(this.#r);)this.#n(!0);if(cm(this.#r))return this.#a();if(xd(this.#r))return this.#d();if(Wr(this.#r))return this.#u();if(this.#r===46)return this.#l();if(this.#r===44)return this.#h();if(this.#r===58)return this.#c();if(dm(this.#r))return this.#p();if(hm(this.#r))return this.#g();if(this.#n(),this.#r!==void 0)throw new Error(`Expected end of input, got ${this.#r}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#r=this.#t.charCodeAt(this.#e),t===!0&&(this.#i=this.#e)):this.#r=void 0}#o(t=0){let e=this.#t.substring(this.#i,this.#e+t);return t===0&&this.#s(),e}#s(){this.#i=this.#e}#a(){let t="unterminated string",e=this.#r;for(this.#n(!0);this.#r!==e;){if(this.#r===void 0)throw new Error(t);if(this.#r===92&&(this.#n(),this.#r===void 0))throw new Error(t);this.#n()}let i=Gt(O.STRING,pm(this.#o()));return this.#n(),i}#d(){do this.#n();while(am(this.#r));let t=this.#o(),e=lm(t)?O.KEYWORD:O.IDENTIFIER;return Gt(e,t)}#u(){do this.#n();while(Wr(this.#r));return this.#r===46?this.#l():Gt(O.INTEGER,this.#o())}#l(){return this.#n(),Wr(this.#r)?this.#m():(this.#s(),Gt(O.DOT,".",co))}#h(){return this.#n(!0),Gt(O.COMMA,",")}#c(){return this.#n(!0),Gt(O.COLON,":")}#m(){do this.#n();while(Wr(this.#r));return Gt(O.DECIMAL,this.#o())}#p(){this.#n();let t=this.#o(2);if(om.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Gt(O.ARROW,t);nm.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Gt(O.OPERATOR,t,ll[t])}#g(){let t=String.fromCharCode(this.#r),e=Gt(O.GROUPER,t,ll[t]);return this.#n(!0),e}};var cl=(o,t)=>new Qr(o,t).parse(),Qr=class{#t;#e;#i;#r;#n;constructor(t,e){this.#e=new ho(t),this.#i=e}parse(){return this.#o(),this.#s()}#o(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#r?.kind} (${this.#r?.value})`);let i=this.#e.nextToken();this.#r=i,this.#t=i?.kind,this.#n=i?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#n!==e)}#s(){if(!this.#r)return this.#i.empty();let t=this.#l();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#r;)if(this._matches(O.GROUPER,"(")){let i=this.#v();t=this.#i.invoke(t,void 0,i)}else if(this._matches(O.GROUPER,"[")){let i=this.#f();t=this.#i.index(t,i)}else if(this._matches(O.DOT)){this.#o();let i=this.#l();t=this.#d(t,i)}else{if(this._matches(O.KEYWORD))break;if(this._matches(O.OPERATOR)&&this.#r.precedence>=e)t=this.#n==="?"?this.#h(t):this.#u(t,this.#r);else break}return t}#d(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#i.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let i=e.receiver;return this.#i.invoke(t,i.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#u(t,e){if(qd.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let i=this.#l();for(;(this.#t===O.OPERATOR||this.#t===O.DOT||this.#t===O.GROUPER)&&this.#r.precedence>e.precedence;)i=this.#a(i,this.#r.precedence);return this.#i.binary(t,e.value,i)}#l(){if(this._matches(O.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(O.INTEGER))return this.#x(t);if(this._matches(O.DECIMAL))return this.#k(t)}if(yd.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#c(),co);return this.#i.unary(t,e)}return this.#c()}#h(t){this.#o(O.OPERATOR,"?");let e=this.#s();this.#o(O.COLON);let i=this.#s();return this.#i.ternary(t,e,i)}#c(){switch(this.#t){case O.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#i.id(t);throw lo.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case O.IDENTIFIER:return this.#g();case O.STRING:return this.#q();case O.INTEGER:return this.#x();case O.DECIMAL:return this.#k();case O.GROUPER:return this.#n==="("?this.#y():this.#n==="{"?this.#p():this.#n==="["?this.#m():void 0;case O.COLON:throw new Error('unexpected token ":"');default:return}}#m(){let t=[];do{if(this.#o(),this._matches(O.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"]"),this.#i.list(t)}#p(){let t={};do{if(this.#o(),this._matches(O.GROUPER,"}"))break;let e=this.#n;(this._matches(O.STRING)||this._matches(O.IDENTIFIER))&&this.#o(),this.#o(O.COLON),t[e]=this.#s()}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"}"),this.#i.map(t)}#g(){let t=this.#n;if(t==="true")return this.#o(),this.#i.literal(!0);if(t==="false")return this.#o(),this.#i.literal(!1);if(t==="null")return this.#o(),this.#i.literal(null);if(t==="undefined")return this.#o(),this.#i.literal(void 0);let e=this.#b(),i=this.#v();return i?this.#i.invoke(e,void 0,i):e}#b(){if(!this._matches(O.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let t=this.#n;return this.#o(),this.#i.id(t)}#v(){if(!this._matches(O.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(O.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(O.COMMA));return this.#o(O.GROUPER,")"),t}#f(){this.#o();let t=this.#s();return this.#o(O.GROUPER,"]"),t}#y(){let t=this.#v();if(this._matches(O.ARROW)){this.#o();let e=this.#s(),i=t?.map(r=>r.value)??[];return this.#i.arrowFunction(i,e)}else return this.#i.paren(t[0])}#q(){let t=this.#i.literal(this.#n);return this.#o(),t}#x(t=""){let e=this.#i.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#k(t=""){let e=this.#i.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:wd,fromEntries:um}=Object,mm={"+":(o,t)=>o+t,"-":(o,t)=>o-t,"*":(o,t)=>o*t,"/":(o,t)=>o/t,"%":(o,t)=>o%t,"==":(o,t)=>o==t,"!=":(o,t)=>o!=t,"===":(o,t)=>o===t,"!==":(o,t)=>o!==t,">":(o,t)=>o>t,">=":(o,t)=>o>=t,"<":(o,t)=>o<t,"<=":(o,t)=>o<=t,"||":(o,t)=>o||t,"&&":(o,t)=>o&&t,"??":(o,t)=>o??t,"|":(o,t)=>t(o),"|>":(o,t)=>t(o)},fm={"+":o=>o,"-":o=>-o,"!":o=>!o},po=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let i=fm[t];return{type:"Unary",operator:t,child:e,evaluate(r){return i(this.child.evaluate(r))},getIds(r){return this.child.getIds(r)}}}binary(t,e,i){let r=mm[e];return{type:"Binary",operator:e,left:t,right:i,evaluate(n){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(n),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),l=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,l=this.left.value),a===void 0?void 0:a[l]=s}return r(this.left.evaluate(n),this.right.evaluate(n))},getIds(n){return this.left.getIds(n),this.right.getIds(n),n}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(i){return this.receiver.evaluate(i)?.[this.name]},getIds(i){return this.receiver.getIds(i),i}}}invoke(t,e,i){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:i,evaluate(r){let n=this.receiver.evaluate(r),s=this.method?n:r?.this??r,a=this.method?n?.[e]:n,c=(this.arguments??[]).map(d=>d?.evaluate(r));return a?.apply?.(s,c)},getIds(r){return this.receiver.getIds(r),this.arguments?.forEach(n=>n?.getIds(r)),r}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(i){return this.receiver.evaluate(i)?.[this.argument.evaluate(i)]},getIds(i){return this.receiver.getIds(i),i}}}ternary(t,e,i){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:i,evaluate(r){return this.condition.evaluate(r)?this.trueExpr.evaluate(r):this.falseExpr.evaluate(r)},getIds(r){return this.condition.getIds(r),this.trueExpr.getIds(r),this.falseExpr.getIds(r),r}}}map(t){return{type:"Map",entries:t,evaluate(e){let i={};if(t&&this.entries)for(let r in t){let n=this.entries[r];n&&(i[r]=n.evaluate(e))}return i},getIds(e){if(t&&this.entries)for(let i in t){let r=this.entries[i];r&&r.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(i=>i?.evaluate(e))},getIds(e){return this.items?.forEach(i=>i?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(i){let r=this.params,n=this.body;return function(...s){let a=um(r.map((c,d)=>[c,s[d]])),l=new Proxy(i??{},{set(c,d,h){return wd(a,d)&&(a[d]=h),c[d]=h},get(c,d){return wd(a,d)?a[d]:c[d]}});return n.evaluate(l)}},getIds(i){return this.body.getIds(i).filter(r=>!this.params.includes(r))}}}};var dl=null,Cd={boundAttributeSuffix:rt.M,marker:rt.P,markerMatch:rt.A,HTML_RESULT:rt.C,getTemplateHtml:rt.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,i){return t(this,i)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){dl??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(dl))return void(e[dl]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let i=ot;return o.j=r=>i=r,o._$AI(t,o,e),i},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:rt.V,AttributePart:rt.H,PropertyPart:rt.B,BooleanAttributePart:rt.N,EventPart:rt.U,ElementPart:rt.F,TemplateInstance:rt.R,isIterable:rt.D,ChildPart:rt.I};var{AttributePart:gm,PropertyPart:bm,BooleanAttributePart:vm,EventPart:ym}=Cd,pl=new po,hl=new Map,kd=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),uo=(o,t)=>{let e=hl.get(o);if(e===void 0){if(hl.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let i=o.substring(2,o.length-2).trim();e=new Qr(i,pl).parse(),hl.set(o,e)}}return e?.evaluate(t)},qm=(o,t,e,i)=>{let r=o.getAttribute("if");if(r!==null&&uo(r,t))return mo(o,t,e,i)},Sd=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Ed=o=>/(?:\\{{)|(?:\\}})/g.test(o),Xr=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),xm=(o,t,e,i)=>{let r=o.getAttribute("repeat");if(r!==null){let n=uo(r,t);if(!n[Symbol.iterator])return P;let s=Gr(o),a=-1,l=[];for(let c of n){a++;let d=Object.create(t);d.item=c,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let y=m.update(d,e,i);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};l.push(f)}return l}},_d={if:qm,repeat:xm},Ae=(o,t=_d,e={},i)=>{let n=Gr(o).renderers;if(i){let a=Gr(i).renderers,l=n.super;l!==void 0?e={...n,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,y)=>mo(i,f,m,y)},l(c,d,h))}:(e={...a,...n,...e},o=i)}else e={...n,...e};return s=>mo(o,s,t,e)};var mo=(o,t,e=_d,i={})=>{let r=Gr(o),n=[];for(let a of r.parts){let l=a.update(t,e,i);a.type===1?n.push(...l):n.push(l)}return{_$litType$:r,values:n}},Ad=new Map,Gr=o=>{let t=Ad.get(o);return t===void 0&&Ad.set(o,t=wm(o)),t},wm=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),i=e.currentNode,r=-1,n=[];for(;(i=e.nextNode())!==null;)if(i.nodeType===Node.COMMENT_NODE)r++;else if(i.nodeType===Node.ELEMENT_NODE){r++;let s=i;if(s.tagName==="TEMPLATE"){let l=s.getAttribute("type"),c=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||l!==null||c!==null){s.parentNode.insertBefore(document.createComment(""),s),n.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:uo(g,y);return(m?uo(f,y):u[d])?.(b,x,u)}}else l!==null?h=(f,m,y)=>{let x=m[l];return x?.(s,f,m,y)}:(c==="super"?t.renderers.super=(f,m,y)=>{let x=y.super,u=Gr(s);return y={...y,...u.renderers},x(f,m,y)}:t.renderers[c]=(f,m,y)=>mo(s,f,m,y),h=(f,m,y)=>{let x=y[c];return x?.(f,m,y)});t.parts.push({type:2,index:r,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(Sd);if(d.length===1){Ed(c)&&s.setAttribute(l,Xr(c));continue}s.removeAttribute(l);let h=l,f=gm,m=l[0];m==="."?(h=kd(l.substring(1)),f=bm):m==="?"?(h=l.substring(1),f=vm):m==="@"&&(h=kd(l.substring(1)),f=ym);let y=[Xr(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(cl(g,pl)),y.push(Xr(d[u+1]))}t.parts.push({type:1,index:r,name:h,strings:y,ctor:f,update:(u,g,b)=>x.map(q=>q.evaluate(u))})}}else if(i.nodeType===Node.TEXT_NODE){let s=i,a=s.textContent,l=a.split(Sd);l.length>1?s.textContent=Xr(l[0]):Ed(a)&&(s.textContent=Xr(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=cl(d,pl);t.parts.push({type:2,index:++r,update:(m,y)=>h.evaluate(m)});let f=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of n)s.remove();return t};var ul=Symbol.for("qti-components.context-root"),Cm=()=>{if(typeof document>"u")return;let o=globalThis;o[ul]||(o[ul]=new Hr,o[ul].attach(document.documentElement))};Cm();var Rd=[];var fl=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#i():queueMicrotask(()=>this.#i())}#i(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},ml="custom-state-support-probe";function km(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(ml)||customElements.define(ml,class extends HTMLElement{});let t=o.call(document.createElement(ml)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var Id=!1;function Td(){if(Id)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=km(o);return t==="modern"||(Id=!0,HTMLElement.prototype.attachInternals=function(){let i=o.call(this);return Object.defineProperty(i,"states",{configurable:!0,enumerable:!0,value:new fl(this)}),i}),t}Td();for(let{tag:o,ctor:t}of Rd)customElements.get(o)||customElements.define(o,t);var _e=Symbol("computedItemContext");var z=Symbol("computedContext");var wt=Symbol("configContext");var ji=Symbol("interactionContext");var F=Symbol("item");var Md=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Sm=/^[A-Za-z0-9-]+$/,Em=o=>typeof o=="string"&&Sm.test(o),gy=o=>Em(o)?o:void 0,Ct=Symbol("qtiContext");var gl={view:"candidate"},Re=Symbol("sessionContext");var bl={items:[],testOutcomeVariables:[]},st=Symbol("testContext");var M=w`
1
+ var dl=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var zt=function(o,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(o,e):i?i.value=e:t.set(o,e),e},tt=function(o,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(o):r?r.value:t.get(o)},Er,_n,Tn,bi,va,vi,Rn,Ge,yi,qe,In,hl;var W={__proto__:null};W.enumerable=!0;Object.freeze(W);var ya=(qe=class{constructor(t,e={}){if(Er.set(this,!1),_n.set(this,!1),Tn.set(this,!1),bi.set(this,!1),va.set(this,Date.now()),vi.set(this,!1),Rn.set(this,void 0),Ge.set(this,void 0),yi.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:n}=e;zt(this,Er,!!i,"f"),zt(this,_n,!!r,"f"),zt(this,Tn,!!n,"f"),zt(this,Rn,`${t}`,"f"),zt(this,Ge,null,"f"),zt(this,yi,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){zt(this,bi,!0,"f")}get target(){return tt(this,Ge,"f")}get currentTarget(){return tt(this,Ge,"f")}get srcElement(){return tt(this,Ge,"f")}get type(){return tt(this,Rn,"f")}get cancelable(){return tt(this,Er,"f")}get defaultPrevented(){return tt(this,Er,"f")&&tt(this,bi,"f")}get timeStamp(){return tt(this,va,"f")}composedPath(){return tt(this,yi,"f")?[tt(this,Ge,"f")]:[]}get returnValue(){return!tt(this,Er,"f")||!tt(this,bi,"f")}get bubbles(){return tt(this,_n,"f")}get composed(){return tt(this,Tn,"f")}get eventPhase(){return tt(this,yi,"f")?qe.AT_TARGET:qe.NONE}get cancelBubble(){return tt(this,vi,"f")}set cancelBubble(t){t&&zt(this,vi,!0,"f")}stopPropagation(){zt(this,vi,!0,"f")}get isTrusted(){return!1}},Er=new WeakMap,_n=new WeakMap,Tn=new WeakMap,bi=new WeakMap,va=new WeakMap,vi=new WeakMap,Rn=new WeakMap,Ge=new WeakMap,yi=new WeakMap,qe.NONE=0,qe.CAPTURING_PHASE=1,qe.AT_TARGET=2,qe.BUBBLING_PHASE=3,qe);Object.defineProperties(ya.prototype,{initEvent:W,stopImmediatePropagation:W,preventDefault:W,target:W,currentTarget:W,srcElement:W,type:W,cancelable:W,defaultPrevented:W,timeStamp:W,composedPath:W,returnValue:W,bubbles:W,composed:W,eventPhase:W,cancelBubble:W,stopPropagation:W,isTrusted:W});var pl=(hl=class extends ya{constructor(t,e={}){super(t,e),In.set(this,void 0),zt(this,In,e?.detail??null,"f")}initCustomEvent(t,e,r,i){throw new Error("Method not implemented.")}get detail(){return tt(this,In,"f")}},In=new WeakMap,hl);Object.defineProperties(pl.prototype,{detail:W});var ie=ya,qa=pl;var ot;var tg=(ot=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},ot.STYLE_RULE=1,ot.CHARSET_RULE=2,ot.IMPORT_RULE=3,ot.MEDIA_RULE=4,ot.FONT_FACE_RULE=5,ot.PAGE_RULE=6,ot.NAMESPACE_RULE=10,ot.KEYFRAMES_RULE=7,ot.KEYFRAME_RULE=8,ot.SUPPORTS_RULE=12,ot.COUNTER_STYLE_RULE=11,ot.FONT_FEATURE_VALUES_RULE=14,ot.MARGIN_RULE=9,ot);globalThis.Event??=ie;globalThis.CustomEvent??=qa;var wa=Symbol(),ul=o=>typeof o=="boolean"?o:o?.capture??!1,ne={__proto__:null};ne.enumerable=!0;Object.freeze(ne);var Mn=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let i=ul(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);if(n===void 0)n=new Map,i.set(t,n);else if(n.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),n.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let i=ul(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);n!==void 0&&(n.delete(e),n.size||i.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,i=!1,n=ie.NONE,s=null,a=null,c=null,l=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...ne},srcElement:{get(){return t.target},...ne},currentTarget:{get(){return c},...ne},eventPhase:{get(){return n},...ne},composedPath:{value:()=>e,...ne},stopPropagation:{value:()=>{r=!0,l.call(t)},...ne},stopImmediatePropagation:{value:()=>{i=!0,d.call(t)},...ne}});let h=(u,g,b)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&b.delete(u)},f=()=>(c=null,n=ie.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),c=u,n=u===t.target?ie.AT_TARGET:ie.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&y(x.slice(0,x.indexOf(u)+1)),c=u,n=u===t.target?ie.AT_TARGET:ie.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,gl,nu]}};var ml=new WeakMap,qi=o=>{let t=ml.get(o);return t===void 0&&ml.set(o,t=new Map),t},xi=class extends Mn{getRootNode(t){return t?.composed?xa:this.__host?.__shadowRoot??xa}};var fl=class extends xi{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var gl=new fl,xa=gl;var bl=class extends xi{constructor(t){if(super(),t!==wa)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Pn,customElements:ka,document:xa,Document:fl,Element:vl,EventTarget:Mn,HTMLElement:yl,Node:xi,ShadowRoot:ql,window:this,Window:bl})}};var vl=class extends xi{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(qi(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){qi(this).set(t,String(e))}removeAttribute(t){qi(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return qi(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new ql(wa,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new dl(this);return this.__internals=t,t}getAttribute(t){return qi(this).get(t)??null}};var yl=class extends vl{},Ca=yl;var ql=class extends xi{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new Ca,"localName",{get(){return"lit-server-root"}});function ru(){let o,t;return{promise:new Promise((r,i)=>{o=r,t=i}),resolve:o,reject:t}}var Pn=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
2
+ Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let r=this.__pendingWhenDefineds.get(t);return r||(r=ru(),this.__pendingWhenDefineds.set(t,r)),r.promise}},iu=Pn;var ka=new iu,nu=new bl(wa);var wi=globalThis,On=wi.ShadowRoot&&(wi.ShadyCSS===void 0||wi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Sa=Symbol(),xl=new WeakMap,Ci=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Sa)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(On&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=xl.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&xl.set(e,t))}return t}toString(){return this.cssText}},wl=o=>new Ci(typeof o=="string"?o:o+"",void 0,Sa),w=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,i,n)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[n+1],o[0]);return new Ci(e,o,Sa)},Cl=(o,t)=>{if(On)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=wi.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,o.appendChild(r)}},Ea=On||wi.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return wl(e)})(o):o;var{is:ou,defineProperty:su,getOwnPropertyDescriptor:au,getOwnPropertyNames:cu,getOwnPropertySymbols:lu,getPrototypeOf:du}=Object,Ei=globalThis;Ei.customElements??=ka;var kl=Ei.trustedTypes,hu=kl?kl.emptyScript:"",pu=Ei.reactiveElementPolyfillSupport,ki=(o,t)=>o,Si={toAttribute(o,t){switch(t){case Boolean:o=o?hu:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},Dn=(o,t)=>!ou(o,t),Sl={attribute:!0,type:String,converter:Si,reflect:!1,useDefault:!1,hasChanged:Dn};Symbol.metadata??=Symbol("metadata"),Ei.litPropertyMetadata??=new WeakMap;var oe=class extends(globalThis.HTMLElement??Ca){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Sl){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&su(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:n}=au(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:i,set(s){let a=i?.call(this);n?.call(this,s),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Sl}static _$Ei(){if(this.hasOwnProperty(ki("elementProperties")))return;let t=du(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ki("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ki("properties"))){let e=this.properties,r=[...cu(e),...lu(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(Ea(i))}else t!==void 0&&e.push(Ea(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Cl(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:Si).toAttribute(e,r.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let n=r.getPropertyOptions(i),s=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Si;this._$Em=i;let a=s.fromAttribute(e,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(t,e,r,i=!1,n){if(t!==void 0){let s=this.constructor;if(i===!1&&(n=this[t]),r??=s.getPropertyOptions(t),!((r.hasChanged??Dn)(n,e)||r.useDefault&&r.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:i,wrapped:n},s){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),n!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,n]of r){let{wrapped:s}=n,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};oe.elementStyles=[],oe.shadowRootOptions={mode:"open"},oe[ki("elementProperties")]=new Map,oe[ki("finalized")]=new Map,pu?.({ReactiveElement:oe}),(Ei.reactiveElementVersions??=[]).push("2.1.2");var zn=globalThis,El=o=>o,$n=zn.trustedTypes,Al=$n?$n.createPolicy("lit-html",{createHTML:o=>o}):void 0,_a="$lit$",se=`lit$${Math.random().toFixed(9).slice(2)}$`,Ta="?"+se,uu=`<${Ta}>`,Ke=zn.document===void 0?{createTreeWalker:()=>({})}:document,_i=()=>Ke.createComment(""),Ti=o=>o===null||typeof o!="object"&&typeof o!="function",Ra=Array.isArray,Pl=o=>Ra(o)||typeof o?.[Symbol.iterator]=="function",Aa=`[
3
+ \f\r]`,Ai=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_l=/-->/g,Tl=/>/g,Je=RegExp(`>|${Aa}(?:([^\\s"'>=/]+)(${Aa}*=${Aa}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Rl=/'/g,Il=/"/g,Ol=/^(?:script|style|textarea|title)$/i,Ia=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=Ia(1),Ii=Ia(2),Pg=Ia(3),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Ml=new WeakMap,Ye=Ke.createTreeWalker(Ke,129);function Dl(o,t){if(!Ra(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Al!==void 0?Al.createHTML(t):t}var $l=(o,t)=>{let e=o.length-1,r=[],i,n=t===2?"<svg>":t===3?"<math>":"",s=Ai;for(let a=0;a<e;a++){let c=o[a],l,d,h=-1,f=0;for(;f<c.length&&(s.lastIndex=f,d=s.exec(c),d!==null);)f=s.lastIndex,s===Ai?d[1]==="!--"?s=_l:d[1]!==void 0?s=Tl:d[2]!==void 0?(Ol.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=Je):d[3]!==void 0&&(s=Je):s===Je?d[0]===">"?(s=i??Ai,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,l=d[1],s=d[3]===void 0?Je:d[3]==='"'?Il:Rl):s===Il||s===Rl?s=Je:s===_l||s===Tl?s=Ai:(s=Je,i=void 0);let m=s===Je&&o[a+1].startsWith("/>")?" ":"";n+=s===Ai?c+uu:h>=0?(r.push(l),c.slice(0,h)+_a+c.slice(h)+se+m):c+se+(h===-2?a:m)}return[Dl(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Ri=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,s=0,a=t.length-1,c=this.parts,[l,d]=$l(t,e);if(this.el=o.createElement(l,r),Ye.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=Ye.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(_a)){let f=d[s++],m=i.getAttribute(h).split(se),y=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?Ln:y[1]==="?"?Vn:y[1]==="@"?jn:tr}),i.removeAttribute(h)}else h.startsWith(se)&&(c.push({type:6,index:n}),i.removeAttribute(h));if(Ol.test(i.tagName)){let h=i.textContent.split(se),f=h.length-1;if(f>0){i.textContent=$n?$n.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],_i()),Ye.nextNode(),c.push({type:2,index:++n});i.append(h[f],_i())}}}else if(i.nodeType===8)if(i.data===Ta)c.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(se,h+1))!==-1;)c.push({type:7,index:n}),h+=se.length-1}n++}}static createElement(t,e){let r=Ke.createElement("template");return r.innerHTML=t,r}};function Ze(o,t,e=o,r){if(t===it)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,n=Ti(t)?void 0:t._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(o),i._$AT(o,e,r)),r!==void 0?(e._$Co??=[])[r]=i:e._$Cl=i),i!==void 0&&(t=Ze(o,i._$AS(o,t.values),i,r)),t}var Nn=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??Ke).importNode(e,!0);Ye.currentNode=i;let n=Ye.nextNode(),s=0,a=0,c=r[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new Ar(n,n.nextSibling,this,t):c.type===1?l=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(l=new Fn(n,this,t)),this._$AV.push(l),c=r[++a]}s!==c?.index&&(n=Ye.nextNode(),s++)}return Ye.currentNode=Ke,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},Ar=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ze(this,t,e),Ti(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Pl(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==P&&Ti(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ke.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ri.createElement(Dl(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new Nn(i,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(t){let e=Ml.get(t.strings);return e===void 0&&Ml.set(t.strings,e=new Ri(t)),e}k(t){Ra(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let n of t)i===e.length?e.push(r=new o(this.O(_i()),this.O(_i()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=El(t).nextSibling;El(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},tr=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,n){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(t,e=this,r,i){let n=this.strings,s=!1;if(n===void 0)t=Ze(this,t,e,0),s=!Ti(t)||t!==this._$AH&&t!==it,s&&(this._$AH=t);else{let a=t,c,l;for(t=n[0],c=0;c<n.length-1;c++)l=Ze(this,a[r+c],e,c),l===it&&(l=this._$AH[c]),s||=!Ti(l)||l!==this._$AH[c],l===P?t=P:t!==P&&(t+=(l??"")+n[c+1]),this._$AH[c]=l}s&&!i&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ln=class extends tr{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Vn=class extends tr{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},jn=class extends tr{constructor(t,e,r,i,n){super(t,e,r,i,n),this.type=5}_$AI(t,e=this){if((t=Ze(this,t,e,0)??P)===it)return;let r=this._$AH,i=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Fn=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Ze(this,t)}},et={M:_a,P:se,A:Ta,C:1,L:$l,R:Nn,D:Pl,V:Ze,I:Ar,H:tr,N:Vn,U:jn,B:Ln,F:Fn},mu=zn.litHtmlPolyfillSupport;mu?.(Ri,Ar),(zn.litHtmlVersions??=[]).push("3.3.3");var Ma=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let n=e?.renderBefore??null;r._$litPart$=i=new Ar(t.insertBefore(_i(),n),n,void 0,e??{})}return i._$AI(o),i};var Pa=globalThis,S=class extends oe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ma(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};S._$litElement$=!0,S.finalized=!0,Pa.litElementHydrateSupport?.({LitElement:S});var fu=Pa.litElementPolyfillSupport;fu?.({LitElement:S});(Pa.litElementVersions??=[]).push("4.2.2");var gu={attribute:!0,type:String,converter:Si,reflect:!1,hasChanged:Dn},bu=(o=gu,t,e)=>{let{kind:r,metadata:i}=e,n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),r==="setter"&&((o=Object.create(o)).wrapped=!0),n.set(e.name,o),r==="accessor"){let{name:s}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,c,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let c=this[s];t.call(this,a),this.requestUpdate(s,c,o,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(o){return(t,e)=>typeof e=="object"?bu(o,t,e):((r,i,n)=>{let s=i.hasOwnProperty(n);return i.constructor.createProperty(n,r),s?Object.getOwnPropertyDescriptor(i,n):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var xe=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function _r(o,t){return(e,r,i)=>{let n=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:i??(()=>{let c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return xe(e,r,{get(){let c=s.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return xe(e,r,{get(){return n(this)}})}}function Nl(o){return(t,e)=>{let{slot:r,selector:i}=o??{},n="slot"+(r?`[name=${r}]`:":not([name])");return xe(t,e,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(o)??[];return i===void 0?a:a.filter(c=>c.matches(i))}})}}var ae=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var at=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ae(this.context,this.host,this.t,this.subscribe))}};var Bn=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Oa=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},Bt=class extends Bn{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let n=i.contextTarget??i.composedPath()[0];n!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,n,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let n=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)n.has(s)||(n.add(s),a.dispatchEvent(new ae(this.context,a,s,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Oa(this.context,this.host))}};var Mi=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:r}=e;for(let{elementRef:i,callbackRef:n}of r){let s=i.deref(),a=n.deref();s===void 0||a===void 0||s.dispatchEvent(new ae(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],r=t.callback,i=this.pendingContextRequests.get(t.context);i===void 0&&this.pendingContextRequests.set(t.context,i={callbacks:new WeakMap,requests:[]});let n=i.callbacks.get(e);n===void 0&&i.callbacks.set(e,n=new WeakSet),n.has(r)||(n.add(r),i.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(r)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function J({context:o}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return r.get(this).setValue(i),t.set.call(this,i)},init(i){return r.set(this,new Bt(this,{context:o,initialValue:i})),i}};{t.constructor.addInitializer((s=>{r.set(s,new Bt(s,{context:o}))}));let i=Object.getOwnPropertyDescriptor(t,e),n;if(i===void 0){let s=new WeakMap;n={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;n={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}function R({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new at(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new at(i,{context:o,callback:n=>{i[r]=n},subscribe:t})}))}}var Un=["this"],Ll=["+","-","!"],Vl=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Da={"!":0,":":0,",":0,")":0,"]":0,"}":0,"|>":1,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"{":13},Hn=13;var vu=["==","!=","<=",">=","||","&&","??","|>"],yu=["===","!=="],O;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(O||(O={}));var Ht=(o,t,e=0)=>({kind:o,value:t,precedence:e}),qu=o=>o===9||o===10||o===13||o===32,jl=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),xu=o=>jl(o)||Pi(o),wu=o=>Un.indexOf(o)!==-1,Cu=o=>o===34||o===39,Pi=o=>48<=o&&o<=57,ku=o=>o===43||o===45||o===42||o===47||o===33||o===38||o===37||o===60||o===61||o===62||o===63||o===94||o===124,Su=o=>o===40||o===41||o===91||o===93||o===123||o===125,Eu=o=>o.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
5
+ `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Wn=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;qu(this.#i);)this.#n(!0);if(Cu(this.#i))return this.#a();if(jl(this.#i))return this.#c();if(Pi(this.#i))return this.#p();if(this.#i===46)return this.#l();if(this.#i===44)return this.#d();if(this.#i===58)return this.#h();if(ku(this.#i))return this.#g();if(Su(this.#i))return this.#m();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(t);this.#n()}let r=Ht(O.STRING,Eu(this.#o()));return this.#n(),r}#c(){do this.#n();while(xu(this.#i));let t=this.#o(),e=wu(t)?O.KEYWORD:O.IDENTIFIER;return Ht(e,t)}#p(){do this.#n();while(Pi(this.#i));return this.#i===46?this.#l():Ht(O.INTEGER,this.#o())}#l(){return this.#n(),Pi(this.#i)?this.#u():(this.#s(),Ht(O.DOT,".",Hn))}#d(){return this.#n(!0),Ht(O.COMMA,",")}#h(){return this.#n(!0),Ht(O.COLON,":")}#u(){do this.#n();while(Pi(this.#i));return Ht(O.DECIMAL,this.#o())}#g(){this.#n();let t=this.#o(2);if(yu.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Ht(O.ARROW,t);vu.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Ht(O.OPERATOR,t,Da[t])}#m(){let t=String.fromCharCode(this.#i),e=Ht(O.GROUPER,t,Da[t]);return this.#n(!0),e}};var $a=(o,t)=>new Oi(o,t).parse(),Oi=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new Wn(t),this.#r=e}parse(){return this.#o(),this.#s()}#o(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let r=this.#e.nextToken();this.#i=r,this.#t=r?.kind,this.#n=r?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#n!==e)}#s(){if(!this.#i)return this.#r.empty();let t=this.#l();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(O.GROUPER,"(")){let r=this.#f();t=this.#r.invoke(t,void 0,r)}else if(this._matches(O.GROUPER,"[")){let r=this.#v();t=this.#r.index(t,r)}else if(this._matches(O.DOT)){this.#o();let r=this.#l();t=this.#c(t,r)}else{if(this._matches(O.KEYWORD))break;if(this._matches(O.OPERATOR)&&this.#i.precedence>=e)t=this.#n==="?"?this.#d(t):this.#p(t,this.#i);else break}return t}#c(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this.#r.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(Vl.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#l();for(;(this.#t===O.OPERATOR||this.#t===O.DOT||this.#t===O.GROUPER)&&this.#i.precedence>e.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(t,e.value,r)}#l(){if(this._matches(O.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(O.INTEGER))return this.#x(t);if(this._matches(O.DECIMAL))return this.#C(t)}if(Ll.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#h(),Hn);return this.#r.unary(t,e)}return this.#h()}#d(t){this.#o(O.OPERATOR,"?");let e=this.#s();this.#o(O.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#h(){switch(this.#t){case O.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#r.id(t);throw Un.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case O.IDENTIFIER:return this.#m();case O.STRING:return this.#q();case O.INTEGER:return this.#x();case O.DECIMAL:return this.#C();case O.GROUPER:return this.#n==="("?this.#y():this.#n==="{"?this.#g():this.#n==="["?this.#u():void 0;case O.COLON:throw new Error('unexpected token ":"');default:return}}#u(){let t=[];do{if(this.#o(),this._matches(O.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"]"),this.#r.list(t)}#g(){let t={};do{if(this.#o(),this._matches(O.GROUPER,"}"))break;let e=this.#n;(this._matches(O.STRING)||this._matches(O.IDENTIFIER))&&this.#o(),this.#o(O.COLON),t[e]=this.#s()}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"}"),this.#r.map(t)}#m(){let t=this.#n;if(t==="true")return this.#o(),this.#r.literal(!0);if(t==="false")return this.#o(),this.#r.literal(!1);if(t==="null")return this.#o(),this.#r.literal(null);if(t==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#b(),r=this.#f();return r?this.#r.invoke(e,void 0,r):e}#b(){if(!this._matches(O.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let t=this.#n;return this.#o(),this.#r.id(t)}#f(){if(!this._matches(O.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(O.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(O.COMMA));return this.#o(O.GROUPER,")"),t}#v(){this.#o();let t=this.#s();return this.#o(O.GROUPER,"]"),t}#y(){let t=this.#f();if(this._matches(O.ARROW)){this.#o();let e=this.#s(),r=t?.map(i=>i.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#q(){let t=this.#r.literal(this.#n);return this.#o(),t}#x(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#C(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:Fl,fromEntries:Au}=Object,_u={"+":(o,t)=>o+t,"-":(o,t)=>o-t,"*":(o,t)=>o*t,"/":(o,t)=>o/t,"%":(o,t)=>o%t,"==":(o,t)=>o==t,"!=":(o,t)=>o!=t,"===":(o,t)=>o===t,"!==":(o,t)=>o!==t,">":(o,t)=>o>t,">=":(o,t)=>o>=t,"<":(o,t)=>o<t,"<=":(o,t)=>o<=t,"||":(o,t)=>o||t,"&&":(o,t)=>o&&t,"??":(o,t)=>o??t,"|":(o,t)=>t(o),"|>":(o,t)=>t(o)},Tu={"+":o=>o,"-":o=>-o,"!":o=>!o},Qn=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let r=Tu[t];return{type:"Unary",operator:t,child:e,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,r){let i=_u[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(n){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(n),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),c=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,c=this.left.value),a===void 0?void 0:a[c]=s}return i(this.left.evaluate(n),this.right.evaluate(n))},getIds(n){return this.left.getIds(n),this.right.getIds(n),n}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let n=this.receiver.evaluate(i),s=this.method?n:i?.this??i,a=this.method?n?.[e]:n,l=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,l)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(n=>n?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let n=this.entries[i];n&&(r[i]=n.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,n=this.body;return function(...s){let a=Au(i.map((l,d)=>[l,s[d]])),c=new Proxy(r??{},{set(l,d,h){return Fl(a,d)&&(a[d]=h),l[d]=h},get(l,d){return Fl(a,d)?a[d]:l[d]}});return n.evaluate(c)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var Na=null,zl={boundAttributeSuffix:et.M,marker:et.P,markerMatch:et.A,HTML_RESULT:et.C,getTemplateHtml:et.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){Na??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Na))return void(e[Na]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let r=it;return o.j=i=>r=i,o._$AI(t,o,e),r},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:et.V,AttributePart:et.H,PropertyPart:et.B,BooleanAttributePart:et.N,EventPart:et.U,ElementPart:et.F,TemplateInstance:et.R,isIterable:et.D,ChildPart:et.I};var{AttributePart:Ru,PropertyPart:Iu,BooleanAttributePart:Mu,EventPart:Pu}=zl,Va=new Qn,La=new Map,Bl=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),Xn=(o,t)=>{let e=La.get(o);if(e===void 0){if(La.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new Oi(r,Va).parse(),La.set(o,e)}}return e?.evaluate(t)},Ou=(o,t,e,r)=>{let i=o.getAttribute("if");if(i!==null&&Xn(i,t))return Gn(o,t,e,r)},Ul=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Hl=o=>/(?:\\{{)|(?:\\}})/g.test(o),Di=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Du=(o,t,e,r)=>{let i=o.getAttribute("repeat");if(i!==null){let n=Xn(i,t);if(!n[Symbol.iterator])return P;let s=$i(o),a=-1,c=[];for(let l of n){a++;let d=Object.create(t);d.item=l,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let y=m.update(d,e,r);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};c.push(f)}return c}},Ql={if:Ou,repeat:Du},Xl=(o,t=Ql,e={},r)=>{let n=$i(o).renderers;if(r){let a=$i(r).renderers,c=n.super;c!==void 0?e={...n,...e,super:(l,d,h)=>(h={...a,...h,super:(f,m,y)=>Gn(r,f,m,y)},c(l,d,h))}:(e={...a,...n,...e},o=r)}else e={...n,...e};return s=>Gn(o,s,t,e)};var Gn=(o,t,e=Ql,r={})=>{let i=$i(o),n=[];for(let a of i.parts){let c=a.update(t,e,r);a.type===1?n.push(...c):n.push(c)}return{_$litType$:i,values:n}},Wl=new Map,$i=o=>{let t=Wl.get(o);return t===void 0&&Wl.set(o,t=$u(o)),t},$u=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,n=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)i++;else if(r.nodeType===Node.ELEMENT_NODE){i++;let s=r;if(s.tagName==="TEMPLATE"){let c=s.getAttribute("type"),l=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||c!==null||l!==null){s.parentNode.insertBefore(document.createComment(""),s),n.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:Xn(g,y);return(m?Xn(f,y):u[d])?.(b,x,u)}}else c!==null?h=(f,m,y)=>{let x=m[c];return x?.(s,f,m,y)}:(l==="super"?t.renderers.super=(f,m,y)=>{let x=y.super,u=$i(s);return y={...y,...u.renderers},x(f,m,y)}:t.renderers[l]=(f,m,y)=>Gn(s,f,m,y),h=(f,m,y)=>{let x=y[l];return x?.(f,m,y)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let c of a){let l=s.getAttribute(c),d=l.split(Ul);if(d.length===1){Hl(l)&&s.setAttribute(c,Di(l));continue}s.removeAttribute(c);let h=c,f=Ru,m=c[0];m==="."?(h=Bl(c.substring(1)),f=Iu):m==="?"?(h=c.substring(1),f=Mu):m==="@"&&(h=Bl(c.substring(1)),f=Pu);let y=[Di(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push($a(g,Va)),y.push(Di(d[u+1]))}t.parts.push({type:1,index:i,name:h,strings:y,ctor:f,update:(u,g,b)=>x.map(q=>q.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,c=a.split(Ul);c.length>1?s.textContent=Di(c[0]):Hl(a)&&(s.textContent=Di(a));for(let l=1;l<c.length;l+=2){let d=c[l],h=$a(d,Va);t.parts.push({type:2,index:++i,update:(m,y)=>h.evaluate(m)});let f=new Text(c[l+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of n)s.remove();return t};var ja=Symbol.for("qti-components.context-root"),Nu=()=>{if(typeof document>"u")return;let o=globalThis;o[ja]||(o[ja]=new Mi,o[ja].attach(document.documentElement))};Nu();var Gl=[];var za=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#r():queueMicrotask(()=>this.#r())}#r(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},Fa="custom-state-support-probe";function Lu(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(Fa)||customElements.define(Fa,class extends HTMLElement{});let t=o.call(document.createElement(Fa)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var Jl=!1;function Yl(){if(Jl)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Lu(o);return t==="modern"||(Jl=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new za(this)}),r}),t}Yl();for(let{tag:o,ctor:t}of Gl)customElements.get(o)||customElements.define(o,t);var we=Symbol("computedItemContext");var ct=Symbol("computedContext");var yt=Symbol("configContext");var Tr=Symbol("interactionContext");var j=Symbol("item");var Kl=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Vu=/^[A-Za-z0-9-]+$/,ju=o=>typeof o=="string"&&Vu.test(o),Sv=o=>ju(o)?o:void 0,qt=Symbol("qtiContext");var Ba={view:"candidate"},Jn=Symbol("sessionContext");var Ua={items:[],testOutcomeVariables:[]},nt=Symbol("testContext");var M=w`
6
6
  :host {
7
7
  box-sizing: border-box;
8
8
  }
@@ -12,7 +12,7 @@ Make sure to test your application with a production build as repeat registratio
12
12
  *::after {
13
13
  box-sizing: inherit;
14
14
  }
15
- `;var Jt=w`
15
+ `;var Wt=w`
16
16
  [part~='drop'] {
17
17
  /*
18
18
  * The one deliberate opt-out from the border-box reset.
@@ -52,27 +52,27 @@ Make sure to test your application with a production build as repeat registratio
52
52
  flex: 0 1 auto;
53
53
  align-self: flex-start;
54
54
  }
55
- `;var H=w`
55
+ `;var U=w`
56
56
  [part~='message'] {
57
57
  display: none;
58
58
  }
59
- `;var Pd={chip:["drag"],drop:["droppable"],lifted:["dragging"],used:["placeholder"],"return-target":["return-anchor"],"drag-over":["hover"],"candidate-partial":["candidate-partially-correct"]};function B(o,t,e,i){if(!o)return;let r=[t,...i??Pd[t]??[]];for(let n of r)e?o.add(n):o.delete(n)}function Jr(o,t){return o?o.has(t)?!0:(Pd[t]??[]).some(e=>o.has(e)):!1}var Fi=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},D=class extends C{#t;get _context(){return this.#t.value}#e;#i;#r(t){t?.readonly!==void 0&&t.readonly!==this.#e&&(this.#e=t.readonly,this.readonly=t.readonly),t?.disabled!==void 0&&t.disabled!==this.#i&&(this.#i=t.disabled,this.disabled=t.disabled),this.#a(t)}#n;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),i=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!i)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let r=this.#n===void 0,n=JSON.stringify(i.value??null);n!==this.#n&&(this.#n=n,!(r&&(i.value===null||i.value===void 0))&&n!==this.#o&&(this.#o=n,this.response=i.value))}#d;static{this.formAssociated=!0}get internals(){return this._internals}get registersWithItem(){return!0}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let t=this._context.variables.filter(i=>i.type==="response"),e=this.getAttribute("response-identifier");return t.find(i=>i.identifier===e)}get value(){return JSON.stringify(this.response)}set value(t){this.response=t?JSON.parse(t):null}resetValidityReport(){this._validityReported=!1,this.clearInlineValidationMessage()}reportValidity(t){let e=t?.trigger??"submit";e==="submit"&&this.validate?.();let i=this._internals.validity.valid,r=this.validationDisplayMode;if(e==="submit"&&(this._validityReported=!0),e==="change"&&!this._validityReported&&this._validityKind==="min")return this.clearInlineValidationMessage(),i;if(r==="native"||r==="both"){this._reportingNatively=!0;try{this._internals.reportValidity()}finally{this._reportingNatively=!1}}return r==="inline"||r==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),r==="none"&&this.clearInlineValidationMessage(),i}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(t){let e=t?.defaultWhenUnset??!0,i=this.configContext;return i&&i.allowReorder!==void 0?i.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,i=this.configContext;return i?i.disableAfterMaxReached!==void 0?i.disableAfterMaxReached:i.disableAfterIfMaxChoicesReached!==void 0?(this.#d||(this.#d=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),i.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",i,r){let n=i??this;this._internals.setValidity(t?{}:{customError:!0},e,n),this._validityKind=t?void 0:r?.kind??"other",r?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.resetValidityReport(),this.response=null}formResetCallback(){this.resetValidityReport(),this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}update(t){let e=!this.hasUpdated;if(super.update(t),e){let i=()=>this.isConnected&&this.validate();this.updateComplete.then(i),requestAnimationFrame(()=>requestAnimationFrame(i))}t.has("disabled")&&B(this._internals.states,"disabled",this.disabled),t.has("readonly")&&B(this._internals.states,"readonly",this.readonly)}constructor(){super(),this.#t=new dt(this,{context:F,subscribe:!0,callback:t=>this.#r(t)}),this.#s=!1,this.#d=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._validityReported=!1,this._reportingNatively=!1,this._internals=this.attachInternals(),this.addEventListener("invalid",()=>{this._reportingNatively||(this._validityReported=!0,(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage())}),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Fi([I({context:wt,subscribe:!0})],D.prototype,"configContext",void 0);Fi([X({context:ji})],D.prototype,"_interactionContext",void 0);Fi([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Fi([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Fi([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Fi([p({type:String})],D.prototype,"name",void 0);var zi=class extends C{render(){return v`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let i=e.map(r=>r.innerHTML.trim());return i.length>1||t==="multiple"||t==="ordered"?i:i[0]}};var yl=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},vl=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??Od(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??Od(o),value:String(o),cardinality:"single",type:"response"},Od=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",Am=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},E=class extends C{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let i=e.getAttribute("identifier")||"";return i==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.resolveVariable(i)}case"qti-multiple":{let r=e.getResult();return r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(n=>n.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let r=e.getResult();return r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(n=>n.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let r=e.getResult();return r?.length>0?r:null}case"qti-custom-operator":return vl(e.calculate?.());case"qti-correct":{let i=e.getAttribute("identifier")||"",r=this.context?.variables?.find(n=>n.identifier===i);return r?{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}:(console.warn(`qti-correct: no response declaration for "${i}"`),vl(null))}default:{try{let i=e,r=i.getResult();return vl(r,i.resultBaseType??Am(i,r))}catch(i){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,i)}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null);return this.#t=t,t}}#t;get lastResult(){return this.result}get lastVariables(){return this.#t}static{this.styles=w`
59
+ `;var Zl={chip:["drag"],drop:["droppable"],lifted:["dragging"],used:["placeholder"],"return-target":["return-anchor"],"drag-over":["hover"],"candidate-partial":["candidate-partially-correct"]};function z(o,t,e,r){if(!o)return;let i=[t,...r??Zl[t]??[]];for(let n of i)e?o.add(n):o.delete(n)}function Ni(o,t){return o?o.has(t)?!0:(Zl[t]??[]).some(e=>o.has(e)):!1}var Rr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},D=class extends S{#t;get _context(){return this.#t.value}#e;#r;#i(t){t?.readonly!==void 0&&t.readonly!==this.#e&&(this.#e=t.readonly,this.readonly=t.readonly),t?.disabled!==void 0&&t.disabled!==this.#r&&(this.#r=t.disabled,this.disabled=t.disabled),this.#a(t)}#n;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),r=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!r)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let i=this.#n===void 0,n=JSON.stringify(r.value??null);n!==this.#n&&(this.#n=n,!(i&&(r.value===null||r.value===void 0))&&n!==this.#o&&(this.#o=n,this.response=r.value))}#c;static{this.formAssociated=!0}get internals(){return this._internals}get registersWithItem(){return!0}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let t=this._context.variables.filter(r=>r.type==="response"),e=this.getAttribute("response-identifier");return t.find(r=>r.identifier===e)}get value(){return JSON.stringify(this.response)}set value(t){this.response=t?JSON.parse(t):null}resetValidityReport(){this._validityReported=!1,this.clearInlineValidationMessage()}reportValidity(t){let e=t?.trigger??"submit";e==="submit"&&this.validate?.();let r=this._internals.validity.valid,i=this.validationDisplayMode;if(e==="submit"&&(this._validityReported=!0),e==="change"&&!this._validityReported&&this._validityKind==="min")return this.clearInlineValidationMessage(),r;if(i==="native"||i==="both"){this._reportingNatively=!0;try{this._internals.reportValidity()}finally{this._reportingNatively=!1}}return i==="inline"||i==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),i==="none"&&this.clearInlineValidationMessage(),r}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(t){let e=t?.defaultWhenUnset??!0,r=this.configContext;return r&&r.allowReorder!==void 0?r.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,r=this.configContext;return r?r.disableAfterMaxReached!==void 0?r.disableAfterMaxReached:r.disableAfterIfMaxChoicesReached!==void 0?(this.#c||(this.#c=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),r.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",r,i){let n=r??this;this._internals.setValidity(t?{}:{customError:!0},e,n),this._validityKind=t?void 0:i?.kind??"other",i?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.resetValidityReport(),this.response=null}formResetCallback(){this.resetValidityReport(),this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}update(t){let e=!this.hasUpdated;if(super.update(t),e){let r=()=>this.isConnected&&this.validate();this.updateComplete.then(r),requestAnimationFrame(()=>requestAnimationFrame(r))}t.has("disabled")&&z(this._internals.states,"disabled",this.disabled),t.has("readonly")&&z(this._internals.states,"readonly",this.readonly)}constructor(){super(),this.#t=new at(this,{context:j,subscribe:!0,callback:t=>this.#i(t)}),this.#s=!1,this.#c=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._validityReported=!1,this._reportingNatively=!1,this._internals=this.attachInternals(),this.addEventListener("invalid",()=>{this._reportingNatively||(this._validityReported=!0,(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage())}),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Rr([R({context:yt,subscribe:!0})],D.prototype,"configContext",void 0);Rr([J({context:Tr})],D.prototype,"_interactionContext",void 0);Rr([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Rr([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Rr([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Rr([p({type:String})],D.prototype,"name",void 0);var Ir=class extends S{render(){return v`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(i=>i.innerHTML.trim());return r.length>1||t==="multiple"||t==="ordered"?r:r[0]}};var Wa=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ha=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??td(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??td(o),value:String(o),cardinality:"single",type:"response"},td=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",Fu=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},E=class extends S{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return r==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.resolveVariable(r)}case"qti-multiple":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let i=e.getResult();return i?.length>0?i:null}case"qti-custom-operator":return Ha(e.calculate?.());case"qti-correct":{let r=e.getAttribute("identifier")||"",i=this.context?.variables?.find(n=>n.identifier===r);return i?{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}:(console.warn(`qti-correct: no response declaration for "${r}"`),Ha(null))}default:{try{let r=e,i=r.getResult();return Ha(i,r.resultBaseType??Fu(r,i))}catch(r){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,r)}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null);return this.#t=t,t}}#t;get lastResult(){return this.result}get lastVariables(){return this.#t}static{this.styles=w`
60
60
  slot {
61
61
  display: none;
62
62
  }
63
- `}render(){return v`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(r=>r.identifier===e[0])?.variables?.find(r=>r.identifier===e[e.length-1])??null}};yl([I({context:F,subscribe:!0})],E.prototype,"context",void 0);yl([I({context:Ct,subscribe:!0})],E.prototype,"qtiContext",void 0);yl([I({context:st,subscribe:!0})],E.prototype,"_testContext",void 0);var Yt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Qy=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Dt=o=>typeof o=="string"?o:o.toString();function ql(o){return o==null}function fo(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Yr=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ft=class extends C{constructor(){super(...arguments),this.showHide="show",this.#t=new dt(this,{context:F,subscribe:!0,callback:t=>this.#i(t)}),this.#r=!1}#t;get _context(){return this.#t.value}#e;#i(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let i=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),r=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,n=this.#e===void 0?r>0:this.#e!==i||r>0;this.#e=i,n&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(r=>r.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let i=!1;Array.isArray(e.value)?i=e.value.includes(this.identifier):i=!ql(this.identifier)&&!ql(e?.value)&&this.identifier===e.value||!1,this.#n(i)}#r;#n(t){let e=this.#s()&&this.#o(t)?"on":"off";if(e==="on"){if(this.showStatus==="on"||this.#r)return;if(!this.feedbackShowing()){this.#r=!0,this.showStatus="off";return}}else if(this.#r=!1,this.showStatus==="on"&&!this.feedbackHiding())return;this.showStatus=e}#o(t){return t&&this.showHide==="show"||!t&&this.showHide==="hide"}feedbackShowing(){return!0}feedbackHiding(){return!0}#s(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(r=>r.active)?.sections.flatMap(r=>r.items).find(r=>r.active);if(!t||t.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(r=>r.identifier==="numAttempts")?.value)||0)<e}};Yr([p({type:String,attribute:"show-hide"})],ft.prototype,"showHide",void 0);Yr([p({type:String,attribute:"outcome-identifier"})],ft.prototype,"outcomeIdentifier",void 0);Yr([p({type:String})],ft.prototype,"identifier",void 0);Yr([p({type:String,attribute:!1})],ft.prototype,"showStatus",void 0);Yr([I({context:z,subscribe:!0}),R()],ft.prototype,"_computedContext",void 0);function Kr(o){if(o==null)return null;if(!o.includes(",")){let e=o.trim();return e.length>0?e:null}let t=o.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function li(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(i=>i.trim()).filter(i=>i.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*iq(o){if(o!=null){if(Array.isArray(o)){for(let t of o){let e=t.trim();e&&(yield e)}return}if(!o.includes(",")){let t=o.trim();t&&(yield t);return}for(let t of o.split(",")){let e=t.trim();e&&(yield e)}}}function rq(o){let[t,e,...i]=o.trim().split(/\s+/);if(!t||!e||i.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function nq(o,t){return`${o} ${t}`}function oq(o){let[t,e,...i]=o.trim().split(/\s+/),r=Number(t),n=Number(e);if(!Number.isFinite(r)||!Number.isFinite(n)||i.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:r,y:n}}function sq(o,t){return`${o} ${t}`}function Kt(o){let{emptyAs:t}=o,e=i=>i===t||i==null||i===""||Array.isArray(i)&&i.length===0;return{fromAttribute:i=>{let r=Kr(i);return r===null?t:r},toAttribute:i=>e(i)?null:li(i)}}var $t=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Zr=o=>{let t={},e={};for(let i of o){let r=i.getAttribute("field-identifier");if(!r)continue;t[r]=i.textContent?.trim()??"";let n=i.getAttribute("base-type");n&&(e[r]=n)}return{value:t,baseTypes:e}},Dd=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,go=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(Dd.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(i=>Dd.test(i))?"point":"string"};var $d=class extends C{},Bi=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Ui=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var _m=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},xl=o=>t=>{let e=_m(t);return e===null?null:o(e)},Rm=["depcp","questify","qade"],Im={Trim:xl(o=>o.trim()),ToAscii:xl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:xl(o=>o.replace(",","."))},Tm=new Map(Rm.flatMap(o=>Object.entries(Im).map(([t,e])=>[`${o}:${t}`,e]))),wl=new Map,hq=(o,t)=>{wl.set(o,t)},pq=o=>{wl.delete(o)},Nd=o=>wl.get(o)??Tm.get(o)??null;var Ld={true:!0,1:!0,false:!1,0:!1},Z=class{static isPointInArea(t,e,i){if(i!=="point")return console.warn(`Base type ${i} is not supported for point area mapping.`),!1;let[r,n]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((r-c)**2+(n-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):r>=c&&r<=h&&n>=d&&n<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(r-c)**2/h**2,y=(n-d)**2/f**2;return m+y<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:r,y:n},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let i=!1;for(let r=0,n=e.length-1;r<e.length;n=r++){let s=e[r].x,a=e[r].y,l=e[n].x,c=e[n].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(i=!i)}return i}static compareSingleValues(t,e,i){switch(i){case"identifier":case"string":return t===e;case"boolean":{let r=Ld[t.trim().toLowerCase()];return r!==void 0&&r===Ld[e.trim().toLowerCase()]}case"integer":{let r=parseInt(t,10),n=parseInt(e,10);if(!isNaN(r)&&!isNaN(n)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:r===n}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let r=parseFloat(t),n=parseFloat(e);if(!isNaN(r)&&!isNaN(n))return r===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let r=t.split(" "),n=e.split(" ");if(r.length===2&&n.length===2)return i==="pair"&&(r.sort(),n.sort()),r.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Ie=Symbol("testHost");var jd={"qc-item-rendered":{kind:"notification",scope:"item",deprecated:"cito-item-rendered"},"qc-item-response-changed":{kind:"notification",scope:"item",deprecated:"cito-item-response-changed"},"qc-item-set-outcomes":{kind:"request",scope:"item",deprecated:"cito-item-set-outcomes"},"qc-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcome-changed"},"qc-item-outcomes-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcomes-changed"},"qc-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"cito-item-rubric-placement"},"qc-feedback-show":{kind:"notification",scope:"item",deprecated:"cito-feedback-show"},"qc-feedback-hide":{kind:"notification",scope:"item",deprecated:"cito-feedback-hide"}};function Cl(o,t,e,i,r=!1){let n={detail:i??{},bubbles:!0,composed:!0,cancelable:r},s=o.dispatchEvent(new CustomEvent(e,n)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,n))&&s:s}var Vd=new Set;function kl(o,t,e,i){let r;o.addEventListener(e,s=>{r=s.detail,queueMicrotask(()=>r=void 0),i(s)});let{deprecated:n}=t[e];n&&o.addEventListener(n,s=>{r!==void 0&&s.detail===r||(Vd.has(n)||(Vd.add(n),console.warn(`[qti-components] The event "${n}" is deprecated; dispatch "${e}" instead.`)),i(s))})}function kt(o,t,e,i=!1){return Cl(o,jd,t,e,i)}function Fd(o,t,e){kl(o,jd,t,e)}var zd={"qc-test-navigate":{kind:"request",scope:"test",deprecated:"cito-test-navigate"},"qc-test-end-attempt":{kind:"request",scope:"test",deprecated:"cito-test-end-attempt"},"qc-test-submit":{kind:"request",scope:"test",deprecated:"cito-test-submit"},"qc-test-update-outcome":{kind:"request",scope:"test",deprecated:"cito-test-update-outcome"},"qc-test-update-plugin-state":{kind:"request",scope:"test",deprecated:"cito-test-update-plugin-state"},"qc-test-switch-view":{kind:"request",scope:"test",deprecated:"cito-test-switch-view"},"qc-test-submitted":{kind:"notification",scope:"test",deprecated:"cito-test-submitted"},"qc-test-navigated":{kind:"notification",scope:"test",deprecated:"cito-test-navigated"},"qc-test-navigation-started":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-started"},"qc-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-failed"},"qc-test-rendered":{kind:"notification",scope:"test",deprecated:"cito-test-rendered"},"qc-test-loaded":{kind:"notification",scope:"test",deprecated:"cito-test-loaded"},"qc-test-state-changed":{kind:"notification",scope:"test",deprecated:"cito-test-state-changed"},"qc-test-items-skipped":{kind:"notification",scope:"test",deprecated:"cito-test-items-skipped"},"qc-test-end-reached":{kind:"notification",scope:"test",deprecated:"cito-test-end-reached"},"qc-item-ref-connected":{kind:"notification",scope:"item",deprecated:"cito-item-ref-connected"}};function L(o,t,e){Cl(o,zd,t,e)}function U(o,t,e){kl(o,zd,t,e)}var Te=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Bd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},St=class extends C{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let i=e.getAttribute("identifier");if(!i)continue;let r=Number(e.getAttribute("value"));if(Number.isNaN(r)){console.warn(`qti-weight "${i}" has a non-numeric value, ignoring it`);continue}t.set(i,r)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?Ae(t):null,this.requestUpdate(),await this.updateComplete,L(this,"qc-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let i=e.items.find(r=>r.identifier===this.identifier);if(i)return i}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};Te([p({type:String})],St.prototype,"category",void 0);Te([p({type:String})],St.prototype,"identifier",void 0);Te([p({type:Boolean,converter:Bd})],St.prototype,"required",void 0);Te([p({type:Boolean,converter:Bd})],St.prototype,"fixed",void 0);Te([p({type:String})],St.prototype,"href",void 0);Te([R(),I({context:z,subscribe:!0})],St.prototype,"computedContext",void 0);Te([p({type:Object,attribute:!1})],St.prototype,"xmlDoc",void 0);Te([I({context:Ie,subscribe:!0})],St.prototype,"testHost",void 0);var Me=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Sl={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Et=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return v`<slot name="qti-rubric-block"></slot><slot></slot>`}};Me([p({type:String})],Et.prototype,"identifier",void 0);Me([p({type:String})],Et.prototype,"required",void 0);Me([p({type:Boolean,converter:Sl})],Et.prototype,"fixed",void 0);Me([p({type:Boolean,converter:Sl})],Et.prototype,"visible",void 0);Me([p({type:Boolean,converter:Sl,attribute:"keep-together"})],Et.prototype,"keepTogether",void 0);Me([p({type:String,attribute:"navigation-mode"})],Et.prototype,"navigationMode",void 0);Me([p({type:String,attribute:"submission-mode"})],Et.prototype,"submissionMode",void 0);Me([I({context:st,subscribe:!0})],Et.prototype,"_testContext",void 0);var El=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ci=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,L(this,"qc-test-loaded",this)}render(){return v` <slot></slot>`}};El([p({type:String})],ci.prototype,"identifier",void 0);El([p({type:String})],ci.prototype,"title",null);El([I({context:st,subscribe:!0})],ci.prototype,"_testContext",void 0);function bo(o,t){let e=o.firstElementChild;if(!e||typeof e.calculate!="function")return console.warn(`<${o.localName}> has no evaluable expression child`,o),t;try{let i=e.calculate();return i===!0||i==="true"}catch(i){return console.warn(`<${o.localName}> could not evaluate its expression`,i),t}}var Mm=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ue=class extends C{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=w`
63
+ `}render(){return v`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(i=>i.identifier===e[0])?.variables?.find(i=>i.identifier===e[e.length-1])??null}};Wa([R({context:j,subscribe:!0})],E.prototype,"context",void 0);Wa([R({context:qt,subscribe:!0})],E.prototype,"qtiContext",void 0);Wa([R({context:nt,subscribe:!0})],E.prototype,"_testContext",void 0);var Qt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var ry=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Mt=o=>typeof o=="string"?o:o.toString();function Qa(o){return o==null}function Yn(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Li=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pt=class extends S{constructor(){super(...arguments),this.showHide="show",this.#t=new at(this,{context:j,subscribe:!0,callback:t=>this.#r(t)}),this.#i=!1}#t;get _context(){return this.#t.value}#e;#r(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let r=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),i=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,n=this.#e===void 0?i>0:this.#e!==r||i>0;this.#e=r,n&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!Qa(this.identifier)&&!Qa(e?.value)&&this.identifier===e.value||!1,this.#n(r)}#i;#n(t){let e=this.#s()&&this.#o(t)?"on":"off";if(e==="on"){if(this.showStatus==="on"||this.#i)return;if(!this.feedbackShowing()){this.#i=!0,this.showStatus="off";return}}else if(this.#i=!1,this.showStatus==="on"&&!this.feedbackHiding())return;this.showStatus=e}#o(t){return t&&this.showHide==="show"||!t&&this.showHide==="hide"}feedbackShowing(){return!0}feedbackHiding(){return!0}#s(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(i=>i.active)?.sections.flatMap(i=>i.items).find(i=>i.active);if(!t||t.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(i=>i.identifier==="numAttempts")?.value)||0)<e}};Li([p({type:String,attribute:"show-hide"})],pt.prototype,"showHide",void 0);Li([p({type:String,attribute:"outcome-identifier"})],pt.prototype,"outcomeIdentifier",void 0);Li([p({type:String})],pt.prototype,"identifier",void 0);Li([p({type:String,attribute:!1})],pt.prototype,"showStatus",void 0);Li([R({context:ct,subscribe:!0}),T()],pt.prototype,"_computedContext",void 0);function Vi(o){if(o==null)return null;if(!o.includes(",")){let e=o.trim();return e.length>0?e:null}let t=o.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function er(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(r=>r.trim()).filter(r=>r.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*hy(o){if(o!=null){if(Array.isArray(o)){for(let t of o){let e=t.trim();e&&(yield e)}return}if(!o.includes(",")){let t=o.trim();t&&(yield t);return}for(let t of o.split(",")){let e=t.trim();e&&(yield e)}}}function py(o){let[t,e,...r]=o.trim().split(/\s+/);if(!t||!e||r.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function uy(o,t){return`${o} ${t}`}function my(o){let[t,e,...r]=o.trim().split(/\s+/),i=Number(t),n=Number(e);if(!Number.isFinite(i)||!Number.isFinite(n)||r.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:i,y:n}}function fy(o,t){return`${o} ${t}`}function Xt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=Vi(r);return i===null?t:i},toAttribute:r=>e(r)?null:er(r)}}var ce=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),ji=o=>{let t={},e={};for(let r of o){let i=r.getAttribute("field-identifier");if(!i)continue;t[i]=r.textContent?.trim()??"";let n=r.getAttribute("base-type");n&&(e[i]=n)}return{value:t,baseTypes:e}},ed=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,Kn=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(ed.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(r=>ed.test(r))?"point":"string"};var rd=class extends S{},Mr=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Pr=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var zu=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},Xa=o=>t=>{let e=zu(t);return e===null?null:o(e)},Bu=["depcp","questify","qade"],Uu={Trim:Xa(o=>o.trim()),ToAscii:Xa(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:Xa(o=>o.replace(",","."))},Hu=new Map(Bu.flatMap(o=>Object.entries(Uu).map(([t,e])=>[`${o}:${t}`,e]))),Ga=new Map,qy=(o,t)=>{Ga.set(o,t)},xy=o=>{Ga.delete(o)},id=o=>Ga.get(o)??Hu.get(o)??null;var nd={true:!0,1:!0,false:!1,0:!1},Y=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,n]=t.split(" ").map(Number),[s,...a]=e.split(","),c=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[l,d,h]=c;return c.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-l)**2+(n-d)**2)<=h}case"rect":{let[l,d,h,f]=c;return c.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=l&&i<=h&&n>=d&&n<=f}case"ellipse":{let[l,d,h,f]=c;if(c.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-l)**2/h**2,y=(n-d)**2/f**2;return m+y<=1}case"poly":{if(c.length<6||c.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let l=[];for(let d=0;d<c.length;d+=2)l.push({x:c[d],y:c[d+1]});return this.isPointInPolygon({x:i,y:n},l)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let s=e[i].x,a=e[i].y,c=e[n].x,l=e[n].y;a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"boolean":{let i=nd[t.trim().toLowerCase()];return i!==void 0&&i===nd[e.trim().toLowerCase()]}case"integer":{let i=parseInt(t,10),n=parseInt(e,10);if(!isNaN(i)&&!isNaN(n)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:i===n}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),n=parseFloat(e);if(!isNaN(i)&&!isNaN(n))return i===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" "),n=e.split(" ");if(i.length===2&&n.length===2)return r==="pair"&&(i.sort(),n.sort()),i.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Ce=Symbol("testHost");var sd={"qc-item-rendered":{kind:"notification",scope:"item",deprecated:"cito-item-rendered"},"qc-item-response-changed":{kind:"notification",scope:"item",deprecated:"cito-item-response-changed"},"qc-item-set-outcomes":{kind:"request",scope:"item",deprecated:"cito-item-set-outcomes"},"qc-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcome-changed"},"qc-item-outcomes-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcomes-changed"},"qc-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"cito-item-rubric-placement"},"qc-feedback-show":{kind:"notification",scope:"item",deprecated:"cito-feedback-show"},"qc-feedback-hide":{kind:"notification",scope:"item",deprecated:"cito-feedback-hide"}};function Ja(o,t,e,r,i=!1){let n={detail:r??{},bubbles:!0,composed:!0,cancelable:i},s=o.dispatchEvent(new CustomEvent(e,n)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,n))&&s:s}var od=new Set;function Ya(o,t,e,r){let i;o.addEventListener(e,s=>{i=s.detail,queueMicrotask(()=>i=void 0),r(s)});let{deprecated:n}=t[e];n&&o.addEventListener(n,s=>{i!==void 0&&s.detail===i||(od.has(n)||(od.add(n),console.warn(`[qti-components] The event "${n}" is deprecated; dispatch "${e}" instead.`)),r(s))})}function xt(o,t,e,r=!1){return Ja(o,sd,t,e,r)}function ad(o,t,e){Ya(o,sd,t,e)}var cd={"qc-test-navigate":{kind:"request",scope:"test",deprecated:"cito-test-navigate"},"qc-test-end-attempt":{kind:"request",scope:"test",deprecated:"cito-test-end-attempt"},"qc-test-submit":{kind:"request",scope:"test",deprecated:"cito-test-submit"},"qc-test-update-outcome":{kind:"request",scope:"test",deprecated:"cito-test-update-outcome"},"qc-test-update-plugin-state":{kind:"request",scope:"test",deprecated:"cito-test-update-plugin-state"},"qc-test-switch-view":{kind:"request",scope:"test",deprecated:"cito-test-switch-view"},"qc-test-submitted":{kind:"notification",scope:"test",deprecated:"cito-test-submitted"},"qc-test-navigated":{kind:"notification",scope:"test",deprecated:"cito-test-navigated"},"qc-test-navigation-started":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-started"},"qc-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-failed"},"qc-test-rendered":{kind:"notification",scope:"test",deprecated:"cito-test-rendered"},"qc-test-loaded":{kind:"notification",scope:"test",deprecated:"cito-test-loaded"},"qc-test-state-changed":{kind:"notification",scope:"test",deprecated:"cito-test-state-changed"},"qc-test-items-skipped":{kind:"notification",scope:"test",deprecated:"cito-test-items-skipped"},"qc-test-end-reached":{kind:"notification",scope:"test",deprecated:"cito-test-end-reached"},"qc-item-ref-connected":{kind:"notification",scope:"item",deprecated:"cito-item-ref-connected"}};function F(o,t,e){Ja(o,cd,t,e)}function B(o,t,e){Ya(o,cd,t,e)}var ke=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ld={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},wt=class extends S{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let r=e.getAttribute("identifier");if(!r)continue;let i=Number(e.getAttribute("value"));if(Number.isNaN(i)){console.warn(`qti-weight "${r}" has a non-numeric value, ignoring it`);continue}t.set(r,i)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?Xl(t):null,this.requestUpdate(),await this.updateComplete,F(this,"qc-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let r=e.items.find(i=>i.identifier===this.identifier);if(r)return r}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};ke([p({type:String})],wt.prototype,"category",void 0);ke([p({type:String})],wt.prototype,"identifier",void 0);ke([p({type:Boolean,converter:ld})],wt.prototype,"required",void 0);ke([p({type:Boolean,converter:ld})],wt.prototype,"fixed",void 0);ke([p({type:String})],wt.prototype,"href",void 0);ke([T(),R({context:ct,subscribe:!0})],wt.prototype,"computedContext",void 0);ke([p({type:Object,attribute:!1})],wt.prototype,"xmlDoc",void 0);ke([R({context:Ce,subscribe:!0})],wt.prototype,"testHost",void 0);var Se=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ka={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ct=class extends S{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return v`<slot name="qti-rubric-block"></slot><slot></slot>`}};Se([p({type:String})],Ct.prototype,"identifier",void 0);Se([p({type:String})],Ct.prototype,"required",void 0);Se([p({type:Boolean,converter:Ka})],Ct.prototype,"fixed",void 0);Se([p({type:Boolean,converter:Ka})],Ct.prototype,"visible",void 0);Se([p({type:Boolean,converter:Ka,attribute:"keep-together"})],Ct.prototype,"keepTogether",void 0);Se([p({type:String,attribute:"navigation-mode"})],Ct.prototype,"navigationMode",void 0);Se([p({type:String,attribute:"submission-mode"})],Ct.prototype,"submissionMode",void 0);Se([R({context:nt,subscribe:!0})],Ct.prototype,"_testContext",void 0);var Za=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},rr=class extends S{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,F(this,"qc-test-loaded",this)}render(){return v` <slot></slot>`}};Za([p({type:String})],rr.prototype,"identifier",void 0);Za([p({type:String})],rr.prototype,"title",null);Za([R({context:nt,subscribe:!0})],rr.prototype,"_testContext",void 0);function Zn(o,t){let e=o.firstElementChild;if(!e||typeof e.calculate!="function")return console.warn(`<${o.localName}> has no evaluable expression child`,o),t;try{let r=e.calculate();return r===!0||r==="true"}catch(r){return console.warn(`<${o.localName}> could not evaluate its expression`,r),t}}var Wu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},le=class extends S{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=w`
64
64
  :host {
65
65
  display: none;
66
66
  }
67
- `}evaluate(){return bo(this,!1)}render(){return v`<slot></slot>`}};Mm([p({type:String})],ue.prototype,"target",void 0);var di=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Hi={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Nt=class extends C{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return v`<slot></slot>`}};di([p({type:Number,attribute:"max-attempts"})],Nt.prototype,"maxAttempts",void 0);di([p({type:Boolean,converter:Hi,attribute:"show-feedback"})],Nt.prototype,"showFeedback",void 0);di([p({type:Boolean,converter:Hi,attribute:"allow-review"})],Nt.prototype,"allowReview",void 0);di([p({type:Boolean,converter:Hi,attribute:"show-solution"})],Nt.prototype,"showSolution",void 0);di([p({type:Boolean,converter:Hi,attribute:"allow-comment"})],Nt.prototype,"allowComment",void 0);di([p({type:Boolean,converter:Hi,attribute:"allow-skipping"})],Nt.prototype,"allowSkipping",void 0);di([p({type:Boolean,converter:Hi,attribute:"validate-responses"})],Nt.prototype,"validateResponses",void 0);var Al=o=>o?.split(/\s+/).filter(Boolean)??[],Wi=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:Al(o.getAttribute("include-category")),excludeCategories:Al(o.getAttribute("exclude-category"))}),Qi=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:i})=>{let r=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return r.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):r.flatMap(n=>Array.from(n.querySelectorAll("qti-assessment-item-ref"))).filter(n=>{let s=Al(n.category);return!(e.length>0&&!s.some(a=>e.includes(a))||i.length>0&&s.some(a=>i.includes(a)))})};var Pm=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},tn=class extends E{#t=null;constructor(){super(),U(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-number-presented: no enclosing qti-assessment-test, nothing to count"),0;let e=new Set((this._testContext?.items??[]).filter(i=>{let r=i.variables?.find(n=>n.identifier==="completionStatus")?.value;return r!=null&&r!=="not_attempted"}).map(i=>i.identifier));return Qi(t,Wi(this)).filter(i=>e.has(i.identifier)).length}calculate(){return this.getResult()}};Pm([I({context:st,subscribe:!0})],tn.prototype,"_testContext",void 0);var vo=class extends E{#t=null;constructor(){super(),U(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?Qi(t,Wi(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var yo=class extends C{static{this.styles=w`
67
+ `}evaluate(){return Zn(this,!1)}render(){return v`<slot></slot>`}};Wu([p({type:String})],le.prototype,"target",void 0);var ir=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Or={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Pt=class extends S{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return v`<slot></slot>`}};ir([p({type:Number,attribute:"max-attempts"})],Pt.prototype,"maxAttempts",void 0);ir([p({type:Boolean,converter:Or,attribute:"show-feedback"})],Pt.prototype,"showFeedback",void 0);ir([p({type:Boolean,converter:Or,attribute:"allow-review"})],Pt.prototype,"allowReview",void 0);ir([p({type:Boolean,converter:Or,attribute:"show-solution"})],Pt.prototype,"showSolution",void 0);ir([p({type:Boolean,converter:Or,attribute:"allow-comment"})],Pt.prototype,"allowComment",void 0);ir([p({type:Boolean,converter:Or,attribute:"allow-skipping"})],Pt.prototype,"allowSkipping",void 0);ir([p({type:Boolean,converter:Or,attribute:"validate-responses"})],Pt.prototype,"validateResponses",void 0);var tc=o=>o?.split(/\s+/).filter(Boolean)??[],Dr=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:tc(o.getAttribute("include-category")),excludeCategories:tc(o.getAttribute("exclude-category"))}),$r=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:r})=>{let i=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return i.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):i.flatMap(n=>Array.from(n.querySelectorAll("qti-assessment-item-ref"))).filter(n=>{let s=tc(n.category);return!(e.length>0&&!s.some(a=>e.includes(a))||r.length>0&&s.some(a=>r.includes(a)))})};var Qu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Fi=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-number-presented: no enclosing qti-assessment-test, nothing to count"),0;let e=new Set((this._testContext?.items??[]).filter(r=>{let i=r.variables?.find(n=>n.identifier==="completionStatus")?.value;return i!=null&&i!=="not_attempted"}).map(r=>r.identifier));return $r(t,Dr(this)).filter(r=>e.has(r.identifier)).length}calculate(){return this.getResult()}};Qu([R({context:nt,subscribe:!0})],Fi.prototype,"_testContext",void 0);var to=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?$r(t,Dr(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var eo=class extends S{static{this.styles=w`
68
68
  :host {
69
69
  display: none;
70
70
  }
71
- `}evaluate(){return bo(this,!0)}render(){return v`<slot></slot>`}};var qo=class extends C{static{this.styles=[w`
71
+ `}evaluate(){return Zn(this,!0)}render(){return v`<slot></slot>`}};var ro=class extends S{static{this.styles=[w`
72
72
  :host {
73
73
  display: none;
74
74
  }
75
- `]}render(){return v`<slot></slot>`}process(){let t=new _l,e=[...this.children];t.process(e)}},_l=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Ui))throw e}}};var hi=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},gt=class extends C{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:Md},this.#i={...this._context,variables:this._context.variables},this.#r=new Map,this.#n=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,i=e.type==="template"?this.#r.get(e.identifier):void 0,r=i!==void 0?{...e,value:i}:e;this._context={...this._context,variables:[...this._context.variables,r]},this.#i=this._context,t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:i}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.#b(i,!0,e)},this.#l=t=>{t.stopImmediatePropagation();let{outcomes:e=[],responseProcessed:i=!1}=t.detail??{},r=[];i&&this.adaptive==="false"&&(e.find(s=>s.identifier==="completionStatus")?.value??this.getVariable("completionStatus")?.value)==="unknown"&&r.push({identifier:"completionStatus",value:"completed"}),this.#y([...e,...r],this.#q(!1)),i&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#h=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:i}=t.detail;this.#r.has(e)||this.updateTemplateVariable(e,i??void 0),t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:i}=t.detail;this.updateCorrectResponse(e,i??void 0),t.stopPropagation()},this.#m=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:i,state:r}=t.detail;this.updateResponseVariable(e,i),r!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:r}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),i=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||i)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...i?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(n=>!("identifier"in n))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,i=t.filter(n=>n.value!==null&&n.value!==void 0&&(n.type==="template"||e.some(s=>s.identifier===n.identifier&&s.type==="template")));i.forEach(n=>this.#r.set(n.identifier,n.value));let r=i.some(n=>JSON.stringify(e.find(s=>s.identifier===n.identifier)?.value)!==JSON.stringify(n.value));this._context={...this._context,variables:this._context.variables.map(n=>{let s=t.find(a=>a.identifier===n.identifier);return s?{...n,...s,interpolationTable:n.interpolationTable,matchTable:n.matchTable}:n})},this.#n&&r&&this.#g(),this.updateComplete.then(()=>this.#k()),this.isConnected&&this.#f()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#i;#r;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let r=this.interactionElements.find(n=>n.getAttribute("response-identifier")===e.responseIdentifier);r&&(r.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#f(),kt(this,"qc-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#p()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#d),this.addEventListener("end-attempt",this.#u),this.addEventListener("qc-item-set-outcomes",this.#l),this.addEventListener("qti-set-template-value",this.#h),this.addEventListener("qti-set-correct-response",this.#c),this.addEventListener("qti-interaction-response",this.#m)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#d),this.removeEventListener("end-attempt",this.#u),this.removeEventListener("qc-item-set-outcomes",this.#l),this.removeEventListener("qti-set-template-value",this.#h),this.removeEventListener("qti-set-correct-response",this.#c),this.removeEventListener("qti-interaction-response",this.#m)}#a;#d;#u;#l;#h;#c;#m;async#p(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#g()}#g(){this.#e&&(this.#e.process(),this.#i={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#b(t,e)}#b(t,e,i){this.#q(e),this.#v(i);let r=+this.getVariable("numAttempts")?.value+(t?1:0),n=this.querySelector("qti-response-processing");if(typeof n?.processResponse=="function"){try{n.processResponse({numAttempts:r})}catch(s){throw this.#y([{identifier:"numAttempts",value:String(r)}]),s}return!0}return kt(this,"qc-item-set-outcomes",{outcomes:[{identifier:"numAttempts",value:String(r)}],responseProcessed:!0}),!1}#v(t){let e=Array.from(this.querySelectorAll("qti-end-attempt-interaction"),i=>i.getAttribute("response-identifier")).filter(i=>i&&i!==t);e.length!==0&&(this._context={...this._context,variables:this._context.variables.map(i=>e.includes(i.identifier)?{...i,value:"false"}:i)})}resetResponses(){this._context=this.#i,this.isConnected&&this.#f()}#f(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==t?i:{...i,value:e})},this.afterResponseVariableUpdated(),kt(this,"qc-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let i=this._context.variables.find(n=>n.identifier===t&&n.type==="template");if(!i){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let r=i.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:r})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let i=this.getResponse(t);if(!i){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let r=i.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,correctResponse:r})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){this.#y([{identifier:t,value:e}])}#y(t,e){let i=new Map;for(let{identifier:n,value:s}of t){let a=this.getVariable(n);if(!a){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);continue}i.set(n,a.cardinality==="single"||Array.isArray(s)?s:[s])}let r=e!==void 0&&e!==this._context.valid;if(!(i.size===0&&!r)&&(this._context={...this._context,...r?{valid:e}:{},variables:this._context.variables.map(n=>i.has(n.identifier)?{...n,value:i.get(n.identifier)}:n)},i.size>0)){for(let[n,s]of i)kt(this,"qc-item-outcome-changed",{item:this.identifier,outcomeIdentifier:n,value:s});kt(this,"qc-item-outcomes-changed",{item:this.identifier,outcomes:[...i].map(([n,s])=>({identifier:n,value:s}))})}}validate(t=!0){let e=this.#q(t);return this.#x(e),e}#q(t){let e=this.interactionElements.every(i=>i.validate());return t&&this.reportValidity(),e}#x(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#k(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}};hi([p({type:String})],gt.prototype,"identifier",void 0);hi([p({type:String})],gt.prototype,"adaptive",void 0);hi([p({type:String,attribute:"time-dependent"})],gt.prototype,"timeDependent",void 0);hi([p({type:String})],gt.prototype,"title",null);hi([p({type:Boolean})],gt.prototype,"disabled",void 0);hi([p({type:Boolean})],gt.prototype,"readonly",void 0);hi([X({context:F})],gt.prototype,"_context",void 0);var Ud=w`
75
+ `]}render(){return v`<slot></slot>`}process(){let t=new ec,e=[...this.children];t.process(e)}},ec=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Pr))throw e}}};var nr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ut=class extends S{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:Kl},this.#r={...this._context,variables:this._context.variables},this.#i=new Map,this.#n=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,r=e.type==="template"?this.#i.get(e.identifier):void 0,i=r!==void 0?{...e,value:r}:e;this._context={...this._context,variables:[...this._context.variables,i]},this.#r=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.#b(r,!0,e)},this.#l=t=>{t.stopImmediatePropagation();let{outcomes:e=[],responseProcessed:r=!1}=t.detail??{},i=[];r&&this.adaptive==="false"&&(e.find(s=>s.identifier==="completionStatus")?.value??this.getVariable("completionStatus")?.value)==="unknown"&&i.push({identifier:"completionStatus",value:"completed"}),this.#y([...e,...i],this.#q(!1)),r&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),r=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||r)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...r?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(n=>!("identifier"in n))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,r=t.filter(n=>n.value!==null&&n.value!==void 0&&(n.type==="template"||e.some(s=>s.identifier===n.identifier&&s.type==="template")));r.forEach(n=>this.#i.set(n.identifier,n.value));let i=r.some(n=>JSON.stringify(e.find(s=>s.identifier===n.identifier)?.value)!==JSON.stringify(n.value));this._context={...this._context,variables:this._context.variables.map(n=>{let s=t.find(a=>a.identifier===n.identifier);return s?{...n,...s,interpolationTable:n.interpolationTable,matchTable:n.matchTable}:n})},this.#n&&i&&this.#m(),this.updateComplete.then(()=>this.#C()),this.isConnected&&this.#v()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#i;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(n=>n.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#v(),xt(this,"qc-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#g()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#p),this.addEventListener("qc-item-set-outcomes",this.#l),this.addEventListener("qti-set-template-value",this.#d),this.addEventListener("qti-set-correct-response",this.#h),this.addEventListener("qti-interaction-response",this.#u)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qc-item-set-outcomes",this.#l),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#h),this.removeEventListener("qti-interaction-response",this.#u)}#a;#c;#p;#l;#d;#h;#u;async#g(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#m()}#m(){this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#b(t,e)}#b(t,e,r){this.#q(e),this.#f(r);let i=+this.getVariable("numAttempts")?.value+(t?1:0),n=this.querySelector("qti-response-processing");if(typeof n?.processResponse=="function"){try{n.processResponse({numAttempts:i})}catch(s){throw this.#y([{identifier:"numAttempts",value:String(i)}]),s}return!0}return xt(this,"qc-item-set-outcomes",{outcomes:[{identifier:"numAttempts",value:String(i)}],responseProcessed:!0}),!1}#f(t){let e=Array.from(this.querySelectorAll("qti-end-attempt-interaction"),r=>r.getAttribute("response-identifier")).filter(r=>r&&r!==t);e.length!==0&&(this._context={...this._context,variables:this._context.variables.map(r=>e.includes(r.identifier)?{...r,value:"false"}:r)})}resetResponses(){this._context=this.#r,this.isConnected&&this.#v()}#v(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),xt(this,"qc-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let r=this._context.variables.find(n=>n.identifier===t&&n.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){this.#y([{identifier:t,value:e}])}#y(t,e){let r=new Map;for(let{identifier:n,value:s}of t){let a=this.getVariable(n);if(!a){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);continue}r.set(n,a.cardinality==="single"||Array.isArray(s)?s:[s])}let i=e!==void 0&&e!==this._context.valid;if(!(r.size===0&&!i)&&(this._context={...this._context,...i?{valid:e}:{},variables:this._context.variables.map(n=>r.has(n.identifier)?{...n,value:r.get(n.identifier)}:n)},r.size>0)){for(let[n,s]of r)xt(this,"qc-item-outcome-changed",{item:this.identifier,outcomeIdentifier:n,value:s});xt(this,"qc-item-outcomes-changed",{item:this.identifier,outcomes:[...r].map(([n,s])=>({identifier:n,value:s}))})}}validate(t=!0){let e=this.#q(t);return this.#x(e),e}#q(t){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}#x(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#C(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}};nr([p({type:String})],ut.prototype,"identifier",void 0);nr([p({type:String})],ut.prototype,"adaptive",void 0);nr([p({type:String,attribute:"time-dependent"})],ut.prototype,"timeDependent",void 0);nr([p({type:String})],ut.prototype,"title",null);nr([p({type:Boolean})],ut.prototype,"disabled",void 0);nr([p({type:Boolean})],ut.prototype,"readonly",void 0);nr([J({context:j})],ut.prototype,"_context",void 0);var dd=w`
76
76
  :host {
77
77
  display: contents;
78
78
  }
@@ -80,11 +80,11 @@ Make sure to test your application with a production build as repeat registratio
80
80
  ::slotted(qti-catalog-info) {
81
81
  display: none;
82
82
  }
83
- `;var xo=class extends C{static{this.styles=Ud}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function Hd(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let i=document.createComment(e.textContent);e.replaceChild(i,e.firstChild)})}async function Wd(o,t,e,i="qti-portable-custom-interaction"){let r=[],n=o.querySelectorAll(i);if(n.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(n)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&r.includes(d)&&(d=d+r.length,c.setAttribute("custom-interaction-type-identifier",d),r.push(d)),d&&r.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of y){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],b=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",b),a&&a.paths&&a.paths[u]){let q=a.paths[u];Array.isArray(q)?x.setAttribute("fallback-path",q[0]):x.setAttribute("fallback-path",q)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let b=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",b),a&&a.paths&&a.paths[x]){let q=a.paths[x];Array.isArray(q)?g.setAttribute("fallback-path",q[0]):g.setAttribute("fallback-path",q)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=x.map((b,q)=>{let _=u.length>q?u[q]:"";return{primaryPath:b,fallbackPath:_}});for(let b of u)g.some(q=>q.fallbackPath===b)||g.push({primaryPath:x.length>0?x[0]:b,fallbackPath:b});for(let b of g){let q=o.createElement("qti-interaction-module");b.fallbackPath&&q.setAttribute("fallback-path",b.fallbackPath),q.setAttribute("id",f),q.setAttribute("primary-path",b.primaryPath),h&&h.appendChild(q)}}}}}function Qd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===t||n.localName?.toLowerCase()===t.toLowerCase()).forEach(n=>{let s=`${t}-${e}`,a=Gd(n,s);n.replaceWith(a)})}function Xd(o,t){o.querySelectorAll("*").forEach(e=>{let i=e.classList;i&&i.forEach(r=>{if(r.startsWith(`${t}:`)){let n=r.slice(`${t}:`.length),s=`${e.nodeName}-${n}`,a=Gd(e,s);e.replaceWith(a)}})})}function Gd(o,t){let e=o.ownerDocument.createElement(t);for(let i of o.attributes)e.setAttribute(i.name,i.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function Jd(o,t){let e=["hook","module"],i=t.substring(0,t.lastIndexOf("/"));for(let r of e)o.querySelectorAll("["+r+"]").forEach(s=>{let a=s.getAttribute(r);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",i+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var Rl=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=Dm(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=Om(`${t}`),e}random(){this.#t|=0,this.#t=this.#t+1831565813|0;let t=Math.imul(this.#t^this.#t>>>15,1|this.#t);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}};function wo(o){return Rl.fromSeedKey(o)}function Om(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o.charCodeAt(e),3432918353),t=t<<13|t>>>19;return Yd(t)}function Dm(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return Yd(t)}function Yd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var $m=o=>typeof o=="function"?o():o.random();function Co(o,t){let e=o.filter(r=>!r.fixed);for(let r=e.length-1;r>0;r--){let n=Math.floor($m(t)*(r+1));[e[r],e[n]]=[e[n],e[r]]}let i=0;return o.map(r=>r.fixed?r:e[i++])}function Nm(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}function Il(o,t){let e=o.querySelectorAll('[shuffle="true"]'),i=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),r=t!=null&&`${t}`.length>0,n=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of i){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=Nm(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let y=r?wo(`${t}:${n}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(q=>q.parentElement!==null);if(x.filter(q=>q.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(q=>q.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=Co(x.map(q=>({element:q,fixed:q.getAttribute("fixed")==="true"})),y);for(let q of x)q.remove();for(let{element:q}of b)u.insertBefore(q,g);h=!0}h&&a.removeAttribute("shuffle")}}function Kd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Lm={"qti-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-choice-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-drawing-interaction":{baseTypes:["file"],cardinalities:["single"]},"qti-end-attempt-interaction":{baseTypes:["boolean"],cardinalities:["single"]},"qti-extended-text-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","multiple","ordered","record"]},"qti-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["multiple"]},"qti-graphic-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-hotspot-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-hottext-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-inline-choice-interaction":{baseTypes:["identifier"],cardinalities:["single"]},"qti-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-media-interaction":{baseTypes:["integer"],cardinalities:["single"]},"qti-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-position-object-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-select-point-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:0}},"qti-slider-interaction":{baseTypes:["integer","float"],cardinalities:["single"]},"qti-text-entry-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","record"]},"qti-upload-interaction":{baseTypes:["file"],cardinalities:["single"]}},Zd=o=>o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o[o.length-1]}`;function th(o){let t=new Map(Array.from(o.querySelectorAll("qti-response-declaration"),i=>[i.getAttribute("identifier"),i])),e=[];for(let[i,r]of Object.entries(Lm))for(let n of Array.from(o.querySelectorAll(i))){let s=n.getAttribute("response-identifier"),a=t.get(s);if(!a)continue;let l=`${i} (response "${s}")`,c=a.getAttribute("cardinality"),d=a.getAttribute("base-type");if(c&&!r.cardinalities.includes(c))e.push(`${l}: ${c} cardinality is not permitted; it must be ${Zd(r.cardinalities)}`);else if(c&&r.max&&c!=="multiple"){let h=n.getAttribute(r.max.attribute),f=h===null?r.max.default:Number(h);(f===0||f>1)&&e.push(`${l}: ${r.max.attribute} ${f} requires multiple cardinality, not ${c}`)}c!=="record"&&d&&!r.baseTypes.includes(d)&&e.push(`${l}: base-type ${d} is not permitted; it must be ${Zd(r.baseTypes)}`)}if(e.length>0)throw new Error(`QTI validation error: ${e.join("; ")}.`)}var eh=!1;function ko(o,t){eh||(eh=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function Vm(o){return(o.textContent||"").replace(/\s+/g," ").trim().replace(/^This page contains the following errors:\s*/i,"").replace(/\s*Below is a rendering of the page up to the first error\.?\s*$/i,"").trim()||"malformed XML"}function ih(o,t){let i=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),r=i.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??i.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(r)throw new Error(t(Vm(r)));return i}function Xi(o,t){return fetch(o,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>ih(e,i=>`is not well-formed XML: ${i}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Gi(o){return ih(o,t=>`Failed to parse XML: ${t}`)}function rh(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let i=o,r;!i.namespaceURI||i.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||i.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?r=e?t.createElement(i.localName,{customElementRegistry:e}):t.createElement(i.localName):r=t.createElementNS(i.namespaceURI,i.tagName);for(let n=0;n<i.attributes.length;n++){let s=i.attributes[n];r.setAttribute(s.localName,s.value)}for(let n=0;n<i.childNodes.length;n++)r.appendChild(rh(i.childNodes[n],t,e));return r}return o.cloneNode(!1)}function Ji(o,t){let e=document.createDocumentFragment();for(let i=0;i<o.childNodes.length;i++)e.appendChild(rh(o.childNodes[i],document,t));return e}function Yi(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(i=>{for(let r of["src","href","srcset","poster"]){let n=i.getAttribute(r)?.trim();if(n&&!/^(data:|https?:|blob:)/.test(n)){let s=t+encodeURI(n);i.setAttribute(r,s)}}})}var Zt=()=>{let o,t="",e={load(i,r){return t=i,Xi(i,r).then(n=>(o=n,e))},parse(i){return o=Gi(i),t="",e},path:i=>(Yi(o,i),t=null,e),fn(i){return i(o),e},pciHooks(i){return Jd(o,i),e},async configurePci(i,r,n="qti-portable-custom-interaction"){return await Wd(o,i,r,n),e},shuffleInteractions(i){let r=typeof i=="string"?i.trim():i;if(r==null||r===""){let n=t||"default-item-seed";return ko("qtiTransformItem",n),Il(o,n),e}return Il(o,r),e},extendElementName:(i,r)=>(Qd(o,i,r),e),extendElementsWithClass:(i="extend")=>(Xd(o,i),e),customInteraction(i,r){let n=o.querySelector("qti-custom-interaction"),s=n.querySelector("object");return n.setAttribute("data-base-ref",i),n.setAttribute("data-base-item",i+r),n.setAttribute("data",s.getAttribute("data")),n.setAttribute("width",s.getAttribute("width")),n.setAttribute("height",s.getAttribute("height")),n.removeChild(s),e},convertCDATAtoComment(){return Hd(o),e},stripStyleSheets(){return Kd(o),e},validateBindings(){return th(o),e},html(){return t!==null&&Yi(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Ji(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(i){return t!==null&&Yi(o,t.substring(0,t.lastIndexOf("/"))),Ji(o,i)},xmlDoc(){return o}};return e};var nh=()=>{let o,t={async load(e,i){return o=await Xi(e,i),t},parse(e){o=Gi(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function oh(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let i=e.getAttribute("identifier"),r=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:i,href:r,category:n})}),t}var So=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),sh=o=>So(o,"qti-assessment-item-ref","assessmentitemref"),rn=o=>So(o,"qti-assessment-section","assessmentsection"),en=(o,...t)=>t.some(e=>{let i=(o.getAttribute(e)??"").trim().toLowerCase();return i==="true"||i==="1"}),jm=(o,...t)=>t.some(e=>{let i=(o.getAttribute(e)??"").trim().toLowerCase();return i==="false"||i==="0"}),Tl=o=>So(o,"qti-ordering","ordering"),Fm=o=>So(o,"qti-selection","selection"),zm=o=>Array.from(o.children).filter(t=>Tl(t)&&en(t,"shuffle")),Bm=(o,t)=>wo(`${o}:${t}`);function Um(o){let t=[],e=[],i=r=>{for(let n of Array.from(r.children))sh(n)?t.push(n):rn(n)?i(n):!Tl(n)&&!Fm(n)&&e.push(n.localName)};return i(o),{itemRefs:t,dropped:e}}function Hm(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function ah(o,t){for(let l of Array.from(o.children))rn(l)&&ah(l,t);let e=zm(o);if(e.length===0)return;let i=[],r=[];for(let l of Array.from(o.children))if(sh(l))i.push({nodes:[l],fixed:en(l,"fixed")}),r.push(l);else if(rn(l)){let{itemRefs:c,dropped:d}=Um(l);if(Hm(l,d),jm(l,"keep-together","keeptogether"))for(let h of c)i.push({nodes:[h],fixed:en(h,"fixed")});else c.length>0&&i.push({nodes:c,fixed:en(l,"fixed")});r.push(l)}let n=r.length>0?r[r.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=Co(i,Bm(t,s));for(let l of r)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,n);for(let l of e)l.remove()}function lh(o){return Array.from(o.getElementsByTagName("*")).some(t=>Tl(t)&&en(t,"shuffle"))}function Ml(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(i=>rn(i));for(let i of e){if(!i.parentNode)continue;let r=i.parentElement;r&&rn(r)||ah(i,t)}}var Ki=()=>{let o,t="",e={async load(i,r){return o=await Xi(i,r),t=i,e.path(i.substring(0,i.lastIndexOf("/"))),e},parse(i){return o=Gi(i),t="",e},path:i=>(Yi(o,i),e),fn(i){return i(o),e},shuffleOrdering(i){if(!lh(o))return e;let r=typeof i=="string"?i.trim():i;if(r==null||r===""){let n=t||"default-test-seed";return ko("qtiTransformTest",n),Ml(o,n),e}return Ml(o,r),e},items(){return oh(o)},html(){return new XMLSerializer().serializeToString(Ji(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(i){return Ji(o,i)},xmlDoc(){return o}};return e};var ch=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Pl=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},Zi=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new Pl(this,t);this.dispatchEvent(e);let i=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&i&&await this.updateStimulusRef(i)}async updateStimulusRef(t){let i=(await Zt().load(this.href).then(r=>r.htmlDoc()))?.querySelector("qti-assessment-stimulus");i&&(t.innerHTML="",t.append(i))}};ch([p({type:String})],Zi.prototype,"identifier",void 0);ch([p({type:String})],Zi.prototype,"href",void 0);var Eo=class extends C{};var Wm=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},nn=class extends C{render(){return v`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(r=>r.type==="template");for(let r of e){let n=r;n.mathVariable!==!0||n.value===null||n.value===void 0||t.set(n.identifier,this.#e(n.value))}if(t.size===0)return;let i=Array.from(this.querySelectorAll("*")).filter(r=>r.localName.toLowerCase()==="mi"||r.localName.toLowerCase()==="mn");for(let r of i){let n=r.getAttribute("data-qti-math-variable-source")??r.textContent?.trim()??"",s=t.get(n);if(!s)continue;if(r.localName.toLowerCase()==="mn"){r.textContent=s,r.setAttribute("data-qti-math-variable-source",n);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",n),r.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Wm([I({context:F,subscribe:!0}),R()],nn.prototype,"context",void 0);var dh=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},tr=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[w`
83
+ `;var io=class extends S{static{this.styles=dd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function hd(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function pd(o,t,e,r="qti-portable-custom-interaction"){let i=[],n=o.querySelectorAll(r);if(n.length===0)return;let s=null,a=null,c=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let l of Array.from(n)){l.setAttribute("data-base-url",t);let d=l.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,l.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=l.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await c();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of y){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],b=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",b),a&&a.paths&&a.paths[u]){let q=a.paths[u];Array.isArray(q)?x.setAttribute("fallback-path",q[0]):x.setAttribute("fallback-path",q)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let b=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",b),a&&a.paths&&a.paths[x]){let q=a.paths[x];Array.isArray(q)?g.setAttribute("fallback-path",q[0]):g.setAttribute("fallback-path",q)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await c(),s){l.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),l.appendChild(h)):h=l.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=x.map((b,q)=>{let _=u.length>q?u[q]:"";return{primaryPath:b,fallbackPath:_}});for(let b of u)g.some(q=>q.fallbackPath===b)||g.push({primaryPath:x.length>0?x[0]:b,fallbackPath:b});for(let b of g){let q=o.createElement("qti-interaction-module");b.fallbackPath&&q.setAttribute("fallback-path",b.fallbackPath),q.setAttribute("id",f),q.setAttribute("primary-path",b.primaryPath),h&&h.appendChild(q)}}}}}function ud(o,t,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===t||n.localName?.toLowerCase()===t.toLowerCase()).forEach(n=>{let s=`${t}-${e}`,a=fd(n,s);n.replaceWith(a)})}function md(o,t){o.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let n=i.slice(`${t}:`.length),s=`${e.nodeName}-${n}`,a=fd(e,s);e.replaceWith(a)}})})}function fd(o,t){let e=o.ownerDocument.createElement(t);for(let r of o.attributes)e.setAttribute(r.name,r.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function gd(o,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let i of e)o.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var rc=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=Gu(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=Xu(`${t}`),e}random(){this.#t|=0,this.#t=this.#t+1831565813|0;let t=Math.imul(this.#t^this.#t>>>15,1|this.#t);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}};function no(o){return rc.fromSeedKey(o)}function Xu(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o.charCodeAt(e),3432918353),t=t<<13|t>>>19;return bd(t)}function Gu(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return bd(t)}function bd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var Ju=o=>typeof o=="function"?o():o.random();function oo(o,t){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let n=Math.floor(Ju(t)*(i+1));[e[i],e[n]]=[e[n],e[i]]}let r=0;return o.map(i=>i.fixed?i:e[r++])}function Yu(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}function ic(o,t){let e=o.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,n=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let c=a.getAttribute("response-identifier")??`${s}`;s++;let l=Yu(a.tagName.toLowerCase()),d=Array.isArray(l)?l:[l],h=!1,f=0;for(let m of d){if(!m)continue;let y=i?no(`${t}:${n}:${c}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(q=>q.parentElement!==null);if(x.filter(q=>q.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(q=>q.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=oo(x.map(q=>({element:q,fixed:q.getAttribute("fixed")==="true"})),y);for(let q of x)q.remove();for(let{element:q}of b)u.insertBefore(q,g);h=!0}h&&a.removeAttribute("shuffle")}}function vd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Ku={"qti-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-choice-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-drawing-interaction":{baseTypes:["file"],cardinalities:["single"]},"qti-end-attempt-interaction":{baseTypes:["boolean"],cardinalities:["single"]},"qti-extended-text-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","multiple","ordered","record"]},"qti-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["multiple"]},"qti-graphic-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-hotspot-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-hottext-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-inline-choice-interaction":{baseTypes:["identifier"],cardinalities:["single"]},"qti-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-media-interaction":{baseTypes:["integer"],cardinalities:["single"]},"qti-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-position-object-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-select-point-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:0}},"qti-slider-interaction":{baseTypes:["integer","float"],cardinalities:["single"]},"qti-text-entry-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","record"]},"qti-upload-interaction":{baseTypes:["file"],cardinalities:["single"]}},yd=o=>o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o[o.length-1]}`;function qd(o){let t=new Map(Array.from(o.querySelectorAll("qti-response-declaration"),r=>[r.getAttribute("identifier"),r])),e=[];for(let[r,i]of Object.entries(Ku))for(let n of Array.from(o.querySelectorAll(r))){let s=n.getAttribute("response-identifier"),a=t.get(s);if(!a)continue;let c=`${r} (response "${s}")`,l=a.getAttribute("cardinality"),d=a.getAttribute("base-type");if(l&&!i.cardinalities.includes(l))e.push(`${c}: ${l} cardinality is not permitted; it must be ${yd(i.cardinalities)}`);else if(l&&i.max&&l!=="multiple"){let h=n.getAttribute(i.max.attribute),f=h===null?i.max.default:Number(h);(f===0||f>1)&&e.push(`${c}: ${i.max.attribute} ${f} requires multiple cardinality, not ${l}`)}l!=="record"&&d&&!i.baseTypes.includes(d)&&e.push(`${c}: base-type ${d} is not permitted; it must be ${yd(i.baseTypes)}`)}if(e.length>0)throw new Error(`QTI validation error: ${e.join("; ")}.`)}var xd=!1;function so(o,t){xd||(xd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function Zu(o){return(o.textContent||"").replace(/\s+/g," ").trim().replace(/^This page contains the following errors:\s*/i,"").replace(/\s*Below is a rendering of the page up to the first error\.?\s*$/i,"").trim()||"malformed XML"}function wd(o,t){let r=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),i=r.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??r.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(i)throw new Error(t(Zu(i)));return r}function Nr(o,t){return fetch(o,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>wd(e,r=>`is not well-formed XML: ${r}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Lr(o){return wd(o,t=>`Failed to parse XML: ${t}`)}function Cd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let r=o,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):i=t.createElementNS(r.namespaceURI,r.tagName);for(let n=0;n<r.attributes.length;n++){let s=r.attributes[n];i.setAttribute(s.localName,s.value)}for(let n=0;n<r.childNodes.length;n++)i.appendChild(Cd(r.childNodes[n],t,e));return i}return o.cloneNode(!1)}function Vr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild(Cd(o.childNodes[r],document,t));return e}function jr(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let n=r.getAttribute(i)?.trim();if(n&&!/^(data:|https?:|blob:)/.test(n)){let s=t+encodeURI(n);r.setAttribute(i,s)}}})}var Gt=()=>{let o,t="",e={load(r,i){return t=r,Nr(r,i).then(n=>(o=n,e))},parse(r){return o=Lr(r),t="",e},path:r=>(jr(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return gd(o,r),e},async configurePci(r,i,n="qti-portable-custom-interaction"){return await pd(o,r,i,n),e},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-item-seed";return so("qtiTransformItem",n),ic(o,n),e}return ic(o,i),e},extendElementName:(r,i)=>(ud(o,r,i),e),extendElementsWithClass:(r="extend")=>(md(o,r),e),customInteraction(r,i){let n=o.querySelector("qti-custom-interaction"),s=n.querySelector("object");return n.setAttribute("data-base-ref",r),n.setAttribute("data-base-item",r+i),n.setAttribute("data",s.getAttribute("data")),n.setAttribute("width",s.getAttribute("width")),n.setAttribute("height",s.getAttribute("height")),n.removeChild(s),e},convertCDATAtoComment(){return hd(o),e},stripStyleSheets(){return vd(o),e},validateBindings(){return qd(o),e},html(){return t!==null&&jr(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Vr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&jr(o,t.substring(0,t.lastIndexOf("/"))),Vr(o,r)},xmlDoc(){return o}};return e};var kd=()=>{let o,t={async load(e,r){return o=await Nr(e,r),t},parse(e){o=Lr(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Sd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:i,category:n})}),t}var ao=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Ed=o=>ao(o,"qti-assessment-item-ref","assessmentitemref"),Bi=o=>ao(o,"qti-assessment-section","assessmentsection"),zi=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),tm=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),nc=o=>ao(o,"qti-ordering","ordering"),em=o=>ao(o,"qti-selection","selection"),rm=o=>Array.from(o.children).filter(t=>nc(t)&&zi(t,"shuffle")),im=(o,t)=>no(`${o}:${t}`);function nm(o){let t=[],e=[],r=i=>{for(let n of Array.from(i.children))Ed(n)?t.push(n):Bi(n)?r(n):!nc(n)&&!em(n)&&e.push(n.localName)};return r(o),{itemRefs:t,dropped:e}}function om(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function Ad(o,t){for(let c of Array.from(o.children))Bi(c)&&Ad(c,t);let e=rm(o);if(e.length===0)return;let r=[],i=[];for(let c of Array.from(o.children))if(Ed(c))r.push({nodes:[c],fixed:zi(c,"fixed")}),i.push(c);else if(Bi(c)){let{itemRefs:l,dropped:d}=nm(c);if(om(c,d),tm(c,"keep-together","keeptogether"))for(let h of l)r.push({nodes:[h],fixed:zi(h,"fixed")});else l.length>0&&r.push({nodes:l,fixed:zi(c,"fixed")});i.push(c)}let n=i.length>0?i[i.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=oo(r,im(t,s));for(let c of i)c.remove();for(let c of a)for(let l of c.nodes)o.insertBefore(l,n);for(let c of e)c.remove()}function _d(o){return Array.from(o.getElementsByTagName("*")).some(t=>nc(t)&&zi(t,"shuffle"))}function oc(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Bi(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&Bi(i)||Ad(r,t)}}var Fr=()=>{let o,t="",e={async load(r,i){return o=await Nr(r,i),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return o=Lr(r),t="",e},path:r=>(jr(o,r),e),fn(r){return r(o),e},shuffleOrdering(r){if(!_d(o))return e;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-test-seed";return so("qtiTransformTest",n),oc(o,n),e}return oc(o,i),e},items(){return Sd(o)},html(){return new XMLSerializer().serializeToString(Vr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return Vr(o,r)},xmlDoc(){return o}};return e};var Td=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},sc=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},zr=class extends S{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new sc(this,t);this.dispatchEvent(e);let r=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(t){let r=(await Gt().load(this.href).then(i=>i.htmlDoc()))?.querySelector("qti-assessment-stimulus");r&&(t.innerHTML="",t.append(r))}};Td([p({type:String})],zr.prototype,"identifier",void 0);Td([p({type:String})],zr.prototype,"href",void 0);var co=class extends S{};var sm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ui=class extends S{render(){return v`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let n=i;n.mathVariable!==!0||n.value===null||n.value===void 0||t.set(n.identifier,this.#e(n.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let n=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(n);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",n);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",n),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};sm([R({context:j,subscribe:!0}),T()],Ui.prototype,"context",void 0);var Rd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Br=class extends S{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[w`
84
84
  :host {
85
85
  display: none;
86
86
  }
87
- `]}render(){return v`<slot></slot>`}};dh([p({type:String})],tr.prototype,"identifier",void 0);dh([p({type:String})],tr.prototype,"cardinality",void 0);var Qm=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},on=class extends C{#t;render(){return v`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.#t=new Function("context","fn","item",t?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t=this.getAttribute("definition");if(t)return this.#e(t);let e={variable:r=>this._context?.variables.find(n=>n.identifier===r)?.value??"",correct:r=>this._context?.variables.find(n=>n.identifier===r)?.correctResponse??""},i={getVariable:r=>this._context?.variables.find(n=>n.identifier===r),updateOutcomeVariable:(r,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:n}}))}};return this.#t(this._context,e,i)}#e(t){let e=Nd(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let i=Array.from(this.children).map(r=>{let n=r.calculate;return typeof n=="function"?n.call(r):null});return e(i)}};Qm([I({context:F,subscribe:!0}),R()],on.prototype,"_context",void 0);function me(o,t,e,i){let r=o.closest("qti-assessment-item")?.getAttribute("identifier")??void 0,n={kind:e,identifier:i,outcomeIdentifier:o.outcomeIdentifier,element:o,...r?{itemIdentifier:r}:{}};return kt(o,t,n,!0)}var Ao=class extends ft{static{this.styles=w`
87
+ `]}render(){return v`<slot></slot>`}};Rd([p({type:String})],Br.prototype,"identifier",void 0);Rd([p({type:String})],Br.prototype,"cardinality",void 0);var am=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Hi=class extends S{#t;render(){return v`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.#t=new Function("context","fn","item",t?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t=this.getAttribute("definition");if(t)return this.#e(t);let e={variable:i=>this._context?.variables.find(n=>n.identifier===i)?.value??"",correct:i=>this._context?.variables.find(n=>n.identifier===i)?.correctResponse??""},r={getVariable:i=>this._context?.variables.find(n=>n.identifier===i),updateOutcomeVariable:(i,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:n}}))}};return this.#t(this._context,e,r)}#e(t){let e=id(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let r=Array.from(this.children).map(i=>{let n=i.calculate;return typeof n=="function"?n.call(i):null});return e(r)}};am([R({context:j,subscribe:!0}),T()],Hi.prototype,"_context",void 0);function de(o,t,e,r){let i=o.closest("qti-assessment-item")?.getAttribute("identifier")??void 0,n={kind:e,identifier:r,outcomeIdentifier:o.outcomeIdentifier,element:o,...i?{itemIdentifier:i}:{}};return xt(o,t,n,!0)}var lo=class extends pt{static{this.styles=w`
88
88
  :host {
89
89
  display: block;
90
90
  }
@@ -94,18 +94,18 @@ Make sure to test your application with a production build as repeat registratio
94
94
  .off {
95
95
  display: none;
96
96
  }
97
- `}render(){return v` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}feedbackShowing(){return me(this,"qc-feedback-show","block",this.identifier)}feedbackHiding(){return me(this,"qc-feedback-hide","block",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var G=o=>o??P;var _o=class extends ft{constructor(){super(...arguments),this.render=()=>v` <slot part="feedback" class="${G(this.showStatus)}"></slot> `}static{this.styles=w`
97
+ `}render(){return v` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}feedbackShowing(){return de(this,"qc-feedback-show","block",this.identifier)}feedbackHiding(){return de(this,"qc-feedback-hide","block",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var kt=o=>o??P;var ho=class extends pt{constructor(){super(...arguments),this.render=()=>v` <slot part="feedback" class="${kt(this.showStatus)}"></slot> `}static{this.styles=w`
98
98
  .on {
99
99
  display: inline-block;
100
100
  }
101
101
  .off {
102
102
  display: none;
103
103
  }
104
- `}feedbackShowing(){return me(this,"qc-feedback-show","inline",this.identifier)}feedbackHiding(){return me(this,"qc-feedback-hide","inline",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var hh=w`
104
+ `}feedbackShowing(){return de(this,"qc-feedback-show","inline",this.identifier)}feedbackHiding(){return de(this,"qc-feedback-hide","inline",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Id=w`
105
105
  :host {
106
106
  display: block;
107
107
  }
108
- `;var Ro=class extends C{static{this.styles=hh}render(){return v`<slot part="rubrics qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var er=class extends ft{static{this.styles=w`
108
+ `;var po=class extends S{static{this.styles=Id}render(){return v`<slot part="rubrics qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Ur=class extends pt{static{this.styles=w`
109
109
  .cito-dialog {
110
110
  background: var(--qti-bg);
111
111
  border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
@@ -150,15 +150,15 @@ Make sure to test your application with a production build as repeat registratio
150
150
  <button class="button close-button" @click="${this.closeFeedback}">Close</button>
151
151
  </div>
152
152
  </dialog>
153
- `}openFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}closeFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&t.open&&(t.close(),this.showStatus="off")}feedbackShowing(){return me(this,"qc-feedback-show","modal",this.identifier)}feedbackHiding(){return me(this,"qc-feedback-hide","modal",this.identifier)}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(t){t.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var sn=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},fe=class extends zi{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[w`
153
+ `}openFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}closeFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&t.open&&(t.close(),this.showStatus="off")}feedbackShowing(){return de(this,"qc-feedback-show","modal",this.identifier)}feedbackHiding(){return de(this,"qc-feedback-hide","modal",this.identifier)}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(t){t.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var Wi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},he=class extends Ir{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[w`
154
154
  :host {
155
155
  display: none;
156
156
  }
157
- `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let i of t.querySelectorAll("qti-interpolation-table-entry")){let r=parseFloat(i.getAttribute("source-value")),n=parseFloat(i.getAttribute("target-value"));if(Number.isNaN(r)||Number.isNaN(n)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:r,targetValue:n,includeBoundary:i.getAttribute("include-boundary")!=="false"})}return e}get matchTable(){let t=this.querySelector("qti-match-table");if(!t)return null;let e=new Map;for(let i of t.querySelectorAll("qti-match-table-entry")){let r=parseFloat(i.getAttribute("source-value")),n=i.getAttribute("target-value");if(Number.isNaN(r)||n===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(r,n)}return e}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:t,type:"outcome",value:null,interpolationTable:this.interpolationTable,matchTable:this.matchTable,externalScored:this.externalScored};e.value=t,(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};sn([p({type:String,attribute:"base-type"})],fe.prototype,"baseType",void 0);sn([p({type:String,attribute:"external-scored"})],fe.prototype,"externalScored",void 0);sn([p({type:String})],fe.prototype,"identifier",void 0);sn([p({type:String})],fe.prototype,"cardinality",void 0);sn([I({context:F,subscribe:!0}),R()],fe.prototype,"itemContext",void 0);var Io=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Pe=class extends zi{static{this.styles=[w`
157
+ `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let r of t.querySelectorAll("qti-interpolation-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=parseFloat(r.getAttribute("target-value"));if(Number.isNaN(i)||Number.isNaN(n)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:i,targetValue:n,includeBoundary:r.getAttribute("include-boundary")!=="false"})}return e}get matchTable(){let t=this.querySelector("qti-match-table");if(!t)return null;let e=new Map;for(let r of t.querySelectorAll("qti-match-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=r.getAttribute("target-value");if(Number.isNaN(i)||n===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(i,n)}return e}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:t,type:"outcome",value:null,interpolationTable:this.interpolationTable,matchTable:this.matchTable,externalScored:this.externalScored};e.value=t,(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};Wi([p({type:String,attribute:"base-type"})],he.prototype,"baseType",void 0);Wi([p({type:String,attribute:"external-scored"})],he.prototype,"externalScored",void 0);Wi([p({type:String})],he.prototype,"identifier",void 0);Wi([p({type:String})],he.prototype,"cardinality",void 0);Wi([R({context:j,subscribe:!0}),T()],he.prototype,"itemContext",void 0);var uo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ee=class extends Ir{static{this.styles=[w`
158
158
  :host {
159
159
  display: none;
160
160
  }
161
- `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:i}=this.#t(),r={baseType:this.baseType,identifier:this.identifier,correctResponse:e,...i?{fieldBaseTypes:i}:{},cardinality:this.cardinality||"single",mapping:this.#r,defaultValue:t,areaMapping:this.#n,value:null,type:"response",candidateResponse:null};r.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:r}}))}#t(){if(this.cardinality!=="record")return{correctResponse:this.#i};let t=this.querySelector("qti-correct-response");if(!t)return{correctResponse:void 0};let e=Array.from(t.querySelectorAll("qti-value")),{value:i,baseTypes:r}=Zr(e);return e.forEach(n=>n.remove()),{correctResponse:Object.keys(i).length?i:void 0,fieldBaseTypes:r}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=Zr(t);return Object.keys(e).length?e:null}get#i(){let t,e=this.querySelector("qti-correct-response");if(e){let i=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&i.length>0)t=i[0].textContent.trim(),i[0].remove();else if(this.cardinality!=="single"){t=[];for(let r=0;r<i.length;r++)t.push(i[r].textContent.trim()),i[r].remove()}}return t}get#r(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(i)?null:i,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(n=>({mapKey:n.getAttribute("map-key")||"",mappedValue:Number(n.getAttribute("mapped-value"))||0,caseSensitive:n.hasAttribute("case-sensitive")?n.getAttribute("case-sensitive")!=="false":!1}))}}get#n(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,i=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound")),n=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(i)?null:i,upperBound:isNaN(r)?null:r,areaMapEntries:n}}};Io([p({type:String,attribute:"base-type"})],Pe.prototype,"baseType",void 0);Io([p({type:String})],Pe.prototype,"identifier",void 0);Io([p({type:String})],Pe.prototype,"cardinality",void 0);Io([I({context:F,subscribe:!0}),R()],Pe.prototype,"itemContext",void 0);var ph=`<qti-response-condition>
161
+ `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:r}=this.#t(),i={baseType:this.baseType,identifier:this.identifier,correctResponse:e,...r?{fieldBaseTypes:r}:{},cardinality:this.cardinality||"single",mapping:this.#i,defaultValue:t,areaMapping:this.#n,value:null,type:"response",candidateResponse:null};i.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:i}}))}#t(){if(this.cardinality!=="record")return{correctResponse:this.#r};let t=this.querySelector("qti-correct-response");if(!t)return{correctResponse:void 0};let e=Array.from(t.querySelectorAll("qti-value")),{value:r,baseTypes:i}=ji(e);return e.forEach(n=>n.remove()),{correctResponse:Object.keys(r).length?r:void 0,fieldBaseTypes:i}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=ji(t);return Object.keys(e).length?e:null}get#r(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){t=[];for(let i=0;i<r.length;i++)t.push(r[i].textContent.trim()),r[i].remove()}}return t}get#i(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(r)?null:r,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(n=>({mapKey:n.getAttribute("map-key")||"",mappedValue:Number(n.getAttribute("mapped-value"))||0,caseSensitive:n.hasAttribute("case-sensitive")?n.getAttribute("case-sensitive")!=="false":!1}))}}get#n(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,r=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound")),n=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(r)?null:r,upperBound:isNaN(i)?null:i,areaMapEntries:n}}};uo([p({type:String,attribute:"base-type"})],Ee.prototype,"baseType",void 0);uo([p({type:String})],Ee.prototype,"identifier",void 0);uo([p({type:String})],Ee.prototype,"cardinality",void 0);uo([R({context:j,subscribe:!0}),T()],Ee.prototype,"itemContext",void 0);var Md=`<qti-response-condition>
162
162
  <qti-response-if>
163
163
  <qti-match>
164
164
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -173,7 +173,7 @@ Make sure to test your application with a production build as repeat registratio
173
173
  <qti-base-value base-type="float">0</qti-base-value>
174
174
  </qti-set-outcome-value>
175
175
  </qti-response-else>
176
- </qti-response-condition>`,uh=`<qti-response-condition>
176
+ </qti-response-condition>`,Pd=`<qti-response-condition>
177
177
  <qti-response-if>
178
178
  <qti-is-null>
179
179
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -187,7 +187,7 @@ Make sure to test your application with a production build as repeat registratio
187
187
  <qti-map-response identifier="RESPONSE"> </qti-map-response>
188
188
  </qti-set-outcome-value>
189
189
  </qti-response-else>
190
- </qti-response-condition>`,mh=`<qti-response-condition>
190
+ </qti-response-condition>`,Od=`<qti-response-condition>
191
191
  <qti-response-if>
192
192
  <qti-is-null>
193
193
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -201,27 +201,27 @@ Make sure to test your application with a production build as repeat registratio
201
201
  <qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
202
202
  </qti-set-outcome-value>
203
203
  </qti-response-else>
204
- </qti-response-condition>`;var Xm={map_response:uh,map_response_point:mh,match_correct:ph},To=class extends C{static{this.styles=[w`
204
+ </qti-response-condition>`;var cm={map_response:Pd,map_response_point:Od,match_correct:Md},mo=class extends S{static{this.styles=[w`
205
205
  :host {
206
206
  display: none;
207
207
  }
208
- `]}#t=new Xt(this,{context:F});#e;constructor(){super(),new dt(this,{context:F,subscribe:!0,callback:t=>{this.#e={...t,variables:t.variables.map(e=>({...e}))},this.#t.setValue(this.#e)}}),this.addEventListener("qti-set-outcome-value",t=>{t.stopImmediatePropagation();let e=this.#e?.variables.find(r=>r.identifier===t.detail.outcomeIdentifier);if(!e){console.warn(`Can not set qti-outcome-identifier: ${t.detail.outcomeIdentifier}, it is not available`);return}let{value:i}=t.detail;e.value=e.cardinality==="single"||Array.isArray(i)?i:[i]})}render(){return v`<slot></slot>`}processResponse({numAttempts:t}){let e=this.#e;if(!e)return;let i=this.closest("qti-assessment-item")?.getAttribute("adaptive")!=="true";for(let r of e.variables)r.identifier==="numAttempts"&&(r.value=String(t)),r.type==="outcome"&&i&&r.identifier!=="completionStatus"&&(r.value=Gm(r));this.#i(),kt(this,"qc-item-set-outcomes",{outcomes:e.variables.filter(r=>r.type==="outcome"||r.identifier==="numAttempts").map(({identifier:r,value:n})=>({identifier:r,value:n})),responseProcessed:!0})}#i(){let t=[...this.children];try{for(let e of t)e.process()}catch(e){if(!(e instanceof Bi))throw e}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let i=e.split("/").pop().replace(".xml",""),r=Xm[i];r&&(this.innerHTML=r)}};function Gm(o){let t=("defaultValue"in o?o.defaultValue:null)??null;return t===null&&(o.baseType==="integer"||o.baseType==="float")?"0":t}function N(o,t){let e={waitUntilFirstUpdate:!1,...t};return(i,r)=>{let{update:n}=i,s=Array.isArray(o)?o:[o];i.update=function(a){s.forEach(l=>{let c=l;if(a.has(c)){let d=a.get(c),h=this[c];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[r](d,h)}}),n.call(this,a)}}}var ir={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Lt=o=>(...t)=>({_$litDirective$:o,values:t}),Oe=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:Jm}=rt,fh=o=>o,bh=o=>o===null||typeof o!="object"&&typeof o!="function";var vh=o=>o.strings===void 0,gh=()=>document.createComment(""),rr=(o,t,e)=>{let i=o._$AA.parentNode,r=t===void 0?o._$AB:t._$AA;if(e===void 0){let n=i.insertBefore(gh(),r),s=i.insertBefore(gh(),r);e=new Jm(n,s,o,o.options)}else{let n=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==s._$AU&&e._$AP(l)}if(n!==r||a){let l=e._$AA;for(;l!==n;){let c=fh(l).nextSibling;fh(i).insertBefore(l,r),l=c}}}return e},De=(o,t,e=o)=>(o._$AI(t,e),o),Ym={},yh=(o,t=Ym)=>o._$AH=t,qh=o=>o._$AH,Mo=o=>{o._$AR(),o._$AA.remove()};var an=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let i of e)i._$AO?.(t,!1),an(i,t);return!0},Po=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},xh=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),tf(t)}};function Km(o){this._$AN!==void 0?(Po(this),this._$AM=o,xh(this)):this._$AM=o}function Zm(o,t=!1,e=0){let i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(i))for(let n=e;n<i.length;n++)an(i[n],!1),Po(i[n]);else i!=null&&(an(i,!1),Po(i));else an(this,o)}var tf=o=>{o.type==ir.CHILD&&(o._$AP??=Zm,o._$AQ??=Km)},$e=class extends Oe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),xh(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(an(this,t),Po(this))}setValue(t){if(vh(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Ol=class extends $e{constructor(){super(...arguments),this.prevData={}}render(t){return P}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},P}apply(t){let e=this.#t(t),{prevData:i,element:r}=this;for(let n in e){let s=e[n];s!==i[n]&&(s===!0?r.setAttribute(n,""):s===!1?r.removeAttribute(n):s!=null?r.setAttribute(n,String(s)):r.removeAttribute(n))}}groom(t){let{prevData:e,element:i}=this;if(!e)return;let r=t?this.#t(t):{};for(let n in e)(!r||!(n in r))&&i.removeAttribute(n)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,i])=>typeof i=="function"?!1:e==="max-choices"&&i===0?!0:!(i===""||i===null||i===void 0)))}},pC=Lt(Ol);var ln=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ge=class extends C{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!kt(this,"qc-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=w`
208
+ `]}#t=new Bt(this,{context:j});#e;constructor(){super(),new at(this,{context:j,subscribe:!0,callback:t=>{this.#e={...t,variables:t.variables.map(e=>({...e}))},this.#t.setValue(this.#e)}}),this.addEventListener("qti-set-outcome-value",t=>{t.stopImmediatePropagation();let e=this.#e?.variables.find(i=>i.identifier===t.detail.outcomeIdentifier);if(!e){console.warn(`Can not set qti-outcome-identifier: ${t.detail.outcomeIdentifier}, it is not available`);return}let{value:r}=t.detail;e.value=e.cardinality==="single"||Array.isArray(r)?r:[r]})}render(){return v`<slot></slot>`}processResponse({numAttempts:t}){let e=this.#e;if(!e)return;let r=this.closest("qti-assessment-item")?.getAttribute("adaptive")!=="true";for(let i of e.variables)i.identifier==="numAttempts"&&(i.value=String(t)),i.type==="outcome"&&r&&i.identifier!=="completionStatus"&&(i.value=lm(i));this.#r(),xt(this,"qc-item-set-outcomes",{outcomes:e.variables.filter(i=>i.type==="outcome"||i.identifier==="numAttempts").map(({identifier:i,value:n})=>({identifier:i,value:n})),responseProcessed:!0})}#r(){let t=[...this.children];try{for(let e of t)e.process()}catch(e){if(!(e instanceof Mr))throw e}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let r=e.split("/").pop().replace(".xml",""),i=cm[r];i&&(this.innerHTML=i)}};function lm(o){let t=("defaultValue"in o?o.defaultValue:null)??null;return t===null&&(o.baseType==="integer"||o.baseType==="float")?"0":t}function N(o,t){let e={waitUntilFirstUpdate:!1,...t};return(r,i)=>{let{update:n}=r,s=Array.isArray(o)?o:[o];r.update=function(a){s.forEach(c=>{let l=c;if(a.has(l)){let d=a.get(l),h=this[l];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,h)}}),n.call(this,a)}}}var Hr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ot=o=>(...t)=>({_$litDirective$:o,values:t}),Ae=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:dm}=et,Dd=o=>o,Nd=o=>o===null||typeof o!="object"&&typeof o!="function";var Ld=o=>o.strings===void 0,$d=()=>document.createComment(""),Wr=(o,t,e)=>{let r=o._$AA.parentNode,i=t===void 0?o._$AB:t._$AA;if(e===void 0){let n=r.insertBefore($d(),i),s=r.insertBefore($d(),i);e=new dm(n,s,o,o.options)}else{let n=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let c;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(c=o._$AU)!==s._$AU&&e._$AP(c)}if(n!==i||a){let c=e._$AA;for(;c!==n;){let l=Dd(c).nextSibling;Dd(r).insertBefore(c,i),c=l}}}return e},_e=(o,t,e=o)=>(o._$AI(t,e),o),hm={},Vd=(o,t=hm)=>o._$AH=t,jd=o=>o._$AH,fo=o=>{o._$AR(),o._$AA.remove()};var Qi=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),Qi(r,t);return!0},go=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},Fd=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),mm(t)}};function pm(o){this._$AN!==void 0?(go(this),this._$AM=o,Fd(this)):this._$AM=o}function um(o,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let n=e;n<r.length;n++)Qi(r[n],!1),go(r[n]);else r!=null&&(Qi(r,!1),go(r));else Qi(this,o)}var mm=o=>{o.type==Hr.CHILD&&(o._$AP??=um,o._$AQ??=pm)},Te=class extends Ae{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Fd(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Qi(this,t),go(this))}setValue(t){if(Ld(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ac=class extends Te{constructor(){super(...arguments),this.prevData={}}render(t){return P}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},P}apply(t){let e=this.#t(t),{prevData:r,element:i}=this;for(let n in e){let s=e[n];s!==r[n]&&(s===!0?i.setAttribute(n,""):s===!1?i.removeAttribute(n):s!=null?i.setAttribute(n,String(s)):i.removeAttribute(n))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let i=t?this.#t(t):{};for(let n in e)(!i||!(n in i))&&r.removeAttribute(n)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>typeof r=="function"?!1:e==="max-choices"&&r===0?!0:!(r===""||r===null||r===void 0)))}},x0=Ot(ac);var Xi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pe=class extends S{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!xt(this,"qc-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=w`
209
209
  :host {
210
210
  display: block;
211
211
  }
212
- `}render(){return v`<slot></slot>`}};ln([p({type:String})],ge.prototype,"id",void 0);ln([p({type:String})],ge.prototype,"use",void 0);ln([p({type:String})],ge.prototype,"view",void 0);ln([p({type:String,attribute:"class"})],ge.prototype,"classNames",void 0);ln([N("classNames",{waitUntilFirstUpdate:!0})],ge.prototype,"handleclassNamesChange",null);var Oo=class extends C{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(i=>i.text()).then(i=>{let r=this.#e(i);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${r}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}).catch(i=>{console.error("Failed to load stylesheet:",i)}),this.textContent!==null&&this.textContent.trim()!==""){let i=this.#e(this.textContent);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}}#e(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.#t)try{this.#t.remove()}catch(t){console.error("Could not remove stylesheet:",t)}super.disconnectedCallback()}};var Do=class extends C{render(){return v`<slot></slot>`}calculate(){let t=[...this.children];if(t.length!==1)return console.error("qti-template-constraint must have exactly one child expression"),!0;try{return!!t[0].calculate()}catch(e){return console.error("Error evaluating template constraint:",e),!0}}getSubRules(){return[]}process(){let t=this.calculate();return t||console.debug("Template constraint not satisfied, restarting template processing"),t}};var cn=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},be=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[w`
212
+ `}render(){return v`<slot></slot>`}};Xi([p({type:String})],pe.prototype,"id",void 0);Xi([p({type:String})],pe.prototype,"use",void 0);Xi([p({type:String})],pe.prototype,"view",void 0);Xi([p({type:String,attribute:"class"})],pe.prototype,"classNames",void 0);Xi([N("classNames",{waitUntilFirstUpdate:!0})],pe.prototype,"handleclassNamesChange",null);var bo=class extends S{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(r=>r.text()).then(r=>{let i=this.#e(r);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}).catch(r=>{console.error("Failed to load stylesheet:",r)}),this.textContent!==null&&this.textContent.trim()!==""){let r=this.#e(this.textContent);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${r}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}}#e(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.#t)try{this.#t.remove()}catch(t){console.error("Could not remove stylesheet:",t)}super.disconnectedCallback()}};var vo=class extends S{render(){return v`<slot></slot>`}calculate(){let t=[...this.children];if(t.length!==1)return console.error("qti-template-constraint must have exactly one child expression"),!0;try{return!!t[0].calculate()}catch(e){return console.error("Error evaluating template constraint:",e),!0}}getSubRules(){return[]}process(){let t=this.calculate();return t||console.debug("Template constraint not satisfied, restarting template processing"),t}};var Gi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ue=class extends S{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[w`
213
213
  :host {
214
214
  display: none;
215
215
  }
216
- `]}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#r()})}#e(){let t=this.querySelector("qti-default-value");if(!t)return;let e=t.textContent?.trim()||"";this.#t=this.#i(e)}#i(t){if(!t)return null;switch(this.baseType){case"integer":return parseInt(t,10);case"float":case"duration":return parseFloat(t);case"boolean":return t.toLowerCase()==="true";default:return t}}#r(){let e={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:this.#t,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:this.#t?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};cn([p({type:String})],be.prototype,"identifier",void 0);cn([p({type:String})],be.prototype,"cardinality",void 0);cn([p({type:String,attribute:"base-type"})],be.prototype,"baseType",void 0);cn([p({type:Boolean,attribute:"math-variable"})],be.prototype,"mathVariable",void 0);cn([p({type:Boolean,attribute:"param-variable"})],be.prototype,"paramVariable",void 0);var $o=class extends C{static{this.styles=[w`
216
+ `]}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#i()})}#e(){let t=this.querySelector("qti-default-value");if(!t)return;let e=t.textContent?.trim()||"";this.#t=this.#r(e)}#r(t){if(!t)return null;switch(this.baseType){case"integer":return parseInt(t,10);case"float":case"duration":return parseFloat(t);case"boolean":return t.toLowerCase()==="true";default:return t}}#i(){let e={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:this.#t,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:this.#t?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};Gi([p({type:String})],ue.prototype,"identifier",void 0);Gi([p({type:String})],ue.prototype,"cardinality",void 0);Gi([p({type:String,attribute:"base-type"})],ue.prototype,"baseType",void 0);Gi([p({type:Boolean,attribute:"math-variable"})],ue.prototype,"mathVariable",void 0);Gi([p({type:Boolean,attribute:"param-variable"})],ue.prototype,"paramVariable",void 0);var yo=class extends S{static{this.styles=[w`
217
217
  :host {
218
218
  display: none;
219
219
  }
220
- `]}#t=100;render(){return v`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,i=!1;do{if(i=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let r=[...this.children];for(let n of r)if(n.tagName.toLowerCase()==="qti-template-constraint"){if(n.calculate()===!1){i=!0;break}}else n.process()}catch(r){console.error("Error during template processing:",r);break}}while(i);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var wh=[{tag:"qti-assessment-item",ctor:gt},{tag:"qti-assessment-stimulus",ctor:xo},{tag:"qti-assessment-stimulus-ref",ctor:Zi},{tag:"qti-companion-materials-info",ctor:Eo},{tag:"qti-content-body",ctor:nn},{tag:"qti-context-declaration",ctor:tr},{tag:"qti-custom-operator",ctor:on},{tag:"qti-feedback-block",ctor:Ao},{tag:"qti-feedback-inline",ctor:_o},{tag:"qti-item-body",ctor:Ro},{tag:"qti-modal-feedback",ctor:er},{tag:"qti-outcome-declaration",ctor:fe},{tag:"qti-response-declaration",ctor:Pe},{tag:"qti-response-processing",ctor:To},{tag:"qti-rubric-block",ctor:ge},{tag:"qti-stylesheet",ctor:Oo},{tag:"qti-template-constraint",ctor:Do},{tag:"qti-template-declaration",ctor:be},{tag:"qti-template-processing",ctor:$o}];var ef=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},dn=class extends er{constructor(){super(...arguments),this.access="atEnd"}static{this.styles=w`
220
+ `]}#t=100;render(){return v`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,r=!1;do{if(r=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let i=[...this.children];for(let n of i)if(n.tagName.toLowerCase()==="qti-template-constraint"){if(n.calculate()===!1){r=!0;break}}else n.process()}catch(i){console.error("Error during template processing:",i);break}}while(r);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var zd=[{tag:"qti-assessment-item",ctor:ut},{tag:"qti-assessment-stimulus",ctor:io},{tag:"qti-assessment-stimulus-ref",ctor:zr},{tag:"qti-companion-materials-info",ctor:co},{tag:"qti-content-body",ctor:Ui},{tag:"qti-context-declaration",ctor:Br},{tag:"qti-custom-operator",ctor:Hi},{tag:"qti-feedback-block",ctor:lo},{tag:"qti-feedback-inline",ctor:ho},{tag:"qti-item-body",ctor:po},{tag:"qti-modal-feedback",ctor:Ur},{tag:"qti-outcome-declaration",ctor:he},{tag:"qti-response-declaration",ctor:Ee},{tag:"qti-response-processing",ctor:mo},{tag:"qti-rubric-block",ctor:pe},{tag:"qti-stylesheet",ctor:bo},{tag:"qti-template-constraint",ctor:vo},{tag:"qti-template-declaration",ctor:ue},{tag:"qti-template-processing",ctor:yo}];var fm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ji=class extends Ur{constructor(){super(...arguments),this.access="atEnd"}static{this.styles=w`
221
221
  :host {
222
222
  color: gray;
223
223
  }
224
- `}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return v``}};ef([p({type:String})],dn.prototype,"access",void 0);var No=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ne=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return v` <slot></slot>`}};No([p({type:String})],Ne.prototype,"identifier",void 0);No([p({type:String})],Ne.prototype,"class",void 0);No([p({type:String,attribute:"navigation-mode"})],Ne.prototype,"navigationMode",void 0);No([p({type:String,attribute:"submission-mode"})],Ne.prototype,"submissionMode",void 0);var rf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},hn=class extends E{#t=null;constructor(){super(),U(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",i=this.getAttribute("variable-identifier"),r=Qi(t,Wi(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new Dl(this._testContext,i,r).calculate()}calculate(){return this.getResult()}};rf([I({context:st,subscribe:!0})],hn.prototype,"_testContext",void 0);var Dl=class{constructor(t,e,i){this.testContext=t,this.itemVariable=e,this.includedItems=i}calculate(){let t=this.testContext?.items??[],e=0,i=[...new Set(this.includedItems.map(r=>r.item))];return t.forEach(r=>{if(i.includes(r.identifier)){let n=r.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===r.identifier)?.weight??1;if(n){let a=Number(n.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var pn="qti-assessment-section",Lo="qti-test-part",Vt=o=>o.identifier||o.getAttribute("identifier")||"";function Ch(o,t){let e=o[t],i=t+1,r=nf(e,o,t);if(r){let s=of(r,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map(Vt)};s>t?i=s:console.warn(`qti-branch-rule target "${r.target}" is not ahead of "${Vt(e)}", ignored`)}let n=o.slice(t+1,i).map(Vt);for(let s=i;s<o.length;s++){if(Sh(o[s],e))return{id:Vt(o[s]),skipped:n};n.push(Vt(o[s]))}return{id:null,skipped:n}}function kh(o){let t=[];for(let e of o){if(Sh(e,null))return{id:Vt(e),skipped:t};t.push(Vt(e))}return{id:null,skipped:t}}function nf(o,t,e){let i=[o];for(let r=o.parentElement;r&&(r.localName===pn||r.localName===Lo)&&!r.contains(t[e+1]??null);r=r.parentElement)i.push(r);for(let r of i)for(let n of r.querySelectorAll(":scope > qti-branch-rule"))if(n.evaluate?.())return n;return null}function of(o,t,e){let i=o.parentElement,r=n=>{if(!n)return null;let s=t.findLastIndex(a=>n.contains(a));return s+1<t.length?s+1:null};switch(o.target){case ue.EXIT_TEST:return null;case ue.EXIT_TESTPART:return r(i.closest(Lo));case ue.EXIT_SECTION:{let n=i.localName===pn?i:i.closest(pn);return r(n??i)}default:{let n=t.findIndex(l=>Vt(l)===o.target);if(n>=0)return n;let s=[...i.closest("qti-assessment-test")?.querySelectorAll(`${pn}, ${Lo}`)??[]].find(l=>l.getAttribute("identifier")===o.target),a=s?t.findIndex(l=>s.contains(l)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function Sh(o,t){let e=[o];for(let i=o.parentElement;i&&(i.localName===pn||i.localName===Lo);i=i.parentElement)(!t||!i.contains(t))&&e.push(i);return e.every(i=>[...i.querySelectorAll(":scope > qti-pre-condition")].every(r=>r.evaluate?.()??!0))}var Vo=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Eh=o=>{class t extends o{constructor(...i){super(...i),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(i,r){let n=r||this._getDefaultNavigationId(i);n&&L(this,"qc-test-navigate",{type:i,id:n})}_bindEventHandlers(){U(this,"qc-test-navigate",this._handleNavigationRequest.bind(this)),U(this,"qc-test-loaded",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(i){this._testElement=i.detail,this._initializeNavigation()}_handleItemConnected(i){let r=i.detail;this._loadingState.connectedItems++;let n=r.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(i){i.preventDefault();let{element:r,item:n}=i;if(console.info("Stimulus ref connected:",{identifier:r.identifier,href:r.href,item:n.identifier}),this._loadedStimulusHrefs.has(r.href)){console.info("Stimulus already loaded, skipping:",r.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(r.href)){console.info("Stimulus already loading, skipping duplicate:",r.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(r.href),console.info("Starting stimulus load:",r.href);try{await this._loadStimulusRef(r,n),this._loadedStimulusHrefs.add(r.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",r.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${r.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(r.href)}}_getDefaultNavigationId(i){return i==="section"?this.sessionContext?.navSectionId??this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let i=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let r=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(r[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let n=kh(r);if(n.skipped.length&&L(this,"qc-test-items-skipped",{ids:n.skipped}),n.id===null){L(this,"qc-test-end-reached",{});return}i=n.id}}i&&this.navigateTo(this.navigate,i)}_isLinearNavigationRestricted(i,r){let n=this.sessionContext?.navItemRefId;if(!n||i==="item"&&r===n)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),l=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||l?.navigationMode||l?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===n);if(i==="item"){let f=d.findIndex(m=>m.identifier===r);return f===-1||h===-1?!1:f!==h+1}return!0}_resolveLinearNext(i,r){if(i!=="item"||!this._testElement)return;let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=n.findIndex(l=>Vt(l)===this.sessionContext?.navItemRefId);if(s<0||!n[s+1]||Vt(n[s+1])!==r||n[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=Ch(n,s);if(a.id!==r)return a}async _handleNavigationRequest({detail:i}){if(!i?.id)return;let r=this._resolveLinearNext(i.type,i.id);if(r?.id===null){r.skipped.length&&L(this,"qc-test-items-skipped",{ids:r.skipped}),L(this,"qc-test-end-reached",{});return}let n=r?.id??i.id;if(!r&&this._isLinearNavigationRestricted(i.type,n)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),i.type,i.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(i.type,n),this._activeController=a,await this._executeNavigation(i.type,n,s,a),r?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&L(this,"qc-test-items-skipped",{ids:r.skipped})}catch(l){this._handleNavigationError(l,i.type,n)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(i.type,n)}}_handleNavigationError(i,r,n){i.name!=="AbortError"&&this._dispatchError(this._createNavigationError(i,r,n))}async _executeNavigation(i,r,n,s){i==="item"?await this._navigateToItem(r,n,s):await this._navigateToSection(r,n,s)}async _navigateToItem(i,r,n){let s=this._findItemRef(i);this._updateSessionContext(s,i),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([i],r,n),await this._waitForLoadingComplete(r,n),!this._isStaleNavigation(r,n)&&this._dispatchTestLoaded(this._loadResults,"item",i)}async _navigateToSection(i,r,n){let a=this._findSection(i)?.closest("qti-test-part")?.identifier,l=this._getSectionItemIds(i);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:i,navItemRefId:this.navigate==="item"?l[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,r,n),await this._waitForLoadingComplete(r,n),!this._isStaleNavigation(r,n)&&this._dispatchTestLoaded(this._loadResults,"section",i)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let i=this._loadingState.connectedItems>=this._loadingState.expectedItems,r=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;i&&r&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(i,r){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(i,r))return;await new Promise(n=>setTimeout(n,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(i,r){console.info("Loading stimulus:",i.href);let n=await this._loadStimulus(i.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,i,r)}_applyStimulusContent(i,r,n){if(!i){console.warn("No stimulus content to apply");return}let s=i.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],l=n.querySelector(`[data-stimulus-idref="${r.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${r.identifier}"]`));if(c.length>0)a=c,console.info("Found targets by identifier:",c.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((c,d)=>{c.innerHTML="",c.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(i,r,n){if(!this._testElement||i.length===0)return;let s=i.map(c=>this._findItemRef(c));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(c=>this._loadSingleItem(c,r,n)))).filter(Boolean);this._isStaleNavigation(r,n)||(l.forEach(({itemRef:c,doc:d})=>{c&&d&&(c.xmlDoc=d)}),l.forEach(({itemRef:c})=>{let d=c?.identifier;if(!c||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&c.updateComplete.then(()=>{let f=c.assessmentItem;f&&(f.state=h)})}),this._loadResults=l)}async _loadSingleItem(i,r,n){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Zt().load(i.href,n.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,i)),this._isStaleNavigation(r,n)?null:{itemRef:i,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${i.identifier} was aborted`),s;return console.warn(`Failed to load item ${i.identifier}:`,s),null}}async _loadStimulus(i){return(await Zt().load(i,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let i=this.querySelector("test-container");if(i)return i.customElementRegistry??void 0}_findItemRef(i){let r=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!r)throw new Error(`Item with identifier "${i}" not found`);return r}_findSection(i){return this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`)||null}_updateSessionContext(i,r){let n=i.closest("qti-test-part")?.identifier,s=i.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:s,navItemRefId:r}}_getSectionItemIds(i){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(r=>r.identifier).filter(Boolean)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(i||[]).forEach(r=>{r.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(i=>i.innerHTML="")}_isStaleNavigation(i,r){return r.signal.aborted||i!==this._navigationId}_createNavigationError(i,r,n){return{message:i.message||`Failed to load ${r}: ${n}`,details:i,itemId:r==="item"?n:void 0,sectionId:r==="section"?n:void 0}}_dispatchLoadingStarted(i,r){L(this,"qc-test-navigation-started",{type:i,id:r})}_dispatchLoadingEnded(i,r){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:i,id:r},bubbles:!0,composed:!0}))}_dispatchError(i){L(this,"qc-test-navigation-failed",i)}_dispatchTestLoaded(i,r,n){requestAnimationFrame(()=>{L(this,"qc-test-rendered",i.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),L(this,"qc-test-navigated",{type:r,id:n})})}}return Vo([p({type:String})],t.prototype,"navigate",void 0),Vo([p({type:Number})],t.prototype,"requestTimeout",void 0),Vo([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),Vo([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var Ah=o=>{class t extends o{constructor(...i){super(...i),this.sessionContext={...this.sessionContext,view:"candidate"},U(this,"qc-test-switch-view",r=>{this.sessionContext={...this.sessionContext,view:r.detail},this._updateElementView()}),U(this,"qc-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",r=>{this._updateElementView(),this._setCorrectResponseVisibility(r.detail)})}willUpdate(i){super.willUpdate(i),i.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let n=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;n&&this.updateAssessmentItemView(n,this.sessionContext.view)}}_setCorrectResponseVisibility(i){this.updateAssessmentItemView(i,this.sessionContext.view)}updateAssessmentItemView(i,r){}}return t};var _h=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},$l=o=>{class t extends o{constructor(...i){super(...i),this.testContext=bl,this.sessionContext=gl,this._updateItemInTestContext=r=>{let n=r.itemContext,s=n.identifier,a=n.variables,l=this.testContext.items.find(c=>c?.identifier===s);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,n.valid);else{let c=[...r.variables];for(let d of l.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}r.variables=c,this.#t(s,c.find(d=>d.identifier==="completionStatus")?.value),l.state&&(r.state=l.state)}},this._initializeEventListeners()}updateItemVariables(i,r,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==i)return a;let l=[...a.variables??[]];for(let{identifier:c,type:d,value:h}of r){let f=l.findIndex(y=>y.identifier===c),m={...f>=0?l[f]:{},identifier:c,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?l[f]=m:l.push(m)}return{...a,variables:l,...n?{state:{...n}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(i)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===i)?.variables??[]],n&&(s.state=n))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=bl,this.sessionContext=gl}),U(this,"qc-test-loaded",i=>{this._testElement=i.detail;let r=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(n=>({href:n.href,identifier:n.identifier,category:n.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:r}}),this.addEventListener("qti-assessment-item-connected",i=>{let r=i.detail,n=r.closest("qti-assessment-item-ref")?.identifier;n&&(r.assessmentItemRefId=n),this._updateItemInTestContext(i.detail)}),this.addEventListener("qti-item-context-updated",i=>{this._updateItemVariablesInTestContext(i.detail.itemContext.identifier,i.detail.itemContext.variables,i.detail.itemContext.state,i.detail.itemContext.valid)})}_updateItemVariablesInTestContext(i,r,n,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==i?a:{...a,variables:r.map(l=>{let c=a.variables.find(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...n!==void 0?{state:n?{...n}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(i,r){typeof r!="string"||r==="not_attempted"||this.testContext.items.find(a=>a.identifier===i)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==i?a:{...a,variables:a.variables.map(l=>l.identifier==="completionStatus"?{...l,value:r}:l)})})}}return _h([p({attribute:!1,type:Object}),X({context:st})],t.prototype,"testContext",void 0),_h([p({attribute:!1,type:Object}),X({context:Re})],t.prototype,"sessionContext",void 0),t},Rh=class extends $l(C){};var jo=1;var Nl=o=>Array.isArray(o)?[...o]:o??null,sf=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},af=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(i=>({identifier:i.identifier,...i.type?{type:i.type}:{},value:Nl(i.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:Nl(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),Ih=o=>{class t extends o{#t=null;#e=!1;#i=null;constructor(...i){super(...i),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#i=null}),U(this,"qc-test-update-plugin-state",({detail:r})=>this.#r(r)),U(this,"qc-test-loaded",()=>{this.#t&&(this.#n(this.#t),this.#t=null),this.#e=!0})}#r({plugin:i,value:r}){if(typeof i!="string"||i==="")return;let{[i]:n,...s}=this.sessionContext.plugins??{},a=s;if(r!=null)try{a={...s,[i]:JSON.parse(JSON.stringify(r))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${i}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return af(this.testContext,this.sessionContext)}set state(i){if(!sf(i)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=i;return}let{navItemRefId:r,navSectionId:n}=this.sessionContext;this.#n(i);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==r?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==n&&this.#s("section",s.navSectionId)}updated(i){if(super.updated(i),!this.#e||!(i.has("testContext")||i.has("sessionContext")))return;let r=this.state,n=JSON.stringify(r);n!==this.#i&&(this.#i=n,L(this,"qc-test-state-changed",r))}#n(i){for(let n of i.test.items)this.updateItemVariables(n.identifier,n.variables,n.state);let r=new Map(i.test.outcomes.map(n=>[n.identifier,n.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>r.has(n.identifier)?{...n,value:Nl(r.get(n.identifier))}:n)},this.sessionContext={...this.sessionContext,...this.#o(i.session),plugins:i.session.plugins&&typeof i.session.plugins=="object"?{...i.session.plugins}:{}}}#o(i){let r=(n,s)=>!!s&&!!this._testElement?.querySelector(`${n}[identifier="${CSS.escape(s)}"]`);return{...r("qti-test-part",i.navPartId)?{navPartId:i.navPartId}:{},...r("qti-assessment-section",i.navSectionId)?{navSectionId:i.navSectionId}:{},...this.testContext.items.some(n=>n.identifier===i.navItemRefId)?{navItemRefId:i.navItemRefId}:{}}}#s(i,r){L(this,"qc-test-navigate",{type:i,id:r})}}return t};var Th=o=>{class t extends o{constructor(...i){super(...i),this.addEventListener("qti-register-variable",r=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],r.detail.variable]},r.stopPropagation()}),U(this,"qc-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",r=>{let{outcomeIdentifier:n,value:s}=r.detail;this.updateOutcomeVariable(n,s),r.stopPropagation()})}outcomeProcessing(){let i=(this._testElement??this).querySelector("qti-outcome-processing");return i?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(r=>({...r,value:r.defaultValue??null}))},i.process(),!0):!1}submit(){return this.outcomeProcessing()?(L(this,"qc-test-submitted",{}),!0):!1}getTestFeedback(i){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(n=>(!i||n.access===i)&&n.matches(this.getOutcome(n.outcomeIdentifier)?.value))}updateOutcomeVariable(i,r){let n=this.getOutcome(i);if(!n){console.warn(`Can not set qti-outcome-identifier: ${i}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==i?s:{...s,value:n.cardinality==="single"?r:[...s.value,r]})}}getOutcome(i){return this.getVariable(i)}getVariable(i){return this.testContext.testOutcomeVariables?.find(r=>r.identifier===i)||null}}return t};var Mh=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Le=class extends Eh(Ah(Th(Ih($l(C))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Xt(this,{context:Ie,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};Mh([R(),X({context:wt})],Le.prototype,"configContext",void 0);Mh([R(),X({context:Ct})],Le.prototype,"qtiContext",void 0);var Fo=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},zo=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var Ph=o=>!bh(o)&&typeof o.then=="function",Oh=1073741823,Ll=class extends $e{constructor(){super(...arguments),this._$Cwt=Oh,this._$Cbt=[],this._$CK=new Fo(this),this._$CX=new zo}render(...t){return t.find(e=>!Ph(e))??ot}update(t,e){let i=this._$Cbt,r=i.length;this._$Cbt=e;let n=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!Ph(l))return this._$Cwt=a,l;a<r&&l===i[a]||(this._$Cwt=Oh,r=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=n.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return ot}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Bo=Lt(Ll);var Uo=`
224
+ `}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return v``}};fm([p({type:String})],Ji.prototype,"access",void 0);var qo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Re=class extends S{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return v` <slot></slot>`}};qo([p({type:String})],Re.prototype,"identifier",void 0);qo([p({type:String})],Re.prototype,"class",void 0);qo([p({type:String,attribute:"navigation-mode"})],Re.prototype,"navigationMode",void 0);qo([p({type:String,attribute:"submission-mode"})],Re.prototype,"submissionMode",void 0);var gm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Yi=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",r=this.getAttribute("variable-identifier"),i=$r(t,Dr(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new cc(this._testContext,r,i).calculate()}calculate(){return this.getResult()}};gm([R({context:nt,subscribe:!0})],Yi.prototype,"_testContext",void 0);var cc=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let t=this.testContext?.items??[],e=0,r=[...new Set(this.includedItems.map(i=>i.item))];return t.forEach(i=>{if(r.includes(i.identifier)){let n=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;if(n){let a=Number(n.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var Ki="qti-assessment-section",xo="qti-test-part",Dt=o=>o.identifier||o.getAttribute("identifier")||"";function Bd(o,t){let e=o[t],r=t+1,i=bm(e,o,t);if(i){let s=vm(i,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map(Dt)};s>t?r=s:console.warn(`qti-branch-rule target "${i.target}" is not ahead of "${Dt(e)}", ignored`)}let n=o.slice(t+1,r).map(Dt);for(let s=r;s<o.length;s++){if(Hd(o[s],e))return{id:Dt(o[s]),skipped:n};n.push(Dt(o[s]))}return{id:null,skipped:n}}function Ud(o){let t=[];for(let e of o){if(Hd(e,null))return{id:Dt(e),skipped:t};t.push(Dt(e))}return{id:null,skipped:t}}function bm(o,t,e){let r=[o];for(let i=o.parentElement;i&&(i.localName===Ki||i.localName===xo)&&!i.contains(t[e+1]??null);i=i.parentElement)r.push(i);for(let i of r)for(let n of i.querySelectorAll(":scope > qti-branch-rule"))if(n.evaluate?.())return n;return null}function vm(o,t,e){let r=o.parentElement,i=n=>{if(!n)return null;let s=t.findLastIndex(a=>n.contains(a));return s+1<t.length?s+1:null};switch(o.target){case le.EXIT_TEST:return null;case le.EXIT_TESTPART:return i(r.closest(xo));case le.EXIT_SECTION:{let n=r.localName===Ki?r:r.closest(Ki);return i(n??r)}default:{let n=t.findIndex(c=>Dt(c)===o.target);if(n>=0)return n;let s=[...r.closest("qti-assessment-test")?.querySelectorAll(`${Ki}, ${xo}`)??[]].find(c=>c.getAttribute("identifier")===o.target),a=s?t.findIndex(c=>s.contains(c)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function Hd(o,t){let e=[o];for(let r=o.parentElement;r&&(r.localName===Ki||r.localName===xo);r=r.parentElement)(!t||!r.contains(t))&&e.push(r);return e.every(r=>[...r.querySelectorAll(":scope > qti-pre-condition")].every(i=>i.evaluate?.()??!0))}var wo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Wd=o=>{class t extends o{constructor(...r){super(...r),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(r,i){let n=i||this._getDefaultNavigationId(r);n&&F(this,"qc-test-navigate",{type:r,id:n})}_bindEventHandlers(){B(this,"qc-test-navigate",this._handleNavigationRequest.bind(this)),B(this,"qc-test-loaded",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(r){this._testElement=r.detail,this._initializeNavigation()}_handleItemConnected(r){let i=r.detail;this._loadingState.connectedItems++;let n=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:n}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:n.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,n),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.href)}}_getDefaultNavigationId(r){return r==="section"?this.sessionContext?.navSectionId??this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let r=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(i[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let n=Ud(i);if(n.skipped.length&&F(this,"qc-test-items-skipped",{ids:n.skipped}),n.id===null){F(this,"qc-test-end-reached",{});return}r=n.id}}r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,i){let n=this.sessionContext?.navItemRefId;if(!n||r==="item"&&i===n)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),c=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||c?.navigationMode||c?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===n);if(r==="item"){let f=d.findIndex(m=>m.identifier===i);return f===-1||h===-1?!1:f!==h+1}return!0}_resolveLinearNext(r,i){if(r!=="item"||!this._testElement)return;let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=n.findIndex(c=>Dt(c)===this.sessionContext?.navItemRefId);if(s<0||!n[s+1]||Dt(n[s+1])!==i||n[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=Bd(n,s);if(a.id!==i)return a}async _handleNavigationRequest({detail:r}){if(!r?.id)return;let i=this._resolveLinearNext(r.type,r.id);if(i?.id===null){i.skipped.length&&F(this,"qc-test-items-skipped",{ids:i.skipped}),F(this,"qc-test-end-reached",{});return}let n=i?.id??r.id;if(!i&&this._isLinearNavigationRestricted(r.type,n)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(r.type,n),this._activeController=a,await this._executeNavigation(r.type,n,s,a),i?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&F(this,"qc-test-items-skipped",{ids:i.skipped})}catch(c){this._handleNavigationError(c,r.type,n)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(r.type,n)}}_handleNavigationError(r,i,n){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,n))}async _executeNavigation(r,i,n,s){r==="item"?await this._navigateToItem(i,n,s):await this._navigateToSection(i,n,s)}async _navigateToItem(r,i,n){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"item",r)}async _navigateToSection(r,i,n){let a=this._findSection(r)?.closest("qti-test-part")?.identifier,c=this._getSectionItemIds(r);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:this.navigate==="item"?c[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=c.length,await this._loadItems(c,i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"section",r)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let r=this._loadingState.connectedItems>=this._loadingState.expectedItems,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,i))return;await new Promise(n=>setTimeout(n,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let n=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,r,i)}_applyStimulusContent(r,i,n){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],c=n.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(c)a.push(c),console.info("Found specific target:",c);else{let l=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.identifier}"]`));if(l.length>0)a=l,console.info("Found targets by identifier:",l.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((l,d)=>{l.innerHTML="",l.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,i,n){if(!this._testElement||r.length===0)return;let s=r.map(l=>this._findItemRef(l));this._clearLoadedItems(),this._clearStimulusRef();let c=(await Promise.all(s.map(l=>this._loadSingleItem(l,i,n)))).filter(Boolean);this._isStaleNavigation(i,n)||(c.forEach(({itemRef:l,doc:d})=>{l&&d&&(l.xmlDoc=d)}),c.forEach(({itemRef:l})=>{let d=l?.identifier;if(!l||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&l.updateComplete.then(()=>{let f=l.assessmentItem;f&&(f.state=h)})}),this._loadResults=c)}async _loadSingleItem(r,i,n){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Gt().load(r.href,n.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,n)?null:{itemRef:r,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${r.identifier} was aborted`),s;return console.warn(`Failed to load item ${r.identifier}:`,s),null}}async _loadStimulus(r){return(await Gt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!i)throw new Error(`Item with identifier "${r}" not found`);return i}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,i){let n=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:s,navItemRefId:i}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,i){return i.signal.aborted||r!==this._navigationId}_createNavigationError(r,i,n){return{message:r.message||`Failed to load ${i}: ${n}`,details:r,itemId:i==="item"?n:void 0,sectionId:i==="section"?n:void 0}}_dispatchLoadingStarted(r,i){F(this,"qc-test-navigation-started",{type:r,id:i})}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchError(r){F(this,"qc-test-navigation-failed",r)}_dispatchTestLoaded(r,i,n){requestAnimationFrame(()=>{F(this,"qc-test-rendered",r.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),F(this,"qc-test-navigated",{type:i,id:n})})}}return wo([p({type:String})],t.prototype,"navigate",void 0),wo([p({type:Number})],t.prototype,"requestTimeout",void 0),wo([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),wo([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var Qd=o=>{class t extends o{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},B(this,"qc-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),B(this,"qc-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(r){super.willUpdate(r),r.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let n=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;n&&this.updateAssessmentItemView(n,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return t};var Xd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lc=o=>{class t extends o{constructor(...r){super(...r),this.testContext=Ua,this.sessionContext=Ba,this._updateItemInTestContext=i=>{let n=i.itemContext,s=n.identifier,a=n.variables,c=this.testContext.items.find(l=>l?.identifier===s);if(!c){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(c.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,n.valid);else{let l=[...i.variables];for(let d of c.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=l.find(f=>f.identifier===d.identifier);h?h.value=d.value:l.push(d)}i.variables=l,this.#t(s,l.find(d=>d.identifier==="completionStatus")?.value),c.state&&(i.state=c.state)}},this._initializeEventListeners()}updateItemVariables(r,i,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==r)return a;let c=[...a.variables??[]];for(let{identifier:l,type:d,value:h}of i){let f=c.findIndex(y=>y.identifier===l),m={...f>=0?c[f]:{},identifier:l,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?c[f]=m:c.push(m)}return{...a,variables:c,...n?{state:{...n}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(r)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===r)?.variables??[]],n&&(s.state=n))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=Ua,this.sessionContext=Ba}),B(this,"qc-test-loaded",r=>{this._testElement=r.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(n=>({href:n.href,identifier:n.identifier,category:n.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",r=>{let i=r.detail,n=i.closest("qti-assessment-item-ref")?.identifier;n&&(i.assessmentItemRefId=n),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables,r.detail.itemContext.state,r.detail.itemContext.valid)})}_updateItemVariablesInTestContext(r,i,n,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:i.map(c=>{let l=a.variables.find(d=>d.identifier===c.identifier);return l?{...l,...c}:c}),...n!==void 0?{state:n?{...n}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(r,i){typeof i!="string"||i==="not_attempted"||this.testContext.items.find(a=>a.identifier===r)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:a.variables.map(c=>c.identifier==="completionStatus"?{...c,value:i}:c)})})}}return Xd([p({attribute:!1,type:Object}),J({context:nt})],t.prototype,"testContext",void 0),Xd([p({attribute:!1,type:Object}),J({context:Jn})],t.prototype,"sessionContext",void 0),t},Gd=class extends lc(S){};var Co=1;var dc=o=>Array.isArray(o)?[...o]:o??null,ym=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},qm=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(r=>({identifier:r.identifier,...r.type?{type:r.type}:{},value:dc(r.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:dc(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),Jd=o=>{class t extends o{#t=null;#e=!1;#r=null;constructor(...r){super(...r),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#r=null}),B(this,"qc-test-update-plugin-state",({detail:i})=>this.#i(i)),B(this,"qc-test-loaded",()=>{this.#t&&(this.#n(this.#t),this.#t=null),this.#e=!0})}#i({plugin:r,value:i}){if(typeof r!="string"||r==="")return;let{[r]:n,...s}=this.sessionContext.plugins??{},a=s;if(i!=null)try{a={...s,[r]:JSON.parse(JSON.stringify(i))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${r}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return qm(this.testContext,this.sessionContext)}set state(r){if(!ym(r)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=r;return}let{navItemRefId:i,navSectionId:n}=this.sessionContext;this.#n(r);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==i?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==n&&this.#s("section",s.navSectionId)}updated(r){if(super.updated(r),!this.#e||!(r.has("testContext")||r.has("sessionContext")))return;let i=this.state,n=JSON.stringify(i);n!==this.#r&&(this.#r=n,F(this,"qc-test-state-changed",i))}#n(r){for(let n of r.test.items)this.updateItemVariables(n.identifier,n.variables,n.state);let i=new Map(r.test.outcomes.map(n=>[n.identifier,n.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>i.has(n.identifier)?{...n,value:dc(i.get(n.identifier))}:n)},this.sessionContext={...this.sessionContext,...this.#o(r.session),plugins:r.session.plugins&&typeof r.session.plugins=="object"?{...r.session.plugins}:{}}}#o(r){let i=(n,s)=>!!s&&!!this._testElement?.querySelector(`${n}[identifier="${CSS.escape(s)}"]`);return{...i("qti-test-part",r.navPartId)?{navPartId:r.navPartId}:{},...i("qti-assessment-section",r.navSectionId)?{navSectionId:r.navSectionId}:{},...this.testContext.items.some(n=>n.identifier===r.navItemRefId)?{navItemRefId:r.navItemRefId}:{}}}#s(r,i){F(this,"qc-test-navigate",{type:r,id:i})}}return t};var Yd=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),B(this,"qc-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:n,value:s}=i.detail;this.updateOutcomeVariable(n,s),i.stopPropagation()})}outcomeProcessing(){let r=(this._testElement??this).querySelector("qti-outcome-processing");return r?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>({...i,value:i.defaultValue??null}))},r.process(),!0):!1}submit(){return this.outcomeProcessing()?(F(this,"qc-test-submitted",{}),!0):!1}getTestFeedback(r){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(n=>(!r||n.access===r)&&n.matches(this.getOutcome(n.outcomeIdentifier)?.value))}updateOutcomeVariable(r,i){let n=this.getOutcome(r);if(!n){console.warn(`Can not set qti-outcome-identifier: ${r}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==r?s:{...s,value:n.cardinality==="single"?i:[...s.value,i]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===r)||null}}return t};var Kd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ie=class extends Wd(Qd(Yd(Jd(lc(S))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Bt(this,{context:Ce,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};Kd([T(),J({context:yt})],Ie.prototype,"configContext",void 0);Kd([T(),J({context:qt})],Ie.prototype,"qtiContext",void 0);var ko=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},So=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var Zd=o=>!Nd(o)&&typeof o.then=="function",th=1073741823,hc=class extends Te{constructor(){super(...arguments),this._$Cwt=th,this._$Cbt=[],this._$CK=new ko(this),this._$CX=new So}render(...t){return t.find(e=>!Zd(e))??it}update(t,e){let r=this._$Cbt,i=r.length;this._$Cbt=e;let n=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let c=e[a];if(!Zd(c))return this._$Cwt=a,c;a<i&&c===r[a]||(this._$Cwt=th,i=0,Promise.resolve(c).then(async l=>{for(;s.get();)await s.get();let d=n.deref();if(d!==void 0){let h=d._$Cbt.indexOf(c);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(l))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Eo=Ot(hc);var Ao=`
225
225
  @layer qti-base, qti-components, qti-extended;
226
226
 
227
227
  @layer qti-components.reset, qti-components.global, qti-components.interactions.base,
@@ -6307,16 +6307,16 @@ div.full-correct-response-inline {
6307
6307
  display: inline-block;
6308
6308
  }
6309
6309
  }
6310
- `;var Ve=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},At=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.testURL=null,this.testDoc=null,this.testXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleTestURLChange(){if(this.testURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Ki().load(this.testURL)).shuffleOrdering(t),i=this.testHost;if(i?.postLoadTestTransformCallback){let n=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");n&&(e=await i.postLoadTestTransformCallback(e,n))}this.#i(e.htmlDoc(this.#e??void 0))}catch(t){console.error("Error loading or parsing XML:",t)}}#i(t){this.testDoc=t,this.dispatchEvent(new CustomEvent("qti-testdoc-loaded",{bubbles:!0,composed:!0}))}handleTestXMLChange(){if(this.testXML)try{let t=this.qtiContext?.QTI_CONTEXT?.seed;this.#i(Ki().parse(this.testXML).shuffleOrdering(t).htmlDoc(this.#e??void 0))}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#n(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#r(){let t=this.querySelector("template");this.#t=t?t.content:v``}#n(){let t=new CSSStyleSheet;t.replaceSync(Uo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
6310
+ `;var Me=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},St=class extends S{constructor(){super(...arguments),this.customElementRegistry=null,this.testURL=null,this.testDoc=null,this.testXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleTestURLChange(){if(this.testURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Fr().load(this.testURL)).shuffleOrdering(t),r=this.testHost;if(r?.postLoadTestTransformCallback){let n=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");n&&(e=await r.postLoadTestTransformCallback(e,n))}this.#r(e.htmlDoc(this.#e??void 0))}catch(t){console.error("Error loading or parsing XML:",t)}}#r(t){this.testDoc=t,this.dispatchEvent(new CustomEvent("qti-testdoc-loaded",{bubbles:!0,composed:!0}))}handleTestXMLChange(){if(this.testXML)try{let t=this.qtiContext?.QTI_CONTEXT?.seed;this.#r(Fr().parse(this.testXML).shuffleOrdering(t).htmlDoc(this.#e??void 0))}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#i(),this.#n(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:v``}#n(){let t=new CSSStyleSheet;t.replaceSync(Ao),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
6311
6311
  ${this.#t}
6312
6312
  <slot></slot>
6313
- ${Bo(this.testDoc,v`<span>Loading...</span>`)}
6314
- `}};Ve([p({attribute:!1})],At.prototype,"customElementRegistry",void 0);Ve([p({type:String,attribute:"test-url"})],At.prototype,"testURL",void 0);Ve([R()],At.prototype,"testDoc",void 0);Ve([R()],At.prototype,"testXML",void 0);Ve([I({context:Ie,subscribe:!0})],At.prototype,"testHost",void 0);Ve([R(),I({context:Ct,subscribe:!0})],At.prototype,"qtiContext",void 0);Ve([N("testURL",{waitUntilFirstUpdate:!0})],At.prototype,"handleTestURLChange",null);Ve([N("testXML",{waitUntilFirstUpdate:!0})],At.prototype,"handleTestXMLChange",null);var Ho=w`var(--qti-color-base-100, var(--qc-color-base-100, var(--cito-color-base-100, Canvas)))`,Vl=w`var(--qti-color-base-content, var(--qc-color-base-content, var(--cito-color-base-content, CanvasText)))`,Wo=w`var(--qti-color-neutral, var(--qc-color-neutral, var(--cito-color-neutral, CanvasText)))`,jl=w`var(--qti-color-neutral-content, var(--qc-color-neutral-content, var(--cito-color-neutral-content, Canvas)))`,Dh=w`var(--button-border-radius, var(--test-button-border-radius, var(--qti-radius-field, var(--qc-radius-field, var(--cito-radius-field, 0.2rem)))))`,$h=w`var(--qti-border-width, var(--qc-border-width, var(--cito-border-width, 1px)))`,lf=w`
6313
+ ${Eo(this.testDoc,v`<span>Loading...</span>`)}
6314
+ `}};Me([p({attribute:!1})],St.prototype,"customElementRegistry",void 0);Me([p({type:String,attribute:"test-url"})],St.prototype,"testURL",void 0);Me([T()],St.prototype,"testDoc",void 0);Me([T()],St.prototype,"testXML",void 0);Me([R({context:Ce,subscribe:!0})],St.prototype,"testHost",void 0);Me([T(),R({context:qt,subscribe:!0})],St.prototype,"qtiContext",void 0);Me([N("testURL",{waitUntilFirstUpdate:!0})],St.prototype,"handleTestURLChange",null);Me([N("testXML",{waitUntilFirstUpdate:!0})],St.prototype,"handleTestXMLChange",null);var _o=w`var(--qti-color-base-100, var(--qc-color-base-100, var(--cito-color-base-100, Canvas)))`,pc=w`var(--qti-color-base-content, var(--qc-color-base-content, var(--cito-color-base-content, CanvasText)))`,To=w`var(--qti-color-neutral, var(--qc-color-neutral, var(--cito-color-neutral, CanvasText)))`,uc=w`var(--qti-color-neutral-content, var(--qc-color-neutral-content, var(--cito-color-neutral-content, Canvas)))`,eh=w`var(--button-border-radius, var(--test-button-border-radius, var(--qti-radius-field, var(--qc-radius-field, var(--cito-radius-field, 0.2rem)))))`,rh=w`var(--qti-border-width, var(--qc-border-width, var(--cito-border-width, 1px)))`,xm=w`
6315
6315
  display: inline-flex;
6316
6316
  cursor: pointer;
6317
6317
  user-select: none;
6318
- border-radius: ${Dh};
6319
- `,Nh=w`
6318
+ border-radius: ${eh};
6319
+ `,ih=w`
6320
6320
  display: flex;
6321
6321
  flex: 1 1 auto;
6322
6322
  align-items: center;
@@ -6329,69 +6329,69 @@ div.full-correct-response-inline {
6329
6329
  line-height: 1.25;
6330
6330
  cursor: pointer;
6331
6331
  user-select: none;
6332
- border-radius: ${Dh};
6333
- `,Fl=w`
6334
- ${Nh};
6335
- background-color: var(--button-background-color, var(--test-button-background-color, ${Ho}));
6332
+ border-radius: ${eh};
6333
+ `,wm=w`
6334
+ ${ih};
6335
+ background-color: var(--button-background-color, var(--test-button-background-color, ${_o}));
6336
6336
  color: var(--button-color, var(--test-button-color, inherit));
6337
- border: ${$h} solid
6337
+ border: ${rh} solid
6338
6338
  var(
6339
6339
  --button-border-color,
6340
- var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${Vl} 45%, ${Ho})))
6340
+ var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${pc} 45%, ${_o})))
6341
6341
  );
6342
- `,cf=w`
6343
- background-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${Wo}));
6344
- color: var(--button-primary-color, var(--test-button-primary-color, ${jl}));
6345
- border-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${Wo}));
6346
- `,zl=w`
6342
+ `,Cm=w`
6343
+ background-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${To}));
6344
+ color: var(--button-primary-color, var(--test-button-primary-color, ${uc}));
6345
+ border-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${To}));
6346
+ `,km=w`
6347
6347
  background-color: var(
6348
6348
  --button-hover-background-color,
6349
- var(--test-button-hover-background-color, color-mix(in oklab, ${Ho}, ${Vl} var(--qti-hover-mix, 8%)))
6349
+ var(--test-button-hover-background-color, color-mix(in oklab, ${_o}, ${pc} var(--qti-hover-mix, 8%)))
6350
6350
  );
6351
- `,df=w`
6351
+ `,Sm=w`
6352
6352
  background-color: var(
6353
6353
  --button-primary-hover-background-color,
6354
6354
  var(
6355
6355
  --test-button-primary-hover-background-color,
6356
- color-mix(in oklab, ${Wo}, ${jl} var(--qti-hover-mix, 8%))
6356
+ color-mix(in oklab, ${To}, ${uc} var(--qti-hover-mix, 8%))
6357
6357
  )
6358
6358
  );
6359
- `,Bl=w`
6359
+ `,Em=w`
6360
6360
  background-color: var(
6361
6361
  --button-active-background-color,
6362
- var(--test-button-active-background-color, color-mix(in oklab, ${Ho}, ${Vl} var(--qti-active-mix, 16%)))
6362
+ var(--test-button-active-background-color, color-mix(in oklab, ${_o}, ${pc} var(--qti-active-mix, 16%)))
6363
6363
  );
6364
- `,hf=w`
6364
+ `,Am=w`
6365
6365
  background-color: var(
6366
6366
  --button-primary-active-background-color,
6367
6367
  var(
6368
6368
  --test-button-primary-active-background-color,
6369
- color-mix(in oklab, ${Wo}, ${jl} var(--qti-active-mix, 16%))
6369
+ color-mix(in oklab, ${To}, ${uc} var(--qti-active-mix, 16%))
6370
6370
  )
6371
6371
  );
6372
- `,Ul=w`
6372
+ `,_m=w`
6373
6373
  outline: var(--qti-focus-border-width, 2px) solid var(--qti-focus-color, Highlight);
6374
6374
  outline-offset: var(--qti-focus-offset, 2px);
6375
- `,Hl=w`
6375
+ `,Tm=w`
6376
6376
  cursor: not-allowed;
6377
6377
  opacity: 0.45;
6378
- `,gS=w`
6379
- ${Nh};
6380
- border: ${$h} solid var(--qti-border-color, GrayText);
6381
- `,ht=v`<span class="control" part="button"><slot></slot></span>`,at=w`
6378
+ `,Sk=w`
6379
+ ${ih};
6380
+ border: ${rh} solid var(--qti-border-color, GrayText);
6381
+ `,Pe=v`<span class="control" part="button"><slot></slot></span>`,Oe=w`
6382
6382
  :host {
6383
- ${lf};
6383
+ ${xm};
6384
6384
  }
6385
6385
  .control {
6386
- ${Fl};
6386
+ ${wm};
6387
6387
  }
6388
6388
  @media (hover: hover) and (pointer: fine) {
6389
6389
  :host(:hover:not([disabled])) .control {
6390
- ${zl};
6390
+ ${km};
6391
6391
  }
6392
6392
  }
6393
6393
  :host(:active:not([disabled])) .control {
6394
- ${Bl};
6394
+ ${Em};
6395
6395
  }
6396
6396
  /* The press the theme gives a choice (qti-motion.css), from the same knob: a touch smaller while
6397
6397
  the button is down, springing back on release; 0 motion means no press. */
@@ -6404,257 +6404,31 @@ div.full-correct-response-inline {
6404
6404
  scale: calc(1 - 0.03 * var(--qti-motion, 1));
6405
6405
  }
6406
6406
  :host(:focus-visible) {
6407
- ${Ul};
6407
+ ${_m};
6408
6408
  }
6409
6409
  :host([disabled]) {
6410
- ${Hl};
6410
+ ${Tm};
6411
6411
  }
6412
6412
  :host([disabled]) .control {
6413
6413
  cursor: not-allowed;
6414
6414
  }
6415
- `,Lh=w`
6415
+ `,nh=w`
6416
6416
  .control {
6417
- ${cf};
6417
+ ${Cm};
6418
6418
  }
6419
6419
  @media (hover: hover) and (pointer: fine) {
6420
6420
  :host(:hover:not([disabled])) .control {
6421
- ${df};
6421
+ ${Sm};
6422
6422
  }
6423
6423
  }
6424
6424
  :host(:active:not([disabled])) .control {
6425
- ${hf};
6426
- }
6427
- `;var un=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Vh=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?Vh(e.host):void 0},ye=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=at}constructor(){super(),this._internalDisabled=!1,this.requireAnswer=!1,this.addEventListener("click",t=>{if(t.preventDefault(),!this._internalDisabled){let e=this.#t;L(this,"qc-test-end-attempt",e?{itemId:e}:{})}})}get#t(){return this.item||Vh(this)}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts,e=this.#t,i=t?.find(a=>a.active);if(!t||!e&&!i)return;let r=e?t.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.identifier===e):i.sections.flatMap(a=>a.items).find(a=>a.active);if(!r){this._internalDisabled=!1;return}let n=r.maxAttempts??1,s=r.numAttempts||0;if(!r.adaptive&&r.optimal){this._internalDisabled=!0;return}if(r.adaptive&&r.completionStatus==="completed"){this._internalDisabled=!0;return}if(!r.adaptive&&n>0&&s>=n){this._internalDisabled=!0;return}this.requireAnswer||r.allowSkipping===!1?this._internalDisabled=r.valid===!1||r.isDefaultResponse:this._internalDisabled=!1}render(){return ht}};un([I({context:z,subscribe:!0}),p({attribute:!1})],ye.prototype,"computedContext",void 0);un([p({type:Boolean,reflect:!0,attribute:"disabled"})],ye.prototype,"_internalDisabled",void 0);un([p({reflect:!0})],ye.prototype,"item",void 0);un([p({type:Boolean,reflect:!0,attribute:"require-answer"})],ye.prototype,"requireAnswer",void 0);un([N("computedContext")],ye.prototype,"_handleTestElementChange",null);var pf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},mn=class extends C{static{this.styles=at}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){L(this,"qc-test-navigate",{type:"item",id:t})}render(){return ht}};pf([p({type:String,attribute:"item-id"})],mn.prototype,"itemId",void 0);var pi=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},uf=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),bt=class extends C{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=uf())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#i(t)}#t;#e;#i(t){let e=this.#n();e?e.qtiContext=t:this.#t=t}#r;#n(){return this.#r.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#r=new dt(this,{context:Ie,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#u=t=>this.#d(t)??null,this.#b=new WeakSet,U(this,"qc-test-loaded",this.#m.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#g.bind(this)),Fd(this,"qc-item-response-changed",this.#c.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),U(this,"qc-test-end-attempt",this.#l.bind(this)),U(this,"qc-test-update-outcome",this.#h.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let i=this.#q(e);this.#s.set(e.identifier,i);let r=this.computedItemFor(e.identifier),n=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),r,this.#y(n,i,r?.maxAttempts,r?.adaptive,s))}afterAttemptEnded(t,e,i){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#d(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#u;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#l(t){let e=t.detail?.itemId,i=e?this.#d(e):this.activeAssessmentItem;if(!i)return;let r=this.configContext?.reportValidityAfterScoring===!0;i.processResponse(!0,r)}#h(t){let e=this.#d(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#c(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let i=e.variables.find(r=>r.identifier==="SCORE");if(i&&i.externalScored===null&&e.adaptive==="false"){let r=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,r)}}}render(){return v`<slot></slot>`}#m(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let r=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#i({QTI_CONTEXT:{...r,testIdentifier:this.#o.identifier,environmentIdentifier:r.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(r=>{let n=this.#p(r);Object.keys(n).length>0&&this.#i({QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let i=Array.from(this.#o?.querySelectorAll("qti-test-part")||[]);this.computedContext={itemElement:this.#u,identifier:this.#o.identifier,title:this.#o.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:i.map(r=>{let n=[...r.querySelectorAll("qti-assessment-section")],s=r.querySelector(":scope > qti-item-session-control"),a=s?s.allowSkipping:!0,l=s?s.maxAttempts:1,c=s?s.showFeedback:!1,d=s?s.showSolution:!1;return{active:!1,identifier:r.identifier,navigationMode:r.navigationMode,submissionMode:r.submissionMode,allowSkipping:a,sections:n.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),y=m?m.allowSkipping:a,x=m?m.maxAttempts:l,u=m?m.showFeedback:c,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:y,items:f.map(b=>{let q=b.querySelector(":scope > qti-item-session-control"),_=q?q.allowSkipping:y,A=q?q.maxAttempts:x,k=q?q.showFeedback:u,S=q?q.showSolution:g;return{...this.initContext?.find(T=>T.identifier===b.identifier),active:!1,identifier:b.identifier,categories:b.category?b.category?.split(" "):[],href:b.href,variables:[],allowSkipping:_,maxAttempts:A,showFeedback:k,showSolution:S}})}})}})}}#p(t){let e={},i=t.querySelector("qti-default-value");return i&&i.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let s=n.getAttribute("field-identifier"),a=n.getAttribute("base-type")||"string",l=n.textContent?.trim()||"";if(s){let c=l;switch(a){case"integer":c=parseInt(l,10);break;case"float":case"duration":c=parseFloat(l);break;case"boolean":c=l.toLowerCase()==="true";break;default:c=l;break}e[s]=c}}),e}#g(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(i=>({...i,sections:i.sections.map(r=>({...r,items:r.items.map(n=>{if(n.identifier!==e.parentElement.getAttribute("identifier"))return n;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),l=e.querySelectorAll("qti-response-declaration"),c=Array.from(l).some(m=>m.querySelector("qti-correct-response")),d=Array.from(l).some(m=>{let y=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return y?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=c||d,f=!!e.querySelector("qti-response-processing");return{...n,assessmentItemIdentifier:e.getAttribute("identifier"),label:e.getAttribute("label"),title:e.title,externalScored:a,adaptive:e.adaptive=="true"||!1,timeDependent:e.timeDependent=="true"||!1,variables:e.variables,hasCorrectResponse:h,hasResponseProcessing:f}})}))}))}}willUpdate(t){if(!this.computedContext)return;let e=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(i=>({...i,active:this._sessionContext?.navPartId===i.identifier||!1,sections:i.sections.map(r=>({...r,active:this._sessionContext?.navSectionId===r.identifier||!1,completed:r.items.every(n=>this._testContext.items.find(s=>s.identifier===n.identifier)?.variables.find(s=>s.identifier==="completionStatus")?.value==="completed"),items:r.items.map(n=>{let s=this._testContext?.items.find(k=>k.identifier===n.identifier),a={...n,...s,...this.initContext?.find(k=>k.identifier===n.identifier)},l=a.variables?.find(k=>k.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(k=>k.identifier==="completionStatus")?.value,h=a.variables?.find(k=>k.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(k=>k.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(k=>k.type==="response"&&k.identifier!=="numAttempts")||[]).every(k=>{if(k.value===void 0||k.value===null)return!0;let S;switch(k.baseType){case"integer":case"float":case"duration":S="0";break;case"boolean":S="false";break;default:S="";break}let T=k.defaultValue??S;if(Array.isArray(k.value)){let $=Array.isArray(T)?T:[T];return k.value.length===$.length&&k.value.every((j,V)=>j===$[V])}return k.value===T}),g=n.categories.includes(this.configContext?.infoItemCategory)?null:e++,b=n.variables?.find(k=>k.identifier=="MAXSCORE")?.value,q=b==null?null:parseFloat(b?.toString()),_=this.#s.get(a.identifier);_===void 0&&(_=s?this.#q(s):"unscored",f>0&&this.#s.set(a.identifier,_));let A=this.#y(f,_,a.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:y,isDefaultResponse:u,maxScore:q,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}updated(t){super.updated(t),this.#v()}#b;#v(){if(!this.#o||!this.computedContext)return;let t=new Map(this.computedContext.testParts.flatMap(e=>e.sections.flatMap(i=>(i.submissionMode||e.submissionMode)==="simultaneous"?[]:i.items.map(r=>[r.identifier,r]))));for(let e of this.#o.querySelectorAll("qti-assessment-item-ref")){let i=e.assessmentItem;if(!i)continue;let r=this.#f(t.get(e.identifier),i);r&&!i.disabled?(i.disabled=!0,this.#b.add(i)):!r&&this.#b.has(i)&&(this.#b.delete(i),i.disabled=!1)}}#f(t,e){if(!t||this.autoScoreItems||t.adaptive||e.adaptive==="true")return!1;let i=t.maxAttempts??1;return i>0&&(t.numAttempts??0)>=i}#y(t,e,i,r,n){if(t===0)return!1;if(r)return n==="completed";if(e!=="suboptimal")return!0;let s=i??1;return s>0&&t>=s}#q(t){let e=t.variables??[],i=this.#x(e,"SCORE"),r=this.#x(e,"MAXSCORE");if(i!==null&&r!==null)return i>=r?"optimal":"suboptimal";let n=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return n.length===0?"unscored":n.every(a=>{let l=a.correctResponse,c=a.value;return c==null?!1:Array.isArray(l)&&Array.isArray(c)?l.length===c.length&&l.every(d=>c.includes(d)):Array.isArray(l)||Array.isArray(c)?!1:l===c})?"optimal":"suboptimal"}#x(t,e){let i=t?.find(n=>n.identifier===e)?.value;if(i==null||Array.isArray(i))return null;let r=parseFloat(i.toString());return Number.isNaN(r)?null:r}};pi([p({type:String})],bt.prototype,"identifier",void 0);pi([R()],bt.prototype,"initContext",void 0);pi([R(),I({context:wt,subscribe:!0})],bt.prototype,"configContext",void 0);pi([R(),I({context:st,subscribe:!0})],bt.prototype,"_testContext",void 0);pi([R(),I({context:Re,subscribe:!0})],bt.prototype,"_sessionContext",void 0);pi([R(),X({context:z})],bt.prototype,"computedContext",void 0);pi([p({type:Boolean,attribute:"auto-score-items"})],bt.prototype,"autoScoreItems",void 0);var Wl=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ui=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[at,Lh]}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(i=>i.active);e&&(this.sectionItems=e.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),i=e?.navigationMode||t.navigationMode,r=e?.submissionMode||t.submissionMode,n=this.sectionItems[this.itemIndex],s=i==="linear"&&r==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!n?.done}_requestItem(t){L(this,"qc-test-navigate",{type:"item",id:t})}render(){return ht}};Wl([p({type:Boolean,reflect:!0,attribute:"disabled"})],ui.prototype,"_internalDisabled",void 0);Wl([I({context:z,subscribe:!0})],ui.prototype,"computedContext",void 0);Wl([N("computedContext")],ui.prototype,"_handleTestElementChange",null);var Ql=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},mi=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=at}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(i=>i.active);e&&(this.sectionItems=e.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(r=>r.active),i=t?.sections.find(r=>r.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=i==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){L(this,"qc-test-navigate",{type:"item",id:t})}render(){return ht}};Ql([p({type:Boolean,reflect:!0,attribute:"disabled"})],mi.prototype,"_internalDisabled",void 0);Ql([I({context:z,subscribe:!0})],mi.prototype,"computedContext",void 0);Ql([N("computedContext")],mi.prototype,"_handleTestElementChange",null);var mf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},fn=class extends C{static{this.styles=at}#t(t){L(this,"qc-test-navigate",{type:"section",id:t})}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#t(this.sectionId))}render(){return ht}};mf([p({type:String,attribute:"section-id"})],fn.prototype,"sectionId",void 0);var jh=(o,t)=>o?.plugins?.[t];var Qo=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Xl=o=>jh(o,"bookmarks")??[],Fh=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?Fh(e.host):void 0},je=class extends C{static{this.styles=[at,w`
6428
- svg {
6429
- width: 1.1em;
6430
- height: 1.1em;
6431
- flex: none;
6432
- fill: none;
6433
- stroke: currentColor;
6434
- stroke-width: 2;
6435
- stroke-linejoin: round;
6436
- }
6437
- :host([bookmarked]) {
6438
- color: var(--qti-bookmark-color, #b45309);
6439
- }
6440
- :host([bookmarked]) svg {
6441
- fill: currentColor;
6442
- }
6443
- `]}constructor(){super(),this.bookmarked=!1,this.disabled=!1,this.addEventListener("click",()=>this.#e()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#e())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","button"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0")}get#t(){return this.item||(Fh(this)??this.computedContext?.testParts?.flatMap(t=>t.sections.flatMap(e=>e.items)).find(t=>t.active)?.identifier)}willUpdate(){let t=this.#t;this.disabled=!t,this.bookmarked=!!t&&Xl(this.computedContext).includes(t)}updated(){this.setAttribute("aria-pressed",String(this.bookmarked)),this.setAttribute("aria-disabled",String(this.disabled))}#e(){let t=this.#t;if(!t)return;let e=Xl(this.computedContext),i=e.includes(t)?e.filter(r=>r!==t):[...e,t];L(this,"qc-test-update-plugin-state",{plugin:"bookmarks",value:i.length>0?i:null})}render(){return v`<span class="control" part="button"
6444
- ><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3h12v18l-6-4.5L6 21z" /></svg><slot></slot
6445
- ></span>`}};Qo([I({context:z,subscribe:!0}),p({attribute:!1})],je.prototype,"computedContext",void 0);Qo([p({reflect:!0})],je.prototype,"item",void 0);Qo([p({type:Boolean,reflect:!0})],je.prototype,"bookmarked",void 0);Qo([p({type:Boolean,reflect:!0})],je.prototype,"disabled",void 0);var ff=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},fi=class extends C{static{this.styles=at}constructor(){super(),this.view="scorer",this.addEventListener("click",()=>{L(this,"qc-test-end-attempt",{}),L(this,"qc-test-switch-view",this.view)})}render(){return ht}};ff([p({type:String})],fi.prototype,"view",void 0);var gf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},gn=class extends C{render(){return v` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};gf([R(),I({context:z,subscribe:!0})],gn.prototype,"computedContext",void 0);var bf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Xo=o=>o==null?"":Array.isArray(o)?o.map(Xo).join(", "):$t(o)?Object.entries(o).map(([t,e])=>`${t}: ${Xo(e)}`).join(", "):String(o),bn=class extends C{static{this.styles=w`
6446
- table {
6447
- width: 100%;
6448
- border-collapse: collapse;
6449
- margin: 20px 0;
6450
- font-size: 14px;
6451
- text-align: left;
6452
- }
6453
- th,
6454
- td {
6455
- border: 1px solid #ddd;
6456
- padding: 8px;
6457
- }
6458
- th {
6459
- background-color: #f4f4f4;
6460
- font-weight: bold;
6461
- }
6462
- h3 {
6463
- margin-top: 20px;
6464
- font-size: 16px;
6465
- }
6466
- `}render(){let t=this.computedContext?.testParts.flatMap(n=>n.sections.flatMap(s=>s.items)).find(n=>n.active);if(!t||!t.variables)return v``;let e=t.variables.filter(n=>n.type==="response"),i=t.variables.filter(n=>n.type==="outcome"),r=(n,s)=>v`
6467
- <h3>${s}</h3>
6468
- <table>
6469
- <thead>
6470
- <tr>
6471
- <th>Identifier</th>
6472
- <th>Value</th>
6473
- <th>Cardinality</th>
6474
- <th>Base Type</th>
6475
- <th>Correct Response / Mappings</th>
6476
- </tr>
6477
- </thead>
6478
- <tbody>
6479
- ${n.map(a=>{let l=Xo(a.correctResponse),c=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return v`
6480
- <tr>
6481
- <td>${a.identifier}</td>
6482
- <td>${Xo(a.value)}</td>
6483
- <td>${a.cardinality}</td>
6484
- <td>${a.baseType}</td>
6485
- <td>${l||c||d}</td>
6486
- </tr>
6487
- `})}
6488
- </tbody>
6489
- </table>
6490
- `;return v`
6491
- ${r(e,"Response Variables")} ${r(i,"Outcome Variables")}
6492
- `}};bf([I({context:z,subscribe:!0})],bn.prototype,"computedContext",void 0);var vf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},vn=class extends C{#t=null;static{this.styles=w`
6493
- :host {
6494
- display: block;
6495
- }
6496
- ul {
6497
- list-style: none;
6498
- margin: 0;
6499
- padding-inline-start: 1rem;
6500
- }
6501
- summary {
6502
- cursor: pointer;
6503
- }
6504
- [part~='count'] {
6505
- opacity: 0.7;
6506
- }
6507
- `}#e=t=>{this.testState=t.detail};connectedCallback(){super.connectedCallback(),this.#t=this.closest("qti-test"),this.#t?.addEventListener("qc-test-state-changed",this.#e),this.testState=this.#t?.state}disconnectedCallback(){super.disconnectedCallback(),this.#t?.removeEventListener("qc-test-state-changed",this.#e),this.#t=null}render(){return this.testState?v`<ul>
6508
- ${this.#i("state",this.testState,0)}
6509
- </ul>`:P}#i(t,e,i){if(e===null||typeof e!="object")return v`<li><span part="key">${t}</span>: <span part="value">${JSON.stringify(e)}</span></li>`;let r=Array.isArray(e)?e.map((s,a)=>[yf(s,a),s]):Object.entries(e),n=Array.isArray(e)?`[${r.length}]`:`{${r.length}}`;return v`<li>
6510
- <details ?open=${i<2}>
6511
- <summary><span part="key">${t}</span> <span part="count">${n}</span></summary>
6512
- <ul>
6513
- ${r.map(([s,a])=>this.#i(s,a,i+1))}
6514
- </ul>
6515
- </details>
6516
- </li>`}};vf([R()],vn.prototype,"testState",void 0);var yf=(o,t)=>{let e=o?.identifier;return typeof e=="string"?`${t} \xB7 ${e}`:String(t)};var Gl=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},gi=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=Ae(t)}#t(t){let r=(this.computedContext?.testParts.find(n=>n.active)).sections.flatMap(n=>n.items).find(n=>n.active)?.identifier;L(this,"qc-test-update-outcome",{assessmentItemRefId:r,outcomeVariableId:"SCORE",value:t})}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!t||!t.variables)return v``;let e=t.variables.find(a=>a.identifier=="MAXSCORE")?.value,i=t.variables.find(a=>a.identifier=="SCORE"),r=i?.value,n=i?.externalScored!=="human";if(!e||!i)return P;let s=[...Array(Number(e)+1).keys()];return v`${this.myTemplate?this.myTemplate({scores:s,score:r,disabled:n}):P}`}constructor(){super(),this.view="",this.disabled=!1,this.myTemplate=null,this.addEventListener("click",t=>{let e=t.target,i=parseFloat(e.value);e.tagName==="INPUT"&&this.#t(i)})}};Gl([p({type:String,attribute:"view"})],gi.prototype,"view",void 0);Gl([p({type:Boolean})],gi.prototype,"disabled",void 0);Gl([I({context:z,subscribe:!0})],gi.prototype,"computedContext",void 0);var zh=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},nr=class extends C{constructor(){super(...arguments),this.view=null}render(){let t=this.computedContext?.testParts.flatMap(s=>s.sections.flatMap(a=>a.items)).find(s=>s.active);if(!t||!t.variables)return v``;if(t.category==="dep-informational")return v`<div>${this.dataset.informational}</div>`;let e=t?.variables.find(s=>s.identifier=="SCORE"),i=parseFloat(e?.value),r=t.externalScored;return v`<div>${t.valid===!1||t.isDefaultResponse?this.dataset.textNoResponse:!r&&i!==void 0&&!Number.isNaN(i)?i>0?this.dataset.textCorrect:this.dataset.textIncorrect:r==="externalMachine"?Number.isNaN(i)||i===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${i===0?"geen punten":i==1?"\xE9\xE9n punt":`${i} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:r==="human"?Number.isNaN(i)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};zh([I({context:z,subscribe:!0})],nr.prototype,"computedContext",void 0);zh([p({type:String,attribute:"view"})],nr.prototype,"view",void 0);var Jl=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},bi=class extends C{constructor(){super(...arguments),this.debug=!1,this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=Ae(t)}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext.testParts.find(h=>h.active),i=e?.sections.find(h=>h.active),r=i?.items.find(h=>h.active),{variables:n,...s}=r||{};if(!e)return;let a={...e,items:e.sections.flatMap(h=>h.items.map(({variables:f,...m})=>m)),sections:e.sections.map(h=>({...h,items:h.items.map(({variables:f,...m})=>m)}))},l={...i,items:(i?.items??[]).map(({variables:h,...f})=>f)},{testParts:c,...d}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:s,activeSection:l,activeTestpart:a,test:d},this.dispatchEvent(new CustomEvent("qti-stamp-context-updated",{detail:this.stampContext,bubbles:!0}))}render(){return v` ${this.debug?v`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:P}
6517
- ${this.myTemplate?this.myTemplate(this.stampContext):P}`}};Jl([p({type:Boolean,reflect:!0})],bi.prototype,"debug",void 0);Jl([R(),I({context:z,subscribe:!0})],bi.prototype,"computedContext",void 0);Jl([R()],bi.prototype,"stampContext",void 0);var Go=class extends C{static{this.styles=at}constructor(){super(),this.addEventListener("click",()=>L(this,"qc-test-submit",{}))}render(){return ht}};var yn=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Jo,te=class extends C{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#t()},this._viewOptions=Jo.DEFAULT_VIEW_OPTIONS}static{this.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"]}connectedCallback(){super.connectedCallback(),this.#t()}#t(){if(this.viewOptions){let t=this.viewOptions.split(",").map(e=>e.trim());this._viewOptions=t.filter(e=>Jo.DEFAULT_VIEW_OPTIONS.includes(e))}else this._viewOptions=Jo.DEFAULT_VIEW_OPTIONS}_switchView(t){L(this,"qc-test-switch-view",t)}render(){return v`
6518
- <label part="label" for="viewSelect">${this.label}</label>
6519
- <select
6520
- part="select"
6521
- id="viewSelect"
6522
- @change=${t=>{let e=t.target;this._switchView(e.value)}}
6523
- >
6524
- ${this._viewOptions.map(t=>v`<option value="${t}" ?selected=${t===this.sessionContext.view}>${t}</option>`)}
6525
- </select>
6526
- `}};Jo=te;yn([I({context:Re,subscribe:!0})],te.prototype,"sessionContext",void 0);yn([p({type:String})],te.prototype,"label",void 0);yn([p({type:String,attribute:"view-options"})],te.prototype,"viewOptions",void 0);yn([N("viewOptions",{waitUntilFirstUpdate:!0})],te.prototype,"_handleViewOptionsChange",void 0);yn([R()],te.prototype,"_viewOptions",void 0);var qf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},qn=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=Ae(t)}_switchView(t){L(this,"qc-test-switch-view",t)}firstUpdated(t){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return v`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):P}`}};qf([I({context:Re,subscribe:!0})],qn.prototype,"sessionContext",void 0);var or=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ko="tts-element",Zo="tts-word",Yo=null;function xf(){return Yo||(Yo=new CSSStyleSheet,Yo.replaceSync(`
6527
- ::highlight(${Ko}) {
6528
- background-color: var(--test-tts-element-highlight, color-mix(in oklab, var(--qti-color-info, var(--qc-color-info, var(--cito-color-info, Highlight))) 15%, transparent));
6529
- color: inherit;
6530
- }
6531
- ::highlight(${Zo}) {
6532
- background-color: var(--test-tts-word-highlight, color-mix(in oklab, var(--qti-color-warning, var(--qc-color-warning, var(--cito-color-warning, Mark))) 55%, transparent));
6533
- color: inherit;
6534
- }
6535
- `)),Yo}var Bh=Symbol("tts-context"),wf={play:"M8 5v14l11-7z",pause:"M6 5h4v14H6zM14 5h4v14h-4z",stop:"M6 6h12v12H6z",prev:"M6 5h2v14H6zM20 5v14L9 12z",next:"M16 5h2v14h-2zM4 5v14l11-7z",pick:"M5 3l13 7-5.5 1.6 3.4 6.6-2.4 1.3-3.4-6.7L6 17z"},Fe=(o,t)=>{let e=v`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
6536
- <path d="${wf[o]}"></path>
6537
- </svg>`;return v`${e}<span class="label">${t}</span>`},jt=class extends C{static{this.styles=w`
6538
- :host {
6539
- display: inline-flex;
6540
- }
6541
- button {
6542
- ${Fl};
6543
- min-inline-size: var(--button-size, var(--test-button-size, 2.25rem));
6544
- padding-inline: 0.5rem;
6545
- /* Containing block for the visually hidden .label. Without it the label is placed against
6546
- the nearest positioned ancestor, which can sit outside a scroll container and make the
6547
- page as tall as the scrolled content. */
6548
- position: relative;
6549
- }
6550
- @media (hover: hover) and (pointer: fine) {
6551
- button:hover:not(:disabled) {
6552
- ${zl};
6553
- }
6554
- }
6555
- button:active:not(:disabled) {
6556
- ${Bl};
6557
- }
6558
- button:focus-visible {
6559
- ${Ul};
6560
- }
6561
- button:disabled {
6562
- ${Hl};
6563
- }
6564
- /* A toggle that is on (the pick button in pick mode). The host carries :state(selected) for a
6565
- page's own rules; in here the inner button's aria-pressed says the same thing and matches in
6566
- a browser without :state(), so the look keys on that. */
6567
- button[aria-pressed='true'],
6568
- button[aria-pressed='true']:hover {
6569
- background-color: var(
6570
- --button-selected-background-color,
6571
- var(--test-button-selected-background-color, var(--qti-selected-bg, Highlight))
6572
- );
6573
- color: var(--button-selected-color, var(--test-button-selected-color, var(--qti-selected-color, HighlightText)));
6574
- }
6575
- svg,
6576
- ::slotted(svg) {
6577
- flex: none;
6578
- inline-size: var(--test-tts-icon-size, 1.125rem);
6579
- block-size: var(--test-tts-icon-size, 1.125rem);
6580
- }
6581
- svg {
6582
- fill: currentColor;
6583
- }
6584
- /* The default content is icon-only; this keeps the button's accessible name. */
6585
- .label {
6586
- position: absolute;
6587
- inline-size: 1px;
6588
- block-size: 1px;
6589
- overflow: hidden;
6590
- clip-path: inset(50%);
6591
- white-space: nowrap;
6592
- }
6593
- `}#t=this.attachInternals();#e;#i=!1;#r=!1;get selected(){return!1}updated(t){let e=this._tts?.state,i=this._tts?.picking??!1,r=this.selected;e===this.#e&&i===this.#i&&r===this.#r||(this.#e=e,this.#i=i,this.#r=r,this.#t.states.clear(),e&&this.#t.states.add(e),i&&this.#t.states.add("picking"),r&&this.#t.states.add("selected"))}};or([p({type:String})],jt.prototype,"label",void 0);or([I({context:Bh,subscribe:!0})],jt.prototype,"_tts",void 0);var vi=class extends C{static{this.styles=w`
6594
- :host {
6595
- display: inline-flex;
6596
- flex-wrap: wrap;
6597
- align-items: center;
6598
- gap: var(--test-tts-gap, 0.25rem);
6599
- }
6600
- `}#t;#e;#i;#r;#n;#o;#s;#a;#d;#u;#l;#h;#c;#m;#p;#g;#b;#v;#f;#y;#q;constructor(){super(),this.language="nl-NL",this.#t=this.attachInternals(),this.#e=!1,this.#i=null,this.#r=!1,this.#n=null,this.#o=null,this.#s=this.#k.bind(this),this.#a=()=>this.#T(),this.#d=void 0,this.#u=void 0,this.#l=null,this.#h=null,this.#c=0,this.#m=[],this.#p=null,this.#g=!1,this.#b=null,this.#v=this.#Q.bind(this),this.#f=!1,this.#y=new Highlight,this.#q=new Highlight,this._ttsContext={state:"idle",currentElementIndex:0,elementCount:0,play:()=>this.#z(),pause:()=>this.#B(),resume:()=>this.#U(),stop:()=>{this.#E(),this.#T()},prevElement:()=>this.#X(),nextElement:()=>this.#G(),togglePick:()=>this.#H(),picking:!1}}willUpdate(t){if(super.willUpdate(t),this.#e||this.#r||this.#n)return;let{item:e,section:i}=this.#w(),r=this.#d!==void 0&&this.#d!==e,n=this.#u!==void 0&&this.#u!==i,s=this.#l!==null&&this.#h!==null&&this.#h!==this.#D();(r||n||s)&&this.#x(),this.#d=e,this.#u=i}#x(){this.#E(),this.#T(),this.#l=null,this.#c=0,this.#f=!1,this.#A()}connectedCallback(){if(super.connectedCallback(),this.#C("idle"),this.#e=this.#P()!==null,this.#e){this.#i=new MutationObserver(t=>{t.some(e=>!this.contains(e.target))&&this.#L()}),this.#i.observe(this.parentElement,{childList:!0,subtree:!0});return}this.#r=this.#O()!==null,!this.#r&&(this.#n=this.closest("qti-assessment-item-ref"),this.#n?(this.#o=this.#n,this.#o.addEventListener("qti-assessment-item-connected",this.#s)):(this.#o=this.closest("test-navigation")??this.getRootNode(),this.#o.addEventListener("qc-test-navigate",this.#a),this.#o.addEventListener("cito-test-navigate",this.#a)))}disconnectedCallback(){super.disconnectedCallback(),this.#p&&(this.#p=null,speechSynthesis.cancel()),this.#E(),this.#R(),this.#o?.removeEventListener("qti-assessment-item-connected",this.#s),this.#o?.removeEventListener("qc-test-navigate",this.#a),this.#o?.removeEventListener("cito-test-navigate",this.#a),this.#o=null,this.#n=null,this.#i?.disconnect(),this.#i=null,this.#e=!1,this.#r=!1}render(){return v`<slot></slot>`}#k(){this.#l!==null&&this.#x()}#w(){for(let t of this._computedContext?.testParts??[])for(let e of t.sections)if(e.active)return{item:e.items.find(i=>i.active)?.identifier??null,section:e.identifier};return{item:null,section:null}}#L(){this.#p&&(this.#p=null,speechSynthesis.cancel()),this.#E(),this.#R(),this.#C("idle"),this.#l=null,this.#c=0,this.#f=!1,this.#A()}#P(){return this.parentElement?.querySelector(":scope > [data-stimulus-idref]")??null}#O(){return this.parentElement?.querySelector(":scope > [data-tts-content]")??null}#D(){return this.#e?this.#P()?.querySelector("qti-stimulus-body")??null:this.#r?this.#O():this.#V()?.querySelector("qti-item-body")??null}#V(){if(this.#n)return this.#n.assessmentItem;let{item:t}=this.#w();return t?this._computedContext?.itemElement?.(t)??null:null}#C(t){this._ttsContext={...this._ttsContext,state:t},this.#t.states.delete("idle"),this.#t.states.delete("playing"),this.#t.states.delete("paused"),this.#t.states.add(t)}#A(){this._ttsContext={...this._ttsContext,currentElementIndex:this.#c,elementCount:this.#S().length}}#S(){if(this.#r&&this.#l?.some(t=>!t.isConnected)&&(this.#l=null,this.#c=0,this.#f=!1),this.#l===null){let t=this.#D();if(!t)return[];this.#h=t;let e="p, h1, h2, h3, h4, h5, h6, li, dt, dd, th, td, caption, blockquote, figcaption, qti-prompt, qti-simple-choice";this.#l=Array.from(t.querySelectorAll(e)).filter(i=>(i.textContent??"").trim().length>0&&!i.querySelector(e)&&!i.closest('[aria-hidden="true"]'))}return this.#l.filter(t=>this.#j(t))}#j(t){return typeof t.checkVisibility=="function"?t.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0}):t.getClientRects().length>0}#F(t){let e=t;for(;e;){let r=e.getAttribute("lang")||e.getAttribute("xml:lang");if(r?.trim())return r.trim();e=e.parentElement??e.getRootNode().host??null}let i=document.documentElement.getAttribute("lang");return i?.trim()?i.trim():this.language}#z(){if(!this.#S().length){console.warn("test-item-to-speech: no readable elements found");return}this.#E(),speechSynthesis.cancel(),this.#f&&(this.#f=!1,this.#c=0),this.#r&&this.#c===0&&(this.#l=null),this.#I(this.#c)}#I(t){let e=this.#S();if(t>=e.length){this.#_(),this.#c=e.length-1,e.length>0&&this.#M(e[this.#c]),this.#f=!0,this.#C("idle"),this.#A();return}this.#c=t,this.#f=!1,this.#A();let i=e[t];i.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#M(i),this.#m=this.#J(i);let r=this.#m.map(s=>s.textContent??"").join("");if(!r.trim()){this.#I(t+1);return}let n=new SpeechSynthesisUtterance(r);n.lang=this.#F(i),n.rate=1,n.onboundary=s=>{s.name==="word"&&this.#Y(s.charIndex,s.charLength??0)},n.onend=()=>{this.#p===n&&(this.#p=null,this.#_(),this.#I(this.#c+1))},n.onerror=()=>{this.#p===n&&(this.#p=null,this.#R(),this.#C("idle"))},this.#p=n,speechSynthesis.speak(n),this.#C("playing")}#B(){speechSynthesis.pause(),this.#C("paused")}#U(){speechSynthesis.resume(),this.#C("playing")}#T(){this.#p=null,speechSynthesis.cancel(),this.#R(),this.#C("idle")}#H(){this.#g?this.#E():this.#W()}#W(){this.#r&&(this.#l=null);let t=this.#S();if(!t.length){console.warn("test-item-to-speech: no readable elements found");return}this.#T(),this.#g=!0,this.#t.states.add("picking"),this.#$(t),this.#b=t[0].getRootNode(),this.#b.addEventListener("click",this.#v,!0),this._ttsContext={...this._ttsContext,picking:!0}}#E(){this.#g&&(this.#g=!1,this.#t.states.delete("picking"),this.#b?.removeEventListener("click",this.#v,!0),this.#b=null,this.#R(),this._ttsContext={...this._ttsContext,picking:!1})}#Q(t){let e=this.#S(),i=t.composedPath(),r=e.findIndex(n=>i.includes(n));if(r<0){let n=i.find(s=>s instanceof Element&&s.matches("qti-simple-choice, li, qti-prompt"));n&&(r=e.findIndex(s=>n.contains(s)))}r<0||(t.preventDefault(),t.stopPropagation(),this.#E(),speechSynthesis.cancel(),this.#I(r))}#X(){let t=this.#S();if(!t.length)return;this.#p=null,speechSynthesis.cancel(),this.#_(),this.#c=Math.max(0,this.#c-1),this.#f=!1,this.#A();let e=t[this.#c];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#M(e),this.#C("idle")}#G(){let t=this.#S();if(!t.length)return;this.#p=null,speechSynthesis.cancel(),this.#_(),this.#c=Math.min(t.length-1,this.#c+1),this.#f=!1,this.#A();let e=t[this.#c];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#M(e),this.#C("idle")}#J(t){let e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),r;for(;r=i.nextNode();)(r.textContent??"").length>0&&!r.parentElement?.closest('[aria-hidden="true"]')&&e.push(r);return e}#M(t){this.#$([t])}#$(t){if("highlights"in CSS){this.#N(),this.#y.clear();for(let e of t){let i=new Range;i.selectNodeContents(e),this.#y.add(i)}CSS.highlights.set(Ko,this.#y)}}#Y(t,e){if(!("highlights"in CSS))return;this.#N(),this.#q.clear();let i=this.#m.map(d=>d.textContent??"").join(""),r=t+(e>0?e:this.#K(t,i)),n=0,s=null,a=0,l=null,c=0;for(let d of this.#m){let h=d.textContent?.length??0;if(!s&&n+h>t&&(s=d,a=t-n),s&&n+h>=r){l=d,c=r-n;break}n+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#q.add(d),CSS.highlights.set(Zo,this.#q)}}#_(){"highlights"in CSS&&(this.#q.clear(),CSS.highlights.get(Zo)===this.#q&&CSS.highlights.delete(Zo))}#R(){"highlights"in CSS&&(this.#_(),this.#y.clear(),CSS.highlights.get(Ko)===this.#y&&CSS.highlights.delete(Ko))}#K(t,e){let i=e.slice(t).search(/\s/);return i<0?e.length-t:i}#N(){if(!("highlights"in CSS))return;let t=xf();document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]);let e=new Set,i=this.getRootNode();i instanceof ShadowRoot&&e.add(i);let r=this.#l?.[0]?.getRootNode();r instanceof ShadowRoot&&e.add(r);for(let n of e)n.adoptedStyleSheets.includes(t)||(n.adoptedStyleSheets=[...n.adoptedStyleSheets,t])}};or([p({type:String})],vi.prototype,"language",void 0);or([I({context:z,subscribe:!0})],vi.prototype,"_computedContext",void 0);or([R(),X({context:Bh})],vi.prototype,"_ttsContext",void 0);var xn=class extends jt{#t(){this._tts&&(this._tts.state==="idle"?this._tts.play():this._tts.state==="playing"?this._tts.pause():this._tts.resume())}render(){let t=this._tts?.state==="playing";return v`
6601
- <button part="button" aria-label=${G(t?this.pauseLabel:this.label)} @click=${this.#t}>
6602
- ${t?v`<slot name="pause">${Fe("pause",this.pauseLabel??"Pause")}</slot>`:v`<slot name="play">${Fe("play",this.label??"Play")}</slot>`}
6603
- </button>
6604
- `}};or([p({type:String,attribute:"pause-label"})],xn.prototype,"pauseLabel",void 0);var ts=class extends jt{render(){return v`
6605
- <button
6606
- part="button"
6607
- aria-label=${G(this.label)}
6608
- ?disabled=${this._tts?.state!=="playing"}
6609
- @click=${()=>this._tts?.pause()}
6610
- >
6611
- <slot>${Fe("pause",this.label??"Pause")}</slot>
6612
- </button>
6613
- `}},es=class extends jt{render(){return v`
6614
- <button
6615
- part="button"
6616
- aria-label=${G(this.label)}
6617
- ?disabled=${this._tts?.state!=="paused"}
6618
- @click=${()=>this._tts?.resume()}
6619
- >
6620
- <slot>${Fe("play",this.label??"Resume")}</slot>
6621
- </button>
6622
- `}},is=class extends jt{render(){let t=this._tts?.state==="idle"&&!this._tts?.picking;return v`
6623
- <button part="button" aria-label=${G(this.label)} ?disabled=${t} @click=${()=>this._tts?.stop()}>
6624
- <slot>${Fe("stop",this.label??"Stop")}</slot>
6625
- </button>
6626
- `}},rs=class extends jt{render(){let t=(this._tts?.elementCount??0)>0,e=(this._tts?.currentElementIndex??0)===0;return v`
6627
- <button
6628
- part="button"
6629
- aria-label=${G(this.label)}
6630
- ?disabled=${t&&e}
6631
- @click=${()=>this._tts?.prevElement()}
6632
- >
6633
- <slot>${Fe("prev",this.label??"Previous sentence")}</slot>
6634
- </button>
6635
- `}},ns=class extends jt{render(){let t=this._tts?.elementCount??0,e=t>0&&(this._tts?.currentElementIndex??0)>=t-1;return v`
6636
- <button
6637
- part="button"
6638
- aria-label=${G(this.label)}
6639
- ?disabled=${e}
6640
- @click=${()=>this._tts?.nextElement()}
6641
- >
6642
- <slot>${Fe("next",this.label??"Next sentence")}</slot>
6643
- </button>
6644
- `}},os=class extends jt{get selected(){return this._tts?.picking??!1}render(){return v`
6645
- <button
6646
- part="button"
6647
- aria-label=${G(this.label)}
6648
- aria-pressed=${this._tts?.picking?"true":"false"}
6649
- @click=${()=>this._tts?.togglePick()}
6650
- >
6651
- <slot>${Fe("pick",this.label??"Read from here")}</slot>
6652
- </button>
6653
- `}};var Uh=[{tag:"test-item-to-speech",ctor:vi},{tag:"test-tts-next",ctor:ns},{tag:"test-tts-pause",ctor:ts},{tag:"test-tts-pick",ctor:os},{tag:"test-tts-play",ctor:xn},{tag:"test-tts-prev",ctor:rs},{tag:"test-tts-resume",ctor:es},{tag:"test-tts-stop",ctor:is}];var Hh=[{tag:"test-check-item",ctor:fi},{tag:"test-bookmark",ctor:je},{tag:"test-print-context",ctor:gn},{tag:"test-print-item-variables",ctor:bn},{tag:"test-print-state",ctor:vn},{tag:"test-scoring-buttons",ctor:gi},{tag:"test-scoring-feedback",ctor:nr},{tag:"test-stamp",ctor:bi},{tag:"test-submit",ctor:Go},{tag:"test-view",ctor:te},{tag:"test-view-toggle",ctor:qn},...Uh];var Wh=[{tag:"qti-assessment-item-ref",ctor:St},{tag:"qti-assessment-section",ctor:Et},{tag:"qti-assessment-test",ctor:ci},{tag:"qti-branch-rule",ctor:ue},{tag:"qti-item-session-control",ctor:Nt},{tag:"qti-number-presented",ctor:tn},{tag:"qti-number-selected",ctor:vo},{tag:"qti-outcome-processing",ctor:qo},{tag:"qti-pre-condition",ctor:yo},{tag:"qti-test",ctor:Le},{tag:"qti-test-feedback",ctor:dn},{tag:"qti-test-part",ctor:Ne},{tag:"qti-test-variables",ctor:hn},{tag:"test-container",ctor:At},{tag:"test-end-attempt",ctor:ye},{tag:"test-item-link",ctor:mn},{tag:"test-navigation",ctor:bt},{tag:"test-next",ctor:ui},{tag:"test-prev",ctor:mi},{tag:"test-section-link",ctor:fn},...Hh];for(let{tag:o,ctor:t}of Wh)customElements.get(o)||customElements.define(o,t);var yi=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ft=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Zt().load(this.itemURL)).shuffleInteractions(t);this.itemDoc=e.htmlDoc(this.#e??void 0)}catch(t){console.error("Error loading or parsing XML:",t)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Zt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#i(),this.#r(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:v``}#r(){let t=new CSSStyleSheet;t.replaceSync(Uo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
6425
+ ${Am};
6426
+ }
6427
+ `;var Zi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},oh=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?oh(e.host):void 0},me=class extends S{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=Oe}constructor(){super(),this._internalDisabled=!1,this.requireAnswer=!1,this.addEventListener("click",t=>{if(t.preventDefault(),!this._internalDisabled){let e=this.#t;F(this,"qc-test-end-attempt",e?{itemId:e}:{})}})}get#t(){return this.item||oh(this)}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts,e=this.#t,r=t?.find(a=>a.active);if(!t||!e&&!r)return;let i=e?t.flatMap(a=>a.sections.flatMap(c=>c.items)).find(a=>a.identifier===e):r.sections.flatMap(a=>a.items).find(a=>a.active);if(!i){this._internalDisabled=!1;return}let n=i.maxAttempts??1,s=i.numAttempts||0;if(!i.adaptive&&i.optimal){this._internalDisabled=!0;return}if(i.adaptive&&i.completionStatus==="completed"){this._internalDisabled=!0;return}if(!i.adaptive&&n>0&&s>=n){this._internalDisabled=!0;return}this.requireAnswer||i.allowSkipping===!1?this._internalDisabled=i.valid===!1||i.isDefaultResponse:this._internalDisabled=!1}render(){return Pe}};Zi([R({context:ct,subscribe:!0}),p({attribute:!1})],me.prototype,"computedContext",void 0);Zi([p({type:Boolean,reflect:!0,attribute:"disabled"})],me.prototype,"_internalDisabled",void 0);Zi([p({reflect:!0})],me.prototype,"item",void 0);Zi([p({type:Boolean,reflect:!0,attribute:"require-answer"})],me.prototype,"requireAnswer",void 0);Zi([N("computedContext")],me.prototype,"_handleTestElementChange",null);var or=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Rm=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),mt=class extends S{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=Rm())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#r(t)}#t;#e;#r(t){let e=this.#n();e?e.qtiContext=t:this.#t=t}#i;#n(){return this.#i.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#i=new at(this,{context:Ce,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#p=t=>this.#c(t)??null,this.#b=new WeakSet,B(this,"qc-test-loaded",this.#u.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#m.bind(this)),ad(this,"qc-item-response-changed",this.#h.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),B(this,"qc-test-end-attempt",this.#l.bind(this)),B(this,"qc-test-update-outcome",this.#d.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=this.#q(e);this.#s.set(e.identifier,r);let i=this.computedItemFor(e.identifier),n=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,this.#y(n,r,i?.maxAttempts,i?.adaptive,s))}afterAttemptEnded(t,e,r){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#c(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#p;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#l(t){let e=t.detail?.itemId,r=e?this.#c(e):this.activeAssessmentItem;if(!r)return;let i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#d(t){let e=this.#c(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#h(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}}}render(){return v`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#r({QTI_CONTEXT:{...i,testIdentifier:this.#o.identifier,environmentIdentifier:i.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=this.#g(i);Object.keys(n).length>0&&this.#r({QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let r=Array.from(this.#o?.querySelectorAll("qti-test-part")||[]);this.computedContext={itemElement:this.#p,identifier:this.#o.identifier,title:this.#o.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:r.map(i=>{let n=[...i.querySelectorAll("qti-assessment-section")],s=i.querySelector(":scope > qti-item-session-control"),a=s?s.allowSkipping:!0,c=s?s.maxAttempts:1,l=s?s.showFeedback:!1,d=s?s.showSolution:!1;return{active:!1,identifier:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,allowSkipping:a,sections:n.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),y=m?m.allowSkipping:a,x=m?m.maxAttempts:c,u=m?m.showFeedback:l,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:y,items:f.map(b=>{let q=b.querySelector(":scope > qti-item-session-control"),_=q?q.allowSkipping:y,A=q?q.maxAttempts:x,C=q?q.showFeedback:u,k=q?q.showSolution:g;return{...this.initContext?.find(I=>I.identifier===b.identifier),active:!1,identifier:b.identifier,categories:b.category?b.category?.split(" "):[],href:b.href,variables:[],allowSkipping:_,maxAttempts:A,showFeedback:C,showSolution:k}})}})}})}}#g(t){let e={},r=t.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let s=n.getAttribute("field-identifier"),a=n.getAttribute("base-type")||"string",c=n.textContent?.trim()||"";if(s){let l=c;switch(a){case"integer":l=parseInt(c,10);break;case"float":case"duration":l=parseFloat(c);break;case"boolean":l=c.toLowerCase()==="true";break;default:l=c;break}e[s]=l}}),e}#m(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(r=>({...r,sections:r.sections.map(i=>({...i,items:i.items.map(n=>{if(n.identifier!==e.parentElement.getAttribute("identifier"))return n;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),c=e.querySelectorAll("qti-response-declaration"),l=Array.from(c).some(m=>m.querySelector("qti-correct-response")),d=Array.from(c).some(m=>{let y=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return y?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=l||d,f=!!e.querySelector("qti-response-processing");return{...n,assessmentItemIdentifier:e.getAttribute("identifier"),label:e.getAttribute("label"),title:e.title,externalScored:a,adaptive:e.adaptive=="true"||!1,timeDependent:e.timeDependent=="true"||!1,variables:e.variables,hasCorrectResponse:h,hasResponseProcessing:f}})}))}))}}willUpdate(t){if(!this.computedContext)return;let e=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(r=>({...r,active:this._sessionContext?.navPartId===r.identifier||!1,sections:r.sections.map(i=>({...i,active:this._sessionContext?.navSectionId===i.identifier||!1,completed:i.items.every(n=>this._testContext.items.find(s=>s.identifier===n.identifier)?.variables.find(s=>s.identifier==="completionStatus")?.value==="completed"),items:i.items.map(n=>{let s=this._testContext?.items.find(C=>C.identifier===n.identifier),a={...n,...s,...this.initContext?.find(C=>C.identifier===n.identifier)},c=a.variables?.find(C=>C.identifier=="SCORE")?.value,l=c==null?null:parseFloat(c?.toString()),d=a.variables?.find(C=>C.identifier==="completionStatus")?.value,h=a.variables?.find(C=>C.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(C=>C.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(C=>C.type==="response"&&C.identifier!=="numAttempts")||[]).every(C=>{if(C.value===void 0||C.value===null)return!0;let k;switch(C.baseType){case"integer":case"float":case"duration":k="0";break;case"boolean":k="false";break;default:k="";break}let I=C.defaultValue??k;if(Array.isArray(C.value)){let $=Array.isArray(I)?I:[I];return C.value.length===$.length&&C.value.every((V,L)=>V===$[L])}return C.value===I}),g=n.categories.includes(this.configContext?.infoItemCategory)?null:e++,b=n.variables?.find(C=>C.identifier=="MAXSCORE")?.value,q=b==null?null:parseFloat(b?.toString()),_=this.#s.get(a.identifier);_===void 0&&(_=s?this.#q(s):"unscored",f>0&&this.#s.set(a.identifier,_));let A=this.#y(f,_,a.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:l,response:h,index:g,active:m,valid:y,isDefaultResponse:u,maxScore:q,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}updated(t){super.updated(t),this.#f()}#b;#f(){if(!this.#o||!this.computedContext)return;let t=new Map(this.computedContext.testParts.flatMap(e=>e.sections.flatMap(r=>(r.submissionMode||e.submissionMode)==="simultaneous"?[]:r.items.map(i=>[i.identifier,i]))));for(let e of this.#o.querySelectorAll("qti-assessment-item-ref")){let r=e.assessmentItem;if(!r)continue;let i=this.#v(t.get(e.identifier),r);i&&!r.disabled?(r.disabled=!0,this.#b.add(r)):!i&&this.#b.has(r)&&(this.#b.delete(r),r.disabled=!1)}}#v(t,e){if(!t||this.autoScoreItems||t.adaptive||e.adaptive==="true")return!1;let r=t.maxAttempts??1;return r>0&&(t.numAttempts??0)>=r}#y(t,e,r,i,n){if(t===0)return!1;if(i)return n==="completed";if(e!=="suboptimal")return!0;let s=r??1;return s>0&&t>=s}#q(t){let e=t.variables??[],r=this.#x(e,"SCORE"),i=this.#x(e,"MAXSCORE");if(r!==null&&i!==null)return r>=i?"optimal":"suboptimal";let n=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return n.length===0?"unscored":n.every(a=>{let c=a.correctResponse,l=a.value;return l==null?!1:Array.isArray(c)&&Array.isArray(l)?c.length===l.length&&c.every(d=>l.includes(d)):Array.isArray(c)||Array.isArray(l)?!1:c===l})?"optimal":"suboptimal"}#x(t,e){let r=t?.find(n=>n.identifier===e)?.value;if(r==null||Array.isArray(r))return null;let i=parseFloat(r.toString());return Number.isNaN(i)?null:i}};or([p({type:String})],mt.prototype,"identifier",void 0);or([T()],mt.prototype,"initContext",void 0);or([T(),R({context:yt,subscribe:!0})],mt.prototype,"configContext",void 0);or([T(),R({context:nt,subscribe:!0})],mt.prototype,"_testContext",void 0);or([T(),R({context:Jn,subscribe:!0})],mt.prototype,"_sessionContext",void 0);or([T(),J({context:ct})],mt.prototype,"computedContext",void 0);or([p({type:Boolean,attribute:"auto-score-items"})],mt.prototype,"autoScoreItems",void 0);var mc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},sr=class extends S{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[Oe,nh]}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),r=e?.navigationMode||t.navigationMode,i=e?.submissionMode||t.submissionMode,n=this.sectionItems[this.itemIndex],s=r==="linear"&&i==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!n?.done}_requestItem(t){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return Pe}};mc([p({type:Boolean,reflect:!0,attribute:"disabled"})],sr.prototype,"_internalDisabled",void 0);mc([R({context:ct,subscribe:!0})],sr.prototype,"computedContext",void 0);mc([N("computedContext")],sr.prototype,"_handleTestElementChange",null);var fc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ar=class extends S{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=Oe}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(i=>i.active),r=t?.sections.find(i=>i.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=r==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return Pe}};fc([p({type:Boolean,reflect:!0,attribute:"disabled"})],ar.prototype,"_internalDisabled",void 0);fc([R({context:ct,subscribe:!0})],ar.prototype,"computedContext",void 0);fc([N("computedContext")],ar.prototype,"_handleTestElementChange",null);var Io=class extends S{static{this.styles=Oe}constructor(){super(),this.addEventListener("click",()=>F(this,"qc-test-submit",{}))}render(){return Pe}};var sh=[{tag:"test-submit",ctor:Io}];var ah=[{tag:"qti-assessment-item-ref",ctor:wt},{tag:"qti-assessment-section",ctor:Ct},{tag:"qti-assessment-test",ctor:rr},{tag:"qti-branch-rule",ctor:le},{tag:"qti-item-session-control",ctor:Pt},{tag:"qti-number-presented",ctor:Fi},{tag:"qti-number-selected",ctor:to},{tag:"qti-outcome-processing",ctor:ro},{tag:"qti-pre-condition",ctor:eo},{tag:"qti-test",ctor:Ie},{tag:"qti-test-feedback",ctor:Ji},{tag:"qti-test-part",ctor:Re},{tag:"qti-test-variables",ctor:Yi},{tag:"test-container",ctor:St},{tag:"test-end-attempt",ctor:me},{tag:"test-navigation",ctor:mt},{tag:"test-next",ctor:sr},{tag:"test-prev",ctor:ar},...sh];for(let{tag:o,ctor:t}of ah)customElements.get(o)||customElements.define(o,t);var KS=(o,t)=>o?.plugins?.[t];var cr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},$t=class extends S{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Gt().load(this.itemURL)).shuffleInteractions(t);this.itemDoc=e.htmlDoc(this.#e??void 0)}catch(t){console.error("Error loading or parsing XML:",t)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Gt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#r(){let t=this.querySelector("template");this.#t=t?t.content:v``}#i(){let t=new CSSStyleSheet;t.replaceSync(Ao),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
6654
6428
  ${this.#t}
6655
6429
  <slot></slot>
6656
- ${Bo(this.itemDoc,v`<span>Loading...</span>`)}
6657
- `}};yi([p({attribute:!1})],Ft.prototype,"customElementRegistry",void 0);yi([p({type:String,attribute:"item-url"})],Ft.prototype,"itemURL",void 0);yi([R()],Ft.prototype,"itemDoc",void 0);yi([R()],Ft.prototype,"itemXML",void 0);yi([R(),I({context:Ct,subscribe:!0})],Ft.prototype,"qtiContext",void 0);yi([N("itemURL",{waitUntilFirstUpdate:!0})],Ft.prototype,"handleItemURLChange",null);yi([N("itemXML",{waitUntilFirstUpdate:!0})],Ft.prototype,"handleItemXMLChange",null);var Cf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},wn=class extends C{static{this.styles=w`
6430
+ ${Eo(this.itemDoc,v`<span>Loading...</span>`)}
6431
+ `}};cr([p({attribute:!1})],$t.prototype,"customElementRegistry",void 0);cr([p({type:String,attribute:"item-url"})],$t.prototype,"itemURL",void 0);cr([T()],$t.prototype,"itemDoc",void 0);cr([T()],$t.prototype,"itemXML",void 0);cr([T(),R({context:qt,subscribe:!0})],$t.prototype,"qtiContext",void 0);cr([N("itemURL",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemURLChange",null);cr([N("itemXML",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemXMLChange",null);var Im=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},tn=class extends S{static{this.styles=w`
6658
6432
  table {
6659
6433
  width: 100%;
6660
6434
  border-collapse: collapse;
@@ -6675,7 +6449,7 @@ div.full-correct-response-inline {
6675
6449
  margin-top: 20px;
6676
6450
  font-size: 16px;
6677
6451
  }
6678
- `}render(){let t=this.computedContext;if(!t||!t.variables)return v``;let e=t.variables.filter(n=>n.type==="response"),i=t.variables.filter(n=>n.type==="outcome"),r=(n,s)=>v`
6452
+ `}render(){let t=this.computedContext;if(!t||!t.variables)return v``;let e=t.variables.filter(n=>n.type==="response"),r=t.variables.filter(n=>n.type==="outcome"),i=(n,s)=>v`
6679
6453
  <h3>${s}</h3>
6680
6454
  <table>
6681
6455
  <thead>
@@ -6688,20 +6462,20 @@ div.full-correct-response-inline {
6688
6462
  </tr>
6689
6463
  </thead>
6690
6464
  <tbody>
6691
- ${n.map(a=>{let l=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",c=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return v`
6465
+ ${n.map(a=>{let c=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",l=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return v`
6692
6466
  <tr>
6693
6467
  <td>${a.identifier}</td>
6694
6468
  <td>${Array.isArray(a.value)?a.value.join(", "):a.value}</td>
6695
6469
  <td>${a.cardinality}</td>
6696
6470
  <td>${a.baseType}</td>
6697
- <td>${l||c||d}</td>
6471
+ <td>${c||l||d}</td>
6698
6472
  </tr>
6699
6473
  `})}
6700
6474
  </tbody>
6701
6475
  </table>
6702
6476
  `;return v`
6703
- ${r(e,"Response Variables")} ${r(i,"Outcome Variables")}
6704
- `}};Cf([I({context:_e,subscribe:!0})],wn.prototype,"computedContext",void 0);var kf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Qh=o=>{class t extends o{#t;constructor(...i){super(...i),this.view="candidate",this.addEventListener("qti-assessment-item-connected",r=>{this.#t=r.detail,this.#e()}),this.addEventListener("item-switch-view",r=>{this.view=r.detail})}willUpdate(i){super.willUpdate(i),i.has("view")&&this.#e()}#e(){let i=this.#t;i&&(i.querySelectorAll("[view]").forEach(r=>{r.classList.toggle("show",r.getAttribute("view")===this.view)}),this.updateAssessmentItemView(i,this.view))}updateAssessmentItemView(i,r){}}return kf([p({type:String})],t.prototype,"view",void 0),t};var Yl=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},qe=class extends Qh(C){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#i.bind(this),this.#e=this.#r.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#i(t){this.#n(t.detail.itemContext.identifier,t.detail?.itemContext?.variables||[])}#r(t){let e=t.detail._context.variables;this.assessmentItem=t.detail,this.computedContext=this.computedContext?.identifier===this.assessmentItem.identifier?{...this.computedContext,title:this.assessmentItem.title}:{identifier:this.assessmentItem.identifier,title:this.assessmentItem.title,adaptive:this.assessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:e},this.#n(this.assessmentItem.identifier,e||[])}#n(t,e){let i=e?.find(c=>c.identifier=="SCORE")?.value,r=parseFloat(i?.toString()),n=e?.find(c=>c.identifier==="completionStatus")?.value,s=r!==void 0&&!isNaN(r)&&r>0,a=r!==void 0&&!isNaN(r)&&r<=0,l=n==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:l,variables:e}}render(){return v`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};Yl([R(),X({context:_e})],qe.prototype,"computedContext",void 0);Yl([R(),X({context:wt})],qe.prototype,"configContext",void 0);Yl([R(),X({context:Ct})],qe.prototype,"qtiContext",void 0);var Xh=[{tag:"item-container",ctor:Ft},{tag:"item-print-variables",ctor:wn},{tag:"qti-item",ctor:qe}];for(let{tag:o,ctor:t}of Xh)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of wh)customElements.get(o)||customElements.define(o,t);var Gh=(o,t,e)=>{let i=new Map;for(let r=t;r<=e;r++)i.set(o[r],r);return i},W=Lt(class extends Oe{constructor(o){if(super(o),o.type!==ir.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);let r=[],n=[],s=0;for(let a of o)r[s]=i?i(a,s):s,n[s]=e(a,s),s++;return{values:n,keys:r}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,i]){let r=qh(o),{values:n,keys:s}=this.dt(t,e,i);if(!Array.isArray(r))return this.ut=s,n;let a=this.ut??=[],l=[],c,d,h=0,f=r.length-1,m=0,y=n.length-1;for(;h<=f&&m<=y;)if(r[h]===null)h++;else if(r[f]===null)f--;else if(a[h]===s[m])l[m]=De(r[h],n[m]),h++,m++;else if(a[f]===s[y])l[y]=De(r[f],n[y]),f--,y--;else if(a[h]===s[y])l[y]=De(r[h],n[y]),rr(o,l[y+1],r[h]),h++,y--;else if(a[f]===s[m])l[m]=De(r[f],n[m]),rr(o,r[h],r[f]),f--,m++;else if(c===void 0&&(c=Gh(s,m,y),d=Gh(a,h,f)),c.has(a[h]))if(c.has(a[f])){let x=d.get(s[m]),u=x!==void 0?r[x]:null;if(u===null){let g=rr(o,r[h]);De(g,n[m]),l[m]=g}else l[m]=De(u,n[m]),rr(o,r[h],u),r[x]=null;m++}else Mo(r[f]),f--;else Mo(r[h]),h++;for(;m<=y;){let x=rr(o,l[y+1]);De(x,n[m]),l[m++]=x}for(;h<=f;){let x=r[h++];x!==null&&Mo(x)}return this.ut=s,yh(o,l),ot}});var ze=Symbol("dragDropContext");var Jh=[M,Jt,w`
6477
+ ${i(e,"Response Variables")} ${i(r,"Outcome Variables")}
6478
+ `}};Im([R({context:we,subscribe:!0})],tn.prototype,"computedContext",void 0);var Mm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ch=o=>{class t extends o{#t;constructor(...r){super(...r),this.view="candidate",this.addEventListener("qti-assessment-item-connected",i=>{this.#t=i.detail,this.#e()}),this.addEventListener("item-switch-view",i=>{this.view=i.detail})}willUpdate(r){super.willUpdate(r),r.has("view")&&this.#e()}#e(){let r=this.#t;r&&(r.querySelectorAll("[view]").forEach(i=>{i.classList.toggle("show",i.getAttribute("view")===this.view)}),this.updateAssessmentItemView(r,this.view))}updateAssessmentItemView(r,i){}}return Mm([p({type:String})],t.prototype,"view",void 0),t};var gc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fe=class extends ch(S){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#r.bind(this),this.#e=this.#i.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#r(t){this.#n(t.detail.itemContext.identifier,t.detail?.itemContext?.variables||[])}#i(t){let e=t.detail._context.variables;this.assessmentItem=t.detail,this.computedContext=this.computedContext?.identifier===this.assessmentItem.identifier?{...this.computedContext,title:this.assessmentItem.title}:{identifier:this.assessmentItem.identifier,title:this.assessmentItem.title,adaptive:this.assessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:e},this.#n(this.assessmentItem.identifier,e||[])}#n(t,e){let r=e?.find(l=>l.identifier=="SCORE")?.value,i=parseFloat(r?.toString()),n=e?.find(l=>l.identifier==="completionStatus")?.value,s=i!==void 0&&!isNaN(i)&&i>0,a=i!==void 0&&!isNaN(i)&&i<=0,c=n==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:c,variables:e}}render(){return v`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};gc([T(),J({context:we})],fe.prototype,"computedContext",void 0);gc([T(),J({context:yt})],fe.prototype,"configContext",void 0);gc([T(),J({context:qt})],fe.prototype,"qtiContext",void 0);var lh=[{tag:"item-container",ctor:$t},{tag:"item-print-variables",ctor:tn},{tag:"qti-item",ctor:fe}];for(let{tag:o,ctor:t}of lh)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of zd)customElements.get(o)||customElements.define(o,t);var dh=(o,t,e)=>{let r=new Map;for(let i=t;i<=e;i++)r.set(o[i],i);return r},H=Ot(class extends Ae{constructor(o){if(super(o),o.type!==Hr.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let i=[],n=[],s=0;for(let a of o)i[s]=r?r(a,s):s,n[s]=e(a,s),s++;return{values:n,keys:i}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,r]){let i=jd(o),{values:n,keys:s}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=s,n;let a=this.ut??=[],c=[],l,d,h=0,f=i.length-1,m=0,y=n.length-1;for(;h<=f&&m<=y;)if(i[h]===null)h++;else if(i[f]===null)f--;else if(a[h]===s[m])c[m]=_e(i[h],n[m]),h++,m++;else if(a[f]===s[y])c[y]=_e(i[f],n[y]),f--,y--;else if(a[h]===s[y])c[y]=_e(i[h],n[y]),Wr(o,c[y+1],i[h]),h++,y--;else if(a[f]===s[m])c[m]=_e(i[f],n[m]),Wr(o,i[h],i[f]),f--,m++;else if(l===void 0&&(l=dh(s,m,y),d=dh(a,h,f)),l.has(a[h]))if(l.has(a[f])){let x=d.get(s[m]),u=x!==void 0?i[x]:null;if(u===null){let g=Wr(o,i[h]);_e(g,n[m]),c[m]=g}else c[m]=_e(u,n[m]),Wr(o,i[h],u),i[x]=null;m++}else fo(i[f]),f--;else fo(i[h]),h++;for(;m<=y;){let x=Wr(o,c[y+1]);_e(x,n[m]),c[m++]=x}for(;h<=f;){let x=i[h++];x!==null&&fo(x)}return this.ut=s,Vd(o,c),it}});var De=Symbol("dragDropContext");var hh=[M,Wt,w`
6705
6479
  /* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
6706
6480
  custom properties on its host; the properties themselves live here. */
6707
6481
  :host {
@@ -6725,9 +6499,9 @@ div.full-correct-response-inline {
6725
6499
  [part~='chip'] {
6726
6500
  flex-shrink: 0;
6727
6501
  }
6728
- `];var Yh=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},sr=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=Jh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return v`<div part="drop">
6729
- ${W(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6730
- </div>`}};Yh([p({type:String,reflect:!0})],sr.prototype,"identifier",void 0);Yh([I({context:ze,subscribe:!0}),R()],sr.prototype,"_dragDrop",void 0);var Kh=[{tag:"qti-associable-hotspot",ctor:sr}];var Zh=[M,Jt,w`
6502
+ `];var ph=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Qr=class extends S{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=hh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return v`<div part="drop">
6503
+ ${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6504
+ </div>`}};ph([p({type:String,reflect:!0})],Qr.prototype,"identifier",void 0);ph([R({context:De,subscribe:!0}),T()],Qr.prototype,"_dragDrop",void 0);var uh=[{tag:"qti-associable-hotspot",ctor:Qr}];var mh=[M,Wt,w`
6731
6505
  /*
6732
6506
  * A drop target. The interaction measures its chips and publishes the result as custom
6733
6507
  * properties on its own host; the actual CSS properties live here, not in a style attribute.
@@ -6772,9 +6546,9 @@ div.full-correct-response-inline {
6772
6546
  min-height: var(--qti-dropzone-min-height, 0);
6773
6547
  min-width: var(--qti-dropzone-min-width, 0);
6774
6548
  }
6775
- `];var Kl=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},qi=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=Zh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`<div part="drop">
6776
- ${W(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6777
- </div>`}};Kl([p({type:Number,reflect:!0})],qi.prototype,"tabindex",void 0);Kl([p({type:String,reflect:!0})],qi.prototype,"identifier",void 0);Kl([I({context:ze,subscribe:!0}),R()],qi.prototype,"_dragDrop",void 0);var tp=[{tag:"qti-gap",ctor:qi}];var ep=[M,w`
6549
+ `];var bc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lr=class extends S{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=mh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`<div part="drop">
6550
+ ${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6551
+ </div>`}};bc([p({type:Number,reflect:!0})],lr.prototype,"tabindex",void 0);bc([p({type:String,reflect:!0})],lr.prototype,"identifier",void 0);bc([R({context:De,subscribe:!0}),T()],lr.prototype,"_dragDrop",void 0);var fh=[{tag:"qti-gap",ctor:lr}];var gh=[M,w`
6778
6552
  /* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
6779
6553
  graphic-gap-match rules, on the host from the document. */
6780
6554
  :host {
@@ -6787,7 +6561,7 @@ div.full-correct-response-inline {
6787
6561
  anywhere else it is unset and the chip keeps its size. */
6788
6562
  zoom: var(--qti-graphic-scale, 1);
6789
6563
  }
6790
- `];var Sf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Cn=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=ep}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<slot part="label"></slot>`}};Sf([p({type:Number,reflect:!0})],Cn.prototype,"tabindex",void 0);var ip=[{tag:"qti-gap-img",ctor:Cn}];var xi=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},rp={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function _t(o,t,{activateOn:e="click"}={}){class i extends o{#t;#e;#i(){let s=this._interactionContext?.choiceRole??null;s!==this.#e&&(this.#e&&this.internals.states.delete(this.#e),this.#e=s,this.internals.role=s,s&&this.internals.states.add(s))}handleDisabledChange(n,s){s?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=s?-1:0}handleReadonlyChange(n,s){s?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...n){super(...n),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=!1,this.#e=null,this._onMouseDown=s=>{this.disabled&&s.preventDefault()},this._onPointerDown=s=>{this.#t=!1,!(e!=="press"||s.button!==0||!s.isPrimary)&&(this.hasAttribute("data-draggable")||this.disabled||this.readonly||(this.#t=!0,this.focus(),this._activate()))},this.internals=this.attachInternals()}willUpdate(n){super.willUpdate(n),this.#i()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.addEventListener("pointerdown",this._onPointerDown),this.addEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.removeEventListener("pointerdown",this._onPointerDown),this.removeEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(n){n.altKey||(n.code==="Space"||n.code==="Enter")&&(n.preventDefault(),this._activate())}_onClick(){if(this.#t){this.#t=!1;return}this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return v`<slot></slot>`}}return xi([p({type:String})],i.prototype,"identifier",void 0),xi([p({type:Number,reflect:!0,attribute:"tabindex"})],i.prototype,"tabIndex",void 0),xi([p({type:Boolean,attribute:"aria-disabled",converter:rp})],i.prototype,"disabled",void 0),xi([p({type:Boolean,attribute:"aria-readonly",converter:rp})],i.prototype,"readonly",void 0),xi([I({context:ji,subscribe:!0}),R()],i.prototype,"_interactionContext",void 0),xi([N("disabled",{waitUntilFirstUpdate:!0})],i.prototype,"handleDisabledChange",null),xi([N("readonly",{waitUntilFirstUpdate:!0})],i.prototype,"handleReadonlyChange",null),i}var np=[M,w`
6564
+ `];var Pm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},en=class extends S{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=gh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<slot part="label"></slot>`}};Pm([p({type:Number,reflect:!0})],en.prototype,"tabindex",void 0);var bh=[{tag:"qti-gap-img",ctor:en}];var dr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vh={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function Et(o,t,{activateOn:e="click"}={}){class r extends o{#t;#e;#r(){let s=this._interactionContext?.choiceRole??null;s!==this.#e&&(this.#e&&this.internals.states.delete(this.#e),this.#e=s,this.internals.role=s,s&&this.internals.states.add(s))}handleDisabledChange(n,s){s?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=s?-1:0}handleReadonlyChange(n,s){s?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...n){super(...n),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=!1,this.#e=null,this._onMouseDown=s=>{this.disabled&&s.preventDefault()},this._onPointerDown=s=>{this.#t=!1,!(e!=="press"||s.button!==0||!s.isPrimary)&&(this.hasAttribute("data-draggable")||this.disabled||this.readonly||(this.#t=!0,this.focus(),this._activate()))},this.internals=this.attachInternals()}willUpdate(n){super.willUpdate(n),this.#r()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.addEventListener("pointerdown",this._onPointerDown),this.addEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.removeEventListener("pointerdown",this._onPointerDown),this.removeEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(n){n.altKey||(n.code==="Space"||n.code==="Enter")&&(n.preventDefault(),this._activate())}_onClick(){if(this.#t){this.#t=!1;return}this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return v`<slot></slot>`}}return dr([p({type:String})],r.prototype,"identifier",void 0),dr([p({type:Number,reflect:!0,attribute:"tabindex"})],r.prototype,"tabIndex",void 0),dr([p({type:Boolean,attribute:"aria-disabled",converter:vh})],r.prototype,"disabled",void 0),dr([p({type:Boolean,attribute:"aria-readonly",converter:vh})],r.prototype,"readonly",void 0),dr([R({context:Tr,subscribe:!0}),T()],r.prototype,"_interactionContext",void 0),dr([N("disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",null),dr([N("readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",null),r}var yh=[M,w`
6791
6565
  /*
6792
6566
  * A chip's own box. Both drag-drop interactions that use this element laid it out from the
6793
6567
  * theme — gap-match with 'display: flex !important; align-items: center !important',
@@ -6830,8 +6604,8 @@ div.full-correct-response-inline {
6830
6604
  align-items: center;
6831
6605
  justify-content: center;
6832
6606
  }
6833
- `];var Ef=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Be=class extends _t(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=np}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<div part="control"></div>
6834
- <slot part="label"></slot>`}};Ef([p({type:Number,reflect:!0})],Be.prototype,"tabindex",void 0);var op=[{tag:"qti-gap-text",ctor:Be}];var sp=[M,w`
6607
+ `];var Om=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},$e=class extends Et(S,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=yh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<div part="control"></div>
6608
+ <slot part="label"></slot>`}};Om([p({type:Number,reflect:!0})],$e.prototype,"tabindex",void 0);var qh=[{tag:"qti-gap-text",ctor:$e}];var xh=[M,w`
6835
6609
  :host {
6836
6610
  display: flex;
6837
6611
  user-select: none;
@@ -6851,7 +6625,7 @@ div.full-correct-response-inline {
6851
6625
  display: grid;
6852
6626
  place-content: center;
6853
6627
  }
6854
- `];var Af=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},wi=class extends _t(C,"qti-hotspot-choice"){static{this.styles=sp}updated(t){super.updated(t),t.has("order")&&(this.order===void 0||this.order===null?this.removeAttribute("data-order"):this.setAttribute("data-order",String(this.order)))}};Af([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],wi.prototype,"order",void 0);var ap=[{tag:"qti-hotspot-choice",ctor:wi}];var lp=[M,w`
6628
+ `];var Dm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},hr=class extends Et(S,"qti-hotspot-choice"){static{this.styles=xh}updated(t){super.updated(t),t.has("order")&&(this.order===void 0||this.order===null?this.removeAttribute("data-order"):this.setAttribute("data-order",String(this.order)))}};Dm([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],hr.prototype,"order",void 0);var wh=[{tag:"qti-hotspot-choice",ctor:hr}];var Ch=[M,w`
6855
6629
  /* 'position: relative' is the containing block for the answer-key tick the theme draws as an
6856
6630
  absolutely positioned ::before. See CONTRACT.md §7. */
6857
6631
  :host {
@@ -6871,8 +6645,8 @@ div.full-correct-response-inline {
6871
6645
  [part='control'] {
6872
6646
  display: none;
6873
6647
  }
6874
- `];var Ci=class extends _t(C,"qti-hottext"){static{this.styles=lp}render(){return v`<div part="control"><div part="control-mark"></div></div>
6875
- <slot part="label"></slot>`}};var cp=[{tag:"qti-hottext",ctor:Ci}];var _f=w`
6648
+ `];var pr=class extends Et(S,"qti-hottext"){static{this.styles=Ch}render(){return v`<div part="control"><div part="control-mark"></div></div>
6649
+ <slot part="label"></slot>`}};var kh=[{tag:"qti-hottext",ctor:pr}];var $m=w`
6876
6650
  /*
6877
6651
  * An option row: one line, clipped, with its text centred against the row's min-height. All four
6878
6652
  * were in the theme, set on this host from the document — which is also why the 'display: block'
@@ -6895,13 +6669,13 @@ div.full-correct-response-inline {
6895
6669
  slot {
6896
6670
  display: inline;
6897
6671
  }
6898
- `,dp=_f;var Rf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},kn=class extends _t(C,"qti-inline-choice"){static{this.styles=dp}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#t),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#t)}render(){return v` <slot></slot> `}#t(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};Rf([p({type:String})],kn.prototype,"identifier",void 0);var hp=[{tag:"qti-inline-choice",ctor:kn}];var pp=[M,w`
6672
+ `,Sh=$m;var Nm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},rn=class extends Et(S,"qti-inline-choice"){static{this.styles=Sh}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#t),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#t)}render(){return v` <slot></slot> `}#t(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};Nm([p({type:String})],rn.prototype,"identifier",void 0);var Eh=[{tag:"qti-inline-choice",ctor:rn}];var Ah=[M,w`
6899
6673
  :host {
6900
6674
  display: block;
6901
6675
  margin: var(--qti-gap) 0;
6902
6676
  width: 100%;
6903
6677
  }
6904
- `];var ss=class extends C{static{this.styles=pp}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var up=[{tag:"qti-prompt",ctor:ss}];var mp=[M,Jt,w`
6678
+ `];var Mo=class extends S{static{this.styles=Ah}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var _h=[{tag:"qti-prompt",ctor:Mo}];var Th=[M,Wt,w`
6905
6679
  /*
6906
6680
  * 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
6907
6681
  * way. In tabular match this element is a light-DOM *grandchild* of the slotted
@@ -7050,13 +6824,13 @@ div.full-correct-response-inline {
7050
6824
  align-items: center;
7051
6825
  justify-content: center;
7052
6826
  }
7053
- `];var as=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},zt=class extends _t(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=mp}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`
6827
+ `];var Po=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Nt=class extends Et(S,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=Th}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`
7054
6828
  <div part="control"></div>
7055
6829
  <slot part="label"></slot>
7056
6830
  <div part="drop">
7057
- ${W(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6831
+ ${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
7058
6832
  </div>
7059
- `}};as([p({type:Number,attribute:"match-min"})],zt.prototype,"matchMin",void 0);as([p({type:Number,attribute:"match-max"})],zt.prototype,"matchMax",void 0);as([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],zt.prototype,"fixed",void 0);as([I({context:ze,subscribe:!0}),R()],zt.prototype,"_dragDrop",void 0);var fp=[{tag:"qti-simple-associable-choice",ctor:zt}];var gp=[M,w`
6833
+ `}};Po([p({type:Number,attribute:"match-min"})],Nt.prototype,"matchMin",void 0);Po([p({type:Number,attribute:"match-max"})],Nt.prototype,"matchMax",void 0);Po([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Nt.prototype,"fixed",void 0);Po([R({context:De,subscribe:!0}),T()],Nt.prototype,"_dragDrop",void 0);var Rh=[{tag:"qti-simple-associable-choice",ctor:Nt}];var Ih=[M,w`
7060
6834
  /*
7061
6835
  * 'position: relative' unconditionally, because this element can carry a correction badge and a
7062
6836
  * badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
@@ -7092,9 +6866,9 @@ div.full-correct-response-inline {
7092
6866
  align-items: center;
7093
6867
  justify-content: center;
7094
6868
  }
7095
- `];var ls=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Bt=class extends _t(C,"qti-simple-choice",{activateOn:"press"}){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=gp}get checked(){return this.internals.states.has("checked")}render(){return v`<div part="control"><div part="control-mark"></div></div>
6869
+ `];var Oo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Lt=class extends Et(S,"qti-simple-choice",{activateOn:"press"}){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=Ih}get checked(){return this.internals.states.has("checked")}render(){return v`<div part="control"><div part="control-mark"></div></div>
7096
6870
  ${this.marker?v`<div id="label" part="marker">${this.marker}</div>`:P}
7097
- <slot part="label"></slot>`}};ls([p({type:String,attribute:"template-identifier"})],Bt.prototype,"templateIdentifier",void 0);ls([p({type:String,attribute:"show-hide"})],Bt.prototype,"showHide",void 0);ls([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Bt.prototype,"fixed",void 0);ls([p({type:String,attribute:!1})],Bt.prototype,"marker",void 0);var bp=[{tag:"qti-simple-choice",ctor:Bt}];var vp=[...Kh,...tp,...ip,...op,...ap,...cp,...hp,...up,...fp,...bp];var If=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n};function Tf(o,t,e,i,r={}){let n=r.publishWidth??!0,s=r.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,l=0,c=i.length?i:[o],d=c.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));c.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),l=Math.max(l,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),r.hasChanged?.({height:a,width:l})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(o.style.setProperty("--qti-dropzone-min-width",`${l}px`),o.style.setProperty("--qti-drag-min-width",`${l}px`)),i.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var Zl=(o,t,e,i='slot[part~="bank"]')=>{class r extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#i=null,this.#r=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#i;#r;#n;collectAutoSizeTargets(){let s=(a,l)=>Array.from(l?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(i,this),...s(i,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&(Tf(this.dropzonePropertyTarget(),s,a,l,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:c=>{let d=this.#n;return d&&d.height===c.height&&d.width===c.width?!1:(this.#n=c,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#i||(this.#i=new MutationObserver(()=>this.#s()),this.#i.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#r||(this.#r=requestAnimationFrame(()=>{this.#r=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let l of this.#e)a.has(l)||this.#t.unobserve(l);for(let l of a)this.#e.has(l)||this.#t.observe(l);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#i?.disconnect(),this.#i=null,this.#r&&cancelAnimationFrame(this.#r),this.#r=0,super.disconnectedCallback()}}return If([p({type:Boolean,attribute:"auto-size-dropzones"})],r.prototype,"autoSizeDropzones",void 0),r};var{AbortController:ee,AbortSignal:tc,WeakMap:Mf,WeakRef:Pf,Window:yp,reportError:cs=console.log}=globalThis,Ue=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||Ue(o.defaultView.parent.document)),ki=()=>!!yp&&globalThis instanceof yp,ec=Symbol("unset"),[qp,Of]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((b,q)=>(x=b,u=q)),resolve:x,reject:u}};function i(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let r=new Mf,n={next(...x){let u=this,g=r.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.next(...x))},return(...x){let u=this,g=r.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.return?b.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=r.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>{if(!b.throw)throw b.return(),new TypeError("no throw method");return b.throw(...x)})}};function s(x){let u=Object.create(n);return r.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let b=i(x,g);return s(b)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return i(x,g)}let l="any"in tc?tc.any.bind(tc):x=>{let u=new ee;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:u,error:g,complete:b}={}){r.set(this,{next:u,error:g,complete:b})}next(u){let{next:g}=r.get(this)||{};g&&g(u)}error(u){let{error:g}=r.get(this)||{};g?g(u):cs(u)}complete(){let{complete:u}=r.get(this)||{};u&&u()}}function h(x,u){let g=r.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let b of g.teardowns.reverse()){if(ki()&&!Ue(document))return;try{b()}catch(q){cs(q)}}}}function f(x,u,g={}){if(ki()&&!Ue(document))return;let b;typeof u=="function"?b=new d({next:u}):u&&!(u instanceof d)?b=new d(u):b=u||new d;let q=r.get(x),_=q.weakSubscriber?.deref();if(_?.active){let k=_,S=r.get(k);S.observers.add(b),g.signal&&(g.signal.aborted?S.observers.delete(b):g.signal.addEventListener("abort",()=>{let T=r.get(k);T?.active&&(T.observers.delete(b),T.observers.size==0&&h(k,g.signal.reason))}));return}let A=new m(b);if(q.weakSubscriber=new Pf(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let k=r.get(A);k?.active&&(k.observers.delete(b),k.observers.size==0&&h(A,g.signal.reason))})),q.subscribeCallback)try{q.subscribeCallback(A)}catch(k){A.error(k)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");r.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new ee})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=r.get(this);if(!g?.active||ki()&&!Ue(document))return;let b=new Set(g.observers);for(let q of b)q.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=r.get(this);if(!g?.active){cs(u);return}if(ki()&&!Ue(document))return;h(this,u);let b=new Set(g.observers);for(let q of b)q.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=r.get(this);if(!u?.active||ki()&&!Ue(document))return;h(this);let g=new Set(u.observers);for(let b of g)b.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(ki()&&!Ue(document))return;let g=r.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!r.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!r.has(this)){let u=new ee;return u.abort(),u.signal}return r.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");r.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let _=function(A,k){if(A.signal.aborted)return;let S;try{let T=k.next();S=Promise.resolve(T)}catch(T){S=Promise.reject(T)}S.then(T=>{if(T===null||typeof T!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:q}=T)}catch(j){A.error(j);return}if(q){A.complete();return}let $;try{$=T.value}catch(j){A.error(j);return}A.next($),_(A,k)},T=>{A.error(T)})},q=!1;return new y(A=>{if(A.signal.aborted)return;let k;try{k=a(u,!0)}catch(T){A.error(T);return}let S=k;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof S.return!="function"||q)return;t(()=>S.return(A.signal.reason)).then($=>{if($===null||typeof $!="object")throw new TypeError("Iterator .return() must return an Object")})}),_(A,S))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(q=>{if(q.signal.aborted)return;let _;try{_=a(u,!1)}catch(S){q.error(S);return}let A=!1,k=_;if(!q.signal.aborted)for(q.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||A)return;let S=k.return();if(S===null||typeof S!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let S=k.next();if({done:A}=S,A){q.complete();return}if(q.next(S.value),q.signal.aborted)break}catch(S){q.error(S);break}});if(u instanceof Promise||typeof u.then=="function")return new y(q=>{u.then(_=>{q.next(_),q.complete()},_=>{q.error(_)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,b=y.from(u);return new y(q=>{let _=new d({next(){q.complete()},error(){q.complete()}}),A={signal:q.signal};if(f(b,_,A),!q.active)return;let k=new d({next(S){q.next(S)},error(S){q.error(S)},complete(){q.complete()}});f(g,k,A)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(k){let S;try{S=u(k,q)}catch(T){b.error(T);return}q+=1,b.next(S)},error(k){b.error(k)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}inspect(u={}){let g=null,b=null,q=null,_=null,A=null;typeof u=="function"?b=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(b=u.next),"error"in u&&(q=u.error),"complete"in u&&(_=u.complete),"abort"in u&&(A=u.abort));let k=this;return new y(S=>{if(g!==null)try{g()}catch(V){S.error(V);return}let T=()=>{try{A!==null&&A(S.signal.reason)}catch(V){cs(V)}};S.signal.addEventListener("abort",T,{once:!0});let $=new d({next(V){if(b!==null)try{b(V)}catch(mt){S.signal.removeEventListener("abort",T),S.error(mt);return}S.next(V)},error(V){if(S.signal.removeEventListener("abort",T),q!==null)try{q(V)}catch(mt){S.error(mt);return}S.error(V)},complete(){if(S.signal.removeEventListener("abort",T),_!==null)try{_()}catch(V){S.error(V);return}S.complete()}}),j={signal:S.signal};f(k,$,j)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(k){let S=!1;try{S=u(k,q)}catch(T){b.error(T);return}q+=1,S&&b.next(k)},error(k){b.error(k)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u;if(q==0)return b.complete();let _=new d({next(k){b.next(k),q-=1,q==0&&b.complete()},error(k){b.error(k)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u,_=new d({next(k){if(q>0)return q-=1;q==0&&b.next(k)},error(k){b.error(k)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=[];function k(j){let V;try{V=u(j,q)}catch(ae){return b.error(ae)}q+=1;let mt;try{mt=y.from(V)}catch(ae){return b.error(ae)}let Ua=new d({next(ae){b.next(ae)},error(ae){b.error(ae)},complete(){if(A.length){let ae=A.shift();k(ae)}else S=!1,_&&b.complete()}}),Wt={signal:b.signal};f(mt,Ua,Wt)}let S=!1,T=new d({next(j){S?A.push(j):(S=!0,k(j))},error(j){b.error(j)},complete(){_=!0,!S&&!A.length&&b.complete()}}),$={signal:b.signal};f(g,T,$)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=null;function k($){let j;try{j=u($,q)}catch(Wt){return b.error(Wt)}q+=1;let V;try{V=y.from(j)}catch(Wt){return b.error(Wt)}let mt=new d({next(Wt){b.next(Wt)},error(Wt){b.error(Wt)},complete(Wt){_?b.complete():A=null}}),Ua={signal:c([A.signal,b.signal])};f(V,mt,Ua)}let S=new d({next($){A&&A.abort(),A=new ee,k($)},error($){b.error($)},complete(){_=!0,A||b.complete()}}),T={signal:b.signal};f(g,S,T)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(q=>{let _=new d({next(k){q.next(k)},error(k){let S;try{S=u(k)}catch(V){q.error(V);return}let T;try{T=y.from(S)}catch(V){q.error(V);return}let $=new d({next(V){q.next(V)},error(V){q.error(V)},complete(){q.complete()}}),j={signal:q.signal};f(T,$,j)},complete(){q.complete()}}),A={signal:q.signal};f(g,_,A)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{b.addTeardown(u);let q=new d({next(A){b.next(A)},error(A){b.error(A)},complete(){b.complete()}}),_={signal:b.signal};f(g,q,_)})}toArray(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=[],A=new d({next(k){_.push(k)},error(k){q(k)},complete(){b(_)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new ee,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return _(k.signal.reason),b;k.signal.addEventListener("abort",()=>{_(k.signal.reason)});let S=0,T=new d({next($){try{u($,S)}catch(j){_(j),A.abort(j)}S+=1},error($){_($)},complete(){q()}});return f(this,T,k),b}every(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new ee,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return _(k.signal.reason),b;k.signal.addEventListener("abort",()=>{_(k.signal.reason)});let S=0,T=new d({next($){let j=!1;try{j=u($,S)}catch(V){_(V),A.abort(V)}S+=1,j||(q(!1),A.abort())},error($){_($)},complete(){q(!0)}});return f(this,T,k),b}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e(),_=new ee,A={signal:c([_.signal,u.signal])};if(A.signal.aborted)return q(A.signal.reason),g;A.signal.addEventListener("abort",()=>{q(A.signal.reason)});let k=new d({next(S){b(S),_.abort()},error(S){q(S)},complete(){q(new RangeError("No values in Observable"))}});return f(this,k,A),g}last(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return q(u.signal.reason),g;u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=null,A=!1,k=new d({next(S){A=!0,_=S},error(S){q(S)},complete(){A?b(_):q(new RangeError("No values in Observable"))}});return f(this,k,u),g}find(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new ee,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return _(k.signal.reason),b;k.signal.addEventListener("abort",()=>{_(k.signal.reason)});let S=0,T=new d({next($){let j=!1;try{j=u($,S)}catch(V){_(V),A.abort(V)}S+=1,j&&(q($),A.abort())},error($){_($)},complete(){q()}});return f(this,T,k),b}some(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new ee,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return _(k.signal.reason),b;k.signal.addEventListener("abort",()=>{_(k.signal.reason)});let S=0,T=new d({next($){let j=!1;try{j=u($,S)}catch(V){_(V),A.abort(V)}S+=1,j&&(q(!0),A.abort())},error($){_($)},complete(){q(!1)}});return f(this,T,k),b}reduce(u,g,b={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:q,resolve:_,reject:A}=e(),k=new ee,S={signal:c([k.signal,b.signal])};if(S.signal.aborted)return A(S.signal.reason),q;S.signal.addEventListener("abort",()=>{A(S.signal.reason)},{once:!0});let T=0,$=arguments.length>1?g:ec,j=new d({next(V){if($===ec){$=V,T++;return}try{let mt=u($,V,T);T++,$=mt}catch(mt){A(mt),k.abort(mt);return}},error(V){A(V)},complete(){$!==ec?_($):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,j,S),q}}return o(y.prototype,"subscribe"),[y,m]})();function xp(){return typeof globalThis.Observable=="function"}function wp(){Object.defineProperties(globalThis,{Observable:{value:qp,configurable:!0,writable:!0},Subscriber:{value:Of,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(ki()&&!Ue(document))return;let e=this;return new qp(i=>{if(!e||i.signal.aborted)return;let r=n=>{i.next(n)};e.addEventListener(o,r,{capture:t.capture||!1,passive:t.passive,once:!1,signal:i.signal})})}}function ic(o,t,e){let i=o.filter(r=>!r.hasAttribute("disabled"));for(let r of i){let n=r.getBoundingClientRect();if(t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom)return r}return null}function Cp(o,t,e,i){if(!i)return null;let r=o.filter(s=>!s.hasAttribute("disabled")),n=i.getBoundingClientRect();for(let s of r){let a=s.getBoundingClientRect();if(!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom))return s}return null}function kp(o,t,e,i){let r=o.filter(c=>!c.hasAttribute("disabled"));if(r.length===0)return null;let n,s;if(i){let c=i.getBoundingClientRect();n=c.left+c.width/2,s=c.top+c.height/2}else n=t,s=e;let a=null,l=1/0;for(let c of r){let d=c.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(n-h,2)+Math.pow(s-f,2));m<l&&(l=m,a=c)}return a}function Sp(o,t,e,i){let r=o.filter(l=>!l.hasAttribute("disabled"));if(r.length===0)return null;let n;if(i){let l=i.getBoundingClientRect();n=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}]}else n=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let l of r){let c=l.getBoundingClientRect(),d=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}],h=0,f=0;for(let y of n)for(let x of d){let u=Math.sqrt(Math.pow(y.x-x.x,2)+Math.pow(y.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function Df(o,t,e){let i=o.getBoundingClientRect();return t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom}function $f(o,t,e,i,r){let n=r&&r.length>0?o.filter(g=>r.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.split(/\s+/).includes("bank")),a=o.filter(g=>!n.includes(g));if(n.length===0&&a.length===0)return null;let l;if(i){let g=i.getBoundingClientRect();l=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else l=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let c=g=>{let b=g.getBoundingClientRect(),q=[{x:b.left,y:b.top},{x:b.right,y:b.top},{x:b.left,y:b.bottom},{x:b.right,y:b.bottom}],_=0,A=0;for(let k of l)for(let S of q){let T=Math.sqrt(Math.pow(k.x-S.x,2)+Math.pow(k.y-S.y,2));_+=T,A++}return _/A},d=null,h=1/0;for(let g of n){let b=c(g);b<h&&(h=b,d=g)}let f=null,m=1/0;for(let g of a){let b=c(g);b<m&&(m=b,f=g)}if(d&&i){let g=i.getBoundingClientRect(),b=d.getBoundingClientRect(),q=g.left+g.width/2,_=g.top+g.height/2;if(q>=b.left&&q<=b.right&&_>=b.top&&_<=b.bottom)return d}if(f&&Df(f,t,e))return f;let x=i?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function Ep(o){switch(o){case"pointerWithin":return ic;case"rectangleIntersection":return Cp;case"closestCenter":return kp;case"closestCorners":return Sp;case"closestCornersWithInventoryPriority":return $f;default:return ic}}function ar(o,t,e,i,r="pointerWithin",n){return Ep(r)(o,t,e,i,n)}function He(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let i of e)if(i instanceof HTMLElement&&i.tagName!=="SLOT"){if(i.matches(t)||i.hasAttribute("data-draggable"))return i;let r=i.closest(t)||i.closest('[data-draggable="true"]');if(r)return r}return null}function Sn(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var rc=o=>o?.internals;function vt(o,t,e){B(rc(o)?.states,t,e)}function ds(o,t){return Jr(rc(o)?.states,t)}function En(o){vt(o,"lifted",!1),vt(o,"used",!1),vt(o,"return-target",!1)}function Si(o){return ds(o,"lifted")||ds(o,"used")}var Ap={filled:[],full:[],"drag-active":["active","enabled"],"drag-over":["hover"]};function ie(o,t,e){if(!o)return;let i=[t,...Ap[t]];for(let s of i)e?o.setAttribute(s,""):o.removeAttribute(s);let r=rc(o)?.states;if(r){B(r,t,e,Ap[t]);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));if(!(!n.has("drop")&&!n.has("bank"))){for(let s of i)e?n.add(s):n.delete(s);o.setAttribute("part",[...n].join(" "))}}function Ei(o,t){o&&(t?o.setAttribute("disabled",""):o.removeAttribute("disabled"),ie(o,"full",t))}function lr(o,t){ie(o,"filled",t)}function cr(o,t){let e=[];return o.forEach(i=>{let r=[];i.tagName.toLowerCase()==="slot"?r=i.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):r=Array.from(i.querySelectorAll(`[identifier="${t}"]`)),e.push(...r)}),e}function _p(o,t){let e=o.find(r=>r.getAttribute("identifier")===t);if(!e)return 1;let i=e.getAttribute("match-max");return i?parseInt(i,10)||0:1}var nc={origin:{x:0,y:0},scale:{x:1,y:1}},hs=100,Nf=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},Lf=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},Vf=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},oc=(o,t)=>{let e=o.ownerDocument??document,i=t??e.body,r=Nf(e);return r&&!Vf(r,i)?Lf(r):i},sc=(o,t=1)=>{let i=(o.ownerDocument??document).createElement("div");i.style.cssText=`position:fixed;left:0;top:0;width:${hs}px;height:${hs}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(i);let r=i.getBoundingClientRect();return i.remove(),{origin:{x:r.left,y:r.top},scale:{x:(r.width/hs||1)*t,y:(r.height/hs||1)*t}}},Rp=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});xp()||wp();var Ip=new WeakSet;function jf(o){!o||Ip.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Ip.add(o))}var Tp=o=>!!o.internals?.states,ps=(o,t,e,i='slot[part~="bank"]',r="pointerWithin")=>{class n extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=r,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=nc,this.cursorBeforeDrag=null,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#i=a=>{let l=a;if(l.context!==ji)return;let c=l.contextTarget;c instanceof HTMLElement&&this.#e.add(c)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#i,{capture:!0}),jf(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#i,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,l){l.remove()}#e;#i;registeredMatching(a){for(let l of this.#e)l.isConnected||this.#e.delete(l);return[...this.#e].filter(l=>l.matches(a))}cacheInteractiveElements(){let a=(S,T)=>Array.from(T?.querySelectorAll(S)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[data-draggable="true"]:not([data-drag-clone])',this),h=a('[data-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...f]));let m=a(e,this),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let x=a(i,this),u=a(i,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),b=new Set(this.trackedDraggables),q=new Set(this.trackedDroppables),_=g?b:new Set,A=g?q:new Set,k=new Set([...b,...q].filter(Tp));for(let S of this.#t)k.has(S)||(B(S.internals.states,"chip",!1),B(S.internals.states,"drop",!1));for(let S of k){let T=_.has(S),$=!T&&A.has(S);B(S.internals.states,"chip",T),B(S.internals.states,"drop",$)}this.#t=k,this.trackedDraggables.forEach(S=>{let T=Si(S);g&&!T?(S.style.cursor="grab",S.style.userSelect="none",S.style.touchAction="none",S.style.webkitUserSelect="none",S.style.webkitTouchCallout="none",S.setAttribute("data-draggable","true"),S.setAttribute("tabindex","0")):(S.style.cursor="",S.style.userSelect="",S.style.touchAction="",S.style.webkitUserSelect="",S.style.webkitTouchCallout="",S.removeAttribute("data-draggable"),S.getAttribute("tabindex")==="0"&&S.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let l=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let y=He(m,t),x=this.disabled||this.readonly,u=Sn(y)||Si(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=He(m,t);if(!y){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let y=He(m,t),x=this.disabled||this.readonly,u=Sn(y)||Si(y),g=m.button===0,b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=He(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=He(m,t),x=this.disabled||this.readonly,u=Sn(y)||Si(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=He(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!y||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let y=this.trackedDraggables.filter(u=>!Si(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.endKeyboardDrag(),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.endKeyboardDrag(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=He(m,t),g=this.disabled||this.readonly,b=Sn(u)||Si(u);u&&["Space","Enter"].includes(m.code)&&!g&&!b&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),vt(u,"lifted",!0),this.activateAllDroppables(this.trackedDroppables.some(q=>q.contains(u)||!!q.shadowRoot?.contains(u))),h={dragging:!0,dragElement:u,dragIndex:y.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>ie(u,"drag-over",!1)),h.dragging&&h.dropElement&&(ie(h.dropElement,"drag-over",!0),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(l,c,d,f)}initiateDrag(a,l,c,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let y=b=>b.contains(a)||!!b.shadowRoot?.contains(a),x=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||null;a.getAnimations().forEach(b=>b.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:l-g.left,y:c-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:l,y:c},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),Ei(u,!1),u&&u.setAttribute("data-drag-source","true");let b=a.getAttribute("identifier");if(b){let q=cr(this.trackedDragContainers,b);q.forEach(_=>vt(_,"return-target",!0)),this.dragState.returnAnchorItems=q}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),vt(a,"lifted",!0);if(this.updateClonePosition(l,c),this.activateAllDroppables(x),this.watchDragCloneHost(),h==="pointer"){let b=this.ownerDocument.documentElement;this.cursorBeforeDrag=b.style.cursor,b.style.cursor="grabbing"}this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.setPointerCapture&&q.setPointerCapture(_)}catch{}let g=q=>{q.cancelable&&(q.preventDefault(),l==="pointer"&&q.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let b=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),l==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.releasePointerCapture&&q.releasePointerCapture(_)}catch{}};this.dragState.touchCleanup=b}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let b=this.dragState.startedFromTrustedEvent;return b===void 0||g.isTrusted===b},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let b=g.touches?.[0]||g.changedTouches?.[0];if(!b)return;this.handleDragMove(b.clientX,b.clientY);return}if(l==="mouse"){let b=g;if(typeof b.buttons=="number"&&(b.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),y=l==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):l==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=ar(this.allDropzones,a,l,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),d=Date.now(),h=d-(this.dragState.lastTargetChangeTime||0);c!==this.dragState.currentTarget&&(c===null||h>=50)&&(this.allDropzones.forEach(m=>ie(m,"drag-over",!1)),c&&ie(c,"drag-over",!0),this.dragState.currentTarget=c,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:l,currentTarget:c,sourceDroppable:d}=this.dragState,h=c;if(l){let y=l.getBoundingClientRect();h=ar(this.allDropzones,y.left+y.width/2,y.top+y.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),vt(a,"lifted",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{vt(y,"return-target",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,l){return this.trackedDroppables.includes(l)||this.trackedDragContainers.includes(l)}handleInvalidDrop(a){En(a)}createDragClone(a,l){let c=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];c.style.setProperty(m,d.getPropertyValue(m))}c.style.removeProperty("box-shadow");let h=oc(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=sc(h,this.cloneZoom),c.style.position="fixed",c.style.width=`${l.width/this.cloneFrame.scale.x}px`,c.style.height=`${l.height/this.cloneFrame.scale.y}px`,c.style.zIndex="9999",c.style.pointerEvents="none",c.style.touchAction="none",c.style.userSelect="none",c.removeAttribute("data-draggable"),c.removeAttribute("tabindex"),c.setAttribute("data-drag-clone","true"),c.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(c),c}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,l){if(this.dragState.lastCoordinates={x:a,y:l},!this.dragState.dragClone)return;let{startOffset:c}=this.dragState,{x:d,y:h}=Rp(this.cloneFrame,a-c.x,l-c.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,l=()=>{let{dragClone:c,dragSource:d,lastCoordinates:h}=this.dragState;if(!c)return;let f=d?.isConnected?d:this,m=oc(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=sc(m,this.cloneZoom),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",l),a.addEventListener("webkitfullscreenchange",l),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",l),a.removeEventListener("webkitfullscreenchange",l)}})}activateAllDroppables(a=!1){this.setDragActive(!0),this.allDropzones.forEach(l=>{let c=this.trackedDragContainers.includes(l);ie(l,"drag-active",a||!c)})}deactivateAllDroppables(){this.setDragActive(!1),this.allDropzones.forEach(a=>{ie(a,"drag-active",!1),ie(a,"drag-over",!1)})}endKeyboardDrag(){this.trackedDraggables.forEach(a=>{a.hasAttribute("data-keyboard-dragging")&&vt(a,"lifted",!1),a.removeAttribute("data-keyboard-dragging")}),this.deactivateAllDroppables()}setDragActive(a){B(this._internals?.states,"drag-active",a,["dragzone-active","dragzone-enabled"])}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{vt(a,"return-target",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",l)}}),this.dragSubscriptions=[],this.cloneFrame=nc,this.cloneZoom=1,this.cursorBeforeDrag!==null&&(this.ownerDocument.documentElement.style.cursor=this.cursorBeforeDrag,this.cursorBeforeDrag=null),this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,l){let c=this._internals;c?.states&&(l?c.states.add(a):c.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)Tp(a)&&(B(a.internals.states,"chip",!1),B(a.internals.states,"drop",!1));this.#t.clear(),this.resetDragState()}}return n};var Mp={duration:250,easing:"ease",fill:"both"};function ac(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Pp(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function We(o){let t=new Map;return o.forEach(e=>{t.set(e,ac(e))}),t}function Op(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function us(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function lc(o){return us(o)>0}function ms(o,t,e={}){let i=us(o);if(i<=0)return null;let r=ac(o),{deltaX:n,deltaY:s,deltaW:a,deltaH:l}=Op(t,r);if(n===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...Mp,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${n}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*i,easing:d,fill:h})}function Qe(o,t={}){let e=new Map;return o.forEach((i,r)=>{if(!(r instanceof HTMLElement))return;let n=ms(r,i,t);n&&e.set(r,n)}),e}var An=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ut=(o,t,e,i='slot[part~="bank"]',r="closestCornersWithInventoryPriority")=>{let n=Zl(o,t,e,i),s=ps(n,t,e,i,r);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this.maxAssociations=0,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}#t;isSwapTarget(c){let d=this.dragState.sourceDroppable,h=parseInt(c.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(c)&&!!d&&d!==c&&this.trackedDroppables.includes(d)}isDeclarativeTarget(c){return c?c.acceptsDeclarativeDrops===!0?!0:c.hasAttribute("data-declarative-drops"):!1}chipsIn(c){return this.isDeclarativeTarget(c)?[...this.#t.get(c)??[]]:Array.from(c.querySelectorAll(t))}droppableHolding(c){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(c)||d.contains(c)||!!d.shadowRoot?.contains(c))??null}placeChip(c,d){this.#t.set(c,[...this.#t.get(c)??[],d])}removeChipFromDroppable(c,d){let h=c??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&lr(h,!1),this.syncDragDropState();return}d.remove()}clearChips(c){this.isDeclarativeTarget(c)?(this.#t.set(c,[]),this.syncDragDropState()):this.chipsIn(c).forEach(d=>d.remove()),lr(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),x=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[data-draggable="true"]'));c[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,x.length),h[m]=y}this._dragDrop={dragsByTarget:c,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:c}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(c[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((c,d)=>c+d,0)}droppableAtCapacityFromState(c){let d=parseInt(c.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=c.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&lc(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let c=this.getResponse,d=typeof c=="function"?c.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(c){if(Array.isArray(c)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=c,this._internals.setFormValue(JSON.stringify(c));return}let d=this.getValue,h=typeof d=="function"?d.call(this,c):c,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response)),this.trackedDroppables?.length&&this.validate()}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let c=this._pendingResponse;this._pendingResponse=void 0,this.response=c}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let c=this.dataset.choicesContainerWidth;c&&this.trackedDroppables.forEach(d=>{d.style.width=`${c}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(c){for(let h of c){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=c.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(c,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(c,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,d,h);let f=c.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity({trigger:"change"})}handleInvalidDrop(c){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!c)return;if(d&&f&&m)this.dropDraggableInDroppable(c,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(c,d,this.dragState.dragClone?.getBoundingClientRect());else if(ds(c,"lifted")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),x=this.maxAssociations>0&&y>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity({trigger:"change"})}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{ms(c,Pp(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){En(c),c.style.display="",c.style.position="",this.animateReturn(c,d)}placeResponse(c){let[d,...h]=c.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=cr(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(c,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(c,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(c,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let _=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),_&&this.restoreOriginalInInventory(_,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,x=y===0||y>1,u=Array.from(d.querySelectorAll('[data-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?We(u):null;if(!x){let _=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[data-draggable="true"]'));if(_){let A=_.getAttribute("identifier"),k=_.getBoundingClientRect();this.removeChipFromDroppable(d,_);let S=this.dragState.sourceDroppable,T=this.isDeclarativeTarget(d)&&S&&S!==d&&this.isDeclarativeTarget(S)?S:null;T?(this.placeChip(T,_),lr(T,!0),this.animateReturn(_,k)):A&&this.restoreOriginalInInventory(A,k)}}let b=c.cloneNode(!0);b.removeAttribute("style"),b.removeAttribute("data-keyboard-dragging"),b.setAttribute("data-draggable","true"),b.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(b.setAttribute("part",b.localName==="qti-gap-text"?"chip text drag drag-text":"chip drag"),b.setAttribute("exportparts",["control: chip-control, control: drag-control, label: chip-label, label: drag-label","correction, candidate-correct, candidate-incorrect, candidate-partial","correction-correct, correction-incorrect, correction-partially-correct"].join(", ")),this.placeChip(d,b)):d.tagName==="SLOT"?b.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&b.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(b)),lr(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Qe(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let _=b.getBoundingClientRect(),A=h.left-_.left,k=h.top-_.top;(A!==0||k!==0)&&b.animate([{transform:`translate(${A}px, ${k}px)`},{transform:"translate(0, 0)"}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let q=c.getAttribute("identifier");q&&this.updateInventoryBasedOnMatchMax(q),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&lr(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=cr(this.trackedDragContainers,c),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[data-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let y=this.enableFlipAnimations&&m.length>0?We(m):null;h.forEach(x=>{En(x),x.style.display="",x.style.visibility="visible"}),y&&this.enableFlipAnimations&&Qe(y,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=cr(this.trackedDragContainers,c),h=_p(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(x=>x.getAttribute("identifier")===c).length:m+y.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{vt(m,"used",h!==0&&f>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source"),y=this.droppableAtCapacityFromState(f);Ei(f,(y||d&&h)&&!m)})}saveResponse(c){let d=this.getResponse,h=c??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(c=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this.trackedDroppables.forEach(d=>Ei(d,!1)),this.checkAllMaxAssociations(),this.resetValidityReport(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),c&&this.saveResponse()}validate(){let c=this.totalAssociationsFromState(),d=this.maxAssociations>0&&c>=this.maxAssociations,h=this.maxAssociations>0&&c>this.maxAssociations,f=this.minAssociations>0&&c<this.minAssociations,m="",y=!0,x="other";h?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):f?(x="min",m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let u=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,u,{suppressInline:!0,kind:x}),y}reportValidity(c){return super.reportValidity(c)}}return An([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),An([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",void 0),An([X({context:ze})],a.prototype,"_dragDrop",void 0),An([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),An([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Kt({emptyAs:[]})})],a.prototype,"response",null),a};var fs=class{getInsertPosition(t,e,i,r,n){let s=t.indexOf(i);if(s===-1)return null;let a=i.getBoundingClientRect(),l=(n-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var Dp=new fs;var Ff={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function _n(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function gs(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function bs(o,t,e={}){let i={...Ff,...e},r=document.createElement("div");return r.setAttribute("data-drop-preview","true"),r.setAttribute("data-drop-placeholder","true"),r.style.width=`${t.width}px`,r.style.height=`${t.height}px`,r.style.margin=window.getComputedStyle(o).margin,r.style.boxSizing="border-box",r.style.border=`${i.borderStyle} ${i.borderColor}`,r.style.borderRadius=getComputedStyle(o).borderRadius,r.style.background=i.background,r.style.transition=`transform ${i.transitionDuration*us(o)}ms ease`,r.style.pointerEvents="none",r}function cc(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var Ht=(o,t='[data-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#i=_n(),this.#r={hoveredSlot:null,originalPositions:new Map},this.#n=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#i;#r;#n;#o;set allowReorder(r){this.#o=r}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(r){return cc(r,this.trackedDroppables)}#s(r){return r.querySelector(t)}#a(r){let n=this.#d(r);return n===0||n>1}#d(r){let n=parseInt(r.getAttribute("match-max")||"1",10);return Number.isNaN(n)?1:n}#u(r){return r.querySelectorAll(t).length}#l(r){let n=this.#d(r);return n===0?!1:this.#u(r)>=n}#h(){this.#r={hoveredSlot:null,originalPositions:new Map}}#c(r){if(!this.#t||r===this.#t){this.#m();return}if(this.#r.hoveredSlot===r)return;this.#m();let n=this.#s(r);if(!n){this.#i.placeholder&&r.appendChild(this.#i.placeholder),this.#r.hoveredSlot=r;return}if(this.#a(r)){if(this.#l(r)){this.#i.placeholder&&this.#t&&this.#t.appendChild(this.#i.placeholder),this.#r.hoveredSlot=null;return}this.#i.placeholder&&r.appendChild(this.#i.placeholder),this.#r.hoveredSlot=r;return}if(this.isDeclarativeTarget(r)){this.#i.placeholder?.parentElement&&this.#i.placeholder.remove(),this.#r.hoveredSlot=r;return}let a=We([n]);this.#r.originalPositions.set(n,r),this.#i.placeholder&&this.#i.placeholder.parentElement&&this.#i.placeholder.remove(),this.#t.appendChild(n),this.#i.placeholder&&r.appendChild(this.#i.placeholder),this.#r.hoveredSlot=r,Qe(a,this.sortableAnimationConfig)}#m(){if(this.#r.originalPositions.size===0&&this.#r.hoveredSlot===null)return;let r=Array.from(this.#r.originalPositions.keys()),n=r.length>0?We(r):null;for(let[s,a]of this.#r.originalPositions)a.appendChild(s);this.#i.placeholder&&this.#t&&this.#t.appendChild(this.#i.placeholder),n&&Qe(n,this.sortableAnimationConfig),this.#r.originalPositions.clear(),this.#r.hoveredSlot=null}initiateDrag(r,n,s,a,...l){this.#t=null,this.#i=_n(),this.#h();let c=this.findContainingDroppable(r);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#i.sortContainer=c;let h=r.getBoundingClientRect();this.#i.placeholder=bs(r,h,this.sortablePlaceholderConfig);let f=r.getAttribute("slot");f&&this.#i.placeholder.setAttribute("slot",f),this.#i.placeholder.style.visibility="hidden",c.appendChild(this.#i.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;Ei(m,!1),this.#n.add(m)}})}let[d]=l;super.initiateDrag(r,n,s,a,d)}cleanupSortableState(r=!0){if(r)for(let[n,s]of this.#r.originalPositions)s.appendChild(n);this.#i.placeholder&&this.#i.placeholder.remove(),gs(this.#i),this.#n.clear(),this.#t=null,this.#h()}onSortableDragMove(r,n){if(!this.isDraggingFromSlot)return;let s=ar(this.trackedDroppables,r,n,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#c(s):this.#m()}handleDragMove(r,n){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,r,n),this.onSortableDragMove(r,n)}allowDrop(r,n){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&n!==this.#e&&this.trackedDroppables.includes(n)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(n)?this.#a(n)?!this.#l(n):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(n)?!0:super.allowDrop(r,n)}handleDrop(r,n){super.handleDrop(r,n),this.cleanupSortableState(!1)}handleInvalidDrop(r){this.cleanupSortableState(),super.handleInvalidDrop(r)}}return e};var $p=[M,H,Jt,w`
6871
+ <slot part="label"></slot>`}};Oo([p({type:String,attribute:"template-identifier"})],Lt.prototype,"templateIdentifier",void 0);Oo([p({type:String,attribute:"show-hide"})],Lt.prototype,"showHide",void 0);Oo([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Lt.prototype,"fixed",void 0);Oo([p({type:String,attribute:!1})],Lt.prototype,"marker",void 0);var Mh=[{tag:"qti-simple-choice",ctor:Lt}];var Ph=[...uh,...fh,...bh,...qh,...wh,...kh,...Eh,..._h,...Rh,...Mh];var Lm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n};function Vm(o,t,e,r,i={}){let n=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,c=0,l=r.length?r:[o],d=l.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));l.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),c=Math.max(c,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:c})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(o.style.setProperty("--qti-dropzone-min-width",`${c}px`),o.style.setProperty("--qti-drag-min-width",`${c}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(h.style.setProperty("--qti-dropzone-min-width",`${c}px`),h.style.setProperty("--qti-drag-min-width",`${c}px`))}))}var vc=(o,t,e,r='slot[part~="bank"]')=>{class i extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#i=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#i;#n;collectAutoSizeTargets(){let s=(a,c)=>Array.from(c?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:c}=this.collectAutoSizeTargets();s.length!==0&&(Vm(this.dropzonePropertyTarget(),s,a,c,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:l=>{let d=this.#n;return d&&d.height===l.height&&d.width===l.width?!1:(this.#n=l,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#s()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let c of this.#e)a.has(c)||this.#t.unobserve(c);for(let c of a)this.#e.has(c)||this.#t.observe(c);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return Lm([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Jt,AbortSignal:yc,WeakMap:jm,WeakRef:Fm,Window:Oh,reportError:Do=console.log}=globalThis,Ne=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||Ne(o.defaultView.parent.document)),ur=()=>!!Oh&&globalThis instanceof Oh,qc=Symbol("unset"),[Dh,zm]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((b,q)=>(x=b,u=q)),resolve:x,reject:u}};function r(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let i=new jm,n={next(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.next(...x))},return(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.return?b.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>{if(!b.throw)throw b.return(),new TypeError("no throw method");return b.throw(...x)})}};function s(x){let u=Object.create(n);return i.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let b=r(x,g);return s(b)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(x,g)}let c="any"in yc?yc.any.bind(yc):x=>{let u=new Jt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},l=x=>c(x.filter(Boolean));class d{constructor({next:u,error:g,complete:b}={}){i.set(this,{next:u,error:g,complete:b})}next(u){let{next:g}=i.get(this)||{};g&&g(u)}error(u){let{error:g}=i.get(this)||{};g?g(u):Do(u)}complete(){let{complete:u}=i.get(this)||{};u&&u()}}function h(x,u){let g=i.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let b of g.teardowns.reverse()){if(ur()&&!Ne(document))return;try{b()}catch(q){Do(q)}}}}function f(x,u,g={}){if(ur()&&!Ne(document))return;let b;typeof u=="function"?b=new d({next:u}):u&&!(u instanceof d)?b=new d(u):b=u||new d;let q=i.get(x),_=q.weakSubscriber?.deref();if(_?.active){let C=_,k=i.get(C);k.observers.add(b),g.signal&&(g.signal.aborted?k.observers.delete(b):g.signal.addEventListener("abort",()=>{let I=i.get(C);I?.active&&(I.observers.delete(b),I.observers.size==0&&h(C,g.signal.reason))}));return}let A=new m(b);if(q.weakSubscriber=new Fm(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let C=i.get(A);C?.active&&(C.observers.delete(b),C.observers.size==0&&h(A,g.signal.reason))})),q.subscribeCallback)try{q.subscribeCallback(A)}catch(C){A.error(C)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Jt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active||ur()&&!Ne(document))return;let b=new Set(g.observers);for(let q of b)q.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active){Do(u);return}if(ur()&&!Ne(document))return;h(this,u);let b=new Set(g.observers);for(let q of b)q.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=i.get(this);if(!u?.active||ur()&&!Ne(document))return;h(this);let g=new Set(u.observers);for(let b of g)b.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(ur()&&!Ne(document))return;let g=i.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!i.has(this)){let u=new Jt;return u.abort(),u.signal}return i.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let _=function(A,C){if(A.signal.aborted)return;let k;try{let I=C.next();k=Promise.resolve(I)}catch(I){k=Promise.reject(I)}k.then(I=>{if(I===null||typeof I!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:q}=I)}catch(V){A.error(V);return}if(q){A.complete();return}let $;try{$=I.value}catch(V){A.error(V);return}A.next($),_(A,C)},I=>{A.error(I)})},q=!1;return new y(A=>{if(A.signal.aborted)return;let C;try{C=a(u,!0)}catch(I){A.error(I);return}let k=C;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||q)return;t(()=>k.return(A.signal.reason)).then($=>{if($===null||typeof $!="object")throw new TypeError("Iterator .return() must return an Object")})}),_(A,k))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(q=>{if(q.signal.aborted)return;let _;try{_=a(u,!1)}catch(k){q.error(k);return}let A=!1,C=_;if(!q.signal.aborted)for(q.signal.addEventListener("abort",()=>{if(typeof C.return!="function"||A)return;let k=C.return();if(k===null||typeof k!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let k=C.next();if({done:A}=k,A){q.complete();return}if(q.next(k.value),q.signal.aborted)break}catch(k){q.error(k);break}});if(u instanceof Promise||typeof u.then=="function")return new y(q=>{u.then(_=>{q.next(_),q.complete()},_=>{q.error(_)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,b=y.from(u);return new y(q=>{let _=new d({next(){q.complete()},error(){q.complete()}}),A={signal:q.signal};if(f(b,_,A),!q.active)return;let C=new d({next(k){q.next(k)},error(k){q.error(k)},complete(){q.complete()}});f(g,C,A)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(C){let k;try{k=u(C,q)}catch(I){b.error(I);return}q+=1,b.next(k)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}inspect(u={}){let g=null,b=null,q=null,_=null,A=null;typeof u=="function"?b=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(b=u.next),"error"in u&&(q=u.error),"complete"in u&&(_=u.complete),"abort"in u&&(A=u.abort));let C=this;return new y(k=>{if(g!==null)try{g()}catch(L){k.error(L);return}let I=()=>{try{A!==null&&A(k.signal.reason)}catch(L){Do(L)}};k.signal.addEventListener("abort",I,{once:!0});let $=new d({next(L){if(b!==null)try{b(L)}catch(ht){k.signal.removeEventListener("abort",I),k.error(ht);return}k.next(L)},error(L){if(k.signal.removeEventListener("abort",I),q!==null)try{q(L)}catch(ht){k.error(ht);return}k.error(L)},complete(){if(k.signal.removeEventListener("abort",I),_!==null)try{_()}catch(L){k.error(L);return}k.complete()}}),V={signal:k.signal};f(C,$,V)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(C){let k=!1;try{k=u(C,q)}catch(I){b.error(I);return}q+=1,k&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u;if(q==0)return b.complete();let _=new d({next(C){b.next(C),q-=1,q==0&&b.complete()},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u,_=new d({next(C){if(q>0)return q-=1;q==0&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=[];function C(V){let L;try{L=u(V,q)}catch(re){return b.error(re)}q+=1;let ht;try{ht=y.from(L)}catch(re){return b.error(re)}let ba=new d({next(re){b.next(re)},error(re){b.error(re)},complete(){if(A.length){let re=A.shift();C(re)}else k=!1,_&&b.complete()}}),Ft={signal:b.signal};f(ht,ba,Ft)}let k=!1,I=new d({next(V){k?A.push(V):(k=!0,C(V))},error(V){b.error(V)},complete(){_=!0,!k&&!A.length&&b.complete()}}),$={signal:b.signal};f(g,I,$)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=null;function C($){let V;try{V=u($,q)}catch(Ft){return b.error(Ft)}q+=1;let L;try{L=y.from(V)}catch(Ft){return b.error(Ft)}let ht=new d({next(Ft){b.next(Ft)},error(Ft){b.error(Ft)},complete(Ft){_?b.complete():A=null}}),ba={signal:l([A.signal,b.signal])};f(L,ht,ba)}let k=new d({next($){A&&A.abort(),A=new Jt,C($)},error($){b.error($)},complete(){_=!0,A||b.complete()}}),I={signal:b.signal};f(g,k,I)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(q=>{let _=new d({next(C){q.next(C)},error(C){let k;try{k=u(C)}catch(L){q.error(L);return}let I;try{I=y.from(k)}catch(L){q.error(L);return}let $=new d({next(L){q.next(L)},error(L){q.error(L)},complete(){q.complete()}}),V={signal:q.signal};f(I,$,V)},complete(){q.complete()}}),A={signal:q.signal};f(g,_,A)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{b.addTeardown(u);let q=new d({next(A){b.next(A)},error(A){b.error(A)},complete(){b.complete()}}),_={signal:b.signal};f(g,q,_)})}toArray(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=[],A=new d({next(C){_.push(C)},error(C){q(C)},complete(){b(_)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){try{u($,k)}catch(V){_(V),A.abort(V)}k+=1},error($){_($)},complete(){q()}});return f(this,I,C),b}every(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V||(q(!1),A.abort())},error($){_($)},complete(){q(!0)}});return f(this,I,C),b}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e(),_=new Jt,A={signal:l([_.signal,u.signal])};if(A.signal.aborted)return q(A.signal.reason),g;A.signal.addEventListener("abort",()=>{q(A.signal.reason)});let C=new d({next(k){b(k),_.abort()},error(k){q(k)},complete(){q(new RangeError("No values in Observable"))}});return f(this,C,A),g}last(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return q(u.signal.reason),g;u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=null,A=!1,C=new d({next(k){A=!0,_=k},error(k){q(k)},complete(){A?b(_):q(new RangeError("No values in Observable"))}});return f(this,C,u),g}find(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V&&(q($),A.abort())},error($){_($)},complete(){q()}});return f(this,I,C),b}some(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V&&(q(!0),A.abort())},error($){_($)},complete(){q(!1)}});return f(this,I,C),b}reduce(u,g,b={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:q,resolve:_,reject:A}=e(),C=new Jt,k={signal:l([C.signal,b.signal])};if(k.signal.aborted)return A(k.signal.reason),q;k.signal.addEventListener("abort",()=>{A(k.signal.reason)},{once:!0});let I=0,$=arguments.length>1?g:qc,V=new d({next(L){if($===qc){$=L,I++;return}try{let ht=u($,L,I);I++,$=ht}catch(ht){A(ht),C.abort(ht);return}},error(L){A(L)},complete(){$!==qc?_($):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,k),q}}return o(y.prototype,"subscribe"),[y,m]})();function $h(){return typeof globalThis.Observable=="function"}function Nh(){Object.defineProperties(globalThis,{Observable:{value:Dh,configurable:!0,writable:!0},Subscriber:{value:zm,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(ur()&&!Ne(document))return;let e=this;return new Dh(r=>{if(!e||r.signal.aborted)return;let i=n=>{r.next(n)};e.addEventListener(o,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function xc(o,t,e){let r=o.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let n=i.getBoundingClientRect();if(t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom)return i}return null}function Lh(o,t,e,r){if(!r)return null;let i=o.filter(s=>!s.hasAttribute("disabled")),n=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom))return s}return null}function Vh(o,t,e,r){let i=o.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let n,s;if(r){let l=r.getBoundingClientRect();n=l.left+l.width/2,s=l.top+l.height/2}else n=t,s=e;let a=null,c=1/0;for(let l of i){let d=l.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(n-h,2)+Math.pow(s-f,2));m<c&&(c=m,a=l)}return a}function jh(o,t,e,r){let i=o.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let n;if(r){let c=r.getBoundingClientRect();n=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}]}else n=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let c of i){let l=c.getBoundingClientRect(),d=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}],h=0,f=0;for(let y of n)for(let x of d){let u=Math.sqrt(Math.pow(y.x-x.x,2)+Math.pow(y.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=c)}return s}function Bm(o,t,e){let r=o.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function Um(o,t,e,r,i){let n=i&&i.length>0?o.filter(g=>i.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.split(/\s+/).includes("bank")),a=o.filter(g=>!n.includes(g));if(n.length===0&&a.length===0)return null;let c;if(r){let g=r.getBoundingClientRect();c=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else c=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let l=g=>{let b=g.getBoundingClientRect(),q=[{x:b.left,y:b.top},{x:b.right,y:b.top},{x:b.left,y:b.bottom},{x:b.right,y:b.bottom}],_=0,A=0;for(let C of c)for(let k of q){let I=Math.sqrt(Math.pow(C.x-k.x,2)+Math.pow(C.y-k.y,2));_+=I,A++}return _/A},d=null,h=1/0;for(let g of n){let b=l(g);b<h&&(h=b,d=g)}let f=null,m=1/0;for(let g of a){let b=l(g);b<m&&(m=b,f=g)}if(d&&r){let g=r.getBoundingClientRect(),b=d.getBoundingClientRect(),q=g.left+g.width/2,_=g.top+g.height/2;if(q>=b.left&&q<=b.right&&_>=b.top&&_<=b.bottom)return d}if(f&&Bm(f,t,e))return f;let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function Fh(o){switch(o){case"pointerWithin":return xc;case"rectangleIntersection":return Lh;case"closestCenter":return Vh;case"closestCorners":return jh;case"closestCornersWithInventoryPriority":return Um;default:return xc}}function Xr(o,t,e,r,i="pointerWithin",n){return Fh(i)(o,t,e,r,n)}function Le(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("data-draggable"))return r;let i=r.closest(t)||r.closest('[data-draggable="true"]');if(i)return i}return null}function nn(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var wc=o=>o?.internals;function ft(o,t,e){z(wc(o)?.states,t,e)}function $o(o,t){return Ni(wc(o)?.states,t)}function on(o){ft(o,"lifted",!1),ft(o,"used",!1),ft(o,"return-target",!1)}function mr(o){return $o(o,"lifted")||$o(o,"used")}var zh={filled:[],full:[],"drag-active":["active","enabled"],"drag-over":["hover"]};function Yt(o,t,e){if(!o)return;let r=[t,...zh[t]];for(let s of r)e?o.setAttribute(s,""):o.removeAttribute(s);let i=wc(o)?.states;if(i){z(i,t,e,zh[t]);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));if(!(!n.has("drop")&&!n.has("bank"))){for(let s of r)e?n.add(s):n.delete(s);o.setAttribute("part",[...n].join(" "))}}function fr(o,t){o&&(t?o.setAttribute("disabled",""):o.removeAttribute("disabled"),Yt(o,"full",t))}function Gr(o,t){Yt(o,"filled",t)}function Jr(o,t){let e=[];return o.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function Bh(o,t){let e=o.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var Cc={origin:{x:0,y:0},scale:{x:1,y:1}},No=100,Hm=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},Wm=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},Qm=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},kc=(o,t)=>{let e=o.ownerDocument??document,r=t??e.body,i=Hm(e);return i&&!Qm(i,r)?Wm(i):r},Sc=(o,t=1)=>{let r=(o.ownerDocument??document).createElement("div");r.style.cssText=`position:fixed;left:0;top:0;width:${No}px;height:${No}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(r);let i=r.getBoundingClientRect();return r.remove(),{origin:{x:i.left,y:i.top},scale:{x:(i.width/No||1)*t,y:(i.height/No||1)*t}}},Uh=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});$h()||Nh();var Hh=new WeakSet;function Xm(o){!o||Hh.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Hh.add(o))}var Wh=o=>!!o.internals?.states,Lo=(o,t,e,r='slot[part~="bank"]',i="pointerWithin")=>{class n extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Cc,this.cursorBeforeDrag=null,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#r=a=>{let c=a;if(c.context!==Tr)return;let l=c.contextTarget;l instanceof HTMLElement&&this.#e.add(l)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#r,{capture:!0}),Xm(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,c){c.remove()}#e;#r;registeredMatching(a){for(let c of this.#e)c.isConnected||this.#e.delete(c);return[...this.#e].filter(c=>c.matches(a))}cacheInteractiveElements(){let a=(k,I)=>Array.from(I?.querySelectorAll(k)??[]),c=a(t,this),l=a(t,this.shadowRoot),d=a('[data-draggable="true"]:not([data-drag-clone])',this),h=a('[data-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...c,...l,...d,...h,...f]));let m=a(e,this),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let x=a(r,this),u=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),b=new Set(this.trackedDraggables),q=new Set(this.trackedDroppables),_=g?b:new Set,A=g?q:new Set,C=new Set([...b,...q].filter(Wh));for(let k of this.#t)C.has(k)||(z(k.internals.states,"chip",!1),z(k.internals.states,"drop",!1));for(let k of C){let I=_.has(k),$=!I&&A.has(k);z(k.internals.states,"chip",I),z(k.internals.states,"drop",$)}this.#t=C,this.trackedDraggables.forEach(k=>{let I=mr(k);g&&!I?(k.style.cursor="grab",k.style.userSelect="none",k.style.touchAction="none",k.style.webkitUserSelect="none",k.style.webkitTouchCallout="none",k.setAttribute("data-draggable","true"),k.setAttribute("tabindex","0")):(k.style.cursor="",k.style.userSelect="",k.style.touchAction="",k.style.webkitUserSelect="",k.style.webkitTouchCallout="",k.removeAttribute("data-draggable"),k.getAttribute("tabindex")==="0"&&k.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let c=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let y=Le(m,t),x=this.disabled||this.readonly,u=nn(y)||mr(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=Le(m,t);if(!y){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),l=a.when("mousedown").filter(m=>{let y=Le(m,t),x=this.disabled||this.readonly,u=nn(y)||mr(y),g=m.button===0,b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Le(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=Le(m,t),x=this.disabled||this.readonly,u=nn(y)||mr(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Le(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!y||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let y=this.trackedDraggables.filter(u=>!mr(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.endKeyboardDrag(),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.endKeyboardDrag(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=Le(m,t),g=this.disabled||this.readonly,b=nn(u)||mr(u);u&&["Space","Enter"].includes(m.code)&&!g&&!b&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),ft(u,"lifted",!0),this.activateAllDroppables(this.trackedDroppables.some(q=>q.contains(u)||!!q.shadowRoot?.contains(u))),h={dragging:!0,dragElement:u,dragIndex:y.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>Yt(u,"drag-over",!1)),h.dragging&&h.dropElement&&(Yt(h.dropElement,"drag-over",!0),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(c,l,d,f)}initiateDrag(a,c,l,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let y=b=>b.contains(a)||!!b.shadowRoot?.contains(a),x=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||null;a.getAnimations().forEach(b=>b.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:c-g.left,y:l-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:c,y:l},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),fr(u,!1),u&&u.setAttribute("data-drag-source","true");let b=a.getAttribute("identifier");if(b){let q=Jr(this.trackedDragContainers,b);q.forEach(_=>ft(_,"return-target",!0)),this.dragState.returnAnchorItems=q}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),ft(a,"lifted",!0);if(this.updateClonePosition(c,l),this.activateAllDroppables(x),this.watchDragCloneHost(),h==="pointer"){let b=this.ownerDocument.documentElement;this.cursorBeforeDrag=b.style.cursor,b.style.cursor="grabbing"}this.setupMoveObservables(d,h)}setupMoveObservables(a,c="pointer"){if(a==="touch"){if(c==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.setPointerCapture&&q.setPointerCapture(_)}catch{}let g=q=>{q.cancelable&&(q.preventDefault(),c==="pointer"&&q.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let b=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),c==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.releasePointerCapture&&q.releasePointerCapture(_)}catch{}};this.dragState.touchCleanup=b}let l=c==="mouse"?"mousemove":c==="touch"?"touchmove":"pointermove",d=c==="mouse"?"mouseup":c==="touch"?"touchend":"pointerup",h=g=>{let b=this.dragState.startedFromTrustedEvent;return b===void 0||g.isTrusted===b},f=document.when(l).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),c==="touch"){let b=g.touches?.[0]||g.changedTouches?.[0];if(!b)return;this.handleDragMove(b.clientX,b.clientY);return}if(c==="mouse"){let b=g;if(typeof b.buttons=="number"&&(b.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),y=c==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):c==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,c){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,c);let l=Xr(this.allDropzones,a,c,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),d=Date.now(),h=d-(this.dragState.lastTargetChangeTime||0);l!==this.dragState.currentTarget&&(l===null||h>=50)&&(this.allDropzones.forEach(m=>Yt(m,"drag-over",!1)),l&&Yt(l,"drag-over",!0),this.dragState.currentTarget=l,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:c,currentTarget:l,sourceDroppable:d}=this.dragState,h=l;if(c){let y=c.getBoundingClientRect();h=Xr(this.allDropzones,y.left+y.width/2,y.top+y.height/2,c,this.collisionDetectionAlgorithm,this.trackedDragContainers)??l}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),ft(a,"lifted",!1)):this.handleInvalidDrop(a),c&&c.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{ft(y,"return-target",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,c){return this.trackedDroppables.includes(c)||this.trackedDragContainers.includes(c)}handleInvalidDrop(a){on(a)}createDragClone(a,c){let l=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];l.style.setProperty(m,d.getPropertyValue(m))}l.style.removeProperty("box-shadow");let h=kc(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=Sc(h,this.cloneZoom),l.style.position="fixed",l.style.width=`${c.width/this.cloneFrame.scale.x}px`,l.style.height=`${c.height/this.cloneFrame.scale.y}px`,l.style.zIndex="9999",l.style.pointerEvents="none",l.style.touchAction="none",l.style.userSelect="none",l.removeAttribute("data-draggable"),l.removeAttribute("tabindex"),l.setAttribute("data-drag-clone","true"),l.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(l),l}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,c){if(this.dragState.lastCoordinates={x:a,y:c},!this.dragState.dragClone)return;let{startOffset:l}=this.dragState,{x:d,y:h}=Uh(this.cloneFrame,a-l.x,c-l.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,c=()=>{let{dragClone:l,dragSource:d,lastCoordinates:h}=this.dragState;if(!l)return;let f=d?.isConnected?d:this,m=kc(f,this.dragCloneRoot());m!==l.parentNode&&(m.appendChild(l),this.cloneFrame=Sc(m,this.cloneZoom),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",c),a.addEventListener("webkitfullscreenchange",c),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",c),a.removeEventListener("webkitfullscreenchange",c)}})}activateAllDroppables(a=!1){this.setDragActive(!0),this.allDropzones.forEach(c=>{let l=this.trackedDragContainers.includes(c);Yt(c,"drag-active",a||!l)})}deactivateAllDroppables(){this.setDragActive(!1),this.allDropzones.forEach(a=>{Yt(a,"drag-active",!1),Yt(a,"drag-over",!1)})}endKeyboardDrag(){this.trackedDraggables.forEach(a=>{a.hasAttribute("data-keyboard-dragging")&&ft(a,"lifted",!1),a.removeAttribute("data-keyboard-dragging")}),this.deactivateAllDroppables()}setDragActive(a){z(this._internals?.states,"drag-active",a,["dragzone-active","dragzone-enabled"])}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{ft(a,"return-target",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(c){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",c)}}),this.dragSubscriptions=[],this.cloneFrame=Cc,this.cloneZoom=1,this.cursorBeforeDrag!==null&&(this.ownerDocument.documentElement.style.cursor=this.cursorBeforeDrag,this.cursorBeforeDrag=null),this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,c){let l=this._internals;l?.states&&(c?l.states.add(a):l.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)Wh(a)&&(z(a.internals.states,"chip",!1),z(a.internals.states,"drop",!1));this.#t.clear(),this.resetDragState()}}return n};var Qh={duration:250,easing:"ease",fill:"both"};function Ec(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Xh(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Ve(o){let t=new Map;return o.forEach(e=>{t.set(e,Ec(e))}),t}function Gh(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function Vo(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function Ac(o){return Vo(o)>0}function jo(o,t,e={}){let r=Vo(o);if(r<=0)return null;let i=Ec(o),{deltaX:n,deltaY:s,deltaW:a,deltaH:c}=Gh(t,i);if(n===0&&s===0&&a===1&&c===1)return null;let{duration:l,easing:d,fill:h}={...Qh,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${n}px, ${s}px) scale(${a}, ${c})`},{transformOrigin:"top left",transform:"none"}],{duration:l*r,easing:d,fill:h})}function je(o,t={}){let e=new Map;return o.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let n=jo(i,r,t);n&&e.set(i,n)}),e}var sn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Vt=(o,t,e,r='slot[part~="bank"]',i="closestCornersWithInventoryPriority")=>{let n=vc(o,t,e,r),s=Lo(n,t,e,r,i);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this.maxAssociations=0,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}#t;isSwapTarget(l){let d=this.dragState.sourceDroppable,h=parseInt(l.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(l)&&!!d&&d!==l&&this.trackedDroppables.includes(d)}isDeclarativeTarget(l){return l?l.acceptsDeclarativeDrops===!0?!0:l.hasAttribute("data-declarative-drops"):!1}chipsIn(l){return this.isDeclarativeTarget(l)?[...this.#t.get(l)??[]]:Array.from(l.querySelectorAll(t))}droppableHolding(l){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(l)||d.contains(l)||!!d.shadowRoot?.contains(l))??null}placeChip(l,d){this.#t.set(l,[...this.#t.get(l)??[],d])}removeChipFromDroppable(l,d){let h=l??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&Gr(h,!1),this.syncDragDropState();return}d.remove()}clearChips(l){this.isDeclarativeTarget(l)?(this.#t.set(l,[]),this.syncDragDropState()):this.chipsIn(l).forEach(d=>d.remove()),Gr(l,!1)}syncDragDropState(){let l={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),x=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[data-draggable="true"]'));l[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,x.length),h[m]=y}this._dragDrop={dragsByTarget:l,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:l}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(l[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((l,d)=>l+d,0)}droppableAtCapacityFromState(l){let d=parseInt(l.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=l.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(l){this._enableFlipAnimations=!l}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Ac(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let l=this.getResponse,d=typeof l=="function"?l.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(l){if(Array.isArray(l)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=l,this._internals.setFormValue(JSON.stringify(l));return}let d=this.getValue,h=typeof d=="function"?d.call(this,l):l,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof l=="string"&&l.length>0?[l]:[];this._internals.setFormValue(JSON.stringify(this._response)),this.trackedDroppables?.length&&this.validate()}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let l=this._pendingResponse;this._pendingResponse=void 0,this.response=l}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let l=this.dataset.choicesContainerWidth;l&&this.trackedDroppables.forEach(d=>{d.style.width=`${l}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(l){for(let h of l){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=l.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(l,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(l,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(l,d,h);let f=l.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity({trigger:"change"})}handleInvalidDrop(l){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!l)return;if(d&&f&&m)this.dropDraggableInDroppable(l,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(l,d,this.dragState.dragClone?.getBoundingClientRect());else if($o(l,"lifted")){this.restoreInventoryItem(l,this.dragState.dragClone?.getBoundingClientRect());let g=l.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),x=this.maxAssociations>0&&y>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity({trigger:"change"})}animateReturn(l,d){!l||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{jo(l,Xh(d),this.flipAnimationConfig)})}restoreInventoryItem(l,d){on(l),l.style.display="",l.style.position="",this.animateReturn(l,d)}placeResponse(l){let[d,...h]=l.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=Jr(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(l,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(l,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(l,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let _=l.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(l),l),_&&this.restoreOriginalInInventory(_,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,x=y===0||y>1,u=Array.from(d.querySelectorAll('[data-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Ve(u):null;if(!x){let _=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[data-draggable="true"]'));if(_){let A=_.getAttribute("identifier"),C=_.getBoundingClientRect();this.removeChipFromDroppable(d,_);let k=this.dragState.sourceDroppable,I=this.isDeclarativeTarget(d)&&k&&k!==d&&this.isDeclarativeTarget(k)?k:null;I?(this.placeChip(I,_),Gr(I,!0),this.animateReturn(_,C)):A&&this.restoreOriginalInInventory(A,C)}}let b=l.cloneNode(!0);b.removeAttribute("style"),b.removeAttribute("data-keyboard-dragging"),b.setAttribute("data-draggable","true"),b.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(b.setAttribute("part",b.localName==="qti-gap-text"?"chip text drag drag-text":"chip drag"),b.setAttribute("exportparts",["control: chip-control, control: drag-control, label: chip-label, label: drag-label","correction, candidate-correct, candidate-incorrect, candidate-partial","correction-correct, correction-incorrect, correction-partially-correct"].join(", ")),this.placeChip(d,b)):d.tagName==="SLOT"?b.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&b.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(b)),Gr(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&je(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let _=b.getBoundingClientRect(),A=h.left-_.left,C=h.top-_.top;(A!==0||C!==0)&&b.animate([{transform:`translate(${A}px, ${C}px)`},{transform:"translate(0, 0)"}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let q=l.getAttribute("identifier");q&&this.updateInventoryBasedOnMatchMax(q),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(l,d){let h=l.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&Gr(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(l,d){let h=Jr(this.trackedDragContainers,l),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[data-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let y=this.enableFlipAnimations&&m.length>0?Ve(m):null;h.forEach(x=>{on(x),x.style.display="",x.style.visibility="visible"}),y&&this.enableFlipAnimations&&je(y,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(l){let d=Jr(this.trackedDragContainers,l),h=Bh(this.trackedDraggables,l),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(x=>x.getAttribute("identifier")===l).length:m+y.querySelectorAll(`[identifier="${l}"]`).length,0);d.forEach(m=>{ft(m,"used",h!==0&&f>=h)})}checkAllMaxAssociations(){let l=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1}),h=this.maxAssociations>0&&l>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source"),y=this.droppableAtCapacityFromState(f);fr(f,(y||d&&h)&&!m)})}saveResponse(l){let d=this.getResponse,h=l??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(l=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this.trackedDroppables.forEach(d=>fr(d,!1)),this.checkAllMaxAssociations(),this.resetValidityReport(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),l&&this.saveResponse()}validate(){let l=this.totalAssociationsFromState(),d=this.maxAssociations>0&&l>=this.maxAssociations,h=this.maxAssociations>0&&l>this.maxAssociations,f=this.minAssociations>0&&l<this.minAssociations,m="",y=!0,x="other";h?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):f?(x="min",m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let u=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,u,{suppressInline:!0,kind:x}),y}reportValidity(l){return super.reportValidity(l)}}return sn([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),sn([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",void 0),sn([J({context:De})],a.prototype,"_dragDrop",void 0),sn([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),sn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Xt({emptyAs:[]})})],a.prototype,"response",null),a};var Fo=class{getInsertPosition(t,e,r,i,n){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),c=(n-a.top)/a.height,d=Math.min(1,Math.max(0,c))>.5;return{index:s,placeAfter:d}}};var Jh=new Fo;var Gm={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function an(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function zo(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function Bo(o,t,e={}){let r={...Gm,...e},i=document.createElement("div");return i.setAttribute("data-drop-preview","true"),i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(o).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(o).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*Vo(o)}ms ease`,i.style.pointerEvents="none",i}function _c(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var jt=(o,t='[data-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=an(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#n=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#r;#i;#n;#o;set allowReorder(i){this.#o=i}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(i){return _c(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let n=this.#c(i);return n===0||n>1}#c(i){let n=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(n)?1:n}#p(i){return i.querySelectorAll(t).length}#l(i){let n=this.#c(i);return n===0?!1:this.#p(i)>=n}#d(){this.#i={hoveredSlot:null,originalPositions:new Map}}#h(i){if(!this.#t||i===this.#t){this.#u();return}if(this.#i.hoveredSlot===i)return;this.#u();let n=this.#s(i);if(!n){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#l(i)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#i.hoveredSlot=null;return}this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.isDeclarativeTarget(i)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#i.hoveredSlot=i;return}let a=Ve([n]);this.#i.originalPositions.set(n,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(n),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,je(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),n=i.length>0?Ve(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),n&&je(n,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,n,s,a,...c){this.#t=null,this.#r=an(),this.#d();let l=this.findContainingDroppable(i);if(this.#e=l,l&&this.allowReorder){this.#t=l,this.#r.sortContainer=l;let h=i.getBoundingClientRect();this.#r.placeholder=Bo(i,h,this.sortablePlaceholderConfig);let f=i.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",l.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==l&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;fr(m,!1),this.#n.add(m)}})}let[d]=c;super.initiateDrag(i,n,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[n,s]of this.#i.originalPositions)s.appendChild(n);this.#r.placeholder&&this.#r.placeholder.remove(),zo(this.#r),this.#n.clear(),this.#t=null,this.#d()}onSortableDragMove(i,n){if(!this.isDraggingFromSlot)return;let s=Xr(this.trackedDroppables,i,n,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#h(s):this.#u()}handleDragMove(i,n){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,n),this.onSortableDragMove(i,n)}allowDrop(i,n){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&n!==this.#e&&this.trackedDroppables.includes(n)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(n)?this.#a(n)?!this.#l(n):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(n)?!0:super.allowDrop(i,n)}handleDrop(i,n){super.handleDrop(i,n),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var Yh=[M,U,Wt,w`
7098
6872
  :host {
7099
6873
  display: block; /* necessary to calculate scaling position */
7100
6874
  }
@@ -7151,9 +6925,9 @@ div.full-correct-response-inline {
7151
6925
  :host([answer-key]) ::slotted(qti-simple-associable-choice) {
7152
6926
  display: none;
7153
6927
  }
7154
- `];var Qf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Xf=Ut(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),Ai=class extends Ht(Xf,'[data-draggable="true"]'){static{this.styles=$p}constructor(){super(),this._childrenMap=[],this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(t){let e=t.composedPath()[0];if(this.shadowRoot?.contains(e))return;let i=e;this._childrenMap.includes(i)||(this._childrenMap=[...this._childrenMap,i])}#t(t,e){let i=this._dragDrop?.nodesByTarget?.[t]??[];return v`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
7155
- ${W(i,r=>r.getAttribute("identifier"),r=>r)}
7156
- </div>`}get#e(){return this.maxAssociations>0?this.maxAssociations:Math.ceil(this._childrenMap.length/2)}getResponse(){let t=[];for(let e=0;e<this.#e;e++){let i=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),n=i&&this.chipsIn(i)[0]?.getAttribute("identifier"),s=r&&this.chipsIn(r)[0]?.getAttribute("identifier");n&&s&&t.push(`${n} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,i)=>{let r=e.split(" ");return r.length!==2?[]:[`${r[0]} droplist${i}_left`,`${r[1]} droplist${i}_right`]})??[]}render(){return v` <slot name="prompt"></slot>
6928
+ `];var ef=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},rf=Vt(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),gr=class extends jt(rf,'[data-draggable="true"]'){static{this.styles=Yh}constructor(){super(),this._childrenMap=[],this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(t){let e=t.composedPath()[0];if(this.shadowRoot?.contains(e))return;let r=e;this._childrenMap.includes(r)||(this._childrenMap=[...this._childrenMap,r])}#t(t,e){let r=this._dragDrop?.nodesByTarget?.[t]??[];return v`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
6929
+ ${H(r,i=>i.getAttribute("identifier"),i=>i)}
6930
+ </div>`}get#e(){return this.maxAssociations>0?this.maxAssociations:Math.ceil(this._childrenMap.length/2)}getResponse(){let t=[];for(let e=0;e<this.#e;e++){let r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),i=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),n=r&&this.chipsIn(r)[0]?.getAttribute("identifier"),s=i&&this.chipsIn(i)[0]?.getAttribute("identifier");n&&s&&t.push(`${n} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,r)=>{let i=e.split(" ");return i.length!==2?[]:[`${i[0]} droplist${r}_left`,`${i[1]} droplist${r}_right`]})??[]}render(){return v` <slot name="prompt"></slot>
7157
6931
  <slot part="bank drags" name="qti-simple-associable-choice"></slot>
7158
6932
  <div part="drops">
7159
6933
  ${this._childrenMap.length>0&&Array.from({length:this.#e},(t,e)=>v`<div part="row drop-row">
@@ -7162,7 +6936,7 @@ div.full-correct-response-inline {
7162
6936
  </div>`)}
7163
6937
 
7164
6938
  <div role="alert" part="message" id="validation-message"></div>
7165
- </div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};Qf([R()],Ai.prototype,"_childrenMap",void 0);var vs=[{tag:"qti-associate-interaction",ctor:Ai}];var Xe=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ge=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(r,n)=>{this._choiceElements.forEach(s=>s.disabled=n)},this._handleReadonlyChange=(r,n)=>{this._choiceElements.forEach(s=>s.readonly=n)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(r,n){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(r){this.maxChoices>1&&(typeof r=="string"||r===null)?this.response=r?r.toString().split(","):[]:this.response=r||""}firstUpdated(){super.firstUpdated(),this._updateChoiceSelection()}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#t.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t&&(this.#t.disconnect(),this.#t=null)}_syncChoicesFromDOM(){let r=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{r.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let n=new Set(this._choiceElements.map(s=>s.getAttribute("identifier")??s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>n.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!n.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let n=this._choiceElements.filter(d=>this._getChoiceChecked(d)).length,s=!0,a="",l="other";this.maxChoices!==0&&n>this.maxChoices?(s=!1,l="max",a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):n<this.minChoices&&(s=!1,l="min",a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let c=this._choiceElements.find(d=>this.contains(d))||this;return this.setInteractionValidity(s,a,c,{suppressInline:!0,kind:l}),s}reportValidity(r){return super.reportValidity(r)}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let r=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==r&&(this._interactionContext={...this._interactionContext,choiceRole:r})}_choiceElementSelectedHandler(r){this._toggleChoiceChecked(r.target);let n=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==r.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&n&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(r,n){r.internals?.states&&(n?(r.internals.states.add("checked"),r.internals.ariaChecked="true"):(r.internals.states.delete("checked"),r.internals.ariaChecked="false"))}_getChoiceChecked(r){return r.internals.states.has("checked")}_toggleChoiceChecked(r){let n=this._getChoiceChecked(r);this._setChoiceChecked(r,!n)}_handleChoiceSelection(){let n=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?n[0]||"":n,this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(this.response)}_updateChoiceSelection(){let r=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(n=>{let s=r.includes(n.identifier);this._setChoiceChecked(n,s)})}}return Xe([Vi("#validation-message")],e.prototype,"_validationMessageElement",void 0),Xe([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Xe([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Xe([N("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Xe([N("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Xe([N("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Xe([p({attribute:"response",reflect:!1,converter:Kt({emptyAs:""})})],e.prototype,"response",void 0),Xe([N("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var Gf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Np=(o,t)=>{class e extends o{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#i=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#r=null;set class(r){this.#t=this.#n(r),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(r,n,s){super.attributeChangedCallback(r,n,s),r==="class"&&n!==s&&(this.class=s??"")}updated(r){super.updated(r),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#r=new MutationObserver(r=>{r.some(n=>n.type==="childList"||n.type==="attributes"&&n.attributeName==="style")&&this.#o()}),this.#r.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){super.disconnectedCallback(),this.#r?.disconnect(),this.#r=null}#n(r){return r?r.split(/\s+/).map(n=>n.trim()).filter(Boolean).filter((n,s,a)=>a.indexOf(n)===s):[]}#o(){let r=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),n=this.#s(r),s=this.#a(),a=this.#d();n.forEach((l,c)=>{l.marker=this.#u(c+1,s,a)})}#s(r){return r.map((n,s)=>{let a=Number(n.style.order);return{el:n,order:Number.isFinite(a)?a:s+1,index:s}}).sort((n,s)=>n.order-s.order||n.index-s.index).map(n=>n.el)}#a(){return this.#t.filter(r=>this.#e.includes(r)).pop()??null}#d(){return this.#t.filter(r=>this.#i.includes(r)).pop()??null}#u(r,n,s){let a=n;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let l="";switch(a){case"qti-labels-decimal":l=`${r}`;break;case"qti-labels-lower-alpha":l=this.#l(r,"lower");break;case"qti-labels-upper-alpha":l=this.#l(r,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(r,n){let s=r,a="",l=n==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return Gf([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var Lp=[M,H,w`
6939
+ </div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};ef([T()],gr.prototype,"_childrenMap",void 0);var Uo=[{tag:"qti-associate-interaction",ctor:gr}];var Fe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ze=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(i,n)=>{this._choiceElements.forEach(s=>s.disabled=n)},this._handleReadonlyChange=(i,n)=>{this._choiceElements.forEach(s=>s.readonly=n)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(i,n){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(i){this.maxChoices>1&&(typeof i=="string"||i===null)?this.response=i?i.toString().split(","):[]:this.response=i||""}firstUpdated(){super.firstUpdated(),this._updateChoiceSelection()}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#t.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t&&(this.#t.disconnect(),this.#t=null)}_syncChoicesFromDOM(){let i=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{i.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let n=new Set(this._choiceElements.map(s=>s.getAttribute("identifier")??s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>n.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!n.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let n=this._choiceElements.filter(d=>this._getChoiceChecked(d)).length,s=!0,a="",c="other";this.maxChoices!==0&&n>this.maxChoices?(s=!1,c="max",a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):n<this.minChoices&&(s=!1,c="min",a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(d=>this.contains(d))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0,kind:c}),s}reportValidity(i){return super.reportValidity(i)}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let i=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==i&&(this._interactionContext={...this._interactionContext,choiceRole:i})}_choiceElementSelectedHandler(i){this._toggleChoiceChecked(i.target);let n=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==i.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&n&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(i,n){i.internals?.states&&(n?(i.internals.states.add("checked"),i.internals.ariaChecked="true"):(i.internals.states.delete("checked"),i.internals.ariaChecked="false"))}_getChoiceChecked(i){return i.internals.states.has("checked")}_toggleChoiceChecked(i){let n=this._getChoiceChecked(i);this._setChoiceChecked(i,!n)}_handleChoiceSelection(){let n=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?n[0]||"":n,this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(this.response)}_updateChoiceSelection(){let i=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(n=>{let s=i.includes(n.identifier);this._setChoiceChecked(n,s)})}}return Fe([_r("#validation-message")],e.prototype,"_validationMessageElement",void 0),Fe([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Fe([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Fe([N("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Fe([N("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Fe([N("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Fe([p({attribute:"response",reflect:!1,converter:Xt({emptyAs:""})})],e.prototype,"response",void 0),Fe([N("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var nf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Kh=(o,t)=>{class e extends o{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#r=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#i=null;set class(i){this.#t=this.#n(i),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(i,n,s){super.attributeChangedCallback(i,n,s),i==="class"&&n!==s&&(this.class=s??"")}updated(i){super.updated(i),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(i=>{i.some(n=>n.type==="childList"||n.type==="attributes"&&n.attributeName==="style")&&this.#o()}),this.#i.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){super.disconnectedCallback(),this.#i?.disconnect(),this.#i=null}#n(i){return i?i.split(/\s+/).map(n=>n.trim()).filter(Boolean).filter((n,s,a)=>a.indexOf(n)===s):[]}#o(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(c=>c),n=this.#s(i),s=this.#a(),a=this.#c();n.forEach((c,l)=>{c.marker=this.#p(l+1,s,a)})}#s(i){return i.map((n,s)=>{let a=Number(n.style.order);return{el:n,order:Number.isFinite(a)?a:s+1,index:s}}).sort((n,s)=>n.order-s.order||n.index-s.index).map(n=>n.el)}#a(){return this.#t.filter(i=>this.#e.includes(i)).pop()??null}#c(){return this.#t.filter(i=>this.#r.includes(i)).pop()??null}#p(i,n,s){let a=n;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let c="";switch(a){case"qti-labels-decimal":c=`${i}`;break;case"qti-labels-lower-alpha":c=this.#l(i,"lower");break;case"qti-labels-upper-alpha":c=this.#l(i,"upper");break}return s==="qti-labels-suffix-period"?`${c}.`:s==="qti-labels-suffix-parenthesis"?`${c})`:c}#l(i,n){let s=i,a="",c=n==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(c+s%26)+a,s=Math.floor(s/26);return a}}return nf([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var Zh=[M,U,w`
7166
6940
  :host {
7167
6941
  display: block;
7168
6942
  }
@@ -7231,16 +7005,16 @@ div.full-correct-response-inline {
7231
7005
  :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
7232
7006
  grid-row: auto;
7233
7007
  }
7234
- `];var Jf=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},_i=class extends Np(Ge(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=Lp}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return v`
7008
+ `];var of=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},br=class extends Kh(ze(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=Zh}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return v`
7235
7009
  <slot part="prompt" name="prompt"></slot>
7236
7010
  <slot part="choices slot" @slotchange=${this.#t}></slot>
7237
7011
  <div part="message" role="alert" id="validation-message"></div>
7238
- `}};Jf([p({type:String})],_i.prototype,"orientation",void 0);var ys=[{tag:"qti-choice-interaction",ctor:_i}];var Vp=[M,w`
7012
+ `}};of([p({type:String})],br.prototype,"orientation",void 0);var Ho=[{tag:"qti-choice-interaction",ctor:br}];var tp=[M,w`
7239
7013
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
7240
7014
  :host {
7241
7015
  display: block;
7242
7016
  }
7243
- `];var Rn=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},dc=`
7017
+ `];var cn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Tc=`
7244
7018
  const postToParentWindows = (type, data) => {
7245
7019
  window.top.postMessage(data ? { type, data } : { type }, '*');
7246
7020
  let w = window.parent;
@@ -7307,7 +7081,7 @@ window.CES = {
7307
7081
  },
7308
7082
  };
7309
7083
  CES.load();
7310
- `,Yf=`
7084
+ `,sf=`
7311
7085
  (function() {
7312
7086
  var blobUrlReceived = null;
7313
7087
 
@@ -7351,16 +7125,16 @@ CES.load();
7351
7125
  requestBlobUrl();
7352
7126
  }
7353
7127
  })();
7354
- `,xe=class extends D{#t;#e;#i;static{this.styles=Vp}constructor(){super(),this.#t="",this.#e=null,this.#i=null,this._errorMessage=null,this.#r=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#r;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let i=this.querySelector("object[data]");if(i){t=i.getAttribute("data");let r=i.getAttribute("width"),n=i.getAttribute("height");r&&this.setAttribute("width",r),n&&this.setAttribute("height",n)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:fo((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(i=>i.json()).then(i=>{this.manifest=i,this.setupCES()}).catch(i=>{this._errorMessage=i})}async setupCES(){await this.updateComplete;let t=this.shadowRoot?.querySelector("#pciContainer");if(!t){this._errorMessage="pciContainer iframe not found";return}t.getAttribute("src")||t.setAttribute("src","about:blank");let e=t.contentDocument??t.contentWindow?.document??null;if(e||(await new Promise(d=>t.addEventListener("load",()=>d(),{once:!0})),e=t.contentDocument??t.contentWindow?.document??null),!e){this._errorMessage="pciContainer iframe document not available";return}if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let i=this.manifest.style[0],r=this.#a(),n=await this.#l(i,r),s=n.url;if(n.baseUrl&&!this.#i&&(this.#i=n.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#l(h,r,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#i&&(this.#i=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+dc+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let x=new Blob([m],{type:"text/html"});this.#r=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",y=await this.#l(m,r,{returnText:!0});if(d=y.url,y.baseUrl&&!this.#i&&(this.#i=y.baseUrl),y.text){let x=y.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let b="<script>"+dc+"</script>",q=x.indexOf("<head>");q!==-1?x=x.slice(0,q+6)+b+x.slice(q+6):x=b+x}let g=new Blob([x],{type:"text/html"});this.#r=URL.createObjectURL(g)}}if(d&&!this.#r)try{let h=await fetch(d);if(h.ok){let f=await h.text();if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let x="<script>"+dc+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let y=new Blob([f],{type:"text/html"});this.#r=URL.createObjectURL(y)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${Yf}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
7128
+ `,ge=class extends D{#t;#e;#r;static{this.styles=tp}constructor(){super(),this.#t="",this.#e=null,this.#r=null,this._errorMessage=null,this.#i=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#i;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let r=this.querySelector("object[data]");if(r){t=r.getAttribute("data");let i=r.getAttribute("width"),n=r.getAttribute("height");i&&this.setAttribute("width",i),n&&this.setAttribute("height",n)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:Yn((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}async setupCES(){await this.updateComplete;let t=this.shadowRoot?.querySelector("#pciContainer");if(!t){this._errorMessage="pciContainer iframe not found";return}t.getAttribute("src")||t.setAttribute("src","about:blank");let e=t.contentDocument??t.contentWindow?.document??null;if(e||(await new Promise(d=>t.addEventListener("load",()=>d(),{once:!0})),e=t.contentDocument??t.contentWindow?.document??null),!e){this._errorMessage="pciContainer iframe document not available";return}if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let r=this.manifest.style[0],i=this.#a(),n=await this.#l(r,i),s=n.url;if(n.baseUrl&&!this.#r&&(this.#r=n.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#l(h,i,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#r&&(this.#r=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+Tc+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let x=new Blob([m],{type:"text/html"});this.#i=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",y=await this.#l(m,i,{returnText:!0});if(d=y.url,y.baseUrl&&!this.#r&&(this.#r=y.baseUrl),y.text){let x=y.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let b="<script>"+Tc+"</script>",q=x.indexOf("<head>");q!==-1?x=x.slice(0,q+6)+b+x.slice(q+6):x=b+x}let g=new Blob([x],{type:"text/html"});this.#i=URL.createObjectURL(g)}}if(d&&!this.#i)try{let h=await fetch(d);if(h.ok){let f=await h.text();if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let x="<script>"+Tc+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let y=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(y)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let c=`<script>${sf}</script>`;window.addEventListener("message",this.handlePostMessage);let l=`
7355
7129
  <!DOCTYPE html>
7356
7130
  <html>
7357
7131
  <head>
7358
7132
  ${s?`<link href='${s}' rel="stylesheet" />`:""}
7359
- ${l}
7133
+ ${c}
7360
7134
  </head>
7361
7135
  <body></body>
7362
7136
  </html>
7363
- `;t.srcdoc=c}#n(){let t=this.shadowRoot.querySelectorAll("iframe"),e=this.querySelectorAll("iframe"),i=[...t,...e];for(let r of i){let n=r.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let a=r.contentDocument||r.contentWindow.document;a&&this.#o(a,i)}catch(a){console.error("Error accessing nested iframe:",a)}}return i.forEach((r,n)=>{i.indexOf(r)!==n&&i.splice(n,1)}),i}#o(t,e=[]){return t.querySelectorAll("iframe").forEach(r=>{e.push(r);let n=r.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let a=r.contentDocument||r.contentWindow.document;this.#o(a,e)}catch(a){console.error("Error accessing nested iframe:",a)}else console.warn("Skipped cross-origin iframe:",n)}),e}#s(t,e){window.postMessage({type:t,data:e},"*");let i=this.#n();for(let r of i)r.contentWindow&&r.contentWindow.postMessage({type:t,data:e},"*")}handlePostMessage(t){let{type:e,data:i}=t.data;switch(e){case"setResponse":(i===null||!(Array.isArray(i)&&i.length===1&&i[0]===""))&&(this.#t=i,this.saveResponse(i));break;case"getResponse":{this.#s("responseData",this.#t);break}case"getBlobUrl":{this.#r&&(this.#s("blobUrl",this.#r),t.source&&t.source!==window&&t.source.postMessage({type:"blobUrl",data:this.#r},"*"));break}case"getMedia":{let r=this.#a(),n=this.manifest.media.map(s=>{if(s.startsWith("http")||s.startsWith("blob"))return s;let a=this.#i||r[0];return a?new URL(s,a.endsWith("/")?a:`${a}/`).toString():s});this.#s("mediaData",n);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){if(!this.#t)return!1;if(Array.isArray(this.#t)){if(this.#t.length===0)return!1;for(let t of this.#t)if(t!==""&&t!==null)return!0}return!0}get response(){return this.#t||null}set response(t){if(typeof t=="string")this.#t=t,this.saveResponse(t);else if(Array.isArray(t))this.#t=t;else if(t)throw new Error("Value must be a string or an array of strings")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return v`<iframe
7137
+ `;t.srcdoc=l}#n(){let t=this.shadowRoot.querySelectorAll("iframe"),e=this.querySelectorAll("iframe"),r=[...t,...e];for(let i of r){let n=i.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let a=i.contentDocument||i.contentWindow.document;a&&this.#o(a,r)}catch(a){console.error("Error accessing nested iframe:",a)}}return r.forEach((i,n)=>{r.indexOf(i)!==n&&r.splice(n,1)}),r}#o(t,e=[]){return t.querySelectorAll("iframe").forEach(i=>{e.push(i);let n=i.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let a=i.contentDocument||i.contentWindow.document;this.#o(a,e)}catch(a){console.error("Error accessing nested iframe:",a)}else console.warn("Skipped cross-origin iframe:",n)}),e}#s(t,e){window.postMessage({type:t,data:e},"*");let r=this.#n();for(let i of r)i.contentWindow&&i.contentWindow.postMessage({type:t,data:e},"*")}handlePostMessage(t){let{type:e,data:r}=t.data;switch(e){case"setResponse":(r===null||!(Array.isArray(r)&&r.length===1&&r[0]===""))&&(this.#t=r,this.saveResponse(r));break;case"getResponse":{this.#s("responseData",this.#t);break}case"getBlobUrl":{this.#i&&(this.#s("blobUrl",this.#i),t.source&&t.source!==window&&t.source.postMessage({type:"blobUrl",data:this.#i},"*"));break}case"getMedia":{let i=this.#a(),n=this.manifest.media.map(s=>{if(s.startsWith("http")||s.startsWith("blob"))return s;let a=this.#r||i[0];return a?new URL(s,a.endsWith("/")?a:`${a}/`).toString():s});this.#s("mediaData",n);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){if(!this.#t)return!1;if(Array.isArray(this.#t)){if(this.#t.length===0)return!1;for(let t of this.#t)if(t!==""&&t!==null)return!0}return!0}get response(){return this.#t||null}set response(t){if(typeof t=="string")this.#t=t,this.saveResponse(t);else if(Array.isArray(t))this.#t=t;else if(t)throw new Error("Value must be a string or an array of strings")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return v`<iframe
7364
7138
  width=${this.getAttribute("width")}
7365
7139
  height=${this.getAttribute("height")}
7366
7140
  frameborder="0"
@@ -7371,9 +7145,9 @@ CES.load();
7371
7145
  ${this._errorMessage&&v`<div style="color:red">
7372
7146
  <h1>Error</h1>
7373
7147
  ${this._errorMessage}
7374
- </div>`}`}#a(){let e=[this.#i,this.baseRefUrl,this.baseItemUrl,this.#d()].filter(Boolean).map(r=>new URL(r,window.location.href).toString()),i=this.#u();return i&&e.push(i),[...new Set(e)]}#d(){return this.#e?new URL(".",this.#e).toString():null}#u(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,i={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let r of e){let n=new URL(r,window.location.href).toString(),s=new URL(t,n.endsWith("/")?n:`${n}/`).toString();try{let a=await fetch(s);if(a.ok){if(i.returnText){let l=await a.text();return{url:s,baseUrl:n,text:l}}return{url:s,baseUrl:n}}}catch{}}return{url:"",baseUrl:null}}};Rn([p({type:String,attribute:"data"})],xe.prototype,"data",void 0);Rn([p({type:String,attribute:"data-base-item"})],xe.prototype,"baseItemUrl",void 0);Rn([p({type:String,attribute:"data-base-ref"})],xe.prototype,"baseRefUrl",void 0);Rn([p({type:String,attribute:"id"})],xe.prototype,"id",void 0);Rn([R()],xe.prototype,"_errorMessage",void 0);var qs=[{tag:"qti-custom-interaction",ctor:xe}];var jp=[M];var In=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},we=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=jp}get#t(){let t=this._itemContext;if(!t)return!1;if(t.disabled||t.readonly)return!0;let e=this.closest("qti-assessment-item")?.getAttribute("adaptive")==="true",i=t.variables?.find(r=>r.identifier==="completionStatus")?.value;return e&&i==="completed"}render(){return v`<button ?disabled=${this.disabled||this.#t} part="button" @click=${this.endAttempt}>
7148
+ </div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(i=>new URL(i,window.location.href).toString()),r=this.#p();return r&&e.push(r),[...new Set(e)]}#c(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let i of e){let n=new URL(i,window.location.href).toString(),s=new URL(t,n.endsWith("/")?n:`${n}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let c=await a.text();return{url:s,baseUrl:n,text:c}}return{url:s,baseUrl:n}}}catch{}}return{url:"",baseUrl:null}}};cn([p({type:String,attribute:"data"})],ge.prototype,"data",void 0);cn([p({type:String,attribute:"data-base-item"})],ge.prototype,"baseItemUrl",void 0);cn([p({type:String,attribute:"data-base-ref"})],ge.prototype,"baseRefUrl",void 0);cn([p({type:String,attribute:"id"})],ge.prototype,"id",void 0);cn([T()],ge.prototype,"_errorMessage",void 0);var Wo=[{tag:"qti-custom-interaction",ctor:ge}];var ep=[M];var ln=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},be=class extends S{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=ep}get#t(){let t=this._itemContext;if(!t)return!1;if(t.disabled||t.readonly)return!0;let e=this.closest("qti-assessment-item")?.getAttribute("adaptive")==="true",r=t.variables?.find(i=>i.identifier==="completionStatus")?.value;return e&&r==="completed"}render(){return v`<button ?disabled=${this.disabled||this.#t} part="button" @click=${this.endAttempt}>
7375
7149
  ${this.title}
7376
- </button>`}endAttempt(t){this.disabled||this.#t||this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt!=="false"}}))}};In([p({type:String,attribute:"response-identifier"})],we.prototype,"responseIdentifier",void 0);In([p({reflect:!0,type:Boolean})],we.prototype,"disabled",void 0);In([I({context:F,subscribe:!0}),R()],we.prototype,"_itemContext",void 0);In([p({type:String,attribute:"count-attempt"})],we.prototype,"countAttempt",void 0);In([p({type:String})],we.prototype,"title",void 0);var xs=[{tag:"qti-end-attempt-interaction",ctor:we}];var Fp=[M,w`
7150
+ </button>`}endAttempt(t){this.disabled||this.#t||this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt!=="false"}}))}};ln([p({type:String,attribute:"response-identifier"})],be.prototype,"responseIdentifier",void 0);ln([p({reflect:!0,type:Boolean})],be.prototype,"disabled",void 0);ln([R({context:j,subscribe:!0}),T()],be.prototype,"_itemContext",void 0);ln([p({type:String,attribute:"count-attempt"})],be.prototype,"countAttempt",void 0);ln([p({type:String})],be.prototype,"title",void 0);var Qo=[{tag:"qti-end-attempt-interaction",ctor:be}];var rp=[M,w`
7377
7151
  /* PK: display host as block, else design will be collapsed */
7378
7152
  /* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
7379
7153
  :host {
@@ -7386,7 +7160,7 @@ CES.load();
7386
7160
  height: 100%;
7387
7161
  border: 0;
7388
7162
  }
7389
- `];var yt=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},zp=5,Kf=50,Bp="qti-height-lines-",Up=!1,J=class extends D{constructor(){super(...arguments),this._rows=zp,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||Up||(Up=!0,console.warn('<qti-extended-text-interaction format="xhtml"> renders as plain text. The interaction has no rich-text editor; the recorded response will contain no markup.'))},this.minStrings=0,this.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Fp}_handleRowsInputChange(){this._rows=this.#t()}#t(){let t=this.#e();return t!==null?t:this.expectedLines>0?this.expectedLines:this.expectedLength>0?Math.ceil(this.expectedLength/Kf):zp}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(Bp))continue;let e=parseInt(t.slice(Bp.length),10);if(!Number.isNaN(e)&&e>0)return e}return null}get value(){return this.response||null}set value(t){this.response=t||null}validate(){let t=this.shadowRoot.querySelector("textarea");if(!t)return!1;let e="",i=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let n=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,s=new RegExp(n);i=t.checkValidity()&&s.test(t.value),i||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else i=t.checkValidity();let r="other";return i&&!this.response&&this.minStrings>=1&&(i=!1,r="min"),!i&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(i,e,t,{suppressInline:!0,kind:r}),i}reportValidity(t){return this.validate(),super.reportValidity(t)}renderPrompt(){return v`<slot name="prompt"></slot>`}renderTextarea(){return v`<textarea
7163
+ `];var gt=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ip=5,af=50,np="qti-height-lines-",op=!1,Q=class extends D{constructor(){super(...arguments),this._rows=ip,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||op||(op=!0,console.warn('<qti-extended-text-interaction format="xhtml"> renders as plain text. The interaction has no rich-text editor; the recorded response will contain no markup.'))},this.minStrings=0,this.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=rp}_handleRowsInputChange(){this._rows=this.#t()}#t(){let t=this.#e();return t!==null?t:this.expectedLines>0?this.expectedLines:this.expectedLength>0?Math.ceil(this.expectedLength/af):ip}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(np))continue;let e=parseInt(t.slice(np.length),10);if(!Number.isNaN(e)&&e>0)return e}return null}get value(){return this.response||null}set value(t){this.response=t||null}validate(){let t=this.shadowRoot.querySelector("textarea");if(!t)return!1;let e="",r=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let n=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,s=new RegExp(n);r=t.checkValidity()&&s.test(t.value),r||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else r=t.checkValidity();let i="other";return r&&!this.response&&this.minStrings>=1&&(r=!1,i="min"),!r&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(r,e,t,{suppressInline:!0,kind:i}),r}reportValidity(t){return this.validate(),super.reportValidity(t)}renderPrompt(){return v`<slot name="prompt"></slot>`}renderTextarea(){return v`<textarea
7390
7164
  part="textarea"
7391
7165
  name="${this.responseIdentifier}"
7392
7166
  spellcheck="false"
@@ -7396,12 +7170,12 @@ CES.load();
7396
7170
  @keyup="${this.textChanged}"
7397
7171
  @change="${this.textChanged}"
7398
7172
  @blur="${t=>{this.reportValidity({trigger:"change"})}}"
7399
- placeholder="${G(this.placeholderText?this.placeholderText:void 0)}"
7173
+ placeholder="${kt(this.placeholderText?this.placeholderText:void 0)}"
7400
7174
  rows="${this._rows}"
7401
7175
  ?disabled="${this.disabled}"
7402
7176
  ?readonly="${this.readonly}"
7403
7177
  .value=${this.response}
7404
- ></textarea>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value),this.reportValidity({trigger:"change"}))}};yt([R()],J.prototype,"_rows",void 0);yt([p({type:Number,attribute:"expected-length"})],J.prototype,"expectedLength",void 0);yt([p({type:Number,attribute:"expected-lines"})],J.prototype,"expectedLines",void 0);yt([p({type:String,reflect:!0})],J.prototype,"format",void 0);yt([N("format")],J.prototype,"_handleFormatChange",void 0);yt([p({type:Number,attribute:"min-strings"})],J.prototype,"minStrings",void 0);yt([p({type:String,attribute:"pattern-mask"})],J.prototype,"patternMask",void 0);yt([p({type:String,attribute:"placeholder-text"})],J.prototype,"placeholderText",void 0);yt([p({type:String,attribute:"data-patternmask-message"})],J.prototype,"dataPatternmaskMessage",void 0);yt([p({type:String,attribute:"class"})],J.prototype,"classNames",void 0);yt([N(["classNames","expectedLines","expectedLength"])],J.prototype,"_handleRowsInputChange",null);yt([p({type:String,attribute:"response",reflect:!1})],J.prototype,"response",void 0);yt([N("response",{waitUntilFirstUpdate:!0})],J.prototype,"_handleResponseChange",void 0);var ws=[{tag:"qti-extended-text-interaction",ctor:J}];var Hp=[M,H,w`
7178
+ ></textarea>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value),this.reportValidity({trigger:"change"}))}};gt([T()],Q.prototype,"_rows",void 0);gt([p({type:Number,attribute:"expected-length"})],Q.prototype,"expectedLength",void 0);gt([p({type:Number,attribute:"expected-lines"})],Q.prototype,"expectedLines",void 0);gt([p({type:String,reflect:!0})],Q.prototype,"format",void 0);gt([N("format")],Q.prototype,"_handleFormatChange",void 0);gt([p({type:Number,attribute:"min-strings"})],Q.prototype,"minStrings",void 0);gt([p({type:String,attribute:"pattern-mask"})],Q.prototype,"patternMask",void 0);gt([p({type:String,attribute:"placeholder-text"})],Q.prototype,"placeholderText",void 0);gt([p({type:String,attribute:"data-patternmask-message"})],Q.prototype,"dataPatternmaskMessage",void 0);gt([p({type:String,attribute:"class"})],Q.prototype,"classNames",void 0);gt([N(["classNames","expectedLines","expectedLength"])],Q.prototype,"_handleRowsInputChange",null);gt([p({type:String,attribute:"response",reflect:!1})],Q.prototype,"response",void 0);gt([N("response",{waitUntilFirstUpdate:!0})],Q.prototype,"_handleResponseChange",void 0);var Xo=[{tag:"qti-extended-text-interaction",ctor:Q}];var sp=[M,U,w`
7405
7179
  :host {
7406
7180
  display: flex;
7407
7181
  align-items: flex-start;
@@ -7449,10 +7223,10 @@ CES.load();
7449
7223
  :host([answer-key]) [part~='bank'] {
7450
7224
  display: none;
7451
7225
  }
7452
- `];var dr=class extends Ht(Ut(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1}static{this.styles=Hp}render(){return v`<slot name="prompt"> </slot>
7226
+ `];var Yr=class extends jt(Vt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1}static{this.styles=sp}render(){return v`<slot name="prompt"> </slot>
7453
7227
  <slot part="bank drags" name="drags"></slot>
7454
7228
  <slot part="drops"></slot>
7455
- <div role="alert" part="message" id="validation-message"></div>`}};var Cs=[{tag:"qti-gap-match-interaction",ctor:dr}];function Gp(o){return o.querySelector('img, object[type^="image"]')}function Wp(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let i=parseFloat(e);return Number.isFinite(i)&&i>0?i:null}var Jp=new WeakMap,Qp=new WeakMap;function Zf(o){let t=Qp.get(o);return t||(t=new Promise(e=>{let i=o.data;if(!i){e(null);return}let r=new Image;r.onload=()=>{let n={width:r.naturalWidth,height:r.naturalHeight};if(!(n.width>0)||!(n.height>0)){e(null);return}Jp.set(o,n),e(n)},r.onerror=()=>e(null),r.src=i}),Qp.set(o,t)),t}function tg(o){if(o.localName==="object")return Jp.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function ks(o){let t=Wp(o,"width"),e=Wp(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let i=tg(o);return i?{width:t??i.width,height:e??i.height}:null}function eg(o){let t=ks(o);if(t)return Promise.resolve(t);if(o.localName==="object")return Zf(o).then(()=>ks(o));let e=o;return e.complete?Promise.resolve(null):new Promise(i=>{let r=()=>{e.removeEventListener("load",r),e.removeEventListener("error",r),i(ks(o))};e.addEventListener("load",r),e.addEventListener("error",r)})}function re(o,t,e,i){let r=ks(e);if(r){Xp(o,t,r,i);return}eg(e).then(n=>{if(!n){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}Xp(o,t,n,i)})}function Xp(o,t,{width:e,height:i},r){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[n,s,a]=t,l=n/e*100,c=s/i*100,d=a/e*100,h=a/i*100;r.style.left=l-d+"%",r.style.top=c-h+"%",r.style.width=2*d+"%",r.style.height=2*h+"%",r.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[n,s,a,l]=t,c=n/e*100,d=s/i*100,h=a/e*100,f=l/i*100;r.style.left=c+"%",r.style.top=d+"%",r.style.width=h-c+"%",r.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[n,s,a,l]=t,c=n/e*100,d=s/i*100,h=a/e*100,f=l/i*100;r.style.left=c-h+"%",r.style.top=d-f+"%",r.style.width=2*h+"%",r.style.height=2*f+"%",r.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let n=[];for(let b=0;b<t.length;b+=2)n.push({x:t[b],y:t[b+1]});let s=Math.min(...n.map(b=>b.x)),a=Math.max(...n.map(b=>b.x)),l=Math.min(...n.map(b=>b.y)),c=Math.max(...n.map(b=>b.y)),d=s/e*100,h=l/i*100,f=a/e*100,m=c/i*100;r.style.left=d+"%",r.style.top=h+"%",r.style.width=f-d+"%",r.style.height=m-h+"%";let y=n.map(b=>({x:(b.x-s)/(a-s)*100,y:(b.y-l)/(c-l)*100})),x=y.map(b=>`${b.x}% ${b.y}%`).join(",");r.style.clipPath=`polygon(${x})`;let u=y.map(b=>`${b.x},${b.y}`).join(" "),g=b=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${u}' fill='none' stroke='black' stroke-width='${b}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;r.style.setProperty("--qti-shape-outline",g(4)),r.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":r.style.left="0%",r.style.top="0%",r.style.width="100%",r.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var Yp=[M,H,w`
7229
+ <div role="alert" part="message" id="validation-message"></div>`}};var Go=[{tag:"qti-gap-match-interaction",ctor:Yr}];function dp(o){return o.querySelector('img, object[type^="image"]')}function ap(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let r=parseFloat(e);return Number.isFinite(r)&&r>0?r:null}var hp=new WeakMap,cp=new WeakMap;function cf(o){let t=cp.get(o);return t||(t=new Promise(e=>{let r=o.data;if(!r){e(null);return}let i=new Image;i.onload=()=>{let n={width:i.naturalWidth,height:i.naturalHeight};if(!(n.width>0)||!(n.height>0)){e(null);return}hp.set(o,n),e(n)},i.onerror=()=>e(null),i.src=r}),cp.set(o,t)),t}function lf(o){if(o.localName==="object")return hp.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function Jo(o){let t=ap(o,"width"),e=ap(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let r=lf(o);return r?{width:t??r.width,height:e??r.height}:null}function df(o){let t=Jo(o);if(t)return Promise.resolve(t);if(o.localName==="object")return cf(o).then(()=>Jo(o));let e=o;return e.complete?Promise.resolve(null):new Promise(r=>{let i=()=>{e.removeEventListener("load",i),e.removeEventListener("error",i),r(Jo(o))};e.addEventListener("load",i),e.addEventListener("error",i)})}function Kt(o,t,e,r){let i=Jo(e);if(i){lp(o,t,i,r);return}df(e).then(n=>{if(!n){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}lp(o,t,n,r)})}function lp(o,t,{width:e,height:r},i){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[n,s,a]=t,c=n/e*100,l=s/r*100,d=a/e*100,h=a/r*100;i.style.left=c-d+"%",i.style.top=l-h+"%",i.style.width=2*d+"%",i.style.height=2*h+"%",i.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[n,s,a,c]=t,l=n/e*100,d=s/r*100,h=a/e*100,f=c/r*100;i.style.left=l+"%",i.style.top=d+"%",i.style.width=h-l+"%",i.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[n,s,a,c]=t,l=n/e*100,d=s/r*100,h=a/e*100,f=c/r*100;i.style.left=l-h+"%",i.style.top=d-f+"%",i.style.width=2*h+"%",i.style.height=2*f+"%",i.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let n=[];for(let b=0;b<t.length;b+=2)n.push({x:t[b],y:t[b+1]});let s=Math.min(...n.map(b=>b.x)),a=Math.max(...n.map(b=>b.x)),c=Math.min(...n.map(b=>b.y)),l=Math.max(...n.map(b=>b.y)),d=s/e*100,h=c/r*100,f=a/e*100,m=l/r*100;i.style.left=d+"%",i.style.top=h+"%",i.style.width=f-d+"%",i.style.height=m-h+"%";let y=n.map(b=>({x:(b.x-s)/(a-s)*100,y:(b.y-c)/(l-c)*100})),x=y.map(b=>`${b.x}% ${b.y}%`).join(",");i.style.clipPath=`polygon(${x})`;let u=y.map(b=>`${b.x},${b.y}`).join(" "),g=b=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${u}' fill='none' stroke='black' stroke-width='${b}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;i.style.setProperty("--qti-shape-outline",g(4)),i.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":i.style.left="0%",i.style.top="0%",i.style.width="100%",i.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var pp=[M,U,w`
7456
7230
  /* Containing block for the absolutely positioned hotspots over the image. Was on this host in
7457
7231
  the theme, together with a 'display: block' this component now owns. */
7458
7232
  :host {
@@ -7501,32 +7275,32 @@ CES.load();
7501
7275
  ::slotted(qti-associable-hotspot) {
7502
7276
  cursor: pointer;
7503
7277
  }
7504
- `];var Ri=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},qt=class extends D{static{this.styles=Yp}#t;#e;constructor(){super(),this.#t=[],this.#e=null,this._response=[],this.minAssociations=0,this.maxAssociations=1,this.addEventListener("qti-register-hotspot",this.#o)}reset(){this.resetValidityReport(),this._response=[],this._internals.setFormValue(null),this.validate(),this.#e=null,this.#c()}validate(){let t=this.#n().length,e=this.maxAssociations>0&&t>this.maxAssociations,i=t<this.minAssociations,r="other",n="";e?(r="max",n=this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):i&&(r="min",n=this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`);let s=!e&&!i;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:r}),s}reportValidity(t){return super.reportValidity(t)}set response(t){this._response=this.#r(t),this.#i(!1),this.#c()}#i(t){let e=this.#n();this._internals.setFormValue(e.length?JSON.stringify(e):null),this.validate(),t&&this.reportValidity({trigger:"change"})}get response(){return this._response}#r(t){return t==null||t===""?[]:Array.isArray(t)?t:[t]}#n(){return this.#r(this._response)}renderSupplementalLines(){return P}render(){return v`<slot name="prompt"></slot>
7278
+ `];var vr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bt=class extends D{static{this.styles=pp}#t;#e;constructor(){super(),this.#t=[],this.#e=null,this._response=[],this.minAssociations=0,this.maxAssociations=1,this.addEventListener("qti-register-hotspot",this.#o)}reset(){this.resetValidityReport(),this._response=[],this._internals.setFormValue(null),this.validate(),this.#e=null,this.#h()}validate(){let t=this.#n().length,e=this.maxAssociations>0&&t>this.maxAssociations,r=t<this.minAssociations,i="other",n="";e?(i="max",n=this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):r&&(i="min",n=this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`);let s=!e&&!r;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:i}),s}reportValidity(t){return super.reportValidity(t)}set response(t){this._response=this.#i(t),this.#r(!1),this.#h()}#r(t){let e=this.#n();this._internals.setFormValue(e.length?JSON.stringify(e):null),this.validate(),t&&this.reportValidity({trigger:"change"})}get response(){return this._response}#i(t){return t==null||t===""?[]:Array.isArray(t)?t:[t]}#n(){return this.#i(this._response)}renderSupplementalLines(){return P}render(){return v`<slot name="prompt"></slot>
7505
7279
  <line-container
7506
7280
  @click=${t=>{this.#e&&!t.composedPath().some(e=>this.#t.includes(e))&&this.#a()}}
7507
7281
  >
7508
7282
  <svg
7509
- width=${G(this.grImage[0]?.width)}
7510
- height=${G(this.grImage[0]?.height)}
7283
+ width=${kt(this.grImage[0]?.width)}
7284
+ height=${kt(this.grImage[0]?.height)}
7511
7285
  viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
7512
7286
  >
7513
- ${W(this.#n(),t=>t,(t,e)=>{let[i,r]=t.split(" "),n=this.querySelector(`[identifier=${i}]`),s=this.querySelector(`[identifier=${r}]`);if(!n||!s)return P;let a=parseInt(n.style.left),l=parseInt(n.style.top),c=parseInt(s.style.left),d=parseInt(s.style.top),h=f=>{f.stopPropagation(),this.#d(e)};return Ur`
7514
- <line part="line" x1=${a} y1=${l} x2=${c} y2=${d} stroke="currentColor" stroke-width="3" />
7287
+ ${H(this.#n(),t=>t,(t,e)=>{let[r,i]=t.split(" "),n=this.querySelector(`[identifier=${r}]`),s=this.querySelector(`[identifier=${i}]`);if(!n||!s)return P;let a=parseInt(n.style.left),c=parseInt(n.style.top),l=parseInt(s.style.left),d=parseInt(s.style.top),h=f=>{f.stopPropagation(),this.#c(e)};return Ii`
7288
+ <line part="line" x1=${a} y1=${c} x2=${l} y2=${d} stroke="currentColor" stroke-width="3" />
7515
7289
  <line
7516
7290
  data-hit
7517
7291
  x1=${a}
7518
- y1=${l}
7519
- x2=${c}
7292
+ y1=${c}
7293
+ x2=${l}
7520
7294
  y2=${d}
7521
7295
  tabindex=${this.disabled||this.readonly?-1:0}
7522
7296
  role="button"
7523
- aria-label=${`Remove line ${i} \u2013 ${r}`}
7297
+ aria-label=${`Remove line ${r} \u2013 ${i}`}
7524
7298
  @click=${h}
7525
7299
  @keydown=${f=>{["Enter"," ","Delete","Backspace"].includes(f.key)&&(f.preventDefault(),h(f))}}
7526
- ><title>Remove line ${i} – ${r}</title></line>
7300
+ ><title>Remove line ${r} – ${i}</title></line>
7527
7301
  `})}
7528
7302
  ${this.renderSupplementalLines()}
7529
- ${this.#e&&Ur`<line
7303
+ ${this.#e&&Ii`<line
7530
7304
  part="point"
7531
7305
  x1=${this.startCoord.x}
7532
7306
  y1=${this.startCoord.y}
@@ -7538,7 +7312,7 @@ CES.load();
7538
7312
  </svg>
7539
7313
  <slot></slot>
7540
7314
  </line-container>
7541
- <div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),i=t.target,r=i.getAttribute("coords"),n=i.getAttribute("shape"),s=r.split(",").map(a=>parseInt(a));re(n,s,e,i)}firstUpdated(){super.firstUpdated(),this.#t=Array.from(this.querySelectorAll("qti-associable-hotspot")),this.addEventListener("mousemove",t=>{let e=this.grImage[0];if(!e)return;let i=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-i.left,y:t.clientY-i.top}}),this.#t.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.tabIndex=0,t.setAttribute("role","button"),t.hasAttribute("aria-label")||t.setAttribute("aria-label",t.getAttribute("hotspot-label")||t.getAttribute("identifier")),t.addEventListener("click",()=>this.#s(t)),t.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.#s(t))})}),this.addEventListener("keydown",t=>{t.key==="Escape"&&this.#e&&this.#a()}),this.#c()}#s(t){if(this.disabled||this.readonly)return;if(!this.#e){if(this.#l(t))return;this.#e=t,this.startCoord=this.#h(t),this.mouseCoord=this.startCoord,this.#c();return}if(t===this.#e){this.#a();return}let e=this.#e.getAttribute("identifier"),i=t.getAttribute("identifier"),r=this.#n(),n=r.some(a=>this.#u(a,e,i)),s=this.maxAssociations===0||r.length<this.maxAssociations;!n&&s&&!this.#l(t)&&(this._response=[...r,`${e} ${i}`],this.saveResponse(this.response),this.#i(!0)),this.#a()}#a(){this.#e=null,this.#c(),this.requestUpdate()}#d(t){this.disabled||this.readonly||(this._response=this.#n().filter((e,i)=>i!==t),this.saveResponse(this.response),this.#i(!0),this.#c())}#u(t,e,i){let[r,n]=t.split(" ");return r===e&&n===i||r===i&&n===e}#l(t){let e=Number(t.getAttribute("match-max")??0);if(!e)return!1;let i=t.getAttribute("identifier");return this.#n().filter(r=>r.split(" ").includes(i)).length>=e}#h(t){let[e,i]=(t.getAttribute("coords")??"0,0").split(",").map(r=>parseInt(r));return{x:e,y:i}}#c(){for(let t of this.#t){let e=t.internals?.states;B(e,"checked",t===this.#e),B(e,"full",this.#l(t))}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};Ri([R()],qt.prototype,"startCoord",void 0);Ri([R()],qt.prototype,"mouseCoord",void 0);Ri([vd({selector:"img"})],qt.prototype,"grImage",void 0);Ri([R()],qt.prototype,"_response",void 0);Ri([p({type:Number,attribute:"min-associations"})],qt.prototype,"minAssociations",void 0);Ri([p({type:Number,attribute:"max-associations"})],qt.prototype,"maxAssociations",void 0);Ri([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Kt({emptyAs:[]})})],qt.prototype,"response",null);var Ss=[{tag:"qti-graphic-associate-interaction",ctor:qt}];var Kp=[M,H,w`
7315
+ <div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),n=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));Kt(n,s,e,r)}firstUpdated(){super.firstUpdated(),this.#t=Array.from(this.querySelectorAll("qti-associable-hotspot")),this.addEventListener("mousemove",t=>{let e=this.grImage[0];if(!e)return;let r=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-r.left,y:t.clientY-r.top}}),this.#t.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.tabIndex=0,t.setAttribute("role","button"),t.hasAttribute("aria-label")||t.setAttribute("aria-label",t.getAttribute("hotspot-label")||t.getAttribute("identifier")),t.addEventListener("click",()=>this.#s(t)),t.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.#s(t))})}),this.addEventListener("keydown",t=>{t.key==="Escape"&&this.#e&&this.#a()}),this.#h()}#s(t){if(this.disabled||this.readonly)return;if(!this.#e){if(this.#l(t))return;this.#e=t,this.startCoord=this.#d(t),this.mouseCoord=this.startCoord,this.#h();return}if(t===this.#e){this.#a();return}let e=this.#e.getAttribute("identifier"),r=t.getAttribute("identifier"),i=this.#n(),n=i.some(a=>this.#p(a,e,r)),s=this.maxAssociations===0||i.length<this.maxAssociations;!n&&s&&!this.#l(t)&&(this._response=[...i,`${e} ${r}`],this.saveResponse(this.response),this.#r(!0)),this.#a()}#a(){this.#e=null,this.#h(),this.requestUpdate()}#c(t){this.disabled||this.readonly||(this._response=this.#n().filter((e,r)=>r!==t),this.saveResponse(this.response),this.#r(!0),this.#h())}#p(t,e,r){let[i,n]=t.split(" ");return i===e&&n===r||i===r&&n===e}#l(t){let e=Number(t.getAttribute("match-max")??0);if(!e)return!1;let r=t.getAttribute("identifier");return this.#n().filter(i=>i.split(" ").includes(r)).length>=e}#d(t){let[e,r]=(t.getAttribute("coords")??"0,0").split(",").map(i=>parseInt(i));return{x:e,y:r}}#h(){for(let t of this.#t){let e=t.internals?.states;z(e,"checked",t===this.#e),z(e,"full",this.#l(t))}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};vr([T()],bt.prototype,"startCoord",void 0);vr([T()],bt.prototype,"mouseCoord",void 0);vr([Nl({selector:"img"})],bt.prototype,"grImage",void 0);vr([T()],bt.prototype,"_response",void 0);vr([p({type:Number,attribute:"min-associations"})],bt.prototype,"minAssociations",void 0);vr([p({type:Number,attribute:"max-associations"})],bt.prototype,"maxAssociations",void 0);vr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Xt({emptyAs:[]})})],bt.prototype,"response",null);var Yo=[{tag:"qti-graphic-associate-interaction",ctor:bt}];var up=[M,U,w`
7542
7316
  :host {
7543
7317
  display: flex;
7544
7318
  align-items: flex-start;
@@ -7627,10 +7401,10 @@ CES.load();
7627
7401
  user-select: none;
7628
7402
  pointer-events: none;
7629
7403
  }
7630
- `];var ig=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},rg=Ut(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='bank']"),Ii=class extends Ht(rg,'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1,this.autoSizeDropzones=!1,this._graphicScale=1,this.#t=null,this.#e=null,this.#s=t=>{this.#n(t.target)}}static{this.styles=Kp}#t;#e;render(){let t=`--qti-graphic-scale: ${this._graphicScale}`;return v` <slot name="prompt"></slot>
7404
+ `];var hf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pf=Vt(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='bank']"),yr=class extends jt(pf,'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1,this.autoSizeDropzones=!1,this._graphicScale=1,this.#t=null,this.#e=null,this.#s=t=>{this.#n(t.target)}}static{this.styles=up}#t;#e;render(){let t=`--qti-graphic-scale: ${this._graphicScale}`;return v` <slot name="prompt"></slot>
7631
7405
  <slot part="image" style=${t}></slot>
7632
7406
  <slot part="bank drags" name="drags" class="hover-border" style=${t}></slot>
7633
- <div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#i(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#r(t){if(t.style.aspectRatio)return;let e=n=>{let s=(t.getAttribute(n)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},i=e("width"),r=e("height");i&&r&&(t.style.aspectRatio=`${i} / ${r}`)}#n(t){let e=this.#i(),i=t.getAttribute("coords"),r=t.getAttribute("shape");!e||!i||!r||(this.#r(e),this.#o(e),re(r,i.split(",").map(n=>parseFloat(n)),e,t))}#o(t){this.#e!==t&&(this.#t?.disconnect(),this.#e=t,this.#t=new ResizeObserver(()=>{let e=parseFloat(t.getAttribute("width")??""),i=t.getBoundingClientRect().width,r=e>0&&i>0?Math.min(1,i/e):1,n=Math.round(r*1e3)/1e3;n!==this._graphicScale&&(this._graphicScale=n)}),this.#t.observe(t))}#s;connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#s),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#n(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s),this.#t?.disconnect(),this.#t=null,this.#e=null}};ig([R()],Ii.prototype,"_graphicScale",void 0);var Es=[{tag:"qti-graphic-gap-match-interaction",ctor:Ii}];var Zp=[M,H,w`
7407
+ <div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#r(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#i(t){if(t.style.aspectRatio)return;let e=n=>{let s=(t.getAttribute(n)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},r=e("width"),i=e("height");r&&i&&(t.style.aspectRatio=`${r} / ${i}`)}#n(t){let e=this.#r(),r=t.getAttribute("coords"),i=t.getAttribute("shape");!e||!r||!i||(this.#i(e),this.#o(e),Kt(i,r.split(",").map(n=>parseFloat(n)),e,t))}#o(t){this.#e!==t&&(this.#t?.disconnect(),this.#e=t,this.#t=new ResizeObserver(()=>{let e=parseFloat(t.getAttribute("width")??""),r=t.getBoundingClientRect().width,i=e>0&&r>0?Math.min(1,r/e):1,n=Math.round(i*1e3)/1e3;n!==this._graphicScale&&(this._graphicScale=n)}),this.#t.observe(t))}#s;connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#s),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#n(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s),this.#t?.disconnect(),this.#t=null,this.#e=null}};hf([T()],yr.prototype,"_graphicScale",void 0);var Ko=[{tag:"qti-graphic-gap-match-interaction",ctor:yr}];var mp=[M,U,w`
7634
7408
  /* The order pins are anchored outside their hotspot's box. */
7635
7409
  :host {
7636
7410
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
@@ -7668,11 +7442,11 @@ CES.load();
7668
7442
  pointer-events: none;
7669
7443
  user-select: none;
7670
7444
  }
7671
- `];var tu=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Je=class o extends Ge(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#n=t=>{this.#r(t.target),this.refreshLocatorPins()}}static{this.styles=Zp}static#t="cito-graphic-order-marker";render(){return v`
7445
+ `];var fp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Be=class o extends ze(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#n=t=>{this.#i(t.target),this.refreshLocatorPins()}}static{this.styles=mp}static#t="cito-graphic-order-marker";render(){return v`
7672
7446
  <slot name="prompt"></slot>
7673
7447
  <slot></slot>
7674
7448
  <div role="alert" part="message" id="validation-message"></div>
7675
- `}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(n=>n.identifier===e))return;let i=[...this.#e()],r=i.indexOf(e);if(r>=0)i.splice(r,1);else{let n=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(i.length>=n)return;i.push(e)}this.response=i,this.saveResponse(this.response),this.updateComplete.then(()=>{this.validate(),this.reportValidity({trigger:"change"})})}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#i(t){return`--qti-graphic-order-${(t.identifier||t.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(t){return"var(--qti-selected-bg)"}refreshLocatorPins(){let t=this.#e();for(let n of this._choiceElements){let s=t.indexOf(n.identifier);n.order=s>=0?s+1:null}let e=this._choiceElements.filter(n=>n.order!=null).sort((n,s)=>n.order-s.order),i=Array.from(this.querySelectorAll(`.${o.#t}`));i.length===e.length&&e.every((n,s)=>{let a=i[s];return a.textContent===String(n.order)&&a.style.getPropertyValue("position-anchor")===this.#i(n)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(n)})||(i.forEach(n=>n.remove()),this._choiceElements.forEach(n=>{n.style.removeProperty("anchor-name")}),e.forEach(n=>{let s=this.#i(n);n.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(n)),n.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(n.order),this.append(a)}))}#r(t){let e=Gp(this),i=t.getAttribute("coords"),r=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let n=i.split(",").map(s=>parseInt(s));re(r,n,e,t)}#n;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#n),this.refreshLocatorPins(),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#r(t))}disconnectedCallback(){this.querySelectorAll(`.${o.#t}`).forEach(t=>t.remove()),super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#n)}};tu([p({type:Number,attribute:"max-choices"})],Je.prototype,"maxChoices",void 0);tu([N("response")],Je.prototype,"handleOrderedResponseChange",null);var As=[{tag:"qti-graphic-order-interaction",ctor:Je}];var eu=[M,H,w`
7449
+ `}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(n=>n.identifier===e))return;let r=[...this.#e()],i=r.indexOf(e);if(i>=0)r.splice(i,1);else{let n=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(r.length>=n)return;r.push(e)}this.response=r,this.saveResponse(this.response),this.updateComplete.then(()=>{this.validate(),this.reportValidity({trigger:"change"})})}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#r(t){return`--qti-graphic-order-${(t.identifier||t.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(t){return"var(--qti-selected-bg)"}refreshLocatorPins(){let t=this.#e();for(let n of this._choiceElements){let s=t.indexOf(n.identifier);n.order=s>=0?s+1:null}let e=this._choiceElements.filter(n=>n.order!=null).sort((n,s)=>n.order-s.order),r=Array.from(this.querySelectorAll(`.${o.#t}`));r.length===e.length&&e.every((n,s)=>{let a=r[s];return a.textContent===String(n.order)&&a.style.getPropertyValue("position-anchor")===this.#r(n)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(n)})||(r.forEach(n=>n.remove()),this._choiceElements.forEach(n=>{n.style.removeProperty("anchor-name")}),e.forEach(n=>{let s=this.#r(n);n.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(n)),n.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(n.order),this.append(a)}))}#i(t){let e=dp(this),r=t.getAttribute("coords"),i=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let n=r.split(",").map(s=>parseInt(s));Kt(i,n,e,t)}#n;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#n),this.refreshLocatorPins(),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#i(t))}disconnectedCallback(){this.querySelectorAll(`.${o.#t}`).forEach(t=>t.remove()),super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#n)}};fp([p({type:Number,attribute:"max-choices"})],Be.prototype,"maxChoices",void 0);fp([N("response")],Be.prototype,"handleOrderedResponseChange",null);var Zo=[{tag:"qti-graphic-order-interaction",ctor:Be}];var gp=[M,U,w`
7676
7450
  :host {
7677
7451
  display: block;
7678
7452
  }
@@ -7721,17 +7495,17 @@ CES.load();
7721
7495
  max-width: 100%;
7722
7496
  height: auto;
7723
7497
  }
7724
- `];var hr=class extends Ge(D,"qti-hotspot-choice"){static{this.styles=eu}render(){return v`
7498
+ `];var Kr=class extends ze(D,"qti-hotspot-choice"){static{this.styles=gp}render(){return v`
7725
7499
  <slot name="prompt"></slot>
7726
7500
  <slot></slot>
7727
7501
  <div part="message" role="alert" id="validation-message"></div>
7728
- `}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let i=()=>{t.removeEventListener("load",i),e(t)};t.addEventListener("load",i)})),this.#t}async#i(t){let e=this.querySelector("img");if(!e)return;let i=t.getAttribute("coords"),r=t.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a)),s=await this.#e(e);re(r,n,s,t)}#r=t=>{this.#i(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#r),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#i(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#r)}};var _s=[{tag:"qti-hotspot-interaction",ctor:hr}];var iu=[M,H,w`
7502
+ `}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let r=()=>{t.removeEventListener("load",r),e(t)};t.addEventListener("load",r)})),this.#t}async#r(t){let e=this.querySelector("img");if(!e)return;let r=t.getAttribute("coords"),i=t.getAttribute("shape"),n=r.split(",").map(a=>parseInt(a)),s=await this.#e(e);Kt(i,n,s,t)}#i=t=>{this.#r(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#i),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var ts=[{tag:"qti-hotspot-interaction",ctor:Kr}];var bp=[M,U,w`
7729
7503
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
7730
7504
  :host {
7731
7505
  display: block;
7732
7506
  }
7733
- `];var pr=class extends Ge(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>v`<slot></slot>
7734
- <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=iu}};var Rs=[{tag:"qti-hottext-interaction",ctor:pr}];var hc=(o,t="[part='menu']",e="[part='trigger']",i="--qti-inline-choice-width")=>{class r extends o{#t=null;#e=null;#i=null;#r=0;#n=null;shouldAutoSizeMenu(){return!1}menuAutoSizeExtraWidth(){return 0}menuAutoSizePropertyTarget(){return this.renderRoot?.querySelector(e)??null}menuAutoSizeRows(){let s=this.renderRoot?.querySelector(t);return s?Array.from(s.children).flatMap(a=>a instanceof HTMLSlotElement?a.assignedElements().filter(l=>l instanceof HTMLElement):a instanceof HTMLElement?[a]:[]):[]}withMenuMeasurable(s){let a=this.renderRoot?.querySelector(t);if(!a)return s();let l=a.matches(":popover-open"),c=a.style.visibility,d=a.style.display;l||(a.style.visibility="hidden",a.style.display="block",a.showPopover?.());try{return s()}finally{l||(a.hidePopover?.(),a.style.visibility=c,a.style.display=d)}}updateMenuWidth(){if(!this.isConnected||!this.shouldAutoSizeMenu())return;let s=this.menuAutoSizePropertyTarget();if(!s)return;let a=this.renderRoot?.querySelector(t);a&&this.#d(a),this.#s();let l=this.#o()+this.menuAutoSizeExtraWidth();l<=0||l===this.#n||(this.#n=l,s.style.setProperty(i,`${l}px`))}#o(){return this.withMenuMeasurable(()=>{let s=0;for(let c of this.menuAutoSizeRows()){let d=c.style.width;c.style.width="max-content",s=Math.max(s,c.getBoundingClientRect().width),c.style.width=d}if(s<=0)return 0;let a=this.renderRoot?.querySelector(t);if(!a)return s;let l=getComputedStyle(a);return s+parseFloat(l.paddingLeft)+parseFloat(l.paddingRight)})}#s(){typeof MutationObserver>"u"||this.#i||(this.#i=new MutationObserver(()=>this.#a()),this.#i.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#a(){this.#r||(this.#r=requestAnimationFrame(()=>{this.#r=0,this.updateMenuWidth()}))}#d(s){typeof ResizeObserver>"u"||this.#e===s||(this.#t??=new ResizeObserver(()=>{this.#e?.matches(":popover-open")&&this.#a()}),this.#e&&this.#t.unobserve(this.#e),this.#t.observe(s),this.#e=s)}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e=null,this.#i?.disconnect(),this.#i=null,this.#r&&cancelAnimationFrame(this.#r),this.#r=0,super.disconnectedCallback()}}return r};var ng=w`
7507
+ `];var Zr=class extends ze(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>v`<slot></slot>
7508
+ <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=bp}};var es=[{tag:"qti-hottext-interaction",ctor:Zr}];var Rc=(o,t="[part='menu']",e="[part='trigger']",r="--qti-inline-choice-width")=>{class i extends o{#t=null;#e=null;#r=null;#i=0;#n=null;shouldAutoSizeMenu(){return!1}menuAutoSizeExtraWidth(){return 0}menuAutoSizePropertyTarget(){return this.renderRoot?.querySelector(e)??null}menuAutoSizeRows(){let s=this.renderRoot?.querySelector(t);return s?Array.from(s.children).flatMap(a=>a instanceof HTMLSlotElement?a.assignedElements().filter(c=>c instanceof HTMLElement):a instanceof HTMLElement?[a]:[]):[]}withMenuMeasurable(s){let a=this.renderRoot?.querySelector(t);if(!a)return s();let c=a.matches(":popover-open"),l=a.style.visibility,d=a.style.display;c||(a.style.visibility="hidden",a.style.display="block",a.showPopover?.());try{return s()}finally{c||(a.hidePopover?.(),a.style.visibility=l,a.style.display=d)}}updateMenuWidth(){if(!this.isConnected||!this.shouldAutoSizeMenu())return;let s=this.menuAutoSizePropertyTarget();if(!s)return;let a=this.renderRoot?.querySelector(t);a&&this.#c(a),this.#s();let c=this.#o()+this.menuAutoSizeExtraWidth();c<=0||c===this.#n||(this.#n=c,s.style.setProperty(r,`${c}px`))}#o(){return this.withMenuMeasurable(()=>{let s=0;for(let l of this.menuAutoSizeRows()){let d=l.style.width;l.style.width="max-content",s=Math.max(s,l.getBoundingClientRect().width),l.style.width=d}if(s<=0)return 0;let a=this.renderRoot?.querySelector(t);if(!a)return s;let c=getComputedStyle(a);return s+parseFloat(c.paddingLeft)+parseFloat(c.paddingRight)})}#s(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#a()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#a(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMenuWidth()}))}#c(s){typeof ResizeObserver>"u"||this.#e===s||(this.#t??=new ResizeObserver(()=>{this.#e?.matches(":popover-open")&&this.#a()}),this.#e&&this.#t.unobserve(this.#e),this.#t.observe(s),this.#e=s)}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e=null,this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return i};var uf=w`
7735
7509
  /* ── Host ──────────────────────────────────────────────────────────────────
7736
7510
  Inline-block so the element flows with surrounding text.
7737
7511
  --qti-inline-choice-width is the single width control surface:
@@ -7949,7 +7723,7 @@ CES.load();
7949
7723
  z-index: var(--qti-overlay-z-index);
7950
7724
  white-space: nowrap;
7951
7725
  }
7952
- `,og=ng,ru=og;var ne=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},sg=0,nt=class extends hc(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${sg++}`,this._handleDataPromptChange=()=>{this.#i()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity({trigger:"change"})},this._pendingResponse=void 0,this.#o=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#s=t=>{this.disabled||this.readonly||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#n(!0))},this.#a=t=>{let i=t.newState==="open";this._dropdownOpen!==i&&(this._dropdownOpen=i),i?this._internals.states.add("open"):this._internals.states.delete("open")},this.#d=t=>{if(!this._dropdownOpen)return;if(t.key==="Escape"){t.preventDefault(),this.#n(!1),this.#u();return}let e=this.#f(),i=this.renderRoot.activeElement,r=this.#l(),n=i||(r instanceof HTMLElement&&this.#h(r)?r:null),s=e.findIndex(a=>a===n);if(t.key==="ArrowDown"&&(t.preventDefault(),e[Math.min(e.length-1,Math.max(0,s+1))]?.focus()),t.key==="ArrowUp"&&(t.preventDefault(),e[Math.max(0,s-1)]?.focus()),t.key==="Enter"||t.key===" "){if(!n)return;if(t.preventDefault(),n instanceof HTMLButtonElement)n.click();else{let a=n.getAttribute("identifier")??"";this.#r(a)}}},this.#p=()=>{this.#i()},this.#g=t=>{if(this.disabled||this.readonly)return;let i=t.currentTarget.getAttribute("identifier")??"";this.#r(i)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[ru]}renderTrigger(){let t=this.#e();return v`
7726
+ `,mf=uf,vp=mf;var Zt=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ff=0,rt=class extends Rc(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${ff++}`,this._handleDataPromptChange=()=>{this.#r()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity({trigger:"change"})},this._pendingResponse=void 0,this.#o=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#s=t=>{this.disabled||this.readonly||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#n(!0))},this.#a=t=>{let r=t.newState==="open";this._dropdownOpen!==r&&(this._dropdownOpen=r),r?this._internals.states.add("open"):this._internals.states.delete("open")},this.#c=t=>{if(!this._dropdownOpen)return;if(t.key==="Escape"){t.preventDefault(),this.#n(!1),this.#p();return}let e=this.#v(),r=this.renderRoot.activeElement,i=this.#l(),n=r||(i instanceof HTMLElement&&this.#d(i)?i:null),s=e.findIndex(a=>a===n);if(t.key==="ArrowDown"&&(t.preventDefault(),e[Math.min(e.length-1,Math.max(0,s+1))]?.focus()),t.key==="ArrowUp"&&(t.preventDefault(),e[Math.max(0,s-1)]?.focus()),t.key==="Enter"||t.key===" "){if(!n)return;if(t.preventDefault(),n instanceof HTMLButtonElement)n.click();else{let a=n.getAttribute("identifier")??"";this.#i(a)}}},this.#g=()=>{this.#r()},this.#m=t=>{if(this.disabled||this.readonly)return;let r=t.currentTarget.getAttribute("identifier")??"";this.#i(r)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[vp]}renderTrigger(){let t=this.#e();return v`
7953
7727
  <button
7954
7728
  part="trigger"
7955
7729
  type="button"
@@ -7969,31 +7743,31 @@ CES.load();
7969
7743
  aria-hidden="true"
7970
7744
  ></span>
7971
7745
  </button>
7972
- `}renderMenu(){let t=this.options[0],e=this.#t(),i=t?.selected??!0,r=e&&i,n=e&&!i,s=["option","prompt",t?.selected?"selected":"",n?"clear":"","option-prompt",t?.selected?"option-selected":"",n?"option-clear":""].filter(Boolean).join(" ");return v`
7746
+ `}renderMenu(){let t=this.options[0],e=this.#t(),r=t?.selected??!0,i=e&&r,n=e&&!r,s=["option","prompt",t?.selected?"selected":"",n?"clear":"","option-prompt",t?.selected?"option-selected":"",n?"option-clear":""].filter(Boolean).join(" ");return v`
7973
7747
  <div
7974
7748
  id="${this._menuId}"
7975
7749
  part="menu"
7976
7750
  role="listbox"
7977
7751
  popover="auto"
7978
7752
  @toggle=${this.#a}
7979
- @keydown=${this.#d}
7753
+ @keydown=${this.#c}
7980
7754
  >
7981
7755
  <button
7982
7756
  part="${s}"
7983
7757
  type="button"
7984
7758
  role="option"
7985
- ?hidden=${r}
7986
- aria-label=${G(n?this.dataClearLabel||"Clear":void 0)}
7759
+ ?hidden=${i}
7760
+ aria-label=${kt(n?this.dataClearLabel||"Clear":void 0)}
7987
7761
  aria-selected="${t?.selected?"true":"false"}"
7988
- @click=${()=>this.#r("")}
7762
+ @click=${()=>this.#i("")}
7989
7763
  >
7990
7764
  <span part="option-content"
7991
7765
  >${n?v`<span part="clear-icon" aria-hidden="true"></span>`:t?.content}</span
7992
7766
  >
7993
7767
  </button>
7994
- <slot @slotchange=${this.#p}></slot>
7768
+ <slot @slotchange=${this.#g}></slot>
7995
7769
  </div>
7996
- `}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#i(),this.#m(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#i()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#v(),this.#f()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#v()}#t(){let t=this.options[0]?.content;return typeof t=="string"&&t.trim()===""}menuAutoSizeRows(){let t=super.menuAutoSizeRows();return this.#t()?t.filter(e=>!e.matches('button[part~="option-prompt"]')):t}#e(){return this.options.find(t=>t.selected)??this.options[0]}#i(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt??this.configContext?.inlineChoicePrompt??"select",i=this._pendingResponse,r=i!==void 0?i??"":this.options.find(a=>a.selected)?.value??"",n=[{content:e,value:"",selected:r===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===r}})],s=n.some(a=>a.selected);this.options=s?n:n.map((a,l)=>({...a,selected:l===0})),this._pendingResponse=void 0,this.#v(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize===!1?!1:!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-"))}menuAutoSizeExtraWidth(){let t=this.renderRoot.querySelector('span[part~="icon"]');if(!t)return 0;let e=this.renderRoot.querySelector('button[part="trigger"]'),i=e&&parseFloat(getComputedStyle(e).columnGap)||0;return t.offsetWidth+i}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,i=this.required||this.minChoices>=1,r=e||!i,n=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(r,r?"":n,this,{suppressInline:!0,kind:"min"}),r}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this.#n(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#v()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(i=>({...i,selected:i.value===e})),this.#v()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#r(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#v(),this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(t),this.#n(!1)}#n(t){let e=this.#c();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#o;#s;#a;#d;#u(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#l(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#h(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#c(){return this.renderRoot.querySelector(`#${this._menuId}`)}#m(){this._slotObserver=new MutationObserver(()=>this.#i()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#p;#g;#b(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#g),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#v(){this._internals.setFormValue(this.response),await this.updateComplete;let t=this.options.find(i=>i.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let i of e){let n=(i.getAttribute("identifier")??"")===t;i.removeEventListener("click",this.#g),i.addEventListener("click",this.#g),i.disabled=this.disabled,i.readonly=this.readonly,i.internals.role="option",i.internals.ariaSelected=n?"true":"false",i.internals.ariaChecked=n?"true":"false",i.internals.ariaDisabled=this.disabled?"true":"false",i.internals.ariaReadOnly=this.readonly?"true":"false",n?i.internals.states.add("checked"):i.internals.states.delete("checked"),i.tabIndex=-1}}#f(){let t=this.renderRoot.querySelector('button[part~="option"]:not([hidden])'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};ne([R()],nt.prototype,"options",void 0);ne([R()],nt.prototype,"_dropdownOpen",void 0);ne([I({context:wt,subscribe:!0}),p({attribute:!1})],nt.prototype,"configContext",void 0);ne([p({type:String,attribute:"data-prompt"})],nt.prototype,"dataPrompt",void 0);ne([p({type:String,attribute:"data-clear-label"})],nt.prototype,"dataClearLabel",void 0);ne([N("dataPrompt",{waitUntilFirstUpdate:!0})],nt.prototype,"_handleDataPromptChange",void 0);ne([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],nt.prototype,"required",void 0);ne([p({type:Number,attribute:"min-choices"})],nt.prototype,"minChoices",void 0);ne([N(["required","minChoices"],{waitUntilFirstUpdate:!0})],nt.prototype,"_handleRequiredChange",void 0);ne([p({attribute:"response",reflect:!1,noAccessor:!0})],nt.prototype,"response",null);var Is=[{tag:"qti-inline-choice-interaction",ctor:nt}];var nu=[M,H,w`
7770
+ `}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#r(),this.#u(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#r()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#f(),this.#v()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#f()}#t(){let t=this.options[0]?.content;return typeof t=="string"&&t.trim()===""}menuAutoSizeRows(){let t=super.menuAutoSizeRows();return this.#t()?t.filter(e=>!e.matches('button[part~="option-prompt"]')):t}#e(){return this.options.find(t=>t.selected)??this.options[0]}#r(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt??this.configContext?.inlineChoicePrompt??"select",r=this._pendingResponse,i=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",n=[{content:e,value:"",selected:i===""},...t.map(a=>{let c=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(l=>l.cloneNode(!0)),value:c,selected:c!==""&&c===i}})],s=n.some(a=>a.selected);this.options=s?n:n.map((a,c)=>({...a,selected:c===0})),this._pendingResponse=void 0,this.#f(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize===!1?!1:!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-"))}menuAutoSizeExtraWidth(){let t=this.renderRoot.querySelector('span[part~="icon"]');if(!t)return 0;let e=this.renderRoot.querySelector('button[part="trigger"]'),r=e&&parseFloat(getComputedStyle(e).columnGap)||0;return t.offsetWidth+r}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,r=this.required||this.minChoices>=1,i=e||!r,n=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(i,i?"":n,this,{suppressInline:!0,kind:"min"}),i}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this.#n(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#f()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(r=>({...r,selected:r.value===e})),this.#f()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#i(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#f(),this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(t),this.#n(!1)}#n(t){let e=this.#h();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#o;#s;#a;#c;#p(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#l(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#d(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#h(){return this.renderRoot.querySelector(`#${this._menuId}`)}#u(){this._slotObserver=new MutationObserver(()=>this.#r()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#g;#m;#b(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#m),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#f(){this._internals.setFormValue(this.response),await this.updateComplete;let t=this.options.find(r=>r.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let r of e){let n=(r.getAttribute("identifier")??"")===t;r.removeEventListener("click",this.#m),r.addEventListener("click",this.#m),r.disabled=this.disabled,r.readonly=this.readonly,r.internals.role="option",r.internals.ariaSelected=n?"true":"false",r.internals.ariaChecked=n?"true":"false",r.internals.ariaDisabled=this.disabled?"true":"false",r.internals.ariaReadOnly=this.readonly?"true":"false",n?r.internals.states.add("checked"):r.internals.states.delete("checked"),r.tabIndex=-1}}#v(){let t=this.renderRoot.querySelector('button[part~="option"]:not([hidden])'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};Zt([T()],rt.prototype,"options",void 0);Zt([T()],rt.prototype,"_dropdownOpen",void 0);Zt([R({context:yt,subscribe:!0}),p({attribute:!1})],rt.prototype,"configContext",void 0);Zt([p({type:String,attribute:"data-prompt"})],rt.prototype,"dataPrompt",void 0);Zt([p({type:String,attribute:"data-clear-label"})],rt.prototype,"dataClearLabel",void 0);Zt([N("dataPrompt",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleDataPromptChange",void 0);Zt([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],rt.prototype,"required",void 0);Zt([p({type:Number,attribute:"min-choices"})],rt.prototype,"minChoices",void 0);Zt([N(["required","minChoices"],{waitUntilFirstUpdate:!0})],rt.prototype,"_handleRequiredChange",void 0);Zt([p({attribute:"response",reflect:!1,noAccessor:!0})],rt.prototype,"response",null);var rs=[{tag:"qti-inline-choice-interaction",ctor:rt}];var yp=[M,U,w`
7997
7771
  /*
7998
7772
  * A custom element is inline unless it says otherwise, and this one never did. Its shadow content
7999
7773
  * is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
@@ -8099,7 +7873,7 @@ CES.load();
8099
7873
  :host(:disabled:not(.qti-match-tabular)) ::slotted(qti-simple-match-set:first-of-type) {
8100
7874
  display: none;
8101
7875
  }
8102
- `];var ou=[M,w`
7876
+ `];var qp=[M,w`
8103
7877
  :host(.qti-match-tabular) slot:not([hidden]) {
8104
7878
  display: contents;
8105
7879
  }
@@ -8188,7 +7962,7 @@ CES.load();
8188
7962
  justify-content: center;
8189
7963
  flex-shrink: 0;
8190
7964
  }
8191
- `];var Ts=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},oe=class extends Ht(Ut(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[data-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.maxAssociations=1,this.minAssociations=0,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,i=e.value,r=e.name,n=e.type;e.checked?(this.response?this.response.indexOf(i)===-1&&(n==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(r)===-1)),this.response=[...this.response,i]):this.response=[i],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==i),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}static{this.styles=[nu,ou]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(t){this.classList.contains("qti-match-tabular")?this._response=t:super.response=t}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...t){this.classList.contains("qti-match-tabular")||super.initiateDrag(...t)}afterCache(){this.classList.contains("qti-match-tabular")||super.afterCache()}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.syncTabularSlotting()}willUpdate(t){super.willUpdate?.(t),t.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let t=this.classList.contains("qti-match-tabular"),e=this.querySelectorAll(":scope > qti-simple-match-set"),i=e[0],r=e[1],n=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(i?.setAttribute("slot","match-rows"),r?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{n(s),s.setAttribute("role","rowheader"),s.tabIndex=-1}),this.targetChoices?.forEach(s=>{n(s),s.setAttribute("role","columnheader"),s.tabIndex=-1})):(i?.removeAttribute("slot"),r?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}),this.targetChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return v`
7965
+ `];var is=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},te=class extends jt(Vt(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[data-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.maxAssociations=1,this.minAssociations=0,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,r=e.value,i=e.name,n=e.type;e.checked?(this.response?this.response.indexOf(r)===-1&&(n==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(i)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==r),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}static{this.styles=[yp,qp]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(t){this.classList.contains("qti-match-tabular")?this._response=t:super.response=t}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...t){this.classList.contains("qti-match-tabular")||super.initiateDrag(...t)}afterCache(){this.classList.contains("qti-match-tabular")||super.afterCache()}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.syncTabularSlotting()}willUpdate(t){super.willUpdate?.(t),t.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let t=this.classList.contains("qti-match-tabular"),e=this.querySelectorAll(":scope > qti-simple-match-set"),r=e[0],i=e[1],n=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(r?.setAttribute("slot","match-rows"),i?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{n(s),s.setAttribute("role","rowheader"),s.tabIndex=-1}),this.targetChoices?.forEach(s=>{n(s),s.setAttribute("role","columnheader"),s.tabIndex=-1})):(r?.removeAttribute("slot"),i?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}),this.targetChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return v`
8192
7966
  <slot name="prompt"></slot>
8193
7967
  <slot ?hidden=${t}></slot>
8194
7968
 
@@ -8204,18 +7978,18 @@ CES.load();
8204
7978
  </div>
8205
7979
  <div part="rows rows-wrap"><slot name="match-rows" part="row-header r-header"></slot></div>
8206
7980
  <div part="cells checkbox-grid">
8207
- ${this.sourceChoices.map((e,i)=>v`
7981
+ ${this.sourceChoices.map((e,r)=>v`
8208
7982
  <div role="row" style="display: contents;">
8209
- ${this.targetChoices.map((r,n)=>{let s=e.getAttribute("identifier"),a=r.getAttribute("identifier"),l=`${s} ${a}`,c=(this.response||[]).filter(g=>g.split(" ")[0]===s).length||0,d=this.response?.includes(l)||!1,h=e.matchMax===1?"radio":"checkbox",f=this.getCellStateVariant(l,d),m=d?"checked":"",y=`control ${h} ${m} ${f}`.trim(),x=`control-mark ${h} ${m} ${f}`.trim(),u=e.matchMax===1?!1:e.matchMax!==0&&c>=e.matchMax&&!d;return v`
7983
+ ${this.targetChoices.map((i,n)=>{let s=e.getAttribute("identifier"),a=i.getAttribute("identifier"),c=`${s} ${a}`,l=(this.response||[]).filter(g=>g.split(" ")[0]===s).length||0,d=this.response?.includes(c)||!1,h=e.matchMax===1?"radio":"checkbox",f=this.getCellStateVariant(c,d),m=d?"checked":"",y=`control ${h} ${m} ${f}`.trim(),x=`control-mark ${h} ${m} ${f}`.trim(),u=e.matchMax===1?!1:e.matchMax!==0&&l>=e.matchMax&&!d;return v`
8210
7984
  <label
8211
7985
  part="cell input-cell"
8212
7986
  role="gridcell"
8213
- style="grid-row: ${i+1}; grid-column: ${n+1}; display: flex; align-items: center; justify-content: center; cursor: pointer;"
7987
+ style="grid-row: ${r+1}; grid-column: ${n+1}; display: flex; align-items: center; justify-content: center; cursor: pointer;"
8214
7988
  >
8215
7989
  <input
8216
7990
  type=${h}
8217
7991
  name=${s}
8218
- value=${l}
7992
+ value=${c}
8219
7993
  .checked=${d}
8220
7994
  .disabled=${u}
8221
7995
  @change=${g=>this.handleRadioChange(g)}
@@ -8233,13 +8007,13 @@ CES.load();
8233
8007
  `:P}
8234
8008
 
8235
8009
  <div role="alert" part="message" id="validation-message"></div>
8236
- `}};Ts([p({type:String})],oe.prototype,"class",void 0);Ts([p({type:String,attribute:"data-first-column-header"})],oe.prototype,"dataFirstColumnHeader",void 0);Ts([R()],oe.prototype,"_response",void 0);Ts([p({type:String,attribute:"response-identifier"})],oe.prototype,"responseIdentifier",void 0);var Ms=[{tag:"qti-match-interaction",ctor:oe}];var su=[M,w`
8010
+ `}};is([p({type:String})],te.prototype,"class",void 0);is([p({type:String,attribute:"data-first-column-header"})],te.prototype,"dataFirstColumnHeader",void 0);is([T()],te.prototype,"_response",void 0);is([p({type:String,attribute:"response-identifier"})],te.prototype,"responseIdentifier",void 0);var ns=[{tag:"qti-match-interaction",ctor:te}];var xp=[M,w`
8237
8011
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
8238
8012
  :host {
8239
8013
  display: block;
8240
8014
  }
8241
- `];var Ps=class extends D{static{this.styles=su}#t=null;reset(){this.#t=null}validate(){return!0}get response(){return this.#t?this.#t.toString():null}set response(t){if(t)if(!isNaN(parseInt(t?.toString())))this.#t=parseInt(t.toString());else throw new Error(`Value must be a number ${t}`)}static get properties(){return{...D.properties,step:{type:Number,attribute:"step",default:10}}}render(){return v` <slot name="prompt"></slot>
8242
- <slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var Os=[{tag:"qti-media-interaction",ctor:Ps}];var au=[M,H,Jt,w`
8015
+ `];var os=class extends D{static{this.styles=xp}#t=null;reset(){this.#t=null}validate(){return!0}get response(){return this.#t?this.#t.toString():null}set response(t){if(t)if(!isNaN(parseInt(t?.toString())))this.#t=parseInt(t.toString());else throw new Error(`Value must be a number ${t}`)}static get properties(){return{...D.properties,step:{type:Number,attribute:"step",default:10}}}render(){return v` <slot name="prompt"></slot>
8016
+ <slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var ss=[{tag:"qti-media-interaction",ctor:os}];var wp=[M,U,Wt,w`
8243
8017
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
8244
8018
  :host {
8245
8019
  display: block;
@@ -8457,16 +8231,16 @@ CES.load();
8457
8231
  :host([answer-key]) [part~='drags'] {
8458
8232
  display: none;
8459
8233
  }
8460
- `];var lu=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ag=Ut(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Ye=class extends Ht(ag,'[data-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=au}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),v` <slot name="prompt"> </slot>
8234
+ `];var Cp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gf=Vt(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Ue=class extends jt(gf,'[data-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=wp}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),v` <slot name="prompt"> </slot>
8461
8235
  <div part="container">
8462
8236
  <slot part="bank drags"> </slot>
8463
8237
  <div part="drops">
8464
- ${[...Array(this.nrChoices)].map((e,i)=>{let r=`droplist${i}`,n=this._dragDrop?.nodesByTarget?.[r]??[];return v`<div role="region" part="drop" data-declarative-drops identifier=${r}>
8465
- ${W(n,s=>s.getAttribute("identifier"),s=>s)}
8238
+ ${[...Array(this.nrChoices)].map((e,r)=>{let i=`droplist${r}`,n=this._dragDrop?.nodesByTarget?.[i]??[];return v`<div role="region" part="drop" data-declarative-drops identifier=${i}>
8239
+ ${H(n,s=>s.getAttribute("identifier"),s=>s)}
8466
8240
  </div>`})}
8467
8241
  </div>
8468
8242
  <div id="validation-message" part="message" role="alert" style="display:none;"></div>
8469
- </div>`}getValue(t){return t?.map((e,i)=>`${e} droplist${i}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(i=>i.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};lu([R()],Ye.prototype,"nrChoices",void 0);lu([p({type:String})],Ye.prototype,"orientation",void 0);var Ds=[{tag:"qti-order-interaction",ctor:Ye}];var cu=`@layer qti-base {
8243
+ </div>`}getValue(t){return t?.map((e,r)=>`${e} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};Cp([T()],Ue.prototype,"nrChoices",void 0);Cp([p({type:String})],Ue.prototype,"orientation",void 0);var as=[{tag:"qti-order-interaction",ctor:Ue}];var kp=`@layer qti-base {
8470
8244
  /* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */
8471
8245
  /* ============================
8472
8246
  QTI 3 shared css
@@ -10022,7 +9796,7 @@ CES.load();
10022
9796
  }
10023
9797
  }
10024
9798
  }
10025
- `;var du=[M,w`
9799
+ `;var Sp=[M,w`
10026
9800
  :host {
10027
9801
  display: block;
10028
9802
  width: 100%;
@@ -10032,18 +9806,18 @@ CES.load();
10032
9806
  ::slotted(qti-interaction-markup) {
10033
9807
  display: none;
10034
9808
  }
10035
- `];var lg=new Set(["point","pair","directedPair"]),ur=(o,t)=>{if(o==null)return o;switch(t){case"integer":{if(typeof o=="number")return o;let e=parseInt(String(o),10);return Number.isNaN(e)?o:e}case"float":case"duration":{if(typeof o=="number")return o;let e=parseFloat(String(o));return Number.isNaN(e)?o:e}case"boolean":{if(typeof o=="boolean")return o;if(typeof o=="string"){let e=o.toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return o}case"point":{let i=(Array.isArray(o)?o:String(o).trim().split(/[\s,]+/)).map(r=>typeof r=="number"?r:parseFloat(String(r)));return i.length===2&&i.every(Number.isFinite)?i:o}case"pair":case"directedPair":{let e=Array.isArray(o)?o:String(o).trim().split(/\s+/);return e.length===2?e.map(String):o}default:return String(o)}},cg=(o,t,e)=>{if(e)return Array.isArray(t)&&!lg.has(e)?{name:o,list:{[e]:t.map(i=>ur(i,e))}}:t==null?{name:o,base:null}:{name:o,base:{[e]:ur(t,e)}};if(Array.isArray(t)){let i=t.filter(r=>r!=null);if(i.length&&i.every(r=>typeof r=="boolean"))return{name:o,list:{boolean:i}};if(i.length&&i.every(r=>typeof r=="number")){let r=i,n=r.every(s=>Number.isInteger(s));return{name:o,list:{[n?"integer":"float"]:r}}}return{name:o,list:{string:t.map(r=>r==null?"":String(r))}}}if(typeof t=="boolean")return{name:o,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:o,base:{integer:t}}:{name:o,base:{float:t}};if(t==null)return{name:o,base:{string:""}};if(typeof t=="object")try{return{name:o,base:{string:JSON.stringify(t)}}}catch{return{name:o,base:{string:String(t)}}}return{name:o,base:{string:String(t)}}},$s=(o,t={})=>{if(!$t(o))return{record:[]};let e=[];for(let[i,r]of Object.entries(o))e.push(cg(i,r,t[i]));return{record:e}},dg=(o,t={})=>{if(!$t(o))return{...t};let e={};for(let[i,r]of Object.entries(o))e[i]=t[i]??go(Array.isArray(r)?r[0]:r);return e},uu=(o,t={})=>$s(o,dg(o,t)),hu=o=>{if(o==null)return null;if(Array.isArray(o))return o.map(String).join(" ");if(typeof o=="object")try{return JSON.stringify(o)}catch{return String(o)}return String(o)},pu=o=>{if(o)for(let t of Object.keys(o)){let e=o[t];if(e!=null)return e}},mu=o=>{let t={};for(let e of o)if(!(!e||typeof e.name!="string"||!e.name))if(e.list){let i=pu(e.list);t[e.name]=Array.isArray(i)?i.map(hu).filter(r=>r!==null):[]}else t[e.name]=hu(pu(e.base));return t};var fu=`/** vim: et:ts=4:sw=4:sts=4
9809
+ `];var dn=o=>o==="file",cs=o=>typeof o=="object"&&o!==null&&typeof o.data=="string",hn=o=>o==null||o===""?null:typeof o=="string"?o:!cs(o)||o.data===""?null:o.data.startsWith("data:")?o.data:`data:${o.mime||"application/octet-stream"};base64,${o.data}`,pn=o=>{if(o==null||o==="")return null;if(typeof o=="object")return cs(o)?o:null;let t=String(o),e=/^data:([^;,]*)((?:;[^;,]*)*),([\s\S]*)$/.exec(t);if(!e)return{data:t,mime:"application/octet-stream"};let[,r,i,n]=e;if(i.split(";").includes("base64"))return{data:n,mime:r||"text/plain"};let s="";return new TextEncoder().encode(decodeURIComponent(n)).forEach(a=>s+=String.fromCharCode(a)),{data:btoa(s),mime:r||"text/plain"}};var bf=new Set(["point","pair","directedPair"]),ti=(o,t)=>{if(o==null)return o;if(dn(t))return pn(o);switch(t){case"integer":{if(typeof o=="number")return o;let e=parseInt(String(o),10);return Number.isNaN(e)?o:e}case"float":case"duration":{if(typeof o=="number")return o;let e=parseFloat(String(o));return Number.isNaN(e)?o:e}case"boolean":{if(typeof o=="boolean")return o;if(typeof o=="string"){let e=o.toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return o}case"point":{let r=(Array.isArray(o)?o:String(o).trim().split(/[\s,]+/)).map(i=>typeof i=="number"?i:parseFloat(String(i)));return r.length===2&&r.every(Number.isFinite)?r:o}case"pair":case"directedPair":{let e=Array.isArray(o)?o:String(o).trim().split(/\s+/);return e.length===2?e.map(String):o}default:return String(o)}},vf=(o,t,e)=>{if(e)return Array.isArray(t)&&!bf.has(e)?{name:o,list:{[e]:t.map(r=>ti(r,e))}}:t==null?{name:o,base:null}:{name:o,base:{[e]:ti(t,e)}};if(Array.isArray(t)){let r=t.filter(i=>i!=null);if(r.length&&r.every(i=>typeof i=="boolean"))return{name:o,list:{boolean:r}};if(r.length&&r.every(i=>typeof i=="number")){let i=r,n=i.every(s=>Number.isInteger(s));return{name:o,list:{[n?"integer":"float"]:i}}}return{name:o,list:{string:t.map(i=>i==null?"":String(i))}}}if(typeof t=="boolean")return{name:o,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:o,base:{integer:t}}:{name:o,base:{float:t}};if(t==null)return{name:o,base:{string:""}};if(typeof t=="object")try{return{name:o,base:{string:JSON.stringify(t)}}}catch{return{name:o,base:{string:String(t)}}}return{name:o,base:{string:String(t)}}},ls=(o,t={})=>{if(!ce(o))return{record:[]};let e=[];for(let[r,i]of Object.entries(o))e.push(vf(r,i,t[r]));return{record:e}},yf=(o,t={})=>{if(!ce(o))return{...t};let e={};for(let[r,i]of Object.entries(o))e[r]=t[r]??Kn(Array.isArray(i)?i[0]:i);return e},_p=(o,t={})=>ls(o,yf(o,t)),Ep=o=>{if(o==null)return null;if(Array.isArray(o))return o.map(String).join(" ");if(cs(o))return hn(o);if(typeof o=="object")try{return JSON.stringify(o)}catch{return String(o)}return String(o)},Ap=o=>{if(o)for(let t of Object.keys(o)){let e=o[t];if(e!=null)return e}},Tp=o=>{let t={};for(let e of o)if(!(!e||typeof e.name!="string"||!e.name))if(e.list){let r=Ap(e.list);t[e.name]=Array.isArray(r)?r.map(Ep).filter(i=>i!==null):[]}else t[e.name]=Ep(Ap(e.base));return t};var Rp=`/** vim: et:ts=4:sw=4:sts=4
10036
9810
  * @license RequireJS 2.3.8 Copyright jQuery Foundation and other contributors.
10037
9811
  * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
10038
9812
  */var requirejs,require,define;(function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.8",commentRegExp=/\\/\\*[\\s\\S]*?\\*\\/|([^:"'=]|^)\\/\\/.*$/mg,cjsRequireRegExp=/[^.]\\s*require\\s*\\(\\s*["']([^'"\\s]+)["']\\s*\\)/g,jsSuffixRegExp=/\\.js$/,currDirRegExp=/^\\.\\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!!(typeof window<"u"&&typeof navigator<"u"&&window.document),isWebWorker=!isBrowser&&typeof importScripts<"u",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera<"u"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(r,a){return a||""}function isFunction(r){return ostring.call(r)==="[object Function]"}function isArray(r){return ostring.call(r)==="[object Array]"}function each(r,a){if(r){var c;for(c=0;c<r.length&&!(r[c]&&a(r[c],c,r));c+=1);}}function eachReverse(r,a){if(r){var c;for(c=r.length-1;c>-1&&!(r[c]&&a(r[c],c,r));c-=1);}}function hasProp(r,a){return hasOwn.call(r,a)}function getOwn(r,a){return hasProp(r,a)&&r[a]}function eachProp(r,a){var c;for(c in r)if(hasProp(r,c)&&c!=="__proto__"&&c!=="constructor"&&a(r[c],c))break}function mixin(r,a,c,u){return a&&eachProp(a,function(h,q){(c||!hasProp(r,q))&&(u&&typeof h=="object"&&h&&!isArray(h)&&!isFunction(h)&&!(h instanceof RegExp)?(r[q]||(r[q]={}),mixin(r[q],h,c,u)):r[q]=h)}),r}function bind(r,a){return function(){return a.apply(r,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(r){throw r}function getGlobal(r){if(!r)return r;var a=global;return each(r.split("."),function(c){a=a[c]}),a}function makeError(r,a,c,u){var h=new Error(a+\`
10039
- https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var Rt=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},hg=o=>o.replace(/<\/(script)/gi,"<\\/$1"),pg=o=>o.replace(/<\/(style)/gi,"<\\/$1"),ug=["solution","review"];function mg(o){return o==null?!1:Array.isArray(o)?o.length>0:$t(o)?Object.keys(o).length>0:o!==""}var Y=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#r=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#k(),this.#f(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let i=e?.params?.value,r=i&&typeof i=="object"?this.#h(i):null,n=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;n!==null&&(this.#o=n,n&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,l;if(a===void 0)l=void 0;else if(a===null)l=null;else if(typeof a=="string")l=a;else try{l=`__qti_json__::${JSON.stringify(a)}`}catch{l=null}if(r===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,l);break}let c=r;this.response=c,this.validate(),this.saveResponse(c,l);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#w=null}#t;static{this.styles=[du,w`
9813
+ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var At=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qf=o=>o.replace(/<\/(script)/gi,"<\\/$1"),xf=o=>o.replace(/<\/(style)/gi,"<\\/$1"),wf=["solution","review"];function Cf(o){return o==null?!1:Array.isArray(o)?o.length>0:ce(o)?Object.keys(o).length>0:o!==""}var X=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#i=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#C(),this.#v(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let r=e?.params?.value,i=r&&typeof r=="object"?this.#d(r):null,n=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;n!==null&&(this.#o=n,n&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,c;if(a===void 0)c=void 0;else if(a===null)c=null;else if(typeof a=="string")c=a;else try{c=`__qti_json__::${JSON.stringify(a)}`}catch{c=null}if(i===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,c);break}let l=i;this.response=l,this.validate(),this.saveResponse(l,c);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#w=null}#t;static{this.styles=[Sp,w`
10040
9814
  :host {
10041
9815
  display: block;
10042
9816
  width: 100%;
10043
9817
  min-height: 50px;
10044
9818
  }
10045
- `]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},i=t.correctResponse;return mg(i)&&(e.correctResponse={value:i}),e}#i(){let t=this.responseDeclaration;if(!t?.correctResponse||ug.includes(this.status))return t;let{correctResponse:e,...i}=t;return i}#r;#n;#o;#s;#a(){if(this.#r===null&&this.requirePathsJson)try{let t=JSON.parse(this.requirePathsJson);if(Array.isArray(t)||!t||typeof t!="object")throw new Error("Require paths must be a JSON object.");this.#r=t}catch(t){console.error("Error parsing require paths JSON:",t),this._errorMessage=`Error parsing require paths JSON: ${t.message}`,this.#r={}}return this.#r||{}}#d(){if(this.#n===null&&this.requireShimJson)try{this.#n=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#n={}}return this.#n||{}}#u(){return this.#a()}#l(){return this.#d()}#h(t){if(t&&Array.isArray(t.record)){let e=mu(t.record);return Object.keys(e).length?e:null}for(let e in t)if(t.hasOwnProperty(e)){let i=t[e];if(i){for(let r in i)if(i.hasOwnProperty(r)){let n=i[r];if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(i=>i.tagName.toLowerCase()===e)}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,i){if(e==="record"||i==="record")return $s(t);if(e!=="single"){let r=this.normalizeListValue(t).map(n=>ur(n,i));return{list:{[i]:r}}}return{base:{[i]:ur(t,i)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(r=>{let n=r.querySelector("qti-default-value");if(!n)return;let{value:s,baseTypes:a}=Zr(n.querySelectorAll("qti-value"));for(let[l,c]of Object.entries(s))e[l]=ur(c,a[l]??"string")}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},i={...t,...e};if(!Object.keys(i).length)return null;let r={candidateIdentifier:i.candidateIdentifier??"",testIdentifier:i.testIdentifier??"",environmentIdentifier:i.environmentIdentifier??"",...i};return $s(r)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(i=>{let r=i.getAttribute("template-identifier")||i.getAttribute("identifier")||"";if(!r)return;let n=this.context?.variables?.find(l=>l.identifier===r);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[r]=this.variableToQtiVariableJSON(n.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(i=>{let r=i.getAttribute("identifier")||"";if(!r)return;if(r==="QTI_CONTEXT"){let l=this.getQtiContextRecord();l&&(t[r]=l);return}let n=this.context?.variables?.find(l=>l.identifier===r);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[r]=this.variableToQtiVariableJSON(n.value,s,a)}),t}#c(t){let e={...t};for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i)){let r=i.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);e[r]=t[i]}return e}#m(t){let e={...t},i=(r,n,s)=>{let a=r;for(let l=0;l<n.length;l+=1){let c=n[l];if(l===n.length-1){a[c]=s;return}(!a[c]||typeof a[c]!="object"||Array.isArray(a[c]))&&(a[c]={}),a=a[c]}};for(let[r,n]of Object.entries(t)){if(!r.includes("__"))continue;let s=r.split("__").filter(Boolean);s.length<2||i(e,s,n)}return e}responseVariablesToQtiVariableJSON(t,e,i,r){if(e==="record")return uu(t,r);if(e!=="single"){let n={list:{}};return n.list[i]=t,n}else{let n={base:{}};return n.base[i]=t,n}}#p(){return this.response===null||this.response===void 0?!1:$t(this.response)?Object.values(this.response).some(t=>t!==""&&t!==null&&t!==void 0):Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#g(t,e){let i=this.dataset.invalidresponsemessage||"Invalid response.",r=t?"":e&&e.trim().length>0?e:i;this._internals.setValidity(t?{}:{customError:!0},r)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#p();return this.#g(t,this.#s),t}set value(t){t===null?this.#t=[]:this.#t=Array.isArray(t)?t:t.split(",")}get value(){return this.#t===null||this.#t===void 0?null:$t(this.#t)?JSON.stringify(this.#t):Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#h(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={},e=this.context?.variables?.find(i=>i.identifier===this.responseIdentifier);if(e){let i=e.cardinality||"single",r=e.baseType||"string",n=e.value||null,s=e.fieldBaseTypes,a=this.responseVariablesToQtiVariableJSON(n,i,r,s);t[this.responseIdentifier]=a}return t}#b(t){return t&&t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/g,"/").replace(/&#x60;/g,"`").replace(/&#x3D;/g,"=")}#v(t){let e={};for(let[i,r]of Object.entries(t))typeof r=="string"?e[i]=this.#b(r):e[i]=r;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let i=this.iframe?.contentWindow;if(!this._iframeLoaded||!i){this._pendingMessages.push({method:t,params:e});return}i.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#f(){this._pendingMessages.length&&(this._pendingMessages.forEach(t=>{this.sendMessageToIframe(t.method,t.params)}),this._pendingMessages=[])}createIframe(){this._interactionReady=!1,this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this.#x(),this.#y()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let e=this.generateIframeContent();this.iframe.srcdoc=e,this.appendChild(this.iframe)}#y(){let t=this.#c(this.#m(this.#v({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],i=typeof e=="string"&&e.length>0?e:null,r={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:fo(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#q(),boundTo:i?null:this.boundTo,responseDeclaration:this.#i(),status:this.status,state:i};this.sendMessageToIframe("initialize",r)}#q(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let i=e.querySelectorAll("qti-interaction-module");for(let r of i)t.push({id:r.getAttribute("id"),primaryPath:r.getAttribute("primary-path"),fallbackPath:r.getAttribute("fallback-path")})}return t}#x(){let t=this.querySelector("qti-interaction-markup");t&&this.sendMessageToIframe("setMarkup",t.innerHTML);let e=Array.from(this.querySelectorAll("qti-stylesheet"));if(e.length){let r=e.map(n=>n.outerHTML).join(`
10046
- `);this.sendMessageToIframe("setStylesheets",r)}let i=this.querySelector("properties");i&&this.sendMessageToIframe("setProperties",i.innerHTML)}#k(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#u()),i=JSON.stringify(this.#l()),r=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",n=r?r.endsWith("/")?r:`${r}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=this.dataset.componentsCdnUrl,l=this.dataset.componentsCssUrl,c=this.requireJsUrl?`<script src="${this.requireJsUrl}"></script>`:`<script>${hg(fu)}</script>`,d=`
9819
+ `]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},r=t.correctResponse;return Cf(r)&&(e.correctResponse={value:r}),e}#r(){let t=this.responseDeclaration;if(!t?.correctResponse||wf.includes(this.status))return t;let{correctResponse:e,...r}=t;return r}#i;#n;#o;#s;#a(){if(this.#i===null&&this.requirePathsJson)try{let t=JSON.parse(this.requirePathsJson);if(Array.isArray(t)||!t||typeof t!="object")throw new Error("Require paths must be a JSON object.");this.#i=t}catch(t){console.error("Error parsing require paths JSON:",t),this._errorMessage=`Error parsing require paths JSON: ${t.message}`,this.#i={}}return this.#i||{}}#c(){if(this.#n===null&&this.requireShimJson)try{this.#n=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#n={}}return this.#n||{}}#p(){return this.#a()}#l(){return this.#c()}#d(t){if(t&&Array.isArray(t.record)){let e=Tp(t.record);return Object.keys(e).length?e:null}for(let e in t)if(t.hasOwnProperty(e)){let r=t[e];if(r){for(let i in r)if(r.hasOwnProperty(i)){let n=r[i];if(i==="file"){if(Array.isArray(n))return n.map(hn).filter(a=>a!==null);let s=hn(n);if(s!==null)return s;continue}if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(r=>r.tagName.toLowerCase()===e)}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,r){if(e==="record"||r==="record")return ls(t);if(e!=="single"){let i=this.normalizeListValue(t).map(n=>ti(n,r));return{list:{[r]:i}}}return{base:{[r]:ti(t,r)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=i.querySelector("qti-default-value");if(!n)return;let{value:s,baseTypes:a}=ji(n.querySelectorAll("qti-value"));for(let[c,l]of Object.entries(s))e[c]=ti(l,a[c]??"string")}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},r={...t,...e};if(!Object.keys(r).length)return null;let i={candidateIdentifier:r.candidateIdentifier??"",testIdentifier:r.testIdentifier??"",environmentIdentifier:r.environmentIdentifier??"",...r};return ls(i)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("template-identifier")||r.getAttribute("identifier")||"";if(!i)return;let n=this.context?.variables?.find(c=>c.identifier===i);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[i]=this.variableToQtiVariableJSON(n.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("identifier")||"";if(!i)return;if(i==="QTI_CONTEXT"){let c=this.getQtiContextRecord();c&&(t[i]=c);return}let n=this.context?.variables?.find(c=>c.identifier===i);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[i]=this.variableToQtiVariableJSON(n.value,s,a)}),t}#h(t){let e={...t};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);e[i]=t[r]}return e}#u(t){let e={...t},r=(i,n,s)=>{let a=i;for(let c=0;c<n.length;c+=1){let l=n[c];if(c===n.length-1){a[l]=s;return}(!a[l]||typeof a[l]!="object"||Array.isArray(a[l]))&&(a[l]={}),a=a[l]}};for(let[i,n]of Object.entries(t)){if(!i.includes("__"))continue;let s=i.split("__").filter(Boolean);s.length<2||r(e,s,n)}return e}responseVariablesToQtiVariableJSON(t,e,r,i){if(e==="record")return _p(t,i);if(e!=="single"){let n={list:{}};return n.list[r]=dn(r)?this.normalizeListValue(t).map(pn).filter(Boolean):t,n}else{let n={base:{}};return n.base[r]=dn(r)?pn(t):t,n}}#g(){return this.response===null||this.response===void 0?!1:ce(this.response)?Object.values(this.response).some(t=>t!==""&&t!==null&&t!==void 0):Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#m(t,e){let r=this.dataset.invalidresponsemessage||"Invalid response.",i=t?"":e&&e.trim().length>0?e:r;this._internals.setValidity(t?{}:{customError:!0},i)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#g();return this.#m(t,this.#s),t}set value(t){t===null?this.#t=[]:this.#t=Array.isArray(t)?t:t.split(",")}get value(){return this.#t===null||this.#t===void 0?null:ce(this.#t)?JSON.stringify(this.#t):Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#d(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={},e=this.context?.variables?.find(r=>r.identifier===this.responseIdentifier);if(e){let r=e.cardinality||"single",i=e.baseType||"string",n=e.value||null,s=e.fieldBaseTypes,a=this.responseVariablesToQtiVariableJSON(n,r,i,s);t[this.responseIdentifier]=a}return t}#b(t){return t&&t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/g,"/").replace(/&#x60;/g,"`").replace(/&#x3D;/g,"=")}#f(t){let e={};for(let[r,i]of Object.entries(t))typeof i=="string"?e[r]=this.#b(i):e[r]=i;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let r=this.iframe?.contentWindow;if(!this._iframeLoaded||!r){this._pendingMessages.push({method:t,params:e});return}r.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#v(){this._pendingMessages.length&&(this._pendingMessages.forEach(t=>{this.sendMessageToIframe(t.method,t.params)}),this._pendingMessages=[])}createIframe(){this._interactionReady=!1,this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this.#x(),this.#y()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let e=this.generateIframeContent();this.iframe.srcdoc=e,this.appendChild(this.iframe)}#y(){let t=this.#h(this.#u(this.#f({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],r=typeof e=="string"&&e.length>0?e:null,i={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:Yn(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#q(),boundTo:r?null:this.boundTo,responseDeclaration:this.#r(),status:this.status,state:r};this.sendMessageToIframe("initialize",i)}#q(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let r=e.querySelectorAll("qti-interaction-module");for(let i of r)t.push({id:i.getAttribute("id"),primaryPath:i.getAttribute("primary-path"),fallbackPath:i.getAttribute("fallback-path")})}return t}#x(){let t=this.querySelector("qti-interaction-markup");t&&this.sendMessageToIframe("setMarkup",t.innerHTML);let e=Array.from(this.querySelectorAll("qti-stylesheet"));if(e.length){let i=e.map(n=>n.outerHTML).join(`
9820
+ `);this.sendMessageToIframe("setStylesheets",i)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#C(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#p()),r=JSON.stringify(this.#l()),i=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",n=i?i.endsWith("/")?i:`${i}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=this.dataset.componentsCdnUrl,c=this.dataset.componentsCssUrl,l=this.requireJsUrl?`<script src="${this.requireJsUrl}"></script>`:`<script>${qf(Rp)}</script>`,d=`
10047
9821
  font-family: ${t.getPropertyValue("font-family")};
10048
9822
  font-size: ${t.getPropertyValue("font-size")};
10049
9823
  line-height: ${t.getPropertyValue("line-height")};
@@ -10056,7 +9830,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10056
9830
  <title>QTI PCI Container</title>
10057
9831
  <base href="${n}" />
10058
9832
  ${a?`<script type="module">import '${a}';</script>`:""}
10059
- <style>${pg(cu)}</style>
9833
+ <style>${xf(kp)}</style>
10060
9834
  <style>
10061
9835
  body, html {
10062
9836
  margin: 0;
@@ -10082,8 +9856,8 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10082
9856
  min-height: 50px;
10083
9857
  }
10084
9858
  </style>
10085
- ${l?`<link href="${l}" rel="stylesheet" />`:""}
10086
- ${c}
9859
+ ${c?`<link href="${c}" rel="stylesheet" />`:""}
9860
+ ${l}
10087
9861
  <script>
10088
9862
  const forwardConsole = ${s?"true":"false"};
10089
9863
  if (forwardConsole) {
@@ -10128,14 +9902,14 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10128
9902
  // Define standard paths and shims
10129
9903
  window.requirePaths = ${e};
10130
9904
 
10131
- window.requireShim = ${i};
9905
+ window.requireShim = ${r};
10132
9906
 
10133
9907
  // Single initial RequireJS configuration with error handling
10134
9908
  window.requirejs.config({
10135
9909
  catchError: true,
10136
9910
  waitSeconds: 30,
10137
9911
  paths: window.requirePaths,
10138
- baseUrl: '${r}',
9912
+ baseUrl: '${i}',
10139
9913
  shim: window.requireShim,
10140
9914
  onNodeCreated: function (node, config, moduleName, url) {
10141
9915
  // Add error handler to script node
@@ -10942,7 +10716,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10942
10716
  <h1>Error</h1>
10943
10717
  ${this._errorMessage}
10944
10718
  </div>`:""}
10945
- `}};Rt([p({type:String,attribute:"module"})],Y.prototype,"module",void 0);Rt([p({type:String,attribute:"custom-interaction-type-identifier"})],Y.prototype,"customInteractionTypeIdentifier",void 0);Rt([p({type:String,attribute:"data-require-paths"})],Y.prototype,"requirePathsJson",void 0);Rt([p({type:String,attribute:"data-require-shim"})],Y.prototype,"requireShimJson",void 0);Rt([p({type:String,attribute:"data-require-js-url"})],Y.prototype,"requireJsUrl",void 0);Rt([p({type:String,attribute:"data-base-url"})],Y.prototype,"baseUrl",void 0);Rt([p({type:Boolean,attribute:"data-use-default-paths"})],Y.prototype,"useDefaultPaths",void 0);Rt([p({type:String,attribute:"data-status"})],Y.prototype,"status",void 0);Rt([R()],Y.prototype,"_errorMessage",void 0);Rt([I({context:F,subscribe:!0}),R()],Y.prototype,"context",void 0);Rt([I({context:Ct,subscribe:!0}),R()],Y.prototype,"qtiContext",void 0);Rt([p({attribute:"response",reflect:!1,converter:Kt({emptyAs:null})})],Y.prototype,"response",void 0);var Ns=class extends Y{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,i)=>{let r=()=>{window.clearTimeout(n),e()},n=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",r),i(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",r,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,i=r=>{let{data:n}=r;n?.source==="qti-pci-iframe"&&(!n?.responseIdentifier||n?.responseIdentifier===this.responseIdentifier)&&n?.method==="getContentResponse"&&n?.messageId===e&&(window.removeEventListener("message",i),t(n.content))};window.addEventListener("message",i),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",i),t("")},5e3)})}setTestContext(t){this.context=t,this.updateComplete.then(()=>{this.value=t?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#t=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#t=!1}}disconnectedCallback(){this.#t||super.disconnectedCallback()}async iFrameMouseClick(t,e){return new Promise(i=>{let r=`click-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===r&&(window.removeEventListener("message",n),i())};window.addEventListener("message",n),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),i()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let i=`click-selector-${Date.now()}`,r=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===i&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let i=`click-text-${Date.now()}`,r=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===i&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(i=>{let r=`set-value-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===r&&(window.removeEventListener("message",n),i(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),i(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let i=`get-bounding-rect-${Date.now()}`,r=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===i&&(window.removeEventListener("message",r),e(s.rect??null))};window.addEventListener("message",r),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(i=>{let r=`set-value-text-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===r&&(window.removeEventListener("message",n),i(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),i(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let i=`mousedown-selector-${Date.now()}`,r=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===i&&(window.removeEventListener("message",r),e(s.success))};window.addEventListener("message",r),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",r),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
10719
+ `}};At([p({type:String,attribute:"module"})],X.prototype,"module",void 0);At([p({type:String,attribute:"custom-interaction-type-identifier"})],X.prototype,"customInteractionTypeIdentifier",void 0);At([p({type:String,attribute:"data-require-paths"})],X.prototype,"requirePathsJson",void 0);At([p({type:String,attribute:"data-require-shim"})],X.prototype,"requireShimJson",void 0);At([p({type:String,attribute:"data-require-js-url"})],X.prototype,"requireJsUrl",void 0);At([p({type:String,attribute:"data-base-url"})],X.prototype,"baseUrl",void 0);At([p({type:Boolean,attribute:"data-use-default-paths"})],X.prototype,"useDefaultPaths",void 0);At([p({type:String,attribute:"data-status"})],X.prototype,"status",void 0);At([T()],X.prototype,"_errorMessage",void 0);At([R({context:j,subscribe:!0}),T()],X.prototype,"context",void 0);At([R({context:qt,subscribe:!0}),T()],X.prototype,"qtiContext",void 0);At([p({attribute:"response",reflect:!1,converter:Xt({emptyAs:null})})],X.prototype,"response",void 0);var ds=class extends X{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,r)=>{let i=()=>{window.clearTimeout(n),e()},n=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",i),r(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",i,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,r=i=>{let{data:n}=i;n?.source==="qti-pci-iframe"&&(!n?.responseIdentifier||n?.responseIdentifier===this.responseIdentifier)&&n?.method==="getContentResponse"&&n?.messageId===e&&(window.removeEventListener("message",r),t(n.content))};window.addEventListener("message",r),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",r),t("")},5e3)})}setTestContext(t){this.context=t,this.updateComplete.then(()=>{this.value=t?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#t=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#t=!1}}disconnectedCallback(){this.#t||super.disconnectedCallback()}async iFrameMouseClick(t,e){return new Promise(r=>{let i=`click-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r())};window.addEventListener("message",n),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let r=`click-selector-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let r=`click-text-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(r=>{let i=`set-value-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let r=`get-bounding-rect-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(r=>{let i=`set-value-text-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let r=`mousedown-selector-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
10946
10720
  // Test helper functions for QtiPortableCustomInteractionTest
10947
10721
  // Base iframe implementation already provides PCIManager.getContent
10948
10722
 
@@ -11135,7 +10909,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11135
10909
  }
11136
10910
  },
11137
10911
  true
11138
- );`,i=t.lastIndexOf("</script>");return t.substring(0,i)+e+t.substring(i)}};var Ls=[{tag:"qti-portable-custom-interaction",ctor:Y},{tag:"qti-portable-custom-interaction-test",ctor:Ns}];var gu="important",fg=" !"+gu,Ti=Lt(class extends Oe{constructor(o){if(super(o),o.type!==ir.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let i=o[e];return i==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${i};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let i of this.ft)t[i]==null&&(this.ft.delete(i),i.includes("-")?e.removeProperty(i):e[i]=null);for(let i in t){let r=t[i];if(r!=null){this.ft.add(i);let n=typeof r=="string"&&r.endsWith(fg);i.includes("-")||n?e.setProperty(i,n?r.slice(0,-11):r,n?gu:""):e[i]=r}}return ot}});var bu=[M,H,w`
10912
+ );`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var hs=[{tag:"qti-portable-custom-interaction",ctor:X},{tag:"qti-portable-custom-interaction-test",ctor:ds}];var Ip="important",kf=" !"+Ip,qr=Ot(class extends Ae{constructor(o){if(super(o),o.type!==Hr.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let r=o[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let i=t[r];if(i!=null){this.ft.add(r);let n=typeof i=="string"&&i.endsWith(kf);r.includes("-")||n?e.setProperty(r,n?i.slice(0,-11):i,n?Ip:""):e[r]=i}}return it}});var Mp=[M,U,w`
11139
10913
  /* Not positioned on purpose: the placed copies are absolutely positioned against the stage
11140
10914
  (qti-position-object-stage), so they land on its image wherever this tray sits. */
11141
10915
  :host {
@@ -11170,33 +10944,33 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11170
10944
  [part~='point'][data-ghost] {
11171
10945
  pointer-events: none;
11172
10946
  }
11173
- `];var Ke=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},gg=4,It=class extends D{constructor(){super(...arguments),this.maxChoices=1,this.minChoices=0,this.centerPoint=null,this.response=null,this._layout=0,this._drag=null,this._armed=!1,this.#t=null,this.#e=new ResizeObserver(()=>this._layout++),this._handleResponseChange=()=>{this._internals.setFormValue(li(this.response)||null),this.validate(),B(this._internals.states,"used",this.#n())},this.#p=t=>{if(!this._drag)return;let e={x:t.clientX,y:t.clientY},i=this._drag.moved||Math.hypot(e.x-this._drag.start.x,e.y-this._drag.start.y)>gg;this._drag={...this._drag,client:e,moved:i}},this.#g=t=>{window.removeEventListener("pointermove",this.#p);let e=this._drag;if(this._drag=null,!e)return;if(!e.moved){e.index===-1&&(this._armed=!this._armed);return}let i=this.#u({x:t.clientX,y:t.clientY}),r=this.#i();e.index===-1?i&&this.#c(i):i?(r[e.index]=i,this.#r(r)):this.#r(r.filter((n,s)=>s!==e.index))},this.#b=t=>{if(!this._armed||this.#h)return;let e=this.#u({x:t.clientX,y:t.clientY});e&&(this._armed=!1,this.#c(e))}}static{this.styles=bu}#t;#e;#i(){return(this.response??[]).map(t=>{let[e,i]=t.split(" ").map(Number);return{x:e,y:i}})}#r(t){this.response=t.map(e=>`${Math.round(e.x)} ${Math.round(e.y)}`),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})}#n(){return this.maxChoices>0&&(this.response?.length??0)>=this.maxChoices}validate(){let t=this.response?.length??0,e=this.maxChoices>0&&t>this.maxChoices,i=t<this.minChoices,r="other",n="";e?(r="max",n=this.dataset.maxSelectionsMessage||`Please place no more than ${this.maxChoices} ${this.maxChoices===1?"position":"positions"}.`):i&&(r="min",n=this.dataset.minSelectionsMessage||`Please place at least ${this.minChoices} ${this.minChoices===1?"position":"positions"}.`);let s=!e&&!i;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:r}),s}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this._armed=!1,this.response=[],this._internals.setFormValue(null)}get#o(){return this.closest("qti-position-object-stage")}#s(){let t=this.#t;return t?{width:parseFloat(t.getAttribute("width")??"")||t.naturalWidth||t.clientWidth||1,height:parseFloat(t.getAttribute("height")??"")||t.naturalHeight||t.clientHeight||1}:{width:1,height:1}}#a(){let t=this.#t?.getBoundingClientRect();return!t||t.width===0?1:this.#s().width/t.width}#d(){let t=this.querySelector("img"),e=parseFloat(t?.getAttribute("width")??"")||t?.naturalWidth||30,i=parseFloat(t?.getAttribute("height")??"")||t?.naturalHeight||30,[r,n]=(this.centerPoint??"").split(/[\s,]+/).map(Number);return{width:e,height:i,centre:Number.isFinite(r)&&Number.isFinite(n)?{x:r,y:n}:{x:e/2,y:i/2}}}#u(t){let e=this.#t?.getBoundingClientRect();if(!e||t.x<e.left||t.x>e.right||t.y<e.top||t.y>e.bottom)return null;let i=this.#a();return{x:(t.x-e.left)*i,y:(t.y-e.top)*i}}#l(t){let e=this.#o?.getBoundingClientRect(),i=this.#t?.getBoundingClientRect();if(!e||!i)return{display:"none"};let r=this.#a(),n=this.#d();return{left:`${i.left-e.left+t.x/r-n.centre.x/r}px`,top:`${i.top-e.top+t.y/r-n.centre.y/r}px`,width:`${n.width/r}px`,height:`${n.height/r}px`}}get#h(){return this.disabled||this.readonly}#c(t){this.#n()||this.#r([...this.#i(),t])}#m(t,e){if(this.#h||t.button!==0||e===-1&&this.#n())return;t.preventDefault();let i={x:t.clientX,y:t.clientY};this._drag={index:e,client:i,start:i,moved:!1},window.addEventListener("pointermove",this.#p),window.addEventListener("pointerup",this.#g,{once:!0})}#p;#g;#b;#v(t){if(!this.#h)if(t.key==="Enter"||t.key===" "){if(t.preventDefault(),this.#n())return;let{width:e,height:i}=this.#s();this.#c({x:e/2,y:i/2}),this.updateComplete.then(()=>{let r=this.shadowRoot?.querySelectorAll('[part~="point"]');r?.[r.length-1]?.focus()})}else t.key==="Escape"&&(this._armed=!1)}#f(t,e){if(this.#h)return;let i=t.shiftKey?10:1,r={ArrowLeft:{x:-i,y:0},ArrowRight:{x:i,y:0},ArrowUp:{x:0,y:-i},ArrowDown:{x:0,y:i}},n=this.#i();if(r[t.key]){t.preventDefault();let{width:s,height:a}=this.#s(),l=n[e];n[e]={x:Math.min(s,Math.max(0,l.x+r[t.key].x)),y:Math.min(a,Math.max(0,l.y+r[t.key].y))},this.#r(n),this.updateComplete.then(()=>this.shadowRoot?.querySelectorAll('[part~="point"]')[e]?.focus())}else(t.key==="Delete"||t.key==="Backspace")&&(t.preventDefault(),this.#r(n.filter((s,a)=>a!==e)),this.updateComplete.then(()=>this.shadowRoot?.querySelector('[part~="object"]')?.focus()))}connectedCallback(){super.connectedCallback(),this.#t=this.#o?.querySelector(":scope > img, :scope > picture img")??null,this.#t&&(this.#e.observe(this.#t),this.#t.addEventListener("load",()=>this._layout++),this.#t.addEventListener("click",this.#b))}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect(),this.#t?.removeEventListener("click",this.#b),window.removeEventListener("pointermove",this.#p)}render(){this._layout;let t=this.querySelector("img")?.currentSrc||this.querySelector("img")?.src||"",e=this.querySelector("img")?.getAttribute("alt")||"object",i=this.#n(),r=["object",this._armed?"selected":"",i?"used":""].filter(Boolean).join(" "),n=this.#i(),s=this._drag,a=s&&s.moved&&this.#t?(()=>{let l=this.#t.getBoundingClientRect(),c=this.#a();return{x:(s.client.x-l.left)*c,y:(s.client.y-l.top)*c}})():null;return v`
10947
+ `];var He=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Sf=4,_t=class extends D{constructor(){super(...arguments),this.maxChoices=1,this.minChoices=0,this.centerPoint=null,this.response=null,this._layout=0,this._drag=null,this._armed=!1,this.#t=null,this.#e=new ResizeObserver(()=>this._layout++),this._handleResponseChange=()=>{this._internals.setFormValue(er(this.response)||null),this.validate(),z(this._internals.states,"used",this.#n())},this.#g=t=>{if(!this._drag)return;let e={x:t.clientX,y:t.clientY},r=this._drag.moved||Math.hypot(e.x-this._drag.start.x,e.y-this._drag.start.y)>Sf;this._drag={...this._drag,client:e,moved:r}},this.#m=t=>{window.removeEventListener("pointermove",this.#g);let e=this._drag;if(this._drag=null,!e)return;if(!e.moved){e.index===-1&&(this._armed=!this._armed);return}let r=this.#p({x:t.clientX,y:t.clientY}),i=this.#r();e.index===-1?r&&this.#h(r):r?(i[e.index]=r,this.#i(i)):this.#i(i.filter((n,s)=>s!==e.index))},this.#b=t=>{if(!this._armed||this.#d)return;let e=this.#p({x:t.clientX,y:t.clientY});e&&(this._armed=!1,this.#h(e))}}static{this.styles=Mp}#t;#e;#r(){return(this.response??[]).map(t=>{let[e,r]=t.split(" ").map(Number);return{x:e,y:r}})}#i(t){this.response=t.map(e=>`${Math.round(e.x)} ${Math.round(e.y)}`),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})}#n(){return this.maxChoices>0&&(this.response?.length??0)>=this.maxChoices}validate(){let t=this.response?.length??0,e=this.maxChoices>0&&t>this.maxChoices,r=t<this.minChoices,i="other",n="";e?(i="max",n=this.dataset.maxSelectionsMessage||`Please place no more than ${this.maxChoices} ${this.maxChoices===1?"position":"positions"}.`):r&&(i="min",n=this.dataset.minSelectionsMessage||`Please place at least ${this.minChoices} ${this.minChoices===1?"position":"positions"}.`);let s=!e&&!r;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:i}),s}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this._armed=!1,this.response=[],this._internals.setFormValue(null)}get#o(){return this.closest("qti-position-object-stage")}#s(){let t=this.#t;return t?{width:parseFloat(t.getAttribute("width")??"")||t.naturalWidth||t.clientWidth||1,height:parseFloat(t.getAttribute("height")??"")||t.naturalHeight||t.clientHeight||1}:{width:1,height:1}}#a(){let t=this.#t?.getBoundingClientRect();return!t||t.width===0?1:this.#s().width/t.width}#c(){let t=this.querySelector("img"),e=parseFloat(t?.getAttribute("width")??"")||t?.naturalWidth||30,r=parseFloat(t?.getAttribute("height")??"")||t?.naturalHeight||30,[i,n]=(this.centerPoint??"").split(/[\s,]+/).map(Number);return{width:e,height:r,centre:Number.isFinite(i)&&Number.isFinite(n)?{x:i,y:n}:{x:e/2,y:r/2}}}#p(t){let e=this.#t?.getBoundingClientRect();if(!e||t.x<e.left||t.x>e.right||t.y<e.top||t.y>e.bottom)return null;let r=this.#a();return{x:(t.x-e.left)*r,y:(t.y-e.top)*r}}#l(t){let e=this.#o?.getBoundingClientRect(),r=this.#t?.getBoundingClientRect();if(!e||!r)return{display:"none"};let i=this.#a(),n=this.#c();return{left:`${r.left-e.left+t.x/i-n.centre.x/i}px`,top:`${r.top-e.top+t.y/i-n.centre.y/i}px`,width:`${n.width/i}px`,height:`${n.height/i}px`}}get#d(){return this.disabled||this.readonly}#h(t){this.#n()||this.#i([...this.#r(),t])}#u(t,e){if(this.#d||t.button!==0||e===-1&&this.#n())return;t.preventDefault();let r={x:t.clientX,y:t.clientY};this._drag={index:e,client:r,start:r,moved:!1},window.addEventListener("pointermove",this.#g),window.addEventListener("pointerup",this.#m,{once:!0})}#g;#m;#b;#f(t){if(!this.#d)if(t.key==="Enter"||t.key===" "){if(t.preventDefault(),this.#n())return;let{width:e,height:r}=this.#s();this.#h({x:e/2,y:r/2}),this.updateComplete.then(()=>{let i=this.shadowRoot?.querySelectorAll('[part~="point"]');i?.[i.length-1]?.focus()})}else t.key==="Escape"&&(this._armed=!1)}#v(t,e){if(this.#d)return;let r=t.shiftKey?10:1,i={ArrowLeft:{x:-r,y:0},ArrowRight:{x:r,y:0},ArrowUp:{x:0,y:-r},ArrowDown:{x:0,y:r}},n=this.#r();if(i[t.key]){t.preventDefault();let{width:s,height:a}=this.#s(),c=n[e];n[e]={x:Math.min(s,Math.max(0,c.x+i[t.key].x)),y:Math.min(a,Math.max(0,c.y+i[t.key].y))},this.#i(n),this.updateComplete.then(()=>this.shadowRoot?.querySelectorAll('[part~="point"]')[e]?.focus())}else(t.key==="Delete"||t.key==="Backspace")&&(t.preventDefault(),this.#i(n.filter((s,a)=>a!==e)),this.updateComplete.then(()=>this.shadowRoot?.querySelector('[part~="object"]')?.focus()))}connectedCallback(){super.connectedCallback(),this.#t=this.#o?.querySelector(":scope > img, :scope > picture img")??null,this.#t&&(this.#e.observe(this.#t),this.#t.addEventListener("load",()=>this._layout++),this.#t.addEventListener("click",this.#b))}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect(),this.#t?.removeEventListener("click",this.#b),window.removeEventListener("pointermove",this.#g)}render(){this._layout;let t=this.querySelector("img")?.currentSrc||this.querySelector("img")?.src||"",e=this.querySelector("img")?.getAttribute("alt")||"object",r=this.#n(),i=["object",this._armed?"selected":"",r?"used":""].filter(Boolean).join(" "),n=this.#r(),s=this._drag,a=s&&s.moved&&this.#t?(()=>{let c=this.#t.getBoundingClientRect(),l=this.#a();return{x:(s.client.x-c.left)*l,y:(s.client.y-c.top)*l}})():null;return v`
11174
10948
  <div
11175
- part=${r}
10949
+ part=${i}
11176
10950
  role="button"
11177
- tabindex=${this.#h||i?-1:0}
11178
- aria-disabled=${this.#h||i?"true":"false"}
10951
+ tabindex=${this.#d||r?-1:0}
10952
+ aria-disabled=${this.#d||r?"true":"false"}
11179
10953
  aria-pressed=${this._armed?"true":"false"}
11180
10954
  aria-label=${`Place ${e}`}
11181
- @pointerdown=${l=>this.#m(l,-1)}
11182
- @keydown=${l=>this.#v(l)}
10955
+ @pointerdown=${c=>this.#u(c,-1)}
10956
+ @keydown=${c=>this.#f(c)}
11183
10957
  >
11184
10958
  <slot></slot>
11185
10959
  </div>
11186
- ${W(n,(l,c)=>c,(l,c)=>{let d=s&&s.index===c&&a?a:l;return v`<img
10960
+ ${H(n,(c,l)=>l,(c,l)=>{let d=s&&s.index===l&&a?a:c;return v`<img
11187
10961
  part="point"
11188
10962
  src=${t}
11189
- alt=${`${e} at ${Math.round(l.x)}, ${Math.round(l.y)}`}
10963
+ alt=${`${e} at ${Math.round(c.x)}, ${Math.round(c.y)}`}
11190
10964
  role="button"
11191
- tabindex=${this.#h?-1:0}
10965
+ tabindex=${this.#d?-1:0}
11192
10966
  draggable="false"
11193
- style=${Ti(this.#l(d))}
11194
- @pointerdown=${h=>this.#m(h,c)}
11195
- @keydown=${h=>this.#f(h,c)}
10967
+ style=${qr(this.#l(d))}
10968
+ @pointerdown=${h=>this.#u(h,l)}
10969
+ @keydown=${h=>this.#v(h,l)}
11196
10970
  />`})}
11197
- ${s&&s.index===-1&&a?v`<img part="point" data-ghost src=${t} alt="" style=${Ti(this.#l(a))} />`:P}
10971
+ ${s&&s.index===-1&&a?v`<img part="point" data-ghost src=${t} alt="" style=${qr(this.#l(a))} />`:P}
11198
10972
  <div part="message" role="alert" id="validation-message" style="display:none;"></div>
11199
- `}};Ke([p({type:Number,attribute:"max-choices"})],It.prototype,"maxChoices",void 0);Ke([p({type:Number,attribute:"min-choices"})],It.prototype,"minChoices",void 0);Ke([p({type:String,attribute:"center-point"})],It.prototype,"centerPoint",void 0);Ke([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Kr(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>li(o)}})],It.prototype,"response",void 0);Ke([R()],It.prototype,"_layout",void 0);Ke([R()],It.prototype,"_drag",void 0);Ke([R()],It.prototype,"_armed",void 0);Ke([N("response")],It.prototype,"_handleResponseChange",void 0);var vu=[M,w`
10973
+ `}};He([p({type:Number,attribute:"max-choices"})],_t.prototype,"maxChoices",void 0);He([p({type:Number,attribute:"min-choices"})],_t.prototype,"minChoices",void 0);He([p({type:String,attribute:"center-point"})],_t.prototype,"centerPoint",void 0);He([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Vi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>er(o)}})],_t.prototype,"response",void 0);He([T()],_t.prototype,"_layout",void 0);He([T()],_t.prototype,"_drag",void 0);He([T()],_t.prototype,"_armed",void 0);He([N("response")],_t.prototype,"_handleResponseChange",void 0);var Pp=[M,w`
11200
10974
  /* The containing block of every placed copy. */
11201
10975
  :host {
11202
10976
  display: inline-block;
@@ -11209,7 +10983,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11209
10983
  height: auto;
11210
10984
  user-select: none;
11211
10985
  }
11212
- `];var Vs=class extends C{static{this.styles=vu}render(){return v`<slot></slot>`}};var js=[{tag:"qti-position-object-interaction",ctor:It},{tag:"qti-position-object-stage",ctor:Vs}];var yu=[M,w`
10986
+ `];var ps=class extends S{static{this.styles=Pp}render(){return v`<slot></slot>`}};var us=[{tag:"qti-position-object-interaction",ctor:_t},{tag:"qti-position-object-stage",ctor:ps}];var Op=[M,w`
11213
10987
  :host {
11214
10988
  display: block;
11215
10989
  --qti-select-point-marker-size: 1.5rem;
@@ -11273,21 +11047,21 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11273
11047
  -webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
11274
11048
  mask: var(--qti-select-point-icon) no-repeat center / contain;
11275
11049
  }
11276
- `];var Mi=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},pt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleResponseChange=()=>{this._internals.setFormValue(li(this.response)||null),this.validate()},this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#i=1,this.#r=1,this.#n=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#d();let e=this.#e.getBoundingClientRect(),i=(t.clientX-e.left)*this.#i,r=(t.clientY-e.top)*this.#r,n=`${i.toFixed()} ${r.toFixed()}`;this.maxChoices===1?this.response=[n]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],n]),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})},this.#a=()=>{this.#d()}}static{this.styles=yu}#t(){try{let t=JSON.parse(this.areaMappings||"[]");if(!Array.isArray(t)){this._areaEntries=[];return}this._areaEntries=t.filter(e=>e&&(e.shape==="circle"||e.shape==="rect")&&typeof e.coords=="string").map(e=>({shape:e.shape,coords:String(e.coords),mappedValue:Number(e.mappedValue??1),defaultValue:Number(e.defaultValue??0)}))}catch{this._areaEntries=[]}}get _effectiveAreaEntries(){let t=this.responseVariable?.areaMapping?.areaMapEntries;return t?.length?t:this._areaEntries}#e;#i;#r;#n;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let t=this.response;return(Array.isArray(t)?t:t?[t]:[]).filter(i=>i).map(i=>{let[r,n]=i.split(" ").map(Number);return{x:r,y:n}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#d();for(let i of t){let r=i.dataset.coord,n=i.dataset.shape;!r||!n||re(n,r.split(",").map(s=>+s),e,i)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return v` <slot name="prompt"></slot>
11050
+ `];var xr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleResponseChange=()=>{this._internals.setFormValue(er(this.response)||null),this.validate()},this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#r=1,this.#i=1,this.#n=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#c();let e=this.#e.getBoundingClientRect(),r=(t.clientX-e.left)*this.#r,i=(t.clientY-e.top)*this.#i,n=`${r.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[n]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],n]),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})},this.#a=()=>{this.#c()}}static{this.styles=Op}#t(){try{let t=JSON.parse(this.areaMappings||"[]");if(!Array.isArray(t)){this._areaEntries=[];return}this._areaEntries=t.filter(e=>e&&(e.shape==="circle"||e.shape==="rect")&&typeof e.coords=="string").map(e=>({shape:e.shape,coords:String(e.coords),mappedValue:Number(e.mappedValue??1),defaultValue:Number(e.defaultValue??0)}))}catch{this._areaEntries=[]}}get _effectiveAreaEntries(){let t=this.responseVariable?.areaMapping?.areaMapEntries;return t?.length?t:this._areaEntries}#e;#r;#i;#n;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let t=this.response;return(Array.isArray(t)?t:t?[t]:[]).filter(r=>r).map(r=>{let[i,n]=r.split(" ").map(Number);return{x:i,y:n}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let r of t){let i=r.dataset.coord,n=r.dataset.shape;!i||!n||Kt(n,i.split(",").map(s=>+s),e,r)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return v` <slot name="prompt"></slot>
11277
11051
  <point-container>
11278
- ${W(e.filter(i=>i),i=>i,(i,r)=>{let[n,s]=i.split(" ").map(Number),a=n/(this.#n||1)*100,l=s/(this.#o||1)*100;return v`
11052
+ ${H(e.filter(r=>r),r=>r,(r,i)=>{let[n,s]=r.split(" ").map(Number),a=n/(this.#n||1)*100,c=s/(this.#o||1)*100;return v`
11279
11053
  <button
11280
- part=${this.pointPart(i,r)}
11281
- style=${Ti({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${l}%`})}
11282
- aria-label="Remove point at ${i}"
11054
+ part=${this.pointPart(r,i)}
11055
+ style=${qr({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${c}%`})}
11056
+ aria-label="Remove point at ${r}"
11283
11057
  ?disabled=${this.disabled}
11284
- @click=${c=>{c.stopPropagation(),this.response=(this.response||[]).filter((d,h)=>h!==r),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})}}
11058
+ @click=${l=>{l.stopPropagation(),this.response=(this.response||[]).filter((d,h)=>h!==i),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})}}
11285
11059
  ></button>
11286
11060
  `})}
11287
11061
  ${this.renderSupplementalLayer()}
11288
11062
  <slot></slot>
11289
11063
  </point-container>
11290
- <div part="message" role="alert" id="validation-message" style="display:none;"></div>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,i=t<this.minChoices,r=!0,n="",s="other";return e?(r=!1,s="max",n=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):i&&(r=!1,s="min",n=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(r,n,this.#e??this,{suppressInline:!0,kind:s}),r}reportValidity(t){return super.reportValidity(t)}#d(){this.#n=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#i=t.width===0?1:this.#n/t.width,this.#r=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#d(),this.requestUpdate(),this.#e.addEventListener("click",this.#s)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#a),this.#e&&this.#e.removeEventListener("click",this.#s)}};Mi([p({type:Number,attribute:"max-choices"})],pt.prototype,"maxChoices",void 0);Mi([p({type:Number,attribute:"min-choices"})],pt.prototype,"minChoices",void 0);Mi([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Kr(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>li(o)}})],pt.prototype,"response",void 0);Mi([p({attribute:"area-mappings"})],pt.prototype,"areaMappings",void 0);Mi([R()],pt.prototype,"_areaEntries",void 0);Mi([N("response")],pt.prototype,"_handleResponseChange",void 0);Mi([N("areaMappings")],pt.prototype,"_handleAreaMappingsChange",void 0);var Fs=[{tag:"qti-select-point-interaction",ctor:pt}];var qu=[M,w`
11064
+ <div part="message" role="alert" id="validation-message" style="display:none;"></div>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,i=!0,n="",s="other";return e?(i=!1,s="max",n=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(i=!1,s="min",n=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(i,n,this.#e??this,{suppressInline:!0,kind:s}),i}reportValidity(t){return super.reportValidity(t)}#c(){this.#n=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#r=t.width===0?1:this.#n/t.width,this.#i=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#c(),this.requestUpdate(),this.#e.addEventListener("click",this.#s)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#a),this.#e&&this.#e.removeEventListener("click",this.#s)}};xr([p({type:Number,attribute:"max-choices"})],lt.prototype,"maxChoices",void 0);xr([p({type:Number,attribute:"min-choices"})],lt.prototype,"minChoices",void 0);xr([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Vi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>er(o)}})],lt.prototype,"response",void 0);xr([p({attribute:"area-mappings"})],lt.prototype,"areaMappings",void 0);xr([T()],lt.prototype,"_areaEntries",void 0);xr([N("response")],lt.prototype,"_handleResponseChange",void 0);xr([N("areaMappings")],lt.prototype,"_handleAreaMappingsChange",void 0);var ms=[{tag:"qti-select-point-interaction",ctor:lt}];var Dp=[M,w`
11291
11065
  :host {
11292
11066
  display: block;
11293
11067
  --show-bounds: true;
@@ -11355,7 +11129,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11355
11129
  text-align: center;
11356
11130
  color: #6b7280; /* text-gray-500 */
11357
11131
  }
11358
- `];var Tn=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Tt=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=qu}#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}willUpdate(t){super.willUpdate(t),this._internals.ariaValueMin=String(this.min),this._internals.ariaValueMax=String(this.max)}get response(){return this.#t===null?null:this.#t.toString()}set response(t){if(t==null||t===""){this.#e(null);return}let e=parseFloat(t);isNaN(e)||this.#e(e)}renderRailSupplement(){return P}#e(t){let e=this.#t;if(this.#t=t===null?null:Math.min(this.max,Math.max(this.min,t)),this.#t===e)return!1;if(this.#t===null)this.style.removeProperty("--value-percentage"),this._internals.setFormValue(null),this._internals.ariaValueNow=null;else{let i=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${i}%`),this._internals.setFormValue(this.value),this._internals.ariaValueNow=String(this.#t)}return this.requestUpdate(),!0}#i(t){this.#e(t)&&this.saveResponse(this.response)}render(){return v`
11132
+ `];var un=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Tt=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=Dp}#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}willUpdate(t){super.willUpdate(t),this._internals.ariaValueMin=String(this.min),this._internals.ariaValueMax=String(this.max)}get response(){return this.#t===null?null:this.#t.toString()}set response(t){if(t==null||t===""){this.#e(null);return}let e=parseFloat(t);isNaN(e)||this.#e(e)}renderRailSupplement(){return P}#e(t){let e=this.#t;if(this.#t=t===null?null:Math.min(this.max,Math.max(this.min,t)),this.#t===e)return!1;if(this.#t===null)this.style.removeProperty("--value-percentage"),this._internals.setFormValue(null),this._internals.ariaValueNow=null;else{let r=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${r}%`),this._internals.setFormValue(this.value),this._internals.ariaValueNow=String(this.#t)}return this.requestUpdate(),!0}#r(t){this.#e(t)&&this.saveResponse(this.response)}render(){return v`
11359
11133
  <slot name="prompt"></slot>
11360
11134
  <div id="slider" part="slider">
11361
11135
  <div id="bounds" part="bounds">
@@ -11365,7 +11139,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11365
11139
 
11366
11140
  <div id="ticks" part="ticks"></div>
11367
11141
 
11368
- <div id="rail" part="rail" @mousedown=${this.#r} @touchstart=${this.#n}>
11142
+ <div id="rail" part="rail" @mousedown=${this.#i} @touchstart=${this.#n}>
11369
11143
  <div id="knob" part="knob">
11370
11144
  ${this.#t===null?P:v`<div id="value" part="value">${this.#t}</div>`}
11371
11145
  </div>
@@ -11373,7 +11147,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11373
11147
  ${this.renderRailSupplement()}
11374
11148
  </div>
11375
11149
  </div>
11376
- `}#r(t){this.#o(t.pageX);let e=r=>this.#s(r.pageX),i=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",i),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",i)}#n(t){this.#o(t.touches[0].pageX);let e=r=>this.#s(r.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",i),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",i)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),i=t-e.left,r=Math.min(1,Math.max(0,i/e.width)),n=this.min+Math.round(r*(this.max-this.min)/this.step)*this.step;this.#i(n)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};Tn([Vi("#rail")],Tt.prototype,"_rail",void 0);Tn([p({type:Number,attribute:"lower-bound"})],Tt.prototype,"min",void 0);Tn([p({type:Number,attribute:"upper-bound"})],Tt.prototype,"max",void 0);Tn([p({type:Number,attribute:"step"})],Tt.prototype,"step",void 0);Tn([p({attribute:"response",reflect:!1,noAccessor:!0})],Tt.prototype,"response",null);var zs=[{tag:"qti-slider-interaction",ctor:Tt}];var xu=()=>new uc,uc=class{},pc=new WeakMap,V3=Lt(class extends $e{render(o){return P}update(o,[t]){let e=t!==this.G;return e&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),P}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=pc.get(t);e===void 0&&(e=new WeakMap,pc.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?pc.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var wu=[M,w`
11150
+ `}#i(t){this.#o(t.pageX);let e=i=>this.#s(i.pageX),r=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",r)}#n(t){this.#o(t.touches[0].pageX);let e=i=>this.#s(i.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),r=t-e.left,i=Math.min(1,Math.max(0,r/e.width)),n=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#r(n)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};un([_r("#rail")],Tt.prototype,"_rail",void 0);un([p({type:Number,attribute:"lower-bound"})],Tt.prototype,"min",void 0);un([p({type:Number,attribute:"upper-bound"})],Tt.prototype,"max",void 0);un([p({type:Number,attribute:"step"})],Tt.prototype,"step",void 0);un([p({attribute:"response",reflect:!1,noAccessor:!0})],Tt.prototype,"response",null);var fs=[{tag:"qti-slider-interaction",ctor:Tt}];var $p=()=>new Mc,Mc=class{},Ic=new WeakMap,yO=Ot(class extends Te{render(o){return P}update(o,[t]){let e=t!==this.G;return e&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),P}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Ic.get(t);e===void 0&&(e=new WeakMap,Ic.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?Ic.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Np=[M,w`
11377
11151
  :host {
11378
11152
  display: inline-flex;
11379
11153
  align-items: center;
@@ -11462,7 +11236,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11462
11236
  :host(.qti-input-width-72) {
11463
11237
  --qti-input-width: 72;
11464
11238
  }
11465
- `];var Pi=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ut=class extends D{constructor(){super(...arguments),this.inputRef=xu(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=wu}get value(){return this.response||null}set value(t){this.response=t||null}get isInline(){return!0}validate(){if(!this._input)return!1;let t="",e=!1;this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),e=this._input.checkValidity(),e||(t=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):e=this._input.checkValidity();let i="other";return e&&this.response===""&&(e=!1,i="min"),!e&&!t&&(t=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(e,t,this._input,{suppressInline:!0,kind:i}),e}renderAnswer(){return v`<div part="answer-key answer" aria-hidden="true"></div>`}renderInput(){return v`<input
11239
+ `];var wr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},dt=class extends D{constructor(){super(...arguments),this.inputRef=$p(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Np}get value(){return this.response||null}set value(t){this.response=t||null}get isInline(){return!0}validate(){if(!this._input)return!1;let t="",e=!1;this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),e=this._input.checkValidity(),e||(t=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):e=this._input.checkValidity();let r="other";return e&&this.response===""&&(e=!1,r="min"),!e&&!t&&(t=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(e,t,this._input,{suppressInline:!0,kind:r}),e}renderAnswer(){return v`<div part="answer-key answer" aria-hidden="true"></div>`}renderInput(){return v`<input
11466
11240
  part="input"
11467
11241
  name="${this.responseIdentifier}"
11468
11242
  spellcheck="false"
@@ -11472,13 +11246,13 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11472
11246
  @keyup="${this.textChanged}"
11473
11247
  @change="${this.textChanged}"
11474
11248
  type="${this.patternMask=="[0-9]*"?"number":"text"}"
11475
- placeholder="${G(this.placeholderText?this.placeholderText:void 0)}"
11249
+ placeholder="${kt(this.placeholderText?this.placeholderText:void 0)}"
11476
11250
  .value="${this.response}"
11477
- pattern="${G(this.patternMask?this.patternMask:void 0)}"
11251
+ pattern="${kt(this.patternMask?this.patternMask:void 0)}"
11478
11252
  maxlength=${1e3}
11479
11253
  ?disabled="${this.disabled}"
11480
11254
  ?readonly="${this.readonly}"
11481
- />`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(t){return this.validate(),super.reportValidity(t)}reset(){this.response=""}};Pi([p({type:Number,attribute:"expected-length"})],ut.prototype,"expectedLength",void 0);Pi([p({type:String,attribute:"pattern-mask"})],ut.prototype,"patternMask",void 0);Pi([p({type:String,attribute:"placeholder-text"})],ut.prototype,"placeholderText",void 0);Pi([p({type:String,attribute:"data-patternmask-message"})],ut.prototype,"dataPatternmaskMessage",void 0);Pi([p({type:String,attribute:"response",reflect:!1})],ut.prototype,"response",void 0);Pi([Vi("input")],ut.prototype,"_input",void 0);Pi([N("response",{waitUntilFirstUpdate:!0})],ut.prototype,"_handleValueChange",void 0);var Bs=[{tag:"qti-text-entry-interaction",ctor:ut}];var Cu=[M,w`
11255
+ />`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(t){return this.validate(),super.reportValidity(t)}reset(){this.response=""}};wr([p({type:Number,attribute:"expected-length"})],dt.prototype,"expectedLength",void 0);wr([p({type:String,attribute:"pattern-mask"})],dt.prototype,"patternMask",void 0);wr([p({type:String,attribute:"placeholder-text"})],dt.prototype,"placeholderText",void 0);wr([p({type:String,attribute:"data-patternmask-message"})],dt.prototype,"dataPatternmaskMessage",void 0);wr([p({type:String,attribute:"response",reflect:!1})],dt.prototype,"response",void 0);wr([_r("input")],dt.prototype,"_input",void 0);wr([N("response",{waitUntilFirstUpdate:!0})],dt.prototype,"_handleValueChange",void 0);var gs=[{tag:"qti-text-entry-interaction",ctor:dt}];var Lp=[M,w`
11482
11256
  :host {
11483
11257
  display: block;
11484
11258
  margin: 1em 0;
@@ -11487,18 +11261,18 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11487
11261
  display: block;
11488
11262
  margin-top: 0.5em;
11489
11263
  }
11490
- `];var Us=class extends D{static{this.styles=Cu}#t=null;#e=null;reset(){this.resetValidityReport(),this.#t=null,this.#e=null,this._internals.setFormValue(null),this.saveResponse(null)}validate(){return this.#e!==null}get response(){return this.#e}set response(t){if(typeof t=="string")this.#e=t,this._internals.setFormValue(t),this.saveResponse(t);else if(t===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...D.properties}}render(){return v`
11264
+ `];var bs=class extends D{static{this.styles=Lp}#t=null;#e=null;reset(){this.resetValidityReport(),this.#t=null,this.#e=null,this._internals.setFormValue(null),this.saveResponse(null)}validate(){return this.#e!==null}get response(){return this.#e}set response(t){if(typeof t=="string")this.#e=t,this._internals.setFormValue(t),this.saveResponse(t);else if(t===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...D.properties}}render(){return v`
11491
11265
  <div>
11492
11266
  <slot name="prompt"></slot>
11493
11267
  <input
11494
11268
  type="file"
11495
11269
  part="input"
11496
- @change="${this.#i}"
11270
+ @change="${this.#r}"
11497
11271
  ?disabled="${this.disabled}"
11498
11272
  ?readonly="${this.readonly}"
11499
11273
  />
11500
11274
  </div>
11501
- `}async#i(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#r(this.#t),this._internals.setFormValue(this.#e),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#r(t){return new Promise((e,i)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>i(r.error),r.readAsDataURL(t)})}};var Hs=[{tag:"qti-upload-interaction",ctor:Us}];var ku=[...vs,...ys,...qs,...xs,...ws,...Cs,...Ss,...Es,...As,..._s,...Rs,...Is,...Ms,...Os,...Ds,...Ls,...js,...Fs,...zs,...Bs,...Hs,...vp];for(let{tag:o,ctor:t}of ku)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of vs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ys)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of qs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of xs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ws)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Cs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ss)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of As)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of _s)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Rs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Is)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ms)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Os)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ls)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of js)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Fs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of zs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Bs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Hs)customElements.get(o)||customElements.define(o,t);var fL=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await nh().load(`${o}`).then(a=>a.assessmentTest()),i=await Ki().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),r=await Ki().load(`${t}/${e.href}`).then(a=>a.items()),n=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:i,testURI:s,testURL:n,items:r,testIdentifier:e.identifier}},gL=async o=>Zt().load(o).then(t=>t.htmlDoc().firstElementChild);var Ws=class extends bg(Yt){calculate(){return this.calculateChildren(Array.from(this.children))}};function bg(o){return class extends o{calculateChildren(e){return e.map(r=>{let n=r;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=n.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(r=>typeof r=="boolean"&&r)}}}var Su=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},mr=class extends E{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let i of t){if(i.cardinality!=="single"||Array.isArray(i.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(i.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(i.value===null||i.value===void 0)return null;i.value==="true"&&e++}return e>=this.min&&e<=this.max}};Su([p({type:Number})],mr.prototype,"min",void 0);Su([p({type:Number})],mr.prototype,"max",void 0);var vg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Mn=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};vg([p({type:String,attribute:"base-type"})],Mn.prototype,"baseType",void 0);var Qs=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var Xs=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let i=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,i));let r=this.#t(t.value),n=this.#t(e.value);return n.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#r(r,n,i):this.#i(r,n,i)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,i){return Z.compareSingleValues(t,e,i)||t===e}#i(t,e,i){let r=[...t];return e.every(n=>{let s=r.findIndex(a=>this.#e(a,n,i));return s===-1?!1:(r.splice(s,1),!0)})}#r(t,e,i){for(let r=0;r+e.length<=t.length;r++)if(e.every((n,s)=>this.#e(t[r+s],n,i)))return!0;return!1}};var Gs=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(i=>i.identifier===t)||null;return e.cardinality==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var mc=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Oi=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,i;if(t.length===2)e=t[0],i=t[1];else if(t.length===1)i=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let n=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!n)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===i);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let r=this.context.variables.find(n=>n.identifier===i);return r?r.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item context`),null)}};mc([p({type:String})],Oi.prototype,"identifier",void 0);mc([I({context:F,subscribe:!0}),R()],Oi.prototype,"context",void 0);mc([R(),I({context:st,subscribe:!0})],Oi.prototype,"_testContext",void 0);var Js=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return e.cardinality!=="single"||!Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):i.value.filter(n=>!e.value.includes(n))}return null}};var Ys=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let i of t){if(!i)continue;let r=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(n=>r(n));continue}r(i.value)}return e}};var Ks=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(i=>this.#e(i));return e.some(i=>i===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Zs=class extends E{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(i=>this.#e(i));return e.some(i=>i===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var yg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Pn=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let r=parseFloat(e.value),n=parseFloat(i.value);if(!isNaN(r)&&!isNaN(n))return this.roundingMode==="significantFigures"?r.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(r*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${r}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};yg([p({type:String,attribute:"rounding-mode"})],Pn.prototype,"roundingMode",void 0);var Eu=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},fr=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return!e||!i?null:e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||i.value===null||e.value===void 0||i.value===void 0?null:this.toleranceMode==="exact"?Z.compareSingleValues(e.value,i.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(i.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let i=this.tolerance.split(/\s+/).filter(Boolean).map(l=>parseFloat(l));if(i.length===0||i.some(l=>Number.isNaN(l)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[r,n=r]=i,[s,a]=this.toleranceMode==="absolute"?[e-r,e+n]:[e*(1-r/100),e*(1+n/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};Eu([p({type:String,attribute:"tolerance-mode"})],fr.prototype,"toleranceMode",void 0);Eu([p({type:String})],fr.prototype,"tolerance",void 0);var K=class extends C{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var ta=class extends K{process(){throw new Bi}};var ea=class extends K{process(){throw new Ui}};var ia=class extends E{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],i=e?.cardinality==="record"||e?.baseType==="record";if(i&&(e.value===null||e.value===void 0))return null;if(!e||!i||!$t(e.value))return console.warn("qti-field-value child expression must return a record"),null;let r=e.value[t];return r==null?null:(this.#t=e.fieldBaseTypes?.[t]??go(Array.isArray(r)?r[0]:r),r)}};var ra=class extends E{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(i.value===null||i.value===void 0)return null;if(i.cardinality==="single"){if(Array.isArray(i.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let r=parseInt(i.value,10);if(isNaN(r))return console.error("qti-gcd non-numerical value"),null;e.push(r)}else if(i.cardinality==="multiple"||i.cardinality==="ordered"){if(!Array.isArray(i.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let r of i.value){if(r==null)return null;let n=parseInt(r,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let i=1;i<t.length&&(e=this.#e(e,Math.abs(t[i])),e!==1);i++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let i=e;e=t%e,t=i}return t}};var Mt=o=>o==null||o==="";var na=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if(Mt(e?.value)||Mt(i?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float"))return+e.value>+i.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var oa=class extends Yt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return Mt(e?.value)||Mt(i?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float")?+e.value>=+i.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var qg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},On=class extends E{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let i=this.#t(this.n);if(i===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(i)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let i=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>i.length?null:i[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(i=>i.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};qg([p({type:String})],On.prototype,"n",void 0);var Au=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},gr=class extends E{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let i=this.#t(e.value.toString()),r=this.#e(this.coords);if(!i||r.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#i(i,r);case"rect":return this.#r(i,r);case"ellipse":return this.#n(i,r);case"poly":case"polygon":return this.#o(i,r);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(n=>n.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let i=Number.parseFloat(e[0]),r=Number.parseFloat(e[1]);return Number.isNaN(i)||Number.isNaN(r)?(console.error("qti-inside requires numeric point coordinates"),null):{x:i,y:r}}#e(t){let e=t.split(",").map(i=>i.trim()).filter(Boolean).map(i=>Number.parseFloat(i));return e.some(i=>Number.isNaN(i))?(console.error("qti-inside requires numeric coords"),[]):e}#i(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[i,r,n]=e;return(t.x-i)**2+(t.y-r)**2<=n**2}#r(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[i,r,n,s]=e,a=Math.min(i,n),l=Math.max(i,n),c=Math.min(r,s),d=Math.max(r,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#n(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[i,r,n,s]=e;return n===0||s===0?!1:(t.x-i)**2/n**2+(t.y-r)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let i=!1;for(let r=0,n=e.length-2;r<e.length;r+=2){let s=e[r],a=e[r+1],l=e[n],c=e[n+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(i=!i),n=r}return i}};Au([p({type:String})],gr.prototype,"shape",void 0);Au([p({type:String})],gr.prototype,"coords",void 0);var sa=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(i.cardinality!=="single"||Array.isArray(i.value))return console.error("qti-integer-divide requires single cardinality"),[];if(i.value===null||i.value===void 0)return[];let r=Number.parseInt(i.value,10);if(Number.isNaN(r))return console.error("qti-integer-divide requires integer values"),[];e.push(r)}return e}};var aa=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(i.cardinality!=="single"||Array.isArray(i.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(i.value===null||i.value===void 0)return[];let r=Number.parseInt(i.value,10);if(Number.isNaN(r))return console.error("qti-integer-modulus requires integer values"),[];e.push(r)}return e}};var la=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let i=Number.parseInt(e.value,10);return Number.isNaN(i)?(console.error("qti-integer-to-float requires an integer value"),null):i}};var ca=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var da=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,i)=>this.#i(e,i))}#t(t){let e=[];for(let i of t){if(i.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(i.value===null||i.value===void 0)return[];if(i.cardinality==="single"){if(Array.isArray(i.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let r=Number.parseInt(i.value,10);if(Number.isNaN(r))return console.error("qti-lcm requires integer values"),[];e.push(r);continue}if(i.cardinality!=="multiple"&&i.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(i.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let r of i.value){let n=Number.parseInt(r,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n)}}return e}#e(t,e){let i=Math.abs(t),r=Math.abs(e);for(;r!==0;){let n=i%r;i=r,r=n}return i}#i(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var _u=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},br=class extends K{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(n=>n.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let i=parseFloat(this.childExpression.calculate()),r;return e.matchTable?.size?r=e.matchTable.get(i):e.interpolationTable&&(r=this.#t(i,e.interpolationTable)),r==null?(console.warn(`lookupOutcomeValue: no table entry matches ${i} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Dt(r)}})),r)}#t(t,e){if(!Number.isNaN(t))return e.find(i=>i.includeBoundary?t>=i.sourceValue:t>i.sourceValue)?.targetValue}};_u([p({type:String})],br.prototype,"identifier",void 0);_u([I({context:F,subscribe:!0}),R()],br.prototype,"context",void 0);var ha=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if(Mt(e?.value)||Mt(i?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float"))return+e.value<+i.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var pa=class extends Yt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return Mt(e?.value)||Mt(i?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(i.baseType==="integer"||i.baseType==="float")?+e.value<=+i.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var xg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Dn=class extends E{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let i=(Array.isArray(t.value)?t.value:[t.value]).filter(s=>typeof s=="string"&&s.length>0);if(i.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let r=0,n=new Set;for(let s of i)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;if(Z.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){r+=a.mappedValue??0,n.add(a.coords);break}}return n.size<i.length&&(r+=e.defaultValue),e.lowerBound!=null&&(r=Math.max(e.lowerBound,r)),e.upperBound!=null&&(r=Math.min(e.upperBound,r)),r}};xg([p({type:String})],Dn.prototype,"identifier",void 0);var wg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},$n=class extends E{getResult(){let t=this.context.variables.find(n=>n.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,i=Array.isArray(t.value)?t.value:[t.value],r=0;for(let n of i){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?Z.compareSingleValues(l.mapKey.toLowerCase(),n.toLowerCase(),t.baseType):Z.compareSingleValues(l.mapKey,n,t.baseType)),a=s.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?r+=e.defaultValue:r+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(r=Math.max(e.lowerBound,r)),e?.upperBound!==null&&e?.upperBound!==void 0&&(r=Math.min(e.upperBound,r)),r}};wg([p({type:String})],$n.prototype,"identifier",void 0);var ua=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];return o.match(e,i)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):Z.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let i=0;i<t.value.length;i++)if(!Z.compareSingleValues(e.value[i],t.value[i],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let i=0;for(let r of e.value){let n=null,s=[...t.value];for(let a of s)if(Z.compareSingleValues(r,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;i++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Cg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Nn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};Cg([p({type:String})],Nn.prototype,"name",void 0);var kg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ln=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let i of t){if(i.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(i.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(i.value===null||i.value===void 0)return null;if(i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let r=parseFloat(i.value);if(isNaN(r))return console.error("qti-math-operator non-numerical value"),null;e.push(r)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let i=e[0],r=e[1];return i===0&&r<=0||i<0&&!Number.isInteger(r)?null:Math.pow(i,r)}case"log_base":{if(e.length!==2)return null;let i=e[0],r=e[1];return i<=0||r<=0||r===1?null:Math.log(i)/Math.log(r)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(i){return console.error(`qti-math-operator: error performing operation "${t}":`,i),null}}};kg([p({type:String})],Ln.prototype,"name",void 0);var ma=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let i of t){if(!i)continue;let r=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(n=>r(n));continue}r(i.value)}return e}};var fa=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,i]=t;if(e.baseType===i.baseType||e.baseType==="integer"&&i.baseType==="float"||e.baseType==="float"&&i.baseType==="integer"||console.warn("Which must both have the same base-type"),i.cardinality==="multiple"||i.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||i.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||i.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||i.value===null)return null;let r=e.value;return i.value.includes(r)}};var ga=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let i of t){if(!i)continue;let r=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(n=>r(n));continue}r(i.value)}return e}};var ba=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var va=class extends E{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var ya=class extends E{getResult(){return null}};var qa=class extends Yt{getResult(){return Array.from(this.children).map(e=>{let i=e;if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=i.calculate(),n=!1;if(typeof r=="string")if(r==="true")n=!0;else if(r==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof r=="boolean"&&(n=r);return n}).some(e=>typeof e=="boolean"&&e)}};var xa=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var wa=class extends C{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},vr=class extends wa{shouldProcess(){return!0}getSubRules(){return[...this.children]}},yr=class extends wa{shouldProcess(){let e=this.firstElementChild.calculate();return e===!0||e==="true"}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},qr=class extends K{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var Ca=class extends qr{};var xr=class extends yr{};var ka=class extends xr{};var Sa=class extends vr{};var Sg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Vn=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let i=this.#t();return i?i.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};Sg([p({type:String})],Vn.prototype,"pattern",void 0);var Ea=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,i]=t;if(e.cardinality!=="single"||i.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(i.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||i.value===null||i.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let r=parseFloat(e.value),n=parseFloat(i.value);if(isNaN(r)||isNaN(n))return console.error("qti-power: non-numerical values encountered"),null;if(r===0&&n<=0||r<0&&!Number.isInteger(n))return null;let s;try{s=Math.pow(r,n)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),l=Math.max(0,14-a),c=Math.pow(10,l);s=Math.round(s*c)/c}return s}};var Eg=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function Ag(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function jn(o,t){return Ag(t===void 0?o.toExponential():o.toExponential(t))}function Ru(o){let[t,e]=o.split(/e/i),i=t.includes(".")?t.replace(/\.?0+$/,""):t,r=e===void 0?"":`e${e}`;return`${i}${r}`}function Iu(o,t){let e=t===0?1:t,i=o===0?0:Math.floor(Math.log10(o));return i<-4||i>=e?Ru(jn(o,e-1)):Ru(o.toFixed(Math.max(0,e-1-i)))}function _g(o,t,e,i){if(o==="s"||o==="c"){let c=o==="c"?i.slice(0,1):i;return e===void 0?c:c.slice(0,e)}let r=Number(i);if(i.trim()===""||!Number.isFinite(r))return i;let n=Math.abs(r),s,a=r<0;switch(o){case"d":case"i":s=String(Math.trunc(n));break;case"u":s=String(Math.trunc(n)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(n).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(n).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(n).toString(16).toUpperCase()}`;break;case"f":case"F":s=n.toFixed(e??6);break;case"e":s=jn(n,e??6);break;case"E":s=jn(n,e??6).toUpperCase();break;case"g":s=Iu(n,e??6);break;case"G":s=Iu(n,e??6).toUpperCase();break;default:return i}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function Rg(o,t,e){if(o.length>=e)return o;let i=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(i)}`;if(t.includes("0")){let[,r,n]=/^([-+ ]?)(.*)$/.exec(o);return`${r}${"0".repeat(i)}${n}`}return`${" ".repeat(i)}${o}`}function Tu(o,t){return o.replace(Eg,(e,i,r,n,s,a)=>i?"%":Rg(_g(a,r??"",s===void 0?void 0:Number(s),t),r??"",n===void 0?0:Number(n)))}var Ce=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},xt=class extends C{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(i=>i.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:v`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let i=e[this.index-1];return i==null?null:this.#e(i,t.baseType)}return e.map(i=>this.#e(i,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let i=e;if(this.field!==void 0){let n=i[this.field];return n==null?null:this.#e(n,t.baseType)}let r=Object.entries(i).filter(([,n])=>n!=null);return r.length===0?null:r.map(([n,s])=>`${n}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let i=Array.isArray(t)?t.join(" "):String(t);if(this.format)return Tu(this.format,i);if(e==="integer"&&this.base!==10){let r=Number.parseInt(i,10);if(Number.isFinite(r))return r.toString(this.base)}if(this.powerForm){let r=Number(i);if(i.trim()!==""&&Number.isFinite(r))return jn(r)}return i}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};Ce([p({type:String})],xt.prototype,"identifier",void 0);Ce([p({type:String})],xt.prototype,"format",void 0);Ce([p({type:Number})],xt.prototype,"base",void 0);Ce([p({type:Number})],xt.prototype,"index",void 0);Ce([p({type:Boolean,attribute:"power-form"})],xt.prototype,"powerForm",void 0);Ce([p({type:String})],xt.prototype,"field",void 0);Ce([p({type:String})],xt.prototype,"delimiter",void 0);Ce([p({type:String,attribute:"mapping-indicator"})],xt.prototype,"mappingIndicator",void 0);Ce([I({context:F,subscribe:!0}),R()],xt.prototype,"context",void 0);var Aa=class extends E{getResult(){return this.getVariables().reduce((i,r)=>{if(r.baseType=="float"||r.baseType=="integer")try{return i*parseFloat(r.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${r.baseType}`);return i},1)}};var fc=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Di=class extends E{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}if(t.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let i=Math.floor(Math.random()*t.length);return t[i]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};fc([p({type:Number})],Di.prototype,"min",void 0);fc([p({type:Number})],Di.prototype,"max",void 0);fc([p({type:Number})],Di.prototype,"step",void 0);var _a=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let i=Math.floor(Math.random()*e.length);return e[i]}return e}return console.error("unexpected number of children in match"),null}};var Ig=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},gc=1e3,Fn=class extends E{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let i=[];for(let r=0;r<t;r++){let n=e.calculate(),s=this.#i(n);s&&i.push(s)}return i}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,i=this.context?.variables?.find(s=>s.identifier===e);if(!i)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let r=Array.isArray(i.value)?i.value[0]:i.value,n=parseInt(r?.toString()??"",10);return Number.isNaN(n)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(n)}#e(t){return t>gc?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${gc} limit, truncating`),gc):t}#i(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};Ig([p({type:String,attribute:"number-repeats"})],Fn.prototype,"numberRepeats",void 0);var Ra=class extends qr{};var wr=class extends yr{};var Ia=class extends wr{};var Ta=class extends vr{};var Ma=class extends K{process(){for(let t of[...this.children])t.process()}};var Mu=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Cr=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let i=parseFloat(e.value);return isNaN(i)?null:isFinite(i)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(i,this.figures):this.#e(i,this.figures):i===1/0?1/0:i===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let i=Math.pow(10,e);return Math.round(t*i)/i}#e(t,e){if(t===0)return 0;let i=Math.floor(Math.log10(Math.abs(t))),r=Math.pow(10,e-i-1);return Math.round(t*r)/r}};Mu([p({type:String,attribute:"rounding-mode"})],Cr.prototype,"roundingMode",void 0);Mu([p({type:Number})],Cr.prototype,"figures",void 0);var Pa=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let i=parseFloat(e.value);return isNaN(i)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(i)?Math.floor(i+.5):i===1/0?1/0:i===-1/0?-1/0:null}};var Oa=class extends K{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let r=new bc(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(r)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Dt(this.#e(e))):Dt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},bc=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var Da=class extends K{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let r=new vc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(r)}}))}#t(t){return Array.isArray(t)?t.map(Dt):t!==null?Dt(t):null}},vc=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>e.value?e.value:e):t}};var $a=class extends K{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let r=new yc(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(r)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Dt(this.#e(e))):Dt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},yc=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var Tg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},zn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#r(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#i(t,t.length);case"popsd":return Math.sqrt(this.#i(t,t.length));case"samplevariance":return t.length<2?null:this.#i(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#i(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,i)=>e+i,0)/t.length}#e(t){let e=[...t].sort((r,n)=>r-n),i=Math.floor(e.length/2);return e.length%2===0?(e[i-1]+e[i])/2:e[i]}#i(t,e){let i=this.#t(t);return t.reduce((r,n)=>r+Math.pow(n-i,2),0)/e}#r(t){let e=[];for(let i of t){if(!i)continue;let r=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(i.value)){i.value.forEach(n=>r(n));continue}r(i.value)}return e}};Tg([p({type:String})],zn.prototype,"name",void 0);var Mg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Bn=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],i=t[1];if(e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let r=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),n=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return Z.compareSingleValues(r,n,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Mg([p({type:String,attribute:"case-sensitive"})],Bn.prototype,"caseSensitive",void 0);var Pg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Un=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,i]=t;if(e.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(i.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||i.value===null||e.value===void 0||i.value===void 0)return null;let r=e.value.toString(),n=i.value.toString();return this.caseSensitive!=="true"?n.toLowerCase().includes(r.toLowerCase()):n.includes(r)}};Pg([p({type:String,attribute:"case-sensitive"})],Un.prototype,"caseSensitive",void 0);var Na=class extends Og(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function Og(o){return class extends o{calculateChildren(e){let i=e.map(r=>{if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=r.calculate();return Number.isNaN(n)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(n)});return i.some(r=>r===null)?(console.error("One or more child expressions returned invalid values"),0):i[0]-i[1]}}}var La=class extends E{getResult(){return new qc(Array.from(this.children)).calculate()}},qc=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(i=>i.calculate!==void 0).some(i=>i.calculate()===null)?null:this.expressions.map(i=>{let r=i.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((i,r)=>i+r,0)}};var Va=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let i=Number.parseFloat(e.value);return Number.isNaN(i)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(i)}};var ja=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var Pu=[{tag:"qti-and",ctor:Ws},{tag:"qti-any-n",ctor:mr},{tag:"qti-base-value",ctor:Mn},{tag:"qti-container-size",ctor:Qs},{tag:"qti-contains",ctor:Xs},{tag:"qti-correct",ctor:Gs},{tag:"qti-default",ctor:Oi},{tag:"qti-delete",ctor:Js},{tag:"qti-divide",ctor:Ys},{tag:"qti-duration-gte",ctor:Ks},{tag:"qti-duration-lt",ctor:Zs},{tag:"qti-equal",ctor:fr},{tag:"qti-equal-rounded",ctor:Pn},{tag:"qti-exit-response",ctor:ta},{tag:"qti-exit-test",ctor:ea},{tag:"qti-field-value",ctor:ia},{tag:"qti-gcd",ctor:ra},{tag:"qti-gt",ctor:na},{tag:"qti-gte",ctor:oa},{tag:"qti-index",ctor:On},{tag:"qti-inside",ctor:gr},{tag:"qti-integer-divide",ctor:sa},{tag:"qti-integer-modulus",ctor:aa},{tag:"qti-integer-to-float",ctor:la},{tag:"qti-is-null",ctor:ca},{tag:"qti-lcm",ctor:da},{tag:"qti-lookup-outcome-value",ctor:br},{tag:"qti-lt",ctor:ha},{tag:"qti-lte",ctor:pa},{tag:"qti-map-response",ctor:$n},{tag:"qti-map-response-point",ctor:Dn},{tag:"qti-match",ctor:ua},{tag:"qti-math-constant",ctor:Nn},{tag:"qti-math-operator",ctor:Ln},{tag:"qti-max",ctor:ma},{tag:"qti-member",ctor:fa},{tag:"qti-min",ctor:ga},{tag:"qti-multiple",ctor:ba},{tag:"qti-not",ctor:va},{tag:"qti-null",ctor:ya},{tag:"qti-or",ctor:qa},{tag:"qti-ordered",ctor:xa},{tag:"qti-outcome-condition",ctor:Ca},{tag:"qti-outcome-else",ctor:Sa},{tag:"qti-outcome-else-if",ctor:ka},{tag:"qti-outcome-if",ctor:xr},{tag:"qti-pattern-match",ctor:Vn},{tag:"qti-power",ctor:Ea},{tag:"qti-printed-variable",ctor:xt},{tag:"qti-product",ctor:Aa},{tag:"qti-random",ctor:_a},{tag:"qti-random-integer",ctor:Di},{tag:"qti-repeat",ctor:Fn},{tag:"qti-response-condition",ctor:Ra},{tag:"qti-response-else",ctor:Ta},{tag:"qti-response-else-if",ctor:Ia},{tag:"qti-response-if",ctor:wr},{tag:"qti-response-processing-fragment",ctor:Ma},{tag:"qti-round",ctor:Pa},{tag:"qti-round-to",ctor:Cr},{tag:"qti-rule",ctor:K},{tag:"qti-set-correct-response",ctor:Oa},{tag:"qti-set-outcome-value",ctor:Da},{tag:"qti-set-template-value",ctor:$a},{tag:"qti-stats-operator",ctor:zn},{tag:"qti-string-match",ctor:Bn},{tag:"qti-substring",ctor:Un},{tag:"qti-subtract",ctor:Na},{tag:"qti-sum",ctor:La},{tag:"qti-truncate",ctor:Va},{tag:"qti-variable",ctor:ja}];for(let{tag:o,ctor:t}of Pu)customElements.get(o)||customElements.define(o,t);var ke=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},et;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(et||(et={}));var xc=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(i,r)=>{this.toggleInternalCorrectResponse(r)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(i,r)=>{this.toggleFullCorrectResponse(r)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(i,r)=>{this.toggleCandidateCorrection(r)},this._correctResponse=null}set correctResponseAttr(i){this._correctResponse=i}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(i){this._isFullCorrectResponse=i,i&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""),B(this._internals.states,"answer-key",!0,[]))}get correctResponse(){let i=this.responseVariable;return i?.correctResponse?i.correctResponse:this._correctResponse}set correctResponse(i){let r=this._correctResponse;this._correctResponse=i,i==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(i)?i.join(","):i),this.requestUpdate("_correctResponse",r)}get correctness(){let i=this.correctResponse;if(!i)return null;let r=this.response;if(r==null||r===""||Array.isArray(r)&&r.length===0)return null;let n=Array.isArray(i)?i:[i],a=(Array.isArray(r)?r:[r]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>n.includes(d)).length,c=a.filter(d=>!n.includes(d)).length;return l===n.length&&c===0&&a.length===n.length?et.Correct:l>0&&(l<n.length||c>0)?et.PartiallyCorrect:et.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(i){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(i):this.toggleInternalCorrectResponse(i)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(i){let r=this.nextSibling,n=r instanceof HTMLDivElement&&r?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(i&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==et.Correct))){if(!n)return;this.parentElement?.removeChild(r);return}if(n)return;let l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(i){B(this._internals.states,"answer-key-shown",!!(i&&this.correctResponse),["show-correct-response"])}toggleCandidateCorrection(i){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return ke([p({attribute:"correct-response",reflect:!0,converter:Kt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),ke([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),ke([N("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),ke([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),ke([N("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),ke([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),ke([N("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),ke([R()],t.prototype,"_isFullCorrectResponse",void 0),ke([R()],t.prototype,"_correctResponse",void 0),t};var ct=w`
11275
+ `}async#r(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#i(this.#t),this._internals.setFormValue(this.#e),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#i(t){return new Promise((e,r)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(t)})}};var vs=[{tag:"qti-upload-interaction",ctor:bs}];var Vp=[...Uo,...Ho,...Wo,...Qo,...Xo,...Go,...Yo,...Ko,...Zo,...ts,...es,...rs,...ns,...ss,...as,...hs,...us,...ms,...fs,...gs,...vs,...Ph];for(let{tag:o,ctor:t}of Vp)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Uo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ho)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Wo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Qo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Xo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Go)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Yo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ko)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Zo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ts)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of rs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ns)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ss)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of as)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of hs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of us)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ms)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of fs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of gs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of vs)customElements.get(o)||customElements.define(o,t);var G$=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await kd().load(`${o}`).then(a=>a.assessmentTest()),r=await Fr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Fr().load(`${t}/${e.href}`).then(a=>a.items()),n=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:n,items:i,testIdentifier:e.identifier}},J$=async o=>Gt().load(o).then(t=>t.htmlDoc().firstElementChild);var ys=class extends Ef(Qt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Ef(o){return class extends o{calculateChildren(e){return e.map(i=>{let n=i;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=n.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var jp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ei=class extends E{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let r of t){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(r.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(r.value===null||r.value===void 0)return null;r.value==="true"&&e++}return e>=this.min&&e<=this.max}};jp([p({type:Number})],ei.prototype,"min",void 0);jp([p({type:Number})],ei.prototype,"max",void 0);var Af=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},mn=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Af([p({type:String,attribute:"base-type"})],mn.prototype,"baseType",void 0);var qs=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var xs=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let i=this.#t(t.value),n=this.#t(e.value);return n.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(i,n,r):this.#r(i,n,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return Y.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let i=[...t];return e.every(n=>{let s=i.findIndex(a=>this.#e(a,n,r));return s===-1?!1:(i.splice(s,1),!0)})}#i(t,e,r){for(let i=0;i+e.length<=t.length;i++)if(e.every((n,s)=>this.#e(t[i+s],n,r)))return!0;return!1}};var ws=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var Pc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Cr=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let n=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!n)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(n=>n.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Pc([p({type:String})],Cr.prototype,"identifier",void 0);Pc([R({context:j,subscribe:!0}),T()],Cr.prototype,"context",void 0);Pc([T(),R({context:nt,subscribe:!0})],Cr.prototype,"_testContext",void 0);var Cs=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(n=>!e.value.includes(n))}return null}};var ks=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Ss=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Es=class extends E{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var _f=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fn=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let i=parseFloat(e.value),n=parseFloat(r.value);if(!isNaN(i)&&!isNaN(n))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};_f([p({type:String,attribute:"rounding-mode"})],fn.prototype,"roundingMode",void 0);var Fp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ri=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?Y.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(c=>parseFloat(c));if(r.length===0||r.some(c=>Number.isNaN(c)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[i,n=i]=r,[s,a]=this.toleranceMode==="absolute"?[e-i,e+n]:[e*(1-i/100),e*(1+n/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};Fp([p({type:String,attribute:"tolerance-mode"})],ri.prototype,"toleranceMode",void 0);Fp([p({type:String})],ri.prototype,"tolerance",void 0);var G=class extends S{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var As=class extends G{process(){throw new Mr}};var _s=class extends G{process(){throw new Pr}};var Ts=class extends E{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],r=e?.cardinality==="record"||e?.baseType==="record";if(r&&(e.value===null||e.value===void 0))return null;if(!e||!r||!ce(e.value))return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i==null?null:(this.#t=e.fieldBaseTypes?.[t]??Kn(Array.isArray(i)?i[0]:i),i)}};var Rs=class extends E{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(r.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(r.cardinality==="multiple"||r.cardinality==="ordered"){if(!Array.isArray(r.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of r.value){if(i==null)return null;let n=parseInt(i,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let r=1;r<t.length&&(e=this.#e(e,Math.abs(t[r])),e!==1);r++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let r=e;e=t%e,t=r}return t}};var Rt=o=>o==null||o==="";var Is=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Rt(e?.value)||Rt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Ms=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Rt(e?.value)||Rt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var Tf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gn=class extends E{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let r=this.#t(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(r)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let r=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>r.length?null:r[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(r=>r.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Tf([p({type:String})],gn.prototype,"n",void 0);var zp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ii=class extends E{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),i=this.#e(this.coords);if(!r||i.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,i);case"rect":return this.#i(r,i);case"ellipse":return this.#n(r,i);case"poly":case"polygon":return this.#o(r,i);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(n=>n.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,n]=e;return(t.x-r)**2+(t.y-i)**2<=n**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,n,s]=e,a=Math.min(r,n),c=Math.max(r,n),l=Math.min(i,s),d=Math.max(i,s);return t.x>=a&&t.x<=c&&t.y>=l&&t.y<=d}#n(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,i,n,s]=e;return n===0||s===0?!1:(t.x-r)**2/n**2+(t.y-i)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,n=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],c=e[n],l=e[n+1];a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a||Number.EPSILON)+s&&(r=!r),n=i}return r}};zp([p({type:String})],ii.prototype,"shape",void 0);zp([p({type:String})],ii.prototype,"coords",void 0);var Ps=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};var Os=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};var Ds=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var $s=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var Ns=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);continue}if(r.cardinality!=="multiple"&&r.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(r.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let i of r.value){let n=Number.parseInt(i,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n)}}return e}#e(t,e){let r=Math.abs(t),i=Math.abs(e);for(;i!==0;){let n=r%i;r=i,i=n}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var Bp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ni=class extends G{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(n=>n.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let r=parseFloat(this.childExpression.calculate()),i;return e.matchTable?.size?i=e.matchTable.get(r):e.interpolationTable&&(i=this.#t(r,e.interpolationTable)),i==null?(console.warn(`lookupOutcomeValue: no table entry matches ${r} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Mt(i)}})),i)}#t(t,e){if(!Number.isNaN(t))return e.find(r=>r.includeBoundary?t>=r.sourceValue:t>r.sourceValue)?.targetValue}};Bp([p({type:String})],ni.prototype,"identifier",void 0);Bp([R({context:j,subscribe:!0}),T()],ni.prototype,"context",void 0);var Ls=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Rt(e?.value)||Rt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var Vs=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Rt(e?.value)||Rt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var Rf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bn=class extends E{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=(Array.isArray(t.value)?t.value:[t.value]).filter(s=>typeof s=="string"&&s.length>0);if(r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,n=new Set;for(let s of r)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;if(Y.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){i+=a.mappedValue??0,n.add(a.coords);break}}return n.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Rf([p({type:String})],bn.prototype,"identifier",void 0);var If=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vn=class extends E{getResult(){let t=this.context.variables.find(n=>n.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let n of r){let s=e.mapEntries.filter(c=>t.baseType==="string"&&!c.caseSensitive?Y.compareSingleValues(c.mapKey.toLowerCase(),n.toLowerCase(),t.baseType):Y.compareSingleValues(c.mapKey,n,t.baseType)),a=s.reduce((c,l)=>c.mappedValue>l.mappedValue?c:l,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};If([p({type:String})],vn.prototype,"identifier",void 0);var js=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):Y.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!Y.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let n=null,s=[...t.value];for(let a of s)if(Y.compareSingleValues(i,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Mf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},yn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};Mf([p({type:String})],yn.prototype,"name",void 0);var Pf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let i=parseFloat(r.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],i=e[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(e.length!==2)return null;let r=e[0],i=e[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};Pf([p({type:String})],qn.prototype,"name",void 0);var Fs=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var zs=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};var Bs=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Us=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var Hs=class extends E{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var Ws=class extends E{getResult(){return null}};var Qs=class extends Qt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),n=!1;if(typeof i=="string")if(i==="true")n=!0;else if(i==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(n=i);return n}).some(e=>typeof e=="boolean"&&e)}};var Xs=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var Gs=class extends S{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},oi=class extends Gs{shouldProcess(){return!0}getSubRules(){return[...this.children]}},si=class extends Gs{shouldProcess(){let e=this.firstElementChild.calculate();return e===!0||e==="true"}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},ai=class extends G{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var Js=class extends ai{};var ci=class extends si{};var Ys=class extends ci{};var Ks=class extends oi{};var Of=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},xn=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=this.#t();return r?r.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};Of([p({type:String})],xn.prototype,"pattern",void 0);var Zs=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),n=parseFloat(r.value);if(isNaN(i)||isNaN(n))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&n<=0||i<0&&!Number.isInteger(n))return null;let s;try{s=Math.pow(i,n)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),c=Math.max(0,14-a),l=Math.pow(10,c);s=Math.round(s*l)/l}return s}};var Df=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function $f(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function wn(o,t){return $f(t===void 0?o.toExponential():o.toExponential(t))}function Up(o){let[t,e]=o.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,i=e===void 0?"":`e${e}`;return`${r}${i}`}function Hp(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?Up(wn(o,e-1)):Up(o.toFixed(Math.max(0,e-1-r)))}function Nf(o,t,e,r){if(o==="s"||o==="c"){let l=o==="c"?r.slice(0,1):r;return e===void 0?l:l.slice(0,e)}let i=Number(r);if(r.trim()===""||!Number.isFinite(i))return r;let n=Math.abs(i),s,a=i<0;switch(o){case"d":case"i":s=String(Math.trunc(n));break;case"u":s=String(Math.trunc(n)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(n).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(n).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(n).toString(16).toUpperCase()}`;break;case"f":case"F":s=n.toFixed(e??6);break;case"e":s=wn(n,e??6);break;case"E":s=wn(n,e??6).toUpperCase();break;case"g":s=Hp(n,e??6);break;case"G":s=Hp(n,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function Lf(o,t,e){if(o.length>=e)return o;let r=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(r)}`;if(t.includes("0")){let[,i,n]=/^([-+ ]?)(.*)$/.exec(o);return`${i}${"0".repeat(r)}${n}`}return`${" ".repeat(r)}${o}`}function Wp(o,t){return o.replace(Df,(e,r,i,n,s,a)=>r?"%":Lf(Nf(a,i??"",s===void 0?void 0:Number(s),t),i??"",n===void 0?0:Number(n)))}var ve=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vt=class extends S{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:v`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let r=e[this.index-1];return r==null?null:this.#e(r,t.baseType)}return e.map(r=>this.#e(r,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let r=e;if(this.field!==void 0){let n=r[this.field];return n==null?null:this.#e(n,t.baseType)}let i=Object.entries(r).filter(([,n])=>n!=null);return i.length===0?null:i.map(([n,s])=>`${n}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let r=Array.isArray(t)?t.join(" "):String(t);if(this.format)return Wp(this.format,r);if(e==="integer"&&this.base!==10){let i=Number.parseInt(r,10);if(Number.isFinite(i))return i.toString(this.base)}if(this.powerForm){let i=Number(r);if(r.trim()!==""&&Number.isFinite(i))return wn(i)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};ve([p({type:String})],vt.prototype,"identifier",void 0);ve([p({type:String})],vt.prototype,"format",void 0);ve([p({type:Number})],vt.prototype,"base",void 0);ve([p({type:Number})],vt.prototype,"index",void 0);ve([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);ve([p({type:String})],vt.prototype,"field",void 0);ve([p({type:String})],vt.prototype,"delimiter",void 0);ve([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);ve([R({context:j,subscribe:!0}),T()],vt.prototype,"context",void 0);var ta=class extends E{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};var Oc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},kr=class extends E{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),e++}if(t.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let r=Math.floor(Math.random()*t.length);return t[r]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};Oc([p({type:Number})],kr.prototype,"min",void 0);Oc([p({type:Number})],kr.prototype,"max",void 0);Oc([p({type:Number})],kr.prototype,"step",void 0);var ea=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let r=Math.floor(Math.random()*e.length);return e[r]}return e}return console.error("unexpected number of children in match"),null}};var Vf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Dc=1e3,Cn=class extends E{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let i=0;i<t;i++){let n=e.calculate(),s=this.#r(n);s&&r.push(s)}return r}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,n=parseInt(i?.toString()??"",10);return Number.isNaN(n)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(n)}#e(t){return t>Dc?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${Dc} limit, truncating`),Dc):t}#r(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};Vf([p({type:String,attribute:"number-repeats"})],Cn.prototype,"numberRepeats",void 0);var ra=class extends ai{};var li=class extends si{};var ia=class extends li{};var na=class extends oi{};var oa=class extends G{process(){for(let t of[...this.children])t.process()}};var Qp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},di=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),i=Math.pow(10,e-r-1);return Math.round(t*i)/i}};Qp([p({type:String,attribute:"rounding-mode"})],di.prototype,"roundingMode",void 0);Qp([p({type:Number})],di.prototype,"figures",void 0);var sa=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var aa=class extends G{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new $c(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},$c=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var ca=class extends G{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new Nc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(Mt):t!==null?Mt(t):null}},Nc=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>e.value?e.value:e):t}};var la=class extends G{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new Lc(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Lc=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var jf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},kn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#i(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#r(t,t.length);case"popsd":return Math.sqrt(this.#r(t,t.length));case"samplevariance":return t.length<2?null:this.#r(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#r(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,r)=>e+r,0)/t.length}#e(t){let e=[...t].sort((i,n)=>i-n),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}#r(t,e){let r=this.#t(t);return t.reduce((i,n)=>i+Math.pow(n-r,2),0)/e}#i(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};jf([p({type:String})],kn.prototype,"name",void 0);var Ff=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Sn=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return Y.compareSingleValues(i,n,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Ff([p({type:String,attribute:"case-sensitive"})],Sn.prototype,"caseSensitive",void 0);var zf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},En=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let i=e.value.toString(),n=r.value.toString();return this.caseSensitive!=="true"?n.toLowerCase().includes(i.toLowerCase()):n.includes(i)}};zf([p({type:String,attribute:"case-sensitive"})],En.prototype,"caseSensitive",void 0);var da=class extends Bf(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function Bf(o){return class extends o{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=i.calculate();return Number.isNaN(n)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(n)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var ha=class extends E{getResult(){return new Vc(Array.from(this.children)).calculate()}},Vc=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(r=>r.calculate!==void 0).some(r=>r.calculate()===null)?null:this.expressions.map(r=>{let i=r.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((r,i)=>r+i,0)}};var pa=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var ua=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var Xp=[{tag:"qti-and",ctor:ys},{tag:"qti-any-n",ctor:ei},{tag:"qti-base-value",ctor:mn},{tag:"qti-container-size",ctor:qs},{tag:"qti-contains",ctor:xs},{tag:"qti-correct",ctor:ws},{tag:"qti-default",ctor:Cr},{tag:"qti-delete",ctor:Cs},{tag:"qti-divide",ctor:ks},{tag:"qti-duration-gte",ctor:Ss},{tag:"qti-duration-lt",ctor:Es},{tag:"qti-equal",ctor:ri},{tag:"qti-equal-rounded",ctor:fn},{tag:"qti-exit-response",ctor:As},{tag:"qti-exit-test",ctor:_s},{tag:"qti-field-value",ctor:Ts},{tag:"qti-gcd",ctor:Rs},{tag:"qti-gt",ctor:Is},{tag:"qti-gte",ctor:Ms},{tag:"qti-index",ctor:gn},{tag:"qti-inside",ctor:ii},{tag:"qti-integer-divide",ctor:Ps},{tag:"qti-integer-modulus",ctor:Os},{tag:"qti-integer-to-float",ctor:Ds},{tag:"qti-is-null",ctor:$s},{tag:"qti-lcm",ctor:Ns},{tag:"qti-lookup-outcome-value",ctor:ni},{tag:"qti-lt",ctor:Ls},{tag:"qti-lte",ctor:Vs},{tag:"qti-map-response",ctor:vn},{tag:"qti-map-response-point",ctor:bn},{tag:"qti-match",ctor:js},{tag:"qti-math-constant",ctor:yn},{tag:"qti-math-operator",ctor:qn},{tag:"qti-max",ctor:Fs},{tag:"qti-member",ctor:zs},{tag:"qti-min",ctor:Bs},{tag:"qti-multiple",ctor:Us},{tag:"qti-not",ctor:Hs},{tag:"qti-null",ctor:Ws},{tag:"qti-or",ctor:Qs},{tag:"qti-ordered",ctor:Xs},{tag:"qti-outcome-condition",ctor:Js},{tag:"qti-outcome-else",ctor:Ks},{tag:"qti-outcome-else-if",ctor:Ys},{tag:"qti-outcome-if",ctor:ci},{tag:"qti-pattern-match",ctor:xn},{tag:"qti-power",ctor:Zs},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:ta},{tag:"qti-random",ctor:ea},{tag:"qti-random-integer",ctor:kr},{tag:"qti-repeat",ctor:Cn},{tag:"qti-response-condition",ctor:ra},{tag:"qti-response-else",ctor:na},{tag:"qti-response-else-if",ctor:ia},{tag:"qti-response-if",ctor:li},{tag:"qti-response-processing-fragment",ctor:oa},{tag:"qti-round",ctor:sa},{tag:"qti-round-to",ctor:di},{tag:"qti-rule",ctor:G},{tag:"qti-set-correct-response",ctor:aa},{tag:"qti-set-outcome-value",ctor:ca},{tag:"qti-set-template-value",ctor:la},{tag:"qti-stats-operator",ctor:kn},{tag:"qti-string-match",ctor:Sn},{tag:"qti-substring",ctor:En},{tag:"qti-subtract",ctor:da},{tag:"qti-sum",ctor:ha},{tag:"qti-truncate",ctor:pa},{tag:"qti-variable",ctor:ua}];for(let{tag:o,ctor:t}of Xp)customElements.get(o)||customElements.define(o,t);var ye=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Z;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(Z||(Z={}));var jc=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,i)=>{this.toggleCandidateCorrection(i)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""),z(this._internals.states,"answer-key",!0,[]))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let i=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",i)}get correctness(){let r=this.correctResponse;if(!r)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let n=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let c=a.filter(d=>n.includes(d)).length,l=a.filter(d=>!n.includes(d)).length;return c===n.length&&l===0&&a.length===n.length?Z.Correct:c>0&&(c<n.length||l>0)?Z.PartiallyCorrect:Z.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let i=this.nextSibling,n=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==Z.Correct))){if(!n)return;this.parentElement?.removeChild(i);return}if(n)return;let c=this.cloneNode(!0);c.removeAttribute("show-full-correct-response"),c.removeAttribute("show-correct-response"),c.removeAttribute("show-candidate-correction");let l=document.createElement("div");l.classList.add("full-correct-response"),this.isInline?l.classList.add("full-correct-response-inline"):l.classList.add("full-correct-response-block"),l.role="full-correct-response",l.appendChild(c),c.isFullCorrectResponse=!0,this.parentElement?.insertBefore(l,this.nextSibling),await c.updateComplete,c.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){z(this._internals.states,"answer-key-shown",!!(r&&this.correctResponse),["show-correct-response"])}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return ye([p({attribute:"correct-response",reflect:!0,converter:Xt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),ye([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),ye([N("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),ye([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),ye([N("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),ye([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),ye([N("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),ye([T()],t.prototype,"_isFullCorrectResponse",void 0),ye([T()],t.prototype,"_correctResponse",void 0),t};var st=w`
11502
11276
  /* Nothing at all until the item judges this element. */
11503
11277
  [part~='correction'] {
11504
11278
  display: none;
@@ -11531,21 +11305,21 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11531
11305
 
11532
11306
  pointer-events: none;
11533
11307
  }
11534
- `;var Ou=o=>o==="partially-correct"?"candidate-partial":`candidate-${o}`,Dg=["candidate-correct","candidate-incorrect","candidate-partial"],wc=o=>o?`correction ${Ou(o)} correction-${o}`:"correction",Cc=(o,t)=>{for(let e of Dg)B(o,e,!1);t&&B(o,Ou(t),!0)},Pt=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(i){if(this.#t===i)return;let r=this.#t;this.#t=i,Cc(this.internals.states,i),this.requestUpdate("candidateCorrection",r)}get correctionPart(){return wc(this.#t)}}return t};var $g=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},tt=o=>{class t extends xc(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return wc(this._candidateCorrection)}toggleCandidateCorrection(i){this.showCandidateCorrection!==i&&(this.showCandidateCorrection=i),super.toggleCandidateCorrection(i);let r=this._internals,n=null;i&&(this.correctness===et.Correct&&(n="correct"),this.correctness===et.PartiallyCorrect&&(n="partially-correct"),this.correctness===et.Incorrect&&(n="incorrect")),Cc(r.states,n),this._candidateCorrection!==n&&(this._candidateCorrection=n)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return $g([R()],t.prototype,"_candidateCorrection",void 0),t};var $i=o=>{class t extends tt(o){toggleInternalCorrectResponse(i){super.toggleInternalCorrectResponse(i);let r=this.correctResponse,n=r?Array.isArray(r)?r:[r]:[];for(let s of this._choiceElements){let a=i&&n.includes(s.identifier);B(s.internals.states,"answer-key",a,["correct-response"])}}toggleCandidateCorrection(i){super.toggleCandidateCorrection(i);for(let s of this._choiceElements)s.candidateCorrection=null;if(!i||!this.correctResponse)return;let r=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],n=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)n.includes(s.identifier)&&(s.candidateCorrection=r.includes(s.identifier)?"correct":"incorrect")}}return t};var kc=class extends Pt(Be){static{this.styles=[Be.styles,ct]}render(){return v`<div part="control"></div>
11308
+ `;var Gp=o=>o==="partially-correct"?"candidate-partial":`candidate-${o}`,Uf=["candidate-correct","candidate-incorrect","candidate-partial"],Fc=o=>o?`correction ${Gp(o)} correction-${o}`:"correction",zc=(o,t)=>{for(let e of Uf)z(o,e,!1);t&&z(o,Gp(t),!0)},It=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(r){if(this.#t===r)return;let i=this.#t;this.#t=r,zc(this.internals.states,r),this.requestUpdate("candidateCorrection",i)}get correctionPart(){return Fc(this.#t)}}return t};var Hf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},K=o=>{class t extends jc(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return Fc(this._candidateCorrection)}toggleCandidateCorrection(r){this.showCandidateCorrection!==r&&(this.showCandidateCorrection=r),super.toggleCandidateCorrection(r);let i=this._internals,n=null;r&&(this.correctness===Z.Correct&&(n="correct"),this.correctness===Z.PartiallyCorrect&&(n="partially-correct"),this.correctness===Z.Incorrect&&(n="incorrect")),zc(i.states,n),this._candidateCorrection!==n&&(this._candidateCorrection=n)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return Hf([T()],t.prototype,"_candidateCorrection",void 0),t};var Sr=o=>{class t extends K(o){toggleInternalCorrectResponse(r){super.toggleInternalCorrectResponse(r);let i=this.correctResponse,n=i?Array.isArray(i)?i:[i]:[];for(let s of this._choiceElements){let a=r&&n.includes(s.identifier);z(s.internals.states,"answer-key",a,["correct-response"])}}toggleCandidateCorrection(r){super.toggleCandidateCorrection(r);for(let s of this._choiceElements)s.candidateCorrection=null;if(!r||!this.correctResponse)return;let i=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],n=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)n.includes(s.identifier)&&(s.candidateCorrection=i.includes(s.identifier)?"correct":"incorrect")}}return t};var Bc=class extends It($e){static{this.styles=[$e.styles,st]}render(){return v`<div part="control"></div>
11535
11309
  <slot part="label"></slot>
11536
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Ng=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Fa=class extends Pt(wi){constructor(){super(...arguments),this.orderCorrect=null}updated(t){super.updated(t),t.has("orderCorrect")&&(this.orderCorrect==null?this.removeAttribute("data-order-correct"):this.setAttribute("data-order-correct",String(this.orderCorrect)))}};Ng([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],Fa.prototype,"orderCorrect",void 0);var Sc=class extends Pt(Ci){static{this.styles=[Ci.styles,ct]}render(){return v`<div part="control"><div part="control-mark"></div></div>
11310
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Wf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ma=class extends It(hr){constructor(){super(...arguments),this.orderCorrect=null}updated(t){super.updated(t),t.has("orderCorrect")&&(this.orderCorrect==null?this.removeAttribute("data-order-correct"):this.setAttribute("data-order-correct",String(this.orderCorrect)))}};Wf([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],ma.prototype,"orderCorrect",void 0);var Uc=class extends It(pr){static{this.styles=[pr.styles,st]}render(){return v`<div part="control"><div part="control-mark"></div></div>
11537
11311
  <slot part="label"></slot>
11538
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Ec=class extends Pt(zt){static{this.styles=[zt.styles,ct]}render(){return v`
11312
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Hc=class extends It(Nt){static{this.styles=[Nt.styles,st]}render(){return v`
11539
11313
  <div part="control"></div>
11540
11314
  <slot part="label"></slot>
11541
11315
  <span part=${this.correctionPart} aria-hidden="true"></span>
11542
11316
  <div part="drop">
11543
- ${W(this.drags,t=>t.getAttribute("identifier"),t=>t)}
11317
+ ${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
11544
11318
  </div>
11545
- `}};var Ac=class extends Pt(Bt){static{this.styles=[Bt.styles,ct]}render(){return v`<div part="control"><div part="control-mark"></div></div>
11319
+ `}};var Wc=class extends It(Lt){static{this.styles=[Lt.styles,st]}render(){return v`<div part="control"><div part="control-mark"></div></div>
11546
11320
  ${this.marker?v`<div id="label" part="marker">${this.marker}</div>`:P}
11547
11321
  <slot part="label"></slot>
11548
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Du=class extends gt{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let i=this.getRootNode();for(;;){if(i.querySelectorAll(t).forEach(r=>r.shown=e),!(i instanceof ShadowRoot))return;i=i.host.getRootNode()}}};var $u=class extends qe{#t=t=>{let e=t.detail;this.assessmentItem?.showCorrectResponse?.(e),this.updateControlState("item-show-correct-response",e)};#e=t=>{let e=t.detail;this.assessmentItem?.showCandidateCorrection?.(e),this.updateControlState("item-show-candidate-correction",e)};#i=t=>{this.assessmentItem?.showCorrectResponse?.(!1),this.configContext={...this.configContext,correctResponseMode:t.detail}};updateAssessmentItemView(t,e){t?.showCorrectResponse?.(e==="scorer"),this.updateControlState("item-show-correct-response",e==="scorer")}constructor(){super(),this.addEventListener("item-show-correct-response",this.#t),this.addEventListener("item-show-candidate-correction",this.#e),this.addEventListener("item-switch-correct-response-mode",this.#i)}updateControlState(t,e){this.querySelectorAll(t).forEach(i=>i.shown=e)}disconnectedCallback(){this.removeEventListener("item-show-correct-response",this.#t),this.removeEventListener("item-show-candidate-correction",this.#e),this.removeEventListener("item-switch-correct-response-mode",this.#i),super.disconnectedCallback()}};var Nu=class extends bt{#t=t=>{this.activeAssessmentItem?.showCorrectResponse?.(t.detail)};#e=t=>{this.activeAssessmentItem?.showCandidateCorrection?.(t.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#t),this.addEventListener("test-show-candidate-correction",this.#e)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#t),this.removeEventListener("test-show-candidate-correction",this.#e),super.disconnectedCallback()}afterAttemptEnded(t,e,i){if(!t||!e?.showSolution)return;let r=t;r.showCandidateCorrection?.(!0),r.showCorrectResponse?.(i)}},Lu=class extends Le{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}},Vu=class extends fi{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var _c=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Hn=class extends C{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return v`
11322
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Jp=class extends ut{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let r=this.getRootNode();for(;;){if(r.querySelectorAll(t).forEach(i=>i.shown=e),!(r instanceof ShadowRoot))return;r=r.host.getRootNode()}}};var Yp=class extends fe{#t=t=>{let e=t.detail;this.assessmentItem?.showCorrectResponse?.(e),this.updateControlState("item-show-correct-response",e)};#e=t=>{let e=t.detail;this.assessmentItem?.showCandidateCorrection?.(e),this.updateControlState("item-show-candidate-correction",e)};#r=t=>{this.assessmentItem?.showCorrectResponse?.(!1),this.configContext={...this.configContext,correctResponseMode:t.detail}};updateAssessmentItemView(t,e){t?.showCorrectResponse?.(e==="scorer"),this.updateControlState("item-show-correct-response",e==="scorer")}constructor(){super(),this.addEventListener("item-show-correct-response",this.#t),this.addEventListener("item-show-candidate-correction",this.#e),this.addEventListener("item-switch-correct-response-mode",this.#r)}updateControlState(t,e){this.querySelectorAll(t).forEach(r=>r.shown=e)}disconnectedCallback(){this.removeEventListener("item-show-correct-response",this.#t),this.removeEventListener("item-show-candidate-correction",this.#e),this.removeEventListener("item-switch-correct-response-mode",this.#r),super.disconnectedCallback()}};var Kp=class extends mt{#t=t=>{this.activeAssessmentItem?.showCorrectResponse?.(t.detail)};#e=t=>{this.activeAssessmentItem?.showCandidateCorrection?.(t.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#t),this.addEventListener("test-show-candidate-correction",this.#e)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#t),this.removeEventListener("test-show-candidate-correction",this.#e),super.disconnectedCallback()}afterAttemptEnded(t,e,r){if(!t||!e?.showSolution)return;let i=t;i.showCandidateCorrection?.(!0),i.showCorrectResponse?.(r)}},Zp=class extends Ie{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}};var Qc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},An=class extends S{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return v`
11549
11323
  <label part="label" for="modeSelect">${this.label}</label>
11550
11324
  <select
11551
11325
  part="select"
@@ -11556,12 +11330,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11556
11330
  ${this._options[t]}
11557
11331
  </option>`)}
11558
11332
  </select>
11559
- `}};_c([I({context:wt,subscribe:!0})],Hn.prototype,"itemContext",void 0);_c([p({type:String})],Hn.prototype,"label",void 0);_c([R()],Hn.prototype,"_options",void 0);var kr=w`
11333
+ `}};Qc([R({context:yt,subscribe:!0})],An.prototype,"itemContext",void 0);Qc([p({type:String})],An.prototype,"label",void 0);Qc([T()],An.prototype,"_options",void 0);var hi=w`
11560
11334
  display: inline-flex;
11561
11335
  cursor: pointer;
11562
11336
  border-radius: 0.25rem;
11563
11337
  user-select: none;
11564
- `,ju=w`
11338
+ `,tu=w`
11565
11339
  display: flex;
11566
11340
  flex: 1 1 auto;
11567
11341
  align-items: center;
@@ -11569,50 +11343,50 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11569
11343
  padding: 0.5rem 1rem;
11570
11344
  border-radius: 0.25rem;
11571
11345
  user-select: none;
11572
- `,Sr=w`
11346
+ `,pi=w`
11573
11347
  background-color: lightgray;
11574
- ${ju};
11575
- `,Er=w`
11348
+ ${tu};
11349
+ `,ui=w`
11576
11350
  cursor: not-allowed;
11577
11351
  opacity: 0.8;
11578
- `,zU=w`
11579
- ${ju};
11352
+ `,wz=w`
11353
+ ${tu};
11580
11354
  border: 1px solid gray;
11581
- `;var Ar=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},Ze=class extends C{static{this.styles=w`
11355
+ `;var mi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},We=class extends S{static{this.styles=w`
11582
11356
  :host {
11583
- ${kr};
11357
+ ${hi};
11584
11358
  }
11585
11359
  div {
11586
- ${Sr};
11360
+ ${pi};
11587
11361
  }
11588
11362
  :host([disabled]) {
11589
- ${Er};
11363
+ ${ui};
11590
11364
  }
11591
- `}#t;#e;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCandidateCorrectionText="Show candidate correction",this.hideCandidateCorrectionText="Hide candidate correction",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(i=>i.correctResponse),e=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#i(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))}#r(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCandidateCorrectionText:this.showCandidateCorrectionText}render(){return v` <div @click="${this.#i}">${this.#r()}</div> `}};Ar([I({context:_e,subscribe:!0})],Ze.prototype,"computedContext",void 0);Ar([p({type:Boolean,reflect:!0})],Ze.prototype,"shown",void 0);Ar([p({type:Boolean,reflect:!0})],Ze.prototype,"disabled",void 0);Ar([p({type:String})],Ze.prototype,"showCandidateCorrectionText",void 0);Ar([p({type:String})],Ze.prototype,"hideCandidateCorrectionText",void 0);Ar([p({type:String})],Ze.prototype,"noCorrectResponseText",void 0);var _r=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ti=class extends C{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}static{this.styles=w`
11365
+ `}#t;#e;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCandidateCorrectionText="Show candidate correction",this.hideCandidateCorrectionText="Hide candidate correction",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCandidateCorrectionText:this.showCandidateCorrectionText}render(){return v` <div @click="${this.#r}">${this.#i()}</div> `}};mi([R({context:we,subscribe:!0})],We.prototype,"computedContext",void 0);mi([p({type:Boolean,reflect:!0})],We.prototype,"shown",void 0);mi([p({type:Boolean,reflect:!0})],We.prototype,"disabled",void 0);mi([p({type:String})],We.prototype,"showCandidateCorrectionText",void 0);mi([p({type:String})],We.prototype,"hideCandidateCorrectionText",void 0);mi([p({type:String})],We.prototype,"noCorrectResponseText",void 0);var fi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Qe=class extends S{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}static{this.styles=w`
11592
11366
  :host {
11593
- ${kr};
11367
+ ${hi};
11594
11368
  }
11595
11369
  div {
11596
- ${Sr};
11370
+ ${pi};
11597
11371
  }
11598
11372
  :host([disabled]) {
11599
- ${Er};
11373
+ ${ui};
11600
11374
  }
11601
- `}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(i=>i.correctResponse),e=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#i(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))}#r(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v` <div @click="${this.#i}">${this.#r()}</div> `}};_r([I({context:_e,subscribe:!0})],ti.prototype,"computedContext",void 0);_r([p({type:Boolean,reflect:!0})],ti.prototype,"shown",void 0);_r([p({type:Boolean,reflect:!0})],ti.prototype,"disabled",void 0);_r([p({type:String})],ti.prototype,"showCorrectText",void 0);_r([p({type:String})],ti.prototype,"hideCorrectText",void 0);_r([p({type:String})],ti.prototype,"noCorrectResponseText",void 0);var Rr=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},ei=class extends C{static{this.styles=w`
11375
+ `}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v` <div @click="${this.#r}">${this.#i()}</div> `}};fi([R({context:we,subscribe:!0})],Qe.prototype,"computedContext",void 0);fi([p({type:Boolean,reflect:!0})],Qe.prototype,"shown",void 0);fi([p({type:Boolean,reflect:!0})],Qe.prototype,"disabled",void 0);fi([p({type:String})],Qe.prototype,"showCorrectText",void 0);fi([p({type:String})],Qe.prototype,"hideCorrectText",void 0);fi([p({type:String})],Qe.prototype,"noCorrectResponseText",void 0);var gi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Xe=class extends S{static{this.styles=w`
11602
11376
  :host {
11603
- ${kr};
11377
+ ${hi};
11604
11378
  }
11605
11379
  div {
11606
- ${Sr};
11380
+ ${pi};
11607
11381
  }
11608
11382
  :host(:focus-visible) {
11609
11383
  outline: 2px solid currentColor;
11610
11384
  outline-offset: 2px;
11611
11385
  }
11612
11386
  :host([disabled]) {
11613
- ${Er};
11387
+ ${ui};
11614
11388
  }
11615
- `}#t;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=this.attachInternals(),this.#t.role="button",this.addEventListener("click",()=>this.#i()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#i())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=0)}#e;willUpdate(t){let e=this.computedContext?.testParts.flatMap(i=>i.sections.flatMap(r=>r.items)).find(i=>i.active);if(this.#e!==e&&(this.shown=!1,this.#e=e),e){let i=!!e?.variables?.some(n=>n.correctResponse),r=!!e?.variables?.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.disabled=!i&&!r}else this.disabled=!0;this.#t.ariaDisabled=String(this.disabled),this.#t.ariaPressed=String(this.shown)}#i(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#r(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v`${this.#r()}`}};Rr([I({context:z,subscribe:!0})],ei.prototype,"computedContext",void 0);Rr([p({type:Boolean,reflect:!0})],ei.prototype,"shown",void 0);Rr([p({type:Boolean,reflect:!0})],ei.prototype,"disabled",void 0);Rr([p({type:String})],ei.prototype,"showCorrectText",void 0);Rr([p({type:String})],ei.prototype,"hideCorrectText",void 0);Rr([p({type:String})],ei.prototype,"noCorrectResponseText",void 0);var se=o=>{class t extends tt(o){toggleInternalCorrectResponse(i){this.showFullCorrectResponse||this.toggleFullCorrectResponse(i)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var Ic=class extends se(Ai){};var Tc=class extends $i(_i){};var Lg=function(o,t,e,i){var r=arguments.length,n=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,i);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(r<3?s(n):r>3?s(t,e,n):s(t,e))||n);return r>3&&n&&Object.defineProperty(t,e,n),n},za=class extends Pt(J){static{this.styles=[J.styles,ct,w`
11389
+ `}#t;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=this.attachInternals(),this.#t.role="button",this.addEventListener("click",()=>this.#r()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#r())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=0)}#e;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(i=>i.items)).find(r=>r.active);if(this.#e!==e?.identifier&&(this.shown=!1,this.#e=e?.identifier),e){let r=!!e?.variables?.some(n=>n.correctResponse),i=!!e?.variables?.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!i}else this.disabled=!0;this.#t.ariaDisabled=String(this.disabled),this.#t.ariaPressed=String(this.shown)}#r(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v`<div part="button">${this.#i()}</div>`}};gi([R({context:ct,subscribe:!0})],Xe.prototype,"computedContext",void 0);gi([p({type:Boolean,reflect:!0})],Xe.prototype,"shown",void 0);gi([p({type:Boolean,reflect:!0})],Xe.prototype,"disabled",void 0);gi([p({type:String})],Xe.prototype,"showCorrectText",void 0);gi([p({type:String})],Xe.prototype,"hideCorrectText",void 0);gi([p({type:String})],Xe.prototype,"noCorrectResponseText",void 0);var ee=o=>{class t extends K(o){toggleInternalCorrectResponse(r){this.showFullCorrectResponse||this.toggleFullCorrectResponse(r)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var Gc=class extends ee(gr){};var Jc=class extends Sr(br){};var Qf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fa=class extends It(Q){static{this.styles=[Q.styles,st,w`
11616
11390
  /*
11617
11391
  * Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
11618
11392
  * is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
@@ -11676,7 +11450,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11676
11450
  }
11677
11451
  `]}render(){return v`${this.renderPrompt()}${this.renderTextarea()}
11678
11452
  <span part=${this.correctionPart} aria-hidden="true"></span>
11679
- ${this.renderValidationMessage()}`}};Lg([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],za.prototype,"candidateCorrection",void 0);var Ba=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[i,r]=e.split(" ");return{source:i,target:r}}):[];var Mc=class extends se(dr){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Ba(this.correctResponse);for(let i of this.querySelectorAll("qti-gap")){let r=i.getAttribute("identifier"),n=i.drags;for(let s of n)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===r)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var Pc=class extends tt(qt){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,i=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",i)}renderSupplementalLines(){return W(this.#t,t=>t,t=>Ur`
11453
+ ${this.renderValidationMessage()}`}};Qf([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],fa.prototype,"candidateCorrection",void 0);var ga=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[r,i]=e.split(" ");return{source:r,target:i}}):[];var Yc=class extends ee(Yr){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=ga(this.correctResponse);for(let r of this.querySelectorAll("qti-gap")){let i=r.getAttribute("identifier"),n=r.drags;for(let s of n)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===i)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var Kc=class extends K(bt){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",r)}renderSupplementalLines(){return H(this.#t,t=>t,t=>Ii`
11680
11454
  <line
11681
11455
  part="line answer-key correct-line"
11682
11456
  x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
@@ -11687,7 +11461,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11687
11461
  stroke-width="3"
11688
11462
  stroke-dasharray="5,5"
11689
11463
  />
11690
- `)}};var Oc=class extends se(Ii){};var Dc=class extends tt(Je){resolvePinColor(t){let{internals:e}=t;return Jr(e.states,"candidate-incorrect")?"var(--qti-incorrect)":Jr(e.states,"candidate-correct")?"var(--qti-correct)":super.resolvePinColor(t)}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,i=e?Array.isArray(e)?e:[e]:[];for(let r of this._choiceElements){let n=i.indexOf(r.identifier);r.orderCorrect=t&&n>=0?n+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,i=e?Array.isArray(e)?e:[e]:[];for(let r of this._choiceElements)r.candidateCorrection=null,t&&r.order!=null&&(r.candidateCorrection=i[r.order-1]===r.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var $c=class extends $i(hr){};var Nc=class extends $i(pr){};var Lc=class extends tt(nt){static get styles(){return[nt.styles,ct,w`
11464
+ `)}};var Zc=class extends ee(yr){};var tl=class extends K(Be){resolvePinColor(t){let{internals:e}=t;return Ni(e.states,"candidate-incorrect")?"var(--qti-incorrect)":Ni(e.states,"candidate-correct")?"var(--qti-correct)":super.resolvePinColor(t)}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements){let n=r.indexOf(i.identifier);i.orderCorrect=t&&n>=0?n+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements)i.candidateCorrection=null,t&&i.order!=null&&(i.candidateCorrection=r[i.order-1]===i.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var el=class extends Sr(Kr){};var rl=class extends Sr(Zr){};var il=class extends K(rt){static get styles(){return[rt.styles,st,w`
11691
11465
  /*
11692
11466
  * Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
11693
11467
  * badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
@@ -11706,20 +11480,20 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11706
11480
  `]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return v`
11707
11481
  ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
11708
11482
  <span part=${this.correctionPart} aria-hidden="true"></span>
11709
- `}};var Vc=class extends se(oe){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Ba(this.correctResponse);this.#t=t?new Set(e.map(i=>`${i.source} ${i.target}`)):new Set;for(let i of this.targetChoices){let r=i.getAttribute("identifier"),n=i.drags;for(let s of n)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${r}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"candidate-correct correct":"candidate-incorrect incorrect"}};function Vg(o){if(o.length===0)return new Set;let t=new Array(o.length).fill(1),e=new Array(o.length).fill(-1);for(let n=0;n<o.length;n++)for(let s=0;s<n;s++)o[s]<o[n]&&t[s]+1>t[n]&&(t[n]=t[s]+1,e[n]=s);let i=0;for(let n=1;n<o.length;n++)t[n]>t[i]&&(i=n);let r=new Set;for(let n=i;n!==-1;n=e[n])r.add(n);return r}function Fu(o,t){let e=new Map(t.map((a,l)=>[a,l])),i=o.filter(a=>e.has(a)),r=i.map(a=>e.get(a)),n=Vg(r),s=new Set;return n.forEach(a=>s.add(i[a])),s}var jc=class extends se(Ye){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let i=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(c=>this.chipsIn(c));for(let c of i)c.candidateCorrection=null;if(!t)return;let r=this.correctResponse,s=(r?Array.isArray(r)?r:[r]:[]).map((c,d)=>{let[h,f]=c.split(" "),m=f?.startsWith("droplist")?parseInt(f.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(m)?d:m}}).filter(c=>c.identifier).sort((c,d)=>c.dropIndex-d.dropIndex).map(c=>c.identifier);if(s.length===0)return;let a=i.map(c=>({choice:c,identifier:c.getAttribute("identifier")})).filter(c=>!!c.identifier),l=Fu(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var Fc=class extends tt(Y){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,i=e?.correctResponse??this.correctResponse;this.correctResponse=t?i:e?.cardinality==="single"?"":[];let r=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${r}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let n=document.createElement("div");n.id=r,n.className="pci-correct-response-container",Object.assign(n.style,{position:"relative",marginTop:"20px",border:"2px solid green",padding:"16px",borderRadius:"4px",backgroundColor:"rgba(0, 128, 0, 0.05)"});let s=document.createElement("div");s.textContent="Correct Response:",Object.assign(s.style,{fontWeight:"bold",marginBottom:"10px",color:"green"}),n.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let l=this.responseIdentifier;a.responseIdentifier=`${l}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let c=this.correctResponse,d=e?.cardinality??(Array.isArray(c)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:c}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(c,d,h);a.sendMessageToIframe("setBoundTo",{[l]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",n.append(a),this.after(n)}};var zc=class extends tt(pt){#t=[];#e=[];static{this.styles=[pt.styles,w`
11483
+ `}};var nl=class extends ee(te){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=ga(this.correctResponse);this.#t=t?new Set(e.map(r=>`${r.source} ${r.target}`)):new Set;for(let r of this.targetChoices){let i=r.getAttribute("identifier"),n=r.drags;for(let s of n)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${i}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"candidate-correct correct":"candidate-incorrect incorrect"}};function Xf(o){if(o.length===0)return new Set;let t=new Array(o.length).fill(1),e=new Array(o.length).fill(-1);for(let n=0;n<o.length;n++)for(let s=0;s<n;s++)o[s]<o[n]&&t[s]+1>t[n]&&(t[n]=t[s]+1,e[n]=s);let r=0;for(let n=1;n<o.length;n++)t[n]>t[r]&&(r=n);let i=new Set;for(let n=r;n!==-1;n=e[n])i.add(n);return i}function eu(o,t){let e=new Map(t.map((a,c)=>[a,c])),r=o.filter(a=>e.has(a)),i=r.map(a=>e.get(a)),n=Xf(i),s=new Set;return n.forEach(a=>s.add(r[a])),s}var ol=class extends ee(Ue){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let r=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(l=>this.chipsIn(l));for(let l of r)l.candidateCorrection=null;if(!t)return;let i=this.correctResponse,s=(i?Array.isArray(i)?i:[i]:[]).map((l,d)=>{let[h,f]=l.split(" "),m=f?.startsWith("droplist")?parseInt(f.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(m)?d:m}}).filter(l=>l.identifier).sort((l,d)=>l.dropIndex-d.dropIndex).map(l=>l.identifier);if(s.length===0)return;let a=r.map(l=>({choice:l,identifier:l.getAttribute("identifier")})).filter(l=>!!l.identifier),c=eu(a.map(l=>l.identifier),s);for(let{choice:l,identifier:d}of a)l.candidateCorrection=c.has(d)?"correct":"incorrect"}};var sl=class extends K(X){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,r=e?.correctResponse??this.correctResponse;this.correctResponse=t?r:e?.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${i}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let n=document.createElement("div");n.id=i,n.className="pci-correct-response-container",Object.assign(n.style,{position:"relative",marginTop:"20px",border:"2px solid green",padding:"16px",borderRadius:"4px",backgroundColor:"rgba(0, 128, 0, 0.05)"});let s=document.createElement("div");s.textContent="Correct Response:",Object.assign(s.style,{fontWeight:"bold",marginBottom:"10px",color:"green"}),n.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let c=this.responseIdentifier;a.responseIdentifier=`${c}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let l=this.correctResponse,d=e?.cardinality??(Array.isArray(l)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:l}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(l,d,h);a.sendMessageToIframe("setBoundTo",{[c]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",n.append(a),this.after(n)}};var al=class extends K(lt){#t=[];#e=[];static{this.styles=[lt.styles,w`
11710
11484
  [part~='candidate-correct'] {
11711
11485
  --qti-select-point-marker-color: var(--qti-correct);
11712
11486
  }
11713
11487
  [part~='candidate-incorrect'] {
11714
11488
  --qti-select-point-marker-color: var(--qti-incorrect);
11715
11489
  }
11716
- `]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let i=this._effectiveAreaEntries,r=this.responseVariable?.baseType,n=this.correctResponse;for(let s of this.responsePoints){let a=i.some(l=>Z.isPointInArea(`${s.x} ${s.y}`,`${l.shape},${l.coords}`,r));!i.length&&n&&(a=(Array.isArray(n)?n:[n]).some(c=>{let[d,h]=c.split(" ").map(Number);return Number.isFinite(d)&&Number.isFinite(h)&&Math.hypot(s.x-d,s.y-h)<=10})),this.#e.push(a)}this.requestUpdate("responseCorrection",e)}toggleInternalCorrectResponse(t){if(super.toggleInternalCorrectResponse(t),!t){let r=this.#t;this.#t=[],this.requestUpdate("correctAreas",r);return}let e=this._effectiveAreaEntries;if(!e.length){let r=this.correctResponse,n=r?Array.isArray(r)?r:[r]:[];if(n.some(s=>s.split(" ").length<2)){console.error("No valid correct responses found.");return}e=n.map(s=>({shape:"circle",coords:`${s.split(" ").join(",")},10`,defaultValue:1,mappedValue:1}))}let i=this.#t;this.#t=e.map(r=>({shape:r.shape,coords:r.coords})),this.requestUpdate("correctAreas",i)}pointPart(t,e){let i=this.#e[e];return i===void 0?"point":i?"point candidate-correct correct":"point candidate-incorrect incorrect"}renderSupplementalLayer(){return W(this.#t,t=>`${t.shape}:${t.coords}`,(t,e)=>v`<div
11717
- style=${Ti({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
11490
+ `]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let r=this._effectiveAreaEntries,i=this.responseVariable?.baseType,n=this.correctResponse;for(let s of this.responsePoints){let a=r.some(c=>Y.isPointInArea(`${s.x} ${s.y}`,`${c.shape},${c.coords}`,i));!r.length&&n&&(a=(Array.isArray(n)?n:[n]).some(l=>{let[d,h]=l.split(" ").map(Number);return Number.isFinite(d)&&Number.isFinite(h)&&Math.hypot(s.x-d,s.y-h)<=10})),this.#e.push(a)}this.requestUpdate("responseCorrection",e)}toggleInternalCorrectResponse(t){if(super.toggleInternalCorrectResponse(t),!t){let i=this.#t;this.#t=[],this.requestUpdate("correctAreas",i);return}let e=this._effectiveAreaEntries;if(!e.length){let i=this.correctResponse,n=i?Array.isArray(i)?i:[i]:[];if(n.some(s=>s.split(" ").length<2)){console.error("No valid correct responses found.");return}e=n.map(s=>({shape:"circle",coords:`${s.split(" ").join(",")},10`,defaultValue:1,mappedValue:1}))}let r=this.#t;this.#t=e.map(i=>({shape:i.shape,coords:i.coords})),this.requestUpdate("correctAreas",r)}pointPart(t,e){let r=this.#e[e];return r===void 0?"point":r?"point candidate-correct correct":"point candidate-incorrect incorrect"}renderSupplementalLayer(){return H(this.#t,t=>`${t.shape}:${t.coords}`,(t,e)=>v`<div
11491
+ style=${qr({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
11718
11492
  data-correction-area
11719
11493
  data-coord=${t.coords}
11720
11494
  data-shape=${t.shape}
11721
11495
  alt=${`correct-response-${e+1}`}
11722
- ></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var Bc=class extends tt(Tt){#t=null;static{this.styles=[Tt.styles,w`
11496
+ ></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var cl=class extends K(Tt){#t=null;static{this.styles=[Tt.styles,w`
11723
11497
  [part~='knob'][part~='answer-key'] {
11724
11498
  background-color: var(--qti-correct-light);
11725
11499
  border: 2px solid var(--qti-correct);
@@ -11732,9 +11506,9 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11732
11506
  border-radius: 9999px;
11733
11507
  left: var(--value-percentage-correct);
11734
11508
  }
11735
- `]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,i=Array.isArray(e)?e[0]:e,r=t&&i?parseFloat(i):NaN,n=this.#t;if(this.#t=Number.isFinite(r)?r:null,this.#t!==null){let s=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}else this.style.removeProperty("--value-percentage-correct");this.requestUpdate("correctResponseNumber",n)}renderRailSupplement(){return this.#t===null?P:v`<div id="knob-correct" part="knob answer-key knob-correct">
11509
+ `]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=Array.isArray(e)?e[0]:e,i=t&&r?parseFloat(r):NaN,n=this.#t;if(this.#t=Number.isFinite(i)?i:null,this.#t!==null){let s=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}else this.style.removeProperty("--value-percentage-correct");this.requestUpdate("correctResponseNumber",n)}renderRailSupplement(){return this.#t===null?P:v`<div id="knob-correct" part="knob answer-key knob-correct">
11736
11510
  <div id="value" part="value">${this.#t}</div>
11737
- </div>`}};var Uc=class extends tt(ut){static{this.styles=[ut.styles,ct,w`
11511
+ </div>`}};var ll=class extends K(dt){static{this.styles=[dt.styles,st,w`
11738
11512
  /*
11739
11513
  * The trailing inset only — size and leading gap come from the shared sheet.
11740
11514
  *
@@ -11754,11 +11528,11 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11754
11528
  position: relative;
11755
11529
  anchor-name: --text-entry-host, --qti-correction-anchor;
11756
11530
  }
11757
- `]}get correctness(){let t=this.responseVariable;if(!t)return super.correctness;if(t.value===null)return et.Incorrect;if(t.mapping){let e=t.mapping.mapEntries.reduce((i,r)=>Math.max(r.mappedValue,i),0);for(let i of t.mapping.mapEntries){let r=i.mapKey,n=t.value;if(i.caseSensitive||(r=r.toLowerCase(),n=n.toLowerCase()),r===n)return i.mappedValue===e?et.Correct:i.mappedValue<=(t.mapping.defaultValue||0)?et.Incorrect:et.PartiallyCorrect}}return t.correctResponse===t.value?et.Correct:et.Incorrect}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}render(){return v`
11531
+ `]}get correctness(){let t=this.responseVariable;if(!t)return super.correctness;if(t.value===null)return Z.Incorrect;if(t.mapping){let e=t.mapping.mapEntries.reduce((r,i)=>Math.max(i.mappedValue,r),0);for(let r of t.mapping.mapEntries){let i=r.mapKey,n=t.value;if(r.caseSensitive||(i=i.toLowerCase(),n=n.toLowerCase()),i===n)return r.mappedValue===e?Z.Correct:r.mappedValue<=(t.mapping.defaultValue||0)?Z.Incorrect:Z.PartiallyCorrect}}return t.correctResponse===t.value?Z.Correct:Z.Incorrect}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}render(){return v`
11758
11532
  ${this.renderAnswer()} ${this.renderInput()}
11759
11533
  <span part=${this.correctionPart} aria-hidden="true"></span>
11760
11534
  ${this.renderValidationMessage()}
11761
- `}};export{tt as CandidateCorrectionMixin,$i as ChoiceCorrectionMixin,xc as CorrectResponseMixin,et as Correctness,fl as CustomStateSetShim,gl as INITIAL_SESSION_CONTEXT,bl as INITIAL_TEST_CONTEXT,D as Interaction,ql as IsNullOrUndefined,Ft as ItemContainer,Hn as ItemCorrectResponseMode,wn as ItemPrintVariables,Ze as ItemShowCandidateCorrection,ti as ItemShowCorrectResponse,Qh as ItemViewMixin,jd as PUBLIC_ITEM_EVENTS,jo as QTI_TEST_STATE_VERSION,Ws as QtiAnd,mr as QtiAnyN,gt as QtiAssessmentItem,Du as QtiAssessmentItemCorrection,St as QtiAssessmentItemRef,Et as QtiAssessmentSection,xo as QtiAssessmentStimulus,Zi as QtiAssessmentStimulusRef,Pl as QtiAssessmentStimulusRefConnectedEvent,ci as QtiAssessmentTest,sr as QtiAssociableHotspot,Ai as QtiAssociateInteraction,Ic as QtiAssociateInteractionCorrection,Mn as QtiBaseValue,ue as QtiBranchRule,_i as QtiChoiceInteraction,Tc as QtiChoiceInteractionCorrection,Eo as QtiCompanionMaterialsInfo,Yt as QtiConditionExpression,Qs as QtiContainerSize,Xs as QtiContains,nn as QtiContentBody,tr as QtiContextDeclaration,Gs as QtiCorrect,xe as QtiCustomInteraction,on as QtiCustomOperator,Oi as QtiDefault,Js as QtiDelete,Ys as QtiDivide,Ks as QtiDurationGte,Zs as QtiDurationLt,we as QtiEndAttemptInteraction,fr as QtiEqual,Pn as QtiEqualRounded,ta as QtiExitResponse,Bi as QtiExitResponseSignal,ea as QtiExitTest,Ui as QtiExitTestSignal,E as QtiExpression,J as QtiExtendedTextInteraction,za as QtiExtendedTextInteractionCorrection,ft as QtiFeedback,Ao as QtiFeedbackBlock,_o as QtiFeedbackInline,ia as QtiFieldValue,qi as QtiGap,Cn as QtiGapImg,dr as QtiGapMatchInteraction,Mc as QtiGapMatchInteractionCorrection,Be as QtiGapText,kc as QtiGapTextCorrection,ra as QtiGcd,qt as QtiGraphicAssociateInteraction,Pc as QtiGraphicAssociateInteractionCorrection,Ii as QtiGraphicGapMatchInteraction,Oc as QtiGraphicGapMatchInteractionCorrection,Je as QtiGraphicOrderInteraction,Dc as QtiGraphicOrderInteractionCorrection,na as QtiGt,oa as QtiGte,wi as QtiHotspotChoice,Fa as QtiHotspotChoiceCorrection,hr as QtiHotspotInteraction,$c as QtiHotspotInteractionCorrection,Ci as QtiHottext,Sc as QtiHottextCorrection,pr as QtiHottextInteraction,Nc as QtiHottextInteractionCorrection,On as QtiIndex,kn as QtiInlineChoice,nt as QtiInlineChoiceInteraction,Lc as QtiInlineChoiceInteractionCorrection,gr as QtiInside,sa as QtiIntegerDivide,aa as QtiIntegerModulus,la as QtiIntegerToFloat,ca as QtiIsNull,qe as QtiItem,Ro as QtiItemBody,$u as QtiItemCorrection,Nt as QtiItemSessionControl,da as QtiLcm,br as QtiLookupOutcomeValue,ha as QtiLt,pa as QtiLte,$n as QtiMapResponse,Dn as QtiMapResponsePoint,ua as QtiMatch,oe as QtiMatchInteraction,Vc as QtiMatchInteractionCorrection,Nn as QtiMathConstant,Ln as QtiMathOperator,ma as QtiMax,Ps as QtiMediaInteraction,fa as QtiMember,ga as QtiMin,er as QtiModalFeedback,ba as QtiMultiple,va as QtiNot,ya as QtiNull,tn as QtiNumberPresented,vo as QtiNumberSelected,qa as QtiOr,Ye as QtiOrderInteraction,jc as QtiOrderInteractionCorrection,xa as QtiOrdered,Ca as QtiOutcomeCondition,fe as QtiOutcomeDeclaration,Sa as QtiOutcomeElse,ka as QtiOutcomeElseIf,xr as QtiOutcomeIf,qo as QtiOutcomeProcessing,_l as QtiOutcomeProcessingProcessor,Vn as QtiPatternMatch,Y as QtiPortableCustomInteraction,Fc as QtiPortableCustomInteractionCorrection,It as QtiPositionObjectInteraction,Vs as QtiPositionObjectStage,Ea as QtiPower,yo as QtiPreCondition,xt as QtiPrintedVariable,Aa as QtiProduct,ss as QtiPrompt,_a as QtiRandom,Di as QtiRandomInteger,Fn as QtiRepeat,Ra as QtiResponseCondition,Pe as QtiResponseDeclaration,Ta as QtiResponseElse,Ia as QtiResponseElseIf,wr as QtiResponseIf,To as QtiResponseProcessing,Ma as QtiResponseProcessingFragment,Pa as QtiRound,Cr as QtiRoundTo,ge as QtiRubricBlock,$d as QtiRuleElement,pt as QtiSelectPointInteraction,zc as QtiSelectPointInteractionCorrection,Oa as QtiSetCorrectResponse,bc as QtiSetCorrectResponseRule,Da as QtiSetOutcomeValue,vc as QtiSetOutcomeValueRule,$a as QtiSetTemplateValue,yc as QtiSetTemplateValueRule,zt as QtiSimpleAssociableChoice,Ec as QtiSimpleAssociableChoiceCorrection,Bt as QtiSimpleChoice,Ac as QtiSimpleChoiceCorrection,Tt as QtiSliderInteraction,Bc as QtiSliderInteractionCorrection,zn as QtiStatsOperator,Bn as QtiStringMatch,Oo as QtiStylesheet,Un as QtiSubstring,Na as QtiSubtract,La as QtiSum,qc as QtiSumExpression,Do as QtiTemplateConstraint,be as QtiTemplateDeclaration,$o as QtiTemplateProcessing,Le as QtiTest,Lu as QtiTestCorrection,dn as QtiTestFeedback,Ne as QtiTestPart,hn as QtiTestVariables,Dl as QtiTestVariablesExpression,ut as QtiTextEntryInteraction,Uc as QtiTextEntryInteractionCorrection,Va as QtiTruncate,Us as QtiUploadInteraction,ja as QtiVariable,zi as QtiVariableDeclaration,Pd as STATE_ALIASES,Z as ScoringHelper,je as TestBookmark,fi as TestCheckItem,Vu as TestCheckItemCorrection,At as TestContainer,ye as TestEndAttempt,mn as TestItemLink,vi as TestItemToSpeech,bt as TestNavigation,Nu as TestNavigationCorrection,ui as TestNext,mi as TestPrev,gn as TestPrintContext,vn as TestPrintState,bn as TestPrintVariables,gi as TestScoringButtons,nr as TestScoringFeedback,fn as TestSectionLink,ei as TestShowCorrectResponse,bi as TestStamp,Go as TestSubmit,ns as TestTtsNext,ts as TestTtsPause,os as TestTtsPick,xn as TestTtsPlay,rs as TestTtsPrev,es as TestTtsResume,is as TestTtsStop,te as TestView,qn as TestViewToggle,gy as asSeed,Xl as bookmarkedItems,M as boxSizing,km as classifyCustomStateSupport,z as computedContext,_e as computedItemContext,wt as configContext,Dt as convertNumberToUniversalFormat,ct as correctionPart,Qy as decimalSeparator,Cl as dispatchDeclared,kt as dispatchPublic,Jt as dropRegion,Nd as getCustomOperator,gL as getItemByUri,fL as getManifestInfo,Jr as hasState,go as inferRecordFieldBaseType,hg as inlineScriptText,pg as inlineStyleText,Td as installCustomStateSetFallback,ji as interactionContext,$t as isRecordValue,Em as isSeed,F as itemContext,Md as itemContextVariables,iq as iterResponseValues,kl as listenDeclared,Fd as listenPublic,rq as parsePair,oq as parsePoint,Kr as parseResponseAttribute,Hh as pluginElements,jh as pluginState,bg as qtiAndMixin,Ct as qtiContext,ku as qtiInteractionElements,Og as qtiSubtractMixin,Zt as qtiTransformItem,nh as qtiTransformManifest,Ki as qtiTransformTest,Zr as readRecordFieldValues,hq as registerCustomOperator,fo as removeDoubleSlashes,Kt as responseAttributeConverter,nq as serializePair,sq as serializePoint,li as serializeResponseAttribute,Re as sessionContext,B as setState,st as testContext,Uh as ttsElements,pq as unregisterCustomOperator,H as validationMessage};
11535
+ `}};export{K as CandidateCorrectionMixin,Sr as ChoiceCorrectionMixin,jc as CorrectResponseMixin,Z as Correctness,za as CustomStateSetShim,Ba as INITIAL_SESSION_CONTEXT,Ua as INITIAL_TEST_CONTEXT,D as Interaction,Qa as IsNullOrUndefined,$t as ItemContainer,An as ItemCorrectResponseMode,tn as ItemPrintVariables,We as ItemShowCandidateCorrection,Qe as ItemShowCorrectResponse,ch as ItemViewMixin,sd as PUBLIC_ITEM_EVENTS,Co as QTI_TEST_STATE_VERSION,ys as QtiAnd,ei as QtiAnyN,ut as QtiAssessmentItem,Jp as QtiAssessmentItemCorrection,wt as QtiAssessmentItemRef,Ct as QtiAssessmentSection,io as QtiAssessmentStimulus,zr as QtiAssessmentStimulusRef,sc as QtiAssessmentStimulusRefConnectedEvent,rr as QtiAssessmentTest,Qr as QtiAssociableHotspot,gr as QtiAssociateInteraction,Gc as QtiAssociateInteractionCorrection,mn as QtiBaseValue,le as QtiBranchRule,br as QtiChoiceInteraction,Jc as QtiChoiceInteractionCorrection,co as QtiCompanionMaterialsInfo,Qt as QtiConditionExpression,qs as QtiContainerSize,xs as QtiContains,Ui as QtiContentBody,Br as QtiContextDeclaration,ws as QtiCorrect,ge as QtiCustomInteraction,Hi as QtiCustomOperator,Cr as QtiDefault,Cs as QtiDelete,ks as QtiDivide,Ss as QtiDurationGte,Es as QtiDurationLt,be as QtiEndAttemptInteraction,ri as QtiEqual,fn as QtiEqualRounded,As as QtiExitResponse,Mr as QtiExitResponseSignal,_s as QtiExitTest,Pr as QtiExitTestSignal,E as QtiExpression,Q as QtiExtendedTextInteraction,fa as QtiExtendedTextInteractionCorrection,pt as QtiFeedback,lo as QtiFeedbackBlock,ho as QtiFeedbackInline,Ts as QtiFieldValue,lr as QtiGap,en as QtiGapImg,Yr as QtiGapMatchInteraction,Yc as QtiGapMatchInteractionCorrection,$e as QtiGapText,Bc as QtiGapTextCorrection,Rs as QtiGcd,bt as QtiGraphicAssociateInteraction,Kc as QtiGraphicAssociateInteractionCorrection,yr as QtiGraphicGapMatchInteraction,Zc as QtiGraphicGapMatchInteractionCorrection,Be as QtiGraphicOrderInteraction,tl as QtiGraphicOrderInteractionCorrection,Is as QtiGt,Ms as QtiGte,hr as QtiHotspotChoice,ma as QtiHotspotChoiceCorrection,Kr as QtiHotspotInteraction,el as QtiHotspotInteractionCorrection,pr as QtiHottext,Uc as QtiHottextCorrection,Zr as QtiHottextInteraction,rl as QtiHottextInteractionCorrection,gn as QtiIndex,rn as QtiInlineChoice,rt as QtiInlineChoiceInteraction,il as QtiInlineChoiceInteractionCorrection,ii as QtiInside,Ps as QtiIntegerDivide,Os as QtiIntegerModulus,Ds as QtiIntegerToFloat,$s as QtiIsNull,fe as QtiItem,po as QtiItemBody,Yp as QtiItemCorrection,Pt as QtiItemSessionControl,Ns as QtiLcm,ni as QtiLookupOutcomeValue,Ls as QtiLt,Vs as QtiLte,vn as QtiMapResponse,bn as QtiMapResponsePoint,js as QtiMatch,te as QtiMatchInteraction,nl as QtiMatchInteractionCorrection,yn as QtiMathConstant,qn as QtiMathOperator,Fs as QtiMax,os as QtiMediaInteraction,zs as QtiMember,Bs as QtiMin,Ur as QtiModalFeedback,Us as QtiMultiple,Hs as QtiNot,Ws as QtiNull,Fi as QtiNumberPresented,to as QtiNumberSelected,Qs as QtiOr,Ue as QtiOrderInteraction,ol as QtiOrderInteractionCorrection,Xs as QtiOrdered,Js as QtiOutcomeCondition,he as QtiOutcomeDeclaration,Ks as QtiOutcomeElse,Ys as QtiOutcomeElseIf,ci as QtiOutcomeIf,ro as QtiOutcomeProcessing,ec as QtiOutcomeProcessingProcessor,xn as QtiPatternMatch,X as QtiPortableCustomInteraction,sl as QtiPortableCustomInteractionCorrection,_t as QtiPositionObjectInteraction,ps as QtiPositionObjectStage,Zs as QtiPower,eo as QtiPreCondition,vt as QtiPrintedVariable,ta as QtiProduct,Mo as QtiPrompt,ea as QtiRandom,kr as QtiRandomInteger,Cn as QtiRepeat,ra as QtiResponseCondition,Ee as QtiResponseDeclaration,na as QtiResponseElse,ia as QtiResponseElseIf,li as QtiResponseIf,mo as QtiResponseProcessing,oa as QtiResponseProcessingFragment,sa as QtiRound,di as QtiRoundTo,pe as QtiRubricBlock,rd as QtiRuleElement,lt as QtiSelectPointInteraction,al as QtiSelectPointInteractionCorrection,aa as QtiSetCorrectResponse,$c as QtiSetCorrectResponseRule,ca as QtiSetOutcomeValue,Nc as QtiSetOutcomeValueRule,la as QtiSetTemplateValue,Lc as QtiSetTemplateValueRule,Nt as QtiSimpleAssociableChoice,Hc as QtiSimpleAssociableChoiceCorrection,Lt as QtiSimpleChoice,Wc as QtiSimpleChoiceCorrection,Tt as QtiSliderInteraction,cl as QtiSliderInteractionCorrection,kn as QtiStatsOperator,Sn as QtiStringMatch,bo as QtiStylesheet,En as QtiSubstring,da as QtiSubtract,ha as QtiSum,Vc as QtiSumExpression,vo as QtiTemplateConstraint,ue as QtiTemplateDeclaration,yo as QtiTemplateProcessing,Ie as QtiTest,Zp as QtiTestCorrection,Ji as QtiTestFeedback,Re as QtiTestPart,Yi as QtiTestVariables,cc as QtiTestVariablesExpression,dt as QtiTextEntryInteraction,ll as QtiTextEntryInteractionCorrection,pa as QtiTruncate,bs as QtiUploadInteraction,ua as QtiVariable,Ir as QtiVariableDeclaration,Zl as STATE_ALIASES,Y as ScoringHelper,St as TestContainer,me as TestEndAttempt,mt as TestNavigation,Kp as TestNavigationCorrection,sr as TestNext,ar as TestPrev,Xe as TestShowCorrectResponse,Io as TestSubmit,Sv as asSeed,M as boxSizing,Lu as classifyCustomStateSupport,ct as computedContext,we as computedItemContext,yt as configContext,Mt as convertNumberToUniversalFormat,st as correctionPart,ry as decimalSeparator,Ja as dispatchDeclared,xt as dispatchPublic,Wt as dropRegion,id as getCustomOperator,J$ as getItemByUri,G$ as getManifestInfo,Ni as hasState,Kn as inferRecordFieldBaseType,qf as inlineScriptText,xf as inlineStyleText,Yl as installCustomStateSetFallback,Tr as interactionContext,ce as isRecordValue,ju as isSeed,j as itemContext,Kl as itemContextVariables,hy as iterResponseValues,Ya as listenDeclared,ad as listenPublic,py as parsePair,my as parsePoint,Vi as parseResponseAttribute,sh as pluginElements,KS as pluginState,Ef as qtiAndMixin,qt as qtiContext,Vp as qtiInteractionElements,Bf as qtiSubtractMixin,Gt as qtiTransformItem,kd as qtiTransformManifest,Fr as qtiTransformTest,ji as readRecordFieldValues,qy as registerCustomOperator,Yn as removeDoubleSlashes,Xt as responseAttributeConverter,uy as serializePair,fy as serializePoint,er as serializeResponseAttribute,Jn as sessionContext,z as setState,nt as testContext,xy as unregisterCustomOperator,U as validationMessage};
11762
11536
  /*! Bundled license information:
11763
11537
 
11764
11538
  @lit-labs/ssr-dom-shim/lib/element-internals.js: