@citolab/qti-components 8.0.0 → 8.0.2

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 (77) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +690 -316
  3. package/dist/base.d.ts +135 -9
  4. package/dist/base.js +1 -1
  5. package/dist/chunk-4DB4SC5K.js +100 -0
  6. package/dist/chunk-4DB4SC5K.js.map +1 -0
  7. package/dist/{chunk-WVVMNF74.js → chunk-7AVWRQIS.js} +188 -160
  8. package/dist/{chunk-WVVMNF74.js.map → chunk-7AVWRQIS.js.map} +1 -1
  9. package/dist/{chunk-MGF5F3S2.js → chunk-BQFWCZFH.js} +2 -2
  10. package/dist/{chunk-5QYII4OZ.js → chunk-CK7AV2UJ.js} +147 -101
  11. package/dist/chunk-CK7AV2UJ.js.map +1 -0
  12. package/dist/chunk-G6GFQDVN.js +7 -0
  13. package/dist/chunk-G6GFQDVN.js.map +1 -0
  14. package/dist/{chunk-LZJHHZQ2.js → chunk-HBSWJC3B.js} +643 -553
  15. package/dist/chunk-HBSWJC3B.js.map +1 -0
  16. package/dist/chunk-HQESINXH.js +834 -0
  17. package/dist/chunk-HQESINXH.js.map +1 -0
  18. package/dist/{chunk-KYEZRYO6.js → chunk-J5SQLKNP.js} +145 -119
  19. package/dist/{chunk-KYEZRYO6.js.map → chunk-J5SQLKNP.js.map} +1 -1
  20. package/dist/{chunk-V5G7X53Y.js → chunk-NJQHUUTN.js} +2 -2
  21. package/dist/{chunk-W4QZPCNC.js → chunk-RSVRS5AK.js} +59 -58
  22. package/dist/chunk-RSVRS5AK.js.map +1 -0
  23. package/dist/{chunk-5SJS36BI.js → chunk-TWPXES3S.js} +642 -673
  24. package/dist/chunk-TWPXES3S.js.map +1 -0
  25. package/dist/{chunk-NA2N2WSG.js → chunk-VAE6HBKR.js} +176 -152
  26. package/dist/{chunk-NA2N2WSG.js.map → chunk-VAE6HBKR.js.map} +1 -1
  27. package/dist/{chunk-MJVPNN7W.js → chunk-ZII6M3SN.js} +2 -2
  28. package/dist/computed-item.types.d-BKZdSLLJ.d.ts +19 -0
  29. package/dist/computed.types.d-DpKIYO6e.d.ts +44 -0
  30. package/dist/config.context.d-BvU9r-Mg.d.ts +91 -0
  31. package/dist/corrections.d.ts +415 -1
  32. package/dist/corrections.js +8 -9
  33. package/dist/elements.d.ts +393 -1
  34. package/dist/elements.js +4 -5
  35. package/dist/index.d.ts +27 -9
  36. package/dist/index.js +21 -14
  37. package/dist/interaction.d-CJiMv8H7.d.ts +126 -0
  38. package/dist/interaction.interface.d-CvjHM2bi.d.ts +46 -0
  39. package/dist/interactions.d.ts +281 -1
  40. package/dist/interactions.js +4 -5
  41. package/dist/item.css +588 -214
  42. package/dist/item.d.ts +92 -1
  43. package/dist/item.js +5 -5
  44. package/dist/item.types.d-QU7LljEK.d.ts +82 -0
  45. package/dist/loader.d.ts +22 -1
  46. package/dist/processing.d.ts +730 -1
  47. package/dist/processing.js +2 -2
  48. package/dist/qti-components-jsx.d.ts +854 -844
  49. package/dist/qti-components-jsx.js +1 -0
  50. package/dist/qti-condition-expression.d-aMvBvpc6.d.ts +8 -0
  51. package/dist/qti-expression.d-BietT_8b.d.ts +31 -0
  52. package/dist/qti-feedback.d-DZbad0RN.d.ts +21 -0
  53. package/dist/qti-rule-base.d-ajOnfGXY.d.ts +16 -0
  54. package/dist/qti-test.d-_YAlhDbt.d.ts +702 -0
  55. package/dist/qti-text-entry-interaction.d-BGdfV9qG.d.ts +1567 -0
  56. package/dist/qti-transform-test.d-BL7GGFJj.d.ts +70 -0
  57. package/dist/qti.context.d-CejJMlfZ.d.ts +50 -0
  58. package/dist/response.d-_8y4kjGP.d.ts +106 -0
  59. package/dist/test.d.ts +32 -1
  60. package/dist/test.js +14 -7
  61. package/dist/transformers.d.ts +18 -1
  62. package/package.json +15 -11
  63. package/dist/chunk-5QYII4OZ.js.map +0 -1
  64. package/dist/chunk-5SJS36BI.js.map +0 -1
  65. package/dist/chunk-64XSIBGO.js +0 -241
  66. package/dist/chunk-64XSIBGO.js.map +0 -1
  67. package/dist/chunk-H3J7LFRO.js +0 -2243
  68. package/dist/chunk-H3J7LFRO.js.map +0 -1
  69. package/dist/chunk-LZJHHZQ2.js.map +0 -1
  70. package/dist/chunk-W4QZPCNC.js.map +0 -1
  71. package/dist/chunk-WCQ26LV7.js +0 -102
  72. package/dist/chunk-WCQ26LV7.js.map +0 -1
  73. package/dist/chunk-X3E5HXG2.js +0 -20
  74. package/dist/chunk-X3E5HXG2.js.map +0 -1
  75. /package/dist/{chunk-MGF5F3S2.js.map → chunk-BQFWCZFH.js.map} +0 -0
  76. /package/dist/{chunk-V5G7X53Y.js.map → chunk-NJQHUUTN.js.map} +0 -0
  77. /package/dist/{chunk-MJVPNN7W.js.map → chunk-ZII6M3SN.js.map} +0 -0
package/cdn/index.js CHANGED
@@ -1,7 +1,7 @@
1
- var bl=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){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=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Oe=function(n,e,t,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 e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(n,t):i?i.value=t:e.set(n,t),t},Y=function(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)},or,Zi,eo,Gr,Ps,Xr,to,Tt,Yr,st,ro,yl,vl=n=>typeof n=="boolean"?n:n?.capture??!1;var Ms=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,r){if(t==null)return;let i=vl(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(e);if(o===void 0)o=new Map,i.set(e,o);else if(o.has(t))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(e,t,r)),o.set(t,s??{})}removeEventListener(e,t,r){if(t==null)return;let i=vl(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(e);o!==void 0&&(o.delete(t),o.size||i.delete(e))}dispatchEvent(e){let t=[this],r=this.__eventTargetParent;if(e.composed)for(;r;)t.push(r),r=r.__eventTargetParent;else for(;r&&r!==this.__host;)t.push(r),r=r.__eventTargetParent;let i=!1,o=!1,s=0,a=null,l=null,c=null,d=e.stopPropagation,h=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get(){return a??l},...z},srcElement:{get(){return e.target},...z},currentTarget:{get(){return c},...z},eventPhase:{get(){return s},...z},composedPath:{value:()=>t,...z},stopPropagation:{value:()=>{i=!0,d.call(e)},...z},stopImmediatePropagation:{value:()=>{o=!0,h.call(e)},...z}});let g=(u,y,v)=>{typeof u=="function"?u(e):typeof u?.handleEvent=="function"&&u.handleEvent(e),y.once&&v.delete(u)},f=()=>(c=null,s=0,!e.defaultPrevented),w=t.slice().reverse();a=!this.__host||!e.composed?this:null;let x=u=>{for(l=this;l.__host&&u.includes(l.__host);)l=l.__host};for(let u of w){!a&&(!l||l===u.__host)&&x(w.slice(w.indexOf(u))),c=u,s=u===e.target?2:1;let y=u.__captureEventListeners.get(e.type);if(y){for(let[v,A]of y)if(g(v,A,y),o)return f()}if(i)return f()}let m=e.bubbles?t:[this];l=null;for(let u of m){!a&&(!l||u===l.__host)&&x(m.slice(0,m.indexOf(u)+1)),c=u,s=u===e.target?2:3;let y=u.__eventListeners.get(e.type);if(y){for(let[v,A]of y)if(g(v,A,y),o)return f()}if(i)return f()}return f()}},Ds=Ms;var z={__proto__:null};z.enumerable=!0;Object.freeze(z);var Ns=(st=class{constructor(e,t={}){if(or.set(this,!1),Zi.set(this,!1),eo.set(this,!1),Gr.set(this,!1),Ps.set(this,Date.now()),Xr.set(this,!1),to.set(this,void 0),Tt.set(this,void 0),Yr.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 t!="object"||!t)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:o}=t;Oe(this,or,!!i,"f"),Oe(this,Zi,!!r,"f"),Oe(this,eo,!!o,"f"),Oe(this,to,`${e}`,"f"),Oe(this,Tt,null,"f"),Oe(this,Yr,!1,"f")}initEvent(e,t,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Oe(this,Gr,!0,"f")}get target(){return Y(this,Tt,"f")}get currentTarget(){return Y(this,Tt,"f")}get srcElement(){return Y(this,Tt,"f")}get type(){return Y(this,to,"f")}get cancelable(){return Y(this,or,"f")}get defaultPrevented(){return Y(this,or,"f")&&Y(this,Gr,"f")}get timeStamp(){return Y(this,Ps,"f")}composedPath(){return Y(this,Yr,"f")?[Y(this,Tt,"f")]:[]}get returnValue(){return!Y(this,or,"f")||!Y(this,Gr,"f")}get bubbles(){return Y(this,Zi,"f")}get composed(){return Y(this,eo,"f")}get eventPhase(){return Y(this,Yr,"f")?st.AT_TARGET:st.NONE}get cancelBubble(){return Y(this,Xr,"f")}set cancelBubble(e){e&&Oe(this,Xr,!0,"f")}stopPropagation(){Oe(this,Xr,!0,"f")}get isTrusted(){return!1}},or=new WeakMap,Zi=new WeakMap,eo=new WeakMap,Gr=new WeakMap,Ps=new WeakMap,Xr=new WeakMap,to=new WeakMap,Tt=new WeakMap,Yr=new WeakMap,st.NONE=0,st.CAPTURING_PHASE=1,st.AT_TARGET=2,st.BUBBLING_PHASE=3,st);Object.defineProperties(Ns.prototype,{initEvent:z,stopImmediatePropagation:z,preventDefault:z,target:z,currentTarget:z,srcElement:z,type:z,cancelable:z,defaultPrevented:z,timeStamp:z,composedPath:z,returnValue:z,bubbles:z,composed:z,eventPhase:z,cancelBubble:z,stopPropagation:z,isTrusted:z});var wl=(yl=class extends Ns{constructor(e,t={}){super(e,t),ro.set(this,void 0),Oe(this,ro,t?.detail??null,"f")}initCustomEvent(e,t,r,i){throw new Error("Method not implemented.")}get detail(){return Y(this,ro,"f")}},ro=new WeakMap,yl);Object.defineProperties(wl.prototype,{detail:z});var $s=Ns,Ls=wl;var ie;var Du=(ie=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.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},ie.STYLE_RULE=1,ie.CHARSET_RULE=2,ie.IMPORT_RULE=3,ie.MEDIA_RULE=4,ie.FONT_FACE_RULE=5,ie.PAGE_RULE=6,ie.NAMESPACE_RULE=10,ie.KEYFRAMES_RULE=7,ie.KEYFRAME_RULE=8,ie.SUPPORTS_RULE=12,ie.COUNTER_STYLE_RULE=11,ie.FONT_FEATURE_VALUES_RULE=14,ie);globalThis.Event??=$s;globalThis.CustomEvent??=Ls;var xl=new WeakMap,Kr=n=>{let e=xl.get(n);return e===void 0&&xl.set(n,e=new Map),e},bh=class extends Ds{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Kr(this)).map(([e,t])=>({name:e,value:t}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){Kr(this).set(e,String(t))}removeAttribute(e){Kr(this).delete(e)}toggleAttribute(e,t){if(this.hasAttribute(e)){if(t===void 0||!t)return this.removeAttribute(e),!1}else return t===void 0||t?(this.setAttribute(e,""),!0):!1;return!0}hasAttribute(e){return Kr(this).has(e)}attachShadow(e){let t={host:this};return this.__shadowRootMode=e.mode,e&&e.mode==="open"&&(this.__shadowRoot=t),t}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let e=new bl(this);return this.__internals=e,e}getAttribute(e){return Kr(this).get(e)??null}};var yh=class extends bh{},zs=yh;globalThis.litServerRoot??=Object.defineProperty(new zs,"localName",{get(){return"lit-server-root"}});function vh(){let n,e;return{promise:new Promise((r,i)=>{n=r,e=i}),resolve:n,reject:e}}var Vs=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(e,t){if(this.__definitions.has(e))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${e}" 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 "${e}" has already been used with this registry`);if(this.__reverseDefinitions.has(t))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(t)}`);t.__localName=e,this.__definitions.set(e,{ctor:t,observedAttributes:t.observedAttributes??[]}),this.__reverseDefinitions.set(t,e),this.__pendingWhenDefineds.get(e)?.resolve(t),this.__pendingWhenDefineds.delete(e)}get(e){return this.__definitions.get(e)?.ctor}getName(e){return this.__reverseDefinitions.get(e)??null}upgrade(e){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(e){let t=this.__definitions.get(e);if(t)return t.ctor;let r=this.__pendingWhenDefineds.get(e);return r||(r=vh(),this.__pendingWhenDefineds.set(e,r)),r.promise}},wh=Vs;var ql=new wh;var Jr=globalThis,io=Jr.ShadowRoot&&(Jr.ShadyCSS===void 0||Jr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,js=Symbol(),Cl=new WeakMap,Zr=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==js)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(io&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Cl.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Cl.set(t,e))}return e}toString(){return this.cssText}},El=n=>new Zr(typeof n=="string"?n:n+"",void 0,js),q=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>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)+n[o+1],n[0]);return new Zr(t,n,js)},kl=(n,e)=>{if(io)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=Jr.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},Fs=io||Jr.CSSStyleSheet===void 0?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return El(t)})(n):n;var{is:xh,defineProperty:qh,getOwnPropertyDescriptor:Ch,getOwnPropertyNames:Eh,getOwnPropertySymbols:kh,getPrototypeOf:Sh}=Object,ri=globalThis;ri.customElements??=ql;var Sl=ri.trustedTypes,Ah=Sl?Sl.emptyScript:"",Ih=ri.reactiveElementPolyfillSupport,ei=(n,e)=>n,ti={toAttribute(n,e){switch(e){case Boolean:n=n?Ah:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},oo=(n,e)=>!xh(n,e),Al={attribute:!0,type:String,converter:ti,reflect:!1,useDefault:!1,hasChanged:oo};Symbol.metadata??=Symbol("metadata"),ri.litPropertyMetadata??=new WeakMap;var Qe=class extends(globalThis.HTMLElement??zs){static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Al){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&qh(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=Ch(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Al}static _$Ei(){if(this.hasOwnProperty(ei("elementProperties")))return;let e=Sh(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ei("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ei("properties"))){let t=this.properties,r=[...Eh(t),...kh(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(Fs(i))}else e!==void 0&&t.push(Fs(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return kl(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:ti).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ti;this._$Em=i;let a=s.fromAttribute(t,o.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,r,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),r??=s.getPropertyOptions(e),!((r.hasChanged??oo)(o,t)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:o},s){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:s}=o,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,o,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Qe.elementStyles=[],Qe.shadowRootOptions={mode:"open"},Qe[ei("elementProperties")]=new Map,Qe[ei("finalized")]=new Map,Ih?.({ReactiveElement:Qe}),(ri.reactiveElementVersions??=[]).push("2.1.2");var po=globalThis,Il=n=>n,no=po.trustedTypes,_l=no?no.createPolicy("lit-html",{createHTML:n=>n}):void 0,Us="$lit$",Ge=`lit$${Math.random().toFixed(9).slice(2)}$`,Hs="?"+Ge,_h=`<${Hs}>`,Pt=po.document===void 0?{createTreeWalker:()=>({})}:document,oi=()=>Pt.createComment(""),ni=n=>n===null||typeof n!="object"&&typeof n!="function",Ws=Array.isArray,Dl=n=>Ws(n)||typeof n?.[Symbol.iterator]=="function",Bs=`[
3
- \f\r]`,ii=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Tl=/-->/g,Rl=/>/g,Rt=RegExp(`>|${Bs}(?:([^\\s"'>=/]+)(${Bs}*=${Bs}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ol=/'/g,Pl=/"/g,Nl=/^(?:script|style|textarea|title)$/i,Qs=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),b=Qs(1),ai=Qs(2),nm=Qs(3),Z=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Ml=new WeakMap,Ot=Pt.createTreeWalker(Pt,129);function $l(n,e){if(!Ws(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return _l!==void 0?_l.createHTML(e):e}var Ll=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=ii;for(let a=0;a<t;a++){let l=n[a],c,d,h=-1,g=0;for(;g<l.length&&(s.lastIndex=g,d=s.exec(l),d!==null);)g=s.lastIndex,s===ii?d[1]==="!--"?s=Tl:d[1]!==void 0?s=Rl:d[2]!==void 0?(Nl.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=Rt):d[3]!==void 0&&(s=Rt):s===Rt?d[0]===">"?(s=i??ii,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Rt:d[3]==='"'?Pl:Ol):s===Pl||s===Ol?s=Rt:s===Tl||s===Rl?s=ii:(s=Rt,i=void 0);let f=s===Rt&&n[a+1].startsWith("/>")?" ":"";o+=s===ii?l+_h:h>=0?(r.push(c),l.slice(0,h)+Us+l.slice(h)+Ge+f):l+Ge+(h===-2?a:f)}return[$l(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},si=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,d]=Ll(e,t);if(this.el=n.createElement(c,r),Ot.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=Ot.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Us)){let g=d[s++],f=i.getAttribute(h).split(Ge),w=/([.?@])?(.*)/.exec(g);l.push({type:1,index:o,name:w[2],strings:f,ctor:w[1]==="."?ao:w[1]==="?"?lo:w[1]==="@"?co:Dt}),i.removeAttribute(h)}else h.startsWith(Ge)&&(l.push({type:6,index:o}),i.removeAttribute(h));if(Nl.test(i.tagName)){let h=i.textContent.split(Ge),g=h.length-1;if(g>0){i.textContent=no?no.emptyScript:"";for(let f=0;f<g;f++)i.append(h[f],oi()),Ot.nextNode(),l.push({type:2,index:++o});i.append(h[g],oi())}}}else if(i.nodeType===8)if(i.data===Hs)l.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(Ge,h+1))!==-1;)l.push({type:7,index:o}),h+=Ge.length-1}o++}}static createElement(e,t){let r=Pt.createElement("template");return r.innerHTML=e,r}};function Mt(n,e,t=n,r){if(e===Z)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=ni(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Mt(n,i._$AS(n,e.values),i,r)),e}var so=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??Pt).importNode(t,!0);Ot.currentNode=i;let o=Ot.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new nr(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new ho(o,this,e)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=Ot.nextNode(),s++)}return Ot.currentNode=Pt,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},nr=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Mt(this,e,t),ni(e)?e===P||e==null||e===""?(this._$AH!==P&&this._$AR(),this._$AH=P):e!==this._$AH&&e!==Z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Dl(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==P&&ni(this._$AH)?this._$AA.nextSibling.data=e:this.T(Pt.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=si.createElement($l(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new so(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Ml.get(e.strings);return t===void 0&&Ml.set(e.strings,t=new si(e)),t}k(e){Ws(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(oi()),this.O(oi()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=Il(e).nextSibling;Il(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Dt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=P,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(e,t=this,r,i){let o=this.strings,s=!1;if(o===void 0)e=Mt(this,e,t,0),s=!ni(e)||e!==this._$AH&&e!==Z,s&&(this._$AH=e);else{let a=e,l,c;for(e=o[0],l=0;l<o.length-1;l++)c=Mt(this,a[r+l],t,l),c===Z&&(c=this._$AH[l]),s||=!ni(c)||c!==this._$AH[l],c===P?e=P:e!==P&&(e+=(c??"")+o[l+1]),this._$AH[l]=c}s&&!i&&this.j(e)}j(e){e===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ao=class extends Dt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===P?void 0:e}},lo=class extends Dt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==P)}},co=class extends Dt{constructor(e,t,r,i,o){super(e,t,r,i,o),this.type=5}_$AI(e,t=this){if((e=Mt(this,e,t,0)??P)===Z)return;let r=this._$AH,i=e===P&&r!==P||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},ho=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Mt(this,e)}},K={M:Us,P:Ge,A:Hs,C:1,L:Ll,R:so,D:Dl,V:Mt,I:nr,H:Dt,N:lo,U:co,B:ao,F:ho},Th=po.litHtmlPolyfillSupport;Th?.(si,nr),(po.litHtmlVersions??=[]).push("3.3.2");var Gs=(n,e,t)=>{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let o=t?.renderBefore??null;r._$litPart$=i=new nr(e.insertBefore(oi(),o),o,void 0,t??{})}return i._$AI(n),i};var Xs=globalThis,C=class extends Qe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Gs(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Z}};C._$litElement$=!0,C.finalized=!0,Xs.litElementHydrateSupport?.({LitElement:C});var Rh=Xs.litElementPolyfillSupport;Rh?.({LitElement:C});(Xs.litElementVersions??=[]).push("4.2.2");var Oh={attribute:!0,type:String,converter:ti,reflect:!1,hasChanged:oo},Ph=(n=Oh,e,t)=>{let{kind:r,metadata:i}=t,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),r==="setter"&&((n=Object.create(n)).wrapped=!0),o.set(t.name,n),r==="accessor"){let{name:s}=t;return{set(a){let l=e.get.call(this);e.set.call(this,a),this.requestUpdate(s,l,n,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,n,a),a}}}if(r==="setter"){let{name:s}=t;return function(a){let l=this[s];e.call(this,a),this.requestUpdate(s,l,n,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(n){return(e,t)=>typeof t=="object"?Ph(n,e,t):((r,i,o)=>{let s=i.hasOwnProperty(o);return i.constructor.createProperty(o,r),s?Object.getOwnPropertyDescriptor(i,o):void 0})(n,e,t)}function _(n){return p({...n,state:!0,attribute:!1})}var at=(n,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,t),t);function sr(n,e){return(t,r,i)=>{let o=s=>s.renderRoot?.querySelector(n)??null;if(e){let{get:s,set:a}=typeof r=="object"?t:i??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return at(t,r,{get(){let l=s.call(this);return l===void 0&&(l=o(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return at(t,r,{get(){return o(this)}})}}function Vl(n){return(e,t)=>{let{slot:r,selector:i}=n??{},o="slot"+(r?`[name=${r}]`:":not([name])");return at(e,t,{get(){let s=this.renderRoot?.querySelector(o),a=s?.assignedElements(n)??[];return i===void 0?a:a.filter(l=>l.matches(i))}})}}var ar=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},zl={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},Pe=class extends C{constructor(){super(...arguments),this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};ar([p({type:String})],Pe.prototype,"category",void 0);ar([p({type:String})],Pe.prototype,"identifier",void 0);ar([p({type:Boolean,converter:zl})],Pe.prototype,"required",void 0);ar([p({type:Boolean,converter:zl})],Pe.prototype,"fixed",void 0);ar([p({type:String})],Pe.prototype,"href",void 0);ar([p({type:Object,attribute:!1})],Pe.prototype,"xmlDoc",void 0);var lt=class extends Event{constructor(e,t,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=i??!1}};var lr=class{constructor(e,t,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,s)),this.unsubscribe=s},this.host=e,t.context!==void 0){let o=t;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=t,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 lt(this.context,this.host,this.t,this.subscribe))}};var uo=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:r}]of this.subscriptions)t(this.o,r)},e!==void 0&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:i}=this.subscriptions.get(e);e(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Ys=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},cr=class extends uo{constructor(e,t,r){super(t.context!==void 0?t.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let o=i.contextTarget??i.composedPath()[0];o!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,o,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let o=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)o.has(s)||(o.add(s),a.dispatchEvent(new lt(this.context,a,s,!0)));i.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,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 Ys(this.context,this.host))}};function B({context:n}){return(e,t)=>{let r=new WeakMap;if(typeof t=="object")return{get(){return e.get.call(this)},set(i){return r.get(this).setValue(i),e.set.call(this,i)},init(i){return r.set(this,new cr(this,{context:n,initialValue:i})),i}};{e.constructor.addInitializer((s=>{r.set(s,new cr(s,{context:n}))}));let i=Object.getOwnPropertyDescriptor(e,t),o;if(i===void 0){let s=new WeakMap;o={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;o={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(e,t,o)}}}function T({context:n,subscribe:e}){return(t,r)=>{typeof r=="object"?r.addInitializer((function(){new lr(this,{context:n,callback:i=>{t.set.call(this,i)},subscribe:e})})):t.constructor.addInitializer((i=>{new lr(i,{context:n,callback:o=>{i[r]=o},subscribe:e})}))}}var jl=[];for(let{tag:n,ctor:e}of jl)customElements.get(n)||customElements.define(n,e);var ct=Symbol("computedItemContext");var F=Symbol("computedContext");var de=Symbol("configContext");var dr=Symbol("interactionContext");var j=Symbol("item");var Fl=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Mh=/^[A-Za-z0-9-]+$/,Dh=n=>typeof n=="string"&&Mh.test(n),Of=n=>Dh(n)?n:void 0,he=Symbol("qtiContext");var Ks={view:"candidate"},De=Symbol("testContext");var Js={items:[],testOutcomeVariables:[]},pe=Symbol("testContext");var R=q`
1
+ var bl=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(e){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=e}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Pe=function(n,e,t,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 e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(n,t):i?i.value=t:e.set(n,t),t},Y=function(n,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(n):r?r.value:e.get(n)},nr,Zi,eo,Gr,Ps,Xr,to,Rt,Yr,st,ro,yl,vl=n=>typeof n=="boolean"?n:n?.capture??!1;var Ms=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(e,t,r){if(t==null)return;let i=vl(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(e);if(o===void 0)o=new Map,i.set(e,o);else if(o.has(t))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(e,t,r)),o.set(t,s??{})}removeEventListener(e,t,r){if(t==null)return;let i=vl(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(e);o!==void 0&&(o.delete(t),o.size||i.delete(e))}dispatchEvent(e){let t=[this],r=this.__eventTargetParent;if(e.composed)for(;r;)t.push(r),r=r.__eventTargetParent;else for(;r&&r!==this.__host;)t.push(r),r=r.__eventTargetParent;let i=!1,o=!1,s=0,a=null,l=null,c=null,d=e.stopPropagation,h=e.stopImmediatePropagation;Object.defineProperties(e,{target:{get(){return a??l},...z},srcElement:{get(){return e.target},...z},currentTarget:{get(){return c},...z},eventPhase:{get(){return s},...z},composedPath:{value:()=>t,...z},stopPropagation:{value:()=>{i=!0,d.call(e)},...z},stopImmediatePropagation:{value:()=>{o=!0,h.call(e)},...z}});let g=(u,y,v)=>{typeof u=="function"?u(e):typeof u?.handleEvent=="function"&&u.handleEvent(e),y.once&&v.delete(u)},m=()=>(c=null,s=0,!e.defaultPrevented),w=t.slice().reverse();a=!this.__host||!e.composed?this:null;let x=u=>{for(l=this;l.__host&&u.includes(l.__host);)l=l.__host};for(let u of w){!a&&(!l||l===u.__host)&&x(w.slice(w.indexOf(u))),c=u,s=u===e.target?2:1;let y=u.__captureEventListeners.get(e.type);if(y){for(let[v,A]of y)if(g(v,A,y),o)return m()}if(i)return m()}let f=e.bubbles?t:[this];l=null;for(let u of f){!a&&(!l||u===l.__host)&&x(f.slice(0,f.indexOf(u)+1)),c=u,s=u===e.target?2:3;let y=u.__eventListeners.get(e.type);if(y){for(let[v,A]of y)if(g(v,A,y),o)return m()}if(i)return m()}return m()}},Ds=Ms;var z={__proto__:null};z.enumerable=!0;Object.freeze(z);var Ns=(st=class{constructor(e,t={}){if(nr.set(this,!1),Zi.set(this,!1),eo.set(this,!1),Gr.set(this,!1),Ps.set(this,Date.now()),Xr.set(this,!1),to.set(this,void 0),Rt.set(this,void 0),Yr.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 t!="object"||!t)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:o}=t;Pe(this,nr,!!i,"f"),Pe(this,Zi,!!r,"f"),Pe(this,eo,!!o,"f"),Pe(this,to,`${e}`,"f"),Pe(this,Rt,null,"f"),Pe(this,Yr,!1,"f")}initEvent(e,t,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Pe(this,Gr,!0,"f")}get target(){return Y(this,Rt,"f")}get currentTarget(){return Y(this,Rt,"f")}get srcElement(){return Y(this,Rt,"f")}get type(){return Y(this,to,"f")}get cancelable(){return Y(this,nr,"f")}get defaultPrevented(){return Y(this,nr,"f")&&Y(this,Gr,"f")}get timeStamp(){return Y(this,Ps,"f")}composedPath(){return Y(this,Yr,"f")?[Y(this,Rt,"f")]:[]}get returnValue(){return!Y(this,nr,"f")||!Y(this,Gr,"f")}get bubbles(){return Y(this,Zi,"f")}get composed(){return Y(this,eo,"f")}get eventPhase(){return Y(this,Yr,"f")?st.AT_TARGET:st.NONE}get cancelBubble(){return Y(this,Xr,"f")}set cancelBubble(e){e&&Pe(this,Xr,!0,"f")}stopPropagation(){Pe(this,Xr,!0,"f")}get isTrusted(){return!1}},nr=new WeakMap,Zi=new WeakMap,eo=new WeakMap,Gr=new WeakMap,Ps=new WeakMap,Xr=new WeakMap,to=new WeakMap,Rt=new WeakMap,Yr=new WeakMap,st.NONE=0,st.CAPTURING_PHASE=1,st.AT_TARGET=2,st.BUBBLING_PHASE=3,st);Object.defineProperties(Ns.prototype,{initEvent:z,stopImmediatePropagation:z,preventDefault:z,target:z,currentTarget:z,srcElement:z,type:z,cancelable:z,defaultPrevented:z,timeStamp:z,composedPath:z,returnValue:z,bubbles:z,composed:z,eventPhase:z,cancelBubble:z,stopPropagation:z,isTrusted:z});var wl=(yl=class extends Ns{constructor(e,t={}){super(e,t),ro.set(this,void 0),Pe(this,ro,t?.detail??null,"f")}initCustomEvent(e,t,r,i){throw new Error("Method not implemented.")}get detail(){return Y(this,ro,"f")}},ro=new WeakMap,yl);Object.defineProperties(wl.prototype,{detail:z});var $s=Ns,Ls=wl;var ie;var Du=(ie=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.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},ie.STYLE_RULE=1,ie.CHARSET_RULE=2,ie.IMPORT_RULE=3,ie.MEDIA_RULE=4,ie.FONT_FACE_RULE=5,ie.PAGE_RULE=6,ie.NAMESPACE_RULE=10,ie.KEYFRAMES_RULE=7,ie.KEYFRAME_RULE=8,ie.SUPPORTS_RULE=12,ie.COUNTER_STYLE_RULE=11,ie.FONT_FEATURE_VALUES_RULE=14,ie);globalThis.Event??=$s;globalThis.CustomEvent??=Ls;var xl=new WeakMap,Kr=n=>{let e=xl.get(n);return e===void 0&&xl.set(n,e=new Map),e},bh=class extends Ds{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Kr(this)).map(([e,t])=>({name:e,value:t}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(e,t){Kr(this).set(e,String(t))}removeAttribute(e){Kr(this).delete(e)}toggleAttribute(e,t){if(this.hasAttribute(e)){if(t===void 0||!t)return this.removeAttribute(e),!1}else return t===void 0||t?(this.setAttribute(e,""),!0):!1;return!0}hasAttribute(e){return Kr(this).has(e)}attachShadow(e){let t={host:this};return this.__shadowRootMode=e.mode,e&&e.mode==="open"&&(this.__shadowRoot=t),t}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let e=new bl(this);return this.__internals=e,e}getAttribute(e){return Kr(this).get(e)??null}};var yh=class extends bh{},zs=yh;globalThis.litServerRoot??=Object.defineProperty(new zs,"localName",{get(){return"lit-server-root"}});function vh(){let n,e;return{promise:new Promise((r,i)=>{n=r,e=i}),resolve:n,reject:e}}var Vs=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(e,t){if(this.__definitions.has(e))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${e}" 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 "${e}" has already been used with this registry`);if(this.__reverseDefinitions.has(t))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(t)}`);t.__localName=e,this.__definitions.set(e,{ctor:t,observedAttributes:t.observedAttributes??[]}),this.__reverseDefinitions.set(t,e),this.__pendingWhenDefineds.get(e)?.resolve(t),this.__pendingWhenDefineds.delete(e)}get(e){return this.__definitions.get(e)?.ctor}getName(e){return this.__reverseDefinitions.get(e)??null}upgrade(e){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(e){let t=this.__definitions.get(e);if(t)return t.ctor;let r=this.__pendingWhenDefineds.get(e);return r||(r=vh(),this.__pendingWhenDefineds.set(e,r)),r.promise}},wh=Vs;var ql=new wh;var Jr=globalThis,io=Jr.ShadowRoot&&(Jr.ShadyCSS===void 0||Jr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,js=Symbol(),Cl=new WeakMap,Zr=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==js)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(io&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Cl.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Cl.set(t,e))}return e}toString(){return this.cssText}},El=n=>new Zr(typeof n=="string"?n:n+"",void 0,js),q=(n,...e)=>{let t=n.length===1?n[0]:e.reduce((r,i,o)=>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)+n[o+1],n[0]);return new Zr(t,n,js)},kl=(n,e)=>{if(io)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of e){let r=document.createElement("style"),i=Jr.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},Fs=io||Jr.CSSStyleSheet===void 0?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return El(t)})(n):n;var{is:xh,defineProperty:qh,getOwnPropertyDescriptor:Ch,getOwnPropertyNames:Eh,getOwnPropertySymbols:kh,getPrototypeOf:Sh}=Object,ri=globalThis;ri.customElements??=ql;var Sl=ri.trustedTypes,Ah=Sl?Sl.emptyScript:"",Ih=ri.reactiveElementPolyfillSupport,ei=(n,e)=>n,ti={toAttribute(n,e){switch(e){case Boolean:n=n?Ah:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},oo=(n,e)=>!xh(n,e),Al={attribute:!0,type:String,converter:ti,reflect:!1,useDefault:!1,hasChanged:oo};Symbol.metadata??=Symbol("metadata"),ri.litPropertyMetadata??=new WeakMap;var Qe=class extends(globalThis.HTMLElement??zs){static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Al){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&qh(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:o}=Ch(this.prototype,e)??{get(){return this[t]},set(s){this[t]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Al}static _$Ei(){if(this.hasOwnProperty(ei("elementProperties")))return;let e=Sh(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ei("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ei("properties"))){let t=this.properties,r=[...Eh(t),...kh(t)];for(let i of r)this.createProperty(i,t[i])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[t,r]of this.elementProperties){let i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let i of r)t.unshift(Fs(i))}else e!==void 0&&t.push(Fs(e));return t}static _$Eu(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return kl(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:ti).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ti;this._$Em=i;let a=s.fromAttribute(t,o.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,r,i=!1,o){if(e!==void 0){let s=this.constructor;if(i===!1&&(o=this[e]),r??=s.getPropertyOptions(e),!((r.hasChanged??oo)(o,t)||r.useDefault&&r.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:o},s){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),o!==!0||s!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:s}=o,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,o,a)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};Qe.elementStyles=[],Qe.shadowRootOptions={mode:"open"},Qe[ei("elementProperties")]=new Map,Qe[ei("finalized")]=new Map,Ih?.({ReactiveElement:Qe}),(ri.reactiveElementVersions??=[]).push("2.1.2");var po=globalThis,Il=n=>n,no=po.trustedTypes,_l=no?no.createPolicy("lit-html",{createHTML:n=>n}):void 0,Us="$lit$",Ge=`lit$${Math.random().toFixed(9).slice(2)}$`,Hs="?"+Ge,_h=`<${Hs}>`,Mt=po.document===void 0?{createTreeWalker:()=>({})}:document,oi=()=>Mt.createComment(""),ni=n=>n===null||typeof n!="object"&&typeof n!="function",Ws=Array.isArray,Dl=n=>Ws(n)||typeof n?.[Symbol.iterator]=="function",Bs=`[
3
+ \f\r]`,ii=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Tl=/-->/g,Rl=/>/g,Ot=RegExp(`>|${Bs}(?:([^\\s"'>=/]+)(${Bs}*=${Bs}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ol=/'/g,Pl=/"/g,Nl=/^(?:script|style|textarea|title)$/i,Qs=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),b=Qs(1),ai=Qs(2),nm=Qs(3),Z=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Ml=new WeakMap,Pt=Mt.createTreeWalker(Mt,129);function $l(n,e){if(!Ws(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return _l!==void 0?_l.createHTML(e):e}var Ll=(n,e)=>{let t=n.length-1,r=[],i,o=e===2?"<svg>":e===3?"<math>":"",s=ii;for(let a=0;a<t;a++){let l=n[a],c,d,h=-1,g=0;for(;g<l.length&&(s.lastIndex=g,d=s.exec(l),d!==null);)g=s.lastIndex,s===ii?d[1]==="!--"?s=Tl:d[1]!==void 0?s=Rl:d[2]!==void 0?(Nl.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=Ot):d[3]!==void 0&&(s=Ot):s===Ot?d[0]===">"?(s=i??ii,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Ot:d[3]==='"'?Pl:Ol):s===Pl||s===Ol?s=Ot:s===Tl||s===Rl?s=ii:(s=Ot,i=void 0);let m=s===Ot&&n[a+1].startsWith("/>")?" ":"";o+=s===ii?l+_h:h>=0?(r.push(c),l.slice(0,h)+Us+l.slice(h)+Ge+m):l+Ge+(h===-2?a:m)}return[$l(n,o+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]},si=class n{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let o=0,s=0,a=e.length-1,l=this.parts,[c,d]=Ll(e,t);if(this.el=n.createElement(c,r),Pt.currentNode=this.el.content,t===2||t===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=Pt.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Us)){let g=d[s++],m=i.getAttribute(h).split(Ge),w=/([.?@])?(.*)/.exec(g);l.push({type:1,index:o,name:w[2],strings:m,ctor:w[1]==="."?ao:w[1]==="?"?lo:w[1]==="@"?co:Nt}),i.removeAttribute(h)}else h.startsWith(Ge)&&(l.push({type:6,index:o}),i.removeAttribute(h));if(Nl.test(i.tagName)){let h=i.textContent.split(Ge),g=h.length-1;if(g>0){i.textContent=no?no.emptyScript:"";for(let m=0;m<g;m++)i.append(h[m],oi()),Pt.nextNode(),l.push({type:2,index:++o});i.append(h[g],oi())}}}else if(i.nodeType===8)if(i.data===Hs)l.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(Ge,h+1))!==-1;)l.push({type:7,index:o}),h+=Ge.length-1}o++}}static createElement(e,t){let r=Mt.createElement("template");return r.innerHTML=e,r}};function Dt(n,e,t=n,r){if(e===Z)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl,o=ni(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=Dt(n,i._$AS(n,e.values),i,r)),e}var so=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??Mt).importNode(t,!0);Pt.currentNode=i;let o=Pt.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new sr(o,o.nextSibling,this,e):l.type===1?c=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(c=new ho(o,this,e)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=Pt.nextNode(),s++)}return Pt.currentNode=Mt,i}p(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},sr=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Dt(this,e,t),ni(e)?e===P||e==null||e===""?(this._$AH!==P&&this._$AR(),this._$AH=P):e!==this._$AH&&e!==Z&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Dl(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==P&&ni(this._$AH)?this._$AA.nextSibling.data=e:this.T(Mt.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=si.createElement($l(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let o=new so(i,this),s=o.u(this.options);o.p(t),this.T(s),this._$AH=o}}_$AC(e){let t=Ml.get(e.strings);return t===void 0&&Ml.set(e.strings,t=new si(e)),t}k(e){Ws(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let o of e)i===t.length?t.push(r=new n(this.O(oi()),this.O(oi()),this,this.options)):r=t[i],r._$AI(o),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let r=Il(e).nextSibling;Il(e).remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Nt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,o){this.type=1,this._$AH=P,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(e,t=this,r,i){let o=this.strings,s=!1;if(o===void 0)e=Dt(this,e,t,0),s=!ni(e)||e!==this._$AH&&e!==Z,s&&(this._$AH=e);else{let a=e,l,c;for(e=o[0],l=0;l<o.length-1;l++)c=Dt(this,a[r+l],t,l),c===Z&&(c=this._$AH[l]),s||=!ni(c)||c!==this._$AH[l],c===P?e=P:e!==P&&(e+=(c??"")+o[l+1]),this._$AH[l]=c}s&&!i&&this.j(e)}j(e){e===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ao=class extends Nt{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===P?void 0:e}},lo=class extends Nt{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==P)}},co=class extends Nt{constructor(e,t,r,i,o){super(e,t,r,i,o),this.type=5}_$AI(e,t=this){if((e=Dt(this,e,t,0)??P)===Z)return;let r=this._$AH,i=e===P&&r!==P||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,o=e!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},ho=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Dt(this,e)}},K={M:Us,P:Ge,A:Hs,C:1,L:Ll,R:so,D:Dl,V:Dt,I:sr,H:Nt,N:lo,U:co,B:ao,F:ho},Th=po.litHtmlPolyfillSupport;Th?.(si,sr),(po.litHtmlVersions??=[]).push("3.3.2");var Gs=(n,e,t)=>{let r=t?.renderBefore??e,i=r._$litPart$;if(i===void 0){let o=t?.renderBefore??null;r._$litPart$=i=new sr(e.insertBefore(oi(),o),o,void 0,t??{})}return i._$AI(n),i};var Xs=globalThis,C=class extends Qe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Gs(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Z}};C._$litElement$=!0,C.finalized=!0,Xs.litElementHydrateSupport?.({LitElement:C});var Rh=Xs.litElementPolyfillSupport;Rh?.({LitElement:C});(Xs.litElementVersions??=[]).push("4.2.2");var Oh={attribute:!0,type:String,converter:ti,reflect:!1,hasChanged:oo},Ph=(n=Oh,e,t)=>{let{kind:r,metadata:i}=t,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),r==="setter"&&((n=Object.create(n)).wrapped=!0),o.set(t.name,n),r==="accessor"){let{name:s}=t;return{set(a){let l=e.get.call(this);e.set.call(this,a),this.requestUpdate(s,l,n,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,n,a),a}}}if(r==="setter"){let{name:s}=t;return function(a){let l=this[s];e.call(this,a),this.requestUpdate(s,l,n,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(n){return(e,t)=>typeof t=="object"?Ph(n,e,t):((r,i,o)=>{let s=i.hasOwnProperty(o);return i.constructor.createProperty(o,r),s?Object.getOwnPropertyDescriptor(i,o):void 0})(n,e,t)}function _(n){return p({...n,state:!0,attribute:!1})}var at=(n,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,t),t);function ar(n,e){return(t,r,i)=>{let o=s=>s.renderRoot?.querySelector(n)??null;if(e){let{get:s,set:a}=typeof r=="object"?t:i??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return at(t,r,{get(){let l=s.call(this);return l===void 0&&(l=o(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return at(t,r,{get(){return o(this)}})}}function Vl(n){return(e,t)=>{let{slot:r,selector:i}=n??{},o="slot"+(r?`[name=${r}]`:":not([name])");return at(e,t,{get(){let s=this.renderRoot?.querySelector(o),a=s?.assignedElements(n)??[];return i===void 0?a:a.filter(l=>l.matches(i))}})}}var lr=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},zl={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},Me=class extends C{constructor(){super(...arguments),this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};lr([p({type:String})],Me.prototype,"category",void 0);lr([p({type:String})],Me.prototype,"identifier",void 0);lr([p({type:Boolean,converter:zl})],Me.prototype,"required",void 0);lr([p({type:Boolean,converter:zl})],Me.prototype,"fixed",void 0);lr([p({type:String})],Me.prototype,"href",void 0);lr([p({type:Object,attribute:!1})],Me.prototype,"xmlDoc",void 0);var lt=class extends Event{constructor(e,t,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t,this.callback=r,this.subscribe=i??!1}};var cr=class{constructor(e,t,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,s)),this.unsubscribe=s},this.host=e,t.context!==void 0){let o=t;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=t,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 lt(this.context,this.host,this.t,this.subscribe))}};var uo=class{get value(){return this.o}set value(e){this.setValue(e)}setValue(e,t=!1){let r=t||!Object.is(e,this.o);this.o=e,r&&this.updateObservers()}constructor(e){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:r}]of this.subscriptions)t(this.o,r)},e!==void 0&&(this.value=e)}addCallback(e,t,r){if(!r)return void e(this.value);this.subscriptions.has(e)||this.subscriptions.set(e,{disposer:()=>{this.subscriptions.delete(e)},consumerHost:t});let{disposer:i}=this.subscriptions.get(e);e(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Ys=class extends Event{constructor(e,t){super("context-provider",{bubbles:!0,composed:!0}),this.context=e,this.contextTarget=t}},dr=class extends uo{constructor(e,t,r){super(t.context!==void 0?t.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let o=i.contextTarget??i.composedPath()[0];o!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,o,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let o=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)o.has(s)||(o.add(s),a.dispatchEvent(new lt(this.context,a,s,!0)));i.stopPropagation()},this.host=e,t.context!==void 0?this.context=t.context:this.context=t,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 Ys(this.context,this.host))}};function B({context:n}){return(e,t)=>{let r=new WeakMap;if(typeof t=="object")return{get(){return e.get.call(this)},set(i){return r.get(this).setValue(i),e.set.call(this,i)},init(i){return r.set(this,new dr(this,{context:n,initialValue:i})),i}};{e.constructor.addInitializer((s=>{r.set(s,new dr(s,{context:n}))}));let i=Object.getOwnPropertyDescriptor(e,t),o;if(i===void 0){let s=new WeakMap;o={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;o={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(e,t,o)}}}function T({context:n,subscribe:e}){return(t,r)=>{typeof r=="object"?r.addInitializer((function(){new cr(this,{context:n,callback:i=>{t.set.call(this,i)},subscribe:e})})):t.constructor.addInitializer((i=>{new cr(i,{context:n,callback:o=>{i[r]=o},subscribe:e})}))}}var jl=[];for(let{tag:n,ctor:e}of jl)customElements.get(n)||customElements.define(n,e);var ct=Symbol("computedItemContext");var F=Symbol("computedContext");var de=Symbol("configContext");var hr=Symbol("interactionContext");var j=Symbol("item");var Fl=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Mh=/^[A-Za-z0-9-]+$/,Dh=n=>typeof n=="string"&&Mh.test(n),Of=n=>Dh(n)?n:void 0,he=Symbol("qtiContext");var Ks={view:"candidate"},Ne=Symbol("testContext");var Js={items:[],testOutcomeVariables:[]},pe=Symbol("testContext");var R=q`
5
5
  :host {
6
6
  box-sizing: border-box;
7
7
  }
@@ -11,7 +11,7 @@ Make sure to test your application with a production build as repeat registratio
11
11
  *::after {
12
12
  box-sizing: inherit;
13
13
  }
14
- `;var Ne=q`
14
+ `;var $e=q`
15
15
  [part~='drop'] {
16
16
  /*
17
17
  * The one deliberate opt-out from the border-box reset.
@@ -55,16 +55,16 @@ Make sure to test your application with a production build as repeat registratio
55
55
  [part~='message'] {
56
56
  display: none;
57
57
  }
58
- `;var Nt=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},D=class extends C{#e;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 e=this._context.variables.filter(r=>r.type==="response"),t=this.getAttribute("response-identifier");return e.find(r=>r.identifier===t)}get value(){return JSON.stringify(this.response)}set value(e){this.response=e?JSON.parse(e):null}reportValidity(){let e=this._internals.validity.valid,t=this.validationDisplayMode;return(t==="native"||t==="both")&&this._internals.reportValidity(),t==="inline"||t==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),t==="none"&&this.clearInlineValidationMessage(),e}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(e){let t=e?.defaultWhenUnset??!0,r=this.configContext;return r&&r.allowReorder!==void 0?r.allowReorder:t}resolveDisableAfterMaxReached(e){let t=e?.defaultWhenUnset??!1,r=this.configContext;return r?r.disableAfterMaxReached!==void 0?r.disableAfterMaxReached:r.disableAfterIfMaxChoicesReached!==void 0?(this.#e||(this.#e=!0,console.log("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),r.disableAfterIfMaxChoicesReached):t:t}setInteractionValidity(e,t="",r,i){let o=r??this;this._internals.setValidity(e?{}:{customError:!0},t,o),i?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let e=this.getValidationMessageElement();if(e){if(!this._internals.validity.valid){e.textContent=this._internals.validationMessage,e.style.setProperty("display","block","important");return}e.textContent="",e.style.display="none"}}clearInlineValidationMessage(){let e=this.getValidationMessageElement();e&&(e.textContent="",e.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.response=null}formResetCallback(){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(e,t){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e,...t!==void 0?{state:t}:{}}}))}constructor(){super(),this.#e=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._internals=this.attachInternals()}firstUpdated(e){}};Nt([T({context:j,subscribe:!0})],D.prototype,"_context",void 0);Nt([T({context:de,subscribe:!0})],D.prototype,"configContext",void 0);Nt([B({context:dr})],D.prototype,"_interactionContext",void 0);Nt([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Nt([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Nt([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Nt([p({type:String})],D.prototype,"name",void 0);var hr=class extends C{render(){return b`<slot></slot>`}defaultValues(e){let t=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(t.length===0)return null;let r=t.map(i=>i.innerHTML.trim());return r.length>1||e==="multiple"||e==="ordered"?r:r[0]}};var Zs=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},k=class extends C{constructor(){super(...arguments),this.getVariables=()=>Array.from(this.children).map(e=>{switch(console.debug("getVariables",e.tagName.toLowerCase()),e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return t==="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.context.variables.find(i=>i.identifier===t)||null}case"qti-multiple":{let r=e.getResult();return console.debug("values",r),r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(i=>i.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(i=>i.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let r=e.getResult();return r?.length>0?r:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",r=this.context?.variables?.find(i=>i.identifier===t)||null;return{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}}default:{try{return{baseType:"integer",value:e.getResult()?.toString()||null,cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null)}static{this.styles=q`
58
+ `;var $t=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},D=class extends C{#e;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 e=this._context.variables.filter(r=>r.type==="response"),t=this.getAttribute("response-identifier");return e.find(r=>r.identifier===t)}get value(){return JSON.stringify(this.response)}set value(e){this.response=e?JSON.parse(e):null}reportValidity(){let e=this._internals.validity.valid,t=this.validationDisplayMode;return(t==="native"||t==="both")&&this._internals.reportValidity(),t==="inline"||t==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),t==="none"&&this.clearInlineValidationMessage(),e}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(e){let t=e?.defaultWhenUnset??!0,r=this.configContext;return r&&r.allowReorder!==void 0?r.allowReorder:t}resolveDisableAfterMaxReached(e){let t=e?.defaultWhenUnset??!1,r=this.configContext;return r?r.disableAfterMaxReached!==void 0?r.disableAfterMaxReached:r.disableAfterIfMaxChoicesReached!==void 0?(this.#e||(this.#e=!0,console.log("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),r.disableAfterIfMaxChoicesReached):t:t}setInteractionValidity(e,t="",r,i){let o=r??this;this._internals.setValidity(e?{}:{customError:!0},t,o),i?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let e=this.getValidationMessageElement();if(e){if(!this._internals.validity.valid){e.textContent=this._internals.validationMessage,e.style.setProperty("display","block","important");return}e.textContent="",e.style.display="none"}}clearInlineValidationMessage(){let e=this.getValidationMessageElement();e&&(e.textContent="",e.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.response=null}formResetCallback(){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(e,t){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e,...t!==void 0?{state:t}:{}}}))}constructor(){super(),this.#e=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._internals=this.attachInternals()}firstUpdated(e){}};$t([T({context:j,subscribe:!0})],D.prototype,"_context",void 0);$t([T({context:de,subscribe:!0})],D.prototype,"configContext",void 0);$t([B({context:hr})],D.prototype,"_interactionContext",void 0);$t([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);$t([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);$t([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);$t([p({type:String})],D.prototype,"name",void 0);var pr=class extends C{render(){return b`<slot></slot>`}defaultValues(e){let t=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(t.length===0)return null;let r=t.map(i=>i.innerHTML.trim());return r.length>1||e==="multiple"||e==="ordered"?r:r[0]}};var Zs=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},k=class extends C{constructor(){super(...arguments),this.getVariables=()=>Array.from(this.children).map(e=>{switch(console.debug("getVariables",e.tagName.toLowerCase()),e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return t==="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.context.variables.find(i=>i.identifier===t)||null}case"qti-multiple":{let r=e.getResult();return console.debug("values",r),r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(i=>i.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(i=>i.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let r=e.getResult();return r?.length>0?r:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",r=this.context?.variables?.find(i=>i.identifier===t)||null;return{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}}default:{try{return{baseType:"integer",value:e.getResult()?.toString()||null,cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null)}static{this.styles=q`
59
59
  slot {
60
60
  display: none;
61
61
  }
62
62
  `}render(){return b`<pre>${JSON.stringify(this.result,null,2)}</pre>
63
- <slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};Zs([_()],k.prototype,"result",void 0);Zs([T({context:j,subscribe:!0}),_()],k.prototype,"context",void 0);Zs([T({context:he,subscribe:!0}),_()],k.prototype,"qtiContext",void 0);var ue=class extends k{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Nh=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),xe=n=>{if(typeof n=="string")return n;let e=Nh();return e==="."?n.toLocaleString():n.toString().replace(".","").replace(e,".")};function ea(n){return n==null}function mo(n){return n.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var li=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},le=class extends C{constructor(){super(...arguments),this.showHide="show"}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e){let t=this._context.variables.find(i=>i.identifier===e)||null;if(this.outcomeIdentifier!==e||!t)return;let r=!1;Array.isArray(t.value)?r=t.value.includes(this.identifier):r=!ea(this.identifier)&&!ea(t?.value)&&this.identifier===t.value||!1,this.#e(r)}#e(e){this.showStatus=e&&this.showHide==="show"||!e&&this.showHide==="hide"?"on":"off"}};li([p({type:String,attribute:"show-hide"})],le.prototype,"showHide",void 0);li([p({type:String,attribute:"outcome-identifier"})],le.prototype,"outcomeIdentifier",void 0);li([p({type:String})],le.prototype,"identifier",void 0);li([p({type:String,attribute:!1})],le.prototype,"showStatus",void 0);li([T({context:j,subscribe:!0}),_()],le.prototype,"_context",void 0);function ta(n){if(n==null)return null;if(!n.includes(",")){let t=n.trim();return t.length>0?t:null}let e=n.split(",").map(t=>t.trim()).filter(t=>t.length>0);return e.length===0?null:e.length===1?e[0]:e}function ra(n){if(n==null)return null;if(Array.isArray(n)){let t=n.map(r=>r.trim()).filter(r=>r.length>0);return t.length>0?t.join(","):null}let e=n.trim();return e.length>0?e:null}function*mg(n){if(n!=null){if(Array.isArray(n)){for(let e of n){let t=e.trim();t&&(yield t)}return}if(!n.includes(",")){let e=n.trim();e&&(yield e);return}for(let e of n.split(",")){let t=e.trim();t&&(yield t)}}}function fg(n){let[e,t,...r]=n.trim().split(/\s+/);if(!e||!t||r.length>0)throw new Error(`malformed directed-pair value: "${n}" (expected "source target")`);return{source:e,target:t}}function gg(n,e){return`${n} ${e}`}function bg(n){let[e,t,...r]=n.trim().split(/\s+/),i=Number(e),o=Number(t);if(!Number.isFinite(i)||!Number.isFinite(o)||r.length>0)throw new Error(`malformed point value: "${n}" (expected "x y" numeric coords)`);return{x:i,y:o}}function yg(n,e){return`${n} ${e}`}function $e(n){let{emptyAs:e}=n,t=r=>r===e||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=ta(r);return i===null?e:i},toAttribute:r=>t(r)?null:ra(r)}}var Bl=class extends C{};var J=class{static isPointInArea(e,t,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,o]=e.split(" ").map(Number),[s,...a]=t.split(","),l=a.map(Number);switch(s.toLowerCase()){case"circle":case"default":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${t}`),!1):Math.sqrt((i-c)**2+(o-d)**2)<=h}case"rect":{let[c,d,h,g]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${t}`),!1):i>=c&&i<=h&&o>=d&&o<=g}case"ellipse":{let[c,d,h,g]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${t}`),!1;let f=(i-c)**2/h**2,w=(o-d)**2/g**2;return f+w<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${t}`),!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:i,y:o},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(e,t){let r=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let s=t[i].x,a=t[i].y,l=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(l-s)*(e.y-a)/(c-a)+s&&(r=!r)}return r}static compareSingleValues(e,t,r){switch(r){case"identifier":case"string":return e===t;case"integer":{let i=parseInt(e,10),o=parseInt(t,10);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`Cannot convert ${e} and/or ${t} to int.`);break}case"float":{let i=parseFloat(e),o=parseFloat(t);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`couldn't convert ${e} and/or ${t} to float.`);break}case"pair":case"directedPair":{let i=e.split(" ").sort(),o=t.split(" ").sort();if(i.length===2&&o.length===2)return r==="pair"&&(i.sort(),o.sort()),i.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${e} 2: ${t}`);break}}return!1}};var pr=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ia={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},Le=class extends C{get title(){return this.#e}set title(e){this.#e=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}#e="";async connectedCallback(){this.#e=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return b`<slot name="qti-rubric-block"></slot><slot></slot>`}};pr([p({type:String})],Le.prototype,"identifier",void 0);pr([p({type:String})],Le.prototype,"required",void 0);pr([p({type:Boolean,converter:ia})],Le.prototype,"fixed",void 0);pr([p({type:Boolean,converter:ia})],Le.prototype,"visible",void 0);pr([p({type:Boolean,converter:ia,attribute:"keep-together"})],Le.prototype,"keepTogether",void 0);pr([T({context:pe,subscribe:!0})],Le.prototype,"_testContext",void 0);var oa=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},$t=class extends C{get title(){return this.#e}set title(e){this.#e=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}#e="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};oa([p({type:String})],$t.prototype,"identifier",void 0);oa([p({type:String})],$t.prototype,"title",null);oa([T({context:pe,subscribe:!0})],$t.prototype,"_testContext",void 0);var fo=class extends C{static{this.styles=[q`
63
+ <slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};Zs([_()],k.prototype,"result",void 0);Zs([T({context:j,subscribe:!0}),_()],k.prototype,"context",void 0);Zs([T({context:he,subscribe:!0}),_()],k.prototype,"qtiContext",void 0);var ue=class extends k{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Nh=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),qe=n=>{if(typeof n=="string")return n;let e=Nh();return e==="."?n.toLocaleString():n.toString().replace(".","").replace(e,".")};function ea(n){return n==null}function mo(n){return n.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var li=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},le=class extends C{constructor(){super(...arguments),this.showHide="show"}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e){let t=this._context.variables.find(i=>i.identifier===e)||null;if(this.outcomeIdentifier!==e||!t)return;let r=!1;Array.isArray(t.value)?r=t.value.includes(this.identifier):r=!ea(this.identifier)&&!ea(t?.value)&&this.identifier===t.value||!1,this.#e(r)}#e(e){this.showStatus=e&&this.showHide==="show"||!e&&this.showHide==="hide"?"on":"off"}};li([p({type:String,attribute:"show-hide"})],le.prototype,"showHide",void 0);li([p({type:String,attribute:"outcome-identifier"})],le.prototype,"outcomeIdentifier",void 0);li([p({type:String})],le.prototype,"identifier",void 0);li([p({type:String,attribute:!1})],le.prototype,"showStatus",void 0);li([T({context:j,subscribe:!0}),_()],le.prototype,"_context",void 0);function ta(n){if(n==null)return null;if(!n.includes(",")){let t=n.trim();return t.length>0?t:null}let e=n.split(",").map(t=>t.trim()).filter(t=>t.length>0);return e.length===0?null:e.length===1?e[0]:e}function ra(n){if(n==null)return null;if(Array.isArray(n)){let t=n.map(r=>r.trim()).filter(r=>r.length>0);return t.length>0?t.join(","):null}let e=n.trim();return e.length>0?e:null}function*mg(n){if(n!=null){if(Array.isArray(n)){for(let e of n){let t=e.trim();t&&(yield t)}return}if(!n.includes(",")){let e=n.trim();e&&(yield e);return}for(let e of n.split(",")){let t=e.trim();t&&(yield t)}}}function fg(n){let[e,t,...r]=n.trim().split(/\s+/);if(!e||!t||r.length>0)throw new Error(`malformed directed-pair value: "${n}" (expected "source target")`);return{source:e,target:t}}function gg(n,e){return`${n} ${e}`}function bg(n){let[e,t,...r]=n.trim().split(/\s+/),i=Number(e),o=Number(t);if(!Number.isFinite(i)||!Number.isFinite(o)||r.length>0)throw new Error(`malformed point value: "${n}" (expected "x y" numeric coords)`);return{x:i,y:o}}function yg(n,e){return`${n} ${e}`}function Le(n){let{emptyAs:e}=n,t=r=>r===e||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=ta(r);return i===null?e:i},toAttribute:r=>t(r)?null:ra(r)}}var Bl=class extends C{};var J=class{static isPointInArea(e,t,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,o]=e.split(" ").map(Number),[s,...a]=t.split(","),l=a.map(Number);switch(s.toLowerCase()){case"circle":case"default":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${t}`),!1):Math.sqrt((i-c)**2+(o-d)**2)<=h}case"rect":{let[c,d,h,g]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${t}`),!1):i>=c&&i<=h&&o>=d&&o<=g}case"ellipse":{let[c,d,h,g]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${t}`),!1;let m=(i-c)**2/h**2,w=(o-d)**2/g**2;return m+w<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${t}`),!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:i,y:o},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(e,t){let r=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){let s=t[i].x,a=t[i].y,l=t[o].x,c=t[o].y;a>e.y!=c>e.y&&e.x<(l-s)*(e.y-a)/(c-a)+s&&(r=!r)}return r}static compareSingleValues(e,t,r){switch(r){case"identifier":case"string":return e===t;case"integer":{let i=parseInt(e,10),o=parseInt(t,10);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`Cannot convert ${e} and/or ${t} to int.`);break}case"float":{let i=parseFloat(e),o=parseFloat(t);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`couldn't convert ${e} and/or ${t} to float.`);break}case"pair":case"directedPair":{let i=e.split(" ").sort(),o=t.split(" ").sort();if(i.length===2&&o.length===2)return r==="pair"&&(i.sort(),o.sort()),i.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${e} 2: ${t}`);break}}return!1}};var dt=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ia={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},me=class extends C{get title(){return this.#e}set title(e){this.#e=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}#e="";async connectedCallback(){this.#e=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return b`<slot name="qti-rubric-block"></slot><slot></slot>`}};dt([p({type:String})],me.prototype,"identifier",void 0);dt([p({type:String})],me.prototype,"required",void 0);dt([p({type:Boolean,converter:ia})],me.prototype,"fixed",void 0);dt([p({type:Boolean,converter:ia})],me.prototype,"visible",void 0);dt([p({type:Boolean,converter:ia,attribute:"keep-together"})],me.prototype,"keepTogether",void 0);dt([p({type:String,attribute:"navigation-mode"})],me.prototype,"navigationMode",void 0);dt([p({type:String,attribute:"submission-mode"})],me.prototype,"submissionMode",void 0);dt([T({context:pe,subscribe:!0})],me.prototype,"_testContext",void 0);var oa=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Lt=class extends C{get title(){return this.#e}set title(e){this.#e=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}#e="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};oa([p({type:String})],Lt.prototype,"identifier",void 0);oa([p({type:String})],Lt.prototype,"title",null);oa([T({context:pe,subscribe:!0})],Lt.prototype,"_testContext",void 0);var fo=class extends C{static{this.styles=[q`
64
64
  :host {
65
65
  display: none;
66
66
  }
67
- `]}render(){return b`<slot></slot>`}process(){let e=new na,t=[...this.children];e.process(t)}},na=class{process(e){for(let t of e)t.process()}};function $(n,e){let t={waitUntilFirstUpdate:!1,...e};return(r,i)=>{let{update:o}=r,s=Array.isArray(n)?n:[n];r.update=function(a){s.forEach(l=>{let c=l;if(a.has(c)){let d=a.get(c),h=this[c];d!==h&&(!t.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,h)}}),o.call(this,a)}}}var ur={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},qe=n=>(...e)=>({_$litDirective$:n,values:e}),dt=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:$h}=K,Ul=n=>n,Wl=n=>n===null||typeof n!="object"&&typeof n!="function";var Ql=n=>n.strings===void 0,Hl=()=>document.createComment(""),mr=(n,e,t)=>{let r=n._$AA.parentNode,i=e===void 0?n._$AB:e._$AA;if(t===void 0){let o=r.insertBefore(Hl(),i),s=r.insertBefore(Hl(),i);t=new $h(o,s,n,n.options)}else{let o=t._$AB.nextSibling,s=t._$AM,a=s!==n;if(a){let l;t._$AQ?.(n),t._$AM=n,t._$AP!==void 0&&(l=n._$AU)!==s._$AU&&t._$AP(l)}if(o!==i||a){let l=t._$AA;for(;l!==o;){let c=Ul(l).nextSibling;Ul(r).insertBefore(l,i),l=c}}}return t},ht=(n,e,t=n)=>(n._$AI(e,t),n),Lh={},Gl=(n,e=Lh)=>n._$AH=e,Xl=n=>n._$AH,go=n=>{n._$AR(),n._$AA.remove()};var ci=(n,e)=>{let t=n._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),ci(r,e);return!0},bo=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while(t?.size===0)},Yl=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),jh(e)}};function Vh(n){this._$AN!==void 0?(bo(this),this._$AM=n,Yl(this)):this._$AM=n}function zh(n,e=!1,t=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let o=t;o<r.length;o++)ci(r[o],!1),bo(r[o]);else r!=null&&(ci(r,!1),bo(r));else ci(this,n)}var jh=n=>{n.type==ur.CHILD&&(n._$AP??=zh,n._$AQ??=Vh)},pt=class extends dt{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),Yl(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(ci(this,e),bo(this))}setValue(e){if(Ql(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var sa=class extends pt{constructor(){super(...arguments),this.prevData={}}render(e){return P}update(e,[t]){return this.element!==e.element&&(this.element=e.element),this.host=e.options?.host||this.element,this.apply(t),this.groom(t),this.prevData={...t},P}apply(e){let t=this.#e(e),{prevData:r,element:i}=this;for(let o in t){let s=t[o];s!==r[o]&&(s===!0?i.setAttribute(o,""):s===!1?i.removeAttribute(o):s!=null?i.setAttribute(o,String(s)):i.removeAttribute(o))}}groom(e){let{prevData:t,element:r}=this;if(!t)return;let i=e?this.#e(e):{};for(let o in t)(!i||!(o in i))&&r.removeAttribute(o)}#e(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>typeof r=="function"?!1:t==="max-choices"&&r===0?!0:!(r===""||r===null||r===void 0)))}},Tb=qe(sa);var Xe=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},te=class extends C{constructor(){super(...arguments),this.#t=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._handleDisabledChange=(e,t)=>{this.interactionElements.forEach(r=>r.disabled=t)},this._handleReadonlyChange=(e,t)=>this.interactionElements.forEach(r=>r.readonly=t),this._context={variables:Fl},this.#r={...this._context,variables:this._context.variables},this.#i=[],this.interactionElements=[],this.#s=e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},this.#r=this._context,e.stopPropagation()},this.#a=e=>{e.stopImmediatePropagation();let t=e.detail;this.#i.push(t),(Number(this._context.variables.find(i=>i.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)},this.#l=e=>{e.stopImmediatePropagation(),this.interactionElements.push(e.detail.interactionElement)},this.#h=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:r}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(r)},this.#c=e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:r}=e.detail;this.updateOutcomeVariable(t,r),e.stopPropagation()},this.#u=e=>{e.stopImmediatePropagation();let{templateIdentifier:t,value:r}=e.detail;this.updateTemplateVariable(t,r??void 0),e.stopPropagation()},this.#d=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,value:r}=e.detail;this.updateCorrectResponse(t,r??void 0),e.stopPropagation()},this.#p=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:r,state:i}=e.detail;this.updateResponseVariable(t,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[t]:i}}),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#e;#t;get title(){return this.#e}set title(e){this.#e=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let r=e.find(i=>i.identifier===t.identifier);return r?{...t,...r,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let r=this.interactionElements.find(i=>i.responseIdentifier===t.identifier);r&&(r.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&this.#i.forEach(r=>r.checkShowFeedback(t.identifier))})}get state(){return this._context.state}set state(e){this._context={...this._context,state:e?{...e}:void 0}}#r;#i;set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let i=this.interactionElements.find(o=>o.getAttribute("response-identifier")===t.responseIdentifier);i&&(i.response=t.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#n(),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#m()})}disconnectedCallback(){this.#o(),super.disconnectedCallback()}#n(){this.addEventListener("qti-register-variable",this.#s),this.addEventListener("qti-register-feedback",this.#a),this.addEventListener("qti-register-interaction",this.#l),this.addEventListener("end-attempt",this.#h),this.addEventListener("qti-set-outcome-value",this.#c),this.addEventListener("qti-set-template-value",this.#u),this.addEventListener("qti-set-correct-response",this.#d),this.addEventListener("qti-interaction-response",this.#p)}#o(){this.removeEventListener("qti-register-variable",this.#s),this.removeEventListener("qti-register-feedback",this.#a),this.removeEventListener("qti-register-interaction",this.#l),this.removeEventListener("end-attempt",this.#h),this.removeEventListener("qti-set-outcome-value",this.#c),this.removeEventListener("qti-set-template-value",this.#u),this.removeEventListener("qti-set-correct-response",this.#d),this.removeEventListener("qti-interaction-response",this.#p)}#s;#a;#l;#h;#c;#u;#d;#p;async#m(){let e=Array.from(this.querySelectorAll("qti-template-declaration"));e.length>0&&(await Promise.all(e.map(t=>t.updateComplete)),await Promise.resolve()),this.#t=this.querySelector("qti-template-processing"),this.#t&&(this.#t.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(o=>o.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#f();let r=this.querySelector("qti-response-processing"),i=!!(r&&typeof r.process=="function");return i&&r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#b()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),i}resetResponses(){this._context=this.#r}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}afterResponseVariableUpdated(){}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==e?r:{...r,value:t})},this.afterResponseVariableUpdated(),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#b())}updateTemplateVariable(e,t){let r=this._context.variables.find(o=>o.identifier===e&&o.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${e}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(t)?t[0]:t??null:t==null?null:Array.isArray(t)?t:[t];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==e?o:{...o,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(e,t){let r=this.getResponse(e);if(!r){console.warn(`Can not set correct response for identifier: ${e}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(t)?t[0]:t??null:t==null?null:Array.isArray(t)?t:[t];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==e?o:{...o,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){let r=this.getOutcome(e);if(!r){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:r.cardinality==="single"||Array.isArray(t)?t:[t]})},this.#i.forEach(i=>i.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(i=>i.identifier===e)?.value}}))}validate(e=!0){let t=this.interactionElements.every(r=>r.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of this.interactionElements)e.reportValidity()}#b(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"}#f(){this._context={...this._context,variables:this._context.variables.map(e=>{if(e.type!=="outcome")return e;let i=("defaultValue"in e?e.defaultValue:null)??null;return i==null&&(e.baseType==="integer"||e.baseType==="float")&&(i="0"),{...e,value:i}})}}};Xe([p({type:String})],te.prototype,"identifier",void 0);Xe([p({type:String})],te.prototype,"adaptive",void 0);Xe([p({type:String})],te.prototype,"timeDependent",void 0);Xe([p({type:String})],te.prototype,"title",null);Xe([p({type:Boolean})],te.prototype,"disabled",void 0);Xe([$("disabled",{waitUntilFirstUpdate:!0})],te.prototype,"_handleDisabledChange",void 0);Xe([p({type:Boolean})],te.prototype,"readonly",void 0);Xe([$("readonly",{waitUntilFirstUpdate:!0})],te.prototype,"_handleReadonlyChange",void 0);Xe([B({context:j})],te.prototype,"_context",void 0);function Kl(n){n.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(t=>{let r=document.createComment(t.textContent);t.replaceChild(r,t.firstChild)})}async function Jl(n,e,t,r="qti-portable-custom-interaction"){let i=[],o=n.querySelectorAll(r);if(o.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await t(e,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await t(e,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(o)){c.setAttribute("data-base-url",e);let d=c.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,c.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let g=h.getAttribute("primary-configuration");if(g)try{let f=await t(e,`/${g}`),w=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of w){let m=x.getAttribute("id");if(m&&f.paths&&f.paths[m]){let u=f.paths[m],y=Array.isArray(u)?u[0]:u;if(x.setAttribute("primary-path",y),a&&a.paths&&a.paths[m]){let v=a.paths[m];Array.isArray(v)?x.setAttribute("fallback-path",v[0]):x.setAttribute("fallback-path",v)}}}if(f.paths){for(let x in f.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let u=n.createElement("qti-interaction-module");u.setAttribute("id",x);let y=Array.isArray(f.paths[x])?f.paths[x][0]:f.paths[x];if(u.setAttribute("primary-path",y),a&&a.paths&&a.paths[x]){let v=a.paths[x];Array.isArray(v)?u.setAttribute("fallback-path",v[0]):u.setAttribute("fallback-path",v)}h.appendChild(u)}}f.urlArgs&&h.setAttribute("url-args",f.urlArgs)}catch(f){console.warn(`Failed to load primary configuration: ${g}`,f)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=n.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let g in s.paths){let f=s.paths[g],w="";a&&a.paths&&a.paths[g]&&(w=a.paths[g]);let x=Array.isArray(f)?f:[f],m=Array.isArray(w)?w:[w],u=x.map((y,v)=>{let A=m.length>v?m[v]:"";return{primaryPath:y,fallbackPath:A}});for(let y of m)u.some(v=>v.fallbackPath===y)||u.push({primaryPath:x.length>0?x[0]:y,fallbackPath:y});for(let y of u){let v=n.createElement("qti-interaction-module");y.fallbackPath&&v.setAttribute("fallback-path",y.fallbackPath),v.setAttribute("id",g),v.setAttribute("primary-path",y.primaryPath),h&&h.appendChild(v)}}}}}function Zl(n,e,t){Array.from(n.getElementsByTagName("*")).filter(o=>o.localName===e||o.localName?.toLowerCase()===e.toLowerCase()).forEach(o=>{let s=`${e}-${t}`,a=tc(o,s);o.replaceWith(a)})}function ec(n,e){n.querySelectorAll("*").forEach(t=>{let r=t.classList;r&&r.forEach(i=>{if(i.startsWith(`${e}:`)){let o=i.slice(`${e}:`.length),s=`${t.nodeName}-${o}`,a=tc(t,s);t.replaceWith(a)}})})}function tc(n,e){let t=n.ownerDocument.createElement(e);for(let r of n.attributes)t.setAttribute(r.name,r.value);for(;n.firstChild;)t.appendChild(n.firstChild);return t}function rc(n,e){let t=["hook","module"],r=e.substring(0,e.lastIndexOf("/"));for(let i of t)n.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",e),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var aa=class n{#e;constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(e.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let t=new Uint8Array(32);t.set(e,32-e.length),this.#e=Bh(t)}static fromSeed(e){if(e.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new n(e)}static fromFixed(e){if(typeof e!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(e)||e<0||e>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let t=new Uint8Array(32);return t[31]=e,new n(t)}static fromSeedKey(e){let t=new n(new Uint8Array);return t.#e=Fh(`${e}`),t}random(){this.#e|=0,this.#e=this.#e+1831565813|0;let e=Math.imul(this.#e^this.#e>>>15,1|this.#e);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}};function yo(n){return aa.fromSeedKey(n)}function Fh(n){let e=1779033703^n.length;for(let t=0;t<n.length;t++)e=Math.imul(e^n.charCodeAt(t),3432918353),e=e<<13|e>>>19;return ic(e)}function Bh(n){let e=1779033703^n.length;for(let t=0;t<n.length;t++)e=Math.imul(e^n[t],3432918353),e=e<<13|e>>>19;return ic(e)}function ic(n){let e=Math.imul(n^n>>>16,2246822507);return e=Math.imul(e^e>>>13,3266489909),(e^e>>>16)>>>0}var Uh=n=>typeof n=="function"?n():n.random();function vo(n,e){let t=n.filter(i=>!i.fixed);for(let i=t.length-1;i>0;i--){let o=Math.floor(Uh(e)*(i+1));[t[i],t[o]]=[t[o],t[i]]}let r=0;return n.map(i=>i.fixed?i:t[r++])}function Hh(n){switch(n){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 la(n,e){let t=n.querySelectorAll('[shuffle="true"]'),r=Array.from(t).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=e!=null&&`${e}`.length>0,o=n.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=Hh(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,g=0;for(let f of d){if(!f)continue;let w=i?yo(`${e}:${o}:${l}:${g}`):Math.random;g++;let x=Array.from(a.querySelectorAll(f)).filter(v=>v.parentElement!==null);if(x.filter(v=>v.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let m=x[0].parentElement;if(!m||x.some(v=>v.parentElement!==m)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let u=x[x.length-1].nextSibling,y=vo(x.map(v=>({element:v,fixed:v.getAttribute("fixed")==="true"})),w);for(let v of x)v.remove();for(let{element:v}of y)m.insertBefore(v,u);h=!0}h&&a.removeAttribute("shuffle")}}function oc(n){n.querySelectorAll("qti-stylesheet").forEach(e=>e.remove())}var nc=!1;function wo(n,e){nc||(nc=!0,console.warn(`[${n}] No QTI_CONTEXT.seed provided; using "${e}" as deterministic fallback seed.`))}function fr(n,e){return fetch(n,{signal:e}).then(t=>{if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.text()}).then(t=>new DOMParser().parseFromString(t,"text/xml")).catch(t=>{throw t.name==="AbortError"?t:new Error(`Failed to load XML: ${t.message}`)})}function gr(n){return new DOMParser().parseFromString(n,"text/xml")}function sc(n,e,t){if(n.nodeType===Node.ELEMENT_NODE){let r=n,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=t?e.createElement(r.localName,{customElementRegistry:t}):e.createElement(r.localName):i=e.createElementNS(r.namespaceURI,r.tagName);for(let o=0;o<r.attributes.length;o++){let s=r.attributes[o];i.setAttribute(s.localName,s.value)}for(let o=0;o<r.childNodes.length;o++)i.appendChild(sc(r.childNodes[o],e,t));return i}return n.cloneNode(!1)}function br(n,e){let t=document.createDocumentFragment();for(let r=0;r<n.childNodes.length;r++)t.appendChild(sc(n.childNodes[r],document,e));return t}function yr(n,e){e.endsWith("/")||(e+="/"),n.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let o=r.getAttribute(i)?.trim();if(o&&!/^(data:|https?:|blob:)/.test(o)){let s=e+encodeURI(o);r.setAttribute(i,s)}}})}var Ve=()=>{let n,e="",t={load(r,i){return e=r,fr(r,i).then(o=>(n=o,t))},parse(r){return n=gr(r),e="",t},path:r=>(yr(n,r),e=null,t),fn(r){return r(n),t},pciHooks(r){return rc(n,r),t},async configurePci(r,i,o="qti-portable-custom-interaction"){return await Jl(n,r,i,o),t},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let o=e||"default-item-seed";return wo("qtiTransformItem",o),la(n,o),t}return la(n,i),t},extendElementName:(r,i)=>(Zl(n,r,i),t),extendElementsWithClass:(r="extend")=>(ec(n,r),t),customInteraction(r,i){let o=n.querySelector("qti-custom-interaction"),s=o.querySelector("object");return o.setAttribute("data-base-ref",r),o.setAttribute("data-base-item",r+i),o.setAttribute("data",s.getAttribute("data")),o.setAttribute("width",s.getAttribute("width")),o.setAttribute("height",s.getAttribute("height")),o.removeChild(s),t},convertCDATAtoComment(){return Kl(n),t},stripStyleSheets(){return oc(n),t},html(){return e!==null&&yr(n,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(br(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(r){return e!==null&&yr(n,e.substring(0,e.lastIndexOf("/"))),br(n,r)},xmlDoc(){return n}};return t};var ac=()=>{let n,e={async load(t,r){return new Promise(i=>{fr(t,r).then(o=>(n=o,i(e)))})},parse(t){n=gr(t)},assessmentTest(){let t=n.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:t.getAttribute("href"),identifier:t.getAttribute("identifier")}}};return e};function lc(n){let e=[];return n.querySelectorAll("qti-assessment-item-ref").forEach(t=>{let r=t.getAttribute("identifier"),i=t.getAttribute("href"),o=t.getAttribute("category");e.push({identifier:r,href:i,category:o})}),e}var xo=(n,...e)=>e.includes(n.localName)||e.includes(n.localName?.toLowerCase?.()),cc=n=>xo(n,"qti-assessment-item-ref","assessmentitemref"),hi=n=>xo(n,"qti-assessment-section","assessmentsection"),di=(n,...e)=>e.some(t=>{let r=(n.getAttribute(t)??"").trim().toLowerCase();return r==="true"||r==="1"}),Wh=(n,...e)=>e.some(t=>{let r=(n.getAttribute(t)??"").trim().toLowerCase();return r==="false"||r==="0"}),ca=n=>xo(n,"qti-ordering","ordering"),Qh=n=>xo(n,"qti-selection","selection"),Gh=n=>Array.from(n.children).filter(e=>ca(e)&&di(e,"shuffle")),Xh=(n,e)=>yo(`${n}:${e}`);function Yh(n){let e=[],t=[],r=i=>{for(let o of Array.from(i.children))cc(o)?e.push(o):hi(o)?r(o):!ca(o)&&!Qh(o)&&t.push(o.localName)};return r(n),{itemRefs:e,dropped:t}}function Kh(n,e){if(e.length===0)return;let t=n.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${t}" is consumed by section ordering; discarding its ${[...new Set(e)].join(", ")}.`)}function dc(n,e){for(let l of Array.from(n.children))hi(l)&&dc(l,e);let t=Gh(n);if(t.length===0)return;let r=[],i=[];for(let l of Array.from(n.children))if(cc(l))r.push({nodes:[l],fixed:di(l,"fixed")}),i.push(l);else if(hi(l)){let{itemRefs:c,dropped:d}=Yh(l);if(Kh(l,d),Wh(l,"keep-together","keeptogether"))for(let h of c)r.push({nodes:[h],fixed:di(h,"fixed")});else c.length>0&&r.push({nodes:c,fixed:di(l,"fixed")});i.push(l)}let o=i.length>0?i[i.length-1].nextSibling:null,s=n.getAttribute("identifier")??"",a=vo(r,Xh(e,s));for(let l of i)l.remove();for(let l of a)for(let c of l.nodes)n.insertBefore(c,o);for(let l of t)l.remove()}function hc(n){return Array.from(n.getElementsByTagName("*")).some(e=>ca(e)&&di(e,"shuffle"))}function da(n,e){let t=Array.from(n.getElementsByTagName("*")).filter(r=>hi(r));for(let r of t){if(!r.parentNode)continue;let i=r.parentElement;i&&hi(i)||dc(r,e)}}var vr=()=>{let n,e="",t={async load(r,i){return new Promise((o,s)=>{fr(r,i).then(a=>(n=a,e=r,t.path(r.substring(0,r.lastIndexOf("/"))),o(t)))})},parse(r){return n=gr(r),e="",t},path:r=>(yr(n,r),t),fn(r){return r(n),t},shuffleOrdering(r){if(!hc(n))return t;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let o=e||"default-test-seed";return wo("qtiTransformTest",o),da(n,o),t}return da(n,i),t},items(){return lc(n)},html(){return new XMLSerializer().serializeToString(br(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(r){return br(n,r)},xmlDoc(){return n}};return t};var pc=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ha=class n extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(e,t){super(n.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=e,this.item=t}},wr=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let e=this.closest("qti-assessment-item"),t=new ha(this,e);this.dispatchEvent(t);let r=e?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!t.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(e){let t=await Ve().load(this.href).then(r=>r.htmlDoc());if(t){let r=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...r)}}};pc([p({type:String})],wr.prototype,"identifier",void 0);pc([p({type:String})],wr.prototype,"href",void 0);var qo=class extends C{};var Jh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},pi=class extends C{render(){return b`<slot @slotchange=${this.#e}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#e())}updated(e){e.has("context")&&this.#e()}#e(){let e=new Map,t=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of t){let o=i;o.mathVariable!==!0||o.value===null||o.value===void 0||e.set(o.identifier,this.#t(o.value))}if(e.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 o=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=e.get(o);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",o);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",o),i.replaceWith(a)}}#t(e){return Array.isArray(e)?e.join(" "):e?.toString()??""}};Jh([T({context:j,subscribe:!0}),_()],pi.prototype,"context",void 0);var uc=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},xr=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
67
+ `]}render(){return b`<slot></slot>`}process(){let e=new na,t=[...this.children];e.process(t)}},na=class{process(e){for(let t of e)t.process()}};function $(n,e){let t={waitUntilFirstUpdate:!1,...e};return(r,i)=>{let{update:o}=r,s=Array.isArray(n)?n:[n];r.update=function(a){s.forEach(l=>{let c=l;if(a.has(c)){let d=a.get(c),h=this[c];d!==h&&(!t.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,h)}}),o.call(this,a)}}}var ur={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ce=n=>(...e)=>({_$litDirective$:n,values:e}),ht=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,r){this._$Ct=e,this._$AM=t,this._$Ci=r}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}};var{I:$h}=K,Ul=n=>n,Wl=n=>n===null||typeof n!="object"&&typeof n!="function";var Ql=n=>n.strings===void 0,Hl=()=>document.createComment(""),mr=(n,e,t)=>{let r=n._$AA.parentNode,i=e===void 0?n._$AB:e._$AA;if(t===void 0){let o=r.insertBefore(Hl(),i),s=r.insertBefore(Hl(),i);t=new $h(o,s,n,n.options)}else{let o=t._$AB.nextSibling,s=t._$AM,a=s!==n;if(a){let l;t._$AQ?.(n),t._$AM=n,t._$AP!==void 0&&(l=n._$AU)!==s._$AU&&t._$AP(l)}if(o!==i||a){let l=t._$AA;for(;l!==o;){let c=Ul(l).nextSibling;Ul(r).insertBefore(l,i),l=c}}}return t},pt=(n,e,t=n)=>(n._$AI(e,t),n),Lh={},Gl=(n,e=Lh)=>n._$AH=e,Xl=n=>n._$AH,go=n=>{n._$AR(),n._$AA.remove()};var ci=(n,e)=>{let t=n._$AN;if(t===void 0)return!1;for(let r of t)r._$AO?.(e,!1),ci(r,e);return!0},bo=n=>{let e,t;do{if((e=n._$AM)===void 0)break;t=e._$AN,t.delete(n),n=e}while(t?.size===0)},Yl=n=>{for(let e;e=n._$AM;n=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(n))break;t.add(n),jh(e)}};function Vh(n){this._$AN!==void 0?(bo(this),this._$AM=n,Yl(this)):this._$AM=n}function zh(n,e=!1,t=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(e)if(Array.isArray(r))for(let o=t;o<r.length;o++)ci(r[o],!1),bo(r[o]);else r!=null&&(ci(r,!1),bo(r));else ci(this,n)}var jh=n=>{n.type==ur.CHILD&&(n._$AP??=zh,n._$AQ??=Vh)},ut=class extends ht{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,r){super._$AT(e,t,r),Yl(this),this.isConnected=e._$AU}_$AO(e,t=!0){e!==this.isConnected&&(this.isConnected=e,e?this.reconnected?.():this.disconnected?.()),t&&(ci(this,e),bo(this))}setValue(e){if(Ql(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}};var sa=class extends ut{constructor(){super(...arguments),this.prevData={}}render(e){return P}update(e,[t]){return this.element!==e.element&&(this.element=e.element),this.host=e.options?.host||this.element,this.apply(t),this.groom(t),this.prevData={...t},P}apply(e){let t=this.#e(e),{prevData:r,element:i}=this;for(let o in t){let s=t[o];s!==r[o]&&(s===!0?i.setAttribute(o,""):s===!1?i.removeAttribute(o):s!=null?i.setAttribute(o,String(s)):i.removeAttribute(o))}}groom(e){let{prevData:t,element:r}=this;if(!t)return;let i=e?this.#e(e):{};for(let o in t)(!i||!(o in i))&&r.removeAttribute(o)}#e(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>typeof r=="function"?!1:t==="max-choices"&&r===0?!0:!(r===""||r===null||r===void 0)))}},Tb=Ce(sa);var Xe=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},te=class extends C{constructor(){super(...arguments),this.#t=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._handleDisabledChange=(e,t)=>{this.interactionElements.forEach(r=>r.disabled=t)},this._handleReadonlyChange=(e,t)=>this.interactionElements.forEach(r=>r.readonly=t),this._context={variables:Fl},this.#r={...this._context,variables:this._context.variables},this.#i=[],this.interactionElements=[],this.#s=e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},this.#r=this._context,e.stopPropagation()},this.#a=e=>{e.stopImmediatePropagation();let t=e.detail;this.#i.push(t),(Number(this._context.variables.find(i=>i.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)},this.#l=e=>{e.stopImmediatePropagation(),this.interactionElements.push(e.detail.interactionElement)},this.#h=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:r}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(r)},this.#c=e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:r}=e.detail;this.updateOutcomeVariable(t,r),e.stopPropagation()},this.#u=e=>{e.stopImmediatePropagation();let{templateIdentifier:t,value:r}=e.detail;this.updateTemplateVariable(t,r??void 0),e.stopPropagation()},this.#d=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,value:r}=e.detail;this.updateCorrectResponse(t,r??void 0),e.stopPropagation()},this.#p=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:r,state:i}=e.detail;this.updateResponseVariable(t,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[t]:i}}),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#e;#t;get title(){return this.#e}set title(e){this.#e=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let r=e.find(i=>i.identifier===t.identifier);return r?{...t,...r,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let r=this.interactionElements.find(i=>i.responseIdentifier===t.identifier);r&&(r.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&this.#i.forEach(r=>r.checkShowFeedback(t.identifier))})}get state(){return this._context.state}set state(e){this._context={...this._context,state:e?{...e}:void 0}}#r;#i;set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let i=this.interactionElements.find(o=>o.getAttribute("response-identifier")===t.responseIdentifier);i&&(i.response=t.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#n(),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#m()})}disconnectedCallback(){this.#o(),super.disconnectedCallback()}#n(){this.addEventListener("qti-register-variable",this.#s),this.addEventListener("qti-register-feedback",this.#a),this.addEventListener("qti-register-interaction",this.#l),this.addEventListener("end-attempt",this.#h),this.addEventListener("qti-set-outcome-value",this.#c),this.addEventListener("qti-set-template-value",this.#u),this.addEventListener("qti-set-correct-response",this.#d),this.addEventListener("qti-interaction-response",this.#p)}#o(){this.removeEventListener("qti-register-variable",this.#s),this.removeEventListener("qti-register-feedback",this.#a),this.removeEventListener("qti-register-interaction",this.#l),this.removeEventListener("end-attempt",this.#h),this.removeEventListener("qti-set-outcome-value",this.#c),this.removeEventListener("qti-set-template-value",this.#u),this.removeEventListener("qti-set-correct-response",this.#d),this.removeEventListener("qti-interaction-response",this.#p)}#s;#a;#l;#h;#c;#u;#d;#p;async#m(){let e=Array.from(this.querySelectorAll("qti-template-declaration"));e.length>0&&(await Promise.all(e.map(t=>t.updateComplete)),await Promise.resolve()),this.#t=this.querySelector("qti-template-processing"),this.#t&&(this.#t.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(o=>o.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#f();let r=this.querySelector("qti-response-processing"),i=!!(r&&typeof r.process=="function");return i&&r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#b()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),i}resetResponses(){this._context=this.#r}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}afterResponseVariableUpdated(){}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==e?r:{...r,value:t})},this.afterResponseVariableUpdated(),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#b())}updateTemplateVariable(e,t){let r=this._context.variables.find(o=>o.identifier===e&&o.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${e}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(t)?t[0]:t??null:t==null?null:Array.isArray(t)?t:[t];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==e?o:{...o,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(e,t){let r=this.getResponse(e);if(!r){console.warn(`Can not set correct response for identifier: ${e}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(t)?t[0]:t??null:t==null?null:Array.isArray(t)?t:[t];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==e?o:{...o,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){let r=this.getOutcome(e);if(!r){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:r.cardinality==="single"||Array.isArray(t)?t:[t]})},this.#i.forEach(i=>i.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(i=>i.identifier===e)?.value}}))}validate(e=!0){let t=this.interactionElements.every(r=>r.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of this.interactionElements)e.reportValidity()}#b(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"}#f(){this._context={...this._context,variables:this._context.variables.map(e=>{if(e.type!=="outcome")return e;let i=("defaultValue"in e?e.defaultValue:null)??null;return i==null&&(e.baseType==="integer"||e.baseType==="float")&&(i="0"),{...e,value:i}})}}};Xe([p({type:String})],te.prototype,"identifier",void 0);Xe([p({type:String})],te.prototype,"adaptive",void 0);Xe([p({type:String})],te.prototype,"timeDependent",void 0);Xe([p({type:String})],te.prototype,"title",null);Xe([p({type:Boolean})],te.prototype,"disabled",void 0);Xe([$("disabled",{waitUntilFirstUpdate:!0})],te.prototype,"_handleDisabledChange",void 0);Xe([p({type:Boolean})],te.prototype,"readonly",void 0);Xe([$("readonly",{waitUntilFirstUpdate:!0})],te.prototype,"_handleReadonlyChange",void 0);Xe([B({context:j})],te.prototype,"_context",void 0);function Kl(n){n.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(t=>{let r=document.createComment(t.textContent);t.replaceChild(r,t.firstChild)})}async function Jl(n,e,t,r="qti-portable-custom-interaction"){let i=[],o=n.querySelectorAll(r);if(o.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await t(e,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await t(e,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(o)){c.setAttribute("data-base-url",e);let d=c.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,c.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let g=h.getAttribute("primary-configuration");if(g)try{let m=await t(e,`/${g}`),w=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of w){let f=x.getAttribute("id");if(f&&m.paths&&m.paths[f]){let u=m.paths[f],y=Array.isArray(u)?u[0]:u;if(x.setAttribute("primary-path",y),a&&a.paths&&a.paths[f]){let v=a.paths[f];Array.isArray(v)?x.setAttribute("fallback-path",v[0]):x.setAttribute("fallback-path",v)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let u=n.createElement("qti-interaction-module");u.setAttribute("id",x);let y=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(u.setAttribute("primary-path",y),a&&a.paths&&a.paths[x]){let v=a.paths[x];Array.isArray(v)?u.setAttribute("fallback-path",v[0]):u.setAttribute("fallback-path",v)}h.appendChild(u)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${g}`,m)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=n.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let g in s.paths){let m=s.paths[g],w="";a&&a.paths&&a.paths[g]&&(w=a.paths[g]);let x=Array.isArray(m)?m:[m],f=Array.isArray(w)?w:[w],u=x.map((y,v)=>{let A=f.length>v?f[v]:"";return{primaryPath:y,fallbackPath:A}});for(let y of f)u.some(v=>v.fallbackPath===y)||u.push({primaryPath:x.length>0?x[0]:y,fallbackPath:y});for(let y of u){let v=n.createElement("qti-interaction-module");y.fallbackPath&&v.setAttribute("fallback-path",y.fallbackPath),v.setAttribute("id",g),v.setAttribute("primary-path",y.primaryPath),h&&h.appendChild(v)}}}}}function Zl(n,e,t){Array.from(n.getElementsByTagName("*")).filter(o=>o.localName===e||o.localName?.toLowerCase()===e.toLowerCase()).forEach(o=>{let s=`${e}-${t}`,a=tc(o,s);o.replaceWith(a)})}function ec(n,e){n.querySelectorAll("*").forEach(t=>{let r=t.classList;r&&r.forEach(i=>{if(i.startsWith(`${e}:`)){let o=i.slice(`${e}:`.length),s=`${t.nodeName}-${o}`,a=tc(t,s);t.replaceWith(a)}})})}function tc(n,e){let t=n.ownerDocument.createElement(e);for(let r of n.attributes)t.setAttribute(r.name,r.value);for(;n.firstChild;)t.appendChild(n.firstChild);return t}function rc(n,e){let t=["hook","module"],r=e.substring(0,e.lastIndexOf("/"));for(let i of t)n.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",e),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var aa=class n{#e;constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(e.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let t=new Uint8Array(32);t.set(e,32-e.length),this.#e=Bh(t)}static fromSeed(e){if(e.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new n(e)}static fromFixed(e){if(typeof e!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(e)||e<0||e>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let t=new Uint8Array(32);return t[31]=e,new n(t)}static fromSeedKey(e){let t=new n(new Uint8Array);return t.#e=Fh(`${e}`),t}random(){this.#e|=0,this.#e=this.#e+1831565813|0;let e=Math.imul(this.#e^this.#e>>>15,1|this.#e);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}};function yo(n){return aa.fromSeedKey(n)}function Fh(n){let e=1779033703^n.length;for(let t=0;t<n.length;t++)e=Math.imul(e^n.charCodeAt(t),3432918353),e=e<<13|e>>>19;return ic(e)}function Bh(n){let e=1779033703^n.length;for(let t=0;t<n.length;t++)e=Math.imul(e^n[t],3432918353),e=e<<13|e>>>19;return ic(e)}function ic(n){let e=Math.imul(n^n>>>16,2246822507);return e=Math.imul(e^e>>>13,3266489909),(e^e>>>16)>>>0}var Uh=n=>typeof n=="function"?n():n.random();function vo(n,e){let t=n.filter(i=>!i.fixed);for(let i=t.length-1;i>0;i--){let o=Math.floor(Uh(e)*(i+1));[t[i],t[o]]=[t[o],t[i]]}let r=0;return n.map(i=>i.fixed?i:t[r++])}function Hh(n){switch(n){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 la(n,e){let t=n.querySelectorAll('[shuffle="true"]'),r=Array.from(t).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=e!=null&&`${e}`.length>0,o=n.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=Hh(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,g=0;for(let m of d){if(!m)continue;let w=i?yo(`${e}:${o}:${l}:${g}`):Math.random;g++;let x=Array.from(a.querySelectorAll(m)).filter(v=>v.parentElement!==null);if(x.filter(v=>v.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let f=x[0].parentElement;if(!f||x.some(v=>v.parentElement!==f)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let u=x[x.length-1].nextSibling,y=vo(x.map(v=>({element:v,fixed:v.getAttribute("fixed")==="true"})),w);for(let v of x)v.remove();for(let{element:v}of y)f.insertBefore(v,u);h=!0}h&&a.removeAttribute("shuffle")}}function oc(n){n.querySelectorAll("qti-stylesheet").forEach(e=>e.remove())}var nc=!1;function wo(n,e){nc||(nc=!0,console.warn(`[${n}] No QTI_CONTEXT.seed provided; using "${e}" as deterministic fallback seed.`))}function fr(n,e){return fetch(n,{signal:e}).then(t=>{if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.text()}).then(t=>new DOMParser().parseFromString(t,"text/xml")).catch(t=>{throw t.name==="AbortError"?t:new Error(`Failed to load XML: ${t.message}`)})}function gr(n){return new DOMParser().parseFromString(n,"text/xml")}function sc(n,e,t){if(n.nodeType===Node.ELEMENT_NODE){let r=n,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=t?e.createElement(r.localName,{customElementRegistry:t}):e.createElement(r.localName):i=e.createElementNS(r.namespaceURI,r.tagName);for(let o=0;o<r.attributes.length;o++){let s=r.attributes[o];i.setAttribute(s.localName,s.value)}for(let o=0;o<r.childNodes.length;o++)i.appendChild(sc(r.childNodes[o],e,t));return i}return n.cloneNode(!1)}function br(n,e){let t=document.createDocumentFragment();for(let r=0;r<n.childNodes.length;r++)t.appendChild(sc(n.childNodes[r],document,e));return t}function yr(n,e){e.endsWith("/")||(e+="/"),n.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let o=r.getAttribute(i)?.trim();if(o&&!/^(data:|https?:|blob:)/.test(o)){let s=e+encodeURI(o);r.setAttribute(i,s)}}})}var Ve=()=>{let n,e="",t={load(r,i){return e=r,fr(r,i).then(o=>(n=o,t))},parse(r){return n=gr(r),e="",t},path:r=>(yr(n,r),e=null,t),fn(r){return r(n),t},pciHooks(r){return rc(n,r),t},async configurePci(r,i,o="qti-portable-custom-interaction"){return await Jl(n,r,i,o),t},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let o=e||"default-item-seed";return wo("qtiTransformItem",o),la(n,o),t}return la(n,i),t},extendElementName:(r,i)=>(Zl(n,r,i),t),extendElementsWithClass:(r="extend")=>(ec(n,r),t),customInteraction(r,i){let o=n.querySelector("qti-custom-interaction"),s=o.querySelector("object");return o.setAttribute("data-base-ref",r),o.setAttribute("data-base-item",r+i),o.setAttribute("data",s.getAttribute("data")),o.setAttribute("width",s.getAttribute("width")),o.setAttribute("height",s.getAttribute("height")),o.removeChild(s),t},convertCDATAtoComment(){return Kl(n),t},stripStyleSheets(){return oc(n),t},html(){return e!==null&&yr(n,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(br(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(r){return e!==null&&yr(n,e.substring(0,e.lastIndexOf("/"))),br(n,r)},xmlDoc(){return n}};return t};var ac=()=>{let n,e={async load(t,r){return new Promise(i=>{fr(t,r).then(o=>(n=o,i(e)))})},parse(t){n=gr(t)},assessmentTest(){let t=n.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:t.getAttribute("href"),identifier:t.getAttribute("identifier")}}};return e};function lc(n){let e=[];return n.querySelectorAll("qti-assessment-item-ref").forEach(t=>{let r=t.getAttribute("identifier"),i=t.getAttribute("href"),o=t.getAttribute("category");e.push({identifier:r,href:i,category:o})}),e}var xo=(n,...e)=>e.includes(n.localName)||e.includes(n.localName?.toLowerCase?.()),cc=n=>xo(n,"qti-assessment-item-ref","assessmentitemref"),hi=n=>xo(n,"qti-assessment-section","assessmentsection"),di=(n,...e)=>e.some(t=>{let r=(n.getAttribute(t)??"").trim().toLowerCase();return r==="true"||r==="1"}),Wh=(n,...e)=>e.some(t=>{let r=(n.getAttribute(t)??"").trim().toLowerCase();return r==="false"||r==="0"}),ca=n=>xo(n,"qti-ordering","ordering"),Qh=n=>xo(n,"qti-selection","selection"),Gh=n=>Array.from(n.children).filter(e=>ca(e)&&di(e,"shuffle")),Xh=(n,e)=>yo(`${n}:${e}`);function Yh(n){let e=[],t=[],r=i=>{for(let o of Array.from(i.children))cc(o)?e.push(o):hi(o)?r(o):!ca(o)&&!Qh(o)&&t.push(o.localName)};return r(n),{itemRefs:e,dropped:t}}function Kh(n,e){if(e.length===0)return;let t=n.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${t}" is consumed by section ordering; discarding its ${[...new Set(e)].join(", ")}.`)}function dc(n,e){for(let l of Array.from(n.children))hi(l)&&dc(l,e);let t=Gh(n);if(t.length===0)return;let r=[],i=[];for(let l of Array.from(n.children))if(cc(l))r.push({nodes:[l],fixed:di(l,"fixed")}),i.push(l);else if(hi(l)){let{itemRefs:c,dropped:d}=Yh(l);if(Kh(l,d),Wh(l,"keep-together","keeptogether"))for(let h of c)r.push({nodes:[h],fixed:di(h,"fixed")});else c.length>0&&r.push({nodes:c,fixed:di(l,"fixed")});i.push(l)}let o=i.length>0?i[i.length-1].nextSibling:null,s=n.getAttribute("identifier")??"",a=vo(r,Xh(e,s));for(let l of i)l.remove();for(let l of a)for(let c of l.nodes)n.insertBefore(c,o);for(let l of t)l.remove()}function hc(n){return Array.from(n.getElementsByTagName("*")).some(e=>ca(e)&&di(e,"shuffle"))}function da(n,e){let t=Array.from(n.getElementsByTagName("*")).filter(r=>hi(r));for(let r of t){if(!r.parentNode)continue;let i=r.parentElement;i&&hi(i)||dc(r,e)}}var vr=()=>{let n,e="",t={async load(r,i){return new Promise((o,s)=>{fr(r,i).then(a=>(n=a,e=r,t.path(r.substring(0,r.lastIndexOf("/"))),o(t)))})},parse(r){return n=gr(r),e="",t},path:r=>(yr(n,r),t),fn(r){return r(n),t},shuffleOrdering(r){if(!hc(n))return t;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let o=e||"default-test-seed";return wo("qtiTransformTest",o),da(n,o),t}return da(n,i),t},items(){return lc(n)},html(){return new XMLSerializer().serializeToString(br(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(r){return br(n,r)},xmlDoc(){return n}};return t};var pc=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ha=class n extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(e,t){super(n.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=e,this.item=t}},wr=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let e=this.closest("qti-assessment-item"),t=new ha(this,e);this.dispatchEvent(t);let r=e?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!t.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(e){let t=await Ve().load(this.href).then(r=>r.htmlDoc());if(t){let r=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...r)}}};pc([p({type:String})],wr.prototype,"identifier",void 0);pc([p({type:String})],wr.prototype,"href",void 0);var qo=class extends C{};var Jh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},pi=class extends C{render(){return b`<slot @slotchange=${this.#e}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#e())}updated(e){e.has("context")&&this.#e()}#e(){let e=new Map,t=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of t){let o=i;o.mathVariable!==!0||o.value===null||o.value===void 0||e.set(o.identifier,this.#t(o.value))}if(e.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 o=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=e.get(o);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",o);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",o),i.replaceWith(a)}}#t(e){return Array.isArray(e)?e.join(" "):e?.toString()??""}};Jh([T({context:j,subscribe:!0}),_()],pi.prototype,"context",void 0);var uc=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},xr=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
68
68
  :host {
69
69
  display: none;
70
70
  }
@@ -134,15 +134,15 @@ Make sure to test your application with a production build as repeat registratio
134
134
  <button class="button close-button" @click="${this.closeFeedback}">Close</button>
135
135
  </div>
136
136
  </dialog>
137
- `}openFeedback(){let e=this.shadowRoot?.querySelector("dialog");e&&!e.open&&e.showModal()}closeFeedback(){let e=this.shadowRoot?.querySelector("dialog");e&&e.open&&(e.close(),this.showStatus="off")}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(e){e.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var mi=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ye=class extends hr{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[q`
137
+ `}openFeedback(){let e=this.shadowRoot?.querySelector("dialog");e&&!e.open&&e.showModal()}closeFeedback(){let e=this.shadowRoot?.querySelector("dialog");e&&e.open&&(e.close(),this.showStatus="off")}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(e){e.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var mi=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ye=class extends pr{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[q`
138
138
  :host {
139
139
  display: none;
140
140
  }
141
- `]}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return b`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let r of e.querySelectorAll("qti-interpolation-table-entry")){!r.getAttribute("source-value")&&r.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let i=parseFloat(r.getAttribute("source-value")),o=parseFloat(r.getAttribute("target-value"));(isNaN(i)||isNaN(o))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(i,o)}return t}return null}connectedCallback(){super.connectedCallback();let e=this.defaultValues(this.cardinality),t={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:e,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};t.value=e,(t.value===null||t.value==null)&&(t.baseType==="integer"||t.baseType==="float")&&(t.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}};mi([p({type:String,attribute:"base-type"})],Ye.prototype,"baseType",void 0);mi([p({type:String,attribute:"external-scored"})],Ye.prototype,"externalScored",void 0);mi([p({type:String})],Ye.prototype,"identifier",void 0);mi([p({type:String})],Ye.prototype,"cardinality",void 0);mi([T({context:j,subscribe:!0}),_()],Ye.prototype,"itemContext",void 0);var So=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ut=class extends hr{static{this.styles=[q`
141
+ `]}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return b`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let r of e.querySelectorAll("qti-interpolation-table-entry")){!r.getAttribute("source-value")&&r.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let i=parseFloat(r.getAttribute("source-value")),o=parseFloat(r.getAttribute("target-value"));(isNaN(i)||isNaN(o))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(i,o)}return t}return null}connectedCallback(){super.connectedCallback();let e=this.defaultValues(this.cardinality),t={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:e,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};t.value=e,(t.value===null||t.value==null)&&(t.baseType==="integer"||t.baseType==="float")&&(t.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}};mi([p({type:String,attribute:"base-type"})],Ye.prototype,"baseType",void 0);mi([p({type:String,attribute:"external-scored"})],Ye.prototype,"externalScored",void 0);mi([p({type:String})],Ye.prototype,"identifier",void 0);mi([p({type:String})],Ye.prototype,"cardinality",void 0);mi([T({context:j,subscribe:!0}),_()],Ye.prototype,"itemContext",void 0);var So=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},mt=class extends pr{static{this.styles=[q`
142
142
  :host {
143
143
  display: none;
144
144
  }
145
- `]}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return b`${JSON.stringify(e,null,2)}`}connectedCallback(){super.connectedCallback();let e=this.defaultValues(this.cardinality),t={baseType:this.baseType,identifier:this.identifier,correctResponse:this.#e,cardinality:this.cardinality||"single",mapping:this.#t,defaultValue:e,areaMapping:this.#r,value:null,type:"response",candidateResponse:null};t.value=e,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}get#e(){let e,t=this.querySelector("qti-correct-response");if(t){let r=t.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)e=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){e=[];for(let i=0;i<r.length;i++)e.push(r[i].textContent.trim()),r[i].remove()}}return e}get#t(){let e=this.querySelector("qti-mapping"),t=parseFloat(e?.getAttribute("lower-bound")),r=parseFloat(e?.getAttribute("upper-bound"));return{defaultValue:Number(e?.getAttribute("default-value"))||0,lowerBound:isNaN(t)?null:t,upperBound:isNaN(r)?null:r,mapEntries:Array.from(e?.querySelectorAll("qti-map-entry")||[]).map(o=>({mapKey:o.getAttribute("map-key")||"",mappedValue:Number(o.getAttribute("mapped-value"))||0,caseSensitive:o.hasAttribute("case-sensitive")?o.getAttribute("case-sensitive")!=="false":!1}))}}get#r(){let e=this.querySelector("qti-area-mapping"),t=Number(e?.getAttribute("default-value"))||0,r=parseFloat(e?.getAttribute("lower-bound")),i=parseFloat(e?.getAttribute("upper-bound")),o=Array.from(e?.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:t,lowerBound:isNaN(r)?null:r,upperBound:isNaN(i)?null:i,areaMapEntries:o}}};So([p({type:String,attribute:"base-type"})],ut.prototype,"baseType",void 0);So([p({type:String})],ut.prototype,"identifier",void 0);So([p({type:String})],ut.prototype,"cardinality",void 0);So([T({context:j,subscribe:!0}),_()],ut.prototype,"itemContext",void 0);var fc=`<qti-response-processing>
145
+ `]}render(){let e=this.itemContext?.variables.find(t=>t.identifier===this.identifier)?.value;return b`${JSON.stringify(e,null,2)}`}connectedCallback(){super.connectedCallback();let e=this.defaultValues(this.cardinality),t={baseType:this.baseType,identifier:this.identifier,correctResponse:this.#e,cardinality:this.cardinality||"single",mapping:this.#t,defaultValue:e,areaMapping:this.#r,value:null,type:"response",candidateResponse:null};t.value=e,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}get#e(){let e,t=this.querySelector("qti-correct-response");if(t){let r=t.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)e=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){e=[];for(let i=0;i<r.length;i++)e.push(r[i].textContent.trim()),r[i].remove()}}return e}get#t(){let e=this.querySelector("qti-mapping"),t=parseFloat(e?.getAttribute("lower-bound")),r=parseFloat(e?.getAttribute("upper-bound"));return{defaultValue:Number(e?.getAttribute("default-value"))||0,lowerBound:isNaN(t)?null:t,upperBound:isNaN(r)?null:r,mapEntries:Array.from(e?.querySelectorAll("qti-map-entry")||[]).map(o=>({mapKey:o.getAttribute("map-key")||"",mappedValue:Number(o.getAttribute("mapped-value"))||0,caseSensitive:o.hasAttribute("case-sensitive")?o.getAttribute("case-sensitive")!=="false":!1}))}}get#r(){let e=this.querySelector("qti-area-mapping"),t=Number(e?.getAttribute("default-value"))||0,r=parseFloat(e?.getAttribute("lower-bound")),i=parseFloat(e?.getAttribute("upper-bound")),o=Array.from(e?.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:t,lowerBound:isNaN(r)?null:r,upperBound:isNaN(i)?null:i,areaMapEntries:o}}};So([p({type:String,attribute:"base-type"})],mt.prototype,"baseType",void 0);So([p({type:String})],mt.prototype,"identifier",void 0);So([p({type:String})],mt.prototype,"cardinality",void 0);So([T({context:j,subscribe:!0}),_()],mt.prototype,"itemContext",void 0);var fc=`<qti-response-processing>
146
146
  <qti-response-condition>
147
147
  <qti-response-if>
148
148
  <qti-match>
@@ -207,21 +207,21 @@ Make sure to test your application with a production build as repeat registratio
207
207
  :host {
208
208
  display: none;
209
209
  }
210
- `]}#e=100;render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let t=0,r=!1;do{if(r=!1,t++,t>this.#e){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let i=[...this.children];for(let o of i)if(o.tagName.toLowerCase()==="qti-template-constraint"){if(o.calculate()===!1){r=!0;break}}else o.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:t}}))}firstUpdated(e){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var yc=[{tag:"qti-assessment-item",ctor:te},{tag:"qti-assessment-stimulus-ref",ctor:wr},{tag:"qti-companion-materials-info",ctor:qo},{tag:"qti-content-body",ctor:pi},{tag:"qti-context-declaration",ctor:xr},{tag:"qti-custom-operator",ctor:ui},{tag:"qti-feedback-block",ctor:Co},{tag:"qti-feedback-inline",ctor:Eo},{tag:"qti-item-body",ctor:ko},{tag:"qti-modal-feedback",ctor:qr},{tag:"qti-outcome-declaration",ctor:Ye},{tag:"qti-response-declaration",ctor:ut},{tag:"qti-response-processing",ctor:Ao},{tag:"qti-rubric-block",ctor:Ke},{tag:"qti-stylesheet",ctor:Io},{tag:"qti-template-constraint",ctor:_o},{tag:"qti-template-declaration",ctor:Je},{tag:"qti-template-processing",ctor:To}];var Ro=class extends qr{static{this.styles=q`
210
+ `]}#e=100;render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let t=0,r=!1;do{if(r=!1,t++,t>this.#e){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let i=[...this.children];for(let o of i)if(o.tagName.toLowerCase()==="qti-template-constraint"){if(o.calculate()===!1){r=!0;break}}else o.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:t}}))}firstUpdated(e){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var yc=[{tag:"qti-assessment-item",ctor:te},{tag:"qti-assessment-stimulus-ref",ctor:wr},{tag:"qti-companion-materials-info",ctor:qo},{tag:"qti-content-body",ctor:pi},{tag:"qti-context-declaration",ctor:xr},{tag:"qti-custom-operator",ctor:ui},{tag:"qti-feedback-block",ctor:Co},{tag:"qti-feedback-inline",ctor:Eo},{tag:"qti-item-body",ctor:ko},{tag:"qti-modal-feedback",ctor:qr},{tag:"qti-outcome-declaration",ctor:Ye},{tag:"qti-response-declaration",ctor:mt},{tag:"qti-response-processing",ctor:Ao},{tag:"qti-rubric-block",ctor:Ke},{tag:"qti-stylesheet",ctor:Io},{tag:"qti-template-constraint",ctor:_o},{tag:"qti-template-declaration",ctor:Je},{tag:"qti-template-processing",ctor:To}];var Ro=class extends qr{static{this.styles=q`
211
211
  :host {
212
212
  color: gray;
213
213
  }
214
- `}render(){return b``}};var Oo=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},mt=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#e=""}get title(){return this.#e}set title(e){this.#e=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}#e;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};Oo([p({type:String})],mt.prototype,"identifier",void 0);Oo([p({type:String})],mt.prototype,"class",void 0);Oo([p({type:String,attribute:"navigation-mode"})],mt.prototype,"navigationMode",void 0);Oo([p({type:String,attribute:"submission-mode"})],mt.prototype,"submissionMode",void 0);var ep=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},bi=class extends k{#e;constructor(){super(),this.addEventListener("qti-assessment-test-connected",e=>this.#e=e.detail)}getResult(){let e=this.getAttribute("include-category")?.split(" ")??[],t=this.getAttribute("exclude-category")?.split(" ")??[],r=this.getAttribute("weight-identifier")??"",i=this.getAttribute("variable-identifier"),s=Array.from(this.#e.querySelectorAll("qti-asssessment-test qti-assessment-item-ref")).filter(c=>{let d=!0;return e.length>0&&(d=e.includes(c.category)),t.length>0&&(d=!t.includes(c.category)),d}).map(c=>{let d=1;if(r){let h=c.weigths.get(r);h!=null&&(d=h)}return{item:c.identifier,weight:d}});return new pa(this._testContext,i,s).calculate()}calculate(){return this.getResult()}};ep([T({context:pe,subscribe:!0})],bi.prototype,"_testContext",void 0);var pa=class{constructor(e,t,r){this.testContext=e,this.itemVariable=t,this.includedItems=r}calculate(){let{items:e}=this.testContext,t=0,r=[...new Set(this.includedItems.map(i=>i.item))];return e.forEach(i=>{if(r.includes(i.identifier)){let o=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;o&&(t+=Number(o.value)*s)}}),t}};var Po=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},vc=n=>{class e extends n{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 o=i||this._getDefaultNavigationId(r);o&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:r,id:o},bubbles:!0,composed:!0}))}_bindEventHandlers(){this.addEventListener("qti-request-navigation",this._handleNavigationRequest.bind(this)),this.addEventListener("qti-assessment-test-connected",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 o=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=o.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:o}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:o.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,o),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._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);r&&this.navigateTo(this.navigate,r)}async _handleNavigationRequest({detail:r}){if(!r?.id)return;this._cancelPreviousNavigation();let i=++this._navigationId,o=new AbortController;try{this._dispatchLoadingStarted(r.type,r.id),this._activeController=o,await this._executeNavigation(r.type,r.id,i,o)}catch(s){this._handleNavigationError(s,r.type,r.id)}finally{this._activeController===o&&(this._activeController=null),this._dispatchLoadingEnded(r.type,r.id)}}_handleNavigationError(r,i,o){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,o))}async _executeNavigation(r,i,o,s){r==="item"?await this._navigateToItem(i,o,s):await this._navigateToSection(i,o,s)}async _navigateToItem(r,i,o){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,o),await this._waitForLoadingComplete(i,o),!this._isStaleNavigation(i,o)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(r,i,o){let a=this._findSection(r)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:null};let l=this._getSectionItemIds(r);this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,i,o),await this._waitForLoadingComplete(i,o),!this._isStaleNavigation(i,o)&&this._dispatchTestLoaded(this._loadResults)}_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(o=>setTimeout(o,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let o=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",o?"has content":"no content"),this._applyStimulusContent(o,r,i)}_applyStimulusContent(r,i,o){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelectorAll("qti-stimulus-body, qti-stylesheet");if(console.info(`Found ${s.length} stimulus elements to apply for ${i.identifier}`),s.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let a=[],l=o.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.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="";let h=Array.from(s).map(g=>g.cloneNode(!0));c.append(...h),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,o){if(!this._testElement||r.length===0)return;let s=r.map(c=>this._findItemRef(c));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(c=>this._loadSingleItem(c,i,o)))).filter(Boolean);this._isStaleNavigation(i,o)||(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(g=>g.identifier===d)?.state;h!==void 0&&c.updateComplete.then(()=>{let g=c.assessmentItem;g&&(g.state=h)})}),this._loadResults=l)}async _loadSingleItem(r,i,o){try{let s=this.querySelector("test-navigation")?.qtiContext?.QTI_CONTEXT?.seed,a=(await Ve().load(r.href,o.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,o)?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 Ve().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 o=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:o,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,o){return{message:r.message||`Failed to load ${i}: ${o}`,details:r,itemId:i==="item"?o:void 0,sectionId:i==="section"?o:void 0}}_dispatchLoadingStarted(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchError(r){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:r,bubbles:!0,composed:!0}))}_dispatchTestLoaded(r){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:r.map(({itemRef:i})=>({identifier:i?.identifier,element:i})),bubbles:!0,composed:!0}))})}}return Po([p({type:String})],e.prototype,"navigate",void 0),Po([p({type:Number})],e.prototype,"requestTimeout",void 0),Po([p({attribute:!1})],e.prototype,"postLoadTransformCallback",void 0),Po([p({attribute:!1})],e.prototype,"postLoadTestTransformCallback",void 0),e};var wc=n=>{class e extends n{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{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 o=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;o&&this.updateAssessmentItemView(o,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return e};var xc=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ua=n=>{class e extends n{constructor(...r){super(...r),this.testContext=Js,this.sessionContext=Ks,this._updateItemInTestContext=i=>{let o=i._context,s=o.identifier,a=o.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);else{let c=[...i.variables];for(let d of l.variables){let h=c.find(g=>g.identifier===d.identifier);h?h.value=d.value:c.push(d)}i.variables=c}},this._initializeEventListeners()}updateItemVariables(r,i){let o=this.testContext.items.find(a=>a.identifier===r);o&&(o.variables=o.variables.map(a=>{let l=i.find(c=>c.identifier===a.identifier);return l?{...a,...l}:a}));let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);s&&s.assessmentItem&&(s.assessmentItem.variables=i)}_initializeEventListeners(){this.addEventListener("qti-assessment-test-connected",r=>{if(this.testContext=Js,this.sessionContext=Ks,this.testContext&&this.testContext.items.length>0)return;this._testElement=r.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(o=>({href:o.href,identifier:o.identifier,category:o.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,o=i.closest("qti-assessment-item-ref")?.identifier;o&&(i.assessmentItemRefId=o),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)})}_updateItemVariablesInTestContext(r,i,o){this.testContext={...this.testContext,items:this.testContext.items.map(s=>s.identifier!==r?s:{...s,variables:i.map(a=>{let l=s.variables.find(c=>c.identifier===a.identifier);return l?{...l,...a}:a}),...o!==void 0?{state:o?{...o}:void 0}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return xc([p({attribute:!1,type:Object}),B({context:pe})],e.prototype,"testContext",void 0),xc([p({attribute:!1,type:Object}),B({context:De})],e.prototype,"sessionContext",void 0),e},qc=class extends ua(C){};var Cc=n=>{class e extends n{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:o,value:s}=i.detail;this.updateOutcomeVariable(o,s),i.stopPropagation()})}outcomeProcessing(){let r=this.querySelector("qti-outcome-processing");return r?(r?.process(),!0):!1}updateOutcomeVariable(r,i){let o=this.getOutcome(r);if(!o){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:o.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 e};var tp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Lt=class extends vc(wc(Cc(ua(C)))){constructor(){super(...arguments),this.configContext={}}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return b`<slot></slot>`}};tp([_(),B({context:de})],Lt.prototype,"configContext",void 0);var Ec=q`
214
+ `}render(){return b``}};var Oo=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ft=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#e=""}get title(){return this.#e}set title(e){this.#e=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}#e;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};Oo([p({type:String})],ft.prototype,"identifier",void 0);Oo([p({type:String})],ft.prototype,"class",void 0);Oo([p({type:String,attribute:"navigation-mode"})],ft.prototype,"navigationMode",void 0);Oo([p({type:String,attribute:"submission-mode"})],ft.prototype,"submissionMode",void 0);var ep=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},bi=class extends k{#e;constructor(){super(),this.addEventListener("qti-assessment-test-connected",e=>this.#e=e.detail)}getResult(){let e=this.getAttribute("include-category")?.split(" ")??[],t=this.getAttribute("exclude-category")?.split(" ")??[],r=this.getAttribute("weight-identifier")??"",i=this.getAttribute("variable-identifier"),s=Array.from(this.#e.querySelectorAll("qti-asssessment-test qti-assessment-item-ref")).filter(c=>{let d=!0;return e.length>0&&(d=e.includes(c.category)),t.length>0&&(d=!t.includes(c.category)),d}).map(c=>{let d=1;if(r){let h=c.weigths.get(r);h!=null&&(d=h)}return{item:c.identifier,weight:d}});return new pa(this._testContext,i,s).calculate()}calculate(){return this.getResult()}};ep([T({context:pe,subscribe:!0})],bi.prototype,"_testContext",void 0);var pa=class{constructor(e,t,r){this.testContext=e,this.itemVariable=t,this.includedItems=r}calculate(){let{items:e}=this.testContext,t=0,r=[...new Set(this.includedItems.map(i=>i.item))];return e.forEach(i=>{if(r.includes(i.identifier)){let o=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;o&&(t+=Number(o.value)*s)}}),t}};var Po=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},vc=n=>{class e extends n{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 o=i||this._getDefaultNavigationId(r);o&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:r,id:o},bubbles:!0,composed:!0}))}_bindEventHandlers(){this.addEventListener("qti-request-navigation",this._handleNavigationRequest.bind(this)),this.addEventListener("qti-assessment-test-connected",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 o=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=o.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:o}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:o.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,o),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._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);r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,i){let o=this.sessionContext?.navItemRefId;if(!o||r==="item"&&i===o)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${o}"]`);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(g=>g.identifier===o);if(r==="item"){let g=d.findIndex(m=>m.identifier===i);return g===-1||h===-1?!1:g!==h+1}return!0}async _handleNavigationRequest({detail:r}){if(!r?.id)return;if(this._isLinearNavigationRestricted(r.type,r.id)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let i=++this._navigationId,o=new AbortController;try{this._dispatchLoadingStarted(r.type,r.id),this._activeController=o,await this._executeNavigation(r.type,r.id,i,o)}catch(s){this._handleNavigationError(s,r.type,r.id)}finally{this._activeController===o&&(this._activeController=null),this._dispatchLoadingEnded(r.type,r.id)}}_handleNavigationError(r,i,o){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,o))}async _executeNavigation(r,i,o,s){r==="item"?await this._navigateToItem(i,o,s):await this._navigateToSection(i,o,s)}async _navigateToItem(r,i,o){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,o),await this._waitForLoadingComplete(i,o),!this._isStaleNavigation(i,o)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(r,i,o){let a=this._findSection(r)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:null};let l=this._getSectionItemIds(r);this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,i,o),await this._waitForLoadingComplete(i,o),!this._isStaleNavigation(i,o)&&this._dispatchTestLoaded(this._loadResults)}_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(o=>setTimeout(o,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let o=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",o?"has content":"no content"),this._applyStimulusContent(o,r,i)}_applyStimulusContent(r,i,o){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelectorAll("qti-stimulus-body, qti-stylesheet");if(console.info(`Found ${s.length} stimulus elements to apply for ${i.identifier}`),s.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let a=[],l=o.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.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="";let h=Array.from(s).map(g=>g.cloneNode(!0));c.append(...h),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,o){if(!this._testElement||r.length===0)return;let s=r.map(c=>this._findItemRef(c));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(c=>this._loadSingleItem(c,i,o)))).filter(Boolean);this._isStaleNavigation(i,o)||(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(g=>g.identifier===d)?.state;h!==void 0&&c.updateComplete.then(()=>{let g=c.assessmentItem;g&&(g.state=h)})}),this._loadResults=l)}async _loadSingleItem(r,i,o){try{let s=this.querySelector("test-navigation")?.qtiContext?.QTI_CONTEXT?.seed,a=(await Ve().load(r.href,o.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,o)?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 Ve().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 o=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:o,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,o){return{message:r.message||`Failed to load ${i}: ${o}`,details:r,itemId:i==="item"?o:void 0,sectionId:i==="section"?o:void 0}}_dispatchLoadingStarted(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchError(r){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:r,bubbles:!0,composed:!0}))}_dispatchTestLoaded(r){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:r.map(({itemRef:i})=>({identifier:i?.identifier,element:i})),bubbles:!0,composed:!0}))})}}return Po([p({type:String})],e.prototype,"navigate",void 0),Po([p({type:Number})],e.prototype,"requestTimeout",void 0),Po([p({attribute:!1})],e.prototype,"postLoadTransformCallback",void 0),Po([p({attribute:!1})],e.prototype,"postLoadTestTransformCallback",void 0),e};var wc=n=>{class e extends n{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{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 o=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;o&&this.updateAssessmentItemView(o,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return e};var xc=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ua=n=>{class e extends n{constructor(...r){super(...r),this.testContext=Js,this.sessionContext=Ks,this._updateItemInTestContext=i=>{let o=i._context,s=o.identifier,a=o.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);else{let c=[...i.variables];for(let d of l.variables){let h=c.find(g=>g.identifier===d.identifier);h?h.value=d.value:c.push(d)}i.variables=c}},this._initializeEventListeners()}updateItemVariables(r,i){let o=this.testContext.items.find(a=>a.identifier===r);o&&(o.variables=o.variables.map(a=>{let l=i.find(c=>c.identifier===a.identifier);return l?{...a,...l}:a}));let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);s&&s.assessmentItem&&(s.assessmentItem.variables=i)}_initializeEventListeners(){this.addEventListener("qti-assessment-test-connected",r=>{if(this.testContext=Js,this.sessionContext=Ks,this.testContext&&this.testContext.items.length>0)return;this._testElement=r.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(o=>({href:o.href,identifier:o.identifier,category:o.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,o=i.closest("qti-assessment-item-ref")?.identifier;o&&(i.assessmentItemRefId=o),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)})}_updateItemVariablesInTestContext(r,i,o){this.testContext={...this.testContext,items:this.testContext.items.map(s=>s.identifier!==r?s:{...s,variables:i.map(a=>{let l=s.variables.find(c=>c.identifier===a.identifier);return l?{...l,...a}:a}),...o!==void 0?{state:o?{...o}:void 0}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return xc([p({attribute:!1,type:Object}),B({context:pe})],e.prototype,"testContext",void 0),xc([p({attribute:!1,type:Object}),B({context:Ne})],e.prototype,"sessionContext",void 0),e},qc=class extends ua(C){};var Cc=n=>{class e extends n{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:o,value:s}=i.detail;this.updateOutcomeVariable(o,s),i.stopPropagation()})}outcomeProcessing(){let r=this.querySelector("qti-outcome-processing");return r?(r?.process(),!0):!1}updateOutcomeVariable(r,i){let o=this.getOutcome(r);if(!o){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:o.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 e};var tp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Vt=class extends vc(wc(Cc(ua(C)))){constructor(){super(...arguments),this.configContext={}}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return b`<slot></slot>`}};tp([_(),B({context:de})],Vt.prototype,"configContext",void 0);var Ec=q`
215
215
  display: inline-flex;
216
216
  align-items: center;
217
217
  cursor: pointer;
218
218
  padding: 0.5rem 1rem;
219
219
  border-radius: 0.25rem;
220
220
  user-select: none;
221
- `,me=q`
221
+ `,fe=q`
222
222
  background-color: lightgray;
223
223
  ${Ec};
224
- `,fe=q`
224
+ `,ge=q`
225
225
  cursor: not-allowed;
226
226
  opacity: 0.8;
227
227
  `,$w=q`
@@ -229,15 +229,28 @@ Make sure to test your application with a production build as repeat registratio
229
229
  border: 1px solid gray;
230
230
  `;var Er=class extends C{static{this.styles=q`
231
231
  :host {
232
- ${me};
232
+ ${fe};
233
233
  }
234
234
  :host([disabled]) {
235
- ${fe};
235
+ ${ge};
236
236
  }
237
- `}constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}));let t=this.closest("qti-test").querySelector("test-container");Array.from(t.shadowRoot.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",!0)})})}render(){return b` <slot></slot> `}};var Mo=class{constructor(e){this.G=e}disconnect(){this.G=void 0}reconnect(e){this.G=e}deref(){return this.G}},Do=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(e=>this.Z=e)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var kc=n=>!Wl(n)&&typeof n.then=="function",Sc=1073741823,ma=class extends pt{constructor(){super(...arguments),this._$Cwt=Sc,this._$Cbt=[],this._$CK=new Mo(this),this._$CX=new Do}render(...e){return e.find(t=>!kc(t))??Z}update(e,t){let r=this._$Cbt,i=r.length;this._$Cbt=t;let o=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<t.length&&!(a>this._$Cwt);a++){let l=t[a];if(!kc(l))return this._$Cwt=a,l;a<i&&l===r[a]||(this._$Cwt=Sc,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=o.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return Z}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},No=qe(ma);var $o=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
237
+ `}constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}));let t=this.closest("qti-test").querySelector("test-container");Array.from(t.shadowRoot.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",!0)})})}render(){return b` <slot></slot> `}};var Mo=class{constructor(e){this.G=e}disconnect(){this.G=void 0}reconnect(e){this.G=e}deref(){return this.G}},Do=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(e=>this.Z=e)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var kc=n=>!Wl(n)&&typeof n.then=="function",Sc=1073741823,ma=class extends ut{constructor(){super(...arguments),this._$Cwt=Sc,this._$Cbt=[],this._$CK=new Mo(this),this._$CX=new Do}render(...e){return e.find(t=>!kc(t))??Z}update(e,t){let r=this._$Cbt,i=r.length;this._$Cbt=t;let o=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<t.length&&!(a>this._$Cwt);a++){let l=t[a];if(!kc(l))return this._$Cwt=a,l;a<i&&l===r[a]||(this._$Cwt=Sc,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=o.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return Z}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},No=Ce(ma);var $o=`
238
+ @layer qti-base, qti-components, qti-extended;
238
239
  @layer qti-components.reset, qti-components.global, qti-components.interactions.base,
239
- qti-components.interactions.brand, qti-components.interactions.states,
240
- qti-components.interactions.corrections, qti-components.elements, qti-components.overrides;
240
+ qti-components.interactions.brand, qti-components.interactions.states,
241
+ qti-components.interactions.corrections, qti-components.elements, qti-components.overrides;
242
+ /*
243
+ * Layer order, weakest first.
244
+ *
245
+ * qti-base the QTI 3.0 shared class vocabulary and its layout overrides
246
+ * qti-components everything this theme paints (sublayers declared in styles/qti-theme/index.css)
247
+ * qti-extended reserved for the consumer \u2014 empty here, and it beats everything above
248
+ *
249
+ * Every stylesheet below is assigned a layer, at its import wherever the file belongs to just one.
250
+ * Nothing is left unlayered: unlayered CSS outranks every layer, so a single stray rule here would
251
+ * sit above the whole theme AND above the \`qti-extended\` slot consumers are told to author in.
252
+ */
253
+ @layer qti-base{
241
254
  /* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */
242
255
  /* ============================
243
256
  QTI 3 shared css
@@ -254,51 +267,66 @@ Make sure to test your application with a production build as repeat registratio
254
267
  11. Layout
255
268
  12. Other QTI 3 presentation utilities
256
269
  ============================ */
270
+
257
271
  /* ==========
258
272
  Display css
259
273
  =========== */
274
+
260
275
  .qti-display-inline {
261
276
  display: inline;
262
277
  }
278
+
263
279
  .qti-display-inline-block {
264
280
  display: inline-block;
265
281
  }
282
+
266
283
  .qti-display-block {
267
284
  display: block;
268
285
  }
286
+
269
287
  .qti-display-flex {
270
288
  display: flex;
271
289
  }
290
+
272
291
  .qti-display-inline-flex {
273
292
  display: inline-flex;
274
293
  }
294
+
275
295
  .qti-display-grid {
276
296
  display: grid;
277
297
  }
298
+
278
299
  .qti-display-inline-grid {
279
300
  display: inline-grid;
280
301
  }
302
+
281
303
  .qti-display-table {
282
304
  display: table;
283
305
  }
306
+
284
307
  .qti-display-table-cell {
285
308
  display: table-cell;
286
309
  }
310
+
287
311
  .qti-display-table-row {
288
312
  display: table-row;
289
313
  }
314
+
290
315
  .qti-display-list-item {
291
316
  display: list-item;
292
317
  }
318
+
293
319
  .qti-display-inherit {
294
320
  display: inherit;
295
321
  }
322
+
296
323
  /*
297
324
  * hidden to screen readers and sighted
298
325
  */
299
326
  .qti-hidden {
300
327
  display: none;
301
328
  }
329
+
302
330
  /*
303
331
  * visible to screen readers, hidden to sighted
304
332
  */
@@ -311,48 +339,62 @@ Make sure to test your application with a production build as repeat registratio
311
339
  border: 0;
312
340
  margin: -1px;
313
341
  }
342
+
314
343
  /* =============================
315
344
  Special flex styles
316
345
  ============================= */
346
+
317
347
  .qti-flex-direction-column {
318
348
  flex-direction: column;
319
349
  }
350
+
320
351
  .qti-flex-direction-row {
321
352
  flex-direction: row;
322
353
  }
354
+
323
355
  .qti-flex-grow-1 {
324
356
  flex-grow: 1;
325
357
  }
358
+
326
359
  .qti-flex-grow-0 {
327
360
  flex-grow: 0;
328
361
  }
362
+
329
363
  /* =========
330
364
  Margin css
331
365
  ========== */
366
+
332
367
  /**
333
368
  * For margin Top and Bottom and Left and Right
334
369
  */
335
370
  .qti-margin-0 {
336
371
  margin: 0 !important;
337
372
  }
373
+
338
374
  .qti-margin-1 {
339
375
  margin: 0.25rem !important;
340
376
  }
377
+
341
378
  .qti-margin-2 {
342
379
  margin: 0.5rem !important;
343
380
  }
381
+
344
382
  .qti-margin-3 {
345
383
  margin: 1rem !important;
346
384
  }
385
+
347
386
  .qti-margin-4 {
348
387
  margin: 1.5rem !important;
349
388
  }
389
+
350
390
  .qti-margin-5 {
351
391
  margin: 3rem !important;
352
392
  }
393
+
353
394
  .qti-margin-auto {
354
395
  margin: auto !important;
355
396
  }
397
+
356
398
  /*
357
399
  For margin Left and Right
358
400
  */
@@ -360,30 +402,37 @@ Make sure to test your application with a production build as repeat registratio
360
402
  margin-right: 0 !important;
361
403
  margin-left: 0 !important;
362
404
  }
405
+
363
406
  .qti-margin-x-1 {
364
407
  margin-right: 0.25rem !important;
365
408
  margin-left: 0.25rem !important;
366
409
  }
410
+
367
411
  .qti-margin-x-2 {
368
412
  margin-right: 0.5rem !important;
369
413
  margin-left: 0.5rem !important;
370
414
  }
415
+
371
416
  .qti-margin-x-3 {
372
417
  margin-right: 1rem !important;
373
418
  margin-left: 1rem !important;
374
419
  }
420
+
375
421
  .qti-margin-x-4 {
376
422
  margin-right: 1.5rem !important;
377
423
  margin-left: 1.5rem !important;
378
424
  }
425
+
379
426
  .qti-margin-x-5 {
380
427
  margin-right: 3rem !important;
381
428
  margin-left: 3rem !important;
382
429
  }
430
+
383
431
  .qti-margin-x-auto {
384
432
  margin-right: auto !important;
385
433
  margin-left: auto !important;
386
434
  }
435
+
387
436
  /*
388
437
  For margin Top and Bottom
389
438
  */
@@ -391,150 +440,192 @@ Make sure to test your application with a production build as repeat registratio
391
440
  margin-top: 0 !important;
392
441
  margin-bottom: 0 !important;
393
442
  }
443
+
394
444
  .qti-margin-y-1 {
395
445
  margin-top: 0.25rem !important;
396
446
  margin-bottom: 0.25rem !important;
397
447
  }
448
+
398
449
  .qti-margin-y-2 {
399
450
  margin-top: 0.5rem !important;
400
451
  margin-bottom: 0.5rem !important;
401
452
  }
453
+
402
454
  .qti-margin-y-3 {
403
455
  margin-top: 1rem !important;
404
456
  margin-bottom: 1rem !important;
405
457
  }
458
+
406
459
  .qti-margin-y-4 {
407
460
  margin-top: 1.5rem !important;
408
461
  margin-bottom: 1.5rem !important;
409
462
  }
463
+
410
464
  .qti-margin-y-5 {
411
465
  margin-top: 3rem !important;
412
466
  margin-bottom: 3rem !important;
413
467
  }
468
+
414
469
  .qti-margin-y-auto {
415
470
  margin-top: auto !important;
416
471
  margin-bottom: auto !important;
417
472
  }
473
+
418
474
  /*
419
475
  For margin Top
420
476
  */
421
477
  .qti-margin-t-0 {
422
478
  margin-top: 0 !important;
423
479
  }
480
+
424
481
  .qti-margin-t-1 {
425
482
  margin-top: 0.25rem !important;
426
483
  }
484
+
427
485
  .qti-margin-t-2 {
428
486
  margin-top: 0.5rem !important;
429
487
  }
488
+
430
489
  .qti-margin-t-3 {
431
490
  margin-top: 1rem !important;
432
491
  }
492
+
433
493
  .qti-margin-t-4 {
434
494
  margin-top: 1.5rem !important;
435
495
  }
496
+
436
497
  .qti-margin-t-5 {
437
498
  margin-top: 3rem !important;
438
499
  }
500
+
439
501
  .qti-margin-t-auto {
440
502
  margin-top: auto !important;
441
503
  }
504
+
442
505
  /*
443
506
  For margin Bottom
444
507
  */
445
508
  .qti-margin-b-0 {
446
509
  margin-bottom: 0 !important;
447
510
  }
511
+
448
512
  .qti-margin-b-1 {
449
513
  margin-bottom: 0.25rem !important;
450
514
  }
515
+
451
516
  .qti-margin-b-2 {
452
517
  margin-bottom: 0.5rem !important;
453
518
  }
519
+
454
520
  .qti-margin-b-3 {
455
521
  margin-bottom: 1rem !important;
456
522
  }
523
+
457
524
  .qti-margin-b-4 {
458
525
  margin-bottom: 1.5rem !important;
459
526
  }
527
+
460
528
  .qti-margin-b-5 {
461
529
  margin-bottom: 3rem !important;
462
530
  }
531
+
463
532
  .qti-margin-b-auto {
464
533
  margin-bottom: auto !important;
465
534
  }
535
+
466
536
  /*
467
537
  For margin Start LTR
468
538
  */
469
539
  .qti-margin-s-0 {
470
540
  margin-left: 0 !important;
471
541
  }
542
+
472
543
  .qti-margin-s-1 {
473
544
  margin-left: 0.25rem !important;
474
545
  }
546
+
475
547
  .qti-margin-s-2 {
476
548
  margin-left: 0.5rem !important;
477
549
  }
550
+
478
551
  .qti-margin-s-3 {
479
552
  margin-left: 1rem !important;
480
553
  }
554
+
481
555
  .qti-margin-s-4 {
482
556
  margin-left: 1.5rem !important;
483
557
  }
558
+
484
559
  .qti-margin-s-5 {
485
560
  margin-left: 3rem !important;
486
561
  }
562
+
487
563
  .qti-margin-s-auto {
488
564
  margin-left: auto !important;
489
565
  }
566
+
490
567
  /*
491
568
  For margin End LTR
492
569
  */
493
570
  .qti-margin-e-0 {
494
571
  margin-right: 0 !important;
495
572
  }
573
+
496
574
  .qti-margin-e-1 {
497
575
  margin-right: 0.25rem !important;
498
576
  }
577
+
499
578
  .qti-margin-e-2 {
500
579
  margin-right: 0.5rem !important;
501
580
  }
581
+
502
582
  .qti-margin-e-3 {
503
583
  margin-right: 1rem !important;
504
584
  }
585
+
505
586
  .qti-margin-e-4 {
506
587
  margin-right: 1.5rem !important;
507
588
  }
589
+
508
590
  .qti-margin-e-5 {
509
591
  margin-right: 3rem !important;
510
592
  }
593
+
511
594
  .qti-margin-e-auto {
512
595
  margin-right: auto !important;
513
596
  }
597
+
514
598
  /* =========
515
599
  Padding css
516
600
  ========== */
601
+
517
602
  /*
518
603
  For padding Top and Bottom and Left and Right
519
604
  */
520
605
  .qti-padding-0 {
521
606
  padding: 0 !important;
522
607
  }
608
+
523
609
  .qti-padding-1 {
524
610
  padding: 0.25rem !important;
525
611
  }
612
+
526
613
  .qti-padding-2 {
527
614
  padding: 0.5rem !important;
528
615
  }
616
+
529
617
  .qti-padding-3 {
530
618
  padding: 1rem !important;
531
619
  }
620
+
532
621
  .qti-padding-4 {
533
622
  padding: 1.5rem !important;
534
623
  }
624
+
535
625
  .qti-padding-5 {
536
626
  padding: 3rem !important;
537
627
  }
628
+
538
629
  /*
539
630
  For padding Left and Right
540
631
  */
@@ -542,26 +633,32 @@ Make sure to test your application with a production build as repeat registratio
542
633
  padding-right: 0 !important;
543
634
  padding-left: 0 !important;
544
635
  }
636
+
545
637
  .qti-padding-x-1 {
546
638
  padding-right: 0.25rem !important;
547
639
  padding-left: 0.25rem !important;
548
640
  }
641
+
549
642
  .qti-padding-x-2 {
550
643
  padding-right: 0.5rem !important;
551
644
  padding-left: 0.5rem !important;
552
645
  }
646
+
553
647
  .qti-padding-x-3 {
554
648
  padding-right: 1rem !important;
555
649
  padding-left: 1rem !important;
556
650
  }
651
+
557
652
  .qti-padding-x-4 {
558
653
  padding-right: 1.5rem !important;
559
654
  padding-left: 1.5rem !important;
560
655
  }
656
+
561
657
  .qti-padding-x-5 {
562
658
  padding-right: 3rem !important;
563
659
  padding-left: 3rem !important;
564
660
  }
661
+
565
662
  /*
566
663
  For padding Top and Bottom
567
664
  */
@@ -569,727 +666,962 @@ Make sure to test your application with a production build as repeat registratio
569
666
  padding-top: 0 !important;
570
667
  padding-bottom: 0 !important;
571
668
  }
669
+
572
670
  .qti-padding-y-1 {
573
671
  padding-top: 0.25rem !important;
574
672
  padding-bottom: 0.25rem !important;
575
673
  }
674
+
576
675
  .qti-padding-y-2 {
577
676
  padding-top: 0.5rem !important;
578
677
  padding-bottom: 0.5rem !important;
579
678
  }
679
+
580
680
  .qti-padding-y-3 {
581
681
  padding-top: 1rem !important;
582
682
  padding-bottom: 1rem !important;
583
683
  }
684
+
584
685
  .qti-padding-y-4 {
585
686
  padding-top: 1.5rem !important;
586
687
  padding-bottom: 1.5rem !important;
587
688
  }
689
+
588
690
  .qti-padding-y-5 {
589
691
  padding-top: 3rem !important;
590
692
  padding-bottom: 3rem !important;
591
693
  }
694
+
592
695
  /*
593
696
  For padding Top
594
697
  */
595
698
  .qti-padding-t-0 {
596
699
  padding-top: 0 !important;
597
700
  }
701
+
598
702
  .qti-padding-t-1 {
599
703
  padding-top: 0.25rem !important;
600
704
  }
705
+
601
706
  .qti-padding-t-2 {
602
707
  padding-top: 0.5rem !important;
603
708
  }
709
+
604
710
  .qti-padding-t-3 {
605
711
  padding-top: 1rem !important;
606
712
  }
713
+
607
714
  .qti-padding-t-4 {
608
715
  padding-top: 1.5rem !important;
609
716
  }
717
+
610
718
  .qti-padding-t-5 {
611
719
  padding-top: 3rem !important;
612
720
  }
721
+
613
722
  /*
614
723
  For padding Bottom
615
724
  */
616
725
  .qti-padding-b-0 {
617
726
  padding-bottom: 0 !important;
618
727
  }
728
+
619
729
  .qti-padding-b-1 {
620
730
  padding-bottom: 0.25rem !important;
621
731
  }
732
+
622
733
  .qti-padding-b-2 {
623
734
  padding-bottom: 0.5rem !important;
624
735
  }
736
+
625
737
  .qti-padding-b-3 {
626
738
  padding-bottom: 1rem !important;
627
739
  }
740
+
628
741
  .qti-padding-b-4 {
629
742
  padding-bottom: 1.5rem !important;
630
743
  }
744
+
631
745
  .qti-padding-b-5 {
632
746
  padding-bottom: 3rem !important;
633
747
  }
748
+
634
749
  /*
635
750
  For padding Start LTR
636
751
  */
637
752
  .qti-padding-s-0 {
638
753
  padding-left: 0 !important;
639
754
  }
755
+
640
756
  .qti-padding-s-1 {
641
757
  padding-left: 0.25rem !important;
642
758
  }
759
+
643
760
  .qti-padding-s-2 {
644
761
  padding-left: 0.5rem !important;
645
762
  }
763
+
646
764
  .qti-padding-s-3 {
647
765
  padding-left: 1rem !important;
648
766
  }
767
+
649
768
  .qti-padding-s-4 {
650
769
  padding-left: 1.5rem !important;
651
770
  }
771
+
652
772
  .qti-padding-s-5 {
653
773
  padding-left: 3rem !important;
654
774
  }
775
+
655
776
  /*
656
777
  For padding End LTR
657
778
  */
658
779
  .qti-padding-e-0 {
659
780
  padding-right: 0 !important;
660
781
  }
782
+
661
783
  .qti-padding-e-1 {
662
784
  padding-right: 0.25rem !important;
663
785
  }
786
+
664
787
  .qti-padding-e-2 {
665
788
  padding-right: 0.5rem !important;
666
789
  }
790
+
667
791
  .qti-padding-e-3 {
668
792
  padding-right: 1rem !important;
669
793
  }
794
+
670
795
  .qti-padding-e-4 {
671
796
  padding-right: 1.5rem !important;
672
797
  }
798
+
673
799
  .qti-padding-e-5 {
674
800
  padding-right: 3rem !important;
675
801
  }
802
+
676
803
  /* ====================
677
804
  Horizontal alignment
678
805
  ==================== */
806
+
679
807
  .qti-align-left {
680
808
  text-align: left;
681
809
  }
810
+
682
811
  .qti-align-center {
683
812
  text-align: center;
684
813
  }
814
+
685
815
  .qti-align-right {
686
816
  text-align: right;
687
817
  }
818
+
688
819
  /* ==================
689
820
  Vertical alignment
690
821
  ================== */
822
+
691
823
  .qti-valign-top {
692
824
  vertical-align: top;
693
825
  }
826
+
694
827
  .qti-valign-middle {
695
828
  vertical-align: middle;
696
829
  }
830
+
697
831
  .qti-valign-baseline {
698
832
  vertical-align: baseline;
699
833
  }
834
+
700
835
  .qti-valign-bottom {
701
836
  vertical-align: bottom;
702
837
  }
838
+
703
839
  /* =============
704
840
  Height styles
705
841
  ============= */
842
+
706
843
  .qti-height-0 {
707
844
  height: 0;
708
845
  }
846
+
709
847
  .qti-height-px {
710
848
  height: 1px;
711
849
  }
850
+
712
851
  .qti-height-0p5 {
713
852
  height: 0.125rem;
714
853
  }
854
+
715
855
  .qti-height-1 {
716
856
  height: 0.25rem;
717
857
  }
858
+
718
859
  .qti-height-1p5 {
719
860
  height: 0.375rem;
720
861
  }
862
+
721
863
  .qti-height-2 {
722
864
  height: 0.5rem;
723
865
  }
866
+
724
867
  .qti-height-2p5 {
725
868
  height: 0.625rem;
726
869
  }
870
+
727
871
  .qti-height-3 {
728
872
  height: 0.75rem;
729
873
  }
874
+
730
875
  .qti-height-3p5 {
731
876
  height: 0.875rem;
732
877
  }
878
+
733
879
  .qti-height-4 {
734
880
  height: 1rem;
735
881
  }
882
+
736
883
  .qti-height-5 {
737
884
  height: 1.25rem;
738
885
  }
886
+
739
887
  .qti-height-6 {
740
888
  height: 1.5rem;
741
889
  }
890
+
742
891
  .qti-height-7 {
743
892
  height: 1.75rem;
744
893
  }
894
+
745
895
  .qti-height-8 {
746
896
  height: 2rem;
747
897
  }
898
+
748
899
  .qti-height-9 {
749
900
  height: 2.25rem;
750
901
  }
902
+
751
903
  .qti-height-10 {
752
904
  height: 2.5rem;
753
905
  }
906
+
754
907
  .qti-height-11 {
755
908
  height: 2.75rem;
756
909
  }
910
+
757
911
  .qti-height-12 {
758
912
  height: 3rem;
759
913
  }
914
+
760
915
  .qti-height-14 {
761
916
  height: 3.5rem;
762
917
  }
918
+
763
919
  .qti-height-16 {
764
920
  height: 4rem;
765
921
  }
922
+
766
923
  .qti-height-20 {
767
924
  height: 5rem;
768
925
  }
926
+
769
927
  .qti-height-24 {
770
928
  height: 6rem;
771
929
  }
930
+
772
931
  .qti-height-28 {
773
932
  height: 7rem;
774
933
  }
934
+
775
935
  .qti-height-32 {
776
936
  height: 8rem;
777
937
  }
938
+
778
939
  .qti-height-36 {
779
940
  height: 9rem;
780
941
  }
942
+
781
943
  .qti-height-40 {
782
944
  height: 10rem;
783
945
  }
946
+
784
947
  .qti-height-44 {
785
948
  height: 11rem;
786
949
  }
950
+
787
951
  .qti-height-48 {
788
952
  height: 12rem;
789
953
  }
954
+
790
955
  .qti-height-52 {
791
956
  height: 13rem;
792
957
  }
958
+
793
959
  .qti-height-56 {
794
960
  height: 14rem;
795
961
  }
962
+
796
963
  .qti-height-60 {
797
964
  height: 15rem;
798
965
  }
966
+
799
967
  .qti-height-64 {
800
968
  height: 16rem;
801
969
  }
970
+
802
971
  .qti-height-72 {
803
972
  height: 18rem;
804
973
  }
974
+
805
975
  .qti-height-80 {
806
976
  height: 20rem;
807
977
  }
978
+
808
979
  .qti-height-96 {
809
980
  height: 24rem;
810
981
  }
982
+
811
983
  .qti-height-1-2 {
812
984
  height: 50%;
813
985
  }
986
+
814
987
  .qti-height-1-3 {
815
988
  height: 33.3333%;
816
989
  }
990
+
817
991
  .qti-height-2-3 {
818
992
  height: 66.6667%;
819
993
  }
994
+
820
995
  .qti-height-1-4 {
821
996
  height: 25%;
822
997
  }
998
+
823
999
  .qti-height-2-4 {
824
1000
  height: 50%;
825
1001
  }
1002
+
826
1003
  .qti-height-3-4 {
827
1004
  height: 75%;
828
1005
  }
1006
+
829
1007
  .qti-height-1-5 {
830
1008
  height: 20%;
831
1009
  }
1010
+
832
1011
  .qti-height-2-5 {
833
1012
  height: 40%;
834
1013
  }
1014
+
835
1015
  .qti-height-3-5 {
836
1016
  height: 60%;
837
1017
  }
1018
+
838
1019
  .qti-height-4-5 {
839
1020
  height: 80%;
840
1021
  }
1022
+
841
1023
  .qti-height-1-6 {
842
1024
  height: 16.6667%;
843
1025
  }
1026
+
844
1027
  .qti-height-2-6 {
845
1028
  height: 33.3333%;
846
1029
  }
1030
+
847
1031
  .qti-height-3-6 {
848
1032
  height: 50%;
849
1033
  }
1034
+
850
1035
  .qti-height-4-6 {
851
1036
  height: 66.6667%;
852
1037
  }
1038
+
853
1039
  .qti-height-5-6 {
854
1040
  height: 83.3333%;
855
1041
  }
1042
+
856
1043
  .qti-height-auto {
857
1044
  height: auto;
858
1045
  }
1046
+
859
1047
  .qti-height-full {
860
1048
  height: 100%;
861
1049
  }
1050
+
862
1051
  /* ============
863
1052
  Width styles
864
1053
  ============ */
1054
+
865
1055
  .qti-width-0 {
866
1056
  width: 0;
867
1057
  }
1058
+
868
1059
  .qti-width-px {
869
1060
  width: 1px;
870
1061
  }
1062
+
871
1063
  .qti-width-0p5 {
872
1064
  width: 0.125rem;
873
1065
  }
1066
+
874
1067
  .qti-width-1 {
875
1068
  width: 0.25rem;
876
1069
  }
1070
+
877
1071
  .qti-width-1p5 {
878
1072
  width: 0.375rem;
879
1073
  }
1074
+
880
1075
  .qti-width-2 {
881
1076
  width: 0.5rem;
882
1077
  }
1078
+
883
1079
  .qti-width-2p5 {
884
1080
  width: 0.625rem;
885
1081
  }
1082
+
886
1083
  .qti-width-3 {
887
1084
  width: 0.75rem;
888
1085
  }
1086
+
889
1087
  .qti-width-3p5 {
890
1088
  width: 0.875rem;
891
1089
  }
1090
+
892
1091
  .qti-width-4 {
893
1092
  width: 1rem;
894
1093
  }
1094
+
895
1095
  .qti-width-5 {
896
1096
  width: 1.25rem;
897
1097
  }
1098
+
898
1099
  .qti-width-6 {
899
1100
  width: 1.5rem;
900
1101
  }
1102
+
901
1103
  .qti-width-7 {
902
1104
  width: 1.75rem;
903
1105
  }
1106
+
904
1107
  .qti-width-8 {
905
1108
  width: 2rem;
906
1109
  }
1110
+
907
1111
  .qti-width-9 {
908
1112
  width: 2.25rem;
909
1113
  }
1114
+
910
1115
  .qti-width-10 {
911
1116
  width: 2.5rem;
912
1117
  }
1118
+
913
1119
  .qti-width-11 {
914
1120
  width: 2.75rem;
915
1121
  }
1122
+
916
1123
  .qti-width-12 {
917
1124
  width: 3rem;
918
1125
  }
1126
+
919
1127
  .qti-width-14 {
920
1128
  width: 3.5rem;
921
1129
  }
1130
+
922
1131
  .qti-width-16 {
923
1132
  width: 4rem;
924
1133
  }
1134
+
925
1135
  .qti-width-20 {
926
1136
  width: 5rem;
927
1137
  }
1138
+
928
1139
  .qti-width-24 {
929
1140
  width: 6rem;
930
1141
  }
1142
+
931
1143
  .qti-width-28 {
932
1144
  width: 7rem;
933
1145
  }
1146
+
934
1147
  .qti-width-32 {
935
1148
  width: 8rem;
936
1149
  }
1150
+
937
1151
  .qti-width-36 {
938
1152
  width: 9rem;
939
1153
  }
1154
+
940
1155
  .qti-width-40 {
941
1156
  width: 10rem;
942
1157
  }
1158
+
943
1159
  .qti-width-44 {
944
1160
  width: 11rem;
945
1161
  }
1162
+
946
1163
  .qti-width-48 {
947
1164
  width: 12rem;
948
1165
  }
1166
+
949
1167
  .qti-width-52 {
950
1168
  width: 13rem;
951
1169
  }
1170
+
952
1171
  .qti-width-56 {
953
1172
  width: 14rem;
954
1173
  }
1174
+
955
1175
  .qti-width-60 {
956
1176
  width: 15rem;
957
1177
  }
1178
+
958
1179
  .qti-width-64 {
959
1180
  width: 16rem;
960
1181
  }
1182
+
961
1183
  .qti-width-72 {
962
1184
  width: 18rem;
963
1185
  }
1186
+
964
1187
  .qti-width-80 {
965
1188
  width: 20rem;
966
1189
  }
1190
+
967
1191
  .qti-width-96 {
968
1192
  width: 24rem;
969
1193
  }
1194
+
970
1195
  .qti-width-auto {
971
1196
  width: auto;
972
1197
  }
1198
+
973
1199
  .qti-width-1-2 {
974
1200
  width: 50%;
975
1201
  }
1202
+
976
1203
  .qti-width-1-3 {
977
1204
  width: 33.3333%;
978
1205
  }
1206
+
979
1207
  .qti-width-2-3 {
980
1208
  width: 66.6667%;
981
1209
  }
1210
+
982
1211
  .qti-width-1-4 {
983
1212
  width: 25%;
984
1213
  }
1214
+
985
1215
  .qti-width-2-4 {
986
1216
  width: 50%;
987
1217
  }
1218
+
988
1219
  .qti-width-3-4 {
989
1220
  width: 75%;
990
1221
  }
1222
+
991
1223
  .qti-width-1-5 {
992
1224
  width: 20%;
993
1225
  }
1226
+
994
1227
  .qti-width-2-5 {
995
1228
  width: 40%;
996
1229
  }
1230
+
997
1231
  .qti-width-3-5 {
998
1232
  width: 60%;
999
1233
  }
1234
+
1000
1235
  .qti-width-4-5 {
1001
1236
  width: 80%;
1002
1237
  }
1238
+
1003
1239
  .qti-width-1-6 {
1004
1240
  width: 16.6667%;
1005
1241
  }
1242
+
1006
1243
  .qti-width-2-6 {
1007
1244
  width: 33.3333%;
1008
1245
  }
1246
+
1009
1247
  .qti-width-3-6 {
1010
1248
  width: 50%;
1011
1249
  }
1250
+
1012
1251
  .qti-width-4-6 {
1013
1252
  width: 66.6667%;
1014
1253
  }
1254
+
1015
1255
  .qti-width-5-6 {
1016
1256
  width: 83.3333%;
1017
1257
  }
1258
+
1018
1259
  .qti-width-1-12 {
1019
1260
  width: 8.3333%;
1020
1261
  }
1262
+
1021
1263
  .qti-width-2-12 {
1022
1264
  width: 16.6667%;
1023
1265
  }
1266
+
1024
1267
  .qti-width-3-12 {
1025
1268
  width: 25%;
1026
1269
  }
1270
+
1027
1271
  .qti-width-4-12 {
1028
1272
  width: 33.3333%;
1029
1273
  }
1274
+
1030
1275
  .qti-width-5-12 {
1031
1276
  width: 41.6667%;
1032
1277
  }
1278
+
1033
1279
  .qti-width-6-12 {
1034
1280
  width: 50%;
1035
1281
  }
1282
+
1036
1283
  .qti-width-7-12 {
1037
1284
  width: 58.3333%;
1038
1285
  }
1286
+
1039
1287
  .qti-width-8-12 {
1040
1288
  width: 66.6667%;
1041
1289
  }
1290
+
1042
1291
  .qti-width-9-12 {
1043
1292
  width: 75%;
1044
1293
  }
1294
+
1045
1295
  .qti-width-10-12 {
1046
1296
  width: 83.3333%;
1047
1297
  }
1298
+
1048
1299
  .qti-width-11-12 {
1049
1300
  width: 91.6667%;
1050
1301
  }
1302
+
1051
1303
  .qti-width-full,
1052
1304
  .qti-fullwidth {
1053
1305
  width: 100%;
1054
1306
  }
1307
+
1055
1308
  /* ==================
1056
1309
  Text Indent styles
1057
1310
  ================== */
1311
+
1058
1312
  .qti-text-indent-0 {
1059
1313
  text-indent: 0;
1060
1314
  }
1315
+
1061
1316
  .qti-text-indent-px {
1062
1317
  text-indent: 1px;
1063
1318
  }
1319
+
1064
1320
  .qti-text-indent-0p5 {
1065
1321
  text-indent: 0.125rem;
1066
1322
  }
1323
+
1067
1324
  .qti-text-indent-1 {
1068
1325
  text-indent: 0.25rem;
1069
1326
  }
1327
+
1070
1328
  .qti-text-indent-1p5 {
1071
1329
  text-indent: 0.375rem;
1072
1330
  }
1331
+
1073
1332
  .qti-text-indent-2 {
1074
1333
  text-indent: 0.5rem;
1075
1334
  }
1335
+
1076
1336
  .qti-text-indent-2p5 {
1077
1337
  text-indent: 0.625rem;
1078
1338
  }
1339
+
1079
1340
  .qti-text-indent-3 {
1080
1341
  text-indent: 0.75rem;
1081
1342
  }
1343
+
1082
1344
  .qti-text-indent-3p5 {
1083
1345
  text-indent: 0.875rem;
1084
1346
  }
1347
+
1085
1348
  .qti-text-indent-4 {
1086
1349
  text-indent: 1rem;
1087
1350
  }
1351
+
1088
1352
  .qti-text-indent-5 {
1089
1353
  text-indent: 1.25rem;
1090
1354
  }
1355
+
1091
1356
  .qti-text-indent-6 {
1092
1357
  text-indent: 1.5rem;
1093
1358
  }
1359
+
1094
1360
  .qti-text-indent-7 {
1095
1361
  text-indent: 1.75rem;
1096
1362
  }
1363
+
1097
1364
  .qti-text-indent-8 {
1098
1365
  text-indent: 2rem;
1099
1366
  }
1367
+
1100
1368
  .qti-text-indent-12 {
1101
1369
  text-indent: 3rem;
1102
1370
  }
1371
+
1103
1372
  .qti-text-indent-16 {
1104
1373
  text-indent: 4rem;
1105
1374
  }
1375
+
1106
1376
  .qti-text-indent-20 {
1107
1377
  text-indent: 5rem;
1108
1378
  }
1379
+
1109
1380
  .qti-text-indent-24 {
1110
1381
  text-indent: 6rem;
1111
1382
  }
1383
+
1112
1384
  .qti-text-indent-28 {
1113
1385
  text-indent: 7rem;
1114
1386
  }
1387
+
1115
1388
  .qti-text-indent-32 {
1116
1389
  text-indent: 8rem;
1117
1390
  }
1391
+
1118
1392
  /* =================
1119
1393
  List Style styles
1120
1394
  ================= */
1395
+
1121
1396
  .qti-list-style-type-none {
1122
1397
  list-style-type: none;
1123
1398
  }
1399
+
1124
1400
  .qti-list-style-type-disc {
1125
1401
  list-style-type: disc;
1126
1402
  }
1403
+
1127
1404
  .qti-list-style-type-circle {
1128
1405
  list-style-type: circle;
1129
1406
  }
1407
+
1130
1408
  .qti-list-style-type-square {
1131
1409
  list-style-type: square;
1132
1410
  }
1411
+
1133
1412
  .qti-list-style-type-decimal {
1134
1413
  list-style-type: decimal;
1135
1414
  }
1415
+
1136
1416
  .qti-list-style-type-decimal-leading-zero {
1137
1417
  list-style-type: decimal-leading-zero;
1138
1418
  }
1419
+
1139
1420
  .qti-list-style-type-lower-alpha {
1140
1421
  list-style-type: lower-alpha;
1141
1422
  }
1423
+
1142
1424
  .qti-list-style-type-upper-alpha {
1143
1425
  list-style-type: upper-alpha;
1144
1426
  }
1427
+
1145
1428
  .qti-list-style-type-lower-roman {
1146
1429
  list-style-type: lower-roman;
1147
1430
  }
1431
+
1148
1432
  .qti-list-style-type-upper-roman {
1149
1433
  list-style-type: upper-roman;
1150
1434
  }
1435
+
1151
1436
  .qti-list-style-type-lower-latin {
1152
1437
  list-style-type: lower-latin;
1153
1438
  }
1439
+
1154
1440
  .qti-list-style-type-upper-latin {
1155
1441
  list-style-type: upper-latin;
1156
1442
  }
1443
+
1157
1444
  .qti-list-style-type-lower-greek {
1158
1445
  list-style-type: lower-greek;
1159
1446
  }
1447
+
1160
1448
  .qti-list-style-type-arabic-indic {
1161
1449
  list-style-type: arabic-indic;
1162
1450
  }
1451
+
1163
1452
  .qti-list-style-type-armenian {
1164
1453
  list-style-type: armenian;
1165
1454
  }
1455
+
1166
1456
  .qti-list-style-type-lower-armenian {
1167
1457
  list-style-type: lower-armenian;
1168
1458
  }
1459
+
1169
1460
  .qti-list-style-type-upper-armenian {
1170
1461
  list-style-type: upper-armenian;
1171
1462
  }
1463
+
1172
1464
  .qti-list-style-type-bengali {
1173
1465
  list-style-type: bengali;
1174
1466
  }
1467
+
1175
1468
  .qti-list-style-type-cambodian {
1176
1469
  list-style-type: cambodian;
1177
1470
  }
1471
+
1178
1472
  .qti-list-style-type-simp-chinese-formal {
1179
1473
  list-style-type: simp-chinese-formal;
1180
1474
  }
1475
+
1181
1476
  .qti-list-style-type-simp-chinese-informal {
1182
1477
  list-style-type: simp-chinese-informal;
1183
1478
  }
1479
+
1184
1480
  .qti-list-style-type-trad-chinese-formal {
1185
1481
  list-style-type: trad-chinese-formal;
1186
1482
  }
1483
+
1187
1484
  .qti-list-style-type-trad-chinese-informal {
1188
1485
  list-style-type: trad-chinese-informal;
1189
1486
  }
1487
+
1190
1488
  .qti-list-style-type-cjk-ideographic {
1191
1489
  list-style-type: cjk-ideographic;
1192
1490
  }
1491
+
1193
1492
  .qti-list-style-type-cjk-heavenly-stem {
1194
1493
  list-style-type: cjk-heavenly-stem;
1195
1494
  }
1495
+
1196
1496
  .qti-list-style-type-cjk-earthly-branch {
1197
1497
  list-style-type: cjk-earthly-branch;
1198
1498
  }
1499
+
1199
1500
  .qti-list-style-type-devanagari {
1200
1501
  list-style-type: devanagari;
1201
1502
  }
1503
+
1202
1504
  .qti-list-style-type-ethiopic-halehame-ti-er {
1203
1505
  list-style-type: ethiopic-halehame-ti-er;
1204
1506
  }
1507
+
1205
1508
  .qti-list-style-type-ethiopic-halehame-ti-et {
1206
1509
  list-style-type: ethiopic-halehame-ti-et;
1207
1510
  }
1511
+
1208
1512
  .qti-list-style-type-ethiopic-halehame-am {
1209
1513
  list-style-type: ethiopic-halehame-am;
1210
1514
  }
1515
+
1211
1516
  .qti-list-style-type-ethiopic-halehame {
1212
1517
  list-style-type: ethiopic-halehame;
1213
1518
  }
1519
+
1214
1520
  .qti-list-style-type-georgian {
1215
1521
  list-style-type: georgian;
1216
1522
  }
1523
+
1217
1524
  .qti-list-style-type-gujarati {
1218
1525
  list-style-type: gujarati;
1219
1526
  }
1527
+
1220
1528
  .qti-list-style-type-gurmukhi {
1221
1529
  list-style-type: gurmukhi;
1222
1530
  }
1531
+
1223
1532
  .qti-list-style-type-hangul {
1224
1533
  list-style-type: hangul;
1225
1534
  }
1535
+
1226
1536
  .qti-list-style-type-hangul-consonant {
1227
1537
  list-style-type: hangul-consonant;
1228
1538
  }
1539
+
1229
1540
  .qti-list-style-type-hebrew {
1230
1541
  list-style-type: hebrew;
1231
1542
  }
1543
+
1232
1544
  .qti-list-style-type-hiragana {
1233
1545
  list-style-type: hiragana;
1234
1546
  }
1547
+
1235
1548
  .qti-list-style-type-hiragana-iroha {
1236
1549
  list-style-type: hiragana-iroha;
1237
1550
  }
1551
+
1238
1552
  .qti-list-style-type-khmer {
1239
1553
  list-style-type: khmer;
1240
1554
  }
1555
+
1241
1556
  .qti-list-style-type-korean-hangul-formal {
1242
1557
  list-style-type: korean-hangul-formal;
1243
1558
  }
1559
+
1244
1560
  .qti-list-style-type-korean-hanja-formal {
1245
1561
  list-style-type: korean-hanja-formal;
1246
1562
  }
1563
+
1247
1564
  .qti-list-style-type-korean-hanja-informal {
1248
1565
  list-style-type: korean-hanja-informal;
1249
1566
  }
1567
+
1250
1568
  .qti-list-style-type-lao {
1251
1569
  list-style-type: lao;
1252
1570
  }
1571
+
1253
1572
  .qti-list-style-type-malayalam {
1254
1573
  list-style-type: malayalam;
1255
1574
  }
1575
+
1256
1576
  .qti-list-style-type-mongolian {
1257
1577
  list-style-type: mongolian;
1258
1578
  }
1579
+
1259
1580
  .qti-list-style-type-myanmar {
1260
1581
  list-style-type: myanmar;
1261
1582
  }
1583
+
1262
1584
  .qti-list-style-type-oriya {
1263
1585
  list-style-type: oriya;
1264
1586
  }
1587
+
1265
1588
  .qti-list-style-type-persian {
1266
1589
  list-style-type: persian;
1267
1590
  }
1591
+
1268
1592
  .qti-list-style-type-thai {
1269
1593
  list-style-type: thai;
1270
1594
  }
1595
+
1271
1596
  .qti-list-style-type-tibetan {
1272
1597
  list-style-type: tibetan;
1273
1598
  }
1599
+
1274
1600
  .qti-list-style-type-telugu {
1275
1601
  list-style-type: telugu;
1276
1602
  }
1603
+
1277
1604
  .qti-list-style-type-urdu {
1278
1605
  list-style-type: urdu;
1279
1606
  }
1607
+
1280
1608
  /* =========================
1281
1609
  Other QTI 3 Presentation Utilities
1282
1610
  ========================= */
1611
+
1283
1612
  .qti-bordered {
1284
1613
  border: 1px solid var(--table-border-color);
1285
1614
  }
1615
+
1286
1616
  .qti-underline {
1287
1617
  text-decoration: underline;
1288
1618
  text-decoration-color: var(--foreground);
1289
1619
  }
1620
+
1290
1621
  .qti-italic {
1291
1622
  font-style: italic;
1292
1623
  }
1624
+
1293
1625
  .qti-well {
1294
1626
  min-height: 20px;
1295
1627
  padding: 19px;
@@ -1299,33 +1631,40 @@ Make sure to test your application with a production build as repeat registratio
1299
1631
  border-radius: 4px;
1300
1632
  box-shadow: var(--well-box-shadow);
1301
1633
  }
1634
+
1302
1635
  /* Set writing-mode to vertical-rl
1303
1636
  Typical for CJK vertical text */
1304
1637
  .qti-writing-mode-vertical-rl {
1305
1638
  writing-mode: vertical-rl;
1306
1639
  }
1640
+
1307
1641
  /* Set writing-mode to vertical-lr
1308
1642
  Typical for Mongolian vertical text */
1309
1643
  .qti-writing-mode-vertical-lr {
1310
1644
  writing-mode: vertical-lr;
1311
1645
  }
1646
+
1312
1647
  /* Set writing-mode to horizontal-tb
1313
1648
  Browser default */
1314
1649
  .qti-writing-mode-horizontal-tb {
1315
1650
  writing-mode: horizontal-tb;
1316
1651
  }
1652
+
1317
1653
  /* Float an element left */
1318
1654
  .qti-float-left {
1319
1655
  float: left;
1320
1656
  }
1657
+
1321
1658
  /* Float an element right */
1322
1659
  .qti-float-right {
1323
1660
  float: right;
1324
1661
  }
1662
+
1325
1663
  /* Remove a float */
1326
1664
  .qti-float-none {
1327
1665
  float: none;
1328
1666
  }
1667
+
1329
1668
  /* Clearfix Hack to apply to a container of
1330
1669
  floated content that overflows the container. */
1331
1670
  .qti-float-clearfix::after {
@@ -1333,6 +1672,7 @@ Make sure to test your application with a production build as repeat registratio
1333
1672
  clear: both;
1334
1673
  display: table;
1335
1674
  }
1675
+
1336
1676
  .qti-float-clear-left
1337
1677
  .qti-float-clear-right
1338
1678
  .qti-float-clear-both
@@ -1341,121 +1681,138 @@ Make sure to test your application with a production build as repeat registratio
1341
1681
  .qti-text-orientation-upright {
1342
1682
  text-orientation: upright;
1343
1683
  }
1344
- @layer qti-base {
1345
- .qti-layout-row {
1346
- display: flex;
1347
- flex-wrap: wrap;
1348
- width: 100%;
1349
- gap: 2.1276595745%;
1350
- }
1684
+ }
1685
+ @layer qti-base{
1351
1686
 
1352
- .qti-layout-row [class*='qti-layout-col']:not(:empty) {
1353
- box-sizing: border-box;
1354
- }
1687
+ .qti-layout-row {
1688
+ display: flex;
1689
+ flex-wrap: wrap;
1690
+ width: 100%;
1691
+ gap: 2.1276595745%;
1692
+ }
1355
1693
 
1356
- .qti-layout-row [class*='qti-layout-col']:empty {
1357
- width: 0;
1358
- overflow: hidden; /* to fully collapse if there\u2019s padding or borders */
1359
- }
1694
+ .qti-layout-row [class*='qti-layout-col']:not(:empty) {
1695
+ box-sizing: border-box;
1696
+ }
1360
1697
 
1361
- .qti-layout-col1 {
1362
- width: 6.3829787234%;
1363
- }
1698
+ .qti-layout-row [class*='qti-layout-col']:empty {
1699
+ width: 0;
1700
+ overflow: hidden; /* to fully collapse if there\u2019s padding or borders */
1701
+ }
1364
1702
 
1365
- .qti-layout-col2 {
1366
- width: 14.8936170213%;
1367
- }
1703
+ .qti-layout-col1 {
1704
+ width: 6.3829787234%;
1705
+ }
1368
1706
 
1369
- .qti-layout-col3 {
1370
- width: 23.4042553191%;
1371
- }
1707
+ .qti-layout-col2 {
1708
+ width: 14.8936170213%;
1709
+ }
1372
1710
 
1373
- .qti-layout-col4 {
1374
- width: 31.914893617%;
1375
- }
1711
+ .qti-layout-col3 {
1712
+ width: 23.4042553191%;
1713
+ }
1376
1714
 
1377
- .qti-layout-col5 {
1378
- width: 40.4255319149%;
1379
- }
1715
+ .qti-layout-col4 {
1716
+ width: 31.914893617%;
1717
+ }
1380
1718
 
1381
- .qti-layout-col6 {
1382
- width: 48.9361702128%;
1383
- }
1719
+ .qti-layout-col5 {
1720
+ width: 40.4255319149%;
1721
+ }
1384
1722
 
1385
- .qti-layout-col7 {
1386
- width: 57.4468085106%;
1387
- }
1723
+ .qti-layout-col6 {
1724
+ width: 48.9361702128%;
1725
+ }
1388
1726
 
1389
- .qti-layout-col8 {
1390
- width: 65.9574468085%;
1391
- }
1727
+ .qti-layout-col7 {
1728
+ width: 57.4468085106%;
1729
+ }
1392
1730
 
1393
- .qti-layout-col9 {
1394
- width: 74.4680851064%;
1395
- }
1731
+ .qti-layout-col8 {
1732
+ width: 65.9574468085%;
1733
+ }
1396
1734
 
1397
- .qti-layout-col10 {
1398
- width: 82.9787234043%;
1399
- }
1735
+ .qti-layout-col9 {
1736
+ width: 74.4680851064%;
1737
+ }
1400
1738
 
1401
- .qti-layout-col11 {
1402
- width: 91.4893617021%;
1403
- }
1739
+ .qti-layout-col10 {
1740
+ width: 82.9787234043%;
1741
+ }
1404
1742
 
1405
- .qti-layout-col12 {
1406
- width: 100%;
1407
- }
1743
+ .qti-layout-col11 {
1744
+ width: 91.4893617021%;
1745
+ }
1408
1746
 
1409
- .qti-layout-offset1 {
1410
- margin-left: 8.5106382979%;
1411
- }
1747
+ .qti-layout-col12 {
1748
+ width: 100%;
1749
+ }
1412
1750
 
1413
- .qti-layout-offset2 {
1414
- margin-left: 17.0212765957%;
1415
- }
1751
+ .qti-layout-offset1 {
1752
+ margin-left: 8.5106382979%;
1753
+ }
1416
1754
 
1417
- .qti-layout-offset3 {
1418
- margin-left: 25.5319148936%;
1419
- }
1755
+ .qti-layout-offset2 {
1756
+ margin-left: 17.0212765957%;
1757
+ }
1420
1758
 
1421
- .qti-layout-offset4 {
1422
- margin-left: 34.0425531915%;
1423
- }
1759
+ .qti-layout-offset3 {
1760
+ margin-left: 25.5319148936%;
1761
+ }
1424
1762
 
1425
- .qti-layout-offset5 {
1426
- margin-left: 42.5531914894%;
1427
- }
1763
+ .qti-layout-offset4 {
1764
+ margin-left: 34.0425531915%;
1765
+ }
1428
1766
 
1429
- .qti-layout-offset6 {
1430
- margin-left: 51.0638297872%;
1431
- }
1767
+ .qti-layout-offset5 {
1768
+ margin-left: 42.5531914894%;
1769
+ }
1432
1770
 
1433
- .qti-layout-offset7 {
1434
- margin-left: 59.5744680851%;
1435
- }
1771
+ .qti-layout-offset6 {
1772
+ margin-left: 51.0638297872%;
1773
+ }
1436
1774
 
1437
- .qti-layout-offset8 {
1438
- margin-left: 68.085106383%;
1439
- }
1775
+ .qti-layout-offset7 {
1776
+ margin-left: 59.5744680851%;
1777
+ }
1440
1778
 
1441
- .qti-layout-offset9 {
1442
- margin-left: 76.5957446809%;
1443
- }
1779
+ .qti-layout-offset8 {
1780
+ margin-left: 68.085106383%;
1781
+ }
1444
1782
 
1445
- .qti-layout-offset10 {
1446
- margin-left: 85.1063829787%;
1447
- }
1783
+ .qti-layout-offset9 {
1784
+ margin-left: 76.5957446809%;
1785
+ }
1448
1786
 
1449
- .qti-layout-offset11 {
1450
- margin-left: 93.6170212766%;
1451
- }
1787
+ .qti-layout-offset10 {
1788
+ margin-left: 85.1063829787%;
1789
+ }
1452
1790
 
1453
- @media (width <= 767px) {
1454
- [class*='qti-layout-col'] {
1455
- width: 100%;
1456
- }
1791
+ .qti-layout-offset11 {
1792
+ margin-left: 93.6170212766%;
1793
+ }
1794
+
1795
+ @media (width <= 767px) {
1796
+ [class*='qti-layout-col'] {
1797
+ width: 100%;
1457
1798
  }
1458
1799
  }
1800
+ }
1801
+ /**
1802
+ * Layer order for everything the theme ships, and the imports that fill it.
1803
+ *
1804
+ * A file is assigned its layer HERE, at its import, wherever it belongs to exactly one layer \u2014
1805
+ * so the ordering is readable in one place and the file itself stays free of wrapper blocks.
1806
+ * The files imported without \`layer()\` below span several layers internally and declare their
1807
+ * own \`@layer\` blocks; splitting them per layer is the only way to import-assign them, and is
1808
+ * not worth the file count.
1809
+ *
1810
+ * \`interactions.brand\` and \`overrides\` hold nothing here ON PURPOSE \u2014 they are the extension points
1811
+ * a brand sheet writes into (apps/e2e/src/stories/kennisnet/kennisnet.css uses \`interactions.brand\`).
1812
+ * They must stay DECLARED even while empty: a layer first created by a consumer's own \`@layer\`
1813
+ * block is appended after every declared layer, which would put brand paint above the state and
1814
+ * correction paint it is meant to sit under. Deleting the two names moved 7 of the 17 VRT baselines.
1815
+ */
1459
1816
  @layer qti-components.reset{
1460
1817
  @scope (qti-item-body, .ProseMirror) {
1461
1818
  :scope,
@@ -1507,7 +1864,8 @@ Make sure to test your application with a production build as repeat registratio
1507
1864
  }
1508
1865
  }
1509
1866
  }
1510
- /* Plain HTML author markup (tables, lists, rules). Sibling to reset.css, same @scope. */
1867
+ @layer qti-components.elements{
1868
+
1511
1869
  /**
1512
1870
  * Prose \u2014 plain HTML author markup: tables, lists, headings, rules.
1513
1871
  *
@@ -1531,40 +1889,41 @@ Make sure to test your application with a production build as repeat registratio
1531
1889
  * Values route through the theme tokens with a literal fallback, so prose tracks a brand for free.
1532
1890
  * The --qti-prose-* names are the override surface.
1533
1891
  */
1534
- @layer qti-components.elements {
1535
- /*
1536
- * Shared \u2014 rendered item bodies AND editor documents.
1537
- *
1538
- * Intentionally empty. Every candidate rule so far (border-collapse, cell padding) moves rendered
1539
- * items, which is a product decision rather than a styling gap. Add here only with that in mind.
1540
- */
1541
1892
 
1542
- /*
1543
- * Authoring only \u2014 the editor's document.
1544
- */
1545
- @scope (.ProseMirror) {
1546
- :scope table {
1547
- border-collapse: collapse;
1548
- margin: var(--qti-prose-table-margin, 0.5rem 0);
1549
- }
1893
+ /*
1894
+ * Shared \u2014 rendered item bodies AND editor documents.
1895
+ *
1896
+ * Intentionally empty. Every candidate rule so far (border-collapse, cell padding) moves rendered
1897
+ * items, which is a product decision rather than a styling gap. Add here only with that in mind.
1898
+ */
1550
1899
 
1551
- :scope th,
1552
- :scope td {
1553
- border: var(--qti-prose-table-border-width, var(--qti-border-thickness, 1px))
1554
- var(--qti-prose-table-border-style, var(--qti-border-style, solid))
1555
- var(--qti-prose-table-border-color, var(--qti-border-color, #c6cad0));
1556
- padding: var(--qti-prose-table-cell-padding, 0.25rem 0.5rem);
1557
- text-align: left;
1558
- /* No vertical-align here: that is layout, and the theme does not do layout (CONTRACT.md \xA77,
1559
- enforced by qti/no-layout-in-theme). Cells keep the UA default. */
1560
- }
1900
+ /*
1901
+ * Authoring only \u2014 the editor's document.
1902
+ */
1903
+ @scope (.ProseMirror) {
1904
+ :scope table {
1905
+ border-collapse: collapse;
1906
+ margin: var(--qti-prose-table-margin, 0.5rem 0);
1907
+ }
1908
+
1909
+ :scope th,
1910
+ :scope td {
1911
+ border: var(--qti-prose-table-border-width, var(--qti-border-thickness, 1px))
1912
+ var(--qti-prose-table-border-style, var(--qti-border-style, solid))
1913
+ var(--qti-prose-table-border-color, var(--qti-border-color, #c6cad0));
1914
+ padding: var(--qti-prose-table-cell-padding, 0.25rem 0.5rem);
1915
+ text-align: left;
1916
+ /* No vertical-align here: that is layout, and the theme does not do layout (CONTRACT.md \xA77,
1917
+ enforced by qti/no-layout-in-theme). Cells keep the UA default. */
1918
+ }
1561
1919
 
1562
- :scope th {
1563
- background: var(--qti-prose-table-header-bg, var(--qti-bg-active, #f6f8fa));
1564
- font-weight: 600;
1565
- }
1920
+ :scope th {
1921
+ background: var(--qti-prose-table-header-bg, var(--qti-bg-active, #f6f8fa));
1922
+ font-weight: 600;
1566
1923
  }
1567
1924
  }
1925
+ }
1926
+ /* Multi-layer: declares global + interactions.{base,states,corrections} internally. */
1568
1927
  /* QTI base \u2014 design variables. The theme's tokens; a substrate overrides their VALUES to
1569
1928
  * express its look (value first). Split from qti-base.css. See also qti-mixins.css.
1570
1929
  *
@@ -2007,6 +2366,7 @@ Make sure to test your application with a production build as repeat registratio
2007
2366
  --qti-answer-border: var(--qti-info);
2008
2367
  }
2009
2368
  }
2369
+ /* Mixin definitions only \u2014 emits nothing on its own, so it takes no layer. */
2010
2370
  /* QTI base \u2014 shared theme utilities and semantic mixins. Only styles >=2 interactions share.
2011
2371
  * They read the variables in qti-variables.css; a substrate re-colours by overriding those, not
2012
2372
  * by editing these. Split from qti-base.css. */
@@ -2232,6 +2592,7 @@ Make sure to test your application with a production build as repeat registratio
2232
2592
  * hotspots and choices alike where no single rule suited all of them. This one is called from drags
2233
2593
  * only.
2234
2594
  */
2595
+ /* Per-interaction sheets; each import carries its layer where the file has just one. */
2235
2596
  @layer qti-components.interactions.base {
2236
2597
  qti-choice-interaction {
2237
2598
  /* A choice hugs its text here, unlike order-interaction, which uses the same element as a chip.
@@ -5764,11 +6125,11 @@ Make sure to test your application with a production build as repeat registratio
5764
6125
  }
5765
6126
  }
5766
6127
  }
5767
- @layer qti-components.interactions.base {
5768
- qti-slider-interaction {
5769
- --qti-tick-color: rgb(229 231 235 / 100%);
5770
- --qti-tick-width: 1px;
5771
- }
6128
+ @layer qti-components.interactions.base{
6129
+ qti-slider-interaction {
6130
+ --qti-tick-color: rgb(229 231 235 / 100%);
6131
+ --qti-tick-width: 1px;
6132
+ }
5772
6133
  }
5773
6134
  @layer qti-components.interactions.base {
5774
6135
  qti-select-point-interaction {
@@ -5807,16 +6168,17 @@ Make sure to test your application with a production build as repeat registratio
5807
6168
  }
5808
6169
  }
5809
6170
  }
5810
- @layer qti-components.interactions.base {
5811
- qti-position-object-stage {
5812
- & qti-position-object-interaction {
5813
- /* no styles necessary, only layout styles, defined in the component */
5814
- }
6171
+ @layer qti-components.interactions.base{
6172
+ qti-position-object-stage {
6173
+ & qti-position-object-interaction {
6174
+ /* no styles necessary, only layout styles, defined in the component */
5815
6175
  }
5816
6176
  }
5817
- @layer qti-components.interactions.base {
5818
- /* \`display: block\` lives in qti-prompt.styles.ts, which already declares it on :host. */
5819
6177
  }
6178
+ @layer qti-components.interactions.base{
6179
+ /* \`display: block\` lives in qti-prompt.styles.ts, which already declares it on :host. */
6180
+ }
6181
+ @layer qti-components.interactions.corrections{
5820
6182
  /*
5821
6183
  * What is LEFT here is what the base class owns.
5822
6184
  *
@@ -5838,58 +6200,54 @@ Make sure to test your application with a production build as repeat registratio
5838
6200
  * never rendered, because the shared rule declared \`background-color\` directly and outranked the
5839
6201
  * binding that reads them. Deleted with the rule that was hiding them.
5840
6202
  */
5841
- @layer qti-components.interactions.corrections {
5842
- /*
5843
- * The candidate-correction badge, \`part="correction"\` on every corrected element.
5844
- *
5845
- * A token list, so \`::part(correction-correct)\` reaches the badge in the drag bank, on the
5846
- * floating clone, and inside a drop target's shadow root \u2014 a token survives \`exportparts\`,
5847
- * where a chained \`::part()\` would not.
5848
- */
5849
- ::part(correction-correct) {
5850
- background-color: var(--qti-correct);
5851
- mask: var(--qti-check-mask) no-repeat center / contain;
5852
- -webkit-mask: var(--qti-check-mask) no-repeat center / contain;
5853
- }
5854
-
5855
- ::part(correction-incorrect) {
5856
- background-color: var(--qti-incorrect);
5857
- mask: var(--qti-times-mask) no-repeat center / contain;
5858
- -webkit-mask: var(--qti-times-mask) no-repeat center / contain;
5859
- }
5860
-
5861
-
6203
+ /*
6204
+ * The candidate-correction badge, \`part="correction"\` on every corrected element.
6205
+ *
6206
+ * A token list, so \`::part(correction-correct)\` reaches the badge in the drag bank, on the
6207
+ * floating clone, and inside a drop target's shadow root \u2014 a token survives \`exportparts\`,
6208
+ * where a chained \`::part()\` would not.
6209
+ */
6210
+ ::part(correction-correct) {
6211
+ background-color: var(--qti-correct);
6212
+ mask: var(--qti-check-mask) no-repeat center / contain;
6213
+ -webkit-mask: var(--qti-check-mask) no-repeat center / contain;
6214
+ }
5862
6215
 
5863
- /*
5864
- * The third verdict. correction.styles.ts has always SIZED \`correction-partially-correct\` beside
5865
- * its two siblings, but no rule anywhere ever painted it \u2014 so a partially-correct badge has been
5866
- * an invisible 1em gap in every interaction, not just extended-text. This is repo-wide, and the
5867
- * reason it went unnoticed is that partial credit needs a mapping to arise at all.
5868
- */
5869
- ::part(correction-partially-correct) {
5870
- background-color: var(--qti-partially-correct);
5871
- mask: var(--qti-partial-mask) no-repeat center / contain;
5872
- -webkit-mask: var(--qti-partial-mask) no-repeat center / contain;
5873
- }
6216
+ ::part(correction-incorrect) {
6217
+ background-color: var(--qti-incorrect);
6218
+ mask: var(--qti-times-mask) no-repeat center / contain;
6219
+ -webkit-mask: var(--qti-times-mask) no-repeat center / contain;
6220
+ }
5874
6221
 
6222
+ /*
6223
+ * The third verdict. correction.styles.ts has always SIZED \`correction-partially-correct\` beside
6224
+ * its two siblings, but no rule anywhere ever painted it \u2014 so a partially-correct badge has been
6225
+ * an invisible 1em gap in every interaction, not just extended-text. This is repo-wide, and the
6226
+ * reason it went unnoticed is that partial credit needs a mapping to arise at all.
6227
+ */
6228
+ ::part(correction-partially-correct) {
6229
+ background-color: var(--qti-partially-correct);
6230
+ mask: var(--qti-partial-mask) no-repeat center / contain;
6231
+ -webkit-mask: var(--qti-partial-mask) no-repeat center / contain;
6232
+ }
5875
6233
 
5876
- /* A cloned interaction presents the answer key rather than a candidate judgement. What is left
5877
- here is the part no interaction owns: any chip, anywhere. The text-entry and inline-choice
5878
- halves moved into their own files \u2014 those name one interaction each, so they belong to it. */
5879
- .full-correct-response :state(drag),
5880
- .full-correct-response ::part(drag) {
5881
- background-color: var(--qti-answer-bg);
5882
- color: var(--qti-answer-fg);
5883
- border-color: var(--qti-answer-border);
5884
- }
6234
+ /* A cloned interaction presents the answer key rather than a candidate judgement. What is left
6235
+ here is the part no interaction owns: any chip, anywhere. The text-entry and inline-choice
6236
+ halves moved into their own files \u2014 those name one interaction each, so they belong to it. */
6237
+ .full-correct-response :state(drag),
6238
+ .full-correct-response ::part(drag) {
6239
+ background-color: var(--qti-answer-bg);
6240
+ color: var(--qti-answer-fg);
6241
+ border-color: var(--qti-answer-border);
6242
+ }
5885
6243
 
5886
- .full-correct-response :state(drag)::part(control)::before,
5887
- .full-correct-response ::part(drag-control)::before {
5888
- content: '';
5889
- background-color: var(--qti-answer-fg);
5890
- mask: var(--qti-check-mask) no-repeat center / contain;
5891
- -webkit-mask: var(--qti-check-mask) no-repeat center / contain;
5892
- }
6244
+ .full-correct-response :state(drag)::part(control)::before,
6245
+ .full-correct-response ::part(drag-control)::before {
6246
+ content: '';
6247
+ background-color: var(--qti-answer-fg);
6248
+ mask: var(--qti-check-mask) no-repeat center / contain;
6249
+ -webkit-mask: var(--qti-check-mask) no-repeat center / contain;
6250
+ }
5893
6251
  }
5894
6252
  @layer qti-components.elements{
5895
6253
  /* \`display: block\` is declared by the element itself, in qti-rubric-block.ts. */
@@ -5927,6 +6285,7 @@ qti-feedback-block::part(feedback) {
5927
6285
  margin-top: var(--qti-gap);
5928
6286
  }
5929
6287
  }
6288
+ @layer qti-components.global{
5930
6289
  /*
5931
6290
  * Cross-interaction custom states.
5932
6291
  *
@@ -5948,80 +6307,95 @@ qti-feedback-block::part(feedback) {
5948
6307
  * third and fourth time in the Kennisnet overlay. Declared per interaction the rule is an opt-in:
5949
6308
  * graphic-gap-match simply never states one, and there is no exception to write down anywhere.
5950
6309
  */
5951
- @layer qti-components.global {
5952
- ::part(message) {
5953
- color: var(--qti-fg);
5954
- background-color: color-mix(in srgb, var(--qti-warning) 5%, white);
5955
- padding: var(--qti-padding-box);
5956
- border: var(--qti-border-thickness) solid var(--qti-warning);
5957
- border-radius: var(--qti-border-radius);
5958
- margin-top: var(--qti-gap);
5959
- }
6310
+ ::part(message) {
6311
+ color: var(--qti-fg);
6312
+ background-color: color-mix(in srgb, var(--qti-warning) 5%, white);
6313
+ padding: var(--qti-padding-box);
6314
+ border: var(--qti-border-thickness) solid var(--qti-warning);
6315
+ border-radius: var(--qti-border-radius);
6316
+ margin-top: var(--qti-gap);
6317
+ }
5960
6318
 
5961
- /*
5962
- * The interaction is presenting the answer key rather than the candidate's own response.
5963
- * Set on the interaction host by \`Interaction.toggleInternalCorrectResponse\`.
5964
- *
5965
- * Reaches the host wherever that base implementation runs, which is more than it looks: besides
5966
- * \`qti-extended-text-interaction\`, both \`ChoiceCorrectionMixin\` and most per-interaction overrides
5967
- * call \`super\`, so choice, hottext, select-point, slider, graphic-order and the rest set the host
5968
- * state AND mark their individual choices with \`correct-response\` / \`incorrect-response\`.
5969
- *
5970
- * Three do not, and so never paint this outline: the drag-drop mixin replaces the implementation
5971
- * outright, and the two inline interactions \u2014 text-entry and inline-choice \u2014 hand internal mode to
5972
- * the full correct response, which presents the key in a sibling wrapper rather than on the host.
5973
- *
5974
- * The outline went unseen on hottext until its host stopped being an inline box (see the note in
5975
- * qti-match-interaction.styles.ts) \u2014 an inline box whose children are all block has no area to
5976
- * paint. If the double indication ever reads as too much, the fix is here or in the mixin, not
5977
- * a display value.
5978
- */
5979
- :state(show-correct-response) {
5980
- outline: var(--qti-border-thickness) dashed var(--qti-correct);
5981
- outline-offset: 0.25rem;
5982
- }
6319
+ /*
6320
+ * The interaction is presenting the answer key rather than the candidate's own response.
6321
+ * Set on the interaction host by \`Interaction.toggleInternalCorrectResponse\`.
6322
+ *
6323
+ * Reaches the host wherever that base implementation runs, which is more than it looks: besides
6324
+ * \`qti-extended-text-interaction\`, both \`ChoiceCorrectionMixin\` and most per-interaction overrides
6325
+ * call \`super\`, so choice, hottext, select-point, slider, graphic-order and the rest set the host
6326
+ * state AND mark their individual choices with \`correct-response\` / \`incorrect-response\`.
6327
+ *
6328
+ * Three do not, and so never paint this outline: the drag-drop mixin replaces the implementation
6329
+ * outright, and the two inline interactions \u2014 text-entry and inline-choice \u2014 hand internal mode to
6330
+ * the full correct response, which presents the key in a sibling wrapper rather than on the host.
6331
+ *
6332
+ * The outline went unseen on hottext until its host stopped being an inline box (see the note in
6333
+ * qti-match-interaction.styles.ts) \u2014 an inline box whose children are all block has no area to
6334
+ * paint. If the double indication ever reads as too much, the fix is here or in the mixin, not
6335
+ * a display value.
6336
+ */
6337
+ :state(show-correct-response) {
6338
+ outline: var(--qti-border-thickness) dashed var(--qti-correct);
6339
+ outline-offset: 0.25rem;
5983
6340
  }
6341
+ }
6342
+ /* Item-shell structure (what is shown, what is hidden). Kept out of styles/qti-theme/ because it is
6343
+ structure rather than paint \u2014 that directory is where the no-layout-in-theme lint rule applies. */
6344
+ @layer qti-components.global{
6345
+
6346
+ /**
6347
+ * Structural rules for the item shell itself \u2014 what is shown and what is hidden.
6348
+ *
6349
+ * Lives in a file of its own so it can be assigned a layer at its import (see index.css). Rules
6350
+ * written straight into item.css would be unlayered, and unlayered CSS outranks every layer,
6351
+ * including the \`qti-extended\` slot consumers are told to author in.
6352
+ */
6353
+
5984
6354
  [view],
5985
6355
  qti-outcome-declaration,
5986
6356
  qti-response-declaration {
5987
6357
  display: none;
5988
6358
  }
6359
+
5989
6360
  [view].show {
5990
6361
  display: block;
5991
6362
  }
6363
+
5992
6364
  :host {
5993
6365
  box-sizing: border-box;
5994
6366
  }
6367
+
5995
6368
  qti-test-part:not(:has(qti-assessment-item)),
5996
6369
  qti-assessment-section:not(:has(qti-assessment-item)),
5997
6370
  qti-assessment-item-ref:not(:has(qti-assessment-item)) {
5998
6371
  display: none;
5999
6372
  }
6000
- div.full-correct-response {
6001
- }
6373
+
6002
6374
  div.full-correct-response-block {
6003
6375
  display: block;
6004
6376
  }
6377
+
6005
6378
  div.full-correct-response-inline {
6006
6379
  display: inline-block;
6007
6380
  }
6008
- `;var Vt=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ce=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.#e=null,this.#t=null}#e;#t;createRenderRoot(){let e=this.customElementRegistry;return this.#t=e,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...e?{customElementRegistry:e}:{}})}async handleTestURLChange(){if(this.testURL)try{let e=this.qtiContext?.QTI_CONTEXT?.seed,t=(await vr().load(this.testURL)).shuffleOrdering(e),r=this.closest("qti-test");if(r?.postLoadTestTransformCallback){let o=t.htmlDoc(this.#t??void 0).querySelector("qti-assessment-test");o&&(t=await r.postLoadTestTransformCallback(t,o))}this.testDoc=t.htmlDoc(this.#t??void 0)}catch(e){console.error("Error loading or parsing XML:",e)}}handleTestXMLChange(){if(this.testXML)try{let e=this.qtiContext?.QTI_CONTEXT?.seed;this.testDoc=vr().parse(this.testXML).shuffleOrdering(e).htmlDoc(this.#t??void 0)}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#r(){let e=this.querySelector("template");this.#e=e?e.content:b``}#i(){let e=new CSSStyleSheet;e.replaceSync($o),this.shadowRoot.adoptedStyleSheets=[e]}render(){return b`
6381
+ }
6382
+ `;var zt=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ee=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.#e=null,this.#t=null}#e;#t;createRenderRoot(){let e=this.customElementRegistry;return this.#t=e,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...e?{customElementRegistry:e}:{}})}async handleTestURLChange(){if(this.testURL)try{let e=this.qtiContext?.QTI_CONTEXT?.seed,t=(await vr().load(this.testURL)).shuffleOrdering(e),r=this.closest("qti-test");if(r?.postLoadTestTransformCallback){let o=t.htmlDoc(this.#t??void 0).querySelector("qti-assessment-test");o&&(t=await r.postLoadTestTransformCallback(t,o))}this.testDoc=t.htmlDoc(this.#t??void 0)}catch(e){console.error("Error loading or parsing XML:",e)}}handleTestXMLChange(){if(this.testXML)try{let e=this.qtiContext?.QTI_CONTEXT?.seed;this.testDoc=vr().parse(this.testXML).shuffleOrdering(e).htmlDoc(this.#t??void 0)}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#r(){let e=this.querySelector("template");this.#e=e?e.content:b``}#i(){let e=new CSSStyleSheet;e.replaceSync($o),this.shadowRoot.adoptedStyleSheets=[e]}render(){return b`
6009
6383
  ${this.#e}
6010
6384
  <slot></slot>
6011
6385
  ${No(this.testDoc,b`<span>Loading...</span>`)}
6012
- `}};Vt([p({attribute:!1})],Ce.prototype,"customElementRegistry",void 0);Vt([p({type:String,attribute:"test-url"})],Ce.prototype,"testURL",void 0);Vt([_()],Ce.prototype,"testDoc",void 0);Vt([_()],Ce.prototype,"testXML",void 0);Vt([_(),T({context:he,subscribe:!0})],Ce.prototype,"qtiContext",void 0);Vt([$("testURL",{waitUntilFirstUpdate:!0})],Ce.prototype,"handleTestURLChange",null);Vt([$("testXML",{waitUntilFirstUpdate:!0})],Ce.prototype,"handleTestXMLChange",null);var Lo=class extends C{static{this.styles=q`
6386
+ `}};zt([p({attribute:!1})],Ee.prototype,"customElementRegistry",void 0);zt([p({type:String,attribute:"test-url"})],Ee.prototype,"testURL",void 0);zt([_()],Ee.prototype,"testDoc",void 0);zt([_()],Ee.prototype,"testXML",void 0);zt([_(),T({context:he,subscribe:!0})],Ee.prototype,"qtiContext",void 0);zt([$("testURL",{waitUntilFirstUpdate:!0})],Ee.prototype,"handleTestURLChange",null);zt([$("testXML",{waitUntilFirstUpdate:!0})],Ee.prototype,"handleTestXMLChange",null);var Lo=class extends C{static{this.styles=q`
6013
6387
  :host {
6014
- ${me};
6388
+ ${fe};
6015
6389
  }
6016
6390
  :host([disabled]) {
6017
- ${fe};
6391
+ ${ge};
6018
6392
  }
6019
6393
  `}constructor(){super(),this.addEventListener("click",()=>this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0})))}render(){return b` <slot></slot> `}};var ip=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},yi=class extends C{static{this.styles=q`
6020
6394
  :host {
6021
- ${me};
6395
+ ${fe};
6022
6396
  }
6023
6397
  :host([disabled]) {
6024
- ${fe};
6398
+ ${ge};
6025
6399
  }
6026
6400
  `}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return b` <slot></slot> `}};ip([p({type:String,attribute:"item-id"})],yi.prototype,"itemId",void 0);var Qo=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},fa="tts-element",zo="tts-word",Vo=null;function op(){return Vo||(Vo=new CSSStyleSheet,Vo.replaceSync(`
6027
6401
  ::highlight(${fa}) { background-color: #dbeafe; color: inherit; }
@@ -6037,7 +6411,7 @@ div.full-correct-response-inline {
6037
6411
  opacity: 0.4;
6038
6412
  cursor: default;
6039
6413
  }
6040
- `}#e=this.attachInternals();updated(e){e.has("_tts")&&(this.#e.states.clear(),this._tts?.state&&this.#e.states.add(this._tts.state))}};Qo([T({context:Ac,subscribe:!0})],Ze.prototype,"_tts",void 0);var zt=class extends C{#e;#t;#r;#i;#n;#o;#s;#a;#l;#h;#c;constructor(){super(),this.language="nl-NL",this.#e=this.attachInternals(),this.#t=new Map,this.#r=this.#u.bind(this),this.#i=null,this.#n=null,this.#o=0,this.#s=[],this.#a=new Highlight,this.#l=new Highlight,this.#h=void 0,this.#c=()=>this.#v(),this._ttsContext={state:"idle",currentElementIndex:0,elementCount:0,play:()=>this.#b(),pause:()=>this.#y(),resume:()=>this.#q(),stop:()=>this.#v(),prevElement:()=>this.#C(),nextElement:()=>this.#w()}}willUpdate(e){}updated(e){let t=this._sessionContext?.navItemRefId??null;this.#h!==void 0&&this.#h!==t&&(this.#v(),this.#n=null,this.#o=0,this.#p()),this.#h=t}connectedCallback(){super.connectedCallback(),this.#d("idle"),this.#i=this.closest("test-navigation")??this.closest("qti-test")??this.getRootNode(),this.#i.addEventListener("qti-assessment-item-connected",this.#r),this.#i.addEventListener("qti-request-navigation",this.#c)}disconnectedCallback(){super.disconnectedCallback(),speechSynthesis.cancel(),this.#k(),this.#i?.removeEventListener("qti-assessment-item-connected",this.#r),this.#i?.removeEventListener("qti-request-navigation",this.#c),this.#i=null,this.#t.clear()}render(){return b`<slot></slot>`}#u(e){let t=e.detail;t?.identifier&&this.#t.set(t.identifier,t)}#d(e){this._ttsContext={...this._ttsContext,state:e},this.#e.states.delete("idle"),this.#e.states.delete("playing"),this.#e.states.delete("paused"),this.#e.states.add(e)}#p(){this._ttsContext={...this._ttsContext,currentElementIndex:this.#o,elementCount:this.#n?.length??0}}#m(){if(this.#n!==null)return this.#n;let e=this._sessionContext?.navItemRefId;if(!e)return[];let t=this.#t.get(e);if(!t)return[];let r=t.querySelector("qti-item-body");if(!r)return[];let i="p, h1, h2, h3, h4, h5, h6, li, blockquote, figcaption";return this.#n=Array.from(r.querySelectorAll(i)).filter(o=>(o.textContent??"").trim().length>0),this.#n}#b(){if(!this.#m().length){console.warn("test-item-to-speech: no readable elements found in qti-item-body");return}this.#f(this.#o)}#f(e){let t=this.#n??[];if(e>=t.length){this.#E(),this.#o=t.length-1,t.length>0&&this.#g(t[this.#o]),this.#d("idle"),this.#p();return}this.#o=e,this.#p();let r=t[e];r.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(r),this.#s=this.#x(r);let i=this.#s.map(s=>s.textContent??"").join("");if(!i.trim()){this.#f(e+1);return}let o=new SpeechSynthesisUtterance(i);o.lang=this.language,o.rate=1,o.onboundary=s=>{s.name==="word"&&this.#A(s.charIndex,s.charLength??0)},o.onend=()=>{this.#E(),this.#f(this.#o+1)},speechSynthesis.speak(o),this.#d("playing")}#y(){speechSynthesis.pause(),this.#d("paused")}#q(){speechSynthesis.resume(),this.#d("playing")}#v(){speechSynthesis.cancel(),this.#k(),this.#d("idle")}#C(){let e=this.#m();if(!e.length)return;speechSynthesis.cancel(),this.#E(),this.#o=Math.max(0,this.#o-1),this.#p();let t=e[this.#o];t.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(t),this.#d("idle")}#w(){let e=this.#m();if(!e.length)return;speechSynthesis.cancel(),this.#E(),this.#o=Math.min(e.length-1,this.#o+1),this.#p();let t=e[this.#o];t.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(t),this.#d("idle")}#x(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i;for(;i=r.nextNode();)(i.textContent??"").length>0&&t.push(i);return t}#g(e){if(!("highlights"in CSS))return;this.#S(),this.#a.clear();let t=new Range;t.selectNodeContents(e),this.#a.add(t),CSS.highlights.set(fa,this.#a)}#A(e,t){if(!("highlights"in CSS))return;this.#S(),this.#l.clear();let r=this.#s.map(d=>d.textContent??"").join(""),i=e+(t>0?t:this.#I(e,r)),o=0,s=null,a=0,l=null,c=0;for(let d of this.#s){let h=d.textContent?.length??0;if(!s&&o+h>e&&(s=d,a=e-o),s&&o+h>=i){l=d,c=i-o;break}o+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#l.add(d),CSS.highlights.set(zo,this.#l)}}#E(){"highlights"in CSS&&(this.#l.clear(),CSS.highlights.delete(zo))}#k(){"highlights"in CSS&&(this.#l.clear(),CSS.highlights.delete(zo),this.#a.clear(),CSS.highlights.delete(fa))}#I(e,t){let r=t.slice(e).search(/\s/);return r<0?t.length-e:r}#S(){if(!("highlights"in CSS))return;let e=op();document.adoptedStyleSheets.includes(e)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,e]);let r=(this.closest("test-navigation")?.querySelector("test-container")??this.closest("qti-test")?.querySelector("test-container"))?.shadowRoot;r&&!r.adoptedStyleSheets.includes(e)&&(r.adoptedStyleSheets=[...r.adoptedStyleSheets,e])}};Qo([p({type:String})],zt.prototype,"language",void 0);Qo([T({context:De,subscribe:!0})],zt.prototype,"_sessionContext",void 0);Qo([_(),B({context:Ac})],zt.prototype,"_ttsContext",void 0);var jo=class extends Ze{#e(){this._tts&&(this._tts.state==="idle"?this._tts.play():this._tts.state==="playing"?this._tts.pause():this._tts.resume())}render(){let e=this._tts?.state==="playing";return b`
6414
+ `}#e=this.attachInternals();updated(e){e.has("_tts")&&(this.#e.states.clear(),this._tts?.state&&this.#e.states.add(this._tts.state))}};Qo([T({context:Ac,subscribe:!0})],Ze.prototype,"_tts",void 0);var jt=class extends C{#e;#t;#r;#i;#n;#o;#s;#a;#l;#h;#c;constructor(){super(),this.language="nl-NL",this.#e=this.attachInternals(),this.#t=new Map,this.#r=this.#u.bind(this),this.#i=null,this.#n=null,this.#o=0,this.#s=[],this.#a=new Highlight,this.#l=new Highlight,this.#h=void 0,this.#c=()=>this.#v(),this._ttsContext={state:"idle",currentElementIndex:0,elementCount:0,play:()=>this.#b(),pause:()=>this.#y(),resume:()=>this.#q(),stop:()=>this.#v(),prevElement:()=>this.#C(),nextElement:()=>this.#w()}}willUpdate(e){}updated(e){let t=this._sessionContext?.navItemRefId??null;this.#h!==void 0&&this.#h!==t&&(this.#v(),this.#n=null,this.#o=0,this.#p()),this.#h=t}connectedCallback(){super.connectedCallback(),this.#d("idle"),this.#i=this.closest("test-navigation")??this.closest("qti-test")??this.getRootNode(),this.#i.addEventListener("qti-assessment-item-connected",this.#r),this.#i.addEventListener("qti-request-navigation",this.#c)}disconnectedCallback(){super.disconnectedCallback(),speechSynthesis.cancel(),this.#k(),this.#i?.removeEventListener("qti-assessment-item-connected",this.#r),this.#i?.removeEventListener("qti-request-navigation",this.#c),this.#i=null,this.#t.clear()}render(){return b`<slot></slot>`}#u(e){let t=e.detail;t?.identifier&&this.#t.set(t.identifier,t)}#d(e){this._ttsContext={...this._ttsContext,state:e},this.#e.states.delete("idle"),this.#e.states.delete("playing"),this.#e.states.delete("paused"),this.#e.states.add(e)}#p(){this._ttsContext={...this._ttsContext,currentElementIndex:this.#o,elementCount:this.#n?.length??0}}#m(){if(this.#n!==null)return this.#n;let e=this._sessionContext?.navItemRefId;if(!e)return[];let t=this.#t.get(e);if(!t)return[];let r=t.querySelector("qti-item-body");if(!r)return[];let i="p, h1, h2, h3, h4, h5, h6, li, blockquote, figcaption";return this.#n=Array.from(r.querySelectorAll(i)).filter(o=>(o.textContent??"").trim().length>0),this.#n}#b(){if(!this.#m().length){console.warn("test-item-to-speech: no readable elements found in qti-item-body");return}this.#f(this.#o)}#f(e){let t=this.#n??[];if(e>=t.length){this.#E(),this.#o=t.length-1,t.length>0&&this.#g(t[this.#o]),this.#d("idle"),this.#p();return}this.#o=e,this.#p();let r=t[e];r.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(r),this.#s=this.#x(r);let i=this.#s.map(s=>s.textContent??"").join("");if(!i.trim()){this.#f(e+1);return}let o=new SpeechSynthesisUtterance(i);o.lang=this.language,o.rate=1,o.onboundary=s=>{s.name==="word"&&this.#A(s.charIndex,s.charLength??0)},o.onend=()=>{this.#E(),this.#f(this.#o+1)},speechSynthesis.speak(o),this.#d("playing")}#y(){speechSynthesis.pause(),this.#d("paused")}#q(){speechSynthesis.resume(),this.#d("playing")}#v(){speechSynthesis.cancel(),this.#k(),this.#d("idle")}#C(){let e=this.#m();if(!e.length)return;speechSynthesis.cancel(),this.#E(),this.#o=Math.max(0,this.#o-1),this.#p();let t=e[this.#o];t.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(t),this.#d("idle")}#w(){let e=this.#m();if(!e.length)return;speechSynthesis.cancel(),this.#E(),this.#o=Math.min(e.length-1,this.#o+1),this.#p();let t=e[this.#o];t.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(t),this.#d("idle")}#x(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i;for(;i=r.nextNode();)(i.textContent??"").length>0&&t.push(i);return t}#g(e){if(!("highlights"in CSS))return;this.#S(),this.#a.clear();let t=new Range;t.selectNodeContents(e),this.#a.add(t),CSS.highlights.set(fa,this.#a)}#A(e,t){if(!("highlights"in CSS))return;this.#S(),this.#l.clear();let r=this.#s.map(d=>d.textContent??"").join(""),i=e+(t>0?t:this.#I(e,r)),o=0,s=null,a=0,l=null,c=0;for(let d of this.#s){let h=d.textContent?.length??0;if(!s&&o+h>e&&(s=d,a=e-o),s&&o+h>=i){l=d,c=i-o;break}o+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#l.add(d),CSS.highlights.set(zo,this.#l)}}#E(){"highlights"in CSS&&(this.#l.clear(),CSS.highlights.delete(zo))}#k(){"highlights"in CSS&&(this.#l.clear(),CSS.highlights.delete(zo),this.#a.clear(),CSS.highlights.delete(fa))}#I(e,t){let r=t.slice(e).search(/\s/);return r<0?t.length-e:r}#S(){if(!("highlights"in CSS))return;let e=op();document.adoptedStyleSheets.includes(e)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,e]);let r=(this.closest("test-navigation")?.querySelector("test-container")??this.closest("qti-test")?.querySelector("test-container"))?.shadowRoot;r&&!r.adoptedStyleSheets.includes(e)&&(r.adoptedStyleSheets=[...r.adoptedStyleSheets,e])}};Qo([p({type:String})],jt.prototype,"language",void 0);Qo([T({context:Ne,subscribe:!0})],jt.prototype,"_sessionContext",void 0);Qo([_(),B({context:Ac})],jt.prototype,"_ttsContext",void 0);var jo=class extends Ze{#e(){this._tts&&(this._tts.state==="idle"?this._tts.play():this._tts.state==="playing"?this._tts.pause():this._tts.resume())}render(){let e=this._tts?.state==="playing";return b`
6041
6415
  <button part="button" @click=${this.#e}>
6042
6416
  ${e?b`<slot name="pause">⏸</slot>`:b`<slot name="play">▶</slot>`}
6043
6417
  </button>
@@ -6061,22 +6435,22 @@ div.full-correct-response-inline {
6061
6435
  <button part="button" ?disabled=${t||e} @click=${()=>this._tts?.nextElement()}>
6062
6436
  <slot>▶▶</slot>
6063
6437
  </button>
6064
- `}};var ft=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},oe=class extends C{#e;constructor(){super(),this.identifier=void 0,this.initContext=[],this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.configContext={},this.autoScoreItems=!1,this.addEventListener("qti-assessment-test-connected",this.#n.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#s.bind(this)),this.addEventListener("qti-interaction-changed",this.#i.bind(this)),this.addEventListener("test-end-attempt",this.#t.bind(this)),this.addEventListener("test-update-outcome-variable",this.#r.bind(this))}get activeAssessmentItem(){if(!(!this.#e||!this._sessionContext?.navItemRefId))return this.#e.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#t(e){let r=this.#e.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem,i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#r(e){this.#e.querySelector(`qti-assessment-item-ref[identifier="${e.detail.assessmentItemRefId}"]`).assessmentItem.setOutcomeVariable(e.detail.outcomeVariableId,e.detail.value)}#i(e){if(this.autoScoreItems){let t=e.composedPath()[0].closest("qti-assessment-item"),r=t.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&t.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;t.processResponse(!0,i)}}}render(){return b`<slot></slot>`}#n(e){if(this.#e=e.detail,!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.qtiContext={QTI_CONTEXT:{...i,testIdentifier:this.#e.identifier,environmentIdentifier:i.environmentIdentifier||"default"}}}this.#e.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let o=this.#o(i);Object.keys(o).length>0&&(this.qtiContext={QTI_CONTEXT:{...o,...this.qtiContext.QTI_CONTEXT}})});let r=Array.from(this.#e?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:this.#e.identifier,title:this.#e.title,view:this._sessionContext?.view,testParts:r.map(i=>{let o=[...i.querySelectorAll("qti-assessment-section")];return{active:!1,identifier:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,sections:o.map(s=>{let a=[...s.querySelectorAll("qti-assessment-item-ref")];return{active:!1,identifier:s.identifier,title:s.title,items:a.map(l=>({...this.initContext?.find(c=>c.identifier===l.identifier),active:!1,identifier:l.identifier,categories:l.category?l.category?.split(" "):[],href:l.href,variables:[]}))}})}})}}#o(e){let t={},r=e.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(o=>{let s=o.getAttribute("field-identifier"),a=o.getAttribute("base-type")||"string",l=o.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}t[s]=c}}),t}#s(e){let t=e.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(r=>({...r,sections:r.sections.map(i=>({...i,items:i.items.map(o=>{if(o.identifier!==t.parentElement.getAttribute("identifier"))return o;let a=t.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),l=t.querySelectorAll("qti-response-declaration"),c=Array.from(l).some(f=>f.querySelector("qti-correct-response")),d=Array.from(l).some(f=>{let w=f.querySelector("qti-mapping"),x=f.querySelector("qti-area-mapping");return w?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=c||d,g=!!t.querySelector("qti-response-processing");return{...o,assessmentItemIdentifier:t.getAttribute("identifier"),label:t.getAttribute("label"),title:t.title,externalScored:a,adaptive:t.adaptive=="true"||!1,timeDependent:t.timeDependent=="true"||!1,variables:t.variables,hasCorrectResponse:h,hasResponseProcessing:g}})}))}))}}willUpdate(e){if(!this.computedContext)return;let t=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,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(o=>this._testContext.items.find(s=>s.identifier===o.identifier)?.variables.find(s=>s.identifier==="completionStatus").value==="completed"),items:i.items.map(o=>{let s=this._testContext?.items.find(u=>u.identifier===o.identifier),a={...o,...s,...this.initContext?.find(u=>u.identifier===o.identifier)},l=a.variables?.find(u=>u.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(u=>u.identifier==="completionStatus")?.value,h=a.variables?.find(u=>u.identifier==="RESPONSE")?.value||"",g=a.variables?.find(u=>u.identifier==="numAttempts")?.value||0,f=this._sessionContext?.navItemRefId===a.identifier||!1,w=o.categories.includes(this.configContext?.infoItemCategory)?null:t++,x=o.variables?.find(u=>u.identifier=="MAXSCORE")?.value,m=x==null?null:parseFloat(x?.toString());return{...a,completionStatus:d,numAttempts:g,score:c,response:h,index:w,active:f,maxScore:m}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}};ft([p({type:String})],oe.prototype,"identifier",void 0);ft([_()],oe.prototype,"initContext",void 0);ft([_(),B({context:he})],oe.prototype,"qtiContext",void 0);ft([_(),T({context:de,subscribe:!0})],oe.prototype,"configContext",void 0);ft([_(),T({context:pe,subscribe:!0})],oe.prototype,"_testContext",void 0);ft([_(),T({context:De,subscribe:!0})],oe.prototype,"_sessionContext",void 0);ft([_(),B({context:F})],oe.prototype,"computedContext",void 0);ft([p({type:Boolean,attribute:"auto-score-items"})],oe.prototype,"autoScoreItems",void 0);var ga=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},jt=class extends C{_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}static{this.styles=q`
6438
+ `}};var gt=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},oe=class extends C{#e;constructor(){super(),this.identifier=void 0,this.initContext=[],this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.configContext={},this.autoScoreItems=!1,this.addEventListener("qti-assessment-test-connected",this.#n.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#s.bind(this)),this.addEventListener("qti-interaction-changed",this.#i.bind(this)),this.addEventListener("test-end-attempt",this.#t.bind(this)),this.addEventListener("test-update-outcome-variable",this.#r.bind(this))}get activeAssessmentItem(){if(!(!this.#e||!this._sessionContext?.navItemRefId))return this.#e.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#t(e){let r=this.#e.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem,i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#r(e){this.#e.querySelector(`qti-assessment-item-ref[identifier="${e.detail.assessmentItemRefId}"]`).assessmentItem.setOutcomeVariable(e.detail.outcomeVariableId,e.detail.value)}#i(e){if(this.autoScoreItems){let t=e.composedPath()[0].closest("qti-assessment-item"),r=t.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&t.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;t.processResponse(!0,i)}}}render(){return b`<slot></slot>`}#n(e){if(this.#e=e.detail,!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.qtiContext={QTI_CONTEXT:{...i,testIdentifier:this.#e.identifier,environmentIdentifier:i.environmentIdentifier||"default"}}}this.#e.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let o=this.#o(i);Object.keys(o).length>0&&(this.qtiContext={QTI_CONTEXT:{...o,...this.qtiContext.QTI_CONTEXT}})});let r=Array.from(this.#e?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:this.#e.identifier,title:this.#e.title,view:this._sessionContext?.view,testParts:r.map(i=>{let o=[...i.querySelectorAll("qti-assessment-section")];return{active:!1,identifier:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,sections:o.map(s=>{let a=[...s.querySelectorAll("qti-assessment-item-ref")];return{active:!1,identifier:s.identifier,title:s.title,navigationMode:s.navigationMode,submissionMode:s.submissionMode,items:a.map(l=>({...this.initContext?.find(c=>c.identifier===l.identifier),active:!1,identifier:l.identifier,categories:l.category?l.category?.split(" "):[],href:l.href,variables:[]}))}})}})}}#o(e){let t={},r=e.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(o=>{let s=o.getAttribute("field-identifier"),a=o.getAttribute("base-type")||"string",l=o.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}t[s]=c}}),t}#s(e){let t=e.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(r=>({...r,sections:r.sections.map(i=>({...i,items:i.items.map(o=>{if(o.identifier!==t.parentElement.getAttribute("identifier"))return o;let a=t.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),l=t.querySelectorAll("qti-response-declaration"),c=Array.from(l).some(m=>m.querySelector("qti-correct-response")),d=Array.from(l).some(m=>{let w=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return w?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=c||d,g=!!t.querySelector("qti-response-processing");return{...o,assessmentItemIdentifier:t.getAttribute("identifier"),label:t.getAttribute("label"),title:t.title,externalScored:a,adaptive:t.adaptive=="true"||!1,timeDependent:t.timeDependent=="true"||!1,variables:t.variables,hasCorrectResponse:h,hasResponseProcessing:g}})}))}))}}willUpdate(e){if(!this.computedContext)return;let t=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,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(o=>this._testContext.items.find(s=>s.identifier===o.identifier)?.variables.find(s=>s.identifier==="completionStatus").value==="completed"),items:i.items.map(o=>{let s=this._testContext?.items.find(u=>u.identifier===o.identifier),a={...o,...s,...this.initContext?.find(u=>u.identifier===o.identifier)},l=a.variables?.find(u=>u.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(u=>u.identifier==="completionStatus")?.value,h=a.variables?.find(u=>u.identifier==="RESPONSE")?.value||"",g=a.variables?.find(u=>u.identifier==="numAttempts")?.value||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,w=o.categories.includes(this.configContext?.infoItemCategory)?null:t++,x=o.variables?.find(u=>u.identifier=="MAXSCORE")?.value,f=x==null?null:parseFloat(x?.toString());return{...a,completionStatus:d,numAttempts:g,score:c,response:h,index:w,active:m,maxScore:f}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}};gt([p({type:String})],oe.prototype,"identifier",void 0);gt([_()],oe.prototype,"initContext",void 0);gt([_(),B({context:he})],oe.prototype,"qtiContext",void 0);gt([_(),T({context:de,subscribe:!0})],oe.prototype,"configContext",void 0);gt([_(),T({context:pe,subscribe:!0})],oe.prototype,"_testContext",void 0);gt([_(),T({context:Ne,subscribe:!0})],oe.prototype,"_sessionContext",void 0);gt([_(),B({context:F})],oe.prototype,"computedContext",void 0);gt([p({type:Boolean,attribute:"auto-score-items"})],oe.prototype,"autoScoreItems",void 0);var ga=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ft=class extends C{_handleTestElementChange(e,t){t&&this.requestUpdate()}static{this.styles=q`
6065
6439
  :host {
6066
- ${me};
6440
+ ${fe};
6067
6441
  }
6068
6442
  :host([disabled]) {
6069
- ${fe};
6443
+ ${ge};
6070
6444
  }
6071
- `}#e;constructor(){super(),this._internalDisabled=!0,this.#e=this.attachInternals(),this.#e.role="button",this.#e.ariaLabel="Next item",this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(r=>r.active);t&&(this.sectionItems=t.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=this.sectionItems?.length-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return b`<slot></slot>`}};ga([p({type:Boolean,reflect:!0,attribute:"disabled"})],jt.prototype,"_internalDisabled",void 0);ga([T({context:F,subscribe:!0})],jt.prototype,"computedContext",void 0);ga([$("computedContext")],jt.prototype,"_handleTestElementChange",null);var Go=["this"],Ic=["+","-","!"],_c=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],ba={"!":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},Xo=13;var np=["==","!=","<=",">=","||","&&","??","|>"],sp=["===","!=="],M;(function(n){n[n.STRING=1]="STRING",n[n.IDENTIFIER=2]="IDENTIFIER",n[n.DOT=3]="DOT",n[n.COMMA=4]="COMMA",n[n.COLON=5]="COLON",n[n.INTEGER=6]="INTEGER",n[n.DECIMAL=7]="DECIMAL",n[n.OPERATOR=8]="OPERATOR",n[n.GROUPER=9]="GROUPER",n[n.KEYWORD=10]="KEYWORD",n[n.ARROW=11]="ARROW"})(M||(M={}));var je=(n,e,t=0)=>({kind:n,value:e,precedence:t}),ap=n=>n===9||n===10||n===13||n===32,Tc=n=>n===95||n===36||(n&=-33,65<=n&&n<=90),lp=n=>Tc(n)||vi(n),cp=n=>Go.indexOf(n)!==-1,dp=n=>n===34||n===39,vi=n=>48<=n&&n<=57,hp=n=>n===43||n===45||n===42||n===47||n===33||n===38||n===37||n===60||n===61||n===62||n===63||n===94||n===124,pp=n=>n===40||n===41||n===91||n===93||n===123||n===125,up=n=>n.replace(/\\(.)/g,(e,t)=>{switch(t){case"n":return`
6072
- `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return t}}),Yo=class{#e;#t=-1;#r=0;#i;constructor(e){this.#e=e,this.#n()}nextToken(){for(;ap(this.#i);)this.#n(!0);if(dp(this.#i))return this.#a();if(Tc(this.#i))return this.#l();if(vi(this.#i))return this.#h();if(this.#i===46)return this.#c();if(this.#i===44)return this.#u();if(this.#i===58)return this.#d();if(hp(this.#i))return this.#m();if(pp(this.#i))return this.#b();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(e){this.#t++,this.#t<this.#e.length?(this.#i=this.#e.charCodeAt(this.#t),e===!0&&(this.#r=this.#t)):this.#i=void 0}#o(e=0){let t=this.#e.substring(this.#r,this.#t+e);return e===0&&this.#s(),t}#s(){this.#r=this.#t}#a(){let e="unterminated string",t=this.#i;for(this.#n(!0);this.#i!==t;){if(this.#i===void 0)throw new Error(e);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(e);this.#n()}let r=je(M.STRING,up(this.#o()));return this.#n(),r}#l(){do this.#n();while(lp(this.#i));let e=this.#o(),t=cp(e)?M.KEYWORD:M.IDENTIFIER;return je(t,e)}#h(){do this.#n();while(vi(this.#i));return this.#i===46?this.#c():je(M.INTEGER,this.#o())}#c(){return this.#n(),vi(this.#i)?this.#p():(this.#s(),je(M.DOT,".",Xo))}#u(){return this.#n(!0),je(M.COMMA,",")}#d(){return this.#n(!0),je(M.COLON,":")}#p(){do this.#n();while(vi(this.#i));return je(M.DECIMAL,this.#o())}#m(){this.#n();let e=this.#o(2);if(sp.indexOf(e)!==-1)this.#n(),this.#n();else{if(e=this.#o(1),e==="=>")return this.#n(),je(M.ARROW,e);np.indexOf(e)!==-1&&this.#n()}return e=this.#o(),je(M.OPERATOR,e,ba[e])}#b(){let e=String.fromCharCode(this.#i),t=je(M.GROUPER,e,ba[e]);return this.#n(!0),t}};var ya=(n,e)=>new wi(n,e).parse(),wi=class{#e;#t;#r;#i;#n;constructor(e,t){this.#t=new Yo(e),this.#r=t}parse(){return this.#o(),this.#s()}#o(e,t){if(!this._matches(e,t))throw new Error(`Expected kind ${e} (${t}), was ${this.#i?.kind} (${this.#i?.value})`);let r=this.#t.nextToken();this.#i=r,this.#e=r?.kind,this.#n=r?.value}_matches(e,t){return!(e&&this.#e!==e||t&&this.#n!==t)}#s(){if(!this.#i)return this.#r.empty();let e=this.#c();return e===void 0?void 0:this.#a(e,0)}#a(e,t){if(e===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(M.GROUPER,"(")){let r=this.#y();e=this.#r.invoke(e,void 0,r)}else if(this._matches(M.GROUPER,"[")){let r=this.#q();e=this.#r.index(e,r)}else if(this._matches(M.DOT)){this.#o();let r=this.#c();e=this.#l(e,r)}else{if(this._matches(M.KEYWORD))break;if(this._matches(M.OPERATOR)&&this.#i.precedence>=t)e=this.#n==="?"?this.#u(e):this.#h(e,this.#i);else break}return e}#l(e,t){if(t===void 0)throw new Error("expected identifier");if(t.type==="ID")return this.#r.getter(e,t.value);if(t.type==="Invoke"&&t.receiver.type==="ID"){let r=t.receiver;return this.#r.invoke(e,r.value,t.arguments)}else throw new Error(`expected identifier: ${t}`)}#h(e,t){if(_c.indexOf(t.value)===-1)throw new Error(`unknown operator: ${t.value}`);this.#o();let r=this.#c();for(;(this.#e===M.OPERATOR||this.#e===M.DOT||this.#e===M.GROUPER)&&this.#i.precedence>t.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(e,t.value,r)}#c(){if(this._matches(M.OPERATOR)){let e=this.#n;if(this.#o(),e==="+"||e==="-"){if(this._matches(M.INTEGER))return this.#w(e);if(this._matches(M.DECIMAL))return this.#x(e)}if(Ic.indexOf(e)===-1)throw new Error(`unexpected token: ${e}`);let t=this.#a(this.#d(),Xo);return this.#r.unary(e,t)}return this.#d()}#u(e){this.#o(M.OPERATOR,"?");let t=this.#s();this.#o(M.COLON);let r=this.#s();return this.#r.ternary(e,t,r)}#d(){switch(this.#e){case M.KEYWORD:let e=this.#n;if(e==="this")return this.#o(),this.#r.id(e);throw Go.indexOf(e)!==-1?new Error(`unexpected keyword: ${e}`):new Error(`unrecognized keyword: ${e}`);case M.IDENTIFIER:return this.#b();case M.STRING:return this.#C();case M.INTEGER:return this.#w();case M.DECIMAL:return this.#x();case M.GROUPER:return this.#n==="("?this.#v():this.#n==="{"?this.#m():this.#n==="["?this.#p():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#p(){let e=[];do{if(this.#o(),this._matches(M.GROUPER,"]"))break;e.push(this.#s())}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"]"),this.#r.list(e)}#m(){let e={};do{if(this.#o(),this._matches(M.GROUPER,"}"))break;let t=this.#n;(this._matches(M.STRING)||this._matches(M.IDENTIFIER))&&this.#o(),this.#o(M.COLON),e[t]=this.#s()}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"}"),this.#r.map(e)}#b(){let e=this.#n;if(e==="true")return this.#o(),this.#r.literal(!0);if(e==="false")return this.#o(),this.#r.literal(!1);if(e==="null")return this.#o(),this.#r.literal(null);if(e==="undefined")return this.#o(),this.#r.literal(void 0);let t=this.#f(),r=this.#y();return r?this.#r.invoke(t,void 0,r):t}#f(){if(!this._matches(M.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let e=this.#n;return this.#o(),this.#r.id(e)}#y(){if(!this._matches(M.GROUPER,"("))return;let e=[];do{if(this.#o(),this._matches(M.GROUPER,")"))break;let t=this.#s();e.push(t)}while(this._matches(M.COMMA));return this.#o(M.GROUPER,")"),e}#q(){this.#o();let e=this.#s();return this.#o(M.GROUPER,"]"),e}#v(){let e=this.#y();if(this._matches(M.ARROW)){this.#o();let t=this.#s(),r=e?.map(i=>i.value)??[];return this.#r.arrowFunction(r,t)}else return this.#r.paren(e[0])}#C(){let e=this.#r.literal(this.#n);return this.#o(),e}#w(e=""){let t=this.#r.literal(parseInt(`${e}${this.#n}`,10));return this.#o(),t}#x(e=""){let t=this.#r.literal(parseFloat(`${e}${this.#n}`));return this.#o(),t}};var{hasOwn:Rc,fromEntries:mp}=Object,fp={"+":(n,e)=>n+e,"-":(n,e)=>n-e,"*":(n,e)=>n*e,"/":(n,e)=>n/e,"%":(n,e)=>n%e,"==":(n,e)=>n==e,"!=":(n,e)=>n!=e,"===":(n,e)=>n===e,"!==":(n,e)=>n!==e,">":(n,e)=>n>e,">=":(n,e)=>n>=e,"<":(n,e)=>n<e,"<=":(n,e)=>n<=e,"||":(n,e)=>n||e,"&&":(n,e)=>n&&e,"??":(n,e)=>n??e,"|":(n,e)=>e(n),"|>":(n,e)=>e(n)},gp={"+":n=>n,"-":n=>-n,"!":n=>!n},Ko=class{empty(){return{type:"Empty",evaluate(e){return e},getIds(e){return e}}}literal(e){return{type:"Literal",value:e,evaluate(t){return this.value},getIds(t){return t}}}id(e){return{type:"ID",value:e,evaluate(t){return this.value==="this"?t:t?.[this.value]},getIds(t){return t.push(this.value),t}}}unary(e,t){let r=gp[e];return{type:"Unary",operator:e,child:t,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(e,t,r){let i=fp[t];return{type:"Binary",operator:t,left:e,right:r,evaluate(o){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(o),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(o),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(o),l=this.left.argument.evaluate(o)):this.left.type==="ID"&&(a=o,l=this.left.value),a===void 0?void 0:a[l]=s}return i(this.left.evaluate(o),this.right.evaluate(o))},getIds(o){return this.left.getIds(o),this.right.getIds(o),o}}}getter(e,t){return{type:"Getter",receiver:e,name:t,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(e,t,r){if(t!=null&&typeof t!="string")throw new Error("method not a string");return{type:"Invoke",receiver:e,method:t,arguments:r,evaluate(i){let o=this.receiver.evaluate(i),s=this.method?o:i?.this??i,a=this.method?o?.[t]:o,c=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,c)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(o=>o?.getIds(i)),i}}}paren(e){return e}index(e,t){return{type:"Index",receiver:e,argument:t,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(e,t,r){return{type:"Ternary",condition:e,trueExpr:t,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(e){return{type:"Map",entries:e,evaluate(t){let r={};if(e&&this.entries)for(let i in e){let o=this.entries[i];o&&(r[i]=o.evaluate(t))}return r},getIds(t){if(e&&this.entries)for(let r in e){let i=this.entries[r];i&&i.getIds(t)}return t}}}list(e){return{type:"List",items:e,evaluate(t){return this.items?.map(r=>r?.evaluate(t))},getIds(t){return this.items?.forEach(r=>r?.getIds(t)),t}}}arrowFunction(e,t){return{type:"ArrowFunction",params:e,body:t,evaluate(r){let i=this.params,o=this.body;return function(...s){let a=mp(i.map((c,d)=>[c,s[d]])),l=new Proxy(r??{},{set(c,d,h){return Rc(a,d)&&(a[d]=h),c[d]=h},get(c,d){return Rc(a,d)?a[d]:c[d]}});return o.evaluate(l)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var va=null,Oc={boundAttributeSuffix:K.M,marker:K.P,markerMatch:K.A,HTML_RESULT:K.C,getTemplateHtml:K.L,overrideDirectiveResolve:(n,e)=>class extends n{_$AS(t,r){return e(this,r)}},patchDirectiveResolve:(n,e)=>{if(n.prototype._$AS.name!==e.name){va??=n.prototype._$AS.name;for(let t=n.prototype;t!==Object.prototype;t=Object.getPrototypeOf(t))if(t.hasOwnProperty(va))return void(t[va]=e);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(n,e){n._$litDirective$=e},getAttributePartCommittedValue:(n,e,t)=>{let r=Z;return n.j=i=>r=i,n._$AI(e,n,t),r},connectedDisconnectable:n=>({...n,_$AU:!0}),resolveDirective:K.V,AttributePart:K.H,PropertyPart:K.B,BooleanAttributePart:K.N,EventPart:K.U,ElementPart:K.F,TemplateInstance:K.R,isIterable:K.D,ChildPart:K.I};var{AttributePart:bp,PropertyPart:yp,BooleanAttributePart:vp,EventPart:wp}=Oc,xa=new Ko,wa=new Map,Pc=n=>n.replace(/-(-|\w)/g,(e,t)=>t.toUpperCase()),Jo=(n,e)=>{let t=wa.get(n);if(t===void 0){if(wa.has(n))return;if(n=n.trim(),n.startsWith("{{")&&n.endsWith("}}")){let r=n.substring(2,n.length-2).trim();t=new wi(r,xa).parse(),wa.set(n,t)}}return t?.evaluate(e)},xp=(n,e,t,r)=>{let i=n.getAttribute("if");if(i!==null&&Jo(i,e))return Zo(n,e,t,r)},Mc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Dc=n=>/(?:\\{{)|(?:\\}})/g.test(n),xi=n=>n.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),qp=(n,e,t,r)=>{let i=n.getAttribute("repeat");if(i!==null){let o=Jo(i,e);if(!o[Symbol.iterator])return P;let s=qi(n),a=-1,l=[];for(let c of o){a++;let d=Object.create(e);d.item=c,d.index=a,d.this=e.this??e;let h=[];for(let f of s.parts){let w=f.update(d,t,r);f.type===1?h.push(...w):h.push(w)}let g={_$litType$:s,values:h};l.push(g)}return l}},$c={if:xp,repeat:qp},Fe=(n,e=$c,t={},r)=>{let o=qi(n).renderers;if(r){let a=qi(r).renderers,l=o.super;l!==void 0?t={...o,...t,super:(c,d,h)=>(h={...a,...h,super:(g,f,w)=>Zo(r,g,f,w)},l(c,d,h))}:(t={...a,...o,...t},n=r)}else t={...o,...t};return s=>Zo(n,s,e,t)};var Zo=(n,e,t=$c,r={})=>{let i=qi(n),o=[];for(let a of i.parts){let l=a.update(e,t,r);a.type===1?o.push(...l):o.push(l)}return{_$litType$:i,values:o}},Nc=new Map,qi=n=>{let e=Nc.get(n);return e===void 0&&Nc.set(n,e=Cp(n)),e},Cp=n=>{let e={h:void 0,el:n.cloneNode(!0),parts:[],renderers:{}},t=document.createTreeWalker(e.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=t.currentNode,i=-1,o=[];for(;(r=t.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 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),o.push(s);let h;if(d!==null){let g=d.trim(),f=g.startsWith("{{")&&g.endsWith("}}");h=(w,x,m)=>{let u=s.getAttribute("data"),y=u===null?void 0:Jo(u,w);return(f?Jo(g,w):m[d])?.(y,x,m)}}else l!==null?h=(g,f,w)=>{let x=f[l];return x?.(s,g,f,w)}:(c==="super"?e.renderers.super=(g,f,w)=>{let x=w.super,m=qi(s);return w={...w,...m.renderers},x(g,f,w)}:e.renderers[c]=(g,f,w)=>Zo(s,g,f,w),h=(g,f,w)=>{let x=w[c];return x?.(g,f,w)});e.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(Mc);if(d.length===1){Dc(c)&&s.setAttribute(l,xi(c));continue}s.removeAttribute(l);let h=l,g=bp,f=l[0];f==="."?(h=Pc(l.substring(1)),g=yp):f==="?"?(h=l.substring(1),g=vp):f==="@"&&(h=Pc(l.substring(1)),g=wp);let w=[xi(d[0])],x=[];for(let m=1;m<d.length;m+=2){let u=d[m];x.push(ya(u,xa)),w.push(xi(d[m+1]))}e.parts.push({type:1,index:i,name:h,strings:w,ctor:g,update:(m,u,y)=>x.map(v=>v.evaluate(m))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,l=a.split(Mc);l.length>1?s.textContent=xi(l[0]):Dc(a)&&(s.textContent=xi(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=ya(d,xa);e.parts.push({type:2,index:++i,update:(f,w)=>h.evaluate(f)});let g=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(g,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=g,t.currentNode=g}}for(let s of o)s.remove();return e};var Ep=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ci=class extends C{#e;createRenderRoot(){return this}constructor(){super(),this.#e=this.attachInternals(),this.#e.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=Fe(e)}render(){if(!this.computedContext)return b``;let e=this.computedContext.testParts.flatMap(t=>t.sections.flatMap(r=>r.items));return b` ${e.map(t=>this.myTemplate({item:t,view:this.computedContext.view}))} `}};Ep([T({context:F,subscribe:!0})],Ci.prototype,"computedContext",void 0);var qa=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ft=class extends C{_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}static{this.styles=q`
6445
+ `}#e;constructor(){super(),this._internalDisabled=!0,this.#e=this.attachInternals(),this.#e.role="button",this.#e.ariaLabel="Next item",this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(r=>r.active);t&&(this.sectionItems=t.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let e=this.computedContext?.testParts.find(l=>l.active);if(!e)return;let t=e.sections.find(l=>l.active),r=t?.navigationMode||e.navigationMode,i=t?.submissionMode||e.submissionMode,o=this.sectionItems[this.itemIndex],s=r==="linear"&&i==="individual",a=Number(o?.variables.find(l=>l.identifier==="numAttempts")?.value)||0;this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&a===0}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return b`<slot></slot>`}};ga([p({type:Boolean,reflect:!0,attribute:"disabled"})],Ft.prototype,"_internalDisabled",void 0);ga([T({context:F,subscribe:!0})],Ft.prototype,"computedContext",void 0);ga([$("computedContext")],Ft.prototype,"_handleTestElementChange",null);var Go=["this"],Ic=["+","-","!"],_c=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],ba={"!":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},Xo=13;var np=["==","!=","<=",">=","||","&&","??","|>"],sp=["===","!=="],M;(function(n){n[n.STRING=1]="STRING",n[n.IDENTIFIER=2]="IDENTIFIER",n[n.DOT=3]="DOT",n[n.COMMA=4]="COMMA",n[n.COLON=5]="COLON",n[n.INTEGER=6]="INTEGER",n[n.DECIMAL=7]="DECIMAL",n[n.OPERATOR=8]="OPERATOR",n[n.GROUPER=9]="GROUPER",n[n.KEYWORD=10]="KEYWORD",n[n.ARROW=11]="ARROW"})(M||(M={}));var je=(n,e,t=0)=>({kind:n,value:e,precedence:t}),ap=n=>n===9||n===10||n===13||n===32,Tc=n=>n===95||n===36||(n&=-33,65<=n&&n<=90),lp=n=>Tc(n)||vi(n),cp=n=>Go.indexOf(n)!==-1,dp=n=>n===34||n===39,vi=n=>48<=n&&n<=57,hp=n=>n===43||n===45||n===42||n===47||n===33||n===38||n===37||n===60||n===61||n===62||n===63||n===94||n===124,pp=n=>n===40||n===41||n===91||n===93||n===123||n===125,up=n=>n.replace(/\\(.)/g,(e,t)=>{switch(t){case"n":return`
6446
+ `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return t}}),Yo=class{#e;#t=-1;#r=0;#i;constructor(e){this.#e=e,this.#n()}nextToken(){for(;ap(this.#i);)this.#n(!0);if(dp(this.#i))return this.#a();if(Tc(this.#i))return this.#l();if(vi(this.#i))return this.#h();if(this.#i===46)return this.#c();if(this.#i===44)return this.#u();if(this.#i===58)return this.#d();if(hp(this.#i))return this.#m();if(pp(this.#i))return this.#b();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(e){this.#t++,this.#t<this.#e.length?(this.#i=this.#e.charCodeAt(this.#t),e===!0&&(this.#r=this.#t)):this.#i=void 0}#o(e=0){let t=this.#e.substring(this.#r,this.#t+e);return e===0&&this.#s(),t}#s(){this.#r=this.#t}#a(){let e="unterminated string",t=this.#i;for(this.#n(!0);this.#i!==t;){if(this.#i===void 0)throw new Error(e);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(e);this.#n()}let r=je(M.STRING,up(this.#o()));return this.#n(),r}#l(){do this.#n();while(lp(this.#i));let e=this.#o(),t=cp(e)?M.KEYWORD:M.IDENTIFIER;return je(t,e)}#h(){do this.#n();while(vi(this.#i));return this.#i===46?this.#c():je(M.INTEGER,this.#o())}#c(){return this.#n(),vi(this.#i)?this.#p():(this.#s(),je(M.DOT,".",Xo))}#u(){return this.#n(!0),je(M.COMMA,",")}#d(){return this.#n(!0),je(M.COLON,":")}#p(){do this.#n();while(vi(this.#i));return je(M.DECIMAL,this.#o())}#m(){this.#n();let e=this.#o(2);if(sp.indexOf(e)!==-1)this.#n(),this.#n();else{if(e=this.#o(1),e==="=>")return this.#n(),je(M.ARROW,e);np.indexOf(e)!==-1&&this.#n()}return e=this.#o(),je(M.OPERATOR,e,ba[e])}#b(){let e=String.fromCharCode(this.#i),t=je(M.GROUPER,e,ba[e]);return this.#n(!0),t}};var ya=(n,e)=>new wi(n,e).parse(),wi=class{#e;#t;#r;#i;#n;constructor(e,t){this.#t=new Yo(e),this.#r=t}parse(){return this.#o(),this.#s()}#o(e,t){if(!this._matches(e,t))throw new Error(`Expected kind ${e} (${t}), was ${this.#i?.kind} (${this.#i?.value})`);let r=this.#t.nextToken();this.#i=r,this.#e=r?.kind,this.#n=r?.value}_matches(e,t){return!(e&&this.#e!==e||t&&this.#n!==t)}#s(){if(!this.#i)return this.#r.empty();let e=this.#c();return e===void 0?void 0:this.#a(e,0)}#a(e,t){if(e===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(M.GROUPER,"(")){let r=this.#y();e=this.#r.invoke(e,void 0,r)}else if(this._matches(M.GROUPER,"[")){let r=this.#q();e=this.#r.index(e,r)}else if(this._matches(M.DOT)){this.#o();let r=this.#c();e=this.#l(e,r)}else{if(this._matches(M.KEYWORD))break;if(this._matches(M.OPERATOR)&&this.#i.precedence>=t)e=this.#n==="?"?this.#u(e):this.#h(e,this.#i);else break}return e}#l(e,t){if(t===void 0)throw new Error("expected identifier");if(t.type==="ID")return this.#r.getter(e,t.value);if(t.type==="Invoke"&&t.receiver.type==="ID"){let r=t.receiver;return this.#r.invoke(e,r.value,t.arguments)}else throw new Error(`expected identifier: ${t}`)}#h(e,t){if(_c.indexOf(t.value)===-1)throw new Error(`unknown operator: ${t.value}`);this.#o();let r=this.#c();for(;(this.#e===M.OPERATOR||this.#e===M.DOT||this.#e===M.GROUPER)&&this.#i.precedence>t.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(e,t.value,r)}#c(){if(this._matches(M.OPERATOR)){let e=this.#n;if(this.#o(),e==="+"||e==="-"){if(this._matches(M.INTEGER))return this.#w(e);if(this._matches(M.DECIMAL))return this.#x(e)}if(Ic.indexOf(e)===-1)throw new Error(`unexpected token: ${e}`);let t=this.#a(this.#d(),Xo);return this.#r.unary(e,t)}return this.#d()}#u(e){this.#o(M.OPERATOR,"?");let t=this.#s();this.#o(M.COLON);let r=this.#s();return this.#r.ternary(e,t,r)}#d(){switch(this.#e){case M.KEYWORD:let e=this.#n;if(e==="this")return this.#o(),this.#r.id(e);throw Go.indexOf(e)!==-1?new Error(`unexpected keyword: ${e}`):new Error(`unrecognized keyword: ${e}`);case M.IDENTIFIER:return this.#b();case M.STRING:return this.#C();case M.INTEGER:return this.#w();case M.DECIMAL:return this.#x();case M.GROUPER:return this.#n==="("?this.#v():this.#n==="{"?this.#m():this.#n==="["?this.#p():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#p(){let e=[];do{if(this.#o(),this._matches(M.GROUPER,"]"))break;e.push(this.#s())}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"]"),this.#r.list(e)}#m(){let e={};do{if(this.#o(),this._matches(M.GROUPER,"}"))break;let t=this.#n;(this._matches(M.STRING)||this._matches(M.IDENTIFIER))&&this.#o(),this.#o(M.COLON),e[t]=this.#s()}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"}"),this.#r.map(e)}#b(){let e=this.#n;if(e==="true")return this.#o(),this.#r.literal(!0);if(e==="false")return this.#o(),this.#r.literal(!1);if(e==="null")return this.#o(),this.#r.literal(null);if(e==="undefined")return this.#o(),this.#r.literal(void 0);let t=this.#f(),r=this.#y();return r?this.#r.invoke(t,void 0,r):t}#f(){if(!this._matches(M.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let e=this.#n;return this.#o(),this.#r.id(e)}#y(){if(!this._matches(M.GROUPER,"("))return;let e=[];do{if(this.#o(),this._matches(M.GROUPER,")"))break;let t=this.#s();e.push(t)}while(this._matches(M.COMMA));return this.#o(M.GROUPER,")"),e}#q(){this.#o();let e=this.#s();return this.#o(M.GROUPER,"]"),e}#v(){let e=this.#y();if(this._matches(M.ARROW)){this.#o();let t=this.#s(),r=e?.map(i=>i.value)??[];return this.#r.arrowFunction(r,t)}else return this.#r.paren(e[0])}#C(){let e=this.#r.literal(this.#n);return this.#o(),e}#w(e=""){let t=this.#r.literal(parseInt(`${e}${this.#n}`,10));return this.#o(),t}#x(e=""){let t=this.#r.literal(parseFloat(`${e}${this.#n}`));return this.#o(),t}};var{hasOwn:Rc,fromEntries:mp}=Object,fp={"+":(n,e)=>n+e,"-":(n,e)=>n-e,"*":(n,e)=>n*e,"/":(n,e)=>n/e,"%":(n,e)=>n%e,"==":(n,e)=>n==e,"!=":(n,e)=>n!=e,"===":(n,e)=>n===e,"!==":(n,e)=>n!==e,">":(n,e)=>n>e,">=":(n,e)=>n>=e,"<":(n,e)=>n<e,"<=":(n,e)=>n<=e,"||":(n,e)=>n||e,"&&":(n,e)=>n&&e,"??":(n,e)=>n??e,"|":(n,e)=>e(n),"|>":(n,e)=>e(n)},gp={"+":n=>n,"-":n=>-n,"!":n=>!n},Ko=class{empty(){return{type:"Empty",evaluate(e){return e},getIds(e){return e}}}literal(e){return{type:"Literal",value:e,evaluate(t){return this.value},getIds(t){return t}}}id(e){return{type:"ID",value:e,evaluate(t){return this.value==="this"?t:t?.[this.value]},getIds(t){return t.push(this.value),t}}}unary(e,t){let r=gp[e];return{type:"Unary",operator:e,child:t,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(e,t,r){let i=fp[t];return{type:"Binary",operator:t,left:e,right:r,evaluate(o){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(o),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(o),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(o),l=this.left.argument.evaluate(o)):this.left.type==="ID"&&(a=o,l=this.left.value),a===void 0?void 0:a[l]=s}return i(this.left.evaluate(o),this.right.evaluate(o))},getIds(o){return this.left.getIds(o),this.right.getIds(o),o}}}getter(e,t){return{type:"Getter",receiver:e,name:t,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(e,t,r){if(t!=null&&typeof t!="string")throw new Error("method not a string");return{type:"Invoke",receiver:e,method:t,arguments:r,evaluate(i){let o=this.receiver.evaluate(i),s=this.method?o:i?.this??i,a=this.method?o?.[t]:o,c=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,c)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(o=>o?.getIds(i)),i}}}paren(e){return e}index(e,t){return{type:"Index",receiver:e,argument:t,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(e,t,r){return{type:"Ternary",condition:e,trueExpr:t,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(e){return{type:"Map",entries:e,evaluate(t){let r={};if(e&&this.entries)for(let i in e){let o=this.entries[i];o&&(r[i]=o.evaluate(t))}return r},getIds(t){if(e&&this.entries)for(let r in e){let i=this.entries[r];i&&i.getIds(t)}return t}}}list(e){return{type:"List",items:e,evaluate(t){return this.items?.map(r=>r?.evaluate(t))},getIds(t){return this.items?.forEach(r=>r?.getIds(t)),t}}}arrowFunction(e,t){return{type:"ArrowFunction",params:e,body:t,evaluate(r){let i=this.params,o=this.body;return function(...s){let a=mp(i.map((c,d)=>[c,s[d]])),l=new Proxy(r??{},{set(c,d,h){return Rc(a,d)&&(a[d]=h),c[d]=h},get(c,d){return Rc(a,d)?a[d]:c[d]}});return o.evaluate(l)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var va=null,Oc={boundAttributeSuffix:K.M,marker:K.P,markerMatch:K.A,HTML_RESULT:K.C,getTemplateHtml:K.L,overrideDirectiveResolve:(n,e)=>class extends n{_$AS(t,r){return e(this,r)}},patchDirectiveResolve:(n,e)=>{if(n.prototype._$AS.name!==e.name){va??=n.prototype._$AS.name;for(let t=n.prototype;t!==Object.prototype;t=Object.getPrototypeOf(t))if(t.hasOwnProperty(va))return void(t[va]=e);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(n,e){n._$litDirective$=e},getAttributePartCommittedValue:(n,e,t)=>{let r=Z;return n.j=i=>r=i,n._$AI(e,n,t),r},connectedDisconnectable:n=>({...n,_$AU:!0}),resolveDirective:K.V,AttributePart:K.H,PropertyPart:K.B,BooleanAttributePart:K.N,EventPart:K.U,ElementPart:K.F,TemplateInstance:K.R,isIterable:K.D,ChildPart:K.I};var{AttributePart:bp,PropertyPart:yp,BooleanAttributePart:vp,EventPart:wp}=Oc,xa=new Ko,wa=new Map,Pc=n=>n.replace(/-(-|\w)/g,(e,t)=>t.toUpperCase()),Jo=(n,e)=>{let t=wa.get(n);if(t===void 0){if(wa.has(n))return;if(n=n.trim(),n.startsWith("{{")&&n.endsWith("}}")){let r=n.substring(2,n.length-2).trim();t=new wi(r,xa).parse(),wa.set(n,t)}}return t?.evaluate(e)},xp=(n,e,t,r)=>{let i=n.getAttribute("if");if(i!==null&&Jo(i,e))return Zo(n,e,t,r)},Mc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Dc=n=>/(?:\\{{)|(?:\\}})/g.test(n),xi=n=>n.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),qp=(n,e,t,r)=>{let i=n.getAttribute("repeat");if(i!==null){let o=Jo(i,e);if(!o[Symbol.iterator])return P;let s=qi(n),a=-1,l=[];for(let c of o){a++;let d=Object.create(e);d.item=c,d.index=a,d.this=e.this??e;let h=[];for(let m of s.parts){let w=m.update(d,t,r);m.type===1?h.push(...w):h.push(w)}let g={_$litType$:s,values:h};l.push(g)}return l}},$c={if:xp,repeat:qp},Fe=(n,e=$c,t={},r)=>{let o=qi(n).renderers;if(r){let a=qi(r).renderers,l=o.super;l!==void 0?t={...o,...t,super:(c,d,h)=>(h={...a,...h,super:(g,m,w)=>Zo(r,g,m,w)},l(c,d,h))}:(t={...a,...o,...t},n=r)}else t={...o,...t};return s=>Zo(n,s,e,t)};var Zo=(n,e,t=$c,r={})=>{let i=qi(n),o=[];for(let a of i.parts){let l=a.update(e,t,r);a.type===1?o.push(...l):o.push(l)}return{_$litType$:i,values:o}},Nc=new Map,qi=n=>{let e=Nc.get(n);return e===void 0&&Nc.set(n,e=Cp(n)),e},Cp=n=>{let e={h:void 0,el:n.cloneNode(!0),parts:[],renderers:{}},t=document.createTreeWalker(e.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=t.currentNode,i=-1,o=[];for(;(r=t.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 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),o.push(s);let h;if(d!==null){let g=d.trim(),m=g.startsWith("{{")&&g.endsWith("}}");h=(w,x,f)=>{let u=s.getAttribute("data"),y=u===null?void 0:Jo(u,w);return(m?Jo(g,w):f[d])?.(y,x,f)}}else l!==null?h=(g,m,w)=>{let x=m[l];return x?.(s,g,m,w)}:(c==="super"?e.renderers.super=(g,m,w)=>{let x=w.super,f=qi(s);return w={...w,...f.renderers},x(g,m,w)}:e.renderers[c]=(g,m,w)=>Zo(s,g,m,w),h=(g,m,w)=>{let x=w[c];return x?.(g,m,w)});e.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(Mc);if(d.length===1){Dc(c)&&s.setAttribute(l,xi(c));continue}s.removeAttribute(l);let h=l,g=bp,m=l[0];m==="."?(h=Pc(l.substring(1)),g=yp):m==="?"?(h=l.substring(1),g=vp):m==="@"&&(h=Pc(l.substring(1)),g=wp);let w=[xi(d[0])],x=[];for(let f=1;f<d.length;f+=2){let u=d[f];x.push(ya(u,xa)),w.push(xi(d[f+1]))}e.parts.push({type:1,index:i,name:h,strings:w,ctor:g,update:(f,u,y)=>x.map(v=>v.evaluate(f))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,l=a.split(Mc);l.length>1?s.textContent=xi(l[0]):Dc(a)&&(s.textContent=xi(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=ya(d,xa);e.parts.push({type:2,index:++i,update:(m,w)=>h.evaluate(m)});let g=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(g,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=g,t.currentNode=g}}for(let s of o)s.remove();return e};var Ep=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ci=class extends C{#e;createRenderRoot(){return this}constructor(){super(),this.#e=this.attachInternals(),this.#e.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=Fe(e)}render(){if(!this.computedContext)return b``;let e=this.computedContext.testParts.flatMap(t=>t.sections.flatMap(r=>r.items));return b` ${e.map(t=>this.myTemplate({item:t,view:this.computedContext.view}))} `}};Ep([T({context:F,subscribe:!0})],Ci.prototype,"computedContext",void 0);var qa=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Bt=class extends C{_handleTestElementChange(e,t){t&&this.requestUpdate()}static{this.styles=q`
6073
6447
  :host {
6074
- ${me};
6448
+ ${fe};
6075
6449
  }
6076
6450
  :host([disabled]) {
6077
- ${fe};
6451
+ ${ge};
6078
6452
  }
6079
- `}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(r=>r.active);t&&(this.sectionItems=t.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return b`<slot></slot>`}};qa([p({type:Boolean,reflect:!0,attribute:"disabled"})],Ft.prototype,"_internalDisabled",void 0);qa([T({context:F,subscribe:!0})],Ft.prototype,"computedContext",void 0);qa([$("computedContext")],Ft.prototype,"_handleTestElementChange",null);var kp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ei=class extends C{render(){return b` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};kp([_(),T({context:F,subscribe:!0})],Ei.prototype,"computedContext",void 0);var Sp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ki=class extends C{static{this.styles=q`
6453
+ `}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(r=>r.active);t&&(this.sectionItems=t.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let e=this.computedContext?.testParts.find(i=>i.active),r=e?.sections.find(i=>i.active)?.navigationMode||e?.navigationMode||"nonlinear";this._internalDisabled=r==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return b`<slot></slot>`}};qa([p({type:Boolean,reflect:!0,attribute:"disabled"})],Bt.prototype,"_internalDisabled",void 0);qa([T({context:F,subscribe:!0})],Bt.prototype,"computedContext",void 0);qa([$("computedContext")],Bt.prototype,"_handleTestElementChange",null);var kp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ei=class extends C{render(){return b` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};kp([_(),T({context:F,subscribe:!0})],Ei.prototype,"computedContext",void 0);var Sp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ki=class extends C{static{this.styles=q`
6080
6454
  table {
6081
6455
  width: 100%;
6082
6456
  border-collapse: collapse;
@@ -6123,15 +6497,15 @@ div.full-correct-response-inline {
6123
6497
  </table>
6124
6498
  `;return b`
6125
6499
  ${i(t,"Response Variables")} ${i(r,"Outcome Variables")}
6126
- `}};Sp([T({context:F,subscribe:!0})],ki.prototype,"computedContext",void 0);var Ca=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Bt=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Fe(e)}#e(e){let i=(this.computedContext?.testParts.find(o=>o.active)).sections.flatMap(o=>o.items).find(o=>o.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:i,outcomeVariableId:"SCORE",value:e},bubbles:!0}))}render(){let e=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!e||!e.variables)return b``;let t=e.variables.find(a=>a.identifier=="MAXSCORE")?.value,r=e.variables.find(a=>a.identifier=="SCORE"),i=r?.value,o=r?.externalScored!=="human";if(!t||!r)return P;let s=[...Array(Number(t)+1).keys()];return b`${this.myTemplate?this.myTemplate({scores:s,score:i,disabled:o}):P}`}constructor(){super(),this.view="",this.disabled=!1,this.myTemplate=null,this.addEventListener("click",e=>{let t=e.target,r=parseFloat(t.value);t.tagName==="INPUT"&&this.#e(r)})}};Ca([p({type:String,attribute:"view"})],Bt.prototype,"view",void 0);Ca([p({type:Boolean})],Bt.prototype,"disabled",void 0);Ca([T({context:F,subscribe:!0})],Bt.prototype,"computedContext",void 0);var Lc=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},kr=class extends C{constructor(){super(...arguments),this.view=null}render(){let e=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!e||!e.variables)return b``;if(e.category==="dep-informational")return b`<div>${this.dataset.informational}</div>`;let t=e?.variables.find(a=>a.identifier==="completionStatus")?.value,r=e?.variables.find(a=>a.identifier=="SCORE"),i=parseFloat(r?.value),o=e.externalScored;return b`<div>${t!=="completed"?this.dataset.textNoResponse:!o&&i!==void 0&&!Number.isNaN(i)?i>0?this.dataset.textCorrect:this.dataset.textIncorrect:o==="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.`:o==="human"?Number.isNaN(i)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};Lc([T({context:F,subscribe:!0})],kr.prototype,"computedContext",void 0);Lc([p({type:String,attribute:"view"})],kr.prototype,"view",void 0);var Ap=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Si=class extends C{#e;createRenderRoot(){return this}constructor(){super(),this.#e=this.attachInternals(),this.#e.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=Fe(e)}render(){if(!this.computedContext)return b``;let e=this.computedContext.testParts.flatMap(t=>t.sections);return b` ${e.map(t=>this.myTemplate({item:t}))} `}};Ap([T({context:F,subscribe:!0})],Si.prototype,"computedContext",void 0);var Ip=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ai=class extends C{static{this.styles=q`
6500
+ `}};Sp([T({context:F,subscribe:!0})],ki.prototype,"computedContext",void 0);var Ca=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ut=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Fe(e)}#e(e){let i=(this.computedContext?.testParts.find(o=>o.active)).sections.flatMap(o=>o.items).find(o=>o.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:i,outcomeVariableId:"SCORE",value:e},bubbles:!0}))}render(){let e=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!e||!e.variables)return b``;let t=e.variables.find(a=>a.identifier=="MAXSCORE")?.value,r=e.variables.find(a=>a.identifier=="SCORE"),i=r?.value,o=r?.externalScored!=="human";if(!t||!r)return P;let s=[...Array(Number(t)+1).keys()];return b`${this.myTemplate?this.myTemplate({scores:s,score:i,disabled:o}):P}`}constructor(){super(),this.view="",this.disabled=!1,this.myTemplate=null,this.addEventListener("click",e=>{let t=e.target,r=parseFloat(t.value);t.tagName==="INPUT"&&this.#e(r)})}};Ca([p({type:String,attribute:"view"})],Ut.prototype,"view",void 0);Ca([p({type:Boolean})],Ut.prototype,"disabled",void 0);Ca([T({context:F,subscribe:!0})],Ut.prototype,"computedContext",void 0);var Lc=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},kr=class extends C{constructor(){super(...arguments),this.view=null}render(){let e=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!e||!e.variables)return b``;if(e.category==="dep-informational")return b`<div>${this.dataset.informational}</div>`;let t=e?.variables.find(a=>a.identifier==="completionStatus")?.value,r=e?.variables.find(a=>a.identifier=="SCORE"),i=parseFloat(r?.value),o=e.externalScored;return b`<div>${t!=="completed"?this.dataset.textNoResponse:!o&&i!==void 0&&!Number.isNaN(i)?i>0?this.dataset.textCorrect:this.dataset.textIncorrect:o==="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.`:o==="human"?Number.isNaN(i)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};Lc([T({context:F,subscribe:!0})],kr.prototype,"computedContext",void 0);Lc([p({type:String,attribute:"view"})],kr.prototype,"view",void 0);var Ap=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Si=class extends C{#e;createRenderRoot(){return this}constructor(){super(),this.#e=this.attachInternals(),this.#e.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");this.myTemplate=Fe(e)}render(){if(!this.computedContext)return b``;let e=this.computedContext.testParts.flatMap(t=>t.sections);return b` ${e.map(t=>this.myTemplate({item:t}))} `}};Ap([T({context:F,subscribe:!0})],Si.prototype,"computedContext",void 0);var Ip=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ai=class extends C{static{this.styles=q`
6127
6501
  :host {
6128
- ${me};
6502
+ ${fe};
6129
6503
  }
6130
6504
  :host([disabled]) {
6131
- ${fe};
6505
+ ${ge};
6132
6506
  }
6133
- `}#e(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"section",id:e}}))}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#e(this.sectionId))}render(){return b` <slot></slot> `}};Ip([p({type:String,attribute:"section-id"})],Ai.prototype,"sectionId",void 0);var Ea=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ut=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 e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Fe(e)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext.testParts.find(h=>h.active),r=t?.sections.find(h=>h.active),i=r?.items.find(h=>h.active),{variables:o,...s}=i||{};if(!t||!r||!i)return;let a={...t,items:t.sections.flatMap(h=>h.items.map(({variables:g,...f})=>f)),sections:t.sections.map(h=>({...h,items:h.items.map(({variables:g,...f})=>f)}))},l={...r,items:r.items.map(({variables:h,...g})=>g)},{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 b` ${this.debug?b`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:P}
6134
- ${this.myTemplate?this.myTemplate(this.stampContext):P}`}};Ea([p({type:Boolean,reflect:!0})],Ut.prototype,"debug",void 0);Ea([_(),T({context:F,subscribe:!0})],Ut.prototype,"computedContext",void 0);Ea([_()],Ut.prototype,"stampContext",void 0);var Ii=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},en,Be=class extends C{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#e()},this._viewOptions=en.DEFAULT_VIEW_OPTIONS}static{this.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"]}connectedCallback(){super.connectedCallback(),this.#e()}#e(){if(this.viewOptions){let e=this.viewOptions.split(",").map(t=>t.trim());this._viewOptions=e.filter(t=>en.DEFAULT_VIEW_OPTIONS.includes(t))}else this._viewOptions=en.DEFAULT_VIEW_OPTIONS}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}render(){return b`
6507
+ `}#e(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"section",id:e}}))}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#e(this.sectionId))}render(){return b` <slot></slot> `}};Ip([p({type:String,attribute:"section-id"})],Ai.prototype,"sectionId",void 0);var Ea=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ht=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 e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Fe(e)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext.testParts.find(h=>h.active),r=t?.sections.find(h=>h.active),i=r?.items.find(h=>h.active),{variables:o,...s}=i||{};if(!t||!r||!i)return;let a={...t,items:t.sections.flatMap(h=>h.items.map(({variables:g,...m})=>m)),sections:t.sections.map(h=>({...h,items:h.items.map(({variables:g,...m})=>m)}))},l={...r,items:r.items.map(({variables:h,...g})=>g)},{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 b` ${this.debug?b`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:P}
6508
+ ${this.myTemplate?this.myTemplate(this.stampContext):P}`}};Ea([p({type:Boolean,reflect:!0})],Ht.prototype,"debug",void 0);Ea([_(),T({context:F,subscribe:!0})],Ht.prototype,"computedContext",void 0);Ea([_()],Ht.prototype,"stampContext",void 0);var Ii=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},en,Be=class extends C{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#e()},this._viewOptions=en.DEFAULT_VIEW_OPTIONS}static{this.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"]}connectedCallback(){super.connectedCallback(),this.#e()}#e(){if(this.viewOptions){let e=this.viewOptions.split(",").map(t=>t.trim());this._viewOptions=e.filter(t=>en.DEFAULT_VIEW_OPTIONS.includes(t))}else this._viewOptions=en.DEFAULT_VIEW_OPTIONS}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}render(){return b`
6135
6509
  <label part="label" for="viewSelect">${this.label}</label>
6136
6510
  <select
6137
6511
  part="select"
@@ -6140,11 +6514,11 @@ div.full-correct-response-inline {
6140
6514
  >
6141
6515
  ${this._viewOptions.map(e=>b`<option value="${e}" ?selected=${e===this.sessionContext.view}>${e}</option>`)}
6142
6516
  </select>
6143
- `}};en=Be;Ii([T({context:De,subscribe:!0})],Be.prototype,"sessionContext",void 0);Ii([p({type:String})],Be.prototype,"label",void 0);Ii([p({type:String,attribute:"view-options"})],Be.prototype,"viewOptions",void 0);Ii([$("viewOptions",{waitUntilFirstUpdate:!0})],Be.prototype,"_handleViewOptionsChange",void 0);Ii([_()],Be.prototype,"_viewOptions",void 0);var _p=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},_i=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Fe(e)}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}firstUpdated(e){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return b`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):P}`}};_p([T({context:De,subscribe:!0})],_i.prototype,"sessionContext",void 0);var Vc=[{tag:"qti-assessment-item-ref",ctor:Pe},{tag:"qti-assessment-section",ctor:Le},{tag:"qti-assessment-test",ctor:$t},{tag:"qti-outcome-processing",ctor:fo},{tag:"qti-test",ctor:Lt},{tag:"qti-test-feedback",ctor:Ro},{tag:"qti-test-part",ctor:mt},{tag:"qti-test-variables",ctor:bi},{tag:"test-check-item",ctor:Er},{tag:"test-container",ctor:Ce},{tag:"test-end-attempt",ctor:Lo},{tag:"test-item-link",ctor:yi},{tag:"test-item-to-speech",ctor:zt},{tag:"test-navigation",ctor:oe},{tag:"test-next",ctor:jt},{tag:"test-paging-buttons-stamp",ctor:Ci},{tag:"test-prev",ctor:Ft},{tag:"test-print-context",ctor:Ei},{tag:"test-print-item-variables",ctor:ki},{tag:"test-scoring-buttons",ctor:Bt},{tag:"test-scoring-feedback",ctor:kr},{tag:"test-section-buttons-stamp",ctor:Si},{tag:"test-section-link",ctor:Ai},{tag:"test-stamp",ctor:Ut},{tag:"test-tts-next",ctor:Wo},{tag:"test-tts-pause",ctor:Fo},{tag:"test-tts-play",ctor:jo},{tag:"test-tts-prev",ctor:Ho},{tag:"test-tts-resume",ctor:Bo},{tag:"test-tts-stop",ctor:Uo},{tag:"test-view",ctor:Be},{tag:"test-view-toggle",ctor:_i}];for(let{tag:n,ctor:e}of Vc)customElements.get(n)||customElements.define(n,e);var Ht=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ee=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.#e=null,this.#t=null}#e;#t;createRenderRoot(){let e=this.customElementRegistry;return this.#t=e,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...e?{customElementRegistry:e}:{}})}async handleItemURLChange(){if(this.itemURL)try{let e=this.qtiContext?.QTI_CONTEXT?.seed,t=(await Ve().load(this.itemURL)).shuffleInteractions(e);this.itemDoc=t.htmlDoc(this.#t??void 0)}catch(e){console.error("Error loading or parsing XML:",e)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Ve().parse(this.itemXML).htmlDoc(this.#t??void 0)}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#r(){let e=this.querySelector("template");this.#e=e?e.content:b``}#i(){let e=new CSSStyleSheet;e.replaceSync($o),this.shadowRoot.adoptedStyleSheets=[e]}render(){return b`
6517
+ `}};en=Be;Ii([T({context:Ne,subscribe:!0})],Be.prototype,"sessionContext",void 0);Ii([p({type:String})],Be.prototype,"label",void 0);Ii([p({type:String,attribute:"view-options"})],Be.prototype,"viewOptions",void 0);Ii([$("viewOptions",{waitUntilFirstUpdate:!0})],Be.prototype,"_handleViewOptionsChange",void 0);Ii([_()],Be.prototype,"_viewOptions",void 0);var _p=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},_i=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Fe(e)}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}firstUpdated(e){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return b`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):P}`}};_p([T({context:Ne,subscribe:!0})],_i.prototype,"sessionContext",void 0);var Vc=[{tag:"qti-assessment-item-ref",ctor:Me},{tag:"qti-assessment-section",ctor:me},{tag:"qti-assessment-test",ctor:Lt},{tag:"qti-outcome-processing",ctor:fo},{tag:"qti-test",ctor:Vt},{tag:"qti-test-feedback",ctor:Ro},{tag:"qti-test-part",ctor:ft},{tag:"qti-test-variables",ctor:bi},{tag:"test-check-item",ctor:Er},{tag:"test-container",ctor:Ee},{tag:"test-end-attempt",ctor:Lo},{tag:"test-item-link",ctor:yi},{tag:"test-item-to-speech",ctor:jt},{tag:"test-navigation",ctor:oe},{tag:"test-next",ctor:Ft},{tag:"test-paging-buttons-stamp",ctor:Ci},{tag:"test-prev",ctor:Bt},{tag:"test-print-context",ctor:Ei},{tag:"test-print-item-variables",ctor:ki},{tag:"test-scoring-buttons",ctor:Ut},{tag:"test-scoring-feedback",ctor:kr},{tag:"test-section-buttons-stamp",ctor:Si},{tag:"test-section-link",ctor:Ai},{tag:"test-stamp",ctor:Ht},{tag:"test-tts-next",ctor:Wo},{tag:"test-tts-pause",ctor:Fo},{tag:"test-tts-play",ctor:jo},{tag:"test-tts-prev",ctor:Ho},{tag:"test-tts-resume",ctor:Bo},{tag:"test-tts-stop",ctor:Uo},{tag:"test-view",ctor:Be},{tag:"test-view-toggle",ctor:_i}];for(let{tag:n,ctor:e}of Vc)customElements.get(n)||customElements.define(n,e);var Wt=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ke=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.#e=null,this.#t=null}#e;#t;createRenderRoot(){let e=this.customElementRegistry;return this.#t=e,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...e?{customElementRegistry:e}:{}})}async handleItemURLChange(){if(this.itemURL)try{let e=this.qtiContext?.QTI_CONTEXT?.seed,t=(await Ve().load(this.itemURL)).shuffleInteractions(e);this.itemDoc=t.htmlDoc(this.#t??void 0)}catch(e){console.error("Error loading or parsing XML:",e)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Ve().parse(this.itemXML).htmlDoc(this.#t??void 0)}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#r(){let e=this.querySelector("template");this.#e=e?e.content:b``}#i(){let e=new CSSStyleSheet;e.replaceSync($o),this.shadowRoot.adoptedStyleSheets=[e]}render(){return b`
6144
6518
  ${this.#e}
6145
6519
  <slot></slot>
6146
6520
  ${No(this.itemDoc,b`<span>Loading...</span>`)}
6147
- `}};Ht([p({attribute:!1})],Ee.prototype,"customElementRegistry",void 0);Ht([p({type:String,attribute:"item-url"})],Ee.prototype,"itemURL",void 0);Ht([_()],Ee.prototype,"itemDoc",void 0);Ht([_()],Ee.prototype,"itemXML",void 0);Ht([_(),T({context:he,subscribe:!0})],Ee.prototype,"qtiContext",void 0);Ht([$("itemURL",{waitUntilFirstUpdate:!0})],Ee.prototype,"handleItemURLChange",null);Ht([$("itemXML",{waitUntilFirstUpdate:!0})],Ee.prototype,"handleItemXMLChange",null);var Tp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ti=class extends C{static{this.styles=q`
6521
+ `}};Wt([p({attribute:!1})],ke.prototype,"customElementRegistry",void 0);Wt([p({type:String,attribute:"item-url"})],ke.prototype,"itemURL",void 0);Wt([_()],ke.prototype,"itemDoc",void 0);Wt([_()],ke.prototype,"itemXML",void 0);Wt([_(),T({context:he,subscribe:!0})],ke.prototype,"qtiContext",void 0);Wt([$("itemURL",{waitUntilFirstUpdate:!0})],ke.prototype,"handleItemURLChange",null);Wt([$("itemXML",{waitUntilFirstUpdate:!0})],ke.prototype,"handleItemXMLChange",null);var Tp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ti=class extends C{static{this.styles=q`
6148
6522
  table {
6149
6523
  width: 100%;
6150
6524
  border-collapse: collapse;
@@ -6191,7 +6565,7 @@ div.full-correct-response-inline {
6191
6565
  </table>
6192
6566
  `;return b`
6193
6567
  ${i(t,"Response Variables")} ${i(r,"Outcome Variables")}
6194
- `}};Tp([T({context:ct,subscribe:!0})],Ti.prototype,"computedContext",void 0);var ka=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},et=class extends C{#e;#t;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#e=this.#r.bind(this),this.#t=this.#i.bind(this),this.addEventListener("qti-item-context-updated",this.#e),this.addEventListener("qti-assessment-item-connected",this.#t)}#r(e){this.#n(e.detail.itemContext.identifier,e.detail?.itemContext?.variables||[])}#i(e){let t=e.detail._context.variables;this.assessmentItem=e.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:t},this.#n(this.assessmentItem.identifier,t||[])}#n(e,t){let r=t?.find(c=>c.identifier=="SCORE")?.value,i=parseFloat(r?.toString()),o=t?.find(c=>c.identifier==="completionStatus")?.value,s=i!==void 0&&!isNaN(i)&&i>0,a=i!==void 0&&!isNaN(i)&&i<=0,l=o==="completed";this.computedContext={...this.computedContext,identifier:e,correct:s,incorrect:a,completed:l,variables:t}}render(){return b`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#e),this.removeEventListener("qti-assessment-item-connected",this.#t)}};ka([_(),B({context:ct})],et.prototype,"computedContext",void 0);ka([_(),B({context:de})],et.prototype,"configContext",void 0);ka([_(),B({context:he})],et.prototype,"qtiContext",void 0);var zc=[{tag:"item-container",ctor:Ee},{tag:"item-print-variables",ctor:Ti},{tag:"qti-item",ctor:et}];for(let{tag:n,ctor:e}of zc)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of yc)customElements.get(n)||customElements.define(n,e);var jc=(n,e,t)=>{let r=new Map;for(let i=e;i<=t;i++)r.set(n[i],i);return r},H=qe(class extends dt{constructor(n){if(super(n),n.type!==ur.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let i=[],o=[],s=0;for(let a of n)i[s]=r?r(a,s):s,o[s]=t(a,s),s++;return{values:o,keys:i}}render(n,e,t){return this.dt(n,e,t).values}update(n,[e,t,r]){let i=Xl(n),{values:o,keys:s}=this.dt(e,t,r);if(!Array.isArray(i))return this.ut=s,o;let a=this.ut??=[],l=[],c,d,h=0,g=i.length-1,f=0,w=o.length-1;for(;h<=g&&f<=w;)if(i[h]===null)h++;else if(i[g]===null)g--;else if(a[h]===s[f])l[f]=ht(i[h],o[f]),h++,f++;else if(a[g]===s[w])l[w]=ht(i[g],o[w]),g--,w--;else if(a[h]===s[w])l[w]=ht(i[h],o[w]),mr(n,l[w+1],i[h]),h++,w--;else if(a[g]===s[f])l[f]=ht(i[g],o[f]),mr(n,i[h],i[g]),g--,f++;else if(c===void 0&&(c=jc(s,f,w),d=jc(a,h,g)),c.has(a[h]))if(c.has(a[g])){let x=d.get(s[f]),m=x!==void 0?i[x]:null;if(m===null){let u=mr(n,i[h]);ht(u,o[f]),l[f]=u}else l[f]=ht(m,o[f]),mr(n,i[h],m),i[x]=null;f++}else go(i[g]),g--;else go(i[h]),h++;for(;f<=w;){let x=mr(n,l[w+1]);ht(x,o[f]),l[f++]=x}for(;h<=g;){let x=i[h++];x!==null&&go(x)}return this.ut=s,Gl(n,l),Z}});var gt=Symbol("dragDropContext");var Fc=[R,Ne,q`
6568
+ `}};Tp([T({context:ct,subscribe:!0})],Ti.prototype,"computedContext",void 0);var ka=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},et=class extends C{#e;#t;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#e=this.#r.bind(this),this.#t=this.#i.bind(this),this.addEventListener("qti-item-context-updated",this.#e),this.addEventListener("qti-assessment-item-connected",this.#t)}#r(e){this.#n(e.detail.itemContext.identifier,e.detail?.itemContext?.variables||[])}#i(e){let t=e.detail._context.variables;this.assessmentItem=e.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:t},this.#n(this.assessmentItem.identifier,t||[])}#n(e,t){let r=t?.find(c=>c.identifier=="SCORE")?.value,i=parseFloat(r?.toString()),o=t?.find(c=>c.identifier==="completionStatus")?.value,s=i!==void 0&&!isNaN(i)&&i>0,a=i!==void 0&&!isNaN(i)&&i<=0,l=o==="completed";this.computedContext={...this.computedContext,identifier:e,correct:s,incorrect:a,completed:l,variables:t}}render(){return b`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#e),this.removeEventListener("qti-assessment-item-connected",this.#t)}};ka([_(),B({context:ct})],et.prototype,"computedContext",void 0);ka([_(),B({context:de})],et.prototype,"configContext",void 0);ka([_(),B({context:he})],et.prototype,"qtiContext",void 0);var zc=[{tag:"item-container",ctor:ke},{tag:"item-print-variables",ctor:Ti},{tag:"qti-item",ctor:et}];for(let{tag:n,ctor:e}of zc)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of yc)customElements.get(n)||customElements.define(n,e);var jc=(n,e,t)=>{let r=new Map;for(let i=e;i<=t;i++)r.set(n[i],i);return r},H=Ce(class extends ht{constructor(n){if(super(n),n.type!==ur.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,e,t){let r;t===void 0?t=e:e!==void 0&&(r=e);let i=[],o=[],s=0;for(let a of n)i[s]=r?r(a,s):s,o[s]=t(a,s),s++;return{values:o,keys:i}}render(n,e,t){return this.dt(n,e,t).values}update(n,[e,t,r]){let i=Xl(n),{values:o,keys:s}=this.dt(e,t,r);if(!Array.isArray(i))return this.ut=s,o;let a=this.ut??=[],l=[],c,d,h=0,g=i.length-1,m=0,w=o.length-1;for(;h<=g&&m<=w;)if(i[h]===null)h++;else if(i[g]===null)g--;else if(a[h]===s[m])l[m]=pt(i[h],o[m]),h++,m++;else if(a[g]===s[w])l[w]=pt(i[g],o[w]),g--,w--;else if(a[h]===s[w])l[w]=pt(i[h],o[w]),mr(n,l[w+1],i[h]),h++,w--;else if(a[g]===s[m])l[m]=pt(i[g],o[m]),mr(n,i[h],i[g]),g--,m++;else if(c===void 0&&(c=jc(s,m,w),d=jc(a,h,g)),c.has(a[h]))if(c.has(a[g])){let x=d.get(s[m]),f=x!==void 0?i[x]:null;if(f===null){let u=mr(n,i[h]);pt(u,o[m]),l[m]=u}else l[m]=pt(f,o[m]),mr(n,i[h],f),i[x]=null;m++}else go(i[g]),g--;else go(i[h]),h++;for(;m<=w;){let x=mr(n,l[w+1]);pt(x,o[m]),l[m++]=x}for(;h<=g;){let x=i[h++];x!==null&&go(x)}return this.ut=s,Gl(n,l),Z}});var bt=Symbol("dragDropContext");var Fc=[R,$e,q`
6195
6569
  /* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
6196
6570
  custom properties on its host; the properties themselves live here. */
6197
6571
  :host {
@@ -6211,7 +6585,7 @@ div.full-correct-response-inline {
6211
6585
  }
6212
6586
  `];var Bc=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Sr=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=Fc}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 b`<div part="drop">
6213
6587
  ${H(this.drags,e=>e.getAttribute("identifier"),e=>e)}
6214
- </div>`}};Bc([p({type:String,reflect:!0})],Sr.prototype,"identifier",void 0);Bc([T({context:gt,subscribe:!0}),_()],Sr.prototype,"_dragDrop",void 0);var Uc=[{tag:"qti-associable-hotspot",ctor:Sr}];var Hc=[R,Ne,q`
6588
+ </div>`}};Bc([p({type:String,reflect:!0})],Sr.prototype,"identifier",void 0);Bc([T({context:bt,subscribe:!0}),_()],Sr.prototype,"_dragDrop",void 0);var Uc=[{tag:"qti-associable-hotspot",ctor:Sr}];var Hc=[R,$e,q`
6215
6589
  /*
6216
6590
  * A drop target. The interaction measures its chips and publishes the result as custom
6217
6591
  * properties on its own host; the actual CSS properties live here, not in a style attribute.
@@ -6256,9 +6630,9 @@ div.full-correct-response-inline {
6256
6630
  min-height: var(--qti-dropzone-min-height, 0);
6257
6631
  min-width: var(--qti-dropzone-min-width, 0);
6258
6632
  }
6259
- `];var Sa=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Wt=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=Hc}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`<div part="drop">
6633
+ `];var Sa=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Qt=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=Hc}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`<div part="drop">
6260
6634
  ${H(this.drags,e=>e.getAttribute("identifier"),e=>e)}
6261
- </div>`}};Sa([p({type:Number,reflect:!0})],Wt.prototype,"tabindex",void 0);Sa([p({type:String,reflect:!0})],Wt.prototype,"identifier",void 0);Sa([T({context:gt,subscribe:!0}),_()],Wt.prototype,"_dragDrop",void 0);var Wc=[{tag:"qti-gap",ctor:Wt}];var Qc=[R,q`
6635
+ </div>`}};Sa([p({type:Number,reflect:!0})],Qt.prototype,"tabindex",void 0);Sa([p({type:String,reflect:!0})],Qt.prototype,"identifier",void 0);Sa([T({context:bt,subscribe:!0}),_()],Qt.prototype,"_dragDrop",void 0);var Wc=[{tag:"qti-gap",ctor:Qt}];var Qc=[R,q`
6262
6636
  /* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
6263
6637
  graphic-gap-match rules, on the host from the document. */
6264
6638
  :host {
@@ -6267,7 +6641,7 @@ div.full-correct-response-inline {
6267
6641
  justify-content: center;
6268
6642
  user-select: none;
6269
6643
  }
6270
- `];var Rp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ri=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=Qc}connectedCallback(){this.setAttribute("slot","drags")}};Rp([p({type:Number,reflect:!0})],Ri.prototype,"tabindex",void 0);var Gc=[{tag:"qti-gap-img",ctor:Ri}];var Qt=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Xc={toAttribute:n=>n?"true":"false",fromAttribute:n=>n==="true"};function ge(n,e){class t extends n{#e;#t(){let o=this._interactionContext?.choiceRole??null;o!==this.#e&&(this.#e&&this.internals.states.delete(this.#e),this.#e=o,this.internals.role=o,o&&this.internals.states.add(o))}handleDisabledChange(i,o){o?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=o?-1:0}handleReadonlyChange(i,o){o?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...i){super(...i),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#e=null,this.internals=this.attachInternals()}willUpdate(i){super.willUpdate(i),this.#t()}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.dispatchEvent(new CustomEvent(`register-${e}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${e}`,{bubbles:!0,composed:!0}))}_onKeyUp(i){i.altKey||(i.code==="Space"||i.code==="Enter")&&(i.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${e}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return b`<slot></slot>`}}return Qt([p({type:String})],t.prototype,"identifier",void 0),Qt([p({type:Number,reflect:!0,attribute:"tabindex"})],t.prototype,"tabIndex",void 0),Qt([p({type:Boolean,attribute:"aria-disabled",converter:Xc})],t.prototype,"disabled",void 0),Qt([p({type:Boolean,attribute:"aria-readonly",converter:Xc})],t.prototype,"readonly",void 0),Qt([T({context:dr,subscribe:!0}),_()],t.prototype,"_interactionContext",void 0),Qt([$("disabled",{waitUntilFirstUpdate:!0})],t.prototype,"handleDisabledChange",null),Qt([$("readonly",{waitUntilFirstUpdate:!0})],t.prototype,"handleReadonlyChange",null),t}var Yc=[R,q`
6644
+ `];var Rp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ri=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=Qc}connectedCallback(){this.setAttribute("slot","drags")}};Rp([p({type:Number,reflect:!0})],Ri.prototype,"tabindex",void 0);var Gc=[{tag:"qti-gap-img",ctor:Ri}];var Gt=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Xc={toAttribute:n=>n?"true":"false",fromAttribute:n=>n==="true"};function be(n,e){class t extends n{#e;#t(){let o=this._interactionContext?.choiceRole??null;o!==this.#e&&(this.#e&&this.internals.states.delete(this.#e),this.#e=o,this.internals.role=o,o&&this.internals.states.add(o))}handleDisabledChange(i,o){o?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=o?-1:0}handleReadonlyChange(i,o){o?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...i){super(...i),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#e=null,this.internals=this.attachInternals()}willUpdate(i){super.willUpdate(i),this.#t()}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.dispatchEvent(new CustomEvent(`register-${e}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${e}`,{bubbles:!0,composed:!0}))}_onKeyUp(i){i.altKey||(i.code==="Space"||i.code==="Enter")&&(i.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${e}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return b`<slot></slot>`}}return Gt([p({type:String})],t.prototype,"identifier",void 0),Gt([p({type:Number,reflect:!0,attribute:"tabindex"})],t.prototype,"tabIndex",void 0),Gt([p({type:Boolean,attribute:"aria-disabled",converter:Xc})],t.prototype,"disabled",void 0),Gt([p({type:Boolean,attribute:"aria-readonly",converter:Xc})],t.prototype,"readonly",void 0),Gt([T({context:hr,subscribe:!0}),_()],t.prototype,"_interactionContext",void 0),Gt([$("disabled",{waitUntilFirstUpdate:!0})],t.prototype,"handleDisabledChange",null),Gt([$("readonly",{waitUntilFirstUpdate:!0})],t.prototype,"handleReadonlyChange",null),t}var Yc=[R,q`
6271
6645
  /*
6272
6646
  * A chip's own box. Both drag-drop interactions that use this element laid it out from the
6273
6647
  * theme — gap-match with 'display: flex !important; align-items: center !important',
@@ -6298,8 +6672,8 @@ div.full-correct-response-inline {
6298
6672
  justify-content: var(--qti-drag-justify-content, normal);
6299
6673
  user-select: none;
6300
6674
  }
6301
- `];var Op=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},bt=class extends ge(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=Yc}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<div part="control"></div>
6302
- <slot part="label"></slot>`}};Op([p({type:Number,reflect:!0})],bt.prototype,"tabindex",void 0);var Kc=[{tag:"qti-gap-text",ctor:bt}];var Jc=[R,q`
6675
+ `];var Op=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},yt=class extends be(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=Yc}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<div part="control"></div>
6676
+ <slot part="label"></slot>`}};Op([p({type:Number,reflect:!0})],yt.prototype,"tabindex",void 0);var Kc=[{tag:"qti-gap-text",ctor:yt}];var Jc=[R,q`
6303
6677
  :host {
6304
6678
  display: flex;
6305
6679
  user-select: none;
@@ -6319,7 +6693,7 @@ div.full-correct-response-inline {
6319
6693
  display: grid;
6320
6694
  place-content: center;
6321
6695
  }
6322
- `];var Pp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Gt=class extends ge(C,"qti-hotspot-choice"){static{this.styles=Jc}};Pp([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],Gt.prototype,"order",void 0);var Zc=[{tag:"qti-hotspot-choice",ctor:Gt}];var ed=[R,q`
6696
+ `];var Pp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Xt=class extends be(C,"qti-hotspot-choice"){static{this.styles=Jc}};Pp([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],Xt.prototype,"order",void 0);var Zc=[{tag:"qti-hotspot-choice",ctor:Xt}];var ed=[R,q`
6323
6697
  /* 'position: relative' is the containing block for the answer-key tick the theme draws as an
6324
6698
  absolutely positioned ::before. See CONTRACT.md §7. */
6325
6699
  :host {
@@ -6339,8 +6713,8 @@ div.full-correct-response-inline {
6339
6713
  [part='control'] {
6340
6714
  display: none;
6341
6715
  }
6342
- `];var Xt=class extends ge(C,"qti-hottext"){static{this.styles=ed}render(){return b`<div part="control"><div part="control-mark"></div></div>
6343
- <slot part="label"></slot>`}};var td=[{tag:"qti-hottext",ctor:Xt}];var Mp=q`
6716
+ `];var Yt=class extends be(C,"qti-hottext"){static{this.styles=ed}render(){return b`<div part="control"><div part="control-mark"></div></div>
6717
+ <slot part="label"></slot>`}};var td=[{tag:"qti-hottext",ctor:Yt}];var Mp=q`
6344
6718
  /*
6345
6719
  * An option row: one line, clipped, with its text centred against the row's min-height. All four
6346
6720
  * were in the theme, set on this host from the document — which is also why the 'display: block'
@@ -6357,13 +6731,13 @@ div.full-correct-response-inline {
6357
6731
  slot {
6358
6732
  display: inline;
6359
6733
  }
6360
- `,rd=Mp;var Dp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Oi=class extends ge(C,"qti-inline-choice"){static{this.styles=rd}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#e),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#e)}render(){return b` <slot></slot> `}#e(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};Dp([p({type:String})],Oi.prototype,"identifier",void 0);var id=[{tag:"qti-inline-choice",ctor:Oi}];var od=[R,q`
6734
+ `,rd=Mp;var Dp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Oi=class extends be(C,"qti-inline-choice"){static{this.styles=rd}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#e),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#e)}render(){return b` <slot></slot> `}#e(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};Dp([p({type:String})],Oi.prototype,"identifier",void 0);var id=[{tag:"qti-inline-choice",ctor:Oi}];var od=[R,q`
6361
6735
  :host {
6362
6736
  display: block;
6363
6737
  margin: var(--qti-gap) 0;
6364
6738
  width: 100%;
6365
6739
  }
6366
- `];var tn=class extends C{static{this.styles=od}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var nd=[{tag:"qti-prompt",ctor:tn}];var sd=[R,Ne,q`
6740
+ `];var tn=class extends C{static{this.styles=od}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var nd=[{tag:"qti-prompt",ctor:tn}];var sd=[R,$e,q`
6367
6741
  /*
6368
6742
  * 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
6369
6743
  * way. In tabular match this element is a light-DOM *grandchild* of the slotted
@@ -6500,13 +6874,13 @@ div.full-correct-response-inline {
6500
6874
  ::slotted(p) {
6501
6875
  display: inline;
6502
6876
  }
6503
- `];var rn=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ke=class extends ge(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=sd}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`
6877
+ `];var rn=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Se=class extends be(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=sd}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`
6504
6878
  <div part="control"></div>
6505
6879
  <slot part="label"></slot>
6506
6880
  <div part="drop">
6507
6881
  ${H(this.drags,e=>e.getAttribute("identifier"),e=>e)}
6508
6882
  </div>
6509
- `}};rn([p({type:Number,attribute:"match-min"})],ke.prototype,"matchMin",void 0);rn([p({type:Number,attribute:"match-max"})],ke.prototype,"matchMax",void 0);rn([p({type:String,attribute:"fixed",converter:{fromAttribute:n=>n==="true",toAttribute:n=>String(n)}})],ke.prototype,"fixed",void 0);rn([T({context:gt,subscribe:!0}),_()],ke.prototype,"_dragDrop",void 0);var ad=[{tag:"qti-simple-associable-choice",ctor:ke}];var ld=[R,q`
6883
+ `}};rn([p({type:Number,attribute:"match-min"})],Se.prototype,"matchMin",void 0);rn([p({type:Number,attribute:"match-max"})],Se.prototype,"matchMax",void 0);rn([p({type:String,attribute:"fixed",converter:{fromAttribute:n=>n==="true",toAttribute:n=>String(n)}})],Se.prototype,"fixed",void 0);rn([T({context:bt,subscribe:!0}),_()],Se.prototype,"_dragDrop",void 0);var ad=[{tag:"qti-simple-associable-choice",ctor:Se}];var ld=[R,q`
6510
6884
  /*
6511
6885
  * 'position: relative' unconditionally, because this element can carry a correction badge and a
6512
6886
  * badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
@@ -6542,9 +6916,9 @@ div.full-correct-response-inline {
6542
6916
  align-items: center;
6543
6917
  justify-content: center;
6544
6918
  }
6545
- `];var on=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Se=class extends ge(C,"qti-simple-choice"){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=ld}static{this.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0}}get checked(){return this.internals.states.has("checked")}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
6919
+ `];var on=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ae=class extends be(C,"qti-simple-choice"){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=ld}static{this.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0}}get checked(){return this.internals.states.has("checked")}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
6546
6920
  ${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:P}
6547
- <slot part="label"></slot>`}};on([p({type:String,attribute:"template-identifier"})],Se.prototype,"templateIdentifier",void 0);on([p({type:String,attribute:"show-hide"})],Se.prototype,"showHide",void 0);on([p({type:Boolean,converter:{fromAttribute:n=>n==="true",toAttribute:n=>String(n)}})],Se.prototype,"fixed",void 0);on([p({type:String,attribute:!1})],Se.prototype,"marker",void 0);var cd=[{tag:"qti-simple-choice",ctor:Se}];var dd=[...Uc,...Wc,...Gc,...Kc,...Zc,...td,...id,...nd,...ad,...cd];var Np=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o};function $p(n,e,t,r,i={}){let o=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!e.length||!t.length||!s)return;let a=0,l=0,c=r.length?r:[n],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")),e.forEach(h=>{let g=h.getBoundingClientRect();a=Math.max(a,g.height),l=Math.max(l,g.width)}),d.forEach(({el:h,reservation:g,hadStyleAttribute:f})=>{g?h.style.setProperty("--qti-drag-min-width",g):h.style.removeProperty("--qti-drag-min-width"),!f&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:l})!==!1&&(n.style.setProperty("--qti-dropzone-min-height",`${a}px`),o&&(n.style.setProperty("--qti-dropzone-min-width",`${l}px`),n.style.setProperty("--qti-drag-min-width",`${l}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),o&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var Aa=(n,e,t,r='slot[part="drags"]')=>{class i extends n{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#e=null,this.#t=new Set,this.#r=null,this.#i=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#e;#t;#r;#i;#n;collectAutoSizeTargets(){let s=(a,l)=>Array.from(l?.querySelectorAll(a)??[]);return{draggables:[...s(e,this),...s(e,this.shadowRoot)],droppables:[...s(t,this),...s(t,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&($p(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.#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.#e??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let l of this.#t)a.has(l)||this.#e.unobserve(l);for(let l of a)this.#t.has(l)||this.#e.observe(l);this.#t=a}disconnectedCallback(){this.#e?.disconnect(),this.#e=null,this.#t.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return Np([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Ue,AbortSignal:Ia,WeakMap:Lp,WeakRef:Vp,Window:hd,reportError:nn=console.log}=globalThis,yt=n=>n&&n.defaultView!==null&&n.defaultView.document===n&&(n.defaultView.top===n.defaultView||yt(n.defaultView.parent.document)),Yt=()=>!!hd&&globalThis instanceof hd,_a=Symbol("unset"),[pd,zp]=(()=>{function n(x,m,u=!0){Object.defineProperty(x,m,{...Object.getOwnPropertyDescriptor(x,m),enumerable:u})}let e="try"in Promise?Promise.try.bind(Promise):(x,...m)=>new Promise(u=>u(x(...m))),t="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,m;return{promise:new Promise((y,v)=>(x=y,m=v)),resolve:x,reject:m}};function r(x,m){let u=m.call(x);if(u===null||typeof u!="object")throw new TypeError("Iterator is not an object");return u}let i=new Lp,o={next(...x){let m=this,u=i.get(m);if(!u?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:y}=u;return e(()=>y.next(...x))},return(...x){let m=this,u=i.get(m);if(!u?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:y}=u;return e(()=>y.return?y.return(...x):{value:void 0,done:!0})},throw(...x){let m=this,u=i.get(m);if(!u?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:y}=u;return e(()=>{if(!y.throw)throw y.return(),new TypeError("no throw method");return y.throw(...x)})}};function s(x){let m=Object.create(o);return i.set(m,{syncIteratorRecord:x}),m}function a(x,m){let u;if(m){if(u=x[Symbol.asyncIterator],u==null){if(u=x[Symbol.iterator],u==null)throw new TypeError("Object is not async iterable");let y=r(x,u);return s(y)}}else u=x[Symbol.iterator];if(u==null)throw new TypeError("Object is not iterable");return r(x,u)}let l="any"in Ia?Ia.any.bind(Ia):x=>{let m=new Ue;for(let u of x)if(u.aborted)return m.abort(u.reason),m.signal;for(let u of x)u.addEventListener("abort",()=>{m.abort(u.reason)},{signal:m.signal});return m.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:m,error:u,complete:y}={}){i.set(this,{next:m,error:u,complete:y})}next(m){let{next:u}=i.get(this)||{};u&&u(m)}error(m){let{error:u}=i.get(this)||{};u?u(m):nn(m)}complete(){let{complete:m}=i.get(this)||{};m&&m()}}function h(x,m){let u=i.get(x);if(u?.active){u.active=!1,u.subscriptionController.abort(m);for(let y of u.teardowns.reverse()){if(Yt()&&!yt(document))return;try{y()}catch(v){nn(v)}}}}function g(x,m,u={}){if(Yt()&&!yt(document))return;let y;typeof m=="function"?y=new d({next:m}):m&&!(m instanceof d)?y=new d(m):y=m||new d;let v=i.get(x),A=v.weakSubscriber?.deref();if(A?.active){let I=A,E=i.get(I);E.observers.add(y),u.signal&&(u.signal.aborted?E.observers.delete(y):u.signal.addEventListener("abort",()=>{let O=i.get(I);O?.active&&(O.observers.delete(y),O.observers.size==0&&h(I,u.signal.reason))}));return}let S=new f(y);if(v.weakSubscriber=new Vp(S),"signal"in u&&(u.signal.aborted?h(S,u.signal.reason):u.signal.addEventListener("abort",()=>{let I=i.get(S);I?.active&&(I.observers.delete(y),I.observers.size==0&&h(S,u.signal.reason))})),v.subscribeCallback)try{v.subscribeCallback(S)}catch(I){S.error(I)}}class f{get[Symbol.toStringTag](){return"Subscriber"}constructor(m=null){if(!(m instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([m]),teardowns:[],subscriptionController:new Ue})}next(m){if(!(this instanceof f))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let u=i.get(this);if(!u?.active||Yt()&&!yt(document))return;let y=new Set(u.observers);for(let v of y)v.next(m)}error(m){if(!(this instanceof f))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let u=i.get(this);if(!u?.active){nn(m);return}if(Yt()&&!yt(document))return;h(this,m);let y=new Set(u.observers);for(let v of y)v.error(m)}complete(){if(!(this instanceof f))throw new TypeError("illegal invocation");let m=i.get(this);if(!m?.active||Yt()&&!yt(document))return;h(this);let u=new Set(m.observers);for(let y of u)y.complete()}addTeardown(m){if(!(this instanceof f))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(Yt()&&!yt(document))return;let u=i.get(this);u?.active?u.teardowns.push(m):m()}get active(){if(!(this instanceof f))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof f))throw new TypeError("illegal invocation");if(!i.has(this)){let m=new Ue;return m.abort(),m.signal}return i.get(this).subscriptionController.signal}}n(f.prototype,"next"),n(f.prototype,"error"),n(f.prototype,"complete"),n(f.prototype,"addTeardown"),n(f.prototype,"active"),n(f.prototype,"signal");class w{get[Symbol.toStringTag](){return"Observable"}constructor(m){if(!m)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:m})}static from(m){if(m===null||typeof m!="object")throw new TypeError("Observable.from only accepts objects");if(m instanceof w)return m;if(typeof(Symbol.asyncIterator in m&&m[Symbol.asyncIterator])=="function"){let A=function(S,I){if(S.signal.aborted)return;let E;try{let O=I.next();E=Promise.resolve(O)}catch(O){E=Promise.reject(O)}E.then(O=>{if(O===null||typeof O!="object"){S.error(new TypeError("Not an IteratorResult."));return}try{({done:v}=O)}catch(V){S.error(V);return}if(v){S.complete();return}let N;try{N=O.value}catch(V){S.error(V);return}S.next(N),A(S,I)},O=>{S.error(O)})},v=!1;return new w(S=>{if(S.signal.aborted)return;let I;try{I=a(m,!0)}catch(O){S.error(O);return}let E=I;S.signal.aborted||(S.signal.addEventListener("abort",()=>{if(typeof E.return!="function"||v)return;e(()=>E.return(S.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),A(S,E))})}if(typeof(Symbol.iterator in m&&m[Symbol.iterator])=="function")return new w(v=>{if(v.signal.aborted)return;let A;try{A=a(m,!1)}catch(E){v.error(E);return}let S=!1,I=A;if(!v.signal.aborted)for(v.signal.addEventListener("abort",()=>{if(typeof I.return!="function"||S)return;let E=I.return();if(E===null||typeof E!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let E=I.next();if({done:S}=E,S){v.complete();return}if(v.next(E.value),v.signal.aborted)break}catch(E){v.error(E);break}});if(m instanceof Promise||typeof m.then=="function")return new w(v=>{m.then(A=>{v.next(A),v.complete()},A=>{v.error(A)})});throw new TypeError("Could not convert value to Observable")}subscribe(m=null,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");g(this,m,u)}takeUntil(m){if(!(this instanceof w))throw new TypeError("illegal invocation");let u=this,y=w.from(m);return new w(v=>{let A=new d({next(){v.complete()},error(){v.complete()}}),S={signal:v.signal};if(g(y,A,S),!v.active)return;let I=new d({next(E){v.next(E)},error(E){v.error(E)},complete(){v.complete()}});g(u,I,S)})}map(m){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=new d({next(I){let E;try{E=m(I,v)}catch(O){y.error(O);return}v+=1,y.next(E)},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}inspect(m={}){let u=null,y=null,v=null,A=null,S=null;typeof m=="function"?y=m:m&&typeof m=="object"&&("subscribe"in m&&(u=m.subscribe),"next"in m&&(y=m.next),"error"in m&&(v=m.error),"complete"in m&&(A=m.complete),"abort"in m&&(S=m.abort));let I=this;return new w(E=>{if(u!==null)try{u()}catch(L){E.error(L);return}let O=()=>{try{S!==null&&S(E.signal.reason)}catch(L){nn(L)}};E.signal.addEventListener("abort",O,{once:!0});let N=new d({next(L){if(y!==null)try{y(L)}catch(ae){E.signal.removeEventListener("abort",O),E.error(ae);return}E.next(L)},error(L){if(E.signal.removeEventListener("abort",O),v!==null)try{v(L)}catch(ae){E.error(ae);return}E.error(L)},complete(){if(E.signal.removeEventListener("abort",O),A!==null)try{A()}catch(L){E.error(L);return}E.complete()}}),V={signal:E.signal};g(I,N,V)})}filter(m){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=new d({next(I){let E=!1;try{E=m(I,v)}catch(O){y.error(O);return}v+=1,E&&y.next(I)},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}take(m){if(!(this instanceof w))throw new TypeError("illegal invocation");let u=this;return new w(y=>{let v=m;if(v==0)return y.complete();let A=new d({next(I){y.next(I),v-=1,v==0&&y.complete()},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}drop(m){if(!(this instanceof w))throw new TypeError("illegal invocation");let u=this;return new w(y=>{let v=m,A=new d({next(I){if(v>0)return v-=1;v==0&&y.next(I)},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}flatMap(m){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=!1,S=[];function I(V){let L;try{L=m(V,v)}catch(We){return y.error(We)}v+=1;let ae;try{ae=w.from(L)}catch(We){return y.error(We)}let Os=new d({next(We){y.next(We)},error(We){y.error(We)},complete(){if(S.length){let We=S.shift();I(We)}else E=!1,A&&y.complete()}}),Re={signal:y.signal};g(ae,Os,Re)}let E=!1,O=new d({next(V){E?S.push(V):(E=!0,I(V))},error(V){y.error(V)},complete(){A=!0,!E&&!S.length&&y.complete()}}),N={signal:y.signal};g(u,O,N)})}switchMap(m){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=!1,S=null;function I(N){let V;try{V=m(N,v)}catch(Re){return y.error(Re)}v+=1;let L;try{L=w.from(V)}catch(Re){return y.error(Re)}let ae=new d({next(Re){y.next(Re)},error(Re){y.error(Re)},complete(Re){A?y.complete():S=null}}),Os={signal:c([S.signal,y.signal])};g(L,ae,Os)}let E=new d({next(N){S&&S.abort(),S=new Ue,I(N)},error(N){y.error(N)},complete(){A=!0,S||y.complete()}}),O={signal:y.signal};g(u,E,O)})}catch(m){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(v=>{let A=new d({next(I){v.next(I)},error(I){let E;try{E=m(I)}catch(L){v.error(L);return}let O;try{O=w.from(E)}catch(L){v.error(L);return}let N=new d({next(L){v.next(L)},error(L){v.error(L)},complete(){v.complete()}}),V={signal:v.signal};g(O,N,V)},complete(){v.complete()}}),S={signal:v.signal};g(u,A,S)})}finally(m){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{y.addTeardown(m);let v=new d({next(S){y.next(S)},error(S){y.error(S)},complete(){y.complete()}}),A={signal:y.signal};g(u,v,A)})}toArray(m={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:u,resolve:y,reject:v}=t();if(m.signal){if(m.signal.aborted)return Promise.reject(m.signal.reason);m.signal.addEventListener("abort",()=>{v(m.signal.reason)})}let A=[],S=new d({next(I){A.push(I)},error(I){v(I)},complete(){y(A)}});return g(this,S,m),u}forEach(m,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=t(),S=new Ue,I={signal:c([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let E=0,O=new d({next(N){try{m(N,E)}catch(V){A(V),S.abort(V)}E+=1},error(N){A(N)},complete(){v()}});return g(this,O,I),y}every(m,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=t(),S=new Ue,I={signal:c([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let E=0,O=new d({next(N){let V=!1;try{V=m(N,E)}catch(L){A(L),S.abort(L)}E+=1,V||(v(!1),S.abort())},error(N){A(N)},complete(){v(!0)}});return g(this,O,I),y}first(m={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:u,resolve:y,reject:v}=t(),A=new Ue,S={signal:c([A.signal,m.signal])};if(S.signal.aborted)return v(S.signal.reason),u;S.signal.addEventListener("abort",()=>{v(S.signal.reason)});let I=new d({next(E){y(E),A.abort()},error(E){v(E)},complete(){v(new RangeError("No values in Observable"))}});return g(this,I,S),u}last(m={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:u,resolve:y,reject:v}=t();if(m.signal){if(m.signal.aborted)return v(m.signal.reason),u;m.signal.addEventListener("abort",()=>{v(m.signal.reason)})}let A=null,S=!1,I=new d({next(E){S=!0,A=E},error(E){v(E)},complete(){S?y(A):v(new RangeError("No values in Observable"))}});return g(this,I,m),u}find(m,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=t(),S=new Ue,I={signal:c([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let E=0,O=new d({next(N){let V=!1;try{V=m(N,E)}catch(L){A(L),S.abort(L)}E+=1,V&&(v(N),S.abort())},error(N){A(N)},complete(){v()}});return g(this,O,I),y}some(m,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=t(),S=new Ue,I={signal:c([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let E=0,O=new d({next(N){let V=!1;try{V=m(N,E)}catch(L){A(L),S.abort(L)}E+=1,V&&(v(!0),S.abort())},error(N){A(N)},complete(){v(!1)}});return g(this,O,I),y}reduce(m,u,y={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof m!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:A,reject:S}=t(),I=new Ue,E={signal:c([I.signal,y.signal])};if(E.signal.aborted)return S(E.signal.reason),v;E.signal.addEventListener("abort",()=>{S(E.signal.reason)},{once:!0});let O=0,N=arguments.length>1?u:_a,V=new d({next(L){if(N===_a){N=L,O++;return}try{let ae=m(N,L,O);O++,N=ae}catch(ae){S(ae),I.abort(ae);return}},error(L){S(L)},complete(){N!==_a?A(N):S(new TypeError("no initial value provided and no values emitted"))}});return g(this,V,E),v}}return n(w.prototype,"subscribe"),[w,f]})();function ud(){return typeof globalThis.Observable=="function"}function md(){Object.defineProperties(globalThis,{Observable:{value:pd,configurable:!0,writable:!0},Subscriber:{value:zp,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(n,e={}){if(Yt()&&!yt(document))return;let t=this;return new pd(r=>{if(!t||r.signal.aborted)return;let i=o=>{r.next(o)};t.addEventListener(n,i,{capture:e.capture||!1,passive:e.passive,once:!1,signal:r.signal})})}}function Ta(n,e,t){let r=n.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let o=i.getBoundingClientRect();if(e>=o.left&&e<=o.right&&t>=o.top&&t<=o.bottom)return i}return null}function fd(n,e,t,r){if(!r)return null;let i=n.filter(s=>!s.hasAttribute("disabled")),o=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(o.right<a.left||o.left>a.right||o.bottom<a.top||o.top>a.bottom))return s}return null}function gd(n,e,t,r){let i=n.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let o,s;if(r){let c=r.getBoundingClientRect();o=c.left+c.width/2,s=c.top+c.height/2}else o=e,s=t;let a=null,l=1/0;for(let c of i){let d=c.getBoundingClientRect(),h=d.left+d.width/2,g=d.top+d.height/2,f=Math.sqrt(Math.pow(o-h,2)+Math.pow(s-g,2));f<l&&(l=f,a=c)}return a}function bd(n,e,t,r){let i=n.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let o;if(r){let l=r.getBoundingClientRect();o=[{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 o=[{x:e,y:t},{x:e,y:t},{x:e,y:t},{x:e,y:t}];let s=null,a=1/0;for(let l of i){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,g=0;for(let w of o)for(let x of d){let m=Math.sqrt(Math.pow(w.x-x.x,2)+Math.pow(w.y-x.y,2));h+=m,g++}let f=h/g;f<a&&(a=f,s=l)}return s}function jp(n,e,t,r,i){let o=i&&i.length>0?n.filter(u=>i.includes(u)):n.filter(u=>u.tagName==="SLOT"&&u.hasAttribute("part")&&u.getAttribute("part")?.includes("drags")),a=n.filter(u=>!o.includes(u));if(o.length===0&&a.length===0)return null;let l;if(r){let u=r.getBoundingClientRect();l=[{x:u.left,y:u.top},{x:u.right,y:u.top},{x:u.left,y:u.bottom},{x:u.right,y:u.bottom}]}else l=[{x:e,y:t},{x:e,y:t},{x:e,y:t},{x:e,y:t}];let c=u=>{let y=u.getBoundingClientRect(),v=[{x:y.left,y:y.top},{x:y.right,y:y.top},{x:y.left,y:y.bottom},{x:y.right,y:y.bottom}],A=0,S=0;for(let I of l)for(let E of v){let O=Math.sqrt(Math.pow(I.x-E.x,2)+Math.pow(I.y-E.y,2));A+=O,S++}return A/S},d=null,h=1/0;for(let u of o){let y=c(u);y<h&&(h=y,d=u)}let g=null,f=1/0;for(let u of a){let y=c(u);y<f&&(f=y,g=u)}if(d&&r){let u=r.getBoundingClientRect(),y=d.getBoundingClientRect(),v=u.left+u.width/2,A=u.top+u.height/2;if(v>=y.left&&v<=y.right&&A>=y.top&&A<=y.bottom)return d}let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&g?h<=f*x?d:g:d||g}function yd(n){switch(n){case"pointerWithin":return Ta;case"rectangleIntersection":return fd;case"closestCenter":return gd;case"closestCorners":return bd;case"closestCornersWithInventoryPriority":return jp;default:return Ta}}function Ar(n,e,t,r,i="pointerWithin",o){return yd(i)(n,e,t,r,o)}function vt(n,e){let t=n.composedPath?n.composedPath():[n.target];for(let r of t)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(e)||r.hasAttribute("qti-draggable"))return r;let i=r.closest(e)||r.closest('[qti-draggable="true"]');if(i)return i}return null}function Pi(n){return n?n.hasAttribute("disabled")?!0:n.internals?.states?.has("disabled")??!1:!1}var Ra=n=>n?.internals;function Ae(n,e,t){let r=Ra(n)?.states;r&&(t?r.add(e):r.delete(e))}function sn(n,e){return Ra(n)?.states?.has(e)??!1}function Mi(n){Ae(n,"dragging",!1),Ae(n,"placeholder",!1),Ae(n,"return-anchor",!1)}function Kt(n){return sn(n,"dragging")||sn(n,"placeholder")}function tt(n,e,t){if(!n)return;t?n.setAttribute(e,""):n.removeAttribute(e);let r=Ra(n)?.states;if(r){t?r.add(e):r.delete(e);return}let i=new Set((n.getAttribute("part")??"").split(/\s+/).filter(Boolean));i.has("drop")&&(t?i.add(e):i.delete(e),n.setAttribute("part",[...i].join(" ")))}function Ir(n,e){tt(n,"filled",e)}function _r(n,e){let t=[];return n.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===e):i=Array.from(r.querySelectorAll(`[identifier="${e}"]`)),t.push(...i)}),t}function vd(n,e){let t=n.find(i=>i.getAttribute("identifier")===e);if(!t)return 1;let r=t.getAttribute("match-max");return r?parseInt(r,10)||0:1}var Oa={origin:{x:0,y:0},scale:{x:1,y:1}},an=100,Fp=n=>{let e=n.fullscreenElement??n.webkitFullscreenElement??null;for(;e instanceof HTMLElement;){let t=e.shadowRoot?.fullscreenElement??null;if(!t||t===e)break;e=t}return e instanceof HTMLElement?e:null},Bp=n=>{let e=n.shadowRoot;return e?e.querySelector("slot:not([name])")?n:e:n},Up=(n,e)=>{let t=e;for(;t;){if(t===n)return!0;t=t.parentNode??t.host??null}return!1},Pa=(n,e)=>{let t=n.ownerDocument??document,r=e??t.body,i=Fp(t);return i&&!Up(i,r)?Bp(i):r},Ma=n=>{let t=(n.ownerDocument??document).createElement("div");t.style.cssText=`position:fixed;left:0;top:0;width:${an}px;height:${an}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,n.appendChild(t);let r=t.getBoundingClientRect();return t.remove(),{origin:{x:r.left,y:r.top},scale:{x:r.width/an||1,y:r.height/an||1}}},wd=(n,e,t)=>({x:(e-n.origin.x)/n.scale.x,y:(t-n.origin.y)/n.scale.y});ud()||md();var xd=new WeakSet;function Hp(n){!n||xd.has(n)||(n.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),xd.add(n))}var qd=n=>!!n.internals?.states,ln=(n,e,t,r='slot[part="drags"]',i="pointerWithin")=>{class o extends n{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=Oa,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#e=new Set,this.#t=new Set,this.#r=a=>{let l=a;if(l.context!==dr)return;let c=l.contextTarget;c instanceof HTMLElement&&this.#t.add(c)}}#e;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?e:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#r,{capture:!0}),Hp(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#t.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,l){l.remove()}#t;#r;registeredMatching(a){for(let l of this.#t)l.isConnected||this.#t.delete(l);return[...this.#t].filter(l=>l.matches(a))}cacheInteractiveElements(){let a=(E,O)=>Array.from(O?.querySelectorAll(E)??[]),l=a(e,this),c=a(e,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot),g=this.registeredMatching(e);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...g]));let f=a(t,this),w=a(t,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...f,...w]));let x=a(r,this),m=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...m])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let u=this.isDragDropEnabled(),y=new Set(this.trackedDraggables),v=new Set(this.trackedDroppables),A=u?y:new Set,S=u?v:new Set,I=new Set([...y,...v].filter(qd));for(let E of this.#e)I.has(E)||(E.internals.states.delete("drag"),E.internals.states.delete("droppable"));for(let E of I){let O=A.has(E),N=!O&&S.has(E);O?E.internals.states.add("drag"):E.internals.states.delete("drag"),N?E.internals.states.add("droppable"):E.internals.states.delete("droppable")}this.#e=I,this.trackedDraggables.forEach(E=>{let O=Kt(E);u&&!O?(E.style.cursor="grab",E.style.userSelect="none",E.style.touchAction="none",E.style.webkitUserSelect="none",E.style.webkitTouchCallout="none",E.setAttribute("qti-draggable","true"),E.setAttribute("tabindex","0")):(E.style.cursor="",E.style.userSelect="",E.style.touchAction="",E.style.webkitUserSelect="",E.style.webkitTouchCallout="",E.removeAttribute("qti-draggable"),E.getAttribute("tabindex")==="0"&&E.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(f=>{if(!f.isTrusted)return!1;let w=vt(f,e),x=this.disabled||this.readonly,m=Pi(w)||Kt(w),u=Date.now()-this.lastTouchStartAt<50;return w&&f.isPrimary!==!1&&f.button===0&&!x&&!m&&!u}).subscribe(f=>{this.lastPointerDownAt=Date.now();let w=vt(f,e);if(!w){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}f.pointerType==="touch"&&(f.preventDefault(),f.stopPropagation());let x=f.isTrusted?f.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(w,f.clientX,f.clientY,f.pointerType,"pointer",f.pointerId,f.isTrusted);return}let m=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",m,!0),document.removeEventListener("pointercancel",m,!0)};document.addEventListener("pointerup",m,{once:!0,capture:!0}),document.addEventListener("pointercancel",m,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",m,!0),document.removeEventListener("pointercancel",m,!0),this.dragState.dragging||this.initiateDrag(w,f.clientX,f.clientY,f.pointerType,"pointer",f.pointerId,f.isTrusted)},x)}),c=a.when("mousedown").filter(f=>{let w=vt(f,e),x=this.disabled||this.readonly,m=Pi(w)||Kt(w),u=f.button===0,y=Date.now()-this.lastPointerDownAt<50;return w&&u&&!x&&!m&&!y}).subscribe(f=>{let w=vt(f,e);!w||this.dragState.dragging||(f.preventDefault(),this.initiateDrag(w,f.clientX,f.clientY,"mouse","mouse",void 0,f.isTrusted))}),d=a.when("touchstart").filter(f=>{let w=vt(f,e),x=this.disabled||this.readonly,m=Pi(w)||Kt(w),u=!!(f.touches?.[0]||f.changedTouches?.[0]),y=Date.now()-this.lastPointerDownAt<50;return w&&u&&!x&&!m&&!y}).subscribe(f=>{let w=vt(f,e),x=f.touches?.[0]||f.changedTouches?.[0];!w||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),f.preventDefault(),f.stopPropagation(),this.initiateDrag(w,x.clientX,x.clientY,"touch","touch",void 0,f.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},g=a.when("keydown").subscribe(f=>{let w=this.trackedDraggables.filter(m=>!Kt(m)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(f.code){case"ArrowRight":case"ArrowDown":{f.preventDefault();let m=(h.dropIndex+1)%x.length;h={...h,dropIndex:m,dropElement:x[m]};break}case"ArrowLeft":case"ArrowUp":{f.preventDefault();let m=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:m,dropElement:x[m]};break}case"Space":case"Enter":case"Tab":{f.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.trackedDraggables.forEach(m=>m.removeAttribute("data-keyboard-dragging")),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{f.preventDefault(),this.trackedDraggables.forEach(m=>m.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let m=vt(f,e),u=this.disabled||this.readonly,y=Pi(m)||Kt(m);m&&["Space","Enter"].includes(f.code)&&!u&&!y&&(f.preventDefault(),m.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:m,dragIndex:w.indexOf(m),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(m=>m.removeAttribute("hover")),h.dragging&&h.dropElement&&(h.dropElement.setAttribute("hover",""),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(l,c,d,g)}initiateDrag(a,l,c,d,h="pointer",g,f){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 w=y=>y.contains(a)||!!y.shadowRoot?.contains(a),x=this.trackedDroppables.some(w),m=this.trackedDroppables.find(w)||null;a.getAnimations().forEach(y=>y.cancel());let u=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,u),startOffset:{x:l-u.left,y:c-u.top},currentTarget:null,sourceDroppable:m,inputType:d,pointerId:g,startedFromTrustedEvent:f,initialCoordinates:{x:l,y:c},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(m,a),this.cacheInteractiveElements(),m&&m.setAttribute("data-drag-source","true");let y=a.getAttribute("identifier");if(y){let v=_r(this.trackedDragContainers,y);v.forEach(A=>Ae(A,"return-anchor",!0)),this.dragState.returnAnchorItems=v}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),Ae(a,"dragging",!0);this.updateClonePosition(l,c),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let v=this.dragState.dragSource,A=this.dragState.pointerId;v&&A!==void 0&&v.setPointerCapture&&v.setPointerCapture(A)}catch{}let u=v=>{v.cancelable&&(v.preventDefault(),l==="pointer"&&v.stopPropagation())};document.addEventListener("touchmove",u,{passive:!1,capture:!0}),document.addEventListener("touchstart",u,{passive:!1,capture:!0}),document.addEventListener("touchend",u,{passive:!1,capture:!0}),document.addEventListener("gesturestart",u,{passive:!1}),document.addEventListener("gesturechange",u,{passive:!1}),document.addEventListener("gestureend",u,{passive:!1});let y=()=>{if(document.removeEventListener("touchmove",u,{capture:!0}),document.removeEventListener("touchstart",u,{capture:!0}),document.removeEventListener("touchend",u,{capture:!0}),document.removeEventListener("gesturestart",u),document.removeEventListener("gesturechange",u),document.removeEventListener("gestureend",u),l==="pointer")try{let v=this.dragState.dragSource,A=this.dragState.pointerId;v&&A!==void 0&&v.releasePointerCapture&&v.releasePointerCapture(A)}catch{}};this.dragState.touchCleanup=y}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=u=>{let y=this.dragState.startedFromTrustedEvent;return y===void 0||u.isTrusted===y},g=document.when(c).takeUntil(document.when(d)).subscribe({next:u=>{if(h(u)){if(u.preventDefault(),u.stopPropagation(),l==="touch"){let y=u.touches?.[0]||u.changedTouches?.[0];if(!y)return;this.handleDragMove(y.clientX,y.clientY);return}if(l==="mouse"){let y=u;if(typeof y.buttons=="number"&&(y.buttons&1)!==1)return}this.handleDragMove(u.clientX,u.clientY)}}}),f=document.when(d).subscribe({next:u=>{h(u)&&(u.preventDefault(),u.stopPropagation(),this.handleDragEnd())}}),w=l==="touch"?document.when("touchcancel").subscribe({next:u=>{h(u)&&this.handleDragEnd()}}):l==="mouse"?null:document.when("pointercancel").subscribe({next:u=>{h(u)&&this.handleDragEnd()}}),x=document.when("keydown").filter(u=>u.key==="Escape").subscribe({next:u=>{h(u)&&this.handleDragEnd()}}),m=[g,f,x];w&&m.push(w),this.dragSubscriptions.push(...m)}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(f=>tt(f,"hover",!1)),c&&tt(c,"hover",!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 w=l.getBoundingClientRect();h=Ar(this.allDropzones,w.left+w.width/2,w.top+w.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),Ae(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(w=>{Ae(w,"return-anchor",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let f=this.checkAllMaxAssociations;typeof f=="function"&&f.call(this)}allowDrop(a,l){return this.trackedDroppables.includes(l)||this.trackedDragContainers.includes(l)}handleInvalidDrop(a){Mi(a)}createDragClone(a,l){let c=a.cloneNode(!0),d=window.getComputedStyle(a);for(let g=0;g<d.length;g++){let f=d[g];c.style.setProperty(f,d.getPropertyValue(f))}let h=Pa(a.isConnected?a:this,this.dragCloneRoot());return this.cloneFrame=Ma(h),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.style.opacity="0.8",c.removeAttribute("qti-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}=wd(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 g=d?.isConnected?d:this,f=Pa(g,this.dragCloneRoot());f!==c.parentNode&&(f.appendChild(c),this.cloneFrame=Ma(f),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(){this.setInternalsState("dragzone-enabled",!0),this.setInternalsState("dragzone-active",!0),this.allDropzones.forEach(a=>{tt(a,"enabled",!0),tt(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{tt(a,"enabled",!1),tt(a,"active",!1),tt(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{Ae(a,"return-anchor",!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=Oa,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.#e)qd(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#e.clear(),this.resetDragState()}}return o};var Cd={duration:250,easing:"ease",fill:"both"};function Da(n){let e=n.getBoundingClientRect();return{left:e.left,top:e.top,width:e.width,height:e.height}}function Ed(n){return{left:n.left,top:n.top,width:n.width,height:n.height}}function wt(n){let e=new Map;return n.forEach(t=>{e.set(t,Da(t))}),e}function kd(n,e){return{deltaX:n.left-e.left,deltaY:n.top-e.top,deltaW:n.width/e.width,deltaH:n.height/e.height}}function cn(n){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!n)return 1;let e=getComputedStyle(n).getPropertyValue("--qti-motion").trim();if(e==="")return 1;let t=Number.parseFloat(e);return Number.isFinite(t)&&t>0?t:0}function Na(n){return cn(n)>0}function dn(n,e,t={}){let r=cn(n);if(r<=0)return null;let i=Da(n),{deltaX:o,deltaY:s,deltaW:a,deltaH:l}=kd(e,i);if(o===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...Cd,...t};return n.animate([{transformOrigin:"top left",transform:`translate(${o}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*r,easing:d,fill:h})}function xt(n,e={}){let t=new Map;return n.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let o=dn(i,r,e);o&&t.set(i,o)}),t}var Di=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ie=(n,e,t,r='slot[part="drags"]',i="closestCornersWithInventoryPriority")=>{let o=Aa(n,e,t,r),s=ln(o,e,t,r,i);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this._maxAssociations=0,this._maxAssociationsDefaultApplied=!1,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#e=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}get maxAssociations(){if(!this._maxAssociationsDefaultApplied){this._maxAssociationsDefaultApplied=!0;let c=this.tagName?.toLowerCase()||"";(c==="qti-graphic-gap-match-interaction"||c==="qti-gap-match-interaction")&&!this.hasAttribute("max-associations")&&this._maxAssociations===0&&(this._maxAssociations=1)}return this._maxAssociations}set maxAssociations(c){let d=this._maxAssociations;this._maxAssociations=c,this.requestUpdate("maxAssociations",d)}#e;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.#e.get(c)??[]]:Array.from(c.querySelectorAll(e))}droppableHolding(c){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(c)||d.contains(c)||!!d.shadowRoot?.contains(c))??null}placeChip(c,d){this.#e.set(c,[...this.#e.get(c)??[],d])}removeChipFromDroppable(c,d){let h=c??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let g=(this.#e.get(h)??[]).filter(f=>f!==d);this.#e.set(h,g),g.length===0&&Ir(h,!1),this.syncDragDropState();return}d.remove()}clearChips(c){this.isDeclarativeTarget(c)?(this.#e.set(c,[]),this.syncDragDropState()):this.chipsIn(c).forEach(d=>d.remove()),Ir(c,!1)}syncDragDropState(){let c={},d={},h={};for(let g of this.trackedDroppables){let f=g.getAttribute("identifier");if(!f)continue;let w=this.chipsIn(g),x=this.isDeclarativeTarget(g)?w:Array.from(g.querySelectorAll('[qti-draggable="true"]'));c[f]=w.map(m=>m.getAttribute("identifier")).filter(m=>!!m),d[f]=Math.max(w.length,x.length),h[f]=w}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(g=>`${g} ${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 g=c.getAttribute("identifier");return(g?this._dragDrop.countByTarget[g]??0:0)>=h}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Na(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,g=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),g.forEach(x=>this.placeResponse(x));let f=this.getResponse,w=typeof f=="function"?f.call(this):void 0;this._response=Array.isArray(w)?w:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response))}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 g=this.getAttribute(h);if(g&&g.trim().length>0)return g}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),g=d.hasAttribute("disabled"),f=d.hasAttribute("data-drag-source");return g&&this.isSwapTarget(d)?!0:h&&(!g||f)}handleDrop(c,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,d,h);let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.validate(),this.reportValidity()}handleInvalidDrop(c){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,g=!h,f=this.trackedDragContainers[0]||null;if(!c)return;if(d&&g&&f)this.dropDraggableInDroppable(c,f);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(c,d,this.dragState.dragClone?.getBoundingClientRect());else if(sn(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let u=c.getAttribute("identifier");u&&this.updateInventoryBasedOnMatchMax(u),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let w=this.totalAssociationsFromState(),x=this.maxAssociations>0&&w>=this.maxAssociations,m=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=m&&x,this.validate(),this.reportValidity()}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{dn(c,Ed(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){Mi(c),c.style.display="",c.style.position="",this.animateReturn(c,d)}placeResponse(c){let[d,...h]=c.split(" ").reverse(),g=this.trackedDroppables.find(f=>f.getAttribute("identifier")===d);g&&h.forEach(f=>{if(!f)return;let x=_r(this.trackedDragContainers,f).at(0)||this.trackedDraggables.find(m=>m.getAttribute("identifier")===f);x&&this.dropDraggableInDroppable(x,g)})}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 A=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),A&&this.restoreOriginalInInventory(A,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let f=parseInt(d.getAttribute("match-max")||"1",10),w=Number.isNaN(f)?1:f,x=w===0||w>1,m=Array.from(d.querySelectorAll('[qti-draggable="true"]')),u=this.enableFlipAnimations&&m.length>0?wt(m):null;if(!x){let A=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(A){let S=A.getAttribute("identifier"),I=A.getBoundingClientRect();this.removeChipFromDroppable(d,A);let E=this.dragState.sourceDroppable,O=this.isDeclarativeTarget(d)&&E&&E!==d&&this.isDeclarativeTarget(E)?E:null;O?(this.placeChip(O,A),Ir(O,!0),this.animateReturn(A,I)):S&&this.restoreOriginalInInventory(S,I)}}let y=c.cloneNode(!0);y.removeAttribute("style"),y.removeAttribute("data-keyboard-dragging"),y.setAttribute("qti-draggable","true"),y.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(y.setAttribute("part","drag"),y.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,y)):d.tagName==="SLOT"?y.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&y.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(y)),Ir(d,!0),this.syncDragDropState(),u&&this.enableFlipAnimations&&xt(u,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let A=y.getBoundingClientRect(),S=h.left-A.left,I=h.top-A.top;(S!==0||I!==0)&&y.animate([{transform:`translate(${S}px, ${I}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let v=c.getAttribute("identifier");v&&this.updateInventoryBasedOnMatchMax(v),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(g=>{let f=this.chipsIn(g).filter(w=>w.getAttribute("identifier")===h);f.forEach(w=>this.removeChipFromDroppable(g,w)),f.length>0&&this.chipsIn(g).length===0&&Ir(g,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=_r(this.trackedDragContainers,c),g=new Set(h),f=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[qti-draggable="true"]').forEach(m=>!g.has(m)&&f.push(m))});let w=this.enableFlipAnimations&&f.length>0?wt(f):null;h.forEach(x=>{Mi(x),x.style.display="",x.style.visibility="visible"}),w&&this.enableFlipAnimations&&xt(w,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=_r(this.trackedDragContainers,c),h=vd(this.trackedDraggables,c),g=this.trackedDroppables.reduce((f,w)=>this.isDeclarativeTarget(w)?f+this.chipsIn(w).filter(x=>x.getAttribute("identifier")===c).length:f+w.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(f=>{Ae(f,"placeholder",h!==0&&g>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(g=>{let f=g.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(g)||d&&h)&&!f?g.setAttribute("disabled",""):g.removeAttribute("disabled")})}saveResponse(c){let d=this.getResponse,h=c??(typeof d=="function"?d.call(this):void 0),g=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=g,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:g}})),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._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,g=this.minAssociations>0&&c<this.minAssociations,f="",w=!0;h?(f=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}.`,w=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(f=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}.`,w=!1):g?(f=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"}.`,w=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(w,f,x,{suppressInline:!0}),w}reportValidity(){return super.reportValidity()}}return Di([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),Di([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),Di([B({context:gt})],a.prototype,"_dragDrop",void 0),Di([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),Di([p({attribute:"response",reflect:!1,noAccessor:!0,converter:$e({emptyAs:[]})})],a.prototype,"response",null),a};var hn=class{getInsertPosition(e,t,r,i,o){let s=e.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),l=(o-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var Sd=new hn;var Wp={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function Ni(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function pn(n){n.placeholder?.remove(),n.placeholder=null,n.lastHoverTarget=null,n.lastPlacement=null,n.sortContainer=null}function un(n,e,t={}){let r={...Wp,...t},i=document.createElement("div");return i.setAttribute("data-drop-placeholder","true"),i.style.width=`${e.width}px`,i.style.height=`${e.height}px`,i.style.margin=window.getComputedStyle(n).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(n).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*cn(n)}ms ease`,i.style.pointerEvents="none",i}function $a(n,e){for(let t of e)if(t.contains(n)&&t!==n)return t;return null}var _e=(n,e='[qti-draggable="true"]')=>{class t extends n{constructor(){super(...arguments),this.#e=null,this.#t=null,this.#r=Ni(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#n=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#e;#t;#r;#i;#n;#o;set allowReorder(i){this.#o=i}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#e!==null}findContainingDroppable(i){return $a(i,this.trackedDroppables)}#s(i){return i.querySelector(e)}#a(i){let o=this.#l(i);return o===0||o>1}#l(i){let o=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(o)?1:o}#h(i){return i.querySelectorAll(e).length}#c(i){let o=this.#l(i);return o===0?!1:this.#h(i)>=o}#u(){this.#i={hoveredSlot:null,originalPositions:new Map}}#d(i){if(!this.#e||i===this.#e){this.#p();return}if(this.#i.hoveredSlot===i)return;this.#p();let o=this.#s(i);if(!o){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#c(i)){this.#r.placeholder&&this.#e&&this.#e.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=wt([o]);this.#i.originalPositions.set(o,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#e.appendChild(o),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,xt(a,this.sortableAnimationConfig)}#p(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),o=i.length>0?wt(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#e&&this.#e.appendChild(this.#r.placeholder),o&&xt(o,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,o,s,a,...l){this.#e=null,this.#r=Ni(),this.#u();let c=this.findContainingDroppable(i);if(this.#t=c,c&&this.allowReorder){this.#e=c,this.#r.sortContainer=c;let h=i.getBoundingClientRect();this.#r.placeholder=un(i,h,this.sortablePlaceholderConfig);let g=i.getAttribute("slot");g&&this.#r.placeholder.setAttribute("slot",g),this.#r.placeholder.style.visibility="hidden",c.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(f=>{if(f!==c&&f.hasAttribute("disabled")){if(this.#a(f)&&this.#c(f))return;f.removeAttribute("disabled"),this.#n.add(f)}})}let[d]=l;super.initiateDrag(i,o,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[o,s]of this.#i.originalPositions)s.appendChild(o);this.#r.placeholder&&this.#r.placeholder.remove(),pn(this.#r),this.#n.clear(),this.#e=null,this.#u()}onSortableDragMove(i,o){if(!this.isDraggingFromSlot)return;let s=Ar(this.trackedDroppables,i,o,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#p()}handleDragMove(i,o){Object.getPrototypeOf(t.prototype).handleDragMove?.call(this,i,o),this.onSortableDragMove(i,o)}allowDrop(i,o){return!this.allowReorder&&this.#t&&!this.trackedDragContainers.includes(this.#t)&&o!==this.#t&&this.trackedDroppables.includes(o)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(o)?this.#a(o)?!this.#c(o):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(o)?!0:super.allowDrop(i,o)}handleDrop(i,o){super.handleDrop(i,o),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return t};var Ad=[R,U,Ne,q`
6921
+ <slot part="label"></slot>`}};on([p({type:String,attribute:"template-identifier"})],Ae.prototype,"templateIdentifier",void 0);on([p({type:String,attribute:"show-hide"})],Ae.prototype,"showHide",void 0);on([p({type:Boolean,converter:{fromAttribute:n=>n==="true",toAttribute:n=>String(n)}})],Ae.prototype,"fixed",void 0);on([p({type:String,attribute:!1})],Ae.prototype,"marker",void 0);var cd=[{tag:"qti-simple-choice",ctor:Ae}];var dd=[...Uc,...Wc,...Gc,...Kc,...Zc,...td,...id,...nd,...ad,...cd];var Np=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o};function $p(n,e,t,r,i={}){let o=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!e.length||!t.length||!s)return;let a=0,l=0,c=r.length?r:[n],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")),e.forEach(h=>{let g=h.getBoundingClientRect();a=Math.max(a,g.height),l=Math.max(l,g.width)}),d.forEach(({el:h,reservation:g,hadStyleAttribute:m})=>{g?h.style.setProperty("--qti-drag-min-width",g):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:l})!==!1&&(n.style.setProperty("--qti-dropzone-min-height",`${a}px`),o&&(n.style.setProperty("--qti-dropzone-min-width",`${l}px`),n.style.setProperty("--qti-drag-min-width",`${l}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),o&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var Aa=(n,e,t,r='slot[part="drags"]')=>{class i extends n{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#e=null,this.#t=new Set,this.#r=null,this.#i=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#e;#t;#r;#i;#n;collectAutoSizeTargets(){let s=(a,l)=>Array.from(l?.querySelectorAll(a)??[]);return{draggables:[...s(e,this),...s(e,this.shadowRoot)],droppables:[...s(t,this),...s(t,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&($p(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.#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.#e??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let l of this.#t)a.has(l)||this.#e.unobserve(l);for(let l of a)this.#t.has(l)||this.#e.observe(l);this.#t=a}disconnectedCallback(){this.#e?.disconnect(),this.#e=null,this.#t.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return Np([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Ue,AbortSignal:Ia,WeakMap:Lp,WeakRef:Vp,Window:hd,reportError:nn=console.log}=globalThis,vt=n=>n&&n.defaultView!==null&&n.defaultView.document===n&&(n.defaultView.top===n.defaultView||vt(n.defaultView.parent.document)),Kt=()=>!!hd&&globalThis instanceof hd,_a=Symbol("unset"),[pd,zp]=(()=>{function n(x,f,u=!0){Object.defineProperty(x,f,{...Object.getOwnPropertyDescriptor(x,f),enumerable:u})}let e="try"in Promise?Promise.try.bind(Promise):(x,...f)=>new Promise(u=>u(x(...f))),t="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,f;return{promise:new Promise((y,v)=>(x=y,f=v)),resolve:x,reject:f}};function r(x,f){let u=f.call(x);if(u===null||typeof u!="object")throw new TypeError("Iterator is not an object");return u}let i=new Lp,o={next(...x){let f=this,u=i.get(f);if(!u?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:y}=u;return e(()=>y.next(...x))},return(...x){let f=this,u=i.get(f);if(!u?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:y}=u;return e(()=>y.return?y.return(...x):{value:void 0,done:!0})},throw(...x){let f=this,u=i.get(f);if(!u?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:y}=u;return e(()=>{if(!y.throw)throw y.return(),new TypeError("no throw method");return y.throw(...x)})}};function s(x){let f=Object.create(o);return i.set(f,{syncIteratorRecord:x}),f}function a(x,f){let u;if(f){if(u=x[Symbol.asyncIterator],u==null){if(u=x[Symbol.iterator],u==null)throw new TypeError("Object is not async iterable");let y=r(x,u);return s(y)}}else u=x[Symbol.iterator];if(u==null)throw new TypeError("Object is not iterable");return r(x,u)}let l="any"in Ia?Ia.any.bind(Ia):x=>{let f=new Ue;for(let u of x)if(u.aborted)return f.abort(u.reason),f.signal;for(let u of x)u.addEventListener("abort",()=>{f.abort(u.reason)},{signal:f.signal});return f.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:f,error:u,complete:y}={}){i.set(this,{next:f,error:u,complete:y})}next(f){let{next:u}=i.get(this)||{};u&&u(f)}error(f){let{error:u}=i.get(this)||{};u?u(f):nn(f)}complete(){let{complete:f}=i.get(this)||{};f&&f()}}function h(x,f){let u=i.get(x);if(u?.active){u.active=!1,u.subscriptionController.abort(f);for(let y of u.teardowns.reverse()){if(Kt()&&!vt(document))return;try{y()}catch(v){nn(v)}}}}function g(x,f,u={}){if(Kt()&&!vt(document))return;let y;typeof f=="function"?y=new d({next:f}):f&&!(f instanceof d)?y=new d(f):y=f||new d;let v=i.get(x),A=v.weakSubscriber?.deref();if(A?.active){let I=A,E=i.get(I);E.observers.add(y),u.signal&&(u.signal.aborted?E.observers.delete(y):u.signal.addEventListener("abort",()=>{let O=i.get(I);O?.active&&(O.observers.delete(y),O.observers.size==0&&h(I,u.signal.reason))}));return}let S=new m(y);if(v.weakSubscriber=new Vp(S),"signal"in u&&(u.signal.aborted?h(S,u.signal.reason):u.signal.addEventListener("abort",()=>{let I=i.get(S);I?.active&&(I.observers.delete(y),I.observers.size==0&&h(S,u.signal.reason))})),v.subscribeCallback)try{v.subscribeCallback(S)}catch(I){S.error(I)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(f=null){if(!(f instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([f]),teardowns:[],subscriptionController:new Ue})}next(f){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let u=i.get(this);if(!u?.active||Kt()&&!vt(document))return;let y=new Set(u.observers);for(let v of y)v.next(f)}error(f){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let u=i.get(this);if(!u?.active){nn(f);return}if(Kt()&&!vt(document))return;h(this,f);let y=new Set(u.observers);for(let v of y)v.error(f)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let f=i.get(this);if(!f?.active||Kt()&&!vt(document))return;h(this);let u=new Set(f.observers);for(let y of u)y.complete()}addTeardown(f){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(Kt()&&!vt(document))return;let u=i.get(this);u?.active?u.teardowns.push(f):f()}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 f=new Ue;return f.abort(),f.signal}return i.get(this).subscriptionController.signal}}n(m.prototype,"next"),n(m.prototype,"error"),n(m.prototype,"complete"),n(m.prototype,"addTeardown"),n(m.prototype,"active"),n(m.prototype,"signal");class w{get[Symbol.toStringTag](){return"Observable"}constructor(f){if(!f)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:f})}static from(f){if(f===null||typeof f!="object")throw new TypeError("Observable.from only accepts objects");if(f instanceof w)return f;if(typeof(Symbol.asyncIterator in f&&f[Symbol.asyncIterator])=="function"){let A=function(S,I){if(S.signal.aborted)return;let E;try{let O=I.next();E=Promise.resolve(O)}catch(O){E=Promise.reject(O)}E.then(O=>{if(O===null||typeof O!="object"){S.error(new TypeError("Not an IteratorResult."));return}try{({done:v}=O)}catch(V){S.error(V);return}if(v){S.complete();return}let N;try{N=O.value}catch(V){S.error(V);return}S.next(N),A(S,I)},O=>{S.error(O)})},v=!1;return new w(S=>{if(S.signal.aborted)return;let I;try{I=a(f,!0)}catch(O){S.error(O);return}let E=I;S.signal.aborted||(S.signal.addEventListener("abort",()=>{if(typeof E.return!="function"||v)return;e(()=>E.return(S.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),A(S,E))})}if(typeof(Symbol.iterator in f&&f[Symbol.iterator])=="function")return new w(v=>{if(v.signal.aborted)return;let A;try{A=a(f,!1)}catch(E){v.error(E);return}let S=!1,I=A;if(!v.signal.aborted)for(v.signal.addEventListener("abort",()=>{if(typeof I.return!="function"||S)return;let E=I.return();if(E===null||typeof E!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let E=I.next();if({done:S}=E,S){v.complete();return}if(v.next(E.value),v.signal.aborted)break}catch(E){v.error(E);break}});if(f instanceof Promise||typeof f.then=="function")return new w(v=>{f.then(A=>{v.next(A),v.complete()},A=>{v.error(A)})});throw new TypeError("Could not convert value to Observable")}subscribe(f=null,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");g(this,f,u)}takeUntil(f){if(!(this instanceof w))throw new TypeError("illegal invocation");let u=this,y=w.from(f);return new w(v=>{let A=new d({next(){v.complete()},error(){v.complete()}}),S={signal:v.signal};if(g(y,A,S),!v.active)return;let I=new d({next(E){v.next(E)},error(E){v.error(E)},complete(){v.complete()}});g(u,I,S)})}map(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=new d({next(I){let E;try{E=f(I,v)}catch(O){y.error(O);return}v+=1,y.next(E)},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}inspect(f={}){let u=null,y=null,v=null,A=null,S=null;typeof f=="function"?y=f:f&&typeof f=="object"&&("subscribe"in f&&(u=f.subscribe),"next"in f&&(y=f.next),"error"in f&&(v=f.error),"complete"in f&&(A=f.complete),"abort"in f&&(S=f.abort));let I=this;return new w(E=>{if(u!==null)try{u()}catch(L){E.error(L);return}let O=()=>{try{S!==null&&S(E.signal.reason)}catch(L){nn(L)}};E.signal.addEventListener("abort",O,{once:!0});let N=new d({next(L){if(y!==null)try{y(L)}catch(ae){E.signal.removeEventListener("abort",O),E.error(ae);return}E.next(L)},error(L){if(E.signal.removeEventListener("abort",O),v!==null)try{v(L)}catch(ae){E.error(ae);return}E.error(L)},complete(){if(E.signal.removeEventListener("abort",O),A!==null)try{A()}catch(L){E.error(L);return}E.complete()}}),V={signal:E.signal};g(I,N,V)})}filter(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=new d({next(I){let E=!1;try{E=f(I,v)}catch(O){y.error(O);return}v+=1,E&&y.next(I)},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}take(f){if(!(this instanceof w))throw new TypeError("illegal invocation");let u=this;return new w(y=>{let v=f;if(v==0)return y.complete();let A=new d({next(I){y.next(I),v-=1,v==0&&y.complete()},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}drop(f){if(!(this instanceof w))throw new TypeError("illegal invocation");let u=this;return new w(y=>{let v=f,A=new d({next(I){if(v>0)return v-=1;v==0&&y.next(I)},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}flatMap(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=!1,S=[];function I(V){let L;try{L=f(V,v)}catch(We){return y.error(We)}v+=1;let ae;try{ae=w.from(L)}catch(We){return y.error(We)}let Os=new d({next(We){y.next(We)},error(We){y.error(We)},complete(){if(S.length){let We=S.shift();I(We)}else E=!1,A&&y.complete()}}),Oe={signal:y.signal};g(ae,Os,Oe)}let E=!1,O=new d({next(V){E?S.push(V):(E=!0,I(V))},error(V){y.error(V)},complete(){A=!0,!E&&!S.length&&y.complete()}}),N={signal:y.signal};g(u,O,N)})}switchMap(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=!1,S=null;function I(N){let V;try{V=f(N,v)}catch(Oe){return y.error(Oe)}v+=1;let L;try{L=w.from(V)}catch(Oe){return y.error(Oe)}let ae=new d({next(Oe){y.next(Oe)},error(Oe){y.error(Oe)},complete(Oe){A?y.complete():S=null}}),Os={signal:c([S.signal,y.signal])};g(L,ae,Os)}let E=new d({next(N){S&&S.abort(),S=new Ue,I(N)},error(N){y.error(N)},complete(){A=!0,S||y.complete()}}),O={signal:y.signal};g(u,E,O)})}catch(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(v=>{let A=new d({next(I){v.next(I)},error(I){let E;try{E=f(I)}catch(L){v.error(L);return}let O;try{O=w.from(E)}catch(L){v.error(L);return}let N=new d({next(L){v.next(L)},error(L){v.error(L)},complete(){v.complete()}}),V={signal:v.signal};g(O,N,V)},complete(){v.complete()}}),S={signal:v.signal};g(u,A,S)})}finally(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{y.addTeardown(f);let v=new d({next(S){y.next(S)},error(S){y.error(S)},complete(){y.complete()}}),A={signal:y.signal};g(u,v,A)})}toArray(f={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:u,resolve:y,reject:v}=t();if(f.signal){if(f.signal.aborted)return Promise.reject(f.signal.reason);f.signal.addEventListener("abort",()=>{v(f.signal.reason)})}let A=[],S=new d({next(I){A.push(I)},error(I){v(I)},complete(){y(A)}});return g(this,S,f),u}forEach(f,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=t(),S=new Ue,I={signal:c([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let E=0,O=new d({next(N){try{f(N,E)}catch(V){A(V),S.abort(V)}E+=1},error(N){A(N)},complete(){v()}});return g(this,O,I),y}every(f,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=t(),S=new Ue,I={signal:c([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let E=0,O=new d({next(N){let V=!1;try{V=f(N,E)}catch(L){A(L),S.abort(L)}E+=1,V||(v(!1),S.abort())},error(N){A(N)},complete(){v(!0)}});return g(this,O,I),y}first(f={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:u,resolve:y,reject:v}=t(),A=new Ue,S={signal:c([A.signal,f.signal])};if(S.signal.aborted)return v(S.signal.reason),u;S.signal.addEventListener("abort",()=>{v(S.signal.reason)});let I=new d({next(E){y(E),A.abort()},error(E){v(E)},complete(){v(new RangeError("No values in Observable"))}});return g(this,I,S),u}last(f={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:u,resolve:y,reject:v}=t();if(f.signal){if(f.signal.aborted)return v(f.signal.reason),u;f.signal.addEventListener("abort",()=>{v(f.signal.reason)})}let A=null,S=!1,I=new d({next(E){S=!0,A=E},error(E){v(E)},complete(){S?y(A):v(new RangeError("No values in Observable"))}});return g(this,I,f),u}find(f,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=t(),S=new Ue,I={signal:c([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let E=0,O=new d({next(N){let V=!1;try{V=f(N,E)}catch(L){A(L),S.abort(L)}E+=1,V&&(v(N),S.abort())},error(N){A(N)},complete(){v()}});return g(this,O,I),y}some(f,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=t(),S=new Ue,I={signal:c([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let E=0,O=new d({next(N){let V=!1;try{V=f(N,E)}catch(L){A(L),S.abort(L)}E+=1,V&&(v(!0),S.abort())},error(N){A(N)},complete(){v(!1)}});return g(this,O,I),y}reduce(f,u,y={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:A,reject:S}=t(),I=new Ue,E={signal:c([I.signal,y.signal])};if(E.signal.aborted)return S(E.signal.reason),v;E.signal.addEventListener("abort",()=>{S(E.signal.reason)},{once:!0});let O=0,N=arguments.length>1?u:_a,V=new d({next(L){if(N===_a){N=L,O++;return}try{let ae=f(N,L,O);O++,N=ae}catch(ae){S(ae),I.abort(ae);return}},error(L){S(L)},complete(){N!==_a?A(N):S(new TypeError("no initial value provided and no values emitted"))}});return g(this,V,E),v}}return n(w.prototype,"subscribe"),[w,m]})();function ud(){return typeof globalThis.Observable=="function"}function md(){Object.defineProperties(globalThis,{Observable:{value:pd,configurable:!0,writable:!0},Subscriber:{value:zp,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(n,e={}){if(Kt()&&!vt(document))return;let t=this;return new pd(r=>{if(!t||r.signal.aborted)return;let i=o=>{r.next(o)};t.addEventListener(n,i,{capture:e.capture||!1,passive:e.passive,once:!1,signal:r.signal})})}}function Ta(n,e,t){let r=n.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let o=i.getBoundingClientRect();if(e>=o.left&&e<=o.right&&t>=o.top&&t<=o.bottom)return i}return null}function fd(n,e,t,r){if(!r)return null;let i=n.filter(s=>!s.hasAttribute("disabled")),o=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(o.right<a.left||o.left>a.right||o.bottom<a.top||o.top>a.bottom))return s}return null}function gd(n,e,t,r){let i=n.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let o,s;if(r){let c=r.getBoundingClientRect();o=c.left+c.width/2,s=c.top+c.height/2}else o=e,s=t;let a=null,l=1/0;for(let c of i){let d=c.getBoundingClientRect(),h=d.left+d.width/2,g=d.top+d.height/2,m=Math.sqrt(Math.pow(o-h,2)+Math.pow(s-g,2));m<l&&(l=m,a=c)}return a}function bd(n,e,t,r){let i=n.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let o;if(r){let l=r.getBoundingClientRect();o=[{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 o=[{x:e,y:t},{x:e,y:t},{x:e,y:t},{x:e,y:t}];let s=null,a=1/0;for(let l of i){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,g=0;for(let w of o)for(let x of d){let f=Math.sqrt(Math.pow(w.x-x.x,2)+Math.pow(w.y-x.y,2));h+=f,g++}let m=h/g;m<a&&(a=m,s=l)}return s}function jp(n,e,t,r,i){let o=i&&i.length>0?n.filter(u=>i.includes(u)):n.filter(u=>u.tagName==="SLOT"&&u.hasAttribute("part")&&u.getAttribute("part")?.includes("drags")),a=n.filter(u=>!o.includes(u));if(o.length===0&&a.length===0)return null;let l;if(r){let u=r.getBoundingClientRect();l=[{x:u.left,y:u.top},{x:u.right,y:u.top},{x:u.left,y:u.bottom},{x:u.right,y:u.bottom}]}else l=[{x:e,y:t},{x:e,y:t},{x:e,y:t},{x:e,y:t}];let c=u=>{let y=u.getBoundingClientRect(),v=[{x:y.left,y:y.top},{x:y.right,y:y.top},{x:y.left,y:y.bottom},{x:y.right,y:y.bottom}],A=0,S=0;for(let I of l)for(let E of v){let O=Math.sqrt(Math.pow(I.x-E.x,2)+Math.pow(I.y-E.y,2));A+=O,S++}return A/S},d=null,h=1/0;for(let u of o){let y=c(u);y<h&&(h=y,d=u)}let g=null,m=1/0;for(let u of a){let y=c(u);y<m&&(m=y,g=u)}if(d&&r){let u=r.getBoundingClientRect(),y=d.getBoundingClientRect(),v=u.left+u.width/2,A=u.top+u.height/2;if(v>=y.left&&v<=y.right&&A>=y.top&&A<=y.bottom)return d}let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&g?h<=m*x?d:g:d||g}function yd(n){switch(n){case"pointerWithin":return Ta;case"rectangleIntersection":return fd;case"closestCenter":return gd;case"closestCorners":return bd;case"closestCornersWithInventoryPriority":return jp;default:return Ta}}function Ar(n,e,t,r,i="pointerWithin",o){return yd(i)(n,e,t,r,o)}function wt(n,e){let t=n.composedPath?n.composedPath():[n.target];for(let r of t)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(e)||r.hasAttribute("qti-draggable"))return r;let i=r.closest(e)||r.closest('[qti-draggable="true"]');if(i)return i}return null}function Pi(n){return n?n.hasAttribute("disabled")?!0:n.internals?.states?.has("disabled")??!1:!1}var Ra=n=>n?.internals;function Ie(n,e,t){let r=Ra(n)?.states;r&&(t?r.add(e):r.delete(e))}function sn(n,e){return Ra(n)?.states?.has(e)??!1}function Mi(n){Ie(n,"dragging",!1),Ie(n,"placeholder",!1),Ie(n,"return-anchor",!1)}function Jt(n){return sn(n,"dragging")||sn(n,"placeholder")}function tt(n,e,t){if(!n)return;t?n.setAttribute(e,""):n.removeAttribute(e);let r=Ra(n)?.states;if(r){t?r.add(e):r.delete(e);return}let i=new Set((n.getAttribute("part")??"").split(/\s+/).filter(Boolean));i.has("drop")&&(t?i.add(e):i.delete(e),n.setAttribute("part",[...i].join(" ")))}function Ir(n,e){tt(n,"filled",e)}function _r(n,e){let t=[];return n.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===e):i=Array.from(r.querySelectorAll(`[identifier="${e}"]`)),t.push(...i)}),t}function vd(n,e){let t=n.find(i=>i.getAttribute("identifier")===e);if(!t)return 1;let r=t.getAttribute("match-max");return r?parseInt(r,10)||0:1}var Oa={origin:{x:0,y:0},scale:{x:1,y:1}},an=100,Fp=n=>{let e=n.fullscreenElement??n.webkitFullscreenElement??null;for(;e instanceof HTMLElement;){let t=e.shadowRoot?.fullscreenElement??null;if(!t||t===e)break;e=t}return e instanceof HTMLElement?e:null},Bp=n=>{let e=n.shadowRoot;return e?e.querySelector("slot:not([name])")?n:e:n},Up=(n,e)=>{let t=e;for(;t;){if(t===n)return!0;t=t.parentNode??t.host??null}return!1},Pa=(n,e)=>{let t=n.ownerDocument??document,r=e??t.body,i=Fp(t);return i&&!Up(i,r)?Bp(i):r},Ma=n=>{let t=(n.ownerDocument??document).createElement("div");t.style.cssText=`position:fixed;left:0;top:0;width:${an}px;height:${an}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,n.appendChild(t);let r=t.getBoundingClientRect();return t.remove(),{origin:{x:r.left,y:r.top},scale:{x:r.width/an||1,y:r.height/an||1}}},wd=(n,e,t)=>({x:(e-n.origin.x)/n.scale.x,y:(t-n.origin.y)/n.scale.y});ud()||md();var xd=new WeakSet;function Hp(n){!n||xd.has(n)||(n.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),xd.add(n))}var qd=n=>!!n.internals?.states,ln=(n,e,t,r='slot[part="drags"]',i="pointerWithin")=>{class o extends n{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=Oa,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#e=new Set,this.#t=new Set,this.#r=a=>{let l=a;if(l.context!==hr)return;let c=l.contextTarget;c instanceof HTMLElement&&this.#t.add(c)}}#e;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?e:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#r,{capture:!0}),Hp(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#t.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,l){l.remove()}#t;#r;registeredMatching(a){for(let l of this.#t)l.isConnected||this.#t.delete(l);return[...this.#t].filter(l=>l.matches(a))}cacheInteractiveElements(){let a=(E,O)=>Array.from(O?.querySelectorAll(E)??[]),l=a(e,this),c=a(e,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot),g=this.registeredMatching(e);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...g]));let m=a(t,this),w=a(t,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...w]));let x=a(r,this),f=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...f])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let u=this.isDragDropEnabled(),y=new Set(this.trackedDraggables),v=new Set(this.trackedDroppables),A=u?y:new Set,S=u?v:new Set,I=new Set([...y,...v].filter(qd));for(let E of this.#e)I.has(E)||(E.internals.states.delete("drag"),E.internals.states.delete("droppable"));for(let E of I){let O=A.has(E),N=!O&&S.has(E);O?E.internals.states.add("drag"):E.internals.states.delete("drag"),N?E.internals.states.add("droppable"):E.internals.states.delete("droppable")}this.#e=I,this.trackedDraggables.forEach(E=>{let O=Jt(E);u&&!O?(E.style.cursor="grab",E.style.userSelect="none",E.style.touchAction="none",E.style.webkitUserSelect="none",E.style.webkitTouchCallout="none",E.setAttribute("qti-draggable","true"),E.setAttribute("tabindex","0")):(E.style.cursor="",E.style.userSelect="",E.style.touchAction="",E.style.webkitUserSelect="",E.style.webkitTouchCallout="",E.removeAttribute("qti-draggable"),E.getAttribute("tabindex")==="0"&&E.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 w=wt(m,e),x=this.disabled||this.readonly,f=Pi(w)||Jt(w),u=Date.now()-this.lastTouchStartAt<50;return w&&m.isPrimary!==!1&&m.button===0&&!x&&!f&&!u}).subscribe(m=>{this.lastPointerDownAt=Date.now();let w=wt(m,e);if(!w){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(w,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let f=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",f,!0),document.removeEventListener("pointercancel",f,!0)};document.addEventListener("pointerup",f,{once:!0,capture:!0}),document.addEventListener("pointercancel",f,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",f,!0),document.removeEventListener("pointercancel",f,!0),this.dragState.dragging||this.initiateDrag(w,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let w=wt(m,e),x=this.disabled||this.readonly,f=Pi(w)||Jt(w),u=m.button===0,y=Date.now()-this.lastPointerDownAt<50;return w&&u&&!x&&!f&&!y}).subscribe(m=>{let w=wt(m,e);!w||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(w,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let w=wt(m,e),x=this.disabled||this.readonly,f=Pi(w)||Jt(w),u=!!(m.touches?.[0]||m.changedTouches?.[0]),y=Date.now()-this.lastPointerDownAt<50;return w&&u&&!x&&!f&&!y}).subscribe(m=>{let w=wt(m,e),x=m.touches?.[0]||m.changedTouches?.[0];!w||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(w,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},g=a.when("keydown").subscribe(m=>{let w=this.trackedDraggables.filter(f=>!Jt(f)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let f=(h.dropIndex+1)%x.length;h={...h,dropIndex:f,dropElement:x[f]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let f=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:f,dropElement:x[f]};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.trackedDraggables.forEach(f=>f.removeAttribute("data-keyboard-dragging")),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.trackedDraggables.forEach(f=>f.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let f=wt(m,e),u=this.disabled||this.readonly,y=Pi(f)||Jt(f);f&&["Space","Enter"].includes(m.code)&&!u&&!y&&(m.preventDefault(),f.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:f,dragIndex:w.indexOf(f),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(f=>f.removeAttribute("hover")),h.dragging&&h.dropElement&&(h.dropElement.setAttribute("hover",""),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(l,c,d,g)}initiateDrag(a,l,c,d,h="pointer",g,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 w=y=>y.contains(a)||!!y.shadowRoot?.contains(a),x=this.trackedDroppables.some(w),f=this.trackedDroppables.find(w)||null;a.getAnimations().forEach(y=>y.cancel());let u=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,u),startOffset:{x:l-u.left,y:c-u.top},currentTarget:null,sourceDroppable:f,inputType:d,pointerId:g,startedFromTrustedEvent:m,initialCoordinates:{x:l,y:c},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(f,a),this.cacheInteractiveElements(),f&&f.setAttribute("data-drag-source","true");let y=a.getAttribute("identifier");if(y){let v=_r(this.trackedDragContainers,y);v.forEach(A=>Ie(A,"return-anchor",!0)),this.dragState.returnAnchorItems=v}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),Ie(a,"dragging",!0);this.updateClonePosition(l,c),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let v=this.dragState.dragSource,A=this.dragState.pointerId;v&&A!==void 0&&v.setPointerCapture&&v.setPointerCapture(A)}catch{}let u=v=>{v.cancelable&&(v.preventDefault(),l==="pointer"&&v.stopPropagation())};document.addEventListener("touchmove",u,{passive:!1,capture:!0}),document.addEventListener("touchstart",u,{passive:!1,capture:!0}),document.addEventListener("touchend",u,{passive:!1,capture:!0}),document.addEventListener("gesturestart",u,{passive:!1}),document.addEventListener("gesturechange",u,{passive:!1}),document.addEventListener("gestureend",u,{passive:!1});let y=()=>{if(document.removeEventListener("touchmove",u,{capture:!0}),document.removeEventListener("touchstart",u,{capture:!0}),document.removeEventListener("touchend",u,{capture:!0}),document.removeEventListener("gesturestart",u),document.removeEventListener("gesturechange",u),document.removeEventListener("gestureend",u),l==="pointer")try{let v=this.dragState.dragSource,A=this.dragState.pointerId;v&&A!==void 0&&v.releasePointerCapture&&v.releasePointerCapture(A)}catch{}};this.dragState.touchCleanup=y}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=u=>{let y=this.dragState.startedFromTrustedEvent;return y===void 0||u.isTrusted===y},g=document.when(c).takeUntil(document.when(d)).subscribe({next:u=>{if(h(u)){if(u.preventDefault(),u.stopPropagation(),l==="touch"){let y=u.touches?.[0]||u.changedTouches?.[0];if(!y)return;this.handleDragMove(y.clientX,y.clientY);return}if(l==="mouse"){let y=u;if(typeof y.buttons=="number"&&(y.buttons&1)!==1)return}this.handleDragMove(u.clientX,u.clientY)}}}),m=document.when(d).subscribe({next:u=>{h(u)&&(u.preventDefault(),u.stopPropagation(),this.handleDragEnd())}}),w=l==="touch"?document.when("touchcancel").subscribe({next:u=>{h(u)&&this.handleDragEnd()}}):l==="mouse"?null:document.when("pointercancel").subscribe({next:u=>{h(u)&&this.handleDragEnd()}}),x=document.when("keydown").filter(u=>u.key==="Escape").subscribe({next:u=>{h(u)&&this.handleDragEnd()}}),f=[g,m,x];w&&f.push(w),this.dragSubscriptions.push(...f)}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=>tt(m,"hover",!1)),c&&tt(c,"hover",!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 w=l.getBoundingClientRect();h=Ar(this.allDropzones,w.left+w.width/2,w.top+w.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),Ie(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(w=>{Ie(w,"return-anchor",!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){Mi(a)}createDragClone(a,l){let c=a.cloneNode(!0),d=window.getComputedStyle(a);for(let g=0;g<d.length;g++){let m=d[g];c.style.setProperty(m,d.getPropertyValue(m))}let h=Pa(a.isConnected?a:this,this.dragCloneRoot());return this.cloneFrame=Ma(h),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.style.opacity="0.8",c.removeAttribute("qti-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}=wd(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 g=d?.isConnected?d:this,m=Pa(g,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=Ma(m),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(){this.setInternalsState("dragzone-enabled",!0),this.setInternalsState("dragzone-active",!0),this.allDropzones.forEach(a=>{tt(a,"enabled",!0),tt(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{tt(a,"enabled",!1),tt(a,"active",!1),tt(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{Ie(a,"return-anchor",!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=Oa,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.#e)qd(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#e.clear(),this.resetDragState()}}return o};var Cd={duration:250,easing:"ease",fill:"both"};function Da(n){let e=n.getBoundingClientRect();return{left:e.left,top:e.top,width:e.width,height:e.height}}function Ed(n){return{left:n.left,top:n.top,width:n.width,height:n.height}}function xt(n){let e=new Map;return n.forEach(t=>{e.set(t,Da(t))}),e}function kd(n,e){return{deltaX:n.left-e.left,deltaY:n.top-e.top,deltaW:n.width/e.width,deltaH:n.height/e.height}}function cn(n){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!n)return 1;let e=getComputedStyle(n).getPropertyValue("--qti-motion").trim();if(e==="")return 1;let t=Number.parseFloat(e);return Number.isFinite(t)&&t>0?t:0}function Na(n){return cn(n)>0}function dn(n,e,t={}){let r=cn(n);if(r<=0)return null;let i=Da(n),{deltaX:o,deltaY:s,deltaW:a,deltaH:l}=kd(e,i);if(o===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...Cd,...t};return n.animate([{transformOrigin:"top left",transform:`translate(${o}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*r,easing:d,fill:h})}function qt(n,e={}){let t=new Map;return n.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let o=dn(i,r,e);o&&t.set(i,o)}),t}var Di=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},_e=(n,e,t,r='slot[part="drags"]',i="closestCornersWithInventoryPriority")=>{let o=Aa(n,e,t,r),s=ln(o,e,t,r,i);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this._maxAssociations=0,this._maxAssociationsDefaultApplied=!1,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#e=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}get maxAssociations(){if(!this._maxAssociationsDefaultApplied){this._maxAssociationsDefaultApplied=!0;let c=this.tagName?.toLowerCase()||"";(c==="qti-graphic-gap-match-interaction"||c==="qti-gap-match-interaction")&&!this.hasAttribute("max-associations")&&this._maxAssociations===0&&(this._maxAssociations=1)}return this._maxAssociations}set maxAssociations(c){let d=this._maxAssociations;this._maxAssociations=c,this.requestUpdate("maxAssociations",d)}#e;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.#e.get(c)??[]]:Array.from(c.querySelectorAll(e))}droppableHolding(c){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(c)||d.contains(c)||!!d.shadowRoot?.contains(c))??null}placeChip(c,d){this.#e.set(c,[...this.#e.get(c)??[],d])}removeChipFromDroppable(c,d){let h=c??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let g=(this.#e.get(h)??[]).filter(m=>m!==d);this.#e.set(h,g),g.length===0&&Ir(h,!1),this.syncDragDropState();return}d.remove()}clearChips(c){this.isDeclarativeTarget(c)?(this.#e.set(c,[]),this.syncDragDropState()):this.chipsIn(c).forEach(d=>d.remove()),Ir(c,!1)}syncDragDropState(){let c={},d={},h={};for(let g of this.trackedDroppables){let m=g.getAttribute("identifier");if(!m)continue;let w=this.chipsIn(g),x=this.isDeclarativeTarget(g)?w:Array.from(g.querySelectorAll('[qti-draggable="true"]'));c[m]=w.map(f=>f.getAttribute("identifier")).filter(f=>!!f),d[m]=Math.max(w.length,x.length),h[m]=w}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(g=>`${g} ${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 g=c.getAttribute("identifier");return(g?this._dragDrop.countByTarget[g]??0:0)>=h}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Na(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,g=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),g.forEach(x=>this.placeResponse(x));let m=this.getResponse,w=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(w)?w:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response))}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 g=this.getAttribute(h);if(g&&g.trim().length>0)return g}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),g=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return g&&this.isSwapTarget(d)?!0:h&&(!g||m)}handleDrop(c,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,d,h);let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.validate(),this.reportValidity()}handleInvalidDrop(c){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,g=!h,m=this.trackedDragContainers[0]||null;if(!c)return;if(d&&g&&m)this.dropDraggableInDroppable(c,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(c,d,this.dragState.dragClone?.getBoundingClientRect());else if(sn(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let u=c.getAttribute("identifier");u&&this.updateInventoryBasedOnMatchMax(u),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let w=this.totalAssociationsFromState(),x=this.maxAssociations>0&&w>=this.maxAssociations,f=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=f&&x,this.validate(),this.reportValidity()}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{dn(c,Ed(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){Mi(c),c.style.display="",c.style.position="",this.animateReturn(c,d)}placeResponse(c){let[d,...h]=c.split(" ").reverse(),g=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);g&&h.forEach(m=>{if(!m)return;let x=_r(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(f=>f.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,g)})}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 A=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),A&&this.restoreOriginalInInventory(A,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),w=Number.isNaN(m)?1:m,x=w===0||w>1,f=Array.from(d.querySelectorAll('[qti-draggable="true"]')),u=this.enableFlipAnimations&&f.length>0?xt(f):null;if(!x){let A=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(A){let S=A.getAttribute("identifier"),I=A.getBoundingClientRect();this.removeChipFromDroppable(d,A);let E=this.dragState.sourceDroppable,O=this.isDeclarativeTarget(d)&&E&&E!==d&&this.isDeclarativeTarget(E)?E:null;O?(this.placeChip(O,A),Ir(O,!0),this.animateReturn(A,I)):S&&this.restoreOriginalInInventory(S,I)}}let y=c.cloneNode(!0);y.removeAttribute("style"),y.removeAttribute("data-keyboard-dragging"),y.setAttribute("qti-draggable","true"),y.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(y.setAttribute("part","drag"),y.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,y)):d.tagName==="SLOT"?y.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&y.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(y)),Ir(d,!0),this.syncDragDropState(),u&&this.enableFlipAnimations&&qt(u,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let A=y.getBoundingClientRect(),S=h.left-A.left,I=h.top-A.top;(S!==0||I!==0)&&y.animate([{transform:`translate(${S}px, ${I}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let v=c.getAttribute("identifier");v&&this.updateInventoryBasedOnMatchMax(v),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(g=>{let m=this.chipsIn(g).filter(w=>w.getAttribute("identifier")===h);m.forEach(w=>this.removeChipFromDroppable(g,w)),m.length>0&&this.chipsIn(g).length===0&&Ir(g,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=_r(this.trackedDragContainers,c),g=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[qti-draggable="true"]').forEach(f=>!g.has(f)&&m.push(f))});let w=this.enableFlipAnimations&&m.length>0?xt(m):null;h.forEach(x=>{Mi(x),x.style.display="",x.style.visibility="visible"}),w&&this.enableFlipAnimations&&qt(w,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=_r(this.trackedDragContainers,c),h=vd(this.trackedDraggables,c),g=this.trackedDroppables.reduce((m,w)=>this.isDeclarativeTarget(w)?m+this.chipsIn(w).filter(x=>x.getAttribute("identifier")===c).length:m+w.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{Ie(m,"placeholder",h!==0&&g>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(g=>{let m=g.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(g)||d&&h)&&!m?g.setAttribute("disabled",""):g.removeAttribute("disabled")})}saveResponse(c){let d=this.getResponse,h=c??(typeof d=="function"?d.call(this):void 0),g=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=g,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:g}})),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._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,g=this.minAssociations>0&&c<this.minAssociations,m="",w=!0;h?(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}.`,w=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(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}.`,w=!1):g?(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"}.`,w=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(w,m,x,{suppressInline:!0}),w}reportValidity(){return super.reportValidity()}}return Di([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),Di([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),Di([B({context:bt})],a.prototype,"_dragDrop",void 0),Di([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),Di([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Le({emptyAs:[]})})],a.prototype,"response",null),a};var hn=class{getInsertPosition(e,t,r,i,o){let s=e.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),l=(o-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var Sd=new hn;var Wp={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function Ni(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function pn(n){n.placeholder?.remove(),n.placeholder=null,n.lastHoverTarget=null,n.lastPlacement=null,n.sortContainer=null}function un(n,e,t={}){let r={...Wp,...t},i=document.createElement("div");return i.setAttribute("data-drop-placeholder","true"),i.style.width=`${e.width}px`,i.style.height=`${e.height}px`,i.style.margin=window.getComputedStyle(n).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(n).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*cn(n)}ms ease`,i.style.pointerEvents="none",i}function $a(n,e){for(let t of e)if(t.contains(n)&&t!==n)return t;return null}var Te=(n,e='[qti-draggable="true"]')=>{class t extends n{constructor(){super(...arguments),this.#e=null,this.#t=null,this.#r=Ni(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#n=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#e;#t;#r;#i;#n;#o;set allowReorder(i){this.#o=i}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#e!==null}findContainingDroppable(i){return $a(i,this.trackedDroppables)}#s(i){return i.querySelector(e)}#a(i){let o=this.#l(i);return o===0||o>1}#l(i){let o=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(o)?1:o}#h(i){return i.querySelectorAll(e).length}#c(i){let o=this.#l(i);return o===0?!1:this.#h(i)>=o}#u(){this.#i={hoveredSlot:null,originalPositions:new Map}}#d(i){if(!this.#e||i===this.#e){this.#p();return}if(this.#i.hoveredSlot===i)return;this.#p();let o=this.#s(i);if(!o){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#c(i)){this.#r.placeholder&&this.#e&&this.#e.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=xt([o]);this.#i.originalPositions.set(o,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#e.appendChild(o),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,qt(a,this.sortableAnimationConfig)}#p(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),o=i.length>0?xt(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#e&&this.#e.appendChild(this.#r.placeholder),o&&qt(o,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,o,s,a,...l){this.#e=null,this.#r=Ni(),this.#u();let c=this.findContainingDroppable(i);if(this.#t=c,c&&this.allowReorder){this.#e=c,this.#r.sortContainer=c;let h=i.getBoundingClientRect();this.#r.placeholder=un(i,h,this.sortablePlaceholderConfig);let g=i.getAttribute("slot");g&&this.#r.placeholder.setAttribute("slot",g),this.#r.placeholder.style.visibility="hidden",c.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#c(m))return;m.removeAttribute("disabled"),this.#n.add(m)}})}let[d]=l;super.initiateDrag(i,o,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[o,s]of this.#i.originalPositions)s.appendChild(o);this.#r.placeholder&&this.#r.placeholder.remove(),pn(this.#r),this.#n.clear(),this.#e=null,this.#u()}onSortableDragMove(i,o){if(!this.isDraggingFromSlot)return;let s=Ar(this.trackedDroppables,i,o,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#p()}handleDragMove(i,o){Object.getPrototypeOf(t.prototype).handleDragMove?.call(this,i,o),this.onSortableDragMove(i,o)}allowDrop(i,o){return!this.allowReorder&&this.#t&&!this.trackedDragContainers.includes(this.#t)&&o!==this.#t&&this.trackedDroppables.includes(o)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(o)?this.#a(o)?!this.#c(o):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(o)?!0:super.allowDrop(i,o)}handleDrop(i,o){super.handleDrop(i,o),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return t};var Ad=[R,U,$e,q`
6548
6922
  :host {
6549
6923
  display: block; /* necessary to calculate scaling position */
6550
6924
  }
@@ -6597,7 +6971,7 @@ div.full-correct-response-inline {
6597
6971
  :host([answer-key]) ::slotted(qti-simple-associable-choice) {
6598
6972
  display: none;
6599
6973
  }
6600
- `];var Jp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Zp=Ie(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),Jt=class extends _e(Zp,'[qti-draggable="true"]'){static{this.styles=Ad}constructor(){super(),this._childrenMap=[],this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(e){let t=e.composedPath()[0];if(this.shadowRoot?.contains(t))return;let r=t;this._childrenMap.includes(r)||(this._childrenMap=[...this._childrenMap,r])}#e(e,t){let r=this._dragDrop?.nodesByTarget?.[e]??[];return b`<div name=${t} part="drop" data-declarative-drops identifier=${e}>
6974
+ `];var Jp=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Zp=_e(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),Zt=class extends Te(Zp,'[qti-draggable="true"]'){static{this.styles=Ad}constructor(){super(),this._childrenMap=[],this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(e){let t=e.composedPath()[0];if(this.shadowRoot?.contains(t))return;let r=t;this._childrenMap.includes(r)||(this._childrenMap=[...this._childrenMap,r])}#e(e,t){let r=this._dragDrop?.nodesByTarget?.[e]??[];return b`<div name=${t} part="drop" data-declarative-drops identifier=${e}>
6601
6975
  ${H(r,i=>i.getAttribute("identifier"),i=>i)}
6602
6976
  </div>`}get#t(){return this.maxAssociations>0?this.maxAssociations:Math.ceil(this._childrenMap.length/2)}getResponse(){let e=[];for(let t=0;t<this.#t;t++){let r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${t}_left"]`),i=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${t}_right"]`),o=r&&this.chipsIn(r)[0]?.getAttribute("identifier"),s=i&&this.chipsIn(i)[0]?.getAttribute("identifier");o&&s&&e.push(`${o} ${s}`)}return e}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(e){return e?.flatMap((t,r)=>{let i=t.split(" ");return i.length!==2?[]:[`${i[0]} droplist${r}_left`,`${i[1]} droplist${r}_right`]})??[]}render(){return b` <slot name="prompt"></slot>
6603
6977
  <slot part="drags" name="qti-simple-associable-choice"></slot>
@@ -6608,7 +6982,7 @@ div.full-correct-response-inline {
6608
6982
  </div>`)}
6609
6983
 
6610
6984
  <div role="alert" part="message" id="validation-message"></div>
6611
- </div>`}updated(e){super.updated(e),e.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};Jp([_()],Jt.prototype,"_childrenMap",void 0);var mn=[{tag:"qti-associate-interaction",ctor:Jt}];var qt=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ct=(n,e)=>{class t extends n{constructor(){super(...arguments),this._choiceElements=[],this.#e=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(i,o)=>{this._choiceElements.forEach(s=>s.disabled=o)},this._handleReadonlyChange=(i,o)=>{this._choiceElements.forEach(s=>s.readonly=o)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#e;_handleMaxChoicesChange(i,o){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-${e}`,this._choiceElementSelectedHandler),this.#e=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#e.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${e}`,this._choiceElementSelectedHandler),this.#e&&(this.#e.disconnect(),this.#e=null)}_syncChoicesFromDOM(){let i=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(e)),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 o=new Set(this._choiceElements.map(s=>s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>o.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!o.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let o=this._choiceElements.filter(c=>this._getChoiceChecked(c)).length,s=!0,a="";this.maxChoices!==0&&o>this.maxChoices?(s=!1,a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):o<this.minChoices&&(s=!1,a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(c=>this.contains(c))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0}),s}reportValidity(){return super.reportValidity()}_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 o=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==i.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&o&&(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,o){i.internals?.states&&(o?(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 o=this._getChoiceChecked(i);this._setChoiceChecked(i,!o)}_handleChoiceSelection(){let o=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?o[0]||"":o,this.validate(),this.reportValidity(),this.saveResponse(this.response)}_updateChoiceSelection(){let i=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(o=>{let s=i.includes(o.identifier);this._setChoiceChecked(o,s)})}}return qt([sr("#validation-message")],t.prototype,"_validationMessageElement",void 0),qt([p({type:Number,attribute:"min-choices"})],t.prototype,"minChoices",void 0),qt([p({type:Number,attribute:"max-choices"})],t.prototype,"maxChoices",void 0),qt([$("maxChoices")],t.prototype,"_handleMaxChoicesChange",null),qt([$("disabled",{waitUntilFirstUpdate:!0})],t.prototype,"_handleDisabledChange",void 0),qt([$("readonly",{waitUntilFirstUpdate:!0})],t.prototype,"_handleReadonlyChange",void 0),qt([p({attribute:"response",reflect:!1,converter:$e({emptyAs:""})})],t.prototype,"response",void 0),qt([$("response",{waitUntilFirstUpdate:!0})],t.prototype,"_handleValueChange",void 0),t};var eu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Id=(n,e)=>{class t extends n{#e=[];#t=["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.#e=this.#n(i),this.#o()}get class(){return this.#e.join(" ")}attributeChangedCallback(i,o,s){super.attributeChangedCallback(i,o,s),i==="class"&&o!==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(o=>o.type==="childList"||o.type==="attributes"&&o.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(o=>o.trim()).filter(Boolean).filter((o,s,a)=>a.indexOf(o)===s):[]}#o(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),o=this.#s(i),s=this.#a(),a=this.#l();o.forEach((l,c)=>{l.marker=this.#h(c+1,s,a)})}#s(i){return i.map((o,s)=>{let a=Number(o.style.order);return{el:o,order:Number.isFinite(a)?a:s+1,index:s}}).sort((o,s)=>o.order-s.order||o.index-s.index).map(o=>o.el)}#a(){return this.#e.filter(i=>this.#t.includes(i)).pop()??null}#l(){return this.#e.filter(i=>this.#r.includes(i)).pop()??null}#h(i,o,s){let a=o;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=`${i}`;break;case"qti-labels-lower-alpha":l=this.#c(i,"lower");break;case"qti-labels-upper-alpha":l=this.#c(i,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#c(i,o){let s=i,a="",l=o==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return eu([p({type:String,attribute:"class"})],t.prototype,"class",null),t};var _d=[R,U,q`
6985
+ </div>`}updated(e){super.updated(e),e.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};Jp([_()],Zt.prototype,"_childrenMap",void 0);var mn=[{tag:"qti-associate-interaction",ctor:Zt}];var Ct=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Et=(n,e)=>{class t extends n{constructor(){super(...arguments),this._choiceElements=[],this.#e=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(i,o)=>{this._choiceElements.forEach(s=>s.disabled=o)},this._handleReadonlyChange=(i,o)=>{this._choiceElements.forEach(s=>s.readonly=o)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#e;_handleMaxChoicesChange(i,o){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-${e}`,this._choiceElementSelectedHandler),this.#e=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#e.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${e}`,this._choiceElementSelectedHandler),this.#e&&(this.#e.disconnect(),this.#e=null)}_syncChoicesFromDOM(){let i=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(e)),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 o=new Set(this._choiceElements.map(s=>s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>o.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!o.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let o=this._choiceElements.filter(c=>this._getChoiceChecked(c)).length,s=!0,a="";this.maxChoices!==0&&o>this.maxChoices?(s=!1,a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):o<this.minChoices&&(s=!1,a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(c=>this.contains(c))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0}),s}reportValidity(){return super.reportValidity()}_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 o=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==i.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&o&&(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,o){i.internals?.states&&(o?(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 o=this._getChoiceChecked(i);this._setChoiceChecked(i,!o)}_handleChoiceSelection(){let o=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?o[0]||"":o,this.validate(),this.reportValidity(),this.saveResponse(this.response)}_updateChoiceSelection(){let i=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(o=>{let s=i.includes(o.identifier);this._setChoiceChecked(o,s)})}}return Ct([ar("#validation-message")],t.prototype,"_validationMessageElement",void 0),Ct([p({type:Number,attribute:"min-choices"})],t.prototype,"minChoices",void 0),Ct([p({type:Number,attribute:"max-choices"})],t.prototype,"maxChoices",void 0),Ct([$("maxChoices")],t.prototype,"_handleMaxChoicesChange",null),Ct([$("disabled",{waitUntilFirstUpdate:!0})],t.prototype,"_handleDisabledChange",void 0),Ct([$("readonly",{waitUntilFirstUpdate:!0})],t.prototype,"_handleReadonlyChange",void 0),Ct([p({attribute:"response",reflect:!1,converter:Le({emptyAs:""})})],t.prototype,"response",void 0),Ct([$("response",{waitUntilFirstUpdate:!0})],t.prototype,"_handleValueChange",void 0),t};var eu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Id=(n,e)=>{class t extends n{#e=[];#t=["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.#e=this.#n(i),this.#o()}get class(){return this.#e.join(" ")}attributeChangedCallback(i,o,s){super.attributeChangedCallback(i,o,s),i==="class"&&o!==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(o=>o.type==="childList"||o.type==="attributes"&&o.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(o=>o.trim()).filter(Boolean).filter((o,s,a)=>a.indexOf(o)===s):[]}#o(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),o=this.#s(i),s=this.#a(),a=this.#l();o.forEach((l,c)=>{l.marker=this.#h(c+1,s,a)})}#s(i){return i.map((o,s)=>{let a=Number(o.style.order);return{el:o,order:Number.isFinite(a)?a:s+1,index:s}}).sort((o,s)=>o.order-s.order||o.index-s.index).map(o=>o.el)}#a(){return this.#e.filter(i=>this.#t.includes(i)).pop()??null}#l(){return this.#e.filter(i=>this.#r.includes(i)).pop()??null}#h(i,o,s){let a=o;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=`${i}`;break;case"qti-labels-lower-alpha":l=this.#c(i,"lower");break;case"qti-labels-upper-alpha":l=this.#c(i,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#c(i,o){let s=i,a="",l=o==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return eu([p({type:String,attribute:"class"})],t.prototype,"class",null),t};var _d=[R,U,q`
6612
6986
  :host {
6613
6987
  display: block;
6614
6988
  }
@@ -6675,11 +7049,11 @@ div.full-correct-response-inline {
6675
7049
  :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
6676
7050
  grid-row: auto;
6677
7051
  }
6678
- `];var tu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Zt=class extends Id(Ct(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=_d}#e(){let e=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",e.length.toString())}render(){return b`
7052
+ `];var tu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},er=class extends Id(Et(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=_d}#e(){let e=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",e.length.toString())}render(){return b`
6679
7053
  <slot part="prompt" name="prompt"></slot>
6680
7054
  <slot part="slot" @slotchange=${this.#e}></slot>
6681
7055
  <div part="message" role="alert" id="validation-message"></div>
6682
- `}};tu([p({type:String})],Zt.prototype,"orientation",void 0);var fn=[{tag:"qti-choice-interaction",ctor:Zt}];var Td=[R,q`
7056
+ `}};tu([p({type:String})],er.prototype,"orientation",void 0);var fn=[{tag:"qti-choice-interaction",ctor:er}];var Td=[R,q`
6683
7057
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
6684
7058
  :host {
6685
7059
  display: block;
@@ -6795,7 +7169,7 @@ CES.load();
6795
7169
  requestBlobUrl();
6796
7170
  }
6797
7171
  })();
6798
- `,rt=class extends D{#e;#t;#r;static{this.styles=Td}constructor(){super(),this.#e="",this.#t=null,this.#r=null,this._errorMessage=null,this.#i=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#i;connectedCallback(){super.connectedCallback();let e=this.data;if(!e){let r=this.querySelector("object[data]");if(r){e=r.getAttribute("data");let i=r.getAttribute("width"),o=r.getAttribute("height");i&&this.setAttribute("width",i),o&&this.setAttribute("height",o)}}if(!e){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let t=e.startsWith("http")||e.startsWith("blob")?e:mo((this.baseItemUrl||"")+"/"+e);this.#t=new URL(t,window.location.href).toString(),fetch(t).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}async setupCES(){await this.updateComplete;let e=this.shadowRoot?.querySelector("#pciContainer");if(!e){this._errorMessage="pciContainer iframe not found";return}e.getAttribute("src")||e.setAttribute("src","about:blank");let t=e.contentDocument??e.contentWindow?.document??null;if(t||(await new Promise(d=>e.addEventListener("load",()=>d(),{once:!0})),t=e.contentDocument??e.contentWindow?.document??null),!t){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(),o=await this.#c(r,i),s=o.url;if(o.baseUrl&&!this.#r&&(this.#r=o.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],g=await this.#c(h,i,{returnText:!0});if(d=g.url,g.baseUrl&&!this.#r&&(this.#r=g.baseUrl),g.text){let f=g.text;if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let m="<script>"+La+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+m+f.slice(u+6):f=m+f}let x=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",g=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",f=g?`${g}/index.html`:"index.html",w=await this.#c(f,i,{returnText:!0});if(d=w.url,w.baseUrl&&!this.#r&&(this.#r=w.baseUrl),w.text){let x=w.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let y="<script>"+La+"</script>",v=x.indexOf("<head>");v!==-1?x=x.slice(0,v+6)+y+x.slice(v+6):x=y+x}let u=new Blob([x],{type:"text/html"});this.#i=URL.createObjectURL(u)}}if(d&&!this.#i)try{let h=await fetch(d);if(h.ok){let g=await h.text();if(!(g.includes("postToParentWindows")||g.includes("window.CES"))){let x="<script>"+La+"</script>",m=g.indexOf("<head>");m!==-1?g=g.slice(0,m+6)+x+g.slice(m+6):g=x+g}let w=new Blob([g],{type:"text/html"});this.#i=URL.createObjectURL(w)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${ru}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
7172
+ `,rt=class extends D{#e;#t;#r;static{this.styles=Td}constructor(){super(),this.#e="",this.#t=null,this.#r=null,this._errorMessage=null,this.#i=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#i;connectedCallback(){super.connectedCallback();let e=this.data;if(!e){let r=this.querySelector("object[data]");if(r){e=r.getAttribute("data");let i=r.getAttribute("width"),o=r.getAttribute("height");i&&this.setAttribute("width",i),o&&this.setAttribute("height",o)}}if(!e){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let t=e.startsWith("http")||e.startsWith("blob")?e:mo((this.baseItemUrl||"")+"/"+e);this.#t=new URL(t,window.location.href).toString(),fetch(t).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}async setupCES(){await this.updateComplete;let e=this.shadowRoot?.querySelector("#pciContainer");if(!e){this._errorMessage="pciContainer iframe not found";return}e.getAttribute("src")||e.setAttribute("src","about:blank");let t=e.contentDocument??e.contentWindow?.document??null;if(t||(await new Promise(d=>e.addEventListener("load",()=>d(),{once:!0})),t=e.contentDocument??e.contentWindow?.document??null),!t){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(),o=await this.#c(r,i),s=o.url;if(o.baseUrl&&!this.#r&&(this.#r=o.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],g=await this.#c(h,i,{returnText:!0});if(d=g.url,g.baseUrl&&!this.#r&&(this.#r=g.baseUrl),g.text){let m=g.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let f="<script>"+La+"</script>",u=m.indexOf("<head>");u!==-1?m=m.slice(0,u+6)+f+m.slice(u+6):m=f+m}let x=new Blob([m],{type:"text/html"});this.#i=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",g=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=g?`${g}/index.html`:"index.html",w=await this.#c(m,i,{returnText:!0});if(d=w.url,w.baseUrl&&!this.#r&&(this.#r=w.baseUrl),w.text){let x=w.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let y="<script>"+La+"</script>",v=x.indexOf("<head>");v!==-1?x=x.slice(0,v+6)+y+x.slice(v+6):x=y+x}let u=new Blob([x],{type:"text/html"});this.#i=URL.createObjectURL(u)}}if(d&&!this.#i)try{let h=await fetch(d);if(h.ok){let g=await h.text();if(!(g.includes("postToParentWindows")||g.includes("window.CES"))){let x="<script>"+La+"</script>",f=g.indexOf("<head>");f!==-1?g=g.slice(0,f+6)+x+g.slice(f+6):g=x+g}let w=new Blob([g],{type:"text/html"});this.#i=URL.createObjectURL(w)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${ru}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
6799
7173
  <!DOCTYPE html>
6800
7174
  <html>
6801
7175
  <head>
@@ -6815,7 +7189,7 @@ CES.load();
6815
7189
  ${this._errorMessage&&b`<div style="color:red">
6816
7190
  <h1>Error</h1>
6817
7191
  ${this._errorMessage}
6818
- </div>`}`}#a(){let t=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#l()].filter(Boolean).map(i=>new URL(i,window.location.href).toString()),r=this.#h();return r&&t.push(r),[...new Set(t)]}#l(){return this.#t?new URL(".",this.#t).toString():null}#h(){return this.#t?new URL("..",this.#t).toString():null}async#c(e,t,r={}){if(!e)return{url:"",baseUrl:null};if(e.startsWith("http")||e.startsWith("blob"))return{url:e,baseUrl:null};for(let i of t){let o=new URL(i,window.location.href).toString(),s=new URL(e,o.endsWith("/")?o:`${o}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let l=await a.text();return{url:s,baseUrl:o,text:l}}return{url:s,baseUrl:o}}}catch{}}return{url:"",baseUrl:null}}};$i([p({type:String,attribute:"data"})],rt.prototype,"data",void 0);$i([p({type:String,attribute:"data-base-item"})],rt.prototype,"baseItemUrl",void 0);$i([p({type:String,attribute:"data-base-ref"})],rt.prototype,"baseRefUrl",void 0);$i([p({type:String,attribute:"id"})],rt.prototype,"id",void 0);$i([_()],rt.prototype,"_errorMessage",void 0);var gn=[{tag:"qti-custom-interaction",ctor:rt}];var Rd=[R];var bn=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Et=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=Rd}render(){return b`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};bn([p({type:String,attribute:"response-identifier"})],Et.prototype,"responseIdentifier",void 0);bn([p({reflect:!0,type:Boolean})],Et.prototype,"disabled",void 0);bn([p({type:String,attribute:"count-attempt"})],Et.prototype,"countAttempt",void 0);bn([p({type:String})],Et.prototype,"title",void 0);var yn=[{tag:"qti-end-attempt-interaction",ctor:Et}];var Od=[R,q`
7192
+ </div>`}`}#a(){let t=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#l()].filter(Boolean).map(i=>new URL(i,window.location.href).toString()),r=this.#h();return r&&t.push(r),[...new Set(t)]}#l(){return this.#t?new URL(".",this.#t).toString():null}#h(){return this.#t?new URL("..",this.#t).toString():null}async#c(e,t,r={}){if(!e)return{url:"",baseUrl:null};if(e.startsWith("http")||e.startsWith("blob"))return{url:e,baseUrl:null};for(let i of t){let o=new URL(i,window.location.href).toString(),s=new URL(e,o.endsWith("/")?o:`${o}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let l=await a.text();return{url:s,baseUrl:o,text:l}}return{url:s,baseUrl:o}}}catch{}}return{url:"",baseUrl:null}}};$i([p({type:String,attribute:"data"})],rt.prototype,"data",void 0);$i([p({type:String,attribute:"data-base-item"})],rt.prototype,"baseItemUrl",void 0);$i([p({type:String,attribute:"data-base-ref"})],rt.prototype,"baseRefUrl",void 0);$i([p({type:String,attribute:"id"})],rt.prototype,"id",void 0);$i([_()],rt.prototype,"_errorMessage",void 0);var gn=[{tag:"qti-custom-interaction",ctor:rt}];var Rd=[R];var bn=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},kt=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=Rd}render(){return b`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};bn([p({type:String,attribute:"response-identifier"})],kt.prototype,"responseIdentifier",void 0);bn([p({reflect:!0,type:Boolean})],kt.prototype,"disabled",void 0);bn([p({type:String,attribute:"count-attempt"})],kt.prototype,"countAttempt",void 0);bn([p({type:String})],kt.prototype,"title",void 0);var yn=[{tag:"qti-end-attempt-interaction",ctor:kt}];var Od=[R,q`
6819
7193
  /* PK: display host as block, else design will be collapsed */
6820
7194
  /* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
6821
7195
  :host {
@@ -6828,7 +7202,7 @@ CES.load();
6828
7202
  height: 100%;
6829
7203
  border: 0;
6830
7204
  }
6831
- `];var be=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Pd=5,iu=50,Md="qti-height-lines-",Dd=!1,Q=class extends D{constructor(){super(...arguments),this._rows=Pd,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||Dd||(Dd=!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.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Od}_handleRowsInputChange(){this._rows=this.#e()}#e(){let e=this.#t();return e!==null?e:this.expectedLines>0?this.expectedLines:this.expectedLength>0?Math.ceil(this.expectedLength/iu):Pd}#t(){for(let e of(this.classNames??"").split(" ")){if(!e.startsWith(Md))continue;let t=parseInt(e.slice(Md.length),10);if(!Number.isNaN(t)&&t>0)return t}return null}get value(){return this.response||null}set value(e){this.response=e||null}validate(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;let t="",r=!1;if(this.patternMask&&this.dataPatternmaskMessage){e.setCustomValidity("");let i=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,o=new RegExp(i);r=e.checkValidity()&&o.test(e.value),r||(t=this.dataPatternmaskMessage,e.setCustomValidity(this.dataPatternmaskMessage))}else r=e.checkValidity();return r&&!this.response&&(r=!1),!r&&!t&&(t=e.validationMessage||"Invalid value."),this.setInteractionValidity(r,t,e,{suppressInline:!0}),r}reportValidity(){return this.validate(),super.reportValidity()}renderPrompt(){return b`<slot name="prompt"></slot>`}renderTextarea(){return b`<textarea
7205
+ `];var ye=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Pd=5,iu=50,Md="qti-height-lines-",Dd=!1,Q=class extends D{constructor(){super(...arguments),this._rows=Pd,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||Dd||(Dd=!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.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Od}_handleRowsInputChange(){this._rows=this.#e()}#e(){let e=this.#t();return e!==null?e:this.expectedLines>0?this.expectedLines:this.expectedLength>0?Math.ceil(this.expectedLength/iu):Pd}#t(){for(let e of(this.classNames??"").split(" ")){if(!e.startsWith(Md))continue;let t=parseInt(e.slice(Md.length),10);if(!Number.isNaN(t)&&t>0)return t}return null}get value(){return this.response||null}set value(e){this.response=e||null}validate(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;let t="",r=!1;if(this.patternMask&&this.dataPatternmaskMessage){e.setCustomValidity("");let i=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,o=new RegExp(i);r=e.checkValidity()&&o.test(e.value),r||(t=this.dataPatternmaskMessage,e.setCustomValidity(this.dataPatternmaskMessage))}else r=e.checkValidity();return r&&!this.response&&(r=!1),!r&&!t&&(t=e.validationMessage||"Invalid value."),this.setInteractionValidity(r,t,e,{suppressInline:!0}),r}reportValidity(){return this.validate(),super.reportValidity()}renderPrompt(){return b`<slot name="prompt"></slot>`}renderTextarea(){return b`<textarea
6832
7206
  part="textarea"
6833
7207
  name="${this.responseIdentifier}"
6834
7208
  spellcheck="false"
@@ -6843,7 +7217,7 @@ CES.load();
6843
7217
  ?disabled="${this.disabled}"
6844
7218
  ?readonly="${this.readonly}"
6845
7219
  .value=${this.response}
6846
- ></textarea>`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}};be([_()],Q.prototype,"_rows",void 0);be([p({type:Number,attribute:"expected-length"})],Q.prototype,"expectedLength",void 0);be([p({type:Number,attribute:"expected-lines"})],Q.prototype,"expectedLines",void 0);be([p({type:String,reflect:!0})],Q.prototype,"format",void 0);be([$("format")],Q.prototype,"_handleFormatChange",void 0);be([p({type:String,attribute:"pattern-mask"})],Q.prototype,"patternMask",void 0);be([p({type:String,attribute:"placeholder-text"})],Q.prototype,"placeholderText",void 0);be([p({type:String,attribute:"data-patternmask-message"})],Q.prototype,"dataPatternmaskMessage",void 0);be([p({type:String,attribute:"class"})],Q.prototype,"classNames",void 0);be([$(["classNames","expectedLines","expectedLength"])],Q.prototype,"_handleRowsInputChange",null);be([p({type:String,attribute:"response",reflect:!1})],Q.prototype,"response",void 0);be([$("response",{waitUntilFirstUpdate:!0})],Q.prototype,"_handleResponseChange",void 0);var vn=[{tag:"qti-extended-text-interaction",ctor:Q}];var Nd=[R,U,q`
7220
+ ></textarea>`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}};ye([_()],Q.prototype,"_rows",void 0);ye([p({type:Number,attribute:"expected-length"})],Q.prototype,"expectedLength",void 0);ye([p({type:Number,attribute:"expected-lines"})],Q.prototype,"expectedLines",void 0);ye([p({type:String,reflect:!0})],Q.prototype,"format",void 0);ye([$("format")],Q.prototype,"_handleFormatChange",void 0);ye([p({type:String,attribute:"pattern-mask"})],Q.prototype,"patternMask",void 0);ye([p({type:String,attribute:"placeholder-text"})],Q.prototype,"placeholderText",void 0);ye([p({type:String,attribute:"data-patternmask-message"})],Q.prototype,"dataPatternmaskMessage",void 0);ye([p({type:String,attribute:"class"})],Q.prototype,"classNames",void 0);ye([$(["classNames","expectedLines","expectedLength"])],Q.prototype,"_handleRowsInputChange",null);ye([p({type:String,attribute:"response",reflect:!1})],Q.prototype,"response",void 0);ye([$("response",{waitUntilFirstUpdate:!0})],Q.prototype,"_handleResponseChange",void 0);var vn=[{tag:"qti-extended-text-interaction",ctor:Q}];var Nd=[R,U,q`
6847
7221
  :host {
6848
7222
  display: flex;
6849
7223
  align-items: flex-start;
@@ -6887,10 +7261,10 @@ CES.load();
6887
7261
  :host([answer-key]) [part~='drags'] {
6888
7262
  display: none;
6889
7263
  }
6890
- `];var Tr=class extends _e(Ie(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){static{this.styles=Nd}render(){return b`<slot name="prompt"> </slot>
7264
+ `];var Tr=class extends Te(_e(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){static{this.styles=Nd}render(){return b`<slot name="prompt"> </slot>
6891
7265
  <slot part="drags" name="drags"></slot>
6892
7266
  <slot part="drops"></slot>
6893
- <div role="alert" part="message" id="validation-message"></div>`}};var wn=[{tag:"qti-gap-match-interaction",ctor:Tr}];function kt(n,e,t,r){let i=t.getAttribute("width")?parseFloat(t.getAttribute("width")):t.naturalWidth,o=t.getAttribute("height")?parseFloat(t.getAttribute("height")):t.naturalHeight;switch(n){case"circle":{if(e.length!==3){console.error("Invalid circle coordinates:",e);return}let[s,a,l]=e,c=s/i*100,d=a/o*100,h=l/i*100,g=l/o*100;r.style.left=c-h+"%",r.style.top=d-g+"%",r.style.width=2*h+"%",r.style.height=2*g+"%",r.style.borderRadius="50%"}break;case"rect":{if(e.length!==4){console.error("Invalid rectangle coordinates:",e);return}let[s,a,l,c]=e,d=s/i*100,h=a/o*100,g=l/i*100,f=c/o*100;r.style.left=d+"%",r.style.top=h+"%",r.style.width=g-d+"%",r.style.height=f-h+"%"}break;case"ellipse":{if(e.length!==4){console.error("Invalid ellipse coordinates:",e);return}let[s,a,l,c]=e,d=s/i*100,h=a/o*100,g=l/i*100,f=c/o*100;r.style.left=d-g+"%",r.style.top=h-f+"%",r.style.width=2*g+"%",r.style.height=2*f+"%",r.style.borderRadius="50%"}break;case"poly":{if(e.length<6||e.length%2!==0){console.error("Invalid polygon coordinates:",e);return}let s=[];for(let v=0;v<e.length;v+=2)s.push({x:e[v],y:e[v+1]});let a=Math.min(...s.map(v=>v.x)),l=Math.max(...s.map(v=>v.x)),c=Math.min(...s.map(v=>v.y)),d=Math.max(...s.map(v=>v.y)),h=a/i*100,g=c/o*100,f=l/i*100,w=d/o*100;r.style.left=h+"%",r.style.top=g+"%",r.style.width=f-h+"%",r.style.height=w-g+"%";let x=s.map(v=>({x:(v.x-a)/(l-a)*100,y:(v.y-c)/(d-c)*100})),m=x.map(v=>`${v.x}% ${v.y}%`).join(",");r.style.clipPath=`polygon(${m})`;let u=x.map(v=>`${v.x},${v.y}`).join(" "),y=v=>`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='${v}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;r.style.setProperty("--qti-shape-outline",y(4)),r.style.setProperty("--qti-shape-outline-bold",y(8))}break;default:console.error(`Unsupported shape: ${n}`);break}}var $d=[R,U,q`
7267
+ <div role="alert" part="message" id="validation-message"></div>`}};var wn=[{tag:"qti-gap-match-interaction",ctor:Tr}];function St(n,e,t,r){let i=t.getAttribute("width")?parseFloat(t.getAttribute("width")):t.naturalWidth,o=t.getAttribute("height")?parseFloat(t.getAttribute("height")):t.naturalHeight;switch(n){case"circle":{if(e.length!==3){console.error("Invalid circle coordinates:",e);return}let[s,a,l]=e,c=s/i*100,d=a/o*100,h=l/i*100,g=l/o*100;r.style.left=c-h+"%",r.style.top=d-g+"%",r.style.width=2*h+"%",r.style.height=2*g+"%",r.style.borderRadius="50%"}break;case"rect":{if(e.length!==4){console.error("Invalid rectangle coordinates:",e);return}let[s,a,l,c]=e,d=s/i*100,h=a/o*100,g=l/i*100,m=c/o*100;r.style.left=d+"%",r.style.top=h+"%",r.style.width=g-d+"%",r.style.height=m-h+"%"}break;case"ellipse":{if(e.length!==4){console.error("Invalid ellipse coordinates:",e);return}let[s,a,l,c]=e,d=s/i*100,h=a/o*100,g=l/i*100,m=c/o*100;r.style.left=d-g+"%",r.style.top=h-m+"%",r.style.width=2*g+"%",r.style.height=2*m+"%",r.style.borderRadius="50%"}break;case"poly":{if(e.length<6||e.length%2!==0){console.error("Invalid polygon coordinates:",e);return}let s=[];for(let v=0;v<e.length;v+=2)s.push({x:e[v],y:e[v+1]});let a=Math.min(...s.map(v=>v.x)),l=Math.max(...s.map(v=>v.x)),c=Math.min(...s.map(v=>v.y)),d=Math.max(...s.map(v=>v.y)),h=a/i*100,g=c/o*100,m=l/i*100,w=d/o*100;r.style.left=h+"%",r.style.top=g+"%",r.style.width=m-h+"%",r.style.height=w-g+"%";let x=s.map(v=>({x:(v.x-a)/(l-a)*100,y:(v.y-c)/(d-c)*100})),f=x.map(v=>`${v.x}% ${v.y}%`).join(",");r.style.clipPath=`polygon(${f})`;let u=x.map(v=>`${v.x},${v.y}`).join(" "),y=v=>`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='${v}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;r.style.setProperty("--qti-shape-outline",y(4)),r.style.setProperty("--qti-shape-outline-bold",y(8))}break;default:console.error(`Unsupported shape: ${n}`);break}}var $d=[R,U,q`
6894
7268
  /* Containing block for the absolutely positioned hotspots over the image. Was on this host in
6895
7269
  the theme, together with a 'display: block' this component now owns. */
6896
7270
  :host {
@@ -6920,7 +7294,7 @@ CES.load();
6920
7294
  top: 0px;
6921
7295
  left: 0px;
6922
7296
  }
6923
- `];var Li=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Te=class extends D{static{this.styles=$d}#e;#t;#r;constructor(){super(),this.#t=null,this.#r=null,this._response=[],this.addEventListener("qti-register-hotspot",this.#o)}reset(){this._response=[]}validate(){return this.#n().length>0}set response(e){this._response=this.#i(e)}get response(){return this._response}#i(e){return e==null||e===""?[]:Array.isArray(e)?e:[e]}#n(){return this.#i(this._response)}renderSupplementalLines(){return P}render(){return b`<slot name="prompt"></slot>
7297
+ `];var Li=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Re=class extends D{static{this.styles=$d}#e;#t;#r;constructor(){super(),this.#t=null,this.#r=null,this._response=[],this.addEventListener("qti-register-hotspot",this.#o)}reset(){this._response=[]}validate(){return this.#n().length>0}set response(e){this._response=this.#i(e)}get response(){return this._response}#i(e){return e==null||e===""?[]:Array.isArray(e)?e:[e]}#n(){return this.#i(this._response)}renderSupplementalLines(){return P}render(){return b`<slot name="prompt"></slot>
6924
7298
  <line-container>
6925
7299
  <svg
6926
7300
  width=${ze(this.grImage[0]?.width)}
@@ -6952,7 +7326,7 @@ CES.load();
6952
7326
  </svg>
6953
7327
  <slot></slot>
6954
7328
  </line-container>
6955
- <div role="alert" part="message" id="validation-message"></div>`}#o(e){let t=this.querySelector("img"),r=e.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));kt(o,s,t,r)}firstUpdated(){super.firstUpdated(),this.#e=this.querySelectorAll("qti-associable-hotspot"),this.addEventListener("mousemove",e=>{let t=this.grImage[0];if(!t)return;let r=t.getBoundingClientRect();this.mouseCoord={x:e.clientX-r.left,y:e.clientY-r.top}}),this.#e.forEach(e=>{e.style.left=e.getAttribute("coords").split(",")[0]+"px",e.style.top=e.getAttribute("coords").split(",")[1]+"px",e.addEventListener("click",t=>{this.#t?this.#r||(this.#r=t.target,this._response=this.#n(),this._response=[...this._response,`${this.#t.getAttribute("identifier")} ${this.#r.getAttribute("identifier")}`],this.saveResponse(this.response),this.#t=null,this.#r=null):(this.#t=t.target,this.startCoord={x:parseInt(this.#t.getAttribute("coords").split(",")[0]),y:parseInt(this.#t.getAttribute("coords").split(",")[1])})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};Li([_()],Te.prototype,"startCoord",void 0);Li([_()],Te.prototype,"mouseCoord",void 0);Li([Vl({selector:"img"})],Te.prototype,"grImage",void 0);Li([_()],Te.prototype,"_response",void 0);Li([p({attribute:"response",reflect:!1,noAccessor:!0,converter:$e({emptyAs:[]})})],Te.prototype,"response",null);var xn=[{tag:"qti-graphic-associate-interaction",ctor:Te}];var Ld=[R,U,q`
7329
+ <div role="alert" part="message" id="validation-message"></div>`}#o(e){let t=this.querySelector("img"),r=e.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));St(o,s,t,r)}firstUpdated(){super.firstUpdated(),this.#e=this.querySelectorAll("qti-associable-hotspot"),this.addEventListener("mousemove",e=>{let t=this.grImage[0];if(!t)return;let r=t.getBoundingClientRect();this.mouseCoord={x:e.clientX-r.left,y:e.clientY-r.top}}),this.#e.forEach(e=>{e.style.left=e.getAttribute("coords").split(",")[0]+"px",e.style.top=e.getAttribute("coords").split(",")[1]+"px",e.addEventListener("click",t=>{this.#t?this.#r||(this.#r=t.target,this._response=this.#n(),this._response=[...this._response,`${this.#t.getAttribute("identifier")} ${this.#r.getAttribute("identifier")}`],this.saveResponse(this.response),this.#t=null,this.#r=null):(this.#t=t.target,this.startCoord={x:parseInt(this.#t.getAttribute("coords").split(",")[0]),y:parseInt(this.#t.getAttribute("coords").split(",")[1])})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};Li([_()],Re.prototype,"startCoord",void 0);Li([_()],Re.prototype,"mouseCoord",void 0);Li([Vl({selector:"img"})],Re.prototype,"grImage",void 0);Li([_()],Re.prototype,"_response",void 0);Li([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Le({emptyAs:[]})})],Re.prototype,"response",null);var xn=[{tag:"qti-graphic-associate-interaction",ctor:Re}];var Ld=[R,U,q`
6956
7330
  :host {
6957
7331
  display: flex;
6958
7332
  align-items: flex-start;
@@ -7009,7 +7383,7 @@ CES.load();
7009
7383
  user-select: none;
7010
7384
  pointer-events: none;
7011
7385
  }
7012
- `];var ou=Ie(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),Rr=class extends _e(ou,'[qti-draggable="true"]'){static{this.styles=Ld}render(){return b` <slot name="prompt"></slot>
7386
+ `];var ou=_e(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),Rr=class extends Te(ou,'[qti-draggable="true"]'){static{this.styles=Ld}render(){return b` <slot name="prompt"></slot>
7013
7387
  <slot part="image"></slot>
7014
7388
  <slot part="drags" name="drags" class="hover-border"></slot>
7015
7389
  <div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#e(e){let t=e.target,r=t.getAttribute("coords"),i=t.getAttribute("shape"),o=r.split(",").map(s=>parseInt(s));switch(i){case"circle":{let[s,a,l]=o;t.style.left=s-l+"px",t.style.top=a-l+"px",t.style.width=t.style.height=2*l+"px"}break;case"rect":{let[s,a,l,c]=o;t.style.left=s+"px",t.style.top=a+"px",t.style.width=l-s+"px",t.style.height=c-a+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#e)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#e)}};var qn=[{tag:"qti-graphic-gap-match-interaction",ctor:Rr}];var Vd=[R,U,q`
@@ -7050,11 +7424,11 @@ CES.load();
7050
7424
  pointer-events: none;
7051
7425
  user-select: none;
7052
7426
  }
7053
- `];var Or=class n extends Ct(D,"qti-hotspot-choice"){constructor(){super(...arguments),this._choiceElements=[]}static{this.styles=Vd}static#e="cito-graphic-order-marker";render(){return b`
7427
+ `];var Or=class n extends Et(D,"qti-hotspot-choice"){constructor(){super(...arguments),this._choiceElements=[]}static{this.styles=Vd}static#e="cito-graphic-order-marker";render(){return b`
7054
7428
  <slot name="prompt"></slot>
7055
7429
  <slot></slot>
7056
7430
  <div role="alert" part="message" id="validation-message"></div>
7057
- `}#t(e){let{identifier:t}=e.detail,r=this._choiceElements.find(o=>o.getAttribute("identifier")===t);if(!r)return;let i=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){let o=this._choiceElements.filter(s=>s.order!=null).length;if(o>=i){this.choiceOrdering=!1;return}r.order=o+1}else{let o=r.order;r.order=null,this._choiceElements.forEach(s=>{s.order!=null&&s.order>o&&s.order--})}this.refreshLocatorPins(),this.choiceOrdering=!1}}#r(e){return`--qti-graphic-order-${(e.identifier||e.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(e){return"var(--qti-selected-bg)"}refreshLocatorPins(){this.querySelectorAll(`.${n.#e}`).forEach(t=>t.remove()),this._choiceElements.forEach(t=>{t.style.removeProperty("anchor-name")}),this._choiceElements.filter(t=>t.order!=null).sort((t,r)=>t.order-r.order).forEach(t=>{let r=this.#r(t);t.style.setProperty("anchor-name",r);let i=document.createElement("span");i.className=n.#e,i.style.setProperty("position-anchor",r),i.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(t)),t.getAttribute("shape")==="poly"&&i.classList.add("cito-graphic-order-marker--poly"),i.setAttribute("aria-hidden","true"),i.textContent=String(t.order),this.append(i)})}#i(e){let t=this.querySelector("img"),r=e.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));kt(o,s,t,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.#t),this.addEventListener("register-qti-hotspot-choice",this.#i),this.refreshLocatorPins()}disconnectedCallback(){this.querySelectorAll(`.${n.#e}`).forEach(e=>e.remove()),super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.#t),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var Cn=[{tag:"qti-graphic-order-interaction",ctor:Or}];var zd=[R,U,q`
7431
+ `}#t(e){let{identifier:t}=e.detail,r=this._choiceElements.find(o=>o.getAttribute("identifier")===t);if(!r)return;let i=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){let o=this._choiceElements.filter(s=>s.order!=null).length;if(o>=i){this.choiceOrdering=!1;return}r.order=o+1}else{let o=r.order;r.order=null,this._choiceElements.forEach(s=>{s.order!=null&&s.order>o&&s.order--})}this.refreshLocatorPins(),this.choiceOrdering=!1}}#r(e){return`--qti-graphic-order-${(e.identifier||e.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(e){return"var(--qti-selected-bg)"}refreshLocatorPins(){this.querySelectorAll(`.${n.#e}`).forEach(t=>t.remove()),this._choiceElements.forEach(t=>{t.style.removeProperty("anchor-name")}),this._choiceElements.filter(t=>t.order!=null).sort((t,r)=>t.order-r.order).forEach(t=>{let r=this.#r(t);t.style.setProperty("anchor-name",r);let i=document.createElement("span");i.className=n.#e,i.style.setProperty("position-anchor",r),i.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(t)),t.getAttribute("shape")==="poly"&&i.classList.add("cito-graphic-order-marker--poly"),i.setAttribute("aria-hidden","true"),i.textContent=String(t.order),this.append(i)})}#i(e){let t=this.querySelector("img"),r=e.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));St(o,s,t,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.#t),this.addEventListener("register-qti-hotspot-choice",this.#i),this.refreshLocatorPins()}disconnectedCallback(){this.querySelectorAll(`.${n.#e}`).forEach(e=>e.remove()),super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.#t),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var Cn=[{tag:"qti-graphic-order-interaction",ctor:Or}];var zd=[R,U,q`
7058
7432
  :host {
7059
7433
  display: block;
7060
7434
  }
@@ -7103,16 +7477,16 @@ CES.load();
7103
7477
  max-width: 100%;
7104
7478
  height: auto;
7105
7479
  }
7106
- `];var Pr=class extends Ct(D,"qti-hotspot-choice"){static{this.styles=zd}render(){return b`
7480
+ `];var Pr=class extends Et(D,"qti-hotspot-choice"){static{this.styles=zd}render(){return b`
7107
7481
  <slot name="prompt"></slot>
7108
7482
  <slot></slot>
7109
7483
  <div part="message" role="alert" id="validation-message"></div>
7110
- `}#e=null;#t(e){return this.#e||(e.naturalWidth>0&&e.naturalHeight>0?this.#e=Promise.resolve(e):this.#e=new Promise(t=>{let r=()=>{e.removeEventListener("load",r),t(e)};e.addEventListener("load",r)})),this.#e}async#r(e){let t=this.querySelector("img"),r=e.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),s=i.split(",").map(l=>parseInt(l)),a=await this.#t(t);kt(o,s,a,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#r)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.#r)}};var En=[{tag:"qti-hotspot-interaction",ctor:Pr}];var jd=[R,U,q`
7484
+ `}#e=null;#t(e){return this.#e||(e.naturalWidth>0&&e.naturalHeight>0?this.#e=Promise.resolve(e):this.#e=new Promise(t=>{let r=()=>{e.removeEventListener("load",r),t(e)};e.addEventListener("load",r)})),this.#e}async#r(e){let t=this.querySelector("img"),r=e.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),s=i.split(",").map(l=>parseInt(l)),a=await this.#t(t);St(o,s,a,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#r)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.#r)}};var En=[{tag:"qti-hotspot-interaction",ctor:Pr}];var jd=[R,U,q`
7111
7485
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
7112
7486
  :host {
7113
7487
  display: block;
7114
7488
  }
7115
- `];var Mr=class extends Ct(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>b`<slot></slot>
7489
+ `];var Mr=class extends Et(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>b`<slot></slot>
7116
7490
  <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=jd}};var kn=[{tag:"qti-hottext-interaction",ctor:Mr}];var Va=(n,e="[part='menu']",t="[part='trigger']",r="--qti-inline-choice-width")=>{class i extends n{#e=null;#t=null;#r=null;#i=0;#n=null;shouldAutoSizeMenu(){return!1}menuAutoSizeExtraWidth(){return 0}menuAutoSizePropertyTarget(){return this.renderRoot?.querySelector(t)??null}menuAutoSizeRows(){let s=this.renderRoot?.querySelector(e);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(e);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(e);a&&this.#l(a),this.#s();let l=this.#o()+this.menuAutoSizeExtraWidth();l<=0||l===this.#n||(this.#n=l,s.style.setProperty(r,`${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(e);if(!a)return s;let l=getComputedStyle(a);return s+parseFloat(l.paddingLeft)+parseFloat(l.paddingRight)+parseFloat(l.borderLeftWidth)+parseFloat(l.borderRightWidth)})}#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()}))}#l(s){typeof ResizeObserver>"u"||this.#t===s||(this.#e??=new ResizeObserver(()=>{this.#t?.matches(":popover-open")&&this.#a()}),this.#t&&this.#e.unobserve(this.#t),this.#e.observe(s),this.#t=s)}disconnectedCallback(){this.#e?.disconnect(),this.#e=null,this.#t=null,this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return i};var nu=q`
7117
7491
  /* ── Host ──────────────────────────────────────────────────────────────────
7118
7492
  Inline-block so the element flows with surrounding text.
@@ -7496,7 +7870,7 @@ CES.load();
7496
7870
  justify-content: center;
7497
7871
  flex-shrink: 0;
7498
7872
  }
7499
- `];var za=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ot=class extends _e(Ie(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"),'[qti-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=e=>{let t=e.target;this.lastCheckedRadio===t?(t.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=t},this.handleRadioChange=e=>{let t=e.target,r=t.value,i=t.name,o=t.type;t.checked?(this.response?this.response.indexOf(r)===-1&&(o==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(i)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=t):(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=[Bd,Ud]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(e){this.classList.contains("qti-match-tabular")?this._response=e:super.response=e}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...e){this.classList.contains("qti-match-tabular")||super.initiateDrag(...e)}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(e){super.willUpdate?.(e),e.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let e=this.classList.contains("qti-match-tabular"),t=this.querySelectorAll(":scope > qti-simple-match-set"),r=t[0],i=t[1],o=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};e?(r?.setAttribute("slot","match-rows"),i?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{o(s),s.setAttribute("role","rowheader")}),this.targetChoices?.forEach(s=>{o(s),s.setAttribute("role","columnheader")})):(r?.removeAttribute("slot"),i?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>s.removeAttribute("role")),this.targetChoices?.forEach(s=>s.removeAttribute("role")))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(e,t){return""}render(){let e=this.class.split(" ").includes("qti-match-tabular");return b`
7873
+ `];var za=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ot=class extends Te(_e(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"),'[qti-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=e=>{let t=e.target;this.lastCheckedRadio===t?(t.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=t},this.handleRadioChange=e=>{let t=e.target,r=t.value,i=t.name,o=t.type;t.checked?(this.response?this.response.indexOf(r)===-1&&(o==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(i)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=t):(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=[Bd,Ud]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(e){this.classList.contains("qti-match-tabular")?this._response=e:super.response=e}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...e){this.classList.contains("qti-match-tabular")||super.initiateDrag(...e)}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(e){super.willUpdate?.(e),e.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let e=this.classList.contains("qti-match-tabular"),t=this.querySelectorAll(":scope > qti-simple-match-set"),r=t[0],i=t[1],o=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};e?(r?.setAttribute("slot","match-rows"),i?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{o(s),s.setAttribute("role","rowheader")}),this.targetChoices?.forEach(s=>{o(s),s.setAttribute("role","columnheader")})):(r?.removeAttribute("slot"),i?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>s.removeAttribute("role")),this.targetChoices?.forEach(s=>s.removeAttribute("role")))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(e,t){return""}render(){let e=this.class.split(" ").includes("qti-match-tabular");return b`
7500
7874
  <slot name="prompt"></slot>
7501
7875
  <slot ?hidden=${e}></slot>
7502
7876
 
@@ -7512,7 +7886,7 @@ CES.load();
7512
7886
  <div part="checkbox-grid">
7513
7887
  ${this.sourceChoices.map((t,r)=>b`
7514
7888
  <div role="row" style="display: contents;">
7515
- ${this.targetChoices.map((i,o)=>{let s=t.getAttribute("identifier"),a=i.getAttribute("identifier"),l=`${s} ${a}`,c=(this.response||[]).filter(u=>u.split(" ")[0]===s).length||0,d=this.response?.includes(l)||!1,h=t.matchMax===1?"radio":"checkbox",g=this.getCellStateVariant(l,d),f=d?"checked":"",w=`control ${h} ${f} ${g}`.trim(),x=`control-mark ${h} ${f} ${g}`.trim(),m=t.matchMax===1?!1:t.matchMax!==0&&c>=t.matchMax&&!d;return b`
7889
+ ${this.targetChoices.map((i,o)=>{let s=t.getAttribute("identifier"),a=i.getAttribute("identifier"),l=`${s} ${a}`,c=(this.response||[]).filter(u=>u.split(" ")[0]===s).length||0,d=this.response?.includes(l)||!1,h=t.matchMax===1?"radio":"checkbox",g=this.getCellStateVariant(l,d),m=d?"checked":"",w=`control ${h} ${m} ${g}`.trim(),x=`control-mark ${h} ${m} ${g}`.trim(),f=t.matchMax===1?!1:t.matchMax!==0&&c>=t.matchMax&&!d;return b`
7516
7890
  <label
7517
7891
  part="input-cell"
7518
7892
  role="gridcell"
@@ -7524,7 +7898,7 @@ CES.load();
7524
7898
  name=${s}
7525
7899
  value=${l}
7526
7900
  .checked=${d}
7527
- .disabled=${m}
7901
+ .disabled=${f}
7528
7902
  @change=${u=>this.handleRadioChange(u)}
7529
7903
  @click=${u=>t.matchMax===1?this.handleRadioClick(u):null}
7530
7904
  />
@@ -7546,7 +7920,7 @@ CES.load();
7546
7920
  display: block;
7547
7921
  }
7548
7922
  `];var In=class extends D{static{this.styles=Hd}#e=null;reset(){this.#e=null}validate(){return!0}get response(){return this.#e?this.#e.toString():null}set response(e){if(e)if(!isNaN(parseInt(e?.toString())))this.#e=parseInt(e.toString());else throw new Error(`Value must be a number ${e}`)}static get properties(){return{...D.properties,step:{type:Number,attribute:"step",default:10}}}render(){return b` <slot name="prompt"></slot>
7549
- <slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this.#e++,this.saveResponse(this.value)})}};var _n=[{tag:"qti-media-interaction",ctor:In}];var Wd=[R,U,Ne,q`
7923
+ <slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this.#e++,this.saveResponse(this.value)})}};var _n=[{tag:"qti-media-interaction",ctor:In}];var Wd=[R,U,$e,q`
7550
7924
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
7551
7925
  :host {
7552
7926
  display: block;
@@ -7756,7 +8130,7 @@ CES.load();
7756
8130
  :host([answer-key]) [part~='drags'] {
7757
8131
  display: none;
7758
8132
  }
7759
- `];var Qd=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},lu=Ie(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),St=class extends _e(lu,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=Wd}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),b` <slot name="prompt"> </slot>
8133
+ `];var Qd=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},lu=_e(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),At=class extends Te(lu,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=Wd}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),b` <slot name="prompt"> </slot>
7760
8134
  <div part="container">
7761
8135
  <slot part="drags"> </slot>
7762
8136
  <div part="drops">
@@ -7765,7 +8139,7 @@ CES.load();
7765
8139
  </div>`})}
7766
8140
  </div>
7767
8141
  <div id="validation-message" part="message" role="alert" style="display:none;"></div>
7768
- </div>`}getValue(e){return e?.map((t,r)=>`${t} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(t=>this.chipsIn(t).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};Qd([_()],St.prototype,"nrChoices",void 0);Qd([p({type:String})],St.prototype,"orientation",void 0);var Tn=[{tag:"qti-order-interaction",ctor:St}];var Gd=[R,q`
8142
+ </div>`}getValue(e){return e?.map((t,r)=>`${t} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(t=>this.chipsIn(t).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};Qd([_()],At.prototype,"nrChoices",void 0);Qd([p({type:String})],At.prototype,"orientation",void 0);var Tn=[{tag:"qti-order-interaction",ctor:At}];var Gd=[R,q`
7769
8143
  :host {
7770
8144
  display: block;
7771
8145
  width: 100%;
@@ -7775,7 +8149,7 @@ CES.load();
7775
8149
  ::slotted(qti-interaction-markup) {
7776
8150
  display: none;
7777
8151
  }
7778
- `];var ye=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},cu=["solution","review"];function du(n){return n==null?!1:Array.isArray(n)?n.length>0:n!==""}var W=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#t=null,this._errorMessage=null,this.response=null,this.#i=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=e=>{let{data:t}=e;if(!(!t||t.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||e.source!==this.iframe.contentWindow)&&!(t.responseIdentifier&&t.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=e.origin;else if(e.origin!==this._iframeMessageOrigin)return;switch(t.method){case"iframeReady":this._interactionReady=!0,this.#x(),this.#q(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof t.height=="number"&&this.iframe&&(this.iframe.style.height=`${t.height}px`,this.iframe.style.width=`${t.width}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:t.level,args:t.args},bubbles:!0}));break;case"interactionChanged":{let r=t?.params?.value,i=r&&typeof r=="object"?this.#u(r):null,o=typeof t?.params?.valid=="boolean"?t.params.valid:null,s=typeof t?.params?.customValidity=="string"?t.params.customValidity:null;o!==null&&(this.#o=o,o&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=t?.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(i===null){let c=this.responseVariable?.cardinality==="single"?"":[];this.response=c,this.validate(),this.saveResponse(c,l);break}this.response=i,this.validate(),this.saveResponse(i,l);break}case"error":this._errorMessage=t.params.message,console.error("Error from PCI iframe:",t.params.message);break}}},this.#g=null}#e;static{this.styles=[Gd,q`
8152
+ `];var ve=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},cu=["solution","review"];function du(n){return n==null?!1:Array.isArray(n)?n.length>0:n!==""}var W=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#t=null,this._errorMessage=null,this.response=null,this.#i=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=e=>{let{data:t}=e;if(!(!t||t.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||e.source!==this.iframe.contentWindow)&&!(t.responseIdentifier&&t.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=e.origin;else if(e.origin!==this._iframeMessageOrigin)return;switch(t.method){case"iframeReady":this._interactionReady=!0,this.#x(),this.#q(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof t.height=="number"&&this.iframe&&(this.iframe.style.height=`${t.height}px`,this.iframe.style.width=`${t.width}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:t.level,args:t.args},bubbles:!0}));break;case"interactionChanged":{let r=t?.params?.value,i=r&&typeof r=="object"?this.#u(r):null,o=typeof t?.params?.valid=="boolean"?t.params.valid:null,s=typeof t?.params?.customValidity=="string"?t.params.customValidity:null;o!==null&&(this.#o=o,o&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=t?.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(i===null){let c=this.responseVariable?.cardinality==="single"?"":[];this.response=c,this.validate(),this.saveResponse(c,l);break}this.response=i,this.validate(),this.saveResponse(i,l);break}case"error":this._errorMessage=t.params.message,console.error("Error from PCI iframe:",t.params.message);break}}},this.#g=null}#e;static{this.styles=[Gd,q`
7779
8153
  :host {
7780
8154
  display: block;
7781
8155
  width: 100%;
@@ -8679,7 +9053,7 @@ CES.load();
8679
9053
  <h1>Error</h1>
8680
9054
  ${this._errorMessage}
8681
9055
  </div>`:""}
8682
- `}};ye([p({type:String,attribute:"module"})],W.prototype,"module",void 0);ye([p({type:String,attribute:"custom-interaction-type-identifier"})],W.prototype,"customInteractionTypeIdentifier",void 0);ye([p({type:String,attribute:"data-require-paths"})],W.prototype,"requirePathsJson",void 0);ye([p({type:String,attribute:"data-require-shim"})],W.prototype,"requireShimJson",void 0);ye([p({type:String,attribute:"data-require-js-url"})],W.prototype,"requireJsUrl",void 0);ye([p({type:String,attribute:"data-base-url"})],W.prototype,"baseUrl",void 0);ye([p({type:Boolean,attribute:"data-use-default-paths"})],W.prototype,"useDefaultPaths",void 0);ye([p({type:String,attribute:"data-status"})],W.prototype,"status",void 0);ye([_()],W.prototype,"_errorMessage",void 0);ye([T({context:j,subscribe:!0}),_()],W.prototype,"context",void 0);ye([T({context:he,subscribe:!0}),_()],W.prototype,"qtiContext",void 0);ye([p({attribute:"response",reflect:!1,converter:$e({emptyAs:null})})],W.prototype,"response",void 0);var Rn=class extends W{#e=!1;async waitForReady(e=5e3){this._interactionReady||await new Promise((t,r)=>{let i=()=>{window.clearTimeout(o),t()},o=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",i),r(new Error(`Portable custom interaction did not become ready within ${e}ms`))},e);this.addEventListener("qti-portable-custom-interaction-loaded",i,{once:!0})})}async getIFrameContent(){return new Promise(e=>{let t=`get-content-${Date.now()}`,r=i=>{let{data:o}=i;o?.source==="qti-pci-iframe"&&(!o?.responseIdentifier||o?.responseIdentifier===this.responseIdentifier)&&o?.method==="getContentResponse"&&o?.messageId===t&&(window.removeEventListener("message",r),e(o.content))};window.addEventListener("message",r),this.sendMessageToIframe("getContent",{messageId:t}),setTimeout(()=>{window.removeEventListener("message",r),e("")},5e3)})}setTestContext(e){this.context=e,this.updateComplete.then(()=>{this.value=e?.variables?.find(t=>t.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#e=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#e=!1}}disconnectedCallback(){this.#e||super.disconnectedCallback()}async iFrameMouseClick(e,t){return new Promise(r=>{let i=`click-${Date.now()}`,o=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",o),r())};window.addEventListener("message",o),this.sendMessageToIframe("simulateClick",{x:e,y:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",o),r()},5e3)})}async iFrameClickOnElement(e){return new Promise(t=>{let r=`click-selector-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),t(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),t(!1)},5e3)})}async iFrameClickOnElementByText(e){return new Promise(t=>{let r=`click-text-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),t(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),t(!1)},5e3)})}async iFrameSetValueElement(e,t){return new Promise(r=>{let i=`set-value-${Date.now()}`,o=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",o),r(a.success))};window.addEventListener("message",o),this.sendMessageToIframe("setValueElement",{selector:e,value:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",o),r(!1)},5e3)})}async iFrameGetBoundingClientRect(e){return new Promise(t=>{let r=`get-bounding-rect-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),t(s.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),t(null)},5e3)})}async iFrameSetValueElementByText(e,t){return new Promise(r=>{let i=`set-value-text-${Date.now()}`,o=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",o),r(a.success))};window.addEventListener("message",o),this.sendMessageToIframe("setValueElementByText",{text:e,value:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",o),r(!1)},5e3)})}async iFrameMousedownOnElement(e){return new Promise(t=>{let r=`mousedown-selector-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),t(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),t(!1)},5e3)})}generateIframeContent(){let e=super.generateIframeContent(),t=`
9056
+ `}};ve([p({type:String,attribute:"module"})],W.prototype,"module",void 0);ve([p({type:String,attribute:"custom-interaction-type-identifier"})],W.prototype,"customInteractionTypeIdentifier",void 0);ve([p({type:String,attribute:"data-require-paths"})],W.prototype,"requirePathsJson",void 0);ve([p({type:String,attribute:"data-require-shim"})],W.prototype,"requireShimJson",void 0);ve([p({type:String,attribute:"data-require-js-url"})],W.prototype,"requireJsUrl",void 0);ve([p({type:String,attribute:"data-base-url"})],W.prototype,"baseUrl",void 0);ve([p({type:Boolean,attribute:"data-use-default-paths"})],W.prototype,"useDefaultPaths",void 0);ve([p({type:String,attribute:"data-status"})],W.prototype,"status",void 0);ve([_()],W.prototype,"_errorMessage",void 0);ve([T({context:j,subscribe:!0}),_()],W.prototype,"context",void 0);ve([T({context:he,subscribe:!0}),_()],W.prototype,"qtiContext",void 0);ve([p({attribute:"response",reflect:!1,converter:Le({emptyAs:null})})],W.prototype,"response",void 0);var Rn=class extends W{#e=!1;async waitForReady(e=5e3){this._interactionReady||await new Promise((t,r)=>{let i=()=>{window.clearTimeout(o),t()},o=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",i),r(new Error(`Portable custom interaction did not become ready within ${e}ms`))},e);this.addEventListener("qti-portable-custom-interaction-loaded",i,{once:!0})})}async getIFrameContent(){return new Promise(e=>{let t=`get-content-${Date.now()}`,r=i=>{let{data:o}=i;o?.source==="qti-pci-iframe"&&(!o?.responseIdentifier||o?.responseIdentifier===this.responseIdentifier)&&o?.method==="getContentResponse"&&o?.messageId===t&&(window.removeEventListener("message",r),e(o.content))};window.addEventListener("message",r),this.sendMessageToIframe("getContent",{messageId:t}),setTimeout(()=>{window.removeEventListener("message",r),e("")},5e3)})}setTestContext(e){this.context=e,this.updateComplete.then(()=>{this.value=e?.variables?.find(t=>t.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#e=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#e=!1}}disconnectedCallback(){this.#e||super.disconnectedCallback()}async iFrameMouseClick(e,t){return new Promise(r=>{let i=`click-${Date.now()}`,o=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",o),r())};window.addEventListener("message",o),this.sendMessageToIframe("simulateClick",{x:e,y:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",o),r()},5e3)})}async iFrameClickOnElement(e){return new Promise(t=>{let r=`click-selector-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),t(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),t(!1)},5e3)})}async iFrameClickOnElementByText(e){return new Promise(t=>{let r=`click-text-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),t(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),t(!1)},5e3)})}async iFrameSetValueElement(e,t){return new Promise(r=>{let i=`set-value-${Date.now()}`,o=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",o),r(a.success))};window.addEventListener("message",o),this.sendMessageToIframe("setValueElement",{selector:e,value:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",o),r(!1)},5e3)})}async iFrameGetBoundingClientRect(e){return new Promise(t=>{let r=`get-bounding-rect-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),t(s.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),t(null)},5e3)})}async iFrameSetValueElementByText(e,t){return new Promise(r=>{let i=`set-value-text-${Date.now()}`,o=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",o),r(a.success))};window.addEventListener("message",o),this.sendMessageToIframe("setValueElementByText",{text:e,value:t,messageId:i}),setTimeout(()=>{window.removeEventListener("message",o),r(!1)},5e3)})}async iFrameMousedownOnElement(e){return new Promise(t=>{let r=`mousedown-selector-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),t(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:e,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),t(!1)},5e3)})}generateIframeContent(){let e=super.generateIframeContent(),t=`
8683
9057
  // Test helper functions for QtiPortableCustomInteractionTest
8684
9058
  // Base iframe implementation already provides PCIManager.getContent
8685
9059
 
@@ -8888,7 +9262,7 @@ CES.load();
8888
9262
  display: inline-block;
8889
9263
  position: relative;
8890
9264
  }
8891
- `];var Mn=class extends C{static{this.styles=Yd}render(){return b`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(e){e.preventDefault();let t=e.clientX-this.startX,r=e.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+t+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=e.clientX,this.startY=e.clientY}firstUpdated(e){super.firstUpdated(e),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",t=>{this.startX=t.clientX,this.startY=t.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};var Dn=[{tag:"qti-position-object-interaction",ctor:Pn},{tag:"qti-position-object-stage",ctor:Mn}];var Kd="important",hu=" !"+Kd,Nn=qe(class extends dt{constructor(n){if(super(n),n.type!==ur.ATTRIBUTE||n.name!=="style"||n.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(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];return r==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(n,[e]){let{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes("-")?t.removeProperty(r):t[r]=null);for(let r in e){let i=e[r];if(i!=null){this.ft.add(r);let o=typeof i=="string"&&i.endsWith(hu);r.includes("-")||o?t.setProperty(r,o?i.slice(0,-11):i,o?Kd:""):t[r]=i}}return Z}});var Jd=[R,q`
9265
+ `];var Mn=class extends C{static{this.styles=Yd}render(){return b`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(e){e.preventDefault();let t=e.clientX-this.startX,r=e.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+t+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=e.clientX,this.startY=e.clientY}firstUpdated(e){super.firstUpdated(e),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",t=>{this.startX=t.clientX,this.startY=t.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};var Dn=[{tag:"qti-position-object-interaction",ctor:Pn},{tag:"qti-position-object-stage",ctor:Mn}];var Kd="important",hu=" !"+Kd,Nn=Ce(class extends ht{constructor(n){if(super(n),n.type!==ur.ATTRIBUTE||n.name!=="style"||n.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(n){return Object.keys(n).reduce((e,t)=>{let r=n[t];return r==null?e:e+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(n,[e]){let{style:t}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(e)),this.render(e);for(let r of this.ft)e[r]==null&&(this.ft.delete(r),r.includes("-")?t.removeProperty(r):t[r]=null);for(let r in e){let i=e[r];if(i!=null){this.ft.add(r);let o=typeof i=="string"&&i.endsWith(hu);r.includes("-")||o?t.setProperty(r,o?i.slice(0,-11):i,o?Kd:""):t[r]=i}}return Z}});var Jd=[R,q`
8892
9266
  :host {
8893
9267
  display: block;
8894
9268
  --qti-select-point-marker-size: 1.5rem;
@@ -8923,7 +9297,7 @@ CES.load();
8923
9297
  -webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
8924
9298
  mask: var(--qti-select-point-icon) no-repeat center / contain;
8925
9299
  }
8926
- `];var Dr=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ce=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleAreaMappingsChange=()=>{this.#e()},this.#t=null,this.#r=1,this.#i=1,this.#n=0,this.#o=0,this.#s=e=>{if(this.disabled)return;if(!this.#t){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#l();let t=this.#t.getBoundingClientRect(),r=(e.clientX-t.left)*this.#r,i=(e.clientY-t.top)*this.#i,o=`${r.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[o]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],o]),this.saveResponse(this.response)},this.#a=()=>{this.#l()}}static{this.styles=Jd}#e(){try{let e=JSON.parse(this.areaMappings||"[]");if(!Array.isArray(e)){this._areaEntries=[];return}this._areaEntries=e.filter(t=>t&&(t.shape==="circle"||t.shape==="rect")&&typeof t.coords=="string").map(t=>({shape:t.shape,coords:String(t.coords),mappedValue:Number(t.mappedValue??1),defaultValue:Number(t.defaultValue??0)}))}catch{this._areaEntries=[]}}get _effectiveAreaEntries(){let e=this.responseVariable?.areaMapping?.areaMapEntries;return e?.length?e:this._areaEntries}#t;#r;#i;#n;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let e=this.response;return(Array.isArray(e)?e:e?[e]:[]).filter(r=>r).map(r=>{let[i,o]=r.split(" ").map(Number);return{x:i,y:o}})}pointPart(e,t){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(e){let t=this.#t;if(t){this.#l();for(let r of e){let i=r.dataset.coord,o=r.dataset.shape;!i||!o||kt(o,i.split(",").map(s=>+s),t,r)}}}render(){let e=this.response,t=Array.isArray(e)?e:e?[e]:[];return b` <slot name="prompt"></slot>
9300
+ `];var Dr=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ce=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleAreaMappingsChange=()=>{this.#e()},this.#t=null,this.#r=1,this.#i=1,this.#n=0,this.#o=0,this.#s=e=>{if(this.disabled)return;if(!this.#t){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#l();let t=this.#t.getBoundingClientRect(),r=(e.clientX-t.left)*this.#r,i=(e.clientY-t.top)*this.#i,o=`${r.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[o]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],o]),this.saveResponse(this.response)},this.#a=()=>{this.#l()}}static{this.styles=Jd}#e(){try{let e=JSON.parse(this.areaMappings||"[]");if(!Array.isArray(e)){this._areaEntries=[];return}this._areaEntries=e.filter(t=>t&&(t.shape==="circle"||t.shape==="rect")&&typeof t.coords=="string").map(t=>({shape:t.shape,coords:String(t.coords),mappedValue:Number(t.mappedValue??1),defaultValue:Number(t.defaultValue??0)}))}catch{this._areaEntries=[]}}get _effectiveAreaEntries(){let e=this.responseVariable?.areaMapping?.areaMapEntries;return e?.length?e:this._areaEntries}#t;#r;#i;#n;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let e=this.response;return(Array.isArray(e)?e:e?[e]:[]).filter(r=>r).map(r=>{let[i,o]=r.split(" ").map(Number);return{x:i,y:o}})}pointPart(e,t){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(e){let t=this.#t;if(t){this.#l();for(let r of e){let i=r.dataset.coord,o=r.dataset.shape;!i||!o||St(o,i.split(",").map(s=>+s),t,r)}}}render(){let e=this.response,t=Array.isArray(e)?e:e?[e]:[];return b` <slot name="prompt"></slot>
8927
9301
  <point-container>
8928
9302
  ${H(t.filter(r=>r),r=>r,(r,i)=>{let[o,s]=r.split(" ").map(Number),a=o/(this.#n||1)*100,l=s/(this.#o||1)*100;return b`
8929
9303
  <button
@@ -9004,7 +9378,7 @@ CES.load();
9004
9378
  text-align: center;
9005
9379
  color: #6b7280; /* text-gray-500 */
9006
9380
  }
9007
- `];var Vi=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ve=class extends D{constructor(){super(...arguments),this.#e=0,this.min=0,this.max=100,this.step=1}static{this.styles=Zd}#e;validate(){return!0}connectedCallback(){super.connectedCallback(),this.hasAttribute("response")||this.#t(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get response(){return this.#e.toString()}set response(e){if(e===null||e==="")return;let t=parseFloat(e);isNaN(t)||this.#t(t)}renderRailSupplement(){return P}#t(e){let t=this.#e;if(this.#e=Math.min(this.max,Math.max(this.min,e)),this.#e===t)return;let r=(this.#e-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${r}%`),this._internals.setFormValue(this.value),this.saveResponse(this.response),this.requestUpdate()}render(){return b`
9381
+ `];var Vi=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},we=class extends D{constructor(){super(...arguments),this.#e=0,this.min=0,this.max=100,this.step=1}static{this.styles=Zd}#e;validate(){return!0}connectedCallback(){super.connectedCallback(),this.hasAttribute("response")||this.#t(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get response(){return this.#e.toString()}set response(e){if(e===null||e==="")return;let t=parseFloat(e);isNaN(t)||this.#t(t)}renderRailSupplement(){return P}#t(e){let t=this.#e;if(this.#e=Math.min(this.max,Math.max(this.min,e)),this.#e===t)return;let r=(this.#e-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${r}%`),this._internals.setFormValue(this.value),this.saveResponse(this.response),this.requestUpdate()}render(){return b`
9008
9382
  <slot name="prompt"></slot>
9009
9383
  <div id="slider" part="slider">
9010
9384
  <div id="bounds" part="bounds">
@@ -9022,7 +9396,7 @@ CES.load();
9022
9396
  ${this.renderRailSupplement()}
9023
9397
  </div>
9024
9398
  </div>
9025
- `}#r(e){this.#n(e.pageX);let t=i=>this.#o(i.pageX),r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),this.#s()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)}#i(e){this.#n(e.touches[0].pageX);let t=i=>this.#o(i.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",r),this.#s()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",r)}#n(e){this.#o(e)}#o(e){let t=this._rail.getBoundingClientRect(),r=e-t.left,i=Math.min(1,Math.max(0,r/t.width)),o=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#t(o)}#s(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};Vi([sr("#rail")],ve.prototype,"_rail",void 0);Vi([p({type:Number,attribute:"lower-bound"})],ve.prototype,"min",void 0);Vi([p({type:Number,attribute:"upper-bound"})],ve.prototype,"max",void 0);Vi([p({type:Number,attribute:"step"})],ve.prototype,"step",void 0);Vi([p({attribute:"response",reflect:!1,noAccessor:!0})],ve.prototype,"response",null);var Ln=[{tag:"qti-slider-interaction",ctor:ve}];var eh=()=>new Fa,Fa=class{},ja=new WeakMap,MR=qe(class extends pt{render(n){return P}update(n,[e]){let t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=n.options?.host,this.rt(this.ct=n.element)),P}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){let e=this.ht??globalThis,t=ja.get(e);t===void 0&&(t=new WeakMap,ja.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){return typeof this.G=="function"?ja.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 th=[R,q`
9399
+ `}#r(e){this.#n(e.pageX);let t=i=>this.#o(i.pageX),r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),this.#s()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)}#i(e){this.#n(e.touches[0].pageX);let t=i=>this.#o(i.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",r),this.#s()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",r)}#n(e){this.#o(e)}#o(e){let t=this._rail.getBoundingClientRect(),r=e-t.left,i=Math.min(1,Math.max(0,r/t.width)),o=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#t(o)}#s(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};Vi([ar("#rail")],we.prototype,"_rail",void 0);Vi([p({type:Number,attribute:"lower-bound"})],we.prototype,"min",void 0);Vi([p({type:Number,attribute:"upper-bound"})],we.prototype,"max",void 0);Vi([p({type:Number,attribute:"step"})],we.prototype,"step",void 0);Vi([p({attribute:"response",reflect:!1,noAccessor:!0})],we.prototype,"response",null);var Ln=[{tag:"qti-slider-interaction",ctor:we}];var eh=()=>new Fa,Fa=class{},ja=new WeakMap,NR=Ce(class extends ut{render(n){return P}update(n,[e]){let t=e!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=e,this.ht=n.options?.host,this.rt(this.ct=n.element)),P}rt(n){if(this.isConnected||(n=void 0),typeof this.G=="function"){let e=this.ht??globalThis,t=ja.get(e);t===void 0&&(t=new WeakMap,ja.set(e,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){return typeof this.G=="function"?ja.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 th=[R,q`
9026
9400
  :host {
9027
9401
  display: inline-flex;
9028
9402
  align-items: center;
@@ -9111,7 +9485,7 @@ CES.load();
9111
9485
  :host(.qti-input-width-72) {
9112
9486
  --qti-input-width: 72;
9113
9487
  }
9114
- `];var er=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ne=class extends D{constructor(){super(...arguments),this.inputRef=eh(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=th}get value(){return this.response||null}set value(e){this.response=e||null}get isInline(){return!0}validate(){if(!this._input)return!1;let e="",t=!1;return this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),t=this._input.checkValidity(),t||(e=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):t=this._input.checkValidity(),t&&this.response===""&&(t=!1),!t&&!e&&(e=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(t,e,this._input,{suppressInline:!0}),t}renderAnswer(){return b`<div part="answer" aria-hidden="true"></div>`}renderInput(){return b`<input
9488
+ `];var tr=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ne=class extends D{constructor(){super(...arguments),this.inputRef=eh(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=th}get value(){return this.response||null}set value(e){this.response=e||null}get isInline(){return!0}validate(){if(!this._input)return!1;let e="",t=!1;return this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),t=this._input.checkValidity(),t||(e=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):t=this._input.checkValidity(),t&&this.response===""&&(t=!1),!t&&!e&&(e=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(t,e,this._input,{suppressInline:!0}),t}renderAnswer(){return b`<div part="answer" aria-hidden="true"></div>`}renderInput(){return b`<input
9115
9489
  part="input"
9116
9490
  name="${this.responseIdentifier}"
9117
9491
  spellcheck="false"
@@ -9127,7 +9501,7 @@ CES.load();
9127
9501
  maxlength=${1e3}
9128
9502
  ?disabled="${this.disabled}"
9129
9503
  ?readonly="${this.readonly}"
9130
- />`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}reportValidity(){return this.validate(),super.reportValidity()}reset(){this.response=""}};er([p({type:Number,attribute:"expected-length"})],ne.prototype,"expectedLength",void 0);er([p({type:String,attribute:"pattern-mask"})],ne.prototype,"patternMask",void 0);er([p({type:String,attribute:"placeholder-text"})],ne.prototype,"placeholderText",void 0);er([p({type:String,attribute:"data-patternmask-message"})],ne.prototype,"dataPatternmaskMessage",void 0);er([p({type:String,attribute:"response",reflect:!1})],ne.prototype,"response",void 0);er([sr("input")],ne.prototype,"_input",void 0);er([$("response",{waitUntilFirstUpdate:!0})],ne.prototype,"_handleValueChange",void 0);var Vn=[{tag:"qti-text-entry-interaction",ctor:ne}];var rh=[R,q`
9504
+ />`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.response!==t.value&&(this.value=t.value,this.saveResponse(t.value))}reportValidity(){return this.validate(),super.reportValidity()}reset(){this.response=""}};tr([p({type:Number,attribute:"expected-length"})],ne.prototype,"expectedLength",void 0);tr([p({type:String,attribute:"pattern-mask"})],ne.prototype,"patternMask",void 0);tr([p({type:String,attribute:"placeholder-text"})],ne.prototype,"placeholderText",void 0);tr([p({type:String,attribute:"data-patternmask-message"})],ne.prototype,"dataPatternmaskMessage",void 0);tr([p({type:String,attribute:"response",reflect:!1})],ne.prototype,"response",void 0);tr([ar("input")],ne.prototype,"_input",void 0);tr([$("response",{waitUntilFirstUpdate:!0})],ne.prototype,"_handleValueChange",void 0);var Vn=[{tag:"qti-text-entry-interaction",ctor:ne}];var rh=[R,q`
9131
9505
  :host {
9132
9506
  display: block;
9133
9507
  margin: 1em 0;
@@ -9141,7 +9515,7 @@ CES.load();
9141
9515
  <slot name="prompt"></slot>
9142
9516
  <input type="file" @change="${this.#r}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
9143
9517
  </div>
9144
- `}async#r(e){let t=e.target;t.files&&t.files.length>0&&(this.#e=t.files[0],this.#t=await this.#i(this.#e),this.saveResponse(this.#t),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#t}})))}#i(e){return new Promise((t,r)=>{let i=new FileReader;i.onload=()=>t(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(e)})}};var jn=[{tag:"qti-upload-interaction",ctor:zn}];var ih=[...dd,...mn,...fn,...gn,...yn,...vn,...wn,...xn,...qn,...Cn,...En,...kn,...Sn,...An,..._n,...Tn,...On,...Dn,...$n,...Ln,...Vn,...jn];for(let{tag:n,ctor:e}of ih)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of mn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of fn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of gn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of yn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of vn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of wn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of xn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of qn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Cn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of En)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of kn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Sn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of An)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of _n)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Tn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of On)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Dn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of $n)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Ln)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Vn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of jn)customElements.get(n)||customElements.define(n,e);var dM=async n=>{let e=n.substring(0,n.lastIndexOf("/")),t=await ac().load(`${n}`).then(a=>a.assessmentTest()),r=await vr().load(`${e}/${t.href}`).then(a=>a.htmlDoc()),i=await vr().load(`${e}/${t.href}`).then(a=>a.items()),o=`${e}/${t.href}`,s=`${e}/${t.href.substring(0,t.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:o,items:i,testIdentifier:t.identifier}},hM=async n=>Ve().load(n).then(e=>e.htmlDoc().firstElementChild);var Fn=class extends pu(ue){calculate(){return this.calculateChildren(Array.from(this.children))}};function pu(n){return class extends n{calculateChildren(t){return t.map(i=>{let o=i;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=o.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 oh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Nr=class extends k{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let e=this.getVariables();if(!e||e.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 t=0;for(let r of e){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"&&t++}return t>=this.min&&t<=this.max}};oh([p({type:Number})],Nr.prototype,"min",void 0);oh([p({type:Number})],Nr.prototype,"max",void 0);var uu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},zi=class extends k{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};uu([p({type:String,attribute:"base-type"})],zi.prototype,"baseType",void 0);var Bn=class extends k{getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let e=this.getVariables();if(!e||e?.length===0)return 0;let t=e[0];return t.value===null||t.value===void 0?0:t.cardinality!=="multiple"&&t.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(t.value)?t.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var Un=class extends ue{getResult(){let e=this.getVariables();if(this.children.length===2){let t=e[0],r=e[1];if(t.baseType==="directedPair"&&r.baseType==="directedPair"&&t.cardinality==="multiple"){let i=t.value,o=r.value;return i.filter(l=>o.includes(l)).length>0}else if(t.baseType==="directedPair"&&r.baseType==="directedPair"&&t.cardinality==="single"){let i=t.value;return r.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};var Hn=class extends k{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let e=this.getAttribute("identifier")||"",t=this.context.variables.find(r=>r.identifier===e)||null;return t.cardinality!=="single"?t.correctResponse.length>0?t.correctResponse[0]:"":t.correctResponse}};var Ba=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},tr=class extends k{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let e=this.identifier.split("."),t=null,r;if(e.length===2)t=e[0],r=e[1];else if(e.length===1)r=e[0];else return console.error("qti-default: invalid identifier format"),null;if(t){let o=this._testContext.items.find(a=>a.identifier===t);if(console.debug(`itemContext: ${JSON.stringify(o)}`),!this._testContext||!o)return console.warn(`qti-default: item "${t}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===t)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${t}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(o=>o.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Ba([p({type:String})],tr.prototype,"identifier",void 0);Ba([T({context:j,subscribe:!0}),_()],tr.prototype,"context",void 0);Ba([_(),T({context:pe,subscribe:!0})],tr.prototype,"_testContext",void 0);var Wn=class extends k{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return t.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):e[0].baseType!==e[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(o=>!t.value.includes(o))}return null}};var Qn=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):e[1]===0?(console.warn("qti-divide: division by zero"),null):e[0]/e[1]}#e(e){let t=[];for(let r of e){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}t.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return t}};var Gn=class extends k{getResult(){let e=this.#e();return e?e[0]>=e[1]:null}#e(){let e=this.getVariables();if(e.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let t=e.map(r=>this.#t(r));return t.some(r=>r===null)?null:t}#t(e){if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-duration-gte requires single cardinality"),null;if(e.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(e.value===null||e.value===void 0)return null;let t=Number.parseFloat(e.value.toString());return Number.isNaN(t)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${e.value.toString()}"`),null):t}};var Xn=class extends k{getResult(){let e=this.#e();return e?e[0]<e[1]:null}#e(){let e=this.getVariables();if(e.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let t=e.map(r=>this.#t(r));return t.some(r=>r===null)?null:t}#t(e){if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-duration-lt requires single cardinality"),null;if(e.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(e.value===null||e.value===void 0)return null;let t=Number.parseFloat(e.value.toString());return Number.isNaN(t)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${e.value.toString()}"`),null):t}};var mu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ji=class extends k{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let i=parseFloat(t.value),o=parseFloat(r.value);if(!isNaN(i)&&!isNaN(o))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===o.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${o}`);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}};mu([p({type:String})],ji.prototype,"roundingMode",void 0);var fu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Fi=class extends k{constructor(){super(...arguments),this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return!t||!r?null:this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):t.value===null||r.value===null||t.value===void 0||r.value===void 0?null:J.compareSingleValues(t.value,r.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};fu([p({type:String})],Fi.prototype,"toleranceMode",void 0);var Yn=class extends k{getResult(){let e=this.getAttribute("field-identifier");if(!e)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let r=this.getVariables()[0];if(r.baseType!=="record"||r.value===null)throw new Error("qti-field-value child expression must return a record");let i=r.value[e];if(i===void 0)throw new Error(`Field "${e}" not found in record`);return i}};var Kn=class extends k{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let r of e){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;t.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 o=parseInt(i,10);if(isNaN(o))return console.error("qti-gcd non-numerical value"),null;t.push(o)}}else return console.error("qti-gcd unsupported cardinality"),null}return t.length===0?null:this.#e(t)}#e(e){if(e.length===0)return 0;if(e.length===1)return Math.abs(e[0]);let t=Math.abs(e[0]);for(let r=1;r<e.length&&(t=this.#t(t,Math.abs(e[r])),t!==1);r++);return t}#t(e,t){if(e===0&&t===0)return 0;if(e===0)return t;if(t===0)return e;for(;t!==0;){let r=t;t=e%t,e=r}return e}};var Jn=class extends k{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if((t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+t.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Zn=class extends ue{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return(t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+t.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};var gu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Bi=class extends k{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 e=this.getVariables()[0];if(!e)return console.error("qti-index: missing container"),null;let t;if(!isNaN(Number(this.n)))t=Number(this.n);else{let r=this.#e(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;t=Number(r)}if(t<=0||!Number.isInteger(t))return console.error("qti-index: index must be a positive integer"),null;if(e.cardinality==="ordered"){let r=Array.isArray(e.value)?e.value:[e.value];return e.value===null||t>r.length?null:r[t-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#e(e){let t=this.context.variables.find(r=>r.identifier===e)?.value;return t===null||isNaN(Number(t))?null:Number(t)}};gu([p({type:String})],Bi.prototype,"n",void 0);var nh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},$r=class extends k{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let e=this.getVariables();if(e.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let t=e[0];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-inside requires single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#e(t.value.toString()),i=this.#t(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}}#e(e){let t=e.split(/[,\s]+/).map(o=>o.trim()).filter(Boolean);if(t.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(t[0]),i=Number.parseFloat(t[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#t(e){let t=e.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return t.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):t}#r(e,t){if(t.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,o]=t;return(e.x-r)**2+(e.y-i)**2<=o**2}#i(e,t){if(t.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,o,s]=t,a=Math.min(r,o),l=Math.max(r,o),c=Math.min(i,s),d=Math.max(i,s);return e.x>=a&&e.x<=l&&e.y>=c&&e.y<=d}#n(e,t){if(t.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,i,o,s]=t;return o===0||s===0?!1:(e.x-r)**2/o**2+(e.y-i)**2/s**2<=1}#o(e,t){if(t.length<6||t.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,o=t.length-2;i<t.length;i+=2){let s=t[i],a=t[i+1],l=t[o],c=t[o+1];a>e.y!=c>e.y&&e.x<(l-s)*(e.y-a)/(c-a||Number.EPSILON)+s&&(r=!r),o=i}return r}};nh([p({type:String})],$r.prototype,"shape",void 0);nh([p({type:String})],$r.prototype,"coords",void 0);var es=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):e[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(e[0]/e[1])}#e(e){let t=[];for(let r of e){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"),[];t.push(i)}return t}};var ts=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):e[1]===0?(console.error("qti-integer-modulus: division by zero"),null):e[0]%e[1]}#e(e){let t=[];for(let r of e){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"),[];t.push(i)}return t}};var rs=class extends k{getResult(){let e=this.getVariables();if(e.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let t=e[0];if(t.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(t.value===null||t.value===void 0)return null;let r=Number.parseInt(t.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var is=class extends k{getResult(){if(this.children.length===1){let e=this.getVariables();if(!e)return!0;let t=e[0].value;return t==null||t==null||t===""}return console.error("unexpected number of children in qti Null"),null}};var os=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length===0?(console.error("qti-lcm requires at least one integer value"),null):e.reduce((t,r)=>this.#r(t,r))}#e(e){let t=[];for(let r of e){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"),[];t.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 o=Number.parseInt(i,10);if(Number.isNaN(o))return console.error("qti-lcm requires integer values"),[];t.push(o)}}return t}#t(e,t){let r=Math.abs(e),i=Math.abs(t);for(;i!==0;){let o=r%i;r=i,i=o}return r}#r(e,t){return e===0||t===0?0:Math.abs(e*t/this.#t(e,t))}};var se=class extends C{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var sh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Lr=class extends se{get childExpression(){return this.firstElementChild}process(){let e=this.getAttribute("identifier"),t=this.context.variables.find(i=>i.identifier===e)||null,r;return t.interpolationTable&&(r=t.interpolationTable.get(parseFloat(this.childExpression.calculate()))),r==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:xe(r)}})),r)}};sh([p({type:String})],Lr.prototype,"identifier",void 0);sh([T({context:j,subscribe:!0}),_()],Lr.prototype,"context",void 0);var ns=class extends k{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if((t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+t.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var ss=class extends ue{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return(t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+t.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};var bu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ui=class extends k{getResult(){let e=this.context.variables.find(s=>s.identifier===this.identifier);if(!e)return console.warn(`Response ${this.identifier} cannot be found`),null;let t=e.areaMapping;if(!t)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=Array.isArray(e.value)?e.value:[e.value];if(!r||r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,o=new Set;for(let s of r)for(let a of t.areaMapEntries){if(o.has(a.coords))continue;J.isPointInArea(s,`${a.shape},${a.coords}`,e.baseType)&&(i+=a.mappedValue??0,o.add(a.coords))}return o.size<r.length&&(i+=t.defaultValue),t.lowerBound!=null&&(i=Math.max(t.lowerBound,i)),t.upperBound!=null&&(i=Math.min(t.upperBound,i)),i}};bu([p({type:String})],Ui.prototype,"identifier",void 0);var yu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Hi=class extends k{getResult(){let e=this.context.variables.find(o=>o.identifier===this.identifier);if(!e||!e.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let t=e.mapping,r=Array.isArray(e.value)?e.value:[e.value],i=0;for(let o of r){let s=t.mapEntries.filter(l=>e.baseType==="string"&&!l.caseSensitive?J.compareSingleValues(l.mapKey.toLowerCase(),o.toLowerCase(),e.baseType):J.compareSingleValues(l.mapKey,o,e.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?i+=t.defaultValue:i+=a.mappedValue}return t?.lowerBound!==null&&t?.lowerBound!==void 0&&(i=Math.max(t.lowerBound,i)),t?.upperBound!==null&&t?.upperBound!==void 0&&(i=Math.min(t.upperBound,i)),i}};yu([p({type:String})],Hi.prototype,"identifier",void 0);var as=class n extends k{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return n.match(t,r)}return console.error("unexpected number of children in match"),null}static match(e,t){if(e.value===null)return!1;switch(t.cardinality){case"single":return Array.isArray(e.value)||Array.isArray(t.value)?(console.error("unexpected cardinality in qti match"),!1):J.compareSingleValues(e.value?.toString(),t.value.toString(),t.baseType);case"ordered":{if(!Array.isArray(e.value)||!Array.isArray(t.value))return console.error("unexpected cardinality in qti match"),!1;if(e.value.length!==t.value.length)return!1;for(let r=0;r<e.value.length;r++)if(!J.compareSingleValues(t.value[r],e.value[r],t.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(e.value)||!Array.isArray(t.value))return console.error("unexpected cardinality in qti match"),!1;if(e.value.length!==t.value.length)return!1;let r=0;for(let i of t.value){let o=null,s=[...e.value];for(let a of s)if(J.compareSingleValues(i,a,t.baseType)){o=a;break}if(o!==null)s.splice(s.indexOf(o),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var vu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Wi=class extends k{constructor(){super(...arguments),this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let r of e){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;t.push(i)}return this.#e(this.name,t)}#e(e,t){try{switch(e.toLowerCase()){case"sin":return t.length!==1?null:Math.sin(t[0]);case"cos":return t.length!==1?null:Math.cos(t[0]);case"tan":return t.length!==1?null:Math.tan(t[0]);case"asin":return t.length!==1||t[0]<-1||t[0]>1?null:Math.asin(t[0]);case"acos":return t.length!==1||t[0]<-1||t[0]>1?null:Math.acos(t[0]);case"atan":return t.length!==1?null:Math.atan(t[0]);case"sinh":return t.length!==1?null:Math.sinh(t[0]);case"cosh":return t.length!==1?null:Math.cosh(t[0]);case"tanh":return t.length!==1?null:Math.tanh(t[0]);case"log":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"ln":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"log10":return t.length!==1||t[0]<=0?null:Math.log10(t[0]);case"exp":return t.length!==1?null:Math.exp(t[0]);case"abs":return t.length!==1?null:Math.abs(t[0]);case"sqrt":return t.length!==1||t[0]<0?null:Math.sqrt(t[0]);case"signum":return t.length!==1?null:Math.sign(t[0]);case"floor":return t.length!==1?null:Math.floor(t[0]);case"ceil":return t.length!==1?null:Math.ceil(t[0]);case"round":return t.length!==1?null:Math.round(t[0]);case"atan2":return t.length!==2?null:Math.atan2(t[0],t[1]);case"pow":{if(t.length!==2)return null;let r=t[0],i=t[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(t.length!==2)return null;let r=t[0],i=t[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return t.length!==2||t[1]===0?null:t[0]%t[1];case"max":return t.length<1?null:Math.max(...t);case"min":return t.length<1?null:Math.min(...t);default:return console.error(`qti-math-operator: unknown operation "${e}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${e}":`,r),null}}};vu([p({type:String})],Wi.prototype,"name",void 0);var ls=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...e)}#e(e){let t=[];for(let r of e){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}t.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return t}};var cs=class extends k{getResult(){let e=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[t,r]=e;if(t.baseType===r.baseType||t.baseType==="integer"&&r.baseType==="float"||t.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"),(t.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(t.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),t.value===null||r.value===null)return null;let i=t.value;return r.value.includes(i)}};var ds=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...e)}#e(e){let t=[];for(let r of e){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}t.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return t}};var hs=class extends k{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);let e=this.getVariables();if(e.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let t of e)if(t.cardinality!=="multiple"&&t.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return e}};var ps=class extends k{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var us=class extends k{getResult(){return null}};var ms=class extends ue{getResult(){return Array.from(this.children).map(t=>{let r=t;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),o=!1;if(typeof i=="string")if(i==="true")o=!0;else if(i==="false")o=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(o=i);return o}).some(t=>typeof t=="boolean"&&t)}};var fs=class extends k{getResult(){let e=this.getVariables();if(e.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let t of e)if(t.cardinality!=="ordered"&&t.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return e}};var wu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Qi=class extends k{constructor(){super(...arguments),this.pattern=""}getResult(){let e=this.getVariables();if(e.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 t=e[0];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-pattern-match requires single cardinality"),null;if(t.value===null||t.value===void 0)return null;try{return new RegExp(this.pattern).test(t.value.toString())}catch(r){return console.error("qti-pattern-match requires a valid regular expression",r),null}}};wu([p({type:String})],Qi.prototype,"pattern",void 0);var gs=class extends k{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let e=this.getVariables();if(!e||e.length!==2)return null;let[t,r]=e;if(t.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(t.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0||r.value===null||r.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(t.value),o=parseFloat(r.value);if(isNaN(i)||isNaN(o))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&o<=0||i<0&&!Number.isInteger(o))return null;let s;try{s=Math.pow(i,o)}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 ah=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Vr=class extends C{render(){let e=this.context?.variables.find(t=>t.identifier===this.identifier)?.value;return e===null?P:b`${JSON.stringify(e,null,2)}`}calculate(){return this.context.variables.find(t=>t.identifier===this.identifier)||null}};ah([p({type:String})],Vr.prototype,"identifier",void 0);ah([T({context:j,subscribe:!0}),_()],Vr.prototype,"context",void 0);var bs=class extends k{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 Ua=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},rr=class extends k{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 e=[],t=0;for(;;){let i=this.min+this.step*t;if(i>this.max)break;Number.isInteger(i)&&e.push(i),t++}if(e.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()*e.length);return e[r]}getPossibleValues(){let e=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let t=0;for(;;){let r=this.min+this.step*t;if(r>this.max)break;Number.isInteger(r)&&e.push(r),t++}return e.length>0?e:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};Ua([p({type:Number})],rr.prototype,"min",void 0);Ua([p({type:Number})],rr.prototype,"max",void 0);Ua([p({type:Number})],rr.prototype,"step",void 0);var ys=class extends k{getResult(){let e=this.getVariables();if(e.length===1){let t=e[0].value;if(Array.isArray(t)){let r=Math.floor(Math.random()*t.length);return t[r]}return t}return console.error("unexpected number of children in match"),null}};var xu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Gi=class extends k{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let e=this.#e();if(e<=0)return[];let t=this.firstElementChild;if(!t)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let i=0;i<e;i++){let o=t.calculate(),s=this.#t(o);s&&r.push(s)}return r}#e(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let e=parseInt(this.numberRepeats,10);if(!Number.isNaN(e))return e;let t=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===t);if(!r)return console.warn(`qti-repeat: unknown identifier "${t}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,o=parseInt(i?.toString()??"",10);return Number.isNaN(o)?(console.warn(`qti-repeat: invalid repeat count from "${t}"`),0):o}#t(e){if(e==null)return null;if(typeof e=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:e.toString(),type:"response"};if(typeof e=="string"){let t=parseFloat(e);if(!Number.isNaN(t))return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:e.toString(),type:"response"}}if(e&&typeof e=="object"&&"value"in e){let t=e.value;return{identifier:"",cardinality:"single",baseType:e.baseType??"string",value:t!=null?t.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:e.toString(),type:"response"}}};xu([p({type:String,attribute:"number-repeats"})],Gi.prototype,"numberRepeats",void 0);var vs=class extends se{render(){return b`<slot></slot>`}process(){let e=[...this.children];for(let t=0;t<e.length;t++){let r=e[t];if(r.calculate()){r.process();return}}}};var zr=class extends C{render(){return b`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let e=this.getSubRules();for(let t=0;t<e.length;t++)e[t].process()}};var jr=class extends zr{calculate(){return this.firstElementChild.calculate()}getSubRules(){let e=[];for(let t=1;t<this.children.length;t++)e.push(this.children[t]);return e}};var ws=class extends jr{render(){return b`${super.render()}`}};var lh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Fr=class extends k{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(t.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.#e(r,this.figures):this.#t(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#e(e,t){if(e===0)return 0;let r=Math.pow(10,t);return Math.round(e*r)/r}#t(e,t){if(e===0)return 0;let r=Math.floor(Math.log10(Math.abs(e))),i=Math.pow(10,t-r-1);return Math.round(e*i)/i}};lh([p({type:String,attribute:"rounding-mode"})],Fr.prototype,"roundingMode",void 0);lh([p({type:Number})],Fr.prototype,"figures",void 0);var xs=class extends k{getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(t.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 qs=class extends se{process(){let e=this.getAttribute("identifier");if(!e){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let t=this.firstElementChild;if(!t){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new Ha(t).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:e,value:this.#e(i)}}))}#e(e){return e==null?null:Array.isArray(e)?e.map(t=>xe(this.#t(t))):xe(this.#t(e))}#t(e){if(e&&typeof e=="object"&&"value"in e){let t=e.value;return t!=null?t.toString():""}return e?.toString()??""}},Ha=class{constructor(e){this.expression=e}process(){let e=this.expression.calculate()??null;return e===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(e)?e.map(t=>this.#e(t)):this.#e(e)}#e(e){return e&&typeof e=="object"&&"value"in e?e.value:e}};var Cs=class extends se{process(){let e=this.getAttribute("identifier");if(!e){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let t=this.firstElementChild;if(!t){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new Wa(t).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:e,value:this.#e(i)}}))}#e(e){return Array.isArray(e)?e.map(xe):e!==null?xe(e):null}},Wa=class{constructor(e){this.expression=e}process(){let e=this.expression.calculate()??null;return e===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(e)?e.map(t=>t.value?t.value:t):e}};var Es=class extends se{process(){let e=this.getAttribute("identifier");if(!e){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let t=this.firstElementChild;if(!t){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new Qa(t).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:e,value:this.#e(i)}}))}#e(e){return e==null?null:Array.isArray(e)?e.map(t=>xe(this.#t(t))):xe(this.#t(e))}#t(e){if(e&&typeof e=="object"&&"value"in e){let t=e.value;return t!=null?t.toString():""}return e?.toString()??""}},Qa=class{constructor(e){this.expression=e}process(){let e=this.expression.calculate()??null;return e===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(e)?e.map(t=>this.#e(t)):this.#e(e)}#e(e){return e&&typeof e=="object"&&"value"in e?e.value:e}};var qu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Xi=class extends k{constructor(){super(...arguments),this.name=""}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let e=this.#t(this.getVariables());if(e.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return e.reduce((t,r)=>t+r,0)/e.length;case"popsd":return this.#e(e);default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#e(e){let t=e.reduce((i,o)=>i+o,0)/e.length,r=e.reduce((i,o)=>i+Math.pow(o-t,2),0)/e.length;return Math.sqrt(r)}#t(e){let t=[];for(let r of e){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}t.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return t}};qu([p({type:String})],Xi.prototype,"name",void 0);var Cu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Yi=class extends k{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),o=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return J.compareSingleValues(i,o,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Cu([p({type:String,attribute:"case-sensitive"})],Yi.prototype,"caseSensitive",void 0);var Eu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ki=class extends k{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let e=this.getVariables();if(e.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[t,r]=e;if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(t.value===null||r.value===null||t.value===void 0||r.value===void 0)return null;let i=t.value.toString(),o=r.value.toString();return this.caseSensitive!=="true"?o.toLowerCase().includes(i.toLowerCase()):o.includes(i)}};Eu([p({type:String,attribute:"case-sensitive"})],Ki.prototype,"caseSensitive",void 0);var ks=class extends ku(k){getResult(){return this.calculateChildren(Array.from(this.children))}};function ku(n){return class extends n{calculateChildren(t){let r=t.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=i.calculate();return Number.isNaN(o)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(o)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var Ss=class extends k{getResult(){return new Ga(Array.from(this.children)).calculate()}},Ga=class{constructor(e){this.expressions=e}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 As=class extends k{getResult(){let e=this.getVariables();if(e.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let t=e[0];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-truncate requires single cardinality"),null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(t.value===null||t.value===void 0)return null;let r=Number.parseFloat(t.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var Is=class extends k{getResult(){let e=this.getAttribute("identifier");return this.context.variables.find(r=>r.identifier===e).value}};var ch=[{tag:"qti-and",ctor:Fn},{tag:"qti-any-n",ctor:Nr},{tag:"qti-base-value",ctor:zi},{tag:"qti-container-size",ctor:Bn},{tag:"qti-contains",ctor:Un},{tag:"qti-correct",ctor:Hn},{tag:"qti-default",ctor:tr},{tag:"qti-delete",ctor:Wn},{tag:"qti-divide",ctor:Qn},{tag:"qti-duration-gte",ctor:Gn},{tag:"qti-duration-lt",ctor:Xn},{tag:"qti-equal",ctor:Fi},{tag:"qti-equal-rounded",ctor:ji},{tag:"qti-field-value",ctor:Yn},{tag:"qti-gcd",ctor:Kn},{tag:"qti-gt",ctor:Jn},{tag:"qti-gte",ctor:Zn},{tag:"qti-index",ctor:Bi},{tag:"qti-inside",ctor:$r},{tag:"qti-integer-divide",ctor:es},{tag:"qti-integer-modulus",ctor:ts},{tag:"qti-integer-to-float",ctor:rs},{tag:"qti-is-null",ctor:is},{tag:"qti-lcm",ctor:os},{tag:"qti-lookup-outcome-value",ctor:Lr},{tag:"qti-lt",ctor:ns},{tag:"qti-lte",ctor:ss},{tag:"qti-map-response",ctor:Hi},{tag:"qti-map-response-point",ctor:Ui},{tag:"qti-match",ctor:as},{tag:"qti-math-operator",ctor:Wi},{tag:"qti-max",ctor:ls},{tag:"qti-member",ctor:cs},{tag:"qti-min",ctor:ds},{tag:"qti-multiple",ctor:hs},{tag:"qti-not",ctor:ps},{tag:"qti-null",ctor:us},{tag:"qti-or",ctor:ms},{tag:"qti-ordered",ctor:fs},{tag:"qti-pattern-match",ctor:Qi},{tag:"qti-power",ctor:gs},{tag:"qti-printed-variable",ctor:Vr},{tag:"qti-product",ctor:bs},{tag:"qti-random",ctor:ys},{tag:"qti-random-integer",ctor:rr},{tag:"qti-repeat",ctor:Gi},{tag:"qti-response-condition",ctor:vs},{tag:"qti-response-else",ctor:zr},{tag:"qti-response-else-if",ctor:ws},{tag:"qti-response-if",ctor:jr},{tag:"qti-round",ctor:xs},{tag:"qti-round-to",ctor:Fr},{tag:"qti-rule",ctor:se},{tag:"qti-set-correct-response",ctor:qs},{tag:"qti-set-outcome-value",ctor:Cs},{tag:"qti-set-template-value",ctor:Es},{tag:"qti-stats-operator",ctor:Xi},{tag:"qti-string-match",ctor:Yi},{tag:"qti-substring",ctor:Ki},{tag:"qti-subtract",ctor:ks},{tag:"qti-sum",ctor:Ss},{tag:"qti-truncate",ctor:As},{tag:"qti-variable",ctor:Is}];for(let{tag:n,ctor:e}of ch)customElements.get(n)||customElements.define(n,e);var nt=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},X;(function(n){n.Correct="correct",n.PartiallyCorrect="partially-correct",n.Incorrect="incorrect"})(X||(X={}));var Xa=n=>{class e extends n{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",""))}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 o=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>o.includes(d)).length,c=a.filter(d=>!o.includes(d)).length;return l===o.length&&c===0&&a.length===o.length?X.Correct:l>0&&(l<o.length||c>0)?X.PartiallyCorrect:X.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,o=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==X.Correct))){if(!o)return;this.parentElement?.removeChild(i);return}if(o)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(r){this._internals.states.delete("show-correct-response"),r&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return nt([p({attribute:"correct-response",reflect:!0,converter:$e({emptyAs:null})})],e.prototype,"correctResponseAttr",null),nt([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],e.prototype,"showCorrectResponse",void 0),nt([$("showCorrectResponse",{waitUntilFirstUpdate:!0})],e.prototype,"_handleShowCorrectResponseChange",void 0),nt([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],e.prototype,"showFullCorrectResponse",void 0),nt([$("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],e.prototype,"_handleShowFullCorrectResponseChange",void 0),nt([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],e.prototype,"showCandidateCorrection",void 0),nt([$("showCandidateCorrection",{waitUntilFirstUpdate:!0})],e.prototype,"_handleShowCandidateCorrectionChange",void 0),nt([_()],e.prototype,"_isFullCorrectResponse",void 0),nt([_()],e.prototype,"_correctResponse",void 0),e};var re=q`
9518
+ `}async#r(e){let t=e.target;t.files&&t.files.length>0&&(this.#e=t.files[0],this.#t=await this.#i(this.#e),this.saveResponse(this.#t),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#t}})))}#i(e){return new Promise((t,r)=>{let i=new FileReader;i.onload=()=>t(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(e)})}};var jn=[{tag:"qti-upload-interaction",ctor:zn}];var ih=[...dd,...mn,...fn,...gn,...yn,...vn,...wn,...xn,...qn,...Cn,...En,...kn,...Sn,...An,..._n,...Tn,...On,...Dn,...$n,...Ln,...Vn,...jn];for(let{tag:n,ctor:e}of ih)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of mn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of fn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of gn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of yn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of vn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of wn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of xn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of qn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Cn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of En)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of kn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Sn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of An)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of _n)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Tn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of On)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Dn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of $n)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Ln)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of Vn)customElements.get(n)||customElements.define(n,e);for(let{tag:n,ctor:e}of jn)customElements.get(n)||customElements.define(n,e);var pM=async n=>{let e=n.substring(0,n.lastIndexOf("/")),t=await ac().load(`${n}`).then(a=>a.assessmentTest()),r=await vr().load(`${e}/${t.href}`).then(a=>a.htmlDoc()),i=await vr().load(`${e}/${t.href}`).then(a=>a.items()),o=`${e}/${t.href}`,s=`${e}/${t.href.substring(0,t.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:o,items:i,testIdentifier:t.identifier}},uM=async n=>Ve().load(n).then(e=>e.htmlDoc().firstElementChild);var Fn=class extends pu(ue){calculate(){return this.calculateChildren(Array.from(this.children))}};function pu(n){return class extends n{calculateChildren(t){return t.map(i=>{let o=i;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=o.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 oh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Nr=class extends k{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let e=this.getVariables();if(!e||e.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 t=0;for(let r of e){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"&&t++}return t>=this.min&&t<=this.max}};oh([p({type:Number})],Nr.prototype,"min",void 0);oh([p({type:Number})],Nr.prototype,"max",void 0);var uu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},zi=class extends k{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};uu([p({type:String,attribute:"base-type"})],zi.prototype,"baseType",void 0);var Bn=class extends k{getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let e=this.getVariables();if(!e||e?.length===0)return 0;let t=e[0];return t.value===null||t.value===void 0?0:t.cardinality!=="multiple"&&t.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(t.value)?t.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var Un=class extends ue{getResult(){let e=this.getVariables();if(this.children.length===2){let t=e[0],r=e[1];if(t.baseType==="directedPair"&&r.baseType==="directedPair"&&t.cardinality==="multiple"){let i=t.value,o=r.value;return i.filter(l=>o.includes(l)).length>0}else if(t.baseType==="directedPair"&&r.baseType==="directedPair"&&t.cardinality==="single"){let i=t.value;return r.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};var Hn=class extends k{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let e=this.getAttribute("identifier")||"",t=this.context.variables.find(r=>r.identifier===e)||null;return t.cardinality!=="single"?t.correctResponse.length>0?t.correctResponse[0]:"":t.correctResponse}};var Ba=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},rr=class extends k{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let e=this.identifier.split("."),t=null,r;if(e.length===2)t=e[0],r=e[1];else if(e.length===1)r=e[0];else return console.error("qti-default: invalid identifier format"),null;if(t){let o=this._testContext.items.find(a=>a.identifier===t);if(console.debug(`itemContext: ${JSON.stringify(o)}`),!this._testContext||!o)return console.warn(`qti-default: item "${t}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===t)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${t}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(o=>o.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Ba([p({type:String})],rr.prototype,"identifier",void 0);Ba([T({context:j,subscribe:!0}),_()],rr.prototype,"context",void 0);Ba([_(),T({context:pe,subscribe:!0})],rr.prototype,"_testContext",void 0);var Wn=class extends k{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return t.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):e[0].baseType!==e[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(o=>!t.value.includes(o))}return null}};var Qn=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):e[1]===0?(console.warn("qti-divide: division by zero"),null):e[0]/e[1]}#e(e){let t=[];for(let r of e){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}t.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return t}};var Gn=class extends k{getResult(){let e=this.#e();return e?e[0]>=e[1]:null}#e(){let e=this.getVariables();if(e.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let t=e.map(r=>this.#t(r));return t.some(r=>r===null)?null:t}#t(e){if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-duration-gte requires single cardinality"),null;if(e.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(e.value===null||e.value===void 0)return null;let t=Number.parseFloat(e.value.toString());return Number.isNaN(t)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${e.value.toString()}"`),null):t}};var Xn=class extends k{getResult(){let e=this.#e();return e?e[0]<e[1]:null}#e(){let e=this.getVariables();if(e.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let t=e.map(r=>this.#t(r));return t.some(r=>r===null)?null:t}#t(e){if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-duration-lt requires single cardinality"),null;if(e.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(e.value===null||e.value===void 0)return null;let t=Number.parseFloat(e.value.toString());return Number.isNaN(t)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${e.value.toString()}"`),null):t}};var mu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ji=class extends k{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let i=parseFloat(t.value),o=parseFloat(r.value);if(!isNaN(i)&&!isNaN(o))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===o.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${o}`);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}};mu([p({type:String})],ji.prototype,"roundingMode",void 0);var fu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Fi=class extends k{constructor(){super(...arguments),this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return!t||!r?null:this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):t.value===null||r.value===null||t.value===void 0||r.value===void 0?null:J.compareSingleValues(t.value,r.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};fu([p({type:String})],Fi.prototype,"toleranceMode",void 0);var Yn=class extends k{getResult(){let e=this.getAttribute("field-identifier");if(!e)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let r=this.getVariables()[0];if(r.baseType!=="record"||r.value===null)throw new Error("qti-field-value child expression must return a record");let i=r.value[e];if(i===void 0)throw new Error(`Field "${e}" not found in record`);return i}};var Kn=class extends k{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let r of e){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;t.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 o=parseInt(i,10);if(isNaN(o))return console.error("qti-gcd non-numerical value"),null;t.push(o)}}else return console.error("qti-gcd unsupported cardinality"),null}return t.length===0?null:this.#e(t)}#e(e){if(e.length===0)return 0;if(e.length===1)return Math.abs(e[0]);let t=Math.abs(e[0]);for(let r=1;r<e.length&&(t=this.#t(t,Math.abs(e[r])),t!==1);r++);return t}#t(e,t){if(e===0&&t===0)return 0;if(e===0)return t;if(t===0)return e;for(;t!==0;){let r=t;t=e%t,e=r}return e}};var Jn=class extends k{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if((t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+t.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Zn=class extends ue{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return(t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+t.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};var gu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Bi=class extends k{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 e=this.getVariables()[0];if(!e)return console.error("qti-index: missing container"),null;let t;if(!isNaN(Number(this.n)))t=Number(this.n);else{let r=this.#e(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;t=Number(r)}if(t<=0||!Number.isInteger(t))return console.error("qti-index: index must be a positive integer"),null;if(e.cardinality==="ordered"){let r=Array.isArray(e.value)?e.value:[e.value];return e.value===null||t>r.length?null:r[t-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#e(e){let t=this.context.variables.find(r=>r.identifier===e)?.value;return t===null||isNaN(Number(t))?null:Number(t)}};gu([p({type:String})],Bi.prototype,"n",void 0);var nh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},$r=class extends k{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let e=this.getVariables();if(e.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let t=e[0];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-inside requires single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#e(t.value.toString()),i=this.#t(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}}#e(e){let t=e.split(/[,\s]+/).map(o=>o.trim()).filter(Boolean);if(t.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(t[0]),i=Number.parseFloat(t[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#t(e){let t=e.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return t.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):t}#r(e,t){if(t.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,o]=t;return(e.x-r)**2+(e.y-i)**2<=o**2}#i(e,t){if(t.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,o,s]=t,a=Math.min(r,o),l=Math.max(r,o),c=Math.min(i,s),d=Math.max(i,s);return e.x>=a&&e.x<=l&&e.y>=c&&e.y<=d}#n(e,t){if(t.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,i,o,s]=t;return o===0||s===0?!1:(e.x-r)**2/o**2+(e.y-i)**2/s**2<=1}#o(e,t){if(t.length<6||t.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,o=t.length-2;i<t.length;i+=2){let s=t[i],a=t[i+1],l=t[o],c=t[o+1];a>e.y!=c>e.y&&e.x<(l-s)*(e.y-a)/(c-a||Number.EPSILON)+s&&(r=!r),o=i}return r}};nh([p({type:String})],$r.prototype,"shape",void 0);nh([p({type:String})],$r.prototype,"coords",void 0);var es=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):e[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(e[0]/e[1])}#e(e){let t=[];for(let r of e){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"),[];t.push(i)}return t}};var ts=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):e[1]===0?(console.error("qti-integer-modulus: division by zero"),null):e[0]%e[1]}#e(e){let t=[];for(let r of e){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"),[];t.push(i)}return t}};var rs=class extends k{getResult(){let e=this.getVariables();if(e.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let t=e[0];if(t.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(t.value===null||t.value===void 0)return null;let r=Number.parseInt(t.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var is=class extends k{getResult(){if(this.children.length===1){let e=this.getVariables();if(!e)return!0;let t=e[0].value;return t==null||t==null||t===""}return console.error("unexpected number of children in qti Null"),null}};var os=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length===0?(console.error("qti-lcm requires at least one integer value"),null):e.reduce((t,r)=>this.#r(t,r))}#e(e){let t=[];for(let r of e){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"),[];t.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 o=Number.parseInt(i,10);if(Number.isNaN(o))return console.error("qti-lcm requires integer values"),[];t.push(o)}}return t}#t(e,t){let r=Math.abs(e),i=Math.abs(t);for(;i!==0;){let o=r%i;r=i,i=o}return r}#r(e,t){return e===0||t===0?0:Math.abs(e*t/this.#t(e,t))}};var se=class extends C{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var sh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Lr=class extends se{get childExpression(){return this.firstElementChild}process(){let e=this.getAttribute("identifier"),t=this.context.variables.find(i=>i.identifier===e)||null,r;return t.interpolationTable&&(r=t.interpolationTable.get(parseFloat(this.childExpression.calculate()))),r==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:qe(r)}})),r)}};sh([p({type:String})],Lr.prototype,"identifier",void 0);sh([T({context:j,subscribe:!0}),_()],Lr.prototype,"context",void 0);var ns=class extends k{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if((t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+t.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var ss=class extends ue{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return(t.baseType==="integer"||t.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+t.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};var bu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ui=class extends k{getResult(){let e=this.context.variables.find(s=>s.identifier===this.identifier);if(!e)return console.warn(`Response ${this.identifier} cannot be found`),null;let t=e.areaMapping;if(!t)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=Array.isArray(e.value)?e.value:[e.value];if(!r||r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,o=new Set;for(let s of r)for(let a of t.areaMapEntries){if(o.has(a.coords))continue;J.isPointInArea(s,`${a.shape},${a.coords}`,e.baseType)&&(i+=a.mappedValue??0,o.add(a.coords))}return o.size<r.length&&(i+=t.defaultValue),t.lowerBound!=null&&(i=Math.max(t.lowerBound,i)),t.upperBound!=null&&(i=Math.min(t.upperBound,i)),i}};bu([p({type:String})],Ui.prototype,"identifier",void 0);var yu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Hi=class extends k{getResult(){let e=this.context.variables.find(o=>o.identifier===this.identifier);if(!e||!e.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let t=e.mapping,r=Array.isArray(e.value)?e.value:[e.value],i=0;for(let o of r){let s=t.mapEntries.filter(l=>e.baseType==="string"&&!l.caseSensitive?J.compareSingleValues(l.mapKey.toLowerCase(),o.toLowerCase(),e.baseType):J.compareSingleValues(l.mapKey,o,e.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?i+=t.defaultValue:i+=a.mappedValue}return t?.lowerBound!==null&&t?.lowerBound!==void 0&&(i=Math.max(t.lowerBound,i)),t?.upperBound!==null&&t?.upperBound!==void 0&&(i=Math.min(t.upperBound,i)),i}};yu([p({type:String})],Hi.prototype,"identifier",void 0);var as=class n extends k{getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return n.match(t,r)}return console.error("unexpected number of children in match"),null}static match(e,t){if(e.value===null)return!1;switch(t.cardinality){case"single":return Array.isArray(e.value)||Array.isArray(t.value)?(console.error("unexpected cardinality in qti match"),!1):J.compareSingleValues(e.value?.toString(),t.value.toString(),t.baseType);case"ordered":{if(!Array.isArray(e.value)||!Array.isArray(t.value))return console.error("unexpected cardinality in qti match"),!1;if(e.value.length!==t.value.length)return!1;for(let r=0;r<e.value.length;r++)if(!J.compareSingleValues(t.value[r],e.value[r],t.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(e.value)||!Array.isArray(t.value))return console.error("unexpected cardinality in qti match"),!1;if(e.value.length!==t.value.length)return!1;let r=0;for(let i of t.value){let o=null,s=[...e.value];for(let a of s)if(J.compareSingleValues(i,a,t.baseType)){o=a;break}if(o!==null)s.splice(s.indexOf(o),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var vu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Wi=class extends k{constructor(){super(...arguments),this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let r of e){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;t.push(i)}return this.#e(this.name,t)}#e(e,t){try{switch(e.toLowerCase()){case"sin":return t.length!==1?null:Math.sin(t[0]);case"cos":return t.length!==1?null:Math.cos(t[0]);case"tan":return t.length!==1?null:Math.tan(t[0]);case"asin":return t.length!==1||t[0]<-1||t[0]>1?null:Math.asin(t[0]);case"acos":return t.length!==1||t[0]<-1||t[0]>1?null:Math.acos(t[0]);case"atan":return t.length!==1?null:Math.atan(t[0]);case"sinh":return t.length!==1?null:Math.sinh(t[0]);case"cosh":return t.length!==1?null:Math.cosh(t[0]);case"tanh":return t.length!==1?null:Math.tanh(t[0]);case"log":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"ln":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"log10":return t.length!==1||t[0]<=0?null:Math.log10(t[0]);case"exp":return t.length!==1?null:Math.exp(t[0]);case"abs":return t.length!==1?null:Math.abs(t[0]);case"sqrt":return t.length!==1||t[0]<0?null:Math.sqrt(t[0]);case"signum":return t.length!==1?null:Math.sign(t[0]);case"floor":return t.length!==1?null:Math.floor(t[0]);case"ceil":return t.length!==1?null:Math.ceil(t[0]);case"round":return t.length!==1?null:Math.round(t[0]);case"atan2":return t.length!==2?null:Math.atan2(t[0],t[1]);case"pow":{if(t.length!==2)return null;let r=t[0],i=t[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(t.length!==2)return null;let r=t[0],i=t[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return t.length!==2||t[1]===0?null:t[0]%t[1];case"max":return t.length<1?null:Math.max(...t);case"min":return t.length<1?null:Math.min(...t);default:return console.error(`qti-math-operator: unknown operation "${e}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${e}":`,r),null}}};vu([p({type:String})],Wi.prototype,"name",void 0);var ls=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...e)}#e(e){let t=[];for(let r of e){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}t.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return t}};var cs=class extends k{getResult(){let e=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[t,r]=e;if(t.baseType===r.baseType||t.baseType==="integer"&&r.baseType==="float"||t.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"),(t.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(t.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),t.value===null||r.value===null)return null;let i=t.value;return r.value.includes(i)}};var ds=class extends k{getResult(){let e=this.#e(this.getVariables());return e.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...e)}#e(e){let t=[];for(let r of e){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}t.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return t}};var hs=class extends k{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);let e=this.getVariables();if(e.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let t of e)if(t.cardinality!=="multiple"&&t.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return e}};var ps=class extends k{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var us=class extends k{getResult(){return null}};var ms=class extends ue{getResult(){return Array.from(this.children).map(t=>{let r=t;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),o=!1;if(typeof i=="string")if(i==="true")o=!0;else if(i==="false")o=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(o=i);return o}).some(t=>typeof t=="boolean"&&t)}};var fs=class extends k{getResult(){let e=this.getVariables();if(e.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let t of e)if(t.cardinality!=="ordered"&&t.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return e}};var wu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Qi=class extends k{constructor(){super(...arguments),this.pattern=""}getResult(){let e=this.getVariables();if(e.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 t=e[0];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-pattern-match requires single cardinality"),null;if(t.value===null||t.value===void 0)return null;try{return new RegExp(this.pattern).test(t.value.toString())}catch(r){return console.error("qti-pattern-match requires a valid regular expression",r),null}}};wu([p({type:String})],Qi.prototype,"pattern",void 0);var gs=class extends k{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let e=this.getVariables();if(!e||e.length!==2)return null;let[t,r]=e;if(t.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(t.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0||r.value===null||r.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(t.value),o=parseFloat(r.value);if(isNaN(i)||isNaN(o))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&o<=0||i<0&&!Number.isInteger(o))return null;let s;try{s=Math.pow(i,o)}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 ah=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Vr=class extends C{render(){let e=this.context?.variables.find(t=>t.identifier===this.identifier)?.value;return e===null?P:b`${JSON.stringify(e,null,2)}`}calculate(){return this.context.variables.find(t=>t.identifier===this.identifier)||null}};ah([p({type:String})],Vr.prototype,"identifier",void 0);ah([T({context:j,subscribe:!0}),_()],Vr.prototype,"context",void 0);var bs=class extends k{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 Ua=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},ir=class extends k{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 e=[],t=0;for(;;){let i=this.min+this.step*t;if(i>this.max)break;Number.isInteger(i)&&e.push(i),t++}if(e.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()*e.length);return e[r]}getPossibleValues(){let e=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let t=0;for(;;){let r=this.min+this.step*t;if(r>this.max)break;Number.isInteger(r)&&e.push(r),t++}return e.length>0?e:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};Ua([p({type:Number})],ir.prototype,"min",void 0);Ua([p({type:Number})],ir.prototype,"max",void 0);Ua([p({type:Number})],ir.prototype,"step",void 0);var ys=class extends k{getResult(){let e=this.getVariables();if(e.length===1){let t=e[0].value;if(Array.isArray(t)){let r=Math.floor(Math.random()*t.length);return t[r]}return t}return console.error("unexpected number of children in match"),null}};var xu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Gi=class extends k{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let e=this.#e();if(e<=0)return[];let t=this.firstElementChild;if(!t)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let i=0;i<e;i++){let o=t.calculate(),s=this.#t(o);s&&r.push(s)}return r}#e(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let e=parseInt(this.numberRepeats,10);if(!Number.isNaN(e))return e;let t=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===t);if(!r)return console.warn(`qti-repeat: unknown identifier "${t}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,o=parseInt(i?.toString()??"",10);return Number.isNaN(o)?(console.warn(`qti-repeat: invalid repeat count from "${t}"`),0):o}#t(e){if(e==null)return null;if(typeof e=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:e.toString(),type:"response"};if(typeof e=="string"){let t=parseFloat(e);if(!Number.isNaN(t))return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:e.toString(),type:"response"}}if(e&&typeof e=="object"&&"value"in e){let t=e.value;return{identifier:"",cardinality:"single",baseType:e.baseType??"string",value:t!=null?t.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:e.toString(),type:"response"}}};xu([p({type:String,attribute:"number-repeats"})],Gi.prototype,"numberRepeats",void 0);var vs=class extends se{render(){return b`<slot></slot>`}process(){let e=[...this.children];for(let t=0;t<e.length;t++){let r=e[t];if(r.calculate()){r.process();return}}}};var zr=class extends C{render(){return b`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let e=this.getSubRules();for(let t=0;t<e.length;t++)e[t].process()}};var jr=class extends zr{calculate(){return this.firstElementChild.calculate()}getSubRules(){let e=[];for(let t=1;t<this.children.length;t++)e.push(this.children[t]);return e}};var ws=class extends jr{render(){return b`${super.render()}`}};var lh=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Fr=class extends k{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(t.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.#e(r,this.figures):this.#t(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#e(e,t){if(e===0)return 0;let r=Math.pow(10,t);return Math.round(e*r)/r}#t(e,t){if(e===0)return 0;let r=Math.floor(Math.log10(Math.abs(e))),i=Math.pow(10,t-r-1);return Math.round(e*i)/i}};lh([p({type:String,attribute:"rounding-mode"})],Fr.prototype,"roundingMode",void 0);lh([p({type:Number})],Fr.prototype,"figures",void 0);var xs=class extends k{getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(t.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 qs=class extends se{process(){let e=this.getAttribute("identifier");if(!e){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let t=this.firstElementChild;if(!t){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new Ha(t).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:e,value:this.#e(i)}}))}#e(e){return e==null?null:Array.isArray(e)?e.map(t=>qe(this.#t(t))):qe(this.#t(e))}#t(e){if(e&&typeof e=="object"&&"value"in e){let t=e.value;return t!=null?t.toString():""}return e?.toString()??""}},Ha=class{constructor(e){this.expression=e}process(){let e=this.expression.calculate()??null;return e===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(e)?e.map(t=>this.#e(t)):this.#e(e)}#e(e){return e&&typeof e=="object"&&"value"in e?e.value:e}};var Cs=class extends se{process(){let e=this.getAttribute("identifier");if(!e){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let t=this.firstElementChild;if(!t){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new Wa(t).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:e,value:this.#e(i)}}))}#e(e){return Array.isArray(e)?e.map(qe):e!==null?qe(e):null}},Wa=class{constructor(e){this.expression=e}process(){let e=this.expression.calculate()??null;return e===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(e)?e.map(t=>t.value?t.value:t):e}};var Es=class extends se{process(){let e=this.getAttribute("identifier");if(!e){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let t=this.firstElementChild;if(!t){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new Qa(t).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:e,value:this.#e(i)}}))}#e(e){return e==null?null:Array.isArray(e)?e.map(t=>qe(this.#t(t))):qe(this.#t(e))}#t(e){if(e&&typeof e=="object"&&"value"in e){let t=e.value;return t!=null?t.toString():""}return e?.toString()??""}},Qa=class{constructor(e){this.expression=e}process(){let e=this.expression.calculate()??null;return e===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(e)?e.map(t=>this.#e(t)):this.#e(e)}#e(e){return e&&typeof e=="object"&&"value"in e?e.value:e}};var qu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Xi=class extends k{constructor(){super(...arguments),this.name=""}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let e=this.#t(this.getVariables());if(e.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return e.reduce((t,r)=>t+r,0)/e.length;case"popsd":return this.#e(e);default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#e(e){let t=e.reduce((i,o)=>i+o,0)/e.length,r=e.reduce((i,o)=>i+Math.pow(o-t,2),0)/e.length;return Math.sqrt(r)}#t(e){let t=[];for(let r of e){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}t.push(s)};if(Array.isArray(r.value)){r.value.forEach(o=>i(o));continue}i(r.value)}return t}};qu([p({type:String})],Xi.prototype,"name",void 0);var Cu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Yi=class extends k{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),o=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return J.compareSingleValues(i,o,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Cu([p({type:String,attribute:"case-sensitive"})],Yi.prototype,"caseSensitive",void 0);var Eu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ki=class extends k{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let e=this.getVariables();if(e.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[t,r]=e;if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(t.value===null||r.value===null||t.value===void 0||r.value===void 0)return null;let i=t.value.toString(),o=r.value.toString();return this.caseSensitive!=="true"?o.toLowerCase().includes(i.toLowerCase()):o.includes(i)}};Eu([p({type:String,attribute:"case-sensitive"})],Ki.prototype,"caseSensitive",void 0);var ks=class extends ku(k){getResult(){return this.calculateChildren(Array.from(this.children))}};function ku(n){return class extends n{calculateChildren(t){let r=t.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=i.calculate();return Number.isNaN(o)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(o)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var Ss=class extends k{getResult(){return new Ga(Array.from(this.children)).calculate()}},Ga=class{constructor(e){this.expressions=e}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 As=class extends k{getResult(){let e=this.getVariables();if(e.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let t=e[0];if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-truncate requires single cardinality"),null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(t.value===null||t.value===void 0)return null;let r=Number.parseFloat(t.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var Is=class extends k{getResult(){let e=this.getAttribute("identifier");return this.context.variables.find(r=>r.identifier===e).value}};var ch=[{tag:"qti-and",ctor:Fn},{tag:"qti-any-n",ctor:Nr},{tag:"qti-base-value",ctor:zi},{tag:"qti-container-size",ctor:Bn},{tag:"qti-contains",ctor:Un},{tag:"qti-correct",ctor:Hn},{tag:"qti-default",ctor:rr},{tag:"qti-delete",ctor:Wn},{tag:"qti-divide",ctor:Qn},{tag:"qti-duration-gte",ctor:Gn},{tag:"qti-duration-lt",ctor:Xn},{tag:"qti-equal",ctor:Fi},{tag:"qti-equal-rounded",ctor:ji},{tag:"qti-field-value",ctor:Yn},{tag:"qti-gcd",ctor:Kn},{tag:"qti-gt",ctor:Jn},{tag:"qti-gte",ctor:Zn},{tag:"qti-index",ctor:Bi},{tag:"qti-inside",ctor:$r},{tag:"qti-integer-divide",ctor:es},{tag:"qti-integer-modulus",ctor:ts},{tag:"qti-integer-to-float",ctor:rs},{tag:"qti-is-null",ctor:is},{tag:"qti-lcm",ctor:os},{tag:"qti-lookup-outcome-value",ctor:Lr},{tag:"qti-lt",ctor:ns},{tag:"qti-lte",ctor:ss},{tag:"qti-map-response",ctor:Hi},{tag:"qti-map-response-point",ctor:Ui},{tag:"qti-match",ctor:as},{tag:"qti-math-operator",ctor:Wi},{tag:"qti-max",ctor:ls},{tag:"qti-member",ctor:cs},{tag:"qti-min",ctor:ds},{tag:"qti-multiple",ctor:hs},{tag:"qti-not",ctor:ps},{tag:"qti-null",ctor:us},{tag:"qti-or",ctor:ms},{tag:"qti-ordered",ctor:fs},{tag:"qti-pattern-match",ctor:Qi},{tag:"qti-power",ctor:gs},{tag:"qti-printed-variable",ctor:Vr},{tag:"qti-product",ctor:bs},{tag:"qti-random",ctor:ys},{tag:"qti-random-integer",ctor:ir},{tag:"qti-repeat",ctor:Gi},{tag:"qti-response-condition",ctor:vs},{tag:"qti-response-else",ctor:zr},{tag:"qti-response-else-if",ctor:ws},{tag:"qti-response-if",ctor:jr},{tag:"qti-round",ctor:xs},{tag:"qti-round-to",ctor:Fr},{tag:"qti-rule",ctor:se},{tag:"qti-set-correct-response",ctor:qs},{tag:"qti-set-outcome-value",ctor:Cs},{tag:"qti-set-template-value",ctor:Es},{tag:"qti-stats-operator",ctor:Xi},{tag:"qti-string-match",ctor:Yi},{tag:"qti-substring",ctor:Ki},{tag:"qti-subtract",ctor:ks},{tag:"qti-sum",ctor:Ss},{tag:"qti-truncate",ctor:As},{tag:"qti-variable",ctor:Is}];for(let{tag:n,ctor:e}of ch)customElements.get(n)||customElements.define(n,e);var nt=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},X;(function(n){n.Correct="correct",n.PartiallyCorrect="partially-correct",n.Incorrect="incorrect"})(X||(X={}));var Xa=n=>{class e extends n{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",""))}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 o=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>o.includes(d)).length,c=a.filter(d=>!o.includes(d)).length;return l===o.length&&c===0&&a.length===o.length?X.Correct:l>0&&(l<o.length||c>0)?X.PartiallyCorrect:X.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,o=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==X.Correct))){if(!o)return;this.parentElement?.removeChild(i);return}if(o)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(r){this._internals.states.delete("show-correct-response"),r&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return nt([p({attribute:"correct-response",reflect:!0,converter:Le({emptyAs:null})})],e.prototype,"correctResponseAttr",null),nt([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],e.prototype,"showCorrectResponse",void 0),nt([$("showCorrectResponse",{waitUntilFirstUpdate:!0})],e.prototype,"_handleShowCorrectResponseChange",void 0),nt([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],e.prototype,"showFullCorrectResponse",void 0),nt([$("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],e.prototype,"_handleShowFullCorrectResponseChange",void 0),nt([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],e.prototype,"showCandidateCorrection",void 0),nt([$("showCandidateCorrection",{waitUntilFirstUpdate:!0})],e.prototype,"_handleShowCandidateCorrectionChange",void 0),nt([_()],e.prototype,"_isFullCorrectResponse",void 0),nt([_()],e.prototype,"_correctResponse",void 0),e};var re=q`
9145
9519
  /* Nothing at all until the item judges this element. */
9146
9520
  [part~='correction'] {
9147
9521
  display: none;
@@ -9174,21 +9548,21 @@ CES.load();
9174
9548
 
9175
9549
  pointer-events: none;
9176
9550
  }
9177
- `;var Su=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},G=n=>{class e extends Xa(n){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return this._candidateCorrection?`correction correction-${this._candidateCorrection}`:"correction"}toggleCandidateCorrection(r){this.showCandidateCorrection!==r&&(this.showCandidateCorrection=r),super.toggleCandidateCorrection(r);let i=this._internals;i.states.delete("candidate-correct"),i.states.delete("candidate-partially-correct"),i.states.delete("candidate-incorrect");let o=null;r&&(this.correctness===X.Correct&&(i.states.add("candidate-correct"),o="correct"),this.correctness===X.PartiallyCorrect&&(i.states.add("candidate-partially-correct"),o="partially-correct"),this.correctness===X.Incorrect&&(i.states.add("candidate-incorrect"),o="incorrect")),this._candidateCorrection!==o&&(this._candidateCorrection=o)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return Su([_()],e.prototype,"_candidateCorrection",void 0),e};var ir=n=>{class e extends G(n){toggleInternalCorrectResponse(r){super.toggleInternalCorrectResponse(r);let i=this.correctResponse,o=i?Array.isArray(i)?i:[i]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),r&&o.length>0&&s.internals.states.add(o.includes(s.identifier)?"correct-response":"incorrect-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],o=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)o.includes(s.identifier)&&(s.candidateCorrection=i.includes(s.identifier)?"correct":"incorrect")}}return e};var we=n=>{class e extends n{#e=null;get candidateCorrection(){return this.#e}set candidateCorrection(r){if(this.#e===r)return;let i=this.#e;this.#e=r;let o=this.internals.states;o.delete("candidate-correct"),o.delete("candidate-incorrect"),o.delete("candidate-partially-correct"),r&&o.add(`candidate-${r}`),this.requestUpdate("candidateCorrection",i)}get correctionPart(){return this.#e?`correction correction-${this.#e}`:"correction"}}return e};var Ya=class extends we(bt){static{this.styles=[bt.styles,re]}render(){return b`<div part="control"></div>
9551
+ `;var Su=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},G=n=>{class e extends Xa(n){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return this._candidateCorrection?`correction correction-${this._candidateCorrection}`:"correction"}toggleCandidateCorrection(r){this.showCandidateCorrection!==r&&(this.showCandidateCorrection=r),super.toggleCandidateCorrection(r);let i=this._internals;i.states.delete("candidate-correct"),i.states.delete("candidate-partially-correct"),i.states.delete("candidate-incorrect");let o=null;r&&(this.correctness===X.Correct&&(i.states.add("candidate-correct"),o="correct"),this.correctness===X.PartiallyCorrect&&(i.states.add("candidate-partially-correct"),o="partially-correct"),this.correctness===X.Incorrect&&(i.states.add("candidate-incorrect"),o="incorrect")),this._candidateCorrection!==o&&(this._candidateCorrection=o)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return Su([_()],e.prototype,"_candidateCorrection",void 0),e};var or=n=>{class e extends G(n){toggleInternalCorrectResponse(r){super.toggleInternalCorrectResponse(r);let i=this.correctResponse,o=i?Array.isArray(i)?i:[i]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),r&&o.length>0&&s.internals.states.add(o.includes(s.identifier)?"correct-response":"incorrect-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],o=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)o.includes(s.identifier)&&(s.candidateCorrection=i.includes(s.identifier)?"correct":"incorrect")}}return e};var xe=n=>{class e extends n{#e=null;get candidateCorrection(){return this.#e}set candidateCorrection(r){if(this.#e===r)return;let i=this.#e;this.#e=r;let o=this.internals.states;o.delete("candidate-correct"),o.delete("candidate-incorrect"),o.delete("candidate-partially-correct"),r&&o.add(`candidate-${r}`),this.requestUpdate("candidateCorrection",i)}get correctionPart(){return this.#e?`correction correction-${this.#e}`:"correction"}}return e};var Ya=class extends xe(yt){static{this.styles=[yt.styles,re]}render(){return b`<div part="control"></div>
9178
9552
  <slot part="label"></slot>
9179
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Au=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},_s=class extends we(Gt){constructor(){super(...arguments),this.orderCorrect=null}};Au([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],_s.prototype,"orderCorrect",void 0);var Ka=class extends we(Xt){static{this.styles=[Xt.styles,re]}render(){return b`<div part="control"><div part="control-mark"></div></div>
9553
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Au=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},_s=class extends xe(Xt){constructor(){super(...arguments),this.orderCorrect=null}};Au([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],_s.prototype,"orderCorrect",void 0);var Ka=class extends xe(Yt){static{this.styles=[Yt.styles,re]}render(){return b`<div part="control"><div part="control-mark"></div></div>
9180
9554
  <slot part="label"></slot>
9181
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Ja=class extends we(ke){static{this.styles=[ke.styles,re]}render(){return b`
9555
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Ja=class extends xe(Se){static{this.styles=[Se.styles,re]}render(){return b`
9182
9556
  <div part="control"></div>
9183
9557
  <slot part="label"></slot>
9184
9558
  <span part=${this.correctionPart} aria-hidden="true"></span>
9185
9559
  <div part="drop">
9186
9560
  ${H(this.drags,e=>e.getAttribute("identifier"),e=>e)}
9187
9561
  </div>
9188
- `}};var Za=class extends we(Se){static{this.styles=[Se.styles,re]}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
9562
+ `}};var Za=class extends xe(Ae){static{this.styles=[Ae.styles,re]}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
9189
9563
  ${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:P}
9190
9564
  <slot part="label"></slot>
9191
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var dh=class extends te{showCorrectResponse(e){for(let t of this.interactionElements)t.toggleCorrectResponse?.(e);this.updateControlState("item-show-correct-response",e)}showCandidateCorrection(e){for(let t of this.interactionElements)t.toggleCandidateCorrection?.(e);this.updateControlState("item-show-candidate-correction",e)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(e,t){let r=this.getRootNode();for(;;){if(r.querySelectorAll(e).forEach(i=>i.shown=t),!(r instanceof ShadowRoot))return;r=r.host.getRootNode()}}};var hh=class extends et{#e=e=>{let t=e.detail;this.assessmentItem?.showCorrectResponse?.(t),this.updateControlState("item-show-correct-response",t)};#t=e=>{let t=e.detail;this.assessmentItem?.showCandidateCorrection?.(t),this.updateControlState("item-show-candidate-correction",t)};#r=e=>{this.assessmentItem?.showCorrectResponse?.(!1),this.configContext={...this.configContext,correctResponseMode:e.detail}};constructor(){super(),this.addEventListener("item-show-correct-response",this.#e),this.addEventListener("item-show-candidate-correction",this.#t),this.addEventListener("item-switch-correct-response-mode",this.#r)}updateControlState(e,t){this.querySelectorAll(e).forEach(r=>r.shown=t)}disconnectedCallback(){this.removeEventListener("item-show-correct-response",this.#e),this.removeEventListener("item-show-candidate-correction",this.#t),this.removeEventListener("item-switch-correct-response-mode",this.#r),super.disconnectedCallback()}};var ph=class extends oe{#e=e=>{this.activeAssessmentItem?.showCorrectResponse?.(e.detail)};#t=e=>{this.activeAssessmentItem?.showCandidateCorrection?.(e.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#e),this.addEventListener("test-show-candidate-correction",this.#t)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#e),this.removeEventListener("test-show-candidate-correction",this.#t),super.disconnectedCallback()}},uh=class extends Lt{updateAssessmentItemView(e,t){e.showCorrectResponse?.(t==="scorer")}},mh=class extends Er{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var el=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ji=class extends C{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#e(e){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:e,bubbles:!0}))}render(){return b`
9565
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var dh=class extends te{showCorrectResponse(e){for(let t of this.interactionElements)t.toggleCorrectResponse?.(e);this.updateControlState("item-show-correct-response",e)}showCandidateCorrection(e){for(let t of this.interactionElements)t.toggleCandidateCorrection?.(e);this.updateControlState("item-show-candidate-correction",e)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(e,t){let r=this.getRootNode();for(;;){if(r.querySelectorAll(e).forEach(i=>i.shown=t),!(r instanceof ShadowRoot))return;r=r.host.getRootNode()}}};var hh=class extends et{#e=e=>{let t=e.detail;this.assessmentItem?.showCorrectResponse?.(t),this.updateControlState("item-show-correct-response",t)};#t=e=>{let t=e.detail;this.assessmentItem?.showCandidateCorrection?.(t),this.updateControlState("item-show-candidate-correction",t)};#r=e=>{this.assessmentItem?.showCorrectResponse?.(!1),this.configContext={...this.configContext,correctResponseMode:e.detail}};constructor(){super(),this.addEventListener("item-show-correct-response",this.#e),this.addEventListener("item-show-candidate-correction",this.#t),this.addEventListener("item-switch-correct-response-mode",this.#r)}updateControlState(e,t){this.querySelectorAll(e).forEach(r=>r.shown=t)}disconnectedCallback(){this.removeEventListener("item-show-correct-response",this.#e),this.removeEventListener("item-show-candidate-correction",this.#t),this.removeEventListener("item-switch-correct-response-mode",this.#r),super.disconnectedCallback()}};var ph=class extends oe{#e=e=>{this.activeAssessmentItem?.showCorrectResponse?.(e.detail)};#t=e=>{this.activeAssessmentItem?.showCandidateCorrection?.(e.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#e),this.addEventListener("test-show-candidate-correction",this.#t)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#e),this.removeEventListener("test-show-candidate-correction",this.#t),super.disconnectedCallback()}},uh=class extends Vt{updateAssessmentItemView(e,t){e.showCorrectResponse?.(t==="scorer")}},mh=class extends Er{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var el=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ji=class extends C{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#e(e){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:e,bubbles:!0}))}render(){return b`
9192
9566
  <label part="label" for="modeSelect">${this.label}</label>
9193
9567
  <select
9194
9568
  part="select"
@@ -9212,31 +9586,31 @@ CES.load();
9212
9586
  `,Ur=q`
9213
9587
  cursor: not-allowed;
9214
9588
  opacity: 0.8;
9215
- `,H2=q`
9589
+ `,Q2=q`
9216
9590
  ${fh};
9217
9591
  border: 1px solid gray;
9218
- `;var Hr=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},At=class extends C{static{this.styles=q`
9592
+ `;var Hr=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},It=class extends C{static{this.styles=q`
9219
9593
  :host {
9220
9594
  ${Br};
9221
9595
  }
9222
9596
  :host([disabled]) {
9223
9597
  ${Ur};
9224
9598
  }
9225
- `}#e;#t;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.#e=!1,this.#t=""}updated(){if(!this.#e||this.#t!==this.computedContext?.identifier){this.#t=this.computedContext?.identifier;let e=!!this.computedContext?.variables.some(r=>r.correctResponse),t=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#e=e||t}this.disabled=!this.#e}#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 b` <div @click="${this.#r}">${this.#i()}</div> `}};Hr([T({context:ct,subscribe:!0})],At.prototype,"computedContext",void 0);Hr([p({type:Boolean,reflect:!0})],At.prototype,"shown",void 0);Hr([p({type:Boolean,reflect:!0})],At.prototype,"disabled",void 0);Hr([p({type:String})],At.prototype,"showCandidateCorrectionText",void 0);Hr([p({type:String})],At.prototype,"hideCandidateCorrectionText",void 0);Hr([p({type:String})],At.prototype,"noCorrectResponseText",void 0);var Wr=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},It=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.#e=!1,this.#t=""}static{this.styles=q`
9599
+ `}#e;#t;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.#e=!1,this.#t=""}updated(){if(!this.#e||this.#t!==this.computedContext?.identifier){this.#t=this.computedContext?.identifier;let e=!!this.computedContext?.variables.some(r=>r.correctResponse),t=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#e=e||t}this.disabled=!this.#e}#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 b` <div @click="${this.#r}">${this.#i()}</div> `}};Hr([T({context:ct,subscribe:!0})],It.prototype,"computedContext",void 0);Hr([p({type:Boolean,reflect:!0})],It.prototype,"shown",void 0);Hr([p({type:Boolean,reflect:!0})],It.prototype,"disabled",void 0);Hr([p({type:String})],It.prototype,"showCandidateCorrectionText",void 0);Hr([p({type:String})],It.prototype,"hideCandidateCorrectionText",void 0);Hr([p({type:String})],It.prototype,"noCorrectResponseText",void 0);var Wr=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},_t=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.#e=!1,this.#t=""}static{this.styles=q`
9226
9600
  :host {
9227
9601
  ${Br};
9228
9602
  }
9229
9603
  :host([disabled]) {
9230
9604
  ${Ur};
9231
9605
  }
9232
- `}#e;#t;updated(){if(!this.#e||this.#t!==this.computedContext?.identifier){this.#t=this.computedContext?.identifier;let e=!!this.computedContext?.variables.some(r=>r.correctResponse),t=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#e=e||t}this.disabled=!this.#e}#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 b` <div @click="${this.#r}">${this.#i()}</div> `}};Wr([T({context:ct,subscribe:!0})],It.prototype,"computedContext",void 0);Wr([p({type:Boolean,reflect:!0})],It.prototype,"shown",void 0);Wr([p({type:Boolean,reflect:!0})],It.prototype,"disabled",void 0);Wr([p({type:String})],It.prototype,"showCorrectText",void 0);Wr([p({type:String})],It.prototype,"hideCorrectText",void 0);Wr([p({type:String})],It.prototype,"noCorrectResponseText",void 0);var Qr=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},_t=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"}static{this.styles=q`
9606
+ `}#e;#t;updated(){if(!this.#e||this.#t!==this.computedContext?.identifier){this.#t=this.computedContext?.identifier;let e=!!this.computedContext?.variables.some(r=>r.correctResponse),t=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#e=e||t}this.disabled=!this.#e}#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 b` <div @click="${this.#r}">${this.#i()}</div> `}};Wr([T({context:ct,subscribe:!0})],_t.prototype,"computedContext",void 0);Wr([p({type:Boolean,reflect:!0})],_t.prototype,"shown",void 0);Wr([p({type:Boolean,reflect:!0})],_t.prototype,"disabled",void 0);Wr([p({type:String})],_t.prototype,"showCorrectText",void 0);Wr([p({type:String})],_t.prototype,"hideCorrectText",void 0);Wr([p({type:String})],_t.prototype,"noCorrectResponseText",void 0);var Qr=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Tt=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"}static{this.styles=q`
9233
9607
  :host {
9234
9608
  ${Br};
9235
9609
  }
9236
9610
  :host([disabled]) {
9237
9611
  ${Ur};
9238
9612
  }
9239
- `}#e;willUpdate(e){let t=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(i=>i.items)).find(r=>r.active);if(this.#e!==t&&(this.shown=!1,this.#e=t),t){let r=!!t?.variables?.some(o=>o.correctResponse),i=!!t?.variables?.some(o=>o.mapping?.mapEntries?.length>0||o.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!i}else this.disabled=!0}#t(){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 b` <div @click="${this.#t}">${this.#r()}</div> `}};Qr([T({context:F,subscribe:!0})],_t.prototype,"computedContext",void 0);Qr([p({type:Boolean,reflect:!0})],_t.prototype,"shown",void 0);Qr([p({type:Boolean,reflect:!0})],_t.prototype,"disabled",void 0);Qr([p({type:String})],_t.prototype,"showCorrectText",void 0);Qr([p({type:String})],_t.prototype,"hideCorrectText",void 0);Qr([p({type:String})],_t.prototype,"noCorrectResponseText",void 0);var He=n=>{class e extends G(n){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 e};var rl=class extends He(Jt){};var il=class extends ir(Zt){};var Iu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ts=class extends we(Q){static{this.styles=[Q.styles,re,q`
9613
+ `}#e;willUpdate(e){let t=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(i=>i.items)).find(r=>r.active);if(this.#e!==t&&(this.shown=!1,this.#e=t),t){let r=!!t?.variables?.some(o=>o.correctResponse),i=!!t?.variables?.some(o=>o.mapping?.mapEntries?.length>0||o.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!i}else this.disabled=!0}#t(){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 b` <div @click="${this.#t}">${this.#r()}</div> `}};Qr([T({context:F,subscribe:!0})],Tt.prototype,"computedContext",void 0);Qr([p({type:Boolean,reflect:!0})],Tt.prototype,"shown",void 0);Qr([p({type:Boolean,reflect:!0})],Tt.prototype,"disabled",void 0);Qr([p({type:String})],Tt.prototype,"showCorrectText",void 0);Qr([p({type:String})],Tt.prototype,"hideCorrectText",void 0);Qr([p({type:String})],Tt.prototype,"noCorrectResponseText",void 0);var He=n=>{class e extends G(n){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 e};var rl=class extends He(Zt){};var il=class extends or(er){};var Iu=function(n,e,t,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(e,t,o):s(e,t))||o);return i>3&&o&&Object.defineProperty(e,t,o),o},Ts=class extends xe(Q){static{this.styles=[Q.styles,re,q`
9240
9614
  /*
9241
9615
  * Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
9242
9616
  * is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
@@ -9299,7 +9673,7 @@ CES.load();
9299
9673
  }
9300
9674
  `]}render(){return b`${this.renderPrompt()}${this.renderTextarea()}
9301
9675
  <span part=${this.correctionPart} aria-hidden="true"></span>
9302
- ${this.renderValidationMessage()}`}};Iu([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],Ts.prototype,"candidateCorrection",void 0);var Rs=n=>n?(Array.isArray(n)?n:[n]).map(t=>{let[r,i]=t.split(" ");return{source:r,target:i}}):[];var ol=class extends He(Tr){toggleCandidateCorrection(e){super.toggleCandidateCorrection(e);let t=Rs(this.correctResponse);for(let r of this.querySelectorAll("qti-gap")){let i=r.getAttribute("identifier"),o=r.drags;for(let s of o)s.candidateCorrection=null,e&&t.some(a=>a.source===s.identifier&&a.target===i)?s.candidateCorrection="correct":e&&(s.candidateCorrection="incorrect")}}};var nl=class extends G(Te){#e=[];toggleInternalCorrectResponse(e){super.toggleInternalCorrectResponse(e);let t=this.correctResponse,r=this.#e;this.#e=e&&t?Array.isArray(t)?[...t]:[t]:[],this.requestUpdate("correctLines",r)}renderSupplementalLines(){return H(this.#e,e=>e,e=>ai`
9676
+ ${this.renderValidationMessage()}`}};Iu([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],Ts.prototype,"candidateCorrection",void 0);var Rs=n=>n?(Array.isArray(n)?n:[n]).map(t=>{let[r,i]=t.split(" ");return{source:r,target:i}}):[];var ol=class extends He(Tr){toggleCandidateCorrection(e){super.toggleCandidateCorrection(e);let t=Rs(this.correctResponse);for(let r of this.querySelectorAll("qti-gap")){let i=r.getAttribute("identifier"),o=r.drags;for(let s of o)s.candidateCorrection=null,e&&t.some(a=>a.source===s.identifier&&a.target===i)?s.candidateCorrection="correct":e&&(s.candidateCorrection="incorrect")}}};var nl=class extends G(Re){#e=[];toggleInternalCorrectResponse(e){super.toggleInternalCorrectResponse(e);let t=this.correctResponse,r=this.#e;this.#e=e&&t?Array.isArray(t)?[...t]:[t]:[],this.requestUpdate("correctLines",r)}renderSupplementalLines(){return H(this.#e,e=>e,e=>ai`
9303
9677
  <line
9304
9678
  part="correct-line"
9305
9679
  x1=${parseInt(this.querySelector(`[identifier=${e.split(" ")[0]}]`).style.left)}
@@ -9310,7 +9684,7 @@ CES.load();
9310
9684
  stroke-width="3"
9311
9685
  stroke-dasharray="5,5"
9312
9686
  />
9313
- `)}};var sl=class extends He(Rr){};var al=class extends G(Or){resolvePinColor(e){let t=e;return t.matches(":state(candidate-incorrect)")?"var(--qti-incorrect)":t.matches(":state(candidate-correct)")?"var(--qti-correct)":t.matches(":state(correct-response)")?"var(--qti-answer-border)":super.resolvePinColor(e)}toggleInternalCorrectResponse(e){super.toggleInternalCorrectResponse(e);let t=this.correctResponse,r=t?Array.isArray(t)?t:[t]:[];for(let i of this._choiceElements){let o=r.indexOf(i.identifier);i.orderCorrect=e&&o>=0?o+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(e){super.toggleCandidateCorrection(e);let t=this.correctResponse,r=t?Array.isArray(t)?t:[t]:[];for(let i of this._choiceElements)i.candidateCorrection=null,e&&i.order!=null&&(i.candidateCorrection=r[i.order-1]===i.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var ll=class extends ir(Pr){};var cl=class extends ir(Mr){};var dl=class extends G(ee){static get styles(){return[ee.styles,re,q`
9687
+ `)}};var sl=class extends He(Rr){};var al=class extends G(Or){resolvePinColor(e){let t=e;return t.matches(":state(candidate-incorrect)")?"var(--qti-incorrect)":t.matches(":state(candidate-correct)")?"var(--qti-correct)":t.matches(":state(correct-response)")?"var(--qti-answer-border)":super.resolvePinColor(e)}toggleInternalCorrectResponse(e){super.toggleInternalCorrectResponse(e);let t=this.correctResponse,r=t?Array.isArray(t)?t:[t]:[];for(let i of this._choiceElements){let o=r.indexOf(i.identifier);i.orderCorrect=e&&o>=0?o+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(e){super.toggleCandidateCorrection(e);let t=this.correctResponse,r=t?Array.isArray(t)?t:[t]:[];for(let i of this._choiceElements)i.candidateCorrection=null,e&&i.order!=null&&(i.candidateCorrection=r[i.order-1]===i.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var ll=class extends or(Pr){};var cl=class extends or(Mr){};var dl=class extends G(ee){static get styles(){return[ee.styles,re,q`
9314
9688
  /*
9315
9689
  * Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
9316
9690
  * badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
@@ -9329,7 +9703,7 @@ CES.load();
9329
9703
  `]}toggleInternalCorrectResponse(e){this.showFullCorrectResponse||this.toggleFullCorrectResponse(e)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return b`
9330
9704
  ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
9331
9705
  <span part=${this.correctionPart} aria-hidden="true"></span>
9332
- `}};var hl=class extends He(ot){#e=new Set;toggleCandidateCorrection(e){super.toggleCandidateCorrection(e);let t=Rs(this.correctResponse);this.#e=e?new Set(t.map(r=>`${r.source} ${r.target}`)):new Set;for(let r of this.targetChoices){let i=r.getAttribute("identifier"),o=r.drags;for(let s of o)s.candidateCorrection=null,e&&(s.candidateCorrection=this.#e.has(`${s.identifier} ${i}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(e,t){return!this.showCandidateCorrection||!t?"":this.#e.has(e)?"correct":"incorrect"}};function _u(n){if(n.length===0)return new Set;let e=new Array(n.length).fill(1),t=new Array(n.length).fill(-1);for(let o=0;o<n.length;o++)for(let s=0;s<o;s++)n[s]<n[o]&&e[s]+1>e[o]&&(e[o]=e[s]+1,t[o]=s);let r=0;for(let o=1;o<n.length;o++)e[o]>e[r]&&(r=o);let i=new Set;for(let o=r;o!==-1;o=t[o])i.add(o);return i}function gh(n,e){let t=new Map(e.map((a,l)=>[a,l])),r=n.filter(a=>t.has(a)),i=r.map(a=>t.get(a)),o=_u(i),s=new Set;return o.forEach(a=>s.add(r[a])),s}var pl=class extends He(St){toggleCandidateCorrection(e){super.toggleCandidateCorrection(e);let r=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(c=>this.chipsIn(c));for(let c of r)c.candidateCorrection=null;if(!e)return;let i=this.correctResponse,s=(i?Array.isArray(i)?i:[i]:[]).map((c,d)=>{let[h,g]=c.split(" "),f=g?.startsWith("droplist")?parseInt(g.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(f)?d:f}}).filter(c=>c.identifier).sort((c,d)=>c.dropIndex-d.dropIndex).map(c=>c.identifier);if(s.length===0)return;let a=r.map(c=>({choice:c,identifier:c.getAttribute("identifier")})).filter(c=>!!c.identifier),l=gh(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var ul=class extends G(W){toggleInternalCorrectResponse(e){super.toggleInternalCorrectResponse(e);let t=this.responseVariable,r=t?.correctResponse??this.correctResponse;this.correctResponse=e?r:t?.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${i}`).forEach(g=>g.remove()),!e){this.enable();return}if(this.disable(),!this.correctResponse)return;let o=document.createElement("div");o.id=i,o.className="pci-correct-response-container",Object.assign(o.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"}),o.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 g of Array.from(this.children))g.tagName.startsWith("QTI-")&&a.append(g.cloneNode(!0));let c=this.correctResponse,d=t?.cardinality??(Array.isArray(c)?"multiple":"single"),h=t?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:c}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let g=a.responseVariablesToQtiVariableJSON(c,d,h);a.sendMessageToIframe("setBoundTo",{[l]:g}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",o.append(a),this.after(o)}};var ml=class extends G(ce){#e=[];#t=[];static{this.styles=[ce.styles,q`
9706
+ `}};var hl=class extends He(ot){#e=new Set;toggleCandidateCorrection(e){super.toggleCandidateCorrection(e);let t=Rs(this.correctResponse);this.#e=e?new Set(t.map(r=>`${r.source} ${r.target}`)):new Set;for(let r of this.targetChoices){let i=r.getAttribute("identifier"),o=r.drags;for(let s of o)s.candidateCorrection=null,e&&(s.candidateCorrection=this.#e.has(`${s.identifier} ${i}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(e,t){return!this.showCandidateCorrection||!t?"":this.#e.has(e)?"correct":"incorrect"}};function _u(n){if(n.length===0)return new Set;let e=new Array(n.length).fill(1),t=new Array(n.length).fill(-1);for(let o=0;o<n.length;o++)for(let s=0;s<o;s++)n[s]<n[o]&&e[s]+1>e[o]&&(e[o]=e[s]+1,t[o]=s);let r=0;for(let o=1;o<n.length;o++)e[o]>e[r]&&(r=o);let i=new Set;for(let o=r;o!==-1;o=t[o])i.add(o);return i}function gh(n,e){let t=new Map(e.map((a,l)=>[a,l])),r=n.filter(a=>t.has(a)),i=r.map(a=>t.get(a)),o=_u(i),s=new Set;return o.forEach(a=>s.add(r[a])),s}var pl=class extends He(At){toggleCandidateCorrection(e){super.toggleCandidateCorrection(e);let r=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(c=>this.chipsIn(c));for(let c of r)c.candidateCorrection=null;if(!e)return;let i=this.correctResponse,s=(i?Array.isArray(i)?i:[i]:[]).map((c,d)=>{let[h,g]=c.split(" "),m=g?.startsWith("droplist")?parseInt(g.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=r.map(c=>({choice:c,identifier:c.getAttribute("identifier")})).filter(c=>!!c.identifier),l=gh(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var ul=class extends G(W){toggleInternalCorrectResponse(e){super.toggleInternalCorrectResponse(e);let t=this.responseVariable,r=t?.correctResponse??this.correctResponse;this.correctResponse=e?r:t?.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${i}`).forEach(g=>g.remove()),!e){this.enable();return}if(this.disable(),!this.correctResponse)return;let o=document.createElement("div");o.id=i,o.className="pci-correct-response-container",Object.assign(o.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"}),o.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 g of Array.from(this.children))g.tagName.startsWith("QTI-")&&a.append(g.cloneNode(!0));let c=this.correctResponse,d=t?.cardinality??(Array.isArray(c)?"multiple":"single"),h=t?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:c}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let g=a.responseVariablesToQtiVariableJSON(c,d,h);a.sendMessageToIframe("setBoundTo",{[l]:g}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",o.append(a),this.after(o)}};var ml=class extends G(ce){#e=[];#t=[];static{this.styles=[ce.styles,q`
9333
9707
  [part~='correct'] {
9334
9708
  --qti-select-point-marker-color: var(--qti-correct);
9335
9709
  }
@@ -9342,7 +9716,7 @@ CES.load();
9342
9716
  data-coord=${e.coords}
9343
9717
  data-shape=${e.shape}
9344
9718
  alt=${`correct-response-${t+1}`}
9345
- ></div>`)}updated(e){super.updated(e),e.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var fl=class extends G(ve){#e=null;static{this.styles=[ve.styles,q`
9719
+ ></div>`)}updated(e){super.updated(e),e.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var fl=class extends G(we){#e=null;static{this.styles=[we.styles,q`
9346
9720
  [part='knob-correct'] {
9347
9721
  background-color: var(--qti-correct-light);
9348
9722
  border: 2px solid var(--qti-correct);
@@ -9390,7 +9764,7 @@ CES.load();
9390
9764
  ${this.renderAnswer()} ${this.renderInput()}
9391
9765
  <span part=${this.correctionPart} aria-hidden="true"></span>
9392
9766
  ${this.renderValidationMessage()}
9393
- `}};export{G as CandidateCorrectionMixin,ir as ChoiceCorrectionMixin,Xa as CorrectResponseMixin,X as Correctness,Ks as INITIAL_SESSION_CONTEXT,Js as INITIAL_TEST_CONTEXT,D as Interaction,ea as IsNullOrUndefined,Ee as ItemContainer,Ji as ItemCorrectResponseMode,Ti as ItemPrintVariables,At as ItemShowCandidateCorrection,It as ItemShowCorrectResponse,Fn as QtiAnd,Nr as QtiAnyN,te as QtiAssessmentItem,dh as QtiAssessmentItemCorrection,Pe as QtiAssessmentItemRef,Le as QtiAssessmentSection,wr as QtiAssessmentStimulusRef,ha as QtiAssessmentStimulusRefConnectedEvent,$t as QtiAssessmentTest,Sr as QtiAssociableHotspot,Jt as QtiAssociateInteraction,rl as QtiAssociateInteractionCorrection,zi as QtiBaseValue,Zt as QtiChoiceInteraction,il as QtiChoiceInteractionCorrection,qo as QtiCompanionMaterialsInfo,ue as QtiConditionExpression,Bn as QtiContainerSize,Un as QtiContains,pi as QtiContentBody,xr as QtiContextDeclaration,Hn as QtiCorrect,rt as QtiCustomInteraction,ui as QtiCustomOperator,tr as QtiDefault,Wn as QtiDelete,Qn as QtiDivide,Gn as QtiDurationGte,Xn as QtiDurationLt,Et as QtiEndAttemptInteraction,Fi as QtiEqual,ji as QtiEqualRounded,k as QtiExpression,Q as QtiExtendedTextInteraction,Ts as QtiExtendedTextInteractionCorrection,le as QtiFeedback,Co as QtiFeedbackBlock,Eo as QtiFeedbackInline,Yn as QtiFieldValue,Wt as QtiGap,Ri as QtiGapImg,Tr as QtiGapMatchInteraction,ol as QtiGapMatchInteractionCorrection,bt as QtiGapText,Ya as QtiGapTextCorrection,Kn as QtiGcd,Te as QtiGraphicAssociateInteraction,nl as QtiGraphicAssociateInteractionCorrection,Rr as QtiGraphicGapMatchInteraction,sl as QtiGraphicGapMatchInteractionCorrection,Or as QtiGraphicOrderInteraction,al as QtiGraphicOrderInteractionCorrection,Jn as QtiGt,Zn as QtiGte,Gt as QtiHotspotChoice,_s as QtiHotspotChoiceCorrection,Pr as QtiHotspotInteraction,ll as QtiHotspotInteractionCorrection,Xt as QtiHottext,Ka as QtiHottextCorrection,Mr as QtiHottextInteraction,cl as QtiHottextInteractionCorrection,Bi as QtiIndex,Oi as QtiInlineChoice,ee as QtiInlineChoiceInteraction,dl as QtiInlineChoiceInteractionCorrection,$r as QtiInside,es as QtiIntegerDivide,ts as QtiIntegerModulus,rs as QtiIntegerToFloat,is as QtiIsNull,et as QtiItem,ko as QtiItemBody,hh as QtiItemCorrection,os as QtiLcm,Lr as QtiLookupOutcomeValue,ns as QtiLt,ss as QtiLte,Hi as QtiMapResponse,Ui as QtiMapResponsePoint,as as QtiMatch,ot as QtiMatchInteraction,hl as QtiMatchInteractionCorrection,Wi as QtiMathOperator,ls as QtiMax,In as QtiMediaInteraction,cs as QtiMember,ds as QtiMin,qr as QtiModalFeedback,hs as QtiMultiple,ps as QtiNot,us as QtiNull,ms as QtiOr,St as QtiOrderInteraction,pl as QtiOrderInteractionCorrection,fs as QtiOrdered,Ye as QtiOutcomeDeclaration,Qi as QtiPatternMatch,W as QtiPortableCustomInteraction,ul as QtiPortableCustomInteractionCorrection,Pn as QtiPositionObjectInteraction,Mn as QtiPositionObjectStage,gs as QtiPower,Vr as QtiPrintedVariable,bs as QtiProduct,tn as QtiPrompt,ys as QtiRandom,rr as QtiRandomInteger,Gi as QtiRepeat,vs as QtiResponseCondition,ut as QtiResponseDeclaration,zr as QtiResponseElse,ws as QtiResponseElseIf,jr as QtiResponseIf,Ao as QtiResponseProcessing,xs as QtiRound,Fr as QtiRoundTo,Ke as QtiRubricBlock,Bl as QtiRuleElement,ce as QtiSelectPointInteraction,ml as QtiSelectPointInteractionCorrection,qs as QtiSetCorrectResponse,Ha as QtiSetCorrectResponseRule,Cs as QtiSetOutcomeValue,Wa as QtiSetOutcomeValueRule,Es as QtiSetTemplateValue,Qa as QtiSetTemplateValueRule,ke as QtiSimpleAssociableChoice,Ja as QtiSimpleAssociableChoiceCorrection,Se as QtiSimpleChoice,Za as QtiSimpleChoiceCorrection,ve as QtiSliderInteraction,fl as QtiSliderInteractionCorrection,Xi as QtiStatsOperator,Yi as QtiStringMatch,Io as QtiStylesheet,Ki as QtiSubstring,ks as QtiSubtract,Ss as QtiSum,Ga as QtiSumExpression,_o as QtiTemplateConstraint,Je as QtiTemplateDeclaration,To as QtiTemplateProcessing,Lt as QtiTest,uh as QtiTestCorrection,Ro as QtiTestFeedback,mt as QtiTestPart,ne as QtiTextEntryInteraction,gl as QtiTextEntryInteractionCorrection,As as QtiTruncate,zn as QtiUploadInteraction,Is as QtiVariable,hr as QtiVariableDeclaration,J as ScoringHelper,Er as TestCheckItem,mh as TestCheckItemCorrection,Ce as TestContainer,Lo as TestEndAttempt,yi as TestItemLink,zt as TestItemToSpeech,oe as TestNavigation,ph as TestNavigationCorrection,jt as TestNext,Ci as TestPagingButtonsStamp,Ft as TestPrev,Ei as TestPrintContext,ki as TestPrintVariables,Bt as TestScoringButtons,kr as TestScoringFeedback,Si as TestSectionButtonsStamp,Ai as TestSectionLink,_t as TestShowCorrectResponse,Ut as TestStamp,Wo as TestTtsNext,Fo as TestTtsPause,jo as TestTtsPlay,Ho as TestTtsPrev,Bo as TestTtsResume,Uo as TestTtsStop,Be as TestView,_i as TestViewToggle,Of as asSeed,R as boxSizing,F as computedContext,ct as computedItemContext,de as configContext,xe as convertNumberToUniversalFormat,re as correctionPart,Nh as decimalSeparator,Ne as dropRegion,hM as getItemByUri,dM as getManifestInfo,dr as interactionContext,Dh as isSeed,j as itemContext,Fl as itemContextVariables,mg as iterResponseValues,fg as parsePair,bg as parsePoint,ta as parseResponseAttribute,pu as qtiAndMixin,he as qtiContext,ih as qtiInteractionElements,ku as qtiSubtractMixin,Ve as qtiTransformItem,ac as qtiTransformManifest,vr as qtiTransformTest,mo as removeDoubleSlashes,$e as responseAttributeConverter,gg as serializePair,yg as serializePoint,ra as serializeResponseAttribute,De as sessionContext,pe as testContext,Ac as ttsContext,U as validationMessage};
9767
+ `}};export{G as CandidateCorrectionMixin,or as ChoiceCorrectionMixin,Xa as CorrectResponseMixin,X as Correctness,Ks as INITIAL_SESSION_CONTEXT,Js as INITIAL_TEST_CONTEXT,D as Interaction,ea as IsNullOrUndefined,ke as ItemContainer,Ji as ItemCorrectResponseMode,Ti as ItemPrintVariables,It as ItemShowCandidateCorrection,_t as ItemShowCorrectResponse,Fn as QtiAnd,Nr as QtiAnyN,te as QtiAssessmentItem,dh as QtiAssessmentItemCorrection,Me as QtiAssessmentItemRef,me as QtiAssessmentSection,wr as QtiAssessmentStimulusRef,ha as QtiAssessmentStimulusRefConnectedEvent,Lt as QtiAssessmentTest,Sr as QtiAssociableHotspot,Zt as QtiAssociateInteraction,rl as QtiAssociateInteractionCorrection,zi as QtiBaseValue,er as QtiChoiceInteraction,il as QtiChoiceInteractionCorrection,qo as QtiCompanionMaterialsInfo,ue as QtiConditionExpression,Bn as QtiContainerSize,Un as QtiContains,pi as QtiContentBody,xr as QtiContextDeclaration,Hn as QtiCorrect,rt as QtiCustomInteraction,ui as QtiCustomOperator,rr as QtiDefault,Wn as QtiDelete,Qn as QtiDivide,Gn as QtiDurationGte,Xn as QtiDurationLt,kt as QtiEndAttemptInteraction,Fi as QtiEqual,ji as QtiEqualRounded,k as QtiExpression,Q as QtiExtendedTextInteraction,Ts as QtiExtendedTextInteractionCorrection,le as QtiFeedback,Co as QtiFeedbackBlock,Eo as QtiFeedbackInline,Yn as QtiFieldValue,Qt as QtiGap,Ri as QtiGapImg,Tr as QtiGapMatchInteraction,ol as QtiGapMatchInteractionCorrection,yt as QtiGapText,Ya as QtiGapTextCorrection,Kn as QtiGcd,Re as QtiGraphicAssociateInteraction,nl as QtiGraphicAssociateInteractionCorrection,Rr as QtiGraphicGapMatchInteraction,sl as QtiGraphicGapMatchInteractionCorrection,Or as QtiGraphicOrderInteraction,al as QtiGraphicOrderInteractionCorrection,Jn as QtiGt,Zn as QtiGte,Xt as QtiHotspotChoice,_s as QtiHotspotChoiceCorrection,Pr as QtiHotspotInteraction,ll as QtiHotspotInteractionCorrection,Yt as QtiHottext,Ka as QtiHottextCorrection,Mr as QtiHottextInteraction,cl as QtiHottextInteractionCorrection,Bi as QtiIndex,Oi as QtiInlineChoice,ee as QtiInlineChoiceInteraction,dl as QtiInlineChoiceInteractionCorrection,$r as QtiInside,es as QtiIntegerDivide,ts as QtiIntegerModulus,rs as QtiIntegerToFloat,is as QtiIsNull,et as QtiItem,ko as QtiItemBody,hh as QtiItemCorrection,os as QtiLcm,Lr as QtiLookupOutcomeValue,ns as QtiLt,ss as QtiLte,Hi as QtiMapResponse,Ui as QtiMapResponsePoint,as as QtiMatch,ot as QtiMatchInteraction,hl as QtiMatchInteractionCorrection,Wi as QtiMathOperator,ls as QtiMax,In as QtiMediaInteraction,cs as QtiMember,ds as QtiMin,qr as QtiModalFeedback,hs as QtiMultiple,ps as QtiNot,us as QtiNull,ms as QtiOr,At as QtiOrderInteraction,pl as QtiOrderInteractionCorrection,fs as QtiOrdered,Ye as QtiOutcomeDeclaration,fo as QtiOutcomeProcessing,na as QtiOutcomeProcessingProcessor,Qi as QtiPatternMatch,W as QtiPortableCustomInteraction,ul as QtiPortableCustomInteractionCorrection,Pn as QtiPositionObjectInteraction,Mn as QtiPositionObjectStage,gs as QtiPower,Vr as QtiPrintedVariable,bs as QtiProduct,tn as QtiPrompt,ys as QtiRandom,ir as QtiRandomInteger,Gi as QtiRepeat,vs as QtiResponseCondition,mt as QtiResponseDeclaration,zr as QtiResponseElse,ws as QtiResponseElseIf,jr as QtiResponseIf,Ao as QtiResponseProcessing,xs as QtiRound,Fr as QtiRoundTo,Ke as QtiRubricBlock,Bl as QtiRuleElement,ce as QtiSelectPointInteraction,ml as QtiSelectPointInteractionCorrection,qs as QtiSetCorrectResponse,Ha as QtiSetCorrectResponseRule,Cs as QtiSetOutcomeValue,Wa as QtiSetOutcomeValueRule,Es as QtiSetTemplateValue,Qa as QtiSetTemplateValueRule,Se as QtiSimpleAssociableChoice,Ja as QtiSimpleAssociableChoiceCorrection,Ae as QtiSimpleChoice,Za as QtiSimpleChoiceCorrection,we as QtiSliderInteraction,fl as QtiSliderInteractionCorrection,Xi as QtiStatsOperator,Yi as QtiStringMatch,Io as QtiStylesheet,Ki as QtiSubstring,ks as QtiSubtract,Ss as QtiSum,Ga as QtiSumExpression,_o as QtiTemplateConstraint,Je as QtiTemplateDeclaration,To as QtiTemplateProcessing,Vt as QtiTest,uh as QtiTestCorrection,Ro as QtiTestFeedback,ft as QtiTestPart,bi as QtiTestVariables,pa as QtiTestVariablesExpression,ne as QtiTextEntryInteraction,gl as QtiTextEntryInteractionCorrection,As as QtiTruncate,zn as QtiUploadInteraction,Is as QtiVariable,pr as QtiVariableDeclaration,J as ScoringHelper,Er as TestCheckItem,mh as TestCheckItemCorrection,Ee as TestContainer,Lo as TestEndAttempt,yi as TestItemLink,jt as TestItemToSpeech,oe as TestNavigation,ph as TestNavigationCorrection,Ft as TestNext,Ci as TestPagingButtonsStamp,Bt as TestPrev,Ei as TestPrintContext,ki as TestPrintVariables,Ut as TestScoringButtons,kr as TestScoringFeedback,Si as TestSectionButtonsStamp,Ai as TestSectionLink,Tt as TestShowCorrectResponse,Ht as TestStamp,Wo as TestTtsNext,Fo as TestTtsPause,jo as TestTtsPlay,Ho as TestTtsPrev,Bo as TestTtsResume,Uo as TestTtsStop,Be as TestView,_i as TestViewToggle,Of as asSeed,R as boxSizing,F as computedContext,ct as computedItemContext,de as configContext,qe as convertNumberToUniversalFormat,re as correctionPart,Nh as decimalSeparator,$e as dropRegion,uM as getItemByUri,pM as getManifestInfo,hr as interactionContext,Dh as isSeed,j as itemContext,Fl as itemContextVariables,mg as iterResponseValues,fg as parsePair,bg as parsePoint,ta as parseResponseAttribute,pu as qtiAndMixin,he as qtiContext,ih as qtiInteractionElements,ku as qtiSubtractMixin,Ve as qtiTransformItem,ac as qtiTransformManifest,vr as qtiTransformTest,mo as removeDoubleSlashes,Le as responseAttributeConverter,gg as serializePair,yg as serializePoint,ra as serializeResponseAttribute,Ne as sessionContext,pe as testContext,Ac as ttsContext,U as validationMessage};
9394
9768
  /*! Bundled license information:
9395
9769
 
9396
9770
  @lit-labs/ssr-dom-shim/lib/element-internals.js: