@citolab/qti-components 10.0.0-next.30 → 10.0.0-next.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cdn/index.js CHANGED
@@ -1,8 +1,8 @@
1
- var Il=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Ut=function(o,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(o,e):i?i.value=e:t.set(o,e),e},tt=function(o,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(o):r?r.value:t.get(o)},Rr,Fn,zn,Ei,Ma,Si,Bn,er,Ai,Ce,Un,_l;var W={__proto__:null};W.enumerable=!0;Object.freeze(W);var Pa=(Ce=class{constructor(t,e={}){if(Rr.set(this,!1),Fn.set(this,!1),zn.set(this,!1),Ei.set(this,!1),Ma.set(this,Date.now()),Si.set(this,!1),Bn.set(this,void 0),er.set(this,void 0),Ai.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:n}=e;Ut(this,Rr,!!i,"f"),Ut(this,Fn,!!r,"f"),Ut(this,zn,!!n,"f"),Ut(this,Bn,`${t}`,"f"),Ut(this,er,null,"f"),Ut(this,Ai,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Ut(this,Ei,!0,"f")}get target(){return tt(this,er,"f")}get currentTarget(){return tt(this,er,"f")}get srcElement(){return tt(this,er,"f")}get type(){return tt(this,Bn,"f")}get cancelable(){return tt(this,Rr,"f")}get defaultPrevented(){return tt(this,Rr,"f")&&tt(this,Ei,"f")}get timeStamp(){return tt(this,Ma,"f")}composedPath(){return tt(this,Ai,"f")?[tt(this,er,"f")]:[]}get returnValue(){return!tt(this,Rr,"f")||!tt(this,Ei,"f")}get bubbles(){return tt(this,Fn,"f")}get composed(){return tt(this,zn,"f")}get eventPhase(){return tt(this,Ai,"f")?Ce.AT_TARGET:Ce.NONE}get cancelBubble(){return tt(this,Si,"f")}set cancelBubble(t){t&&Ut(this,Si,!0,"f")}stopPropagation(){Ut(this,Si,!0,"f")}get isTrusted(){return!1}},Rr=new WeakMap,Fn=new WeakMap,zn=new WeakMap,Ei=new WeakMap,Ma=new WeakMap,Si=new WeakMap,Bn=new WeakMap,er=new WeakMap,Ai=new WeakMap,Ce.NONE=0,Ce.CAPTURING_PHASE=1,Ce.AT_TARGET=2,Ce.BUBBLING_PHASE=3,Ce);Object.defineProperties(Pa.prototype,{initEvent:W,stopImmediatePropagation:W,preventDefault:W,target:W,currentTarget:W,srcElement:W,type:W,cancelable:W,defaultPrevented:W,timeStamp:W,composedPath:W,returnValue:W,bubbles:W,composed:W,eventPhase:W,cancelBubble:W,stopPropagation:W,isTrusted:W});var Rl=(_l=class extends Pa{constructor(t,e={}){super(t,e),Un.set(this,void 0),Ut(this,Un,e?.detail??null,"f")}initCustomEvent(t,e,r,i){throw new Error("Method not implemented.")}get detail(){return tt(this,Un,"f")}},Un=new WeakMap,_l);Object.defineProperties(Rl.prototype,{detail:W});var oe=Pa,Oa=Rl;var ot;var sb=(ot=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},ot.STYLE_RULE=1,ot.CHARSET_RULE=2,ot.IMPORT_RULE=3,ot.MEDIA_RULE=4,ot.FONT_FACE_RULE=5,ot.PAGE_RULE=6,ot.NAMESPACE_RULE=10,ot.KEYFRAMES_RULE=7,ot.KEYFRAME_RULE=8,ot.SUPPORTS_RULE=12,ot.COUNTER_STYLE_RULE=11,ot.FONT_FEATURE_VALUES_RULE=14,ot.MARGIN_RULE=9,ot);globalThis.Event??=oe;globalThis.CustomEvent??=Oa;var $a=Symbol(),Ml=o=>typeof o=="boolean"?o:o?.capture??!1,se={__proto__:null};se.enumerable=!0;Object.freeze(se);var Hn=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let i=Ml(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);if(n===void 0)n=new Map,i.set(t,n);else if(n.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),n.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let i=Ml(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);n!==void 0&&(n.delete(e),n.size||i.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,i=!1,n=oe.NONE,s=null,a=null,c=null,l=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...se},srcElement:{get(){return t.target},...se},currentTarget:{get(){return c},...se},eventPhase:{get(){return n},...se},composedPath:{value:()=>e,...se},stopPropagation:{value:()=>{r=!0,l.call(t)},...se},stopImmediatePropagation:{value:()=>{i=!0,d.call(t)},...se}});let h=(u,g,b)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&b.delete(u)},f=()=>(c=null,n=oe.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),c=u,n=u===t.target?oe.AT_TARGET:oe.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&y(x.slice(0,x.indexOf(u)+1)),c=u,n=u===t.target?oe.AT_TARGET:oe.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,Dl,Xu]}};var Pl=new WeakMap,Ti=o=>{let t=Pl.get(o);return t===void 0&&Pl.set(o,t=new Map),t},Ii=class extends Hn{getRootNode(t){return t?.composed?Da:this.__host?.__shadowRoot??Da}};var Ol=class extends Ii{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var Dl=new Ol,Da=Dl;var $l=class extends Ii{constructor(t){if(super(),t!==$a)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Wn,customElements:La,document:Da,Document:Ol,Element:Nl,EventTarget:Hn,HTMLElement:Ll,Node:Ii,ShadowRoot:Vl,window:this,Window:$l})}};var Nl=class extends Ii{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Ti(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){Ti(this).set(t,String(e))}removeAttribute(t){Ti(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return Ti(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Vl($a,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new Il(this);return this.__internals=t,t}getAttribute(t){return Ti(this).get(t)??null}};var Ll=class extends Nl{},Na=Ll;var Vl=class extends Ii{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new Na,"localName",{get(){return"lit-server-root"}});function Wu(){let o,t;return{promise:new Promise((r,i)=>{o=r,t=i}),resolve:o,reject:t}}var Wn=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
2
- Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let r=this.__pendingWhenDefineds.get(t);return r||(r=Wu(),this.__pendingWhenDefineds.set(t,r)),r.promise}},Qu=Wn;var La=new Qu,Xu=new $l($a);var _i=globalThis,Qn=_i.ShadowRoot&&(_i.ShadyCSS===void 0||_i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Va=Symbol(),jl=new WeakMap,Ri=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Va)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Qn&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=jl.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&jl.set(e,t))}return t}toString(){return this.cssText}},Fl=o=>new Ri(typeof o=="string"?o:o+"",void 0,Va),w=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,i,n)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[n+1],o[0]);return new Ri(e,o,Va)},zl=(o,t)=>{if(Qn)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=_i.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,o.appendChild(r)}},ja=Qn||_i.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Fl(e)})(o):o;var{is:Gu,defineProperty:Yu,getOwnPropertyDescriptor:Ju,getOwnPropertyNames:Ku,getOwnPropertySymbols:Zu,getPrototypeOf:tm}=Object,Oi=globalThis;Oi.customElements??=La;var Bl=Oi.trustedTypes,em=Bl?Bl.emptyScript:"",rm=Oi.reactiveElementPolyfillSupport,Mi=(o,t)=>o,Pi={toAttribute(o,t){switch(t){case Boolean:o=o?em:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},Xn=(o,t)=>!Gu(o,t),Ul={attribute:!0,type:String,converter:Pi,reflect:!1,useDefault:!1,hasChanged:Xn};Symbol.metadata??=Symbol("metadata"),Oi.litPropertyMetadata??=new WeakMap;var ae=class extends(globalThis.HTMLElement??Na){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Ul){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&Yu(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:n}=Ju(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:i,set(s){let a=i?.call(this);n?.call(this,s),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Ul}static _$Ei(){if(this.hasOwnProperty(Mi("elementProperties")))return;let t=tm(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Mi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Mi("properties"))){let e=this.properties,r=[...Ku(e),...Zu(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(ja(i))}else t!==void 0&&e.push(ja(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return zl(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:Pi).toAttribute(e,r.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let n=r.getPropertyOptions(i),s=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Pi;this._$Em=i;let a=s.fromAttribute(e,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(t,e,r,i=!1,n){if(t!==void 0){let s=this.constructor;if(i===!1&&(n=this[t]),r??=s.getPropertyOptions(t),!((r.hasChanged??Xn)(n,e)||r.useDefault&&r.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:i,wrapped:n},s){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),n!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,n]of r){let{wrapped:s}=n,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};ae.elementStyles=[],ae.shadowRootOptions={mode:"open"},ae[Mi("elementProperties")]=new Map,ae[Mi("finalized")]=new Map,rm?.({ReactiveElement:ae}),(Oi.reactiveElementVersions??=[]).push("2.1.2");var eo=globalThis,Hl=o=>o,Gn=eo.trustedTypes,Wl=Gn?Gn.createPolicy("lit-html",{createHTML:o=>o}):void 0,za="$lit$",ce=`lit$${Math.random().toFixed(9).slice(2)}$`,Ba="?"+ce,im=`<${Ba}>`,nr=eo.document===void 0?{createTreeWalker:()=>({})}:document,$i=()=>nr.createComment(""),Ni=o=>o===null||typeof o!="object"&&typeof o!="function",Ua=Array.isArray,Kl=o=>Ua(o)||typeof o?.[Symbol.iterator]=="function",Fa=`[
3
- \f\r]`,Di=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ql=/-->/g,Xl=/>/g,rr=RegExp(`>|${Fa}(?:([^\\s"'>=/]+)(${Fa}*=${Fa}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Gl=/'/g,Yl=/"/g,Zl=/^(?:script|style|textarea|title)$/i,Ha=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=Ha(1),Vi=Ha(2),Vb=Ha(3),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Jl=new WeakMap,ir=nr.createTreeWalker(nr,129);function td(o,t){if(!Ua(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wl!==void 0?Wl.createHTML(t):t}var ed=(o,t)=>{let e=o.length-1,r=[],i,n=t===2?"<svg>":t===3?"<math>":"",s=Di;for(let a=0;a<e;a++){let c=o[a],l,d,h=-1,f=0;for(;f<c.length&&(s.lastIndex=f,d=s.exec(c),d!==null);)f=s.lastIndex,s===Di?d[1]==="!--"?s=Ql:d[1]!==void 0?s=Xl:d[2]!==void 0?(Zl.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=rr):d[3]!==void 0&&(s=rr):s===rr?d[0]===">"?(s=i??Di,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,l=d[1],s=d[3]===void 0?rr:d[3]==='"'?Yl:Gl):s===Yl||s===Gl?s=rr:s===Ql||s===Xl?s=Di:(s=rr,i=void 0);let m=s===rr&&o[a+1].startsWith("/>")?" ":"";n+=s===Di?c+im:h>=0?(r.push(l),c.slice(0,h)+za+c.slice(h)+ce+m):c+ce+(h===-2?a:m)}return[td(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Li=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,s=0,a=t.length-1,c=this.parts,[l,d]=ed(t,e);if(this.el=o.createElement(l,r),ir.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=ir.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(za)){let f=d[s++],m=i.getAttribute(h).split(ce),y=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?Jn:y[1]==="?"?Kn:y[1]==="@"?Zn:sr}),i.removeAttribute(h)}else h.startsWith(ce)&&(c.push({type:6,index:n}),i.removeAttribute(h));if(Zl.test(i.tagName)){let h=i.textContent.split(ce),f=h.length-1;if(f>0){i.textContent=Gn?Gn.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],$i()),ir.nextNode(),c.push({type:2,index:++n});i.append(h[f],$i())}}}else if(i.nodeType===8)if(i.data===Ba)c.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(ce,h+1))!==-1;)c.push({type:7,index:n}),h+=ce.length-1}n++}}static createElement(t,e){let r=nr.createElement("template");return r.innerHTML=t,r}};function or(o,t,e=o,r){if(t===it)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,n=Ni(t)?void 0:t._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(o),i._$AT(o,e,r)),r!==void 0?(e._$Co??=[])[r]=i:e._$Cl=i),i!==void 0&&(t=or(o,i._$AS(o,t.values),i,r)),t}var Yn=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??nr).importNode(e,!0);ir.currentNode=i;let n=ir.nextNode(),s=0,a=0,c=r[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new Mr(n,n.nextSibling,this,t):c.type===1?l=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(l=new to(n,this,t)),this._$AV.push(l),c=r[++a]}s!==c?.index&&(n=ir.nextNode(),s++)}return ir.currentNode=nr,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},Mr=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=or(this,t,e),Ni(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Kl(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==P&&Ni(this._$AH)?this._$AA.nextSibling.data=t:this.T(nr.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Li.createElement(td(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new Yn(i,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(t){let e=Jl.get(t.strings);return e===void 0&&Jl.set(t.strings,e=new Li(t)),e}k(t){Ua(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let n of t)i===e.length?e.push(r=new o(this.O($i()),this.O($i()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=Hl(t).nextSibling;Hl(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},sr=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,n){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(t,e=this,r,i){let n=this.strings,s=!1;if(n===void 0)t=or(this,t,e,0),s=!Ni(t)||t!==this._$AH&&t!==it,s&&(this._$AH=t);else{let a=t,c,l;for(t=n[0],c=0;c<n.length-1;c++)l=or(this,a[r+c],e,c),l===it&&(l=this._$AH[c]),s||=!Ni(l)||l!==this._$AH[c],l===P?t=P:t!==P&&(t+=(l??"")+n[c+1]),this._$AH[c]=l}s&&!i&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Jn=class extends sr{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Kn=class extends sr{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Zn=class extends sr{constructor(t,e,r,i,n){super(t,e,r,i,n),this.type=5}_$AI(t,e=this){if((t=or(this,t,e,0)??P)===it)return;let r=this._$AH,i=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},to=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){or(this,t)}},et={M:za,P:ce,A:Ba,C:1,L:ed,R:Yn,D:Kl,V:or,I:Mr,H:sr,N:Kn,U:Zn,B:Jn,F:to},nm=eo.litHtmlPolyfillSupport;nm?.(Li,Mr),(eo.litHtmlVersions??=[]).push("3.3.3");var Wa=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let n=e?.renderBefore??null;r._$litPart$=i=new Mr(t.insertBefore($i(),n),n,void 0,e??{})}return i._$AI(o),i};var Qa=globalThis,C=class extends ae{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Wa(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};C._$litElement$=!0,C.finalized=!0,Qa.litElementHydrateSupport?.({LitElement:C});var om=Qa.litElementPolyfillSupport;om?.({LitElement:C});(Qa.litElementVersions??=[]).push("4.2.2");var sm={attribute:!0,type:String,converter:Pi,reflect:!1,hasChanged:Xn},am=(o=sm,t,e)=>{let{kind:r,metadata:i}=e,n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),r==="setter"&&((o=Object.create(o)).wrapped=!0),n.set(e.name,o),r==="accessor"){let{name:s}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,c,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let c=this[s];t.call(this,a),this.requestUpdate(s,c,o,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(o){return(t,e)=>typeof e=="object"?am(o,t,e):((r,i,n)=>{let s=i.hasOwnProperty(n);return i.constructor.createProperty(n,r),s?Object.getOwnPropertyDescriptor(i,n):void 0})(o,t,e)}function I(o){return p({...o,state:!0,attribute:!1})}var ke=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Pr(o,t){return(e,r,i)=>{let n=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:i??(()=>{let c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return ke(e,r,{get(){let c=s.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return ke(e,r,{get(){return n(this)}})}}function rd(o){return(t,e)=>{let{slot:r,selector:i}=o??{},n="slot"+(r?`[name=${r}]`:":not([name])");return ke(t,e,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(o)??[];return i===void 0?a:a.filter(c=>c.matches(i))}})}}var le=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var at=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new le(this.context,this.host,this.t,this.subscribe))}};var ro=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Xa=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},Ht=class extends ro{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let n=i.contextTarget??i.composedPath()[0];n!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,n,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let n=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)n.has(s)||(n.add(s),a.dispatchEvent(new le(this.context,a,s,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Xa(this.context,this.host))}};var ji=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:r}=e;for(let{elementRef:i,callbackRef:n}of r){let s=i.deref(),a=n.deref();s===void 0||a===void 0||s.dispatchEvent(new le(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],r=t.callback,i=this.pendingContextRequests.get(t.context);i===void 0&&this.pendingContextRequests.set(t.context,i={callbacks:new WeakMap,requests:[]});let n=i.callbacks.get(e);n===void 0&&i.callbacks.set(e,n=new WeakSet),n.has(r)||(n.add(r),i.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(r)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function Q({context:o}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return r.get(this).setValue(i),t.set.call(this,i)},init(i){return r.set(this,new Ht(this,{context:o,initialValue:i})),i}};{t.constructor.addInitializer((s=>{r.set(s,new Ht(s,{context:o}))}));let i=Object.getOwnPropertyDescriptor(t,e),n;if(i===void 0){let s=new WeakMap;n={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;n={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}function _({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new at(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new at(i,{context:o,callback:n=>{i[r]=n},subscribe:t})}))}}var io=["this"],id=["+","-","!"],nd=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Ga={"!":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},no=13;var cm=["==","!=","<=",">=","||","&&","??","|>"],lm=["===","!=="],O;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(O||(O={}));var Wt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),dm=o=>o===9||o===10||o===13||o===32,od=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),hm=o=>od(o)||Fi(o),pm=o=>io.indexOf(o)!==-1,um=o=>o===34||o===39,Fi=o=>48<=o&&o<=57,mm=o=>o===43||o===45||o===42||o===47||o===33||o===38||o===37||o===60||o===61||o===62||o===63||o===94||o===124,fm=o=>o===40||o===41||o===91||o===93||o===123||o===125,gm=o=>o.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
5
- `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),oo=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;dm(this.#i);)this.#n(!0);if(um(this.#i))return this.#a();if(od(this.#i))return this.#c();if(Fi(this.#i))return this.#p();if(this.#i===46)return this.#l();if(this.#i===44)return this.#d();if(this.#i===58)return this.#h();if(mm(this.#i))return this.#m();if(fm(this.#i))return this.#f();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(t);this.#n()}let r=Wt(O.STRING,gm(this.#o()));return this.#n(),r}#c(){do this.#n();while(hm(this.#i));let t=this.#o(),e=pm(t)?O.KEYWORD:O.IDENTIFIER;return Wt(e,t)}#p(){do this.#n();while(Fi(this.#i));return this.#i===46?this.#l():Wt(O.INTEGER,this.#o())}#l(){return this.#n(),Fi(this.#i)?this.#u():(this.#s(),Wt(O.DOT,".",no))}#d(){return this.#n(!0),Wt(O.COMMA,",")}#h(){return this.#n(!0),Wt(O.COLON,":")}#u(){do this.#n();while(Fi(this.#i));return Wt(O.DECIMAL,this.#o())}#m(){this.#n();let t=this.#o(2);if(lm.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Wt(O.ARROW,t);cm.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Wt(O.OPERATOR,t,Ga[t])}#f(){let t=String.fromCharCode(this.#i),e=Wt(O.GROUPER,t,Ga[t]);return this.#n(!0),e}};var Ya=(o,t)=>new zi(o,t).parse(),zi=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new oo(t),this.#r=e}parse(){return this.#o(),this.#s()}#o(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let r=this.#e.nextToken();this.#i=r,this.#t=r?.kind,this.#n=r?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#n!==e)}#s(){if(!this.#i)return this.#r.empty();let t=this.#l();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(O.GROUPER,"(")){let r=this.#g();t=this.#r.invoke(t,void 0,r)}else if(this._matches(O.GROUPER,"[")){let r=this.#b();t=this.#r.index(t,r)}else if(this._matches(O.DOT)){this.#o();let r=this.#l();t=this.#c(t,r)}else{if(this._matches(O.KEYWORD))break;if(this._matches(O.OPERATOR)&&this.#i.precedence>=e)t=this.#n==="?"?this.#d(t):this.#p(t,this.#i);else break}return t}#c(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this.#r.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(nd.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#l();for(;(this.#t===O.OPERATOR||this.#t===O.DOT||this.#t===O.GROUPER)&&this.#i.precedence>e.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(t,e.value,r)}#l(){if(this._matches(O.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(O.INTEGER))return this.#w(t);if(this._matches(O.DECIMAL))return this.#C(t)}if(id.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#h(),no);return this.#r.unary(t,e)}return this.#h()}#d(t){this.#o(O.OPERATOR,"?");let e=this.#s();this.#o(O.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#h(){switch(this.#t){case O.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#r.id(t);throw io.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case O.IDENTIFIER:return this.#f();case O.STRING:return this.#q();case O.INTEGER:return this.#w();case O.DECIMAL:return this.#C();case O.GROUPER:return this.#n==="("?this.#y():this.#n==="{"?this.#m():this.#n==="["?this.#u():void 0;case O.COLON:throw new Error('unexpected token ":"');default:return}}#u(){let t=[];do{if(this.#o(),this._matches(O.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"]"),this.#r.list(t)}#m(){let t={};do{if(this.#o(),this._matches(O.GROUPER,"}"))break;let e=this.#n;(this._matches(O.STRING)||this._matches(O.IDENTIFIER))&&this.#o(),this.#o(O.COLON),t[e]=this.#s()}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"}"),this.#r.map(t)}#f(){let t=this.#n;if(t==="true")return this.#o(),this.#r.literal(!0);if(t==="false")return this.#o(),this.#r.literal(!1);if(t==="null")return this.#o(),this.#r.literal(null);if(t==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#v(),r=this.#g();return r?this.#r.invoke(e,void 0,r):e}#v(){if(!this._matches(O.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let t=this.#n;return this.#o(),this.#r.id(t)}#g(){if(!this._matches(O.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(O.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(O.COMMA));return this.#o(O.GROUPER,")"),t}#b(){this.#o();let t=this.#s();return this.#o(O.GROUPER,"]"),t}#y(){let t=this.#g();if(this._matches(O.ARROW)){this.#o();let e=this.#s(),r=t?.map(i=>i.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#q(){let t=this.#r.literal(this.#n);return this.#o(),t}#w(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#C(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:sd,fromEntries:bm}=Object,vm={"+":(o,t)=>o+t,"-":(o,t)=>o-t,"*":(o,t)=>o*t,"/":(o,t)=>o/t,"%":(o,t)=>o%t,"==":(o,t)=>o==t,"!=":(o,t)=>o!=t,"===":(o,t)=>o===t,"!==":(o,t)=>o!==t,">":(o,t)=>o>t,">=":(o,t)=>o>=t,"<":(o,t)=>o<t,"<=":(o,t)=>o<=t,"||":(o,t)=>o||t,"&&":(o,t)=>o&&t,"??":(o,t)=>o??t,"|":(o,t)=>t(o),"|>":(o,t)=>t(o)},ym={"+":o=>o,"-":o=>-o,"!":o=>!o},so=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let r=ym[t];return{type:"Unary",operator:t,child:e,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,r){let i=vm[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(n){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(n),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),c=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,c=this.left.value),a===void 0?void 0:a[c]=s}return i(this.left.evaluate(n),this.right.evaluate(n))},getIds(n){return this.left.getIds(n),this.right.getIds(n),n}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let n=this.receiver.evaluate(i),s=this.method?n:i?.this??i,a=this.method?n?.[e]:n,l=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,l)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(n=>n?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let n=this.entries[i];n&&(r[i]=n.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,n=this.body;return function(...s){let a=bm(i.map((l,d)=>[l,s[d]])),c=new Proxy(r??{},{set(l,d,h){return sd(a,d)&&(a[d]=h),l[d]=h},get(l,d){return sd(a,d)?a[d]:l[d]}});return n.evaluate(c)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var Ja=null,ad={boundAttributeSuffix:et.M,marker:et.P,markerMatch:et.A,HTML_RESULT:et.C,getTemplateHtml:et.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){Ja??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Ja))return void(e[Ja]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let r=it;return o.j=i=>r=i,o._$AI(t,o,e),r},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:et.V,AttributePart:et.H,PropertyPart:et.B,BooleanAttributePart:et.N,EventPart:et.U,ElementPart:et.F,TemplateInstance:et.R,isIterable:et.D,ChildPart:et.I};var{AttributePart:qm,PropertyPart:xm,BooleanAttributePart:wm,EventPart:Cm}=ad,Za=new so,Ka=new Map,cd=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),ao=(o,t)=>{let e=Ka.get(o);if(e===void 0){if(Ka.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new zi(r,Za).parse(),Ka.set(o,e)}}return e?.evaluate(t)},km=(o,t,e,r)=>{let i=o.getAttribute("if");if(i!==null&&ao(i,t))return co(o,t,e,r)},ld=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,dd=o=>/(?:\\{{)|(?:\\}})/g.test(o),Bi=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Em=(o,t,e,r)=>{let i=o.getAttribute("repeat");if(i!==null){let n=ao(i,t);if(!n[Symbol.iterator])return P;let s=Ui(o),a=-1,c=[];for(let l of n){a++;let d=Object.create(t);d.item=l,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let y=m.update(d,e,r);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};c.push(f)}return c}},pd={if:km,repeat:Em},ud=(o,t=pd,e={},r)=>{let n=Ui(o).renderers;if(r){let a=Ui(r).renderers,c=n.super;c!==void 0?e={...n,...e,super:(l,d,h)=>(h={...a,...h,super:(f,m,y)=>co(r,f,m,y)},c(l,d,h))}:(e={...a,...n,...e},o=r)}else e={...n,...e};return s=>co(o,s,t,e)};var co=(o,t,e=pd,r={})=>{let i=Ui(o),n=[];for(let a of i.parts){let c=a.update(t,e,r);a.type===1?n.push(...c):n.push(c)}return{_$litType$:i,values:n}},hd=new Map,Ui=o=>{let t=hd.get(o);return t===void 0&&hd.set(o,t=Sm(o)),t},Sm=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,n=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)i++;else if(r.nodeType===Node.ELEMENT_NODE){i++;let s=r;if(s.tagName==="TEMPLATE"){let c=s.getAttribute("type"),l=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||c!==null||l!==null){s.parentNode.insertBefore(document.createComment(""),s),n.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:ao(g,y);return(m?ao(f,y):u[d])?.(b,x,u)}}else c!==null?h=(f,m,y)=>{let x=m[c];return x?.(s,f,m,y)}:(l==="super"?t.renderers.super=(f,m,y)=>{let x=y.super,u=Ui(s);return y={...y,...u.renderers},x(f,m,y)}:t.renderers[l]=(f,m,y)=>co(s,f,m,y),h=(f,m,y)=>{let x=y[l];return x?.(f,m,y)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let c of a){let l=s.getAttribute(c),d=l.split(ld);if(d.length===1){dd(l)&&s.setAttribute(c,Bi(l));continue}s.removeAttribute(c);let h=c,f=qm,m=c[0];m==="."?(h=cd(c.substring(1)),f=xm):m==="?"?(h=c.substring(1),f=wm):m==="@"&&(h=cd(c.substring(1)),f=Cm);let y=[Bi(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(Ya(g,Za)),y.push(Bi(d[u+1]))}t.parts.push({type:1,index:i,name:h,strings:y,ctor:f,update:(u,g,b)=>x.map(q=>q.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,c=a.split(ld);c.length>1?s.textContent=Bi(c[0]):dd(a)&&(s.textContent=Bi(a));for(let l=1;l<c.length;l+=2){let d=c[l],h=Ya(d,Za);t.parts.push({type:2,index:++i,update:(m,y)=>h.evaluate(m)});let f=new Text(c[l+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of n)s.remove();return t};var tc=Symbol.for("qti-components.context-root"),Am=()=>{if(typeof document>"u")return;let o=globalThis;o[tc]||(o[tc]=new ji,o[tc].attach(document.documentElement))};Am();var md=[];var rc=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#r():queueMicrotask(()=>this.#r())}#r(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},ec="custom-state-support-probe";function Tm(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(ec)||customElements.define(ec,class extends HTMLElement{});let t=o.call(document.createElement(ec)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var fd=!1;function gd(){if(fd)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Tm(o);return t==="modern"||(fd=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new rc(this)}),r}),t}gd();for(let{tag:o,ctor:t}of md)customElements.get(o)||customElements.define(o,t);var Ee=Symbol("computedItemContext");var ct=Symbol("computedContext");var yt=Symbol("configContext");var Or=Symbol("interactionContext");var F=Symbol("item");var bd=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Im=/^[A-Za-z0-9-]+$/,_m=o=>typeof o=="string"&&Im.test(o),Ry=o=>_m(o)?o:void 0,qt=Symbol("qtiContext");var ic={view:"candidate"},lo=Symbol("sessionContext");var nc={items:[],testOutcomeVariables:[]},nt=Symbol("testContext");var R=w`
1
+ var Ol=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Ut=function(o,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(o,e):i?i.value=e:t.set(o,e),e},tt=function(o,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(o):r?r.value:t.get(o)},Pr,Bn,Un,Ai,Da,Ii,Hn,rr,Ti,ke,Wn,Dl;var W={__proto__:null};W.enumerable=!0;Object.freeze(W);var $a=(ke=class{constructor(t,e={}){if(Pr.set(this,!1),Bn.set(this,!1),Un.set(this,!1),Ai.set(this,!1),Da.set(this,Date.now()),Ii.set(this,!1),Hn.set(this,void 0),rr.set(this,void 0),Ti.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:n}=e;Ut(this,Pr,!!i,"f"),Ut(this,Bn,!!r,"f"),Ut(this,Un,!!n,"f"),Ut(this,Hn,`${t}`,"f"),Ut(this,rr,null,"f"),Ut(this,Ti,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Ut(this,Ai,!0,"f")}get target(){return tt(this,rr,"f")}get currentTarget(){return tt(this,rr,"f")}get srcElement(){return tt(this,rr,"f")}get type(){return tt(this,Hn,"f")}get cancelable(){return tt(this,Pr,"f")}get defaultPrevented(){return tt(this,Pr,"f")&&tt(this,Ai,"f")}get timeStamp(){return tt(this,Da,"f")}composedPath(){return tt(this,Ti,"f")?[tt(this,rr,"f")]:[]}get returnValue(){return!tt(this,Pr,"f")||!tt(this,Ai,"f")}get bubbles(){return tt(this,Bn,"f")}get composed(){return tt(this,Un,"f")}get eventPhase(){return tt(this,Ti,"f")?ke.AT_TARGET:ke.NONE}get cancelBubble(){return tt(this,Ii,"f")}set cancelBubble(t){t&&Ut(this,Ii,!0,"f")}stopPropagation(){Ut(this,Ii,!0,"f")}get isTrusted(){return!1}},Pr=new WeakMap,Bn=new WeakMap,Un=new WeakMap,Ai=new WeakMap,Da=new WeakMap,Ii=new WeakMap,Hn=new WeakMap,rr=new WeakMap,Ti=new WeakMap,ke.NONE=0,ke.CAPTURING_PHASE=1,ke.AT_TARGET=2,ke.BUBBLING_PHASE=3,ke);Object.defineProperties($a.prototype,{initEvent:W,stopImmediatePropagation:W,preventDefault:W,target:W,currentTarget:W,srcElement:W,type:W,cancelable:W,defaultPrevented:W,timeStamp:W,composedPath:W,returnValue:W,bubbles:W,composed:W,eventPhase:W,cancelBubble:W,stopPropagation:W,isTrusted:W});var $l=(Dl=class extends $a{constructor(t,e={}){super(t,e),Wn.set(this,void 0),Ut(this,Wn,e?.detail??null,"f")}initCustomEvent(t,e,r,i){throw new Error("Method not implemented.")}get detail(){return tt(this,Wn,"f")}},Wn=new WeakMap,Dl);Object.defineProperties($l.prototype,{detail:W});var se=$a,Na=$l;var ot;var qb=(ot=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},ot.STYLE_RULE=1,ot.CHARSET_RULE=2,ot.IMPORT_RULE=3,ot.MEDIA_RULE=4,ot.FONT_FACE_RULE=5,ot.PAGE_RULE=6,ot.NAMESPACE_RULE=10,ot.KEYFRAMES_RULE=7,ot.KEYFRAME_RULE=8,ot.SUPPORTS_RULE=12,ot.COUNTER_STYLE_RULE=11,ot.FONT_FEATURE_VALUES_RULE=14,ot.MARGIN_RULE=9,ot);globalThis.Event??=se;globalThis.CustomEvent??=Na;var Va=Symbol(),Nl=o=>typeof o=="boolean"?o:o?.capture??!1,ae={__proto__:null};ae.enumerable=!0;Object.freeze(ae);var Qn=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let i=Nl(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);if(n===void 0)n=new Map,i.set(t,n);else if(n.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),n.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let i=Nl(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);n!==void 0&&(n.delete(e),n.size||i.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,i=!1,n=se.NONE,s=null,a=null,c=null,l=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...ae},srcElement:{get(){return t.target},...ae},currentTarget:{get(){return c},...ae},eventPhase:{get(){return n},...ae},composedPath:{value:()=>e,...ae},stopPropagation:{value:()=>{r=!0,l.call(t)},...ae},stopImmediatePropagation:{value:()=>{i=!0,d.call(t)},...ae}});let h=(u,g,b)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&b.delete(u)},f=()=>(c=null,n=se.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),c=u,n=u===t.target?se.AT_TARGET:se.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}let w=t.bubbles?e:[this];a=null;for(let u of w){!s&&(!a||u===a.__host)&&y(w.slice(0,w.indexOf(u)+1)),c=u,n=u===t.target?se.AT_TARGET:se.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,jl,om]}};var Ll=new WeakMap,Ri=o=>{let t=Ll.get(o);return t===void 0&&Ll.set(o,t=new Map),t},_i=class extends Qn{getRootNode(t){return t?.composed?La:this.__host?.__shadowRoot??La}};var Vl=class extends _i{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var jl=new Vl,La=jl;var Fl=class extends _i{constructor(t){if(super(),t!==Va)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Xn,customElements:Fa,document:La,Document:Vl,Element:zl,EventTarget:Qn,HTMLElement:Bl,Node:_i,ShadowRoot:Ul,window:this,Window:Fl})}};var zl=class extends _i{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Ri(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){Ri(this).set(t,String(e))}removeAttribute(t){Ri(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return Ri(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Ul(Va,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new Ol(this);return this.__internals=t,t}getAttribute(t){return Ri(this).get(t)??null}};var Bl=class extends zl{},ja=Bl;var Ul=class extends _i{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new ja,"localName",{get(){return"lit-server-root"}});function im(){let o,t;return{promise:new Promise((r,i)=>{o=r,t=i}),resolve:o,reject:t}}var Xn=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
2
+ Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let r=this.__pendingWhenDefineds.get(t);return r||(r=im(),this.__pendingWhenDefineds.set(t,r)),r.promise}},nm=Xn;var Fa=new nm,om=new Fl(Va);var Mi=globalThis,Gn=Mi.ShadowRoot&&(Mi.ShadyCSS===void 0||Mi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,za=Symbol(),Hl=new WeakMap,Pi=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==za)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Gn&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Hl.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Hl.set(e,t))}return t}toString(){return this.cssText}},Wl=o=>new Pi(typeof o=="string"?o:o+"",void 0,za),x=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,i,n)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[n+1],o[0]);return new Pi(e,o,za)},Ql=(o,t)=>{if(Gn)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Mi.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,o.appendChild(r)}},Ba=Gn||Mi.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Wl(e)})(o):o;var{is:sm,defineProperty:am,getOwnPropertyDescriptor:cm,getOwnPropertyNames:lm,getOwnPropertySymbols:dm,getPrototypeOf:hm}=Object,$i=globalThis;$i.customElements??=Fa;var Xl=$i.trustedTypes,pm=Xl?Xl.emptyScript:"",um=$i.reactiveElementPolyfillSupport,Oi=(o,t)=>o,Di={toAttribute(o,t){switch(t){case Boolean:o=o?pm:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},Yn=(o,t)=>!sm(o,t),Gl={attribute:!0,type:String,converter:Di,reflect:!1,useDefault:!1,hasChanged:Yn};Symbol.metadata??=Symbol("metadata"),$i.litPropertyMetadata??=new WeakMap;var ce=class extends(globalThis.HTMLElement??ja){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Gl){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&am(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:n}=cm(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:i,set(s){let a=i?.call(this);n?.call(this,s),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Gl}static _$Ei(){if(this.hasOwnProperty(Oi("elementProperties")))return;let t=hm(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Oi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Oi("properties"))){let e=this.properties,r=[...lm(e),...dm(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(Ba(i))}else t!==void 0&&e.push(Ba(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ql(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:Di).toAttribute(e,r.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let n=r.getPropertyOptions(i),s=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Di;this._$Em=i;let a=s.fromAttribute(e,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(t,e,r,i=!1,n){if(t!==void 0){let s=this.constructor;if(i===!1&&(n=this[t]),r??=s.getPropertyOptions(t),!((r.hasChanged??Yn)(n,e)||r.useDefault&&r.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:i,wrapped:n},s){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),n!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,n]of r){let{wrapped:s}=n,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};ce.elementStyles=[],ce.shadowRootOptions={mode:"open"},ce[Oi("elementProperties")]=new Map,ce[Oi("finalized")]=new Map,um?.({ReactiveElement:ce}),($i.reactiveElementVersions??=[]).push("2.1.2");var io=globalThis,Yl=o=>o,Jn=io.trustedTypes,Jl=Jn?Jn.createPolicy("lit-html",{createHTML:o=>o}):void 0,Ha="$lit$",le=`lit$${Math.random().toFixed(9).slice(2)}$`,Wa="?"+le,mm=`<${Wa}>`,or=io.document===void 0?{createTreeWalker:()=>({})}:document,Li=()=>or.createComment(""),Vi=o=>o===null||typeof o!="object"&&typeof o!="function",Qa=Array.isArray,id=o=>Qa(o)||typeof o?.[Symbol.iterator]=="function",Ua=`[
3
+ \f\r]`,Ni=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Kl=/-->/g,Zl=/>/g,ir=RegExp(`>|${Ua}(?:([^\\s"'>=/]+)(${Ua}*=${Ua}*(?:[^
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),td=/'/g,ed=/"/g,nd=/^(?:script|style|textarea|title)$/i,Xa=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=Xa(1),Fi=Xa(2),Zb=Xa(3),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),rd=new WeakMap,nr=or.createTreeWalker(or,129);function od(o,t){if(!Qa(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Jl!==void 0?Jl.createHTML(t):t}var sd=(o,t)=>{let e=o.length-1,r=[],i,n=t===2?"<svg>":t===3?"<math>":"",s=Ni;for(let a=0;a<e;a++){let c=o[a],l,d,h=-1,f=0;for(;f<c.length&&(s.lastIndex=f,d=s.exec(c),d!==null);)f=s.lastIndex,s===Ni?d[1]==="!--"?s=Kl:d[1]!==void 0?s=Zl:d[2]!==void 0?(nd.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=ir):d[3]!==void 0&&(s=ir):s===ir?d[0]===">"?(s=i??Ni,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,l=d[1],s=d[3]===void 0?ir:d[3]==='"'?ed:td):s===ed||s===td?s=ir:s===Kl||s===Zl?s=Ni:(s=ir,i=void 0);let m=s===ir&&o[a+1].startsWith("/>")?" ":"";n+=s===Ni?c+mm:h>=0?(r.push(l),c.slice(0,h)+Ha+c.slice(h)+le+m):c+le+(h===-2?a:m)}return[od(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},ji=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,s=0,a=t.length-1,c=this.parts,[l,d]=sd(t,e);if(this.el=o.createElement(l,r),nr.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=nr.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Ha)){let f=d[s++],m=i.getAttribute(h).split(le),y=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?Zn:y[1]==="?"?to:y[1]==="@"?eo:ar}),i.removeAttribute(h)}else h.startsWith(le)&&(c.push({type:6,index:n}),i.removeAttribute(h));if(nd.test(i.tagName)){let h=i.textContent.split(le),f=h.length-1;if(f>0){i.textContent=Jn?Jn.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],Li()),nr.nextNode(),c.push({type:2,index:++n});i.append(h[f],Li())}}}else if(i.nodeType===8)if(i.data===Wa)c.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(le,h+1))!==-1;)c.push({type:7,index:n}),h+=le.length-1}n++}}static createElement(t,e){let r=or.createElement("template");return r.innerHTML=t,r}};function sr(o,t,e=o,r){if(t===it)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,n=Vi(t)?void 0:t._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(o),i._$AT(o,e,r)),r!==void 0?(e._$Co??=[])[r]=i:e._$Cl=i),i!==void 0&&(t=sr(o,i._$AS(o,t.values),i,r)),t}var Kn=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??or).importNode(e,!0);nr.currentNode=i;let n=nr.nextNode(),s=0,a=0,c=r[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new Or(n,n.nextSibling,this,t):c.type===1?l=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(l=new ro(n,this,t)),this._$AV.push(l),c=r[++a]}s!==c?.index&&(n=nr.nextNode(),s++)}return nr.currentNode=or,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},Or=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=sr(this,t,e),Vi(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):id(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==P&&Vi(this._$AH)?this._$AA.nextSibling.data=t:this.T(or.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=ji.createElement(od(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new Kn(i,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(t){let e=rd.get(t.strings);return e===void 0&&rd.set(t.strings,e=new ji(t)),e}k(t){Qa(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let n of t)i===e.length?e.push(r=new o(this.O(Li()),this.O(Li()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=Yl(t).nextSibling;Yl(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ar=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,n){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(t,e=this,r,i){let n=this.strings,s=!1;if(n===void 0)t=sr(this,t,e,0),s=!Vi(t)||t!==this._$AH&&t!==it,s&&(this._$AH=t);else{let a=t,c,l;for(t=n[0],c=0;c<n.length-1;c++)l=sr(this,a[r+c],e,c),l===it&&(l=this._$AH[c]),s||=!Vi(l)||l!==this._$AH[c],l===P?t=P:t!==P&&(t+=(l??"")+n[c+1]),this._$AH[c]=l}s&&!i&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Zn=class extends ar{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},to=class extends ar{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},eo=class extends ar{constructor(t,e,r,i,n){super(t,e,r,i,n),this.type=5}_$AI(t,e=this){if((t=sr(this,t,e,0)??P)===it)return;let r=this._$AH,i=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},ro=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){sr(this,t)}},et={M:Ha,P:le,A:Wa,C:1,L:sd,R:Kn,D:id,V:sr,I:Or,H:ar,N:to,U:eo,B:Zn,F:ro},fm=io.litHtmlPolyfillSupport;fm?.(ji,Or),(io.litHtmlVersions??=[]).push("3.3.3");var Ga=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let n=e?.renderBefore??null;r._$litPart$=i=new Or(t.insertBefore(Li(),n),n,void 0,e??{})}return i._$AI(o),i};var Ya=globalThis,C=class extends ce{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Ga(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};C._$litElement$=!0,C.finalized=!0,Ya.litElementHydrateSupport?.({LitElement:C});var gm=Ya.litElementPolyfillSupport;gm?.({LitElement:C});(Ya.litElementVersions??=[]).push("4.2.2");var bm={attribute:!0,type:String,converter:Di,reflect:!1,hasChanged:Yn},vm=(o=bm,t,e)=>{let{kind:r,metadata:i}=e,n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),r==="setter"&&((o=Object.create(o)).wrapped=!0),n.set(e.name,o),r==="accessor"){let{name:s}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,c,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let c=this[s];t.call(this,a),this.requestUpdate(s,c,o,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(o){return(t,e)=>typeof e=="object"?vm(o,t,e):((r,i,n)=>{let s=i.hasOwnProperty(n);return i.constructor.createProperty(n,r),s?Object.getOwnPropertyDescriptor(i,n):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var Ee=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Dr(o,t){return(e,r,i)=>{let n=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:i??(()=>{let c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return Ee(e,r,{get(){let c=s.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return Ee(e,r,{get(){return n(this)}})}}function ad(o){return(t,e)=>{let{slot:r,selector:i}=o??{},n="slot"+(r?`[name=${r}]`:":not([name])");return Ee(t,e,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(o)??[];return i===void 0?a:a.filter(c=>c.matches(i))}})}}var de=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var at=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new de(this.context,this.host,this.t,this.subscribe))}};var no=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Ja=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},Ht=class extends no{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let n=i.contextTarget??i.composedPath()[0];n!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,n,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let n=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)n.has(s)||(n.add(s),a.dispatchEvent(new de(this.context,a,s,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Ja(this.context,this.host))}};var zi=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:r}=e;for(let{elementRef:i,callbackRef:n}of r){let s=i.deref(),a=n.deref();s===void 0||a===void 0||s.dispatchEvent(new de(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],r=t.callback,i=this.pendingContextRequests.get(t.context);i===void 0&&this.pendingContextRequests.set(t.context,i={callbacks:new WeakMap,requests:[]});let n=i.callbacks.get(e);n===void 0&&i.callbacks.set(e,n=new WeakSet),n.has(r)||(n.add(r),i.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(r)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function Q({context:o}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return r.get(this).setValue(i),t.set.call(this,i)},init(i){return r.set(this,new Ht(this,{context:o,initialValue:i})),i}};{t.constructor.addInitializer((s=>{r.set(s,new Ht(s,{context:o}))}));let i=Object.getOwnPropertyDescriptor(t,e),n;if(i===void 0){let s=new WeakMap;n={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;n={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}function R({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new at(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new at(i,{context:o,callback:n=>{i[r]=n},subscribe:t})}))}}var oo=["this"],cd=["+","-","!"],ld=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Ka={"!":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},so=13;var ym=["==","!=","<=",">=","||","&&","??","|>"],qm=["===","!=="],O;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(O||(O={}));var Wt=(o,t,e=0)=>({kind:o,value:t,precedence:e}),wm=o=>o===9||o===10||o===13||o===32,dd=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),xm=o=>dd(o)||Bi(o),Cm=o=>oo.indexOf(o)!==-1,km=o=>o===34||o===39,Bi=o=>48<=o&&o<=57,Em=o=>o===43||o===45||o===42||o===47||o===33||o===38||o===37||o===60||o===61||o===62||o===63||o===94||o===124,Sm=o=>o===40||o===41||o===91||o===93||o===123||o===125,Am=o=>o.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
5
+ `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),ao=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;wm(this.#i);)this.#n(!0);if(km(this.#i))return this.#a();if(dd(this.#i))return this.#c();if(Bi(this.#i))return this.#p();if(this.#i===46)return this.#l();if(this.#i===44)return this.#d();if(this.#i===58)return this.#h();if(Em(this.#i))return this.#m();if(Sm(this.#i))return this.#f();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(t);this.#n()}let r=Wt(O.STRING,Am(this.#o()));return this.#n(),r}#c(){do this.#n();while(xm(this.#i));let t=this.#o(),e=Cm(t)?O.KEYWORD:O.IDENTIFIER;return Wt(e,t)}#p(){do this.#n();while(Bi(this.#i));return this.#i===46?this.#l():Wt(O.INTEGER,this.#o())}#l(){return this.#n(),Bi(this.#i)?this.#u():(this.#s(),Wt(O.DOT,".",so))}#d(){return this.#n(!0),Wt(O.COMMA,",")}#h(){return this.#n(!0),Wt(O.COLON,":")}#u(){do this.#n();while(Bi(this.#i));return Wt(O.DECIMAL,this.#o())}#m(){this.#n();let t=this.#o(2);if(qm.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Wt(O.ARROW,t);ym.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Wt(O.OPERATOR,t,Ka[t])}#f(){let t=String.fromCharCode(this.#i),e=Wt(O.GROUPER,t,Ka[t]);return this.#n(!0),e}};var Za=(o,t)=>new Ui(o,t).parse(),Ui=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new ao(t),this.#r=e}parse(){return this.#o(),this.#s()}#o(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let r=this.#e.nextToken();this.#i=r,this.#t=r?.kind,this.#n=r?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#n!==e)}#s(){if(!this.#i)return this.#r.empty();let t=this.#l();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(O.GROUPER,"(")){let r=this.#g();t=this.#r.invoke(t,void 0,r)}else if(this._matches(O.GROUPER,"[")){let r=this.#v();t=this.#r.index(t,r)}else if(this._matches(O.DOT)){this.#o();let r=this.#l();t=this.#c(t,r)}else{if(this._matches(O.KEYWORD))break;if(this._matches(O.OPERATOR)&&this.#i.precedence>=e)t=this.#n==="?"?this.#d(t):this.#p(t,this.#i);else break}return t}#c(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this.#r.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(ld.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#l();for(;(this.#t===O.OPERATOR||this.#t===O.DOT||this.#t===O.GROUPER)&&this.#i.precedence>e.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(t,e.value,r)}#l(){if(this._matches(O.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(O.INTEGER))return this.#x(t);if(this._matches(O.DECIMAL))return this.#C(t)}if(cd.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#h(),so);return this.#r.unary(t,e)}return this.#h()}#d(t){this.#o(O.OPERATOR,"?");let e=this.#s();this.#o(O.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#h(){switch(this.#t){case O.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#r.id(t);throw oo.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case O.IDENTIFIER:return this.#f();case O.STRING:return this.#w();case O.INTEGER:return this.#x();case O.DECIMAL:return this.#C();case O.GROUPER:return this.#n==="("?this.#y():this.#n==="{"?this.#m():this.#n==="["?this.#u():void 0;case O.COLON:throw new Error('unexpected token ":"');default:return}}#u(){let t=[];do{if(this.#o(),this._matches(O.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"]"),this.#r.list(t)}#m(){let t={};do{if(this.#o(),this._matches(O.GROUPER,"}"))break;let e=this.#n;(this._matches(O.STRING)||this._matches(O.IDENTIFIER))&&this.#o(),this.#o(O.COLON),t[e]=this.#s()}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"}"),this.#r.map(t)}#f(){let t=this.#n;if(t==="true")return this.#o(),this.#r.literal(!0);if(t==="false")return this.#o(),this.#r.literal(!1);if(t==="null")return this.#o(),this.#r.literal(null);if(t==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#b(),r=this.#g();return r?this.#r.invoke(e,void 0,r):e}#b(){if(!this._matches(O.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let t=this.#n;return this.#o(),this.#r.id(t)}#g(){if(!this._matches(O.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(O.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(O.COMMA));return this.#o(O.GROUPER,")"),t}#v(){this.#o();let t=this.#s();return this.#o(O.GROUPER,"]"),t}#y(){let t=this.#g();if(this._matches(O.ARROW)){this.#o();let e=this.#s(),r=t?.map(i=>i.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#w(){let t=this.#r.literal(this.#n);return this.#o(),t}#x(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#C(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:hd,fromEntries:Im}=Object,Tm={"+":(o,t)=>o+t,"-":(o,t)=>o-t,"*":(o,t)=>o*t,"/":(o,t)=>o/t,"%":(o,t)=>o%t,"==":(o,t)=>o==t,"!=":(o,t)=>o!=t,"===":(o,t)=>o===t,"!==":(o,t)=>o!==t,">":(o,t)=>o>t,">=":(o,t)=>o>=t,"<":(o,t)=>o<t,"<=":(o,t)=>o<=t,"||":(o,t)=>o||t,"&&":(o,t)=>o&&t,"??":(o,t)=>o??t,"|":(o,t)=>t(o),"|>":(o,t)=>t(o)},Rm={"+":o=>o,"-":o=>-o,"!":o=>!o},co=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let r=Rm[t];return{type:"Unary",operator:t,child:e,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,r){let i=Tm[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(n){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(n),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),c=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,c=this.left.value),a===void 0?void 0:a[c]=s}return i(this.left.evaluate(n),this.right.evaluate(n))},getIds(n){return this.left.getIds(n),this.right.getIds(n),n}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let n=this.receiver.evaluate(i),s=this.method?n:i?.this??i,a=this.method?n?.[e]:n,l=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,l)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(n=>n?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let n=this.entries[i];n&&(r[i]=n.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,n=this.body;return function(...s){let a=Im(i.map((l,d)=>[l,s[d]])),c=new Proxy(r??{},{set(l,d,h){return hd(a,d)&&(a[d]=h),l[d]=h},get(l,d){return hd(a,d)?a[d]:l[d]}});return n.evaluate(c)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var tc=null,pd={boundAttributeSuffix:et.M,marker:et.P,markerMatch:et.A,HTML_RESULT:et.C,getTemplateHtml:et.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){tc??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(tc))return void(e[tc]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let r=it;return o.j=i=>r=i,o._$AI(t,o,e),r},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:et.V,AttributePart:et.H,PropertyPart:et.B,BooleanAttributePart:et.N,EventPart:et.U,ElementPart:et.F,TemplateInstance:et.R,isIterable:et.D,ChildPart:et.I};var{AttributePart:_m,PropertyPart:Mm,BooleanAttributePart:Pm,EventPart:Om}=pd,rc=new co,ec=new Map,ud=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),lo=(o,t)=>{let e=ec.get(o);if(e===void 0){if(ec.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new Ui(r,rc).parse(),ec.set(o,e)}}return e?.evaluate(t)},Dm=(o,t,e,r)=>{let i=o.getAttribute("if");if(i!==null&&lo(i,t))return ho(o,t,e,r)},md=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,fd=o=>/(?:\\{{)|(?:\\}})/g.test(o),Hi=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),$m=(o,t,e,r)=>{let i=o.getAttribute("repeat");if(i!==null){let n=lo(i,t);if(!n[Symbol.iterator])return P;let s=Wi(o),a=-1,c=[];for(let l of n){a++;let d=Object.create(t);d.item=l,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let y=m.update(d,e,r);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};c.push(f)}return c}},bd={if:Dm,repeat:$m},vd=(o,t=bd,e={},r)=>{let n=Wi(o).renderers;if(r){let a=Wi(r).renderers,c=n.super;c!==void 0?e={...n,...e,super:(l,d,h)=>(h={...a,...h,super:(f,m,y)=>ho(r,f,m,y)},c(l,d,h))}:(e={...a,...n,...e},o=r)}else e={...n,...e};return s=>ho(o,s,t,e)};var ho=(o,t,e=bd,r={})=>{let i=Wi(o),n=[];for(let a of i.parts){let c=a.update(t,e,r);a.type===1?n.push(...c):n.push(c)}return{_$litType$:i,values:n}},gd=new Map,Wi=o=>{let t=gd.get(o);return t===void 0&&gd.set(o,t=Nm(o)),t},Nm=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,n=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)i++;else if(r.nodeType===Node.ELEMENT_NODE){i++;let s=r;if(s.tagName==="TEMPLATE"){let c=s.getAttribute("type"),l=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||c!==null||l!==null){s.parentNode.insertBefore(document.createComment(""),s),n.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,w,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:lo(g,y);return(m?lo(f,y):u[d])?.(b,w,u)}}else c!==null?h=(f,m,y)=>{let w=m[c];return w?.(s,f,m,y)}:(l==="super"?t.renderers.super=(f,m,y)=>{let w=y.super,u=Wi(s);return y={...y,...u.renderers},w(f,m,y)}:t.renderers[l]=(f,m,y)=>ho(s,f,m,y),h=(f,m,y)=>{let w=y[l];return w?.(f,m,y)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let c of a){let l=s.getAttribute(c),d=l.split(md);if(d.length===1){fd(l)&&s.setAttribute(c,Hi(l));continue}s.removeAttribute(c);let h=c,f=_m,m=c[0];m==="."?(h=ud(c.substring(1)),f=Mm):m==="?"?(h=c.substring(1),f=Pm):m==="@"&&(h=ud(c.substring(1)),f=Om);let y=[Hi(d[0])],w=[];for(let u=1;u<d.length;u+=2){let g=d[u];w.push(Za(g,rc)),y.push(Hi(d[u+1]))}t.parts.push({type:1,index:i,name:h,strings:y,ctor:f,update:(u,g,b)=>w.map(q=>q.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,c=a.split(md);c.length>1?s.textContent=Hi(c[0]):fd(a)&&(s.textContent=Hi(a));for(let l=1;l<c.length;l+=2){let d=c[l],h=Za(d,rc);t.parts.push({type:2,index:++i,update:(m,y)=>h.evaluate(m)});let f=new Text(c[l+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of n)s.remove();return t};var ic=Symbol.for("qti-components.context-root"),Lm=()=>{if(typeof document>"u")return;let o=globalThis;o[ic]||(o[ic]=new zi,o[ic].attach(document.documentElement))};Lm();var yd=[];var oc=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#r():queueMicrotask(()=>this.#r())}#r(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},nc="custom-state-support-probe";function Vm(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(nc)||customElements.define(nc,class extends HTMLElement{});let t=o.call(document.createElement(nc)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var qd=!1;function wd(){if(qd)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Vm(o);return t==="modern"||(qd=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new oc(this)}),r}),t}wd();for(let{tag:o,ctor:t}of yd)customElements.get(o)||customElements.define(o,t);var Se=Symbol("computedItemContext");var ct=Symbol("computedContext");var yt=Symbol("configContext");var $r=Symbol("interactionContext");var F=Symbol("item");var xd=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var jm=/^[A-Za-z0-9-]+$/,Fm=o=>typeof o=="string"&&jm.test(o),Hy=o=>Fm(o)?o:void 0,qt=Symbol("qtiContext");var sc={view:"candidate"},po=Symbol("sessionContext");var ac={items:[],testOutcomeVariables:[]},nt=Symbol("testContext");var _=x`
6
6
  :host {
7
7
  box-sizing: border-box;
8
8
  }
@@ -12,7 +12,7 @@ Make sure to test your application with a production build as repeat registratio
12
12
  *::after {
13
13
  box-sizing: inherit;
14
14
  }
15
- `;var Qt=w`
15
+ `;var Qt=x`
16
16
  [part~='drop'] {
17
17
  /*
18
18
  * The one deliberate opt-out from the border-box reset.
@@ -52,27 +52,27 @@ Make sure to test your application with a production build as repeat registratio
52
52
  flex: 0 1 auto;
53
53
  align-self: flex-start;
54
54
  }
55
- `;var U=w`
55
+ `;var U=x`
56
56
  [part~='message'] {
57
57
  display: none;
58
58
  }
59
- `;var vd={chip:["drag"],drop:["droppable"],lifted:["dragging"],used:["placeholder"],"return-target":["return-anchor"],"drag-over":["hover"],"candidate-partial":["candidate-partially-correct"]};function z(o,t,e,r){if(!o)return;let i=[t,...r??vd[t]??[]];for(let n of i)e?o.add(n):o.delete(n)}function Hi(o,t){return o?o.has(t)?!0:(vd[t]??[]).some(e=>o.has(e)):!1}var Dr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},D=class extends C{#t;get _context(){return this.#t.value}#e;#r;#i(t){t?.readonly!==void 0&&t.readonly!==this.#e&&(this.#e=t.readonly,this.readonly=t.readonly),t?.disabled!==void 0&&t.disabled!==this.#r&&(this.#r=t.disabled,this.disabled=t.disabled),this.#a(t)}#n;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),r=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!r)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let i=this.#n===void 0,n=JSON.stringify(r.value??null);n!==this.#n&&(this.#n=n,!(i&&(r.value===null||r.value===void 0))&&n!==this.#o&&(this.#o=n,this.response=r.value))}#c;static{this.formAssociated=!0}get internals(){return this._internals}get registersWithItem(){return!0}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let t=this._context.variables.filter(r=>r.type==="response"),e=this.getAttribute("response-identifier");return t.find(r=>r.identifier===e)}get value(){return JSON.stringify(this.response)}set value(t){this.response=t?JSON.parse(t):null}resetValidityReport(){this._validityReported=!1,this.clearInlineValidationMessage()}reportValidity(t){let e=t?.trigger??"submit";e==="submit"&&this.validate?.();let r=this._internals.validity.valid,i=this.validationDisplayMode;if(e==="submit"&&(this._validityReported=!0),e==="change"&&!this._validityReported&&this._validityKind==="min")return this.clearInlineValidationMessage(),r;if(i==="native"||i==="both"){this._reportingNatively=!0;try{this._internals.reportValidity()}finally{this._reportingNatively=!1}}return i==="inline"||i==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),i==="none"&&this.clearInlineValidationMessage(),r}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(t){let e=t?.defaultWhenUnset??!0,r=this.configContext;return r&&r.allowReorder!==void 0?r.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,r=this.configContext;return r?r.disableAfterMaxReached!==void 0?r.disableAfterMaxReached:r.disableAfterIfMaxChoicesReached!==void 0?(this.#c||(this.#c=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),r.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",r,i){let n=r??this;this._internals.setValidity(t?{}:{customError:!0},e,n),this._validityKind=t?void 0:i?.kind??"other",i?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.resetValidityReport(),this.response=null}formResetCallback(){this.resetValidityReport(),this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}update(t){let e=!this.hasUpdated;if(super.update(t),e){let r=()=>this.isConnected&&this.validate();this.updateComplete.then(r),requestAnimationFrame(()=>requestAnimationFrame(r))}t.has("disabled")&&z(this._internals.states,"disabled",this.disabled),t.has("readonly")&&z(this._internals.states,"readonly",this.readonly)}constructor(){super(),this.#t=new at(this,{context:F,subscribe:!0,callback:t=>this.#i(t)}),this.#s=!1,this.#c=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._validityReported=!1,this._reportingNatively=!1,this._internals=this.attachInternals(),this.addEventListener("invalid",()=>{this._reportingNatively||(this._validityReported=!0,(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage())}),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Dr([_({context:yt,subscribe:!0})],D.prototype,"configContext",void 0);Dr([Q({context:Or})],D.prototype,"_interactionContext",void 0);Dr([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Dr([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Dr([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Dr([p({type:String})],D.prototype,"name",void 0);var $r=class extends C{render(){return v`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(i=>i.innerHTML.trim());return r.length>1||t==="multiple"||t==="ordered"?r:r[0]}};var sc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},oc=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??yd(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??yd(o),value:String(o),cardinality:"single",type:"response"},yd=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",Rm=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},E=class extends C{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return r==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.resolveVariable(r)}case"qti-multiple":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let i=e.getResult();return i?.length>0?i:null}case"qti-custom-operator":return oc(e.calculate?.());case"qti-correct":{let r=e.getAttribute("identifier")||"",i=this.context?.variables?.find(n=>n.identifier===r);return i?{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}:(console.warn(`qti-correct: no response declaration for "${r}"`),oc(null))}default:{try{let r=e,i=r.getResult();return oc(i,r.resultBaseType??Rm(r,i))}catch(r){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,r)}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null);return this.#t=t,t}}#t;get lastResult(){return this.result}get lastVariables(){return this.#t}static{this.styles=w`
59
+ `;var Cd={chip:["drag"],drop:["droppable"],lifted:["dragging"],used:["placeholder"],"return-target":["return-anchor"],"drag-over":["hover"],"candidate-partial":["candidate-partially-correct"]};function z(o,t,e,r){if(!o)return;let i=[t,...r??Cd[t]??[]];for(let n of i)e?o.add(n):o.delete(n)}function Qi(o,t){return o?o.has(t)?!0:(Cd[t]??[]).some(e=>o.has(e)):!1}var Nr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},D=class extends C{#t;get _context(){return this.#t.value}#e;#r;#i(t){t?.readonly!==void 0&&t.readonly!==this.#e&&(this.#e=t.readonly,this.readonly=t.readonly),t?.disabled!==void 0&&t.disabled!==this.#r&&(this.#r=t.disabled,this.disabled=t.disabled),this.#a(t)}#n;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),r=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!r)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let i=this.#n===void 0,n=JSON.stringify(r.value??null);n!==this.#n&&(this.#n=n,!(i&&(r.value===null||r.value===void 0))&&n!==this.#o&&(this.#o=n,this.response=r.value))}#c;static{this.formAssociated=!0}get internals(){return this._internals}get registersWithItem(){return!0}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let t=this._context.variables.filter(r=>r.type==="response"),e=this.getAttribute("response-identifier");return t.find(r=>r.identifier===e)}get value(){return JSON.stringify(this.response)}set value(t){this.response=t?JSON.parse(t):null}resetValidityReport(){this._validityReported=!1,this.clearInlineValidationMessage()}reportValidity(t){let e=t?.trigger??"submit";e==="submit"&&this.validate?.();let r=this._internals.validity.valid,i=this.validationDisplayMode;if(e==="submit"&&(this._validityReported=!0),e==="change"&&!this._validityReported&&this._validityKind==="min")return this.clearInlineValidationMessage(),r;if(i==="native"||i==="both"){this._reportingNatively=!0;try{this._internals.reportValidity()}finally{this._reportingNatively=!1}}return i==="inline"||i==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),i==="none"&&this.clearInlineValidationMessage(),r}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(t){let e=t?.defaultWhenUnset??!0,r=this.configContext;return r&&r.allowReorder!==void 0?r.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,r=this.configContext;return r?r.disableAfterMaxReached!==void 0?r.disableAfterMaxReached:r.disableAfterIfMaxChoicesReached!==void 0?(this.#c||(this.#c=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),r.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",r,i){let n=r??this;this._internals.setValidity(t?{}:{customError:!0},e,n),this._validityKind=t?void 0:i?.kind??"other",i?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.resetValidityReport(),this.response=null}formResetCallback(){this.resetValidityReport(),this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}update(t){let e=!this.hasUpdated;if(super.update(t),e){let r=()=>this.isConnected&&this.validate();this.updateComplete.then(r),requestAnimationFrame(()=>requestAnimationFrame(r))}t.has("disabled")&&z(this._internals.states,"disabled",this.disabled),t.has("readonly")&&z(this._internals.states,"readonly",this.readonly)}constructor(){super(),this.#t=new at(this,{context:F,subscribe:!0,callback:t=>this.#i(t)}),this.#s=!1,this.#c=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._validityReported=!1,this._reportingNatively=!1,this._internals=this.attachInternals(),this.addEventListener("invalid",()=>{this._reportingNatively||(this._validityReported=!0,(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage())}),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Nr([R({context:yt,subscribe:!0})],D.prototype,"configContext",void 0);Nr([Q({context:$r})],D.prototype,"_interactionContext",void 0);Nr([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Nr([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Nr([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Nr([p({type:String})],D.prototype,"name",void 0);var Lr=class extends C{render(){return v`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(i=>i.innerHTML.trim());return r.length>1||t==="multiple"||t==="ordered"?r:r[0]}};var lc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},cc=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??kd(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??kd(o),value:String(o),cardinality:"single",type:"response"},kd=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",zm=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},E=class extends C{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return r==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.resolveVariable(r)}case"qti-multiple":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let i=e.getResult();return i?.length>0?i:null}case"qti-custom-operator":return cc(e.calculate?.());case"qti-correct":{let r=e.getAttribute("identifier")||"",i=this.context?.variables?.find(n=>n.identifier===r);return i?{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}:(console.warn(`qti-correct: no response declaration for "${r}"`),cc(null))}default:{try{let r=e,i=r.getResult();return cc(i,r.resultBaseType??zm(r,i))}catch(r){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,r)}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null);return this.#t=t,t}}#t;get lastResult(){return this.result}get lastVariables(){return this.#t}static{this.styles=x`
60
60
  slot {
61
61
  display: none;
62
62
  }
63
- `}render(){return v`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(i=>i.identifier===e[0])?.variables?.find(i=>i.identifier===e[e.length-1])??null}};sc([_({context:F,subscribe:!0})],E.prototype,"context",void 0);sc([_({context:qt,subscribe:!0})],E.prototype,"qtiContext",void 0);sc([_({context:nt,subscribe:!0})],E.prototype,"_testContext",void 0);var Xt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var cq=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Mt=o=>typeof o=="string"?o:o.toString();function ac(o){return o==null}function ho(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Wi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ut=class extends C{constructor(){super(...arguments),this.showHide="show",this.#t=new at(this,{context:F,subscribe:!0,callback:t=>this.#r(t)}),this.#i=!1}#t;get _context(){return this.#t.value}#e;#r(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let r=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),i=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,n=this.#e===void 0?i>0:this.#e!==r||i>0;this.#e=r,n&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!ac(this.identifier)&&!ac(e?.value)&&this.identifier===e.value||!1,this.#n(r)}#i;#n(t){let e=this.#s()&&this.#o(t)?"on":"off";if(e==="on"){if(this.showStatus==="on"||this.#i)return;if(!this.feedbackShowing()){this.#i=!0,this.showStatus="off";return}}else if(this.#i=!1,this.showStatus==="on"&&!this.feedbackHiding())return;this.showStatus=e}#o(t){return t&&this.showHide==="show"||!t&&this.showHide==="hide"}feedbackShowing(){return!0}feedbackHiding(){return!0}#s(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(i=>i.active)?.sections.flatMap(i=>i.items).find(i=>i.active);if(!t||t.sessionControl?.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.sessionControl?.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(i=>i.identifier==="numAttempts")?.value)||0)<e}};Wi([p({type:String,attribute:"show-hide"})],ut.prototype,"showHide",void 0);Wi([p({type:String,attribute:"outcome-identifier"})],ut.prototype,"outcomeIdentifier",void 0);Wi([p({type:String})],ut.prototype,"identifier",void 0);Wi([p({type:String,attribute:!1})],ut.prototype,"showStatus",void 0);Wi([_({context:ct,subscribe:!0}),I()],ut.prototype,"_computedContext",void 0);function Qi(o){if(o==null)return null;if(!o.includes(",")){let e=o.trim();return e.length>0?e:null}let t=o.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function ar(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(r=>r.trim()).filter(r=>r.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*bq(o){if(o!=null){if(Array.isArray(o)){for(let t of o){let e=t.trim();e&&(yield e)}return}if(!o.includes(",")){let t=o.trim();t&&(yield t);return}for(let t of o.split(",")){let e=t.trim();e&&(yield e)}}}function vq(o){let[t,e,...r]=o.trim().split(/\s+/);if(!t||!e||r.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function yq(o,t){return`${o} ${t}`}function qq(o){let[t,e,...r]=o.trim().split(/\s+/),i=Number(t),n=Number(e);if(!Number.isFinite(i)||!Number.isFinite(n)||r.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:i,y:n}}function xq(o,t){return`${o} ${t}`}function Gt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=Qi(r);return i===null?t:i},toAttribute:r=>e(r)?null:ar(r)}}var de=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Xi=o=>{let t={},e={};for(let r of o){let i=r.getAttribute("field-identifier");if(!i)continue;t[i]=r.textContent?.trim()??"";let n=r.getAttribute("base-type");n&&(e[i]=n)}return{value:t,baseTypes:e}},qd=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,po=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(qd.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(r=>qd.test(r))?"point":"string"};var xd=class extends C{},Nr=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Lr=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var Mm=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},cc=o=>t=>{let e=Mm(t);return e===null?null:o(e)},Pm=["depcp","questify","qade"],Om={Trim:cc(o=>o.trim()),ToAscii:cc(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:cc(o=>o.replace(",","."))},Dm=new Map(Pm.flatMap(o=>Object.entries(Om).map(([t,e])=>[`${o}:${t}`,e]))),lc=new Map,Sq=(o,t)=>{lc.set(o,t)},Aq=o=>{lc.delete(o)},wd=o=>lc.get(o)??Dm.get(o)??null;var Cd={true:!0,1:!0,false:!1,0:!1},J=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,n]=t.split(" ").map(Number),[s,...a]=e.split(","),c=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[l,d,h]=c;return c.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-l)**2+(n-d)**2)<=h}case"rect":{let[l,d,h,f]=c;return c.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=l&&i<=h&&n>=d&&n<=f}case"ellipse":{let[l,d,h,f]=c;if(c.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-l)**2/h**2,y=(n-d)**2/f**2;return m+y<=1}case"poly":{if(c.length<6||c.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let l=[];for(let d=0;d<c.length;d+=2)l.push({x:c[d],y:c[d+1]});return this.isPointInPolygon({x:i,y:n},l)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let s=e[i].x,a=e[i].y,c=e[n].x,l=e[n].y;a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"boolean":{let i=Cd[t.trim().toLowerCase()];return i!==void 0&&i===Cd[e.trim().toLowerCase()]}case"integer":{let i=parseInt(t,10),n=parseInt(e,10);if(!isNaN(i)&&!isNaN(n)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:i===n}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),n=parseFloat(e);if(!isNaN(i)&&!isNaN(n))return i===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" "),n=e.split(" ");if(i.length===2&&n.length===2)return r==="pair"&&(i.sort(),n.sort()),i.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Se=Symbol("testHost");var Ed={"qc-item-rendered":{kind:"notification",scope:"item",deprecated:"cito-item-rendered"},"qc-item-response-changed":{kind:"notification",scope:"item",deprecated:"cito-item-response-changed"},"qc-item-set-outcomes":{kind:"request",scope:"item",deprecated:"cito-item-set-outcomes"},"qc-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcome-changed"},"qc-item-outcomes-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcomes-changed"},"qc-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"cito-item-rubric-placement"},"qc-feedback-show":{kind:"notification",scope:"item",deprecated:"cito-feedback-show"},"qc-feedback-hide":{kind:"notification",scope:"item",deprecated:"cito-feedback-hide"}};function dc(o,t,e,r,i=!1){let n={detail:r??{},bubbles:!0,composed:!0,cancelable:i},s=o.dispatchEvent(new CustomEvent(e,n)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,n))&&s:s}var kd=new Set;function hc(o,t,e,r){let i;o.addEventListener(e,s=>{i=s.detail,queueMicrotask(()=>i=void 0),r(s)});let{deprecated:n}=t[e];n&&o.addEventListener(n,s=>{i!==void 0&&s.detail===i||(kd.has(n)||(kd.add(n),console.warn(`[qti-components] The event "${n}" is deprecated; dispatch "${e}" instead.`)),r(s))})}function xt(o,t,e,r=!1){return dc(o,Ed,t,e,r)}function Sd(o,t,e){hc(o,Ed,t,e)}var Ad={"qc-test-navigate":{kind:"request",scope:"test",deprecated:"cito-test-navigate"},"qc-test-end-attempt":{kind:"request",scope:"test",deprecated:"cito-test-end-attempt"},"qc-test-submit":{kind:"request",scope:"test",deprecated:"cito-test-submit"},"qc-test-update-outcome":{kind:"request",scope:"test",deprecated:"cito-test-update-outcome"},"qc-test-update-plugin-state":{kind:"request",scope:"test",deprecated:"cito-test-update-plugin-state"},"qc-test-switch-view":{kind:"request",scope:"test",deprecated:"cito-test-switch-view"},"qc-test-submitted":{kind:"notification",scope:"test",deprecated:"cito-test-submitted"},"qc-test-navigated":{kind:"notification",scope:"test",deprecated:"cito-test-navigated"},"qc-test-navigation-started":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-started"},"qc-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-failed"},"qc-test-rendered":{kind:"notification",scope:"test",deprecated:"cito-test-rendered"},"qc-test-loaded":{kind:"notification",scope:"test",deprecated:"cito-test-loaded"},"qc-test-state-changed":{kind:"notification",scope:"test",deprecated:"cito-test-state-changed"},"qc-test-state-refused":{kind:"notification",scope:"test"},"qc-test-items-skipped":{kind:"notification",scope:"test",deprecated:"cito-test-items-skipped"},"qc-test-end-reached":{kind:"notification",scope:"test",deprecated:"cito-test-end-reached"},"qc-item-ref-connected":{kind:"notification",scope:"item",deprecated:"cito-item-ref-connected"}};function j(o,t,e){dc(o,Ad,t,e)}function B(o,t,e){hc(o,Ad,t,e)}var Ae=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Td={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},wt=class extends C{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let r=e.getAttribute("identifier");if(!r)continue;let i=Number(e.getAttribute("value"));if(Number.isNaN(i)){console.warn(`qti-weight "${r}" has a non-numeric value, ignoring it`);continue}t.set(r,i)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?ud(t):null,this.requestUpdate(),await this.updateComplete,j(this,"qc-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let r=e.items.find(i=>i.identifier===this.identifier);if(r)return r}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};Ae([p({type:String})],wt.prototype,"category",void 0);Ae([p({type:String})],wt.prototype,"identifier",void 0);Ae([p({type:Boolean,converter:Td})],wt.prototype,"required",void 0);Ae([p({type:Boolean,converter:Td})],wt.prototype,"fixed",void 0);Ae([p({type:String})],wt.prototype,"href",void 0);Ae([I(),_({context:ct,subscribe:!0})],wt.prototype,"computedContext",void 0);Ae([p({type:Object,attribute:!1})],wt.prototype,"xmlDoc",void 0);Ae([_({context:Se,subscribe:!0})],wt.prototype,"testHost",void 0);var Vr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pc={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Yt=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return v`<slot name="qti-rubric-block"></slot><slot></slot>`}};Vr([p({type:String})],Yt.prototype,"identifier",void 0);Vr([p({type:String})],Yt.prototype,"required",void 0);Vr([p({type:Boolean,converter:pc})],Yt.prototype,"fixed",void 0);Vr([p({type:Boolean,converter:pc})],Yt.prototype,"visible",void 0);Vr([p({type:Boolean,converter:pc,attribute:"keep-together"})],Yt.prototype,"keepTogether",void 0);Vr([_({context:nt,subscribe:!0})],Yt.prototype,"_testContext",void 0);var uc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},cr=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,j(this,"qc-test-loaded",this)}render(){return v` <slot></slot>`}};uc([p({type:String})],cr.prototype,"identifier",void 0);uc([p({type:String})],cr.prototype,"title",null);uc([_({context:nt,subscribe:!0})],cr.prototype,"_testContext",void 0);function uo(o,t){let e=o.firstElementChild;if(!e||typeof e.calculate!="function")return console.warn(`<${o.localName}> has no evaluable expression child`,o),t;try{let r=e.calculate();return r===!0||r==="true"}catch(r){return console.warn(`<${o.localName}> could not evaluate its expression`,r),t}}var $m=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},he=class extends C{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=w`
63
+ `}render(){return v`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(i=>i.identifier===e[0])?.variables?.find(i=>i.identifier===e[e.length-1])??null}};lc([R({context:F,subscribe:!0})],E.prototype,"context",void 0);lc([R({context:qt,subscribe:!0})],E.prototype,"qtiContext",void 0);lc([R({context:nt,subscribe:!0})],E.prototype,"_testContext",void 0);var Xt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var xq=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Mt=o=>typeof o=="string"?o:o.toString();function dc(o){return o==null}function uo(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Xi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ut=class extends C{constructor(){super(...arguments),this.showHide="show",this.#t=new at(this,{context:F,subscribe:!0,callback:t=>this.#r(t)}),this.#i=!1}#t;get _context(){return this.#t.value}#e;#r(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let r=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),i=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,n=this.#e===void 0?i>0:this.#e!==r||i>0;this.#e=r,n&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!dc(this.identifier)&&!dc(e?.value)&&this.identifier===e.value||!1,this.#n(r)}#i;#n(t){let e=this.#s()&&this.#o(t)?"on":"off";if(e==="on"){if(this.showStatus==="on"||this.#i)return;if(!this.feedbackShowing()){this.#i=!0,this.showStatus="off";return}}else if(this.#i=!1,this.showStatus==="on"&&!this.feedbackHiding())return;this.showStatus=e}#o(t){return t&&this.showHide==="show"||!t&&this.showHide==="hide"}feedbackShowing(){return!0}feedbackHiding(){return!0}#s(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(i=>i.active)?.sections.flatMap(i=>i.items).find(i=>i.active);if(!t||t.sessionControl?.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.sessionControl?.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(i=>i.identifier==="numAttempts")?.value)||0)<e}};Xi([p({type:String,attribute:"show-hide"})],ut.prototype,"showHide",void 0);Xi([p({type:String,attribute:"outcome-identifier"})],ut.prototype,"outcomeIdentifier",void 0);Xi([p({type:String})],ut.prototype,"identifier",void 0);Xi([p({type:String,attribute:!1})],ut.prototype,"showStatus",void 0);Xi([R({context:ct,subscribe:!0}),T()],ut.prototype,"_computedContext",void 0);function Gi(o){if(o==null)return null;if(!o.includes(",")){let e=o.trim();return e.length>0?e:null}let t=o.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function cr(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(r=>r.trim()).filter(r=>r.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*_q(o){if(o!=null){if(Array.isArray(o)){for(let t of o){let e=t.trim();e&&(yield e)}return}if(!o.includes(",")){let t=o.trim();t&&(yield t);return}for(let t of o.split(",")){let e=t.trim();e&&(yield e)}}}function Mq(o){let[t,e,...r]=o.trim().split(/\s+/);if(!t||!e||r.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function Pq(o,t){return`${o} ${t}`}function Oq(o){let[t,e,...r]=o.trim().split(/\s+/),i=Number(t),n=Number(e);if(!Number.isFinite(i)||!Number.isFinite(n)||r.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:i,y:n}}function Dq(o,t){return`${o} ${t}`}function Gt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=Gi(r);return i===null?t:i},toAttribute:r=>e(r)?null:cr(r)}}var he=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Yi=o=>{let t={},e={};for(let r of o){let i=r.getAttribute("field-identifier");if(!i)continue;t[i]=r.textContent?.trim()??"";let n=r.getAttribute("base-type");n&&(e[i]=n)}return{value:t,baseTypes:e}},Ed=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,mo=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(Ed.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(r=>Ed.test(r))?"point":"string"};var Sd=class extends C{},Vr=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},jr=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var Bm=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},hc=o=>t=>{let e=Bm(t);return e===null?null:o(e)},Um=["depcp","questify","qade"],Hm={Trim:hc(o=>o.trim()),ToAscii:hc(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:hc(o=>o.replace(",","."))},Wm=new Map(Um.flatMap(o=>Object.entries(Hm).map(([t,e])=>[`${o}:${t}`,e]))),pc=new Map,jq=(o,t)=>{pc.set(o,t)},Fq=o=>{pc.delete(o)},Ad=o=>pc.get(o)??Wm.get(o)??null;var Id={true:!0,1:!0,false:!1,0:!1},J=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,n]=t.split(" ").map(Number),[s,...a]=e.split(","),c=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[l,d,h]=c;return c.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-l)**2+(n-d)**2)<=h}case"rect":{let[l,d,h,f]=c;return c.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=l&&i<=h&&n>=d&&n<=f}case"ellipse":{let[l,d,h,f]=c;if(c.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-l)**2/h**2,y=(n-d)**2/f**2;return m+y<=1}case"poly":{if(c.length<6||c.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let l=[];for(let d=0;d<c.length;d+=2)l.push({x:c[d],y:c[d+1]});return this.isPointInPolygon({x:i,y:n},l)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let s=e[i].x,a=e[i].y,c=e[n].x,l=e[n].y;a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"boolean":{let i=Id[t.trim().toLowerCase()];return i!==void 0&&i===Id[e.trim().toLowerCase()]}case"integer":{let i=parseInt(t,10),n=parseInt(e,10);if(!isNaN(i)&&!isNaN(n)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:i===n}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),n=parseFloat(e);if(!isNaN(i)&&!isNaN(n))return i===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" "),n=e.split(" ");if(i.length===2&&n.length===2)return r==="pair"&&(i.sort(),n.sort()),i.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Ae=Symbol("testHost");var Rd={"qc-item-rendered":{kind:"notification",scope:"item",deprecated:"cito-item-rendered"},"qc-item-response-changed":{kind:"notification",scope:"item",deprecated:"cito-item-response-changed"},"qc-item-set-outcomes":{kind:"request",scope:"item",deprecated:"cito-item-set-outcomes"},"qc-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcome-changed"},"qc-item-outcomes-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcomes-changed"},"qc-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"cito-item-rubric-placement"},"qc-feedback-show":{kind:"notification",scope:"item",deprecated:"cito-feedback-show"},"qc-feedback-hide":{kind:"notification",scope:"item",deprecated:"cito-feedback-hide"}};function uc(o,t,e,r,i=!1){let n={detail:r??{},bubbles:!0,composed:!0,cancelable:i},s=o.dispatchEvent(new CustomEvent(e,n)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,n))&&s:s}var Td=new Set;function mc(o,t,e,r){let i;o.addEventListener(e,s=>{i=s.detail,queueMicrotask(()=>i=void 0),r(s)});let{deprecated:n}=t[e];n&&o.addEventListener(n,s=>{i!==void 0&&s.detail===i||(Td.has(n)||(Td.add(n),console.warn(`[qti-components] The event "${n}" is deprecated; dispatch "${e}" instead.`)),r(s))})}function wt(o,t,e,r=!1){return uc(o,Rd,t,e,r)}function _d(o,t,e){mc(o,Rd,t,e)}var Md={"qc-test-navigate":{kind:"request",scope:"test",deprecated:"cito-test-navigate"},"qc-test-end-attempt":{kind:"request",scope:"test",deprecated:"cito-test-end-attempt"},"qc-test-submit":{kind:"request",scope:"test",deprecated:"cito-test-submit"},"qc-test-update-outcome":{kind:"request",scope:"test",deprecated:"cito-test-update-outcome"},"qc-test-update-plugin-state":{kind:"request",scope:"test",deprecated:"cito-test-update-plugin-state"},"qc-test-switch-view":{kind:"request",scope:"test",deprecated:"cito-test-switch-view"},"qc-test-submitted":{kind:"notification",scope:"test",deprecated:"cito-test-submitted"},"qc-test-navigated":{kind:"notification",scope:"test",deprecated:"cito-test-navigated"},"qc-test-navigation-started":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-started"},"qc-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-failed"},"qc-test-rendered":{kind:"notification",scope:"test",deprecated:"cito-test-rendered"},"qc-test-loaded":{kind:"notification",scope:"test",deprecated:"cito-test-loaded"},"qc-test-state-changed":{kind:"notification",scope:"test",deprecated:"cito-test-state-changed"},"qc-test-state-refused":{kind:"notification",scope:"test"},"qc-test-items-skipped":{kind:"notification",scope:"test",deprecated:"cito-test-items-skipped"},"qc-test-end-reached":{kind:"notification",scope:"test",deprecated:"cito-test-end-reached"},"qc-item-ref-connected":{kind:"notification",scope:"item",deprecated:"cito-item-ref-connected"}};function j(o,t,e){uc(o,Md,t,e)}function B(o,t,e){mc(o,Md,t,e)}var Ie=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Pd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},xt=class extends C{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let r=e.getAttribute("identifier");if(!r)continue;let i=Number(e.getAttribute("value"));if(Number.isNaN(i)){console.warn(`qti-weight "${r}" has a non-numeric value, ignoring it`);continue}t.set(r,i)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?vd(t):null,this.requestUpdate(),await this.updateComplete,j(this,"qc-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let r=e.items.find(i=>i.identifier===this.identifier);if(r)return r}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};Ie([p({type:String})],xt.prototype,"category",void 0);Ie([p({type:String})],xt.prototype,"identifier",void 0);Ie([p({type:Boolean,converter:Pd})],xt.prototype,"required",void 0);Ie([p({type:Boolean,converter:Pd})],xt.prototype,"fixed",void 0);Ie([p({type:String})],xt.prototype,"href",void 0);Ie([T(),R({context:ct,subscribe:!0})],xt.prototype,"computedContext",void 0);Ie([p({type:Object,attribute:!1})],xt.prototype,"xmlDoc",void 0);Ie([R({context:Ae,subscribe:!0})],xt.prototype,"testHost",void 0);var Fr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fc={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Yt=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return v`<slot name="qti-rubric-block"></slot><slot></slot>`}};Fr([p({type:String})],Yt.prototype,"identifier",void 0);Fr([p({type:String})],Yt.prototype,"required",void 0);Fr([p({type:Boolean,converter:fc})],Yt.prototype,"fixed",void 0);Fr([p({type:Boolean,converter:fc})],Yt.prototype,"visible",void 0);Fr([p({type:Boolean,converter:fc,attribute:"keep-together"})],Yt.prototype,"keepTogether",void 0);Fr([R({context:nt,subscribe:!0})],Yt.prototype,"_testContext",void 0);var gc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lr=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,j(this,"qc-test-loaded",this)}render(){return v` <slot></slot>`}};gc([p({type:String})],lr.prototype,"identifier",void 0);gc([p({type:String})],lr.prototype,"title",null);gc([R({context:nt,subscribe:!0})],lr.prototype,"_testContext",void 0);function fo(o,t){let e=o.firstElementChild;if(!e||typeof e.calculate!="function")return console.warn(`<${o.localName}> has no evaluable expression child`,o),t;try{let r=e.calculate();return r===!0||r==="true"}catch(r){return console.warn(`<${o.localName}> could not evaluate its expression`,r),t}}var Qm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pe=class extends C{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=x`
64
64
  :host {
65
65
  display: none;
66
66
  }
67
- `}evaluate(){return uo(this,!1)}render(){return v`<slot></slot>`}};$m([p({type:String})],he.prototype,"target",void 0);var lr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},jr={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Pt=class extends C{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return v`<slot></slot>`}};lr([p({type:Number,attribute:"max-attempts"})],Pt.prototype,"maxAttempts",void 0);lr([p({type:Boolean,converter:jr,attribute:"show-feedback"})],Pt.prototype,"showFeedback",void 0);lr([p({type:Boolean,converter:jr,attribute:"allow-review"})],Pt.prototype,"allowReview",void 0);lr([p({type:Boolean,converter:jr,attribute:"show-solution"})],Pt.prototype,"showSolution",void 0);lr([p({type:Boolean,converter:jr,attribute:"allow-comment"})],Pt.prototype,"allowComment",void 0);lr([p({type:Boolean,converter:jr,attribute:"allow-skipping"})],Pt.prototype,"allowSkipping",void 0);lr([p({type:Boolean,converter:jr,attribute:"validate-responses"})],Pt.prototype,"validateResponses",void 0);var mc=o=>o?.split(/\s+/).filter(Boolean)??[],Fr=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:mc(o.getAttribute("include-category")),excludeCategories:mc(o.getAttribute("exclude-category"))}),zr=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:r})=>{let i=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return i.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):i.flatMap(n=>Array.from(n.querySelectorAll("qti-assessment-item-ref"))).filter(n=>{let s=mc(n.category);return!(e.length>0&&!s.some(a=>e.includes(a))||r.length>0&&s.some(a=>r.includes(a)))})};var Nm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Gi=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-number-presented: no enclosing qti-assessment-test, nothing to count"),0;let e=new Set((this._testContext?.items??[]).filter(r=>{let i=r.variables?.find(n=>n.identifier==="completionStatus")?.value;return i!=null&&i!=="not_attempted"}).map(r=>r.identifier));return zr(t,Fr(this)).filter(r=>e.has(r.identifier)).length}calculate(){return this.getResult()}};Nm([_({context:nt,subscribe:!0})],Gi.prototype,"_testContext",void 0);var mo=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?zr(t,Fr(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var fo=class extends C{static{this.styles=w`
67
+ `}evaluate(){return fo(this,!1)}render(){return v`<slot></slot>`}};Qm([p({type:String})],pe.prototype,"target",void 0);var dr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},zr={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Pt=class extends C{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return v`<slot></slot>`}};dr([p({type:Number,attribute:"max-attempts"})],Pt.prototype,"maxAttempts",void 0);dr([p({type:Boolean,converter:zr,attribute:"show-feedback"})],Pt.prototype,"showFeedback",void 0);dr([p({type:Boolean,converter:zr,attribute:"allow-review"})],Pt.prototype,"allowReview",void 0);dr([p({type:Boolean,converter:zr,attribute:"show-solution"})],Pt.prototype,"showSolution",void 0);dr([p({type:Boolean,converter:zr,attribute:"allow-comment"})],Pt.prototype,"allowComment",void 0);dr([p({type:Boolean,converter:zr,attribute:"allow-skipping"})],Pt.prototype,"allowSkipping",void 0);dr([p({type:Boolean,converter:zr,attribute:"validate-responses"})],Pt.prototype,"validateResponses",void 0);var bc=o=>o?.split(/\s+/).filter(Boolean)??[],Br=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:bc(o.getAttribute("include-category")),excludeCategories:bc(o.getAttribute("exclude-category"))}),Ur=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:r})=>{let i=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return i.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):i.flatMap(n=>Array.from(n.querySelectorAll("qti-assessment-item-ref"))).filter(n=>{let s=bc(n.category);return!(e.length>0&&!s.some(a=>e.includes(a))||r.length>0&&s.some(a=>r.includes(a)))})};var Xm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ji=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-number-presented: no enclosing qti-assessment-test, nothing to count"),0;let e=new Set((this._testContext?.items??[]).filter(r=>{let i=r.variables?.find(n=>n.identifier==="completionStatus")?.value;return i!=null&&i!=="not_attempted"}).map(r=>r.identifier));return Ur(t,Br(this)).filter(r=>e.has(r.identifier)).length}calculate(){return this.getResult()}};Xm([R({context:nt,subscribe:!0})],Ji.prototype,"_testContext",void 0);var go=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?Ur(t,Br(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var bo=class extends C{static{this.styles=x`
68
68
  :host {
69
69
  display: none;
70
70
  }
71
- `}evaluate(){return uo(this,!0)}render(){return v`<slot></slot>`}};var go=class extends C{static{this.styles=[w`
71
+ `}evaluate(){return fo(this,!0)}render(){return v`<slot></slot>`}};var vo=class extends C{static{this.styles=[x`
72
72
  :host {
73
73
  display: none;
74
74
  }
75
- `]}render(){return v`<slot></slot>`}process(){let t=new fc,e=[...this.children];t.process(e)}},fc=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Lr))throw e}}};var dr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},mt=class extends C{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:bd},this.#r={...this._context,variables:this._context.variables},this.#i=new Map,this.#n=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,r=e.type==="template"?this.#i.get(e.identifier):void 0,i=r!==void 0?{...e,value:r}:e;this._context={...this._context,variables:[...this._context.variables,i]},this.#r=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.#v(r,!0,e)},this.#l=t=>{t.stopImmediatePropagation();let{outcomes:e=[],responseProcessed:r=!1}=t.detail??{},i=[];r&&this.adaptive==="false"&&(e.find(s=>s.identifier==="completionStatus")?.value??this.getVariable("completionStatus")?.value)==="unknown"&&i.push({identifier:"completionStatus",value:"completed"}),this.#y([...e,...i],this.#q(!1)),r&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),r=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||r)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...r?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(n=>!("identifier"in n))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,r=t.filter(n=>n.value!==null&&n.value!==void 0&&(n.type==="template"||e.some(s=>s.identifier===n.identifier&&s.type==="template")));r.forEach(n=>this.#i.set(n.identifier,n.value));let i=r.some(n=>JSON.stringify(e.find(s=>s.identifier===n.identifier)?.value)!==JSON.stringify(n.value));this._context={...this._context,variables:this._context.variables.map(n=>{let s=t.find(a=>a.identifier===n.identifier);return s?{...n,...s,interpolationTable:n.interpolationTable,matchTable:n.matchTable}:n})},this.#n&&i&&this.#f(),this.updateComplete.then(()=>this.#C()),this.isConnected&&this.#b()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#i;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(n=>n.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#b(),xt(this,"qc-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#m()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#p),this.addEventListener("qc-item-set-outcomes",this.#l),this.addEventListener("qti-set-template-value",this.#d),this.addEventListener("qti-set-correct-response",this.#h),this.addEventListener("qti-interaction-response",this.#u)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qc-item-set-outcomes",this.#l),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#h),this.removeEventListener("qti-interaction-response",this.#u)}#a;#c;#p;#l;#d;#h;#u;async#m(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#f()}#f(){this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#v(t,e)}#v(t,e,r){this.#q(e),this.#g(r);let i=+this.getVariable("numAttempts")?.value+(t?1:0),n=this.querySelector("qti-response-processing");if(typeof n?.processResponse=="function"){try{n.processResponse({numAttempts:i})}catch(s){throw this.#y([{identifier:"numAttempts",value:String(i)}]),s}return!0}return xt(this,"qc-item-set-outcomes",{outcomes:[{identifier:"numAttempts",value:String(i)}],responseProcessed:!0}),!1}#g(t){let e=Array.from(this.querySelectorAll("qti-end-attempt-interaction"),r=>r.getAttribute("response-identifier")).filter(r=>r&&r!==t);e.length!==0&&(this._context={...this._context,variables:this._context.variables.map(r=>e.includes(r.identifier)?{...r,value:"false"}:r)})}resetResponses(){this._context=this.#r,this.isConnected&&this.#b()}#b(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),xt(this,"qc-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let r=this._context.variables.find(n=>n.identifier===t&&n.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){this.#y([{identifier:t,value:e}])}#y(t,e){let r=new Map;for(let{identifier:n,value:s}of t){let a=this.getVariable(n);if(!a){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);continue}r.set(n,a.cardinality==="single"||Array.isArray(s)?s:[s])}let i=e!==void 0&&e!==this._context.valid;if(!(r.size===0&&!i)&&(this._context={...this._context,...i?{valid:e}:{},variables:this._context.variables.map(n=>r.has(n.identifier)?{...n,value:r.get(n.identifier)}:n)},r.size>0)){for(let[n,s]of r)xt(this,"qc-item-outcome-changed",{item:this.identifier,outcomeIdentifier:n,value:s});xt(this,"qc-item-outcomes-changed",{item:this.identifier,outcomes:[...r].map(([n,s])=>({identifier:n,value:s}))})}}validate(t=!0){let e=this.#q(t);return this.#w(e),e}#q(t){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}#w(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#C(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}};dr([p({type:String})],mt.prototype,"identifier",void 0);dr([p({type:String})],mt.prototype,"adaptive",void 0);dr([p({type:String,attribute:"time-dependent"})],mt.prototype,"timeDependent",void 0);dr([p({type:String})],mt.prototype,"title",null);dr([p({type:Boolean})],mt.prototype,"disabled",void 0);dr([p({type:Boolean})],mt.prototype,"readonly",void 0);dr([Q({context:F})],mt.prototype,"_context",void 0);var Id=w`
75
+ `]}render(){return v`<slot></slot>`}process(){let t=new vc,e=[...this.children];t.process(e)}},vc=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof jr))throw e}}};var hr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},mt=class extends C{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:xd},this.#r={...this._context,variables:this._context.variables},this.#i=new Map,this.#n=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,r=e.type==="template"?this.#i.get(e.identifier):void 0,i=r!==void 0?{...e,value:r}:e;this._context={...this._context,variables:[...this._context.variables,i]},this.#r=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.#b(r,!0,e)},this.#l=t=>{t.stopImmediatePropagation();let{outcomes:e=[],responseProcessed:r=!1}=t.detail??{},i=[];r&&this.adaptive==="false"&&(e.find(s=>s.identifier==="completionStatus")?.value??this.getVariable("completionStatus")?.value)==="unknown"&&i.push({identifier:"completionStatus",value:"completed"}),this.#y([...e,...i],this.#w(!1)),r&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),r=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||r)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...r?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(n=>!("identifier"in n))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,r=t.filter(n=>n.value!==null&&n.value!==void 0&&(n.type==="template"||e.some(s=>s.identifier===n.identifier&&s.type==="template")));r.forEach(n=>this.#i.set(n.identifier,n.value));let i=r.some(n=>JSON.stringify(e.find(s=>s.identifier===n.identifier)?.value)!==JSON.stringify(n.value));this._context={...this._context,variables:this._context.variables.map(n=>{let s=t.find(a=>a.identifier===n.identifier);return s?{...n,...s,interpolationTable:n.interpolationTable,matchTable:n.matchTable}:n})},this.#n&&i&&this.#f(),this.updateComplete.then(()=>this.#C()),this.isConnected&&this.#v()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#i;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(n=>n.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#v(),wt(this,"qc-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#m()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#p),this.addEventListener("qc-item-set-outcomes",this.#l),this.addEventListener("qti-set-template-value",this.#d),this.addEventListener("qti-set-correct-response",this.#h),this.addEventListener("qti-interaction-response",this.#u)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qc-item-set-outcomes",this.#l),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#h),this.removeEventListener("qti-interaction-response",this.#u)}#a;#c;#p;#l;#d;#h;#u;async#m(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#f()}#f(){this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#b(t,e)}#b(t,e,r){this.#w(e),this.#g(r);let i=+this.getVariable("numAttempts")?.value+(t?1:0),n=this.querySelector("qti-response-processing");if(typeof n?.processResponse=="function"){try{n.processResponse({numAttempts:i})}catch(s){throw this.#y([{identifier:"numAttempts",value:String(i)}]),s}return!0}return wt(this,"qc-item-set-outcomes",{outcomes:[{identifier:"numAttempts",value:String(i)}],responseProcessed:!0}),!1}#g(t){let e=Array.from(this.querySelectorAll("qti-end-attempt-interaction"),r=>r.getAttribute("response-identifier")).filter(r=>r&&r!==t);e.length!==0&&(this._context={...this._context,variables:this._context.variables.map(r=>e.includes(r.identifier)?{...r,value:"false"}:r)})}resetResponses(){this._context=this.#r,this.isConnected&&this.#v()}#v(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),wt(this,"qc-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let r=this._context.variables.find(n=>n.identifier===t&&n.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){this.#y([{identifier:t,value:e}])}#y(t,e){let r=new Map;for(let{identifier:n,value:s}of t){let a=this.getVariable(n);if(!a){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);continue}r.set(n,a.cardinality==="single"||Array.isArray(s)?s:[s])}let i=e!==void 0&&e!==this._context.valid;if(!(r.size===0&&!i)&&(this._context={...this._context,...i?{valid:e}:{},variables:this._context.variables.map(n=>r.has(n.identifier)?{...n,value:r.get(n.identifier)}:n)},r.size>0)){for(let[n,s]of r)wt(this,"qc-item-outcome-changed",{item:this.identifier,outcomeIdentifier:n,value:s});wt(this,"qc-item-outcomes-changed",{item:this.identifier,outcomes:[...r].map(([n,s])=>({identifier:n,value:s}))})}}validate(t=!0){let e=this.#w(t);return this.#x(e),e}#w(t){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}#x(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#C(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}};hr([p({type:String})],mt.prototype,"identifier",void 0);hr([p({type:String})],mt.prototype,"adaptive",void 0);hr([p({type:String,attribute:"time-dependent"})],mt.prototype,"timeDependent",void 0);hr([p({type:String})],mt.prototype,"title",null);hr([p({type:Boolean})],mt.prototype,"disabled",void 0);hr([p({type:Boolean})],mt.prototype,"readonly",void 0);hr([Q({context:F})],mt.prototype,"_context",void 0);var Od=x`
76
76
  :host {
77
77
  display: contents;
78
78
  }
@@ -80,11 +80,11 @@ Make sure to test your application with a production build as repeat registratio
80
80
  ::slotted(qti-catalog-info) {
81
81
  display: none;
82
82
  }
83
- `;var bo=class extends C{static{this.styles=Id}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function _d(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function Rd(o,t,e,r="qti-portable-custom-interaction"){let i=[],n=o.querySelectorAll(r);if(n.length===0)return;let s=null,a=null,c=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let l of Array.from(n)){l.setAttribute("data-base-url",t);let d=l.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,l.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=l.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await c();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of y){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],b=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",b),a&&a.paths&&a.paths[u]){let q=a.paths[u];Array.isArray(q)?x.setAttribute("fallback-path",q[0]):x.setAttribute("fallback-path",q)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let b=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",b),a&&a.paths&&a.paths[x]){let q=a.paths[x];Array.isArray(q)?g.setAttribute("fallback-path",q[0]):g.setAttribute("fallback-path",q)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await c(),s){l.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),l.appendChild(h)):h=l.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=x.map((b,q)=>{let A=u.length>q?u[q]:"";return{primaryPath:b,fallbackPath:A}});for(let b of u)g.some(q=>q.fallbackPath===b)||g.push({primaryPath:x.length>0?x[0]:b,fallbackPath:b});for(let b of g){let q=o.createElement("qti-interaction-module");b.fallbackPath&&q.setAttribute("fallback-path",b.fallbackPath),q.setAttribute("id",f),q.setAttribute("primary-path",b.primaryPath),h&&h.appendChild(q)}}}}}function Md(o,t,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===t||n.localName?.toLowerCase()===t.toLowerCase()).forEach(n=>{let s=`${t}-${e}`,a=Od(n,s);n.replaceWith(a)})}function Pd(o,t){o.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let n=i.slice(`${t}:`.length),s=`${e.nodeName}-${n}`,a=Od(e,s);e.replaceWith(a)}})})}function Od(o,t){let e=o.ownerDocument.createElement(t);for(let r of o.attributes)e.setAttribute(r.name,r.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function Dd(o,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let i of e)o.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}function Te(o,...t){let e=o.childNodes,r=[];for(let i=0;i<e.length;i++){let n=e[i];n.nodeType===1&&t.includes(n.localName??"")&&r.push(n)}return r}var pe=(o,t)=>Te(o,t)[0]??null;function Ot(o,t){let e=o.getAttribute(t)?.trim();if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1}function $d(o,t){let e=o.getAttribute(t)?.trim();return e&&/^[+-]?\d+$/.test(e)?Number(e):void 0}var Lm=Object.freeze({maxAttempts:1,showFeedback:!1,allowReview:!0,showSolution:!1,allowComment:!1,allowSkipping:!0,validateResponses:!1});function Nd(o){if(o.localName!=="qti-assessment-test")throw new TypeError(`Expected a qti-assessment-test element, not ${String(o.localName)}.`);return{identifier:o.getAttribute("identifier")??"",title:o.getAttribute("title")??"",testParts:Te(o,"qti-test-part").map(Vm)}}function Vm(o){let t=gc(Lm,o);return{identifier:o.getAttribute("identifier")??"",navigationMode:o.getAttribute("navigation-mode")==="linear"?"linear":"nonlinear",submissionMode:o.getAttribute("submission-mode")==="simultaneous"?"simultaneous":"individual",sessionControl:t,sections:Te(o,"qti-assessment-section").map(e=>Ld(e,t))}}function Ld(o,t){let e=gc(t,o);return{kind:"section",identifier:o.getAttribute("identifier")??"",title:o.getAttribute("title")??"",visible:Ot(o,"visible")??!0,sessionControl:e,content:Te(o,"qti-assessment-section","qti-assessment-item-ref").map(r=>r.localName==="qti-assessment-section"?Ld(r,e):jm(r,e))}}function jm(o,t){let e=o.getAttribute("category")?.trim();return{kind:"itemRef",identifier:o.getAttribute("identifier")??"",href:o.getAttribute("href")??"",categories:e?e.split(/\s+/):[],sessionControl:gc(t,o),declaredSessionControl:Vd(o)}}function gc(o,t){return{...o,...Vd(t)}}function Vd(o){let t=pe(o,"qti-item-session-control");if(!t)return{};let e={maxAttempts:$d(t,"max-attempts"),showFeedback:Ot(t,"show-feedback"),allowReview:Ot(t,"allow-review"),showSolution:Ot(t,"show-solution"),allowComment:Ot(t,"allow-comment"),allowSkipping:Ot(t,"allow-skipping"),validateResponses:Ot(t,"validate-responses")};return Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))}var jd=o=>o.content.filter(t=>t.kind==="itemRef");function bc(o){return o.flatMap(t=>[t,...bc(t.content.filter(e=>e.kind==="section"))])}function Yi(o){return o.flatMap(t=>t.kind==="itemRef"?[t]:Yi(t.content))}function Fd(o){if(o.localName!=="qti-assessment-item")throw new TypeError(`Expected a qti-assessment-item element, not ${String(o.localName)}.`);let t=Te(o,"qti-response-declaration"),e=Te(o,"qti-outcome-declaration").find(r=>r.getAttribute("identifier")==="SCORE");return{identifier:o.getAttribute("identifier")??"",adaptive:Ot(o,"adaptive")??!1,timeDependent:Ot(o,"time-dependent")??!1,hasCorrectResponse:t.some(Fm),hasResponseProcessing:pe(o,"qti-response-processing")!==null,externalScored:zm(e),label:o.getAttribute("label"),title:o.getAttribute("title")??""}}function Fm(o){if(pe(o,"qti-correct-response"))return!0;let t=pe(o,"qti-mapping");if(t&&pe(t,"qti-map-entry"))return!0;let e=pe(o,"qti-area-mapping");return e!==null&&pe(e,"qti-area-map-entry")!==null}function zm(o){let t=o?.getAttribute("external-scored")?.trim();return t==="human"||t==="externalMachine"?t:null}var vc=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=Um(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=Bm(`${t}`),e}random(){this.#t|=0,this.#t=this.#t+1831565813|0;let t=Math.imul(this.#t^this.#t>>>15,1|this.#t);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}};function Br(o){return vc.fromSeedKey(o)}function Bm(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o.charCodeAt(e),3432918353),t=t<<13|t>>>19;return zd(t)}function Um(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return zd(t)}function zd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var Bd=o=>typeof o=="function"?o():o.random();function Ud(o,t,e){let{select:r,withReplacement:i=!1}=t;if(!Number.isInteger(r)||r<0)throw new RangeError(`qti-selection select="${r}" is not a whole number of zero or more.`);let n=o.flatMap((l,d)=>l.required?[d]:[]);if(r<n.length)throw new RangeError(`qti-selection select="${r}" is less than the ${n.length} required items and subsections.`);if(r>o.length&&(!i||o.length===0))throw new RangeError(`qti-selection select="${r}" is more than the ${o.length} items and subsections, without with-replacement="true".`);let s=o.flatMap((l,d)=>l.required?[]:[d]),a=Math.min(r,o.length)-n.length;if(a<s.length)for(let l=0;l<a;l++){let d=l+Math.floor(Bd(e)*(s.length-l));[s[l],s[d]]=[s[d],s[l]]}let c=new Array(o.length).fill(0);for(let l of[...n,...s.slice(0,a)])c[l]=1;for(let l=o.length;l<r;l++)c[Math.floor(Bd(e)*o.length)]++;return c.flatMap((l,d)=>new Array(l).fill(d))}var Hm=o=>typeof o=="function"?o():o.random();function vo(o,t){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let n=Math.floor(Hm(t)*(i+1));[e[i],e[n]]=[e[n],e[i]]}let r=0;return o.map(i=>i.fixed?i:e[r++])}var Hd=(o,t=1)=>t===1?o:`${o}#${t}`;function Wm(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}function yc(o,t){let e=o.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,n=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let c=a.getAttribute("response-identifier")??`${s}`;s++;let l=Wm(a.tagName.toLowerCase()),d=Array.isArray(l)?l:[l],h=!1,f=0;for(let m of d){if(!m)continue;let y=i?Br(`${t}:${n}:${c}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(q=>q.parentElement!==null);if(x.filter(q=>q.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(q=>q.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=vo(x.map(q=>({element:q,fixed:q.getAttribute("fixed")==="true"})),y);for(let q of x)q.remove();for(let{element:q}of b)u.insertBefore(q,g);h=!0}h&&a.removeAttribute("shuffle")}}function Wd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Qm={"qti-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-choice-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-drawing-interaction":{baseTypes:["file"],cardinalities:["single"]},"qti-end-attempt-interaction":{baseTypes:["boolean"],cardinalities:["single"]},"qti-extended-text-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","multiple","ordered","record"]},"qti-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["multiple"]},"qti-graphic-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-hotspot-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-hottext-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-inline-choice-interaction":{baseTypes:["identifier"],cardinalities:["single"]},"qti-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-media-interaction":{baseTypes:["integer"],cardinalities:["single"]},"qti-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-position-object-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-select-point-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:0}},"qti-slider-interaction":{baseTypes:["integer","float"],cardinalities:["single"]},"qti-text-entry-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","record"]},"qti-upload-interaction":{baseTypes:["file"],cardinalities:["single"]}},Qd=o=>o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o[o.length-1]}`;function Xd(o){let t=new Map(Array.from(o.querySelectorAll("qti-response-declaration"),r=>[r.getAttribute("identifier"),r])),e=[];for(let[r,i]of Object.entries(Qm))for(let n of Array.from(o.querySelectorAll(r))){let s=n.getAttribute("response-identifier"),a=t.get(s);if(!a)continue;let c=`${r} (response "${s}")`,l=a.getAttribute("cardinality"),d=a.getAttribute("base-type");if(l&&!i.cardinalities.includes(l))e.push(`${c}: ${l} cardinality is not permitted; it must be ${Qd(i.cardinalities)}`);else if(l&&i.max&&l!=="multiple"){let h=n.getAttribute(i.max.attribute),f=h===null?i.max.default:Number(h);(f===0||f>1)&&e.push(`${c}: ${i.max.attribute} ${f} requires multiple cardinality, not ${l}`)}l!=="record"&&d&&!i.baseTypes.includes(d)&&e.push(`${c}: base-type ${d} is not permitted; it must be ${Qd(i.baseTypes)}`)}if(e.length>0)throw new Error(`QTI validation error: ${e.join("; ")}.`)}var Gd=!1;function yo(o,t){Gd||(Gd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function Xm(o){return(o.textContent||"").replace(/\s+/g," ").trim().replace(/^This page contains the following errors:\s*/i,"").replace(/\s*Below is a rendering of the page up to the first error\.?\s*$/i,"").trim()||"malformed XML"}function Yd(o,t){let r=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),i=r.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??r.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(i)throw new Error(t(Xm(i)));return r}function Ie(o,t){return fetch(o,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>Yd(e,r=>`is not well-formed XML: ${r}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Ur(o){return Yd(o,t=>`Failed to parse XML: ${t}`)}function Jd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let r=o,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):i=t.createElementNS(r.namespaceURI,r.tagName);for(let n=0;n<r.attributes.length;n++){let s=r.attributes[n];i.setAttribute(s.localName,s.value)}for(let n=0;n<r.childNodes.length;n++)i.appendChild(Jd(r.childNodes[n],t,e));return i}return o.cloneNode(!1)}function Hr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild(Jd(o.childNodes[r],document,t));return e}function Wr(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let n=r.getAttribute(i)?.trim();if(n&&!/^(data:|https?:|blob:)/.test(n)){let s=t+encodeURI(n);r.setAttribute(i,s)}}})}var Jt=()=>{let o,t="",e={load(r,i){return t=r,Ie(r,i).then(n=>(o=n,e))},parse(r){return o=Ur(r),t="",e},path:r=>(Wr(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return Dd(o,r),e},async configurePci(r,i,n="qti-portable-custom-interaction"){return await Rd(o,r,i,n),e},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-item-seed";return yo("qtiTransformItem",n),yc(o,n),e}return yc(o,i),e},extendElementName:(r,i)=>(Md(o,r,i),e),extendElementsWithClass:(r="extend")=>(Pd(o,r),e),customInteraction(r,i){let n=o.querySelector("qti-custom-interaction"),s=n.querySelector("object");return n.setAttribute("data-base-ref",r),n.setAttribute("data-base-item",r+i),n.setAttribute("data",s.getAttribute("data")),n.setAttribute("width",s.getAttribute("width")),n.setAttribute("height",s.getAttribute("height")),n.removeChild(s),e},convertCDATAtoComment(){return _d(o),e},stripStyleSheets(){return Wd(o),e},validateBindings(){return Xd(o),e},html(){return t!==null&&Wr(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Hr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&Wr(o,t.substring(0,t.lastIndexOf("/"))),Hr(o,r)},xmlDoc(){return o}};return e};var Kd=()=>{let o,t={async load(e,r){return o=await Ie(e,r),t},parse(e){o=Ur(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Zd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:i,category:n})}),t}var Ji="qti-assessment-section-ref",th="qti-assessment-section",eh="qti-assessment-item-ref",Gm=["src","href","srcset","poster"],qc=/^(data:|https?:|blob:)/,xc=(o,t)=>o.localName===t||o.localName?.toLowerCase()===t,rh=o=>Array.from(o.getElementsByTagName("*")).filter(t=>xc(t,Ji)),Ym=o=>o.slice(0,o.lastIndexOf("/")+1),Jm=o=>new URL(o,"https://base.invalid/").href;function Km(o,t){if(t)for(let e of[o,...Array.from(o.getElementsByTagName("*"))])for(let r of Gm){let i=e.getAttribute(r)?.trim();i&&!qc.test(i)&&e.setAttribute(r,t+i)}}async function ih(o,t,e){if(!wc(o))return;await nh(o,t,e,[]);let r=new Set;for(let i of Array.from(o.getElementsByTagName("*")).filter(n=>xc(n,eh))){let n=i.getAttribute("identifier")??"";if(r.has(n))throw new Error(`The test repeats ${eh} "${n}" once its ${Ji}s are included; item-ref identifiers must be unique.`);r.add(n)}}async function nh(o,t,e,r){let i=t.endsWith("/")?t:`${t}/`;for(let n of rh(o)){let s=n.getAttribute("href")?.trim();if(!s)throw new Error(`${Ji} "${n.getAttribute("identifier")}" has no href.`);let a=qc.test(s)?s:i+encodeURI(s),c=Jm(a);if(r.includes(c))throw new Error(`${Ji} "${s}" refers back to itself.`);let l=await Ie(a,e),d=l?.documentElement;if(!d||!xc(d,th))throw new Error(`${Ji} "${s}" does not hold a single ${th}.`);await nh(l,a.slice(0,a.lastIndexOf("/")+1),e,[...r,c]),qc.test(s)||Km(d,Ym(s));let h=n.getAttribute("identifier");h&&d.setAttribute("identifier",h),n.replaceWith(o.importNode(d,!0))}}var wc=o=>rh(o).length>0;var Ki=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Qr=o=>Ki(o,"qti-assessment-item-ref","assessmentitemref"),Dt=o=>Ki(o,"qti-assessment-section","assessmentsection"),_e=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),Cc=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),qo=o=>Ki(o,"qti-ordering","ordering"),Zi=o=>Ki(o,"qti-selection","selection"),xo=o=>Ki(o,"qti-item-session-control","itemsessioncontrol"),tn=o=>Array.from(o.children).filter(t=>Qr(t)||Dt(t));var oh=o=>o.children.length===0&&Array.from(o.attributes).every(t=>t.name==="select"||t.name==="with-replacement"||t.name==="xmlns"||t.name.startsWith("xmlns:")),Zm=o=>Array.from(o.children).find(t=>Zi(t)&&oh(t));function tf(o,t){for(let e of[o,...Array.from(o.getElementsByTagName("*"))]){if(!Qr(e)&&!Dt(e))continue;let r=e.getAttribute("identifier")??"",i=(t.get(r)??1)+1;t.set(r,i),e.setAttribute("identifier",Hd(r,i))}}function sh(o,t,e){let r=Zm(o);if(r){let i=o.getAttribute("identifier")??"",n=tn(o),s;try{s=Ud(n.map(d=>({required:_e(d,"required")})),{select:Number(r.getAttribute("select")??Number.NaN),withReplacement:_e(r,"with-replacement")},Br(`${t}:select:${i}`))}catch(d){throw new RangeError(`[qtiTransformTest] Section "${i}": ${d.message}`)}let a=new Set(s);for(let[d,h]of n.entries())a.has(d)||h.remove();let c=null,l=null;for(let d of s){if(d!==c)l=n[d];else{let h=n[d].cloneNode(!0);tf(h,e),l.after(h),l=h}c=d}r.remove()}for(let i of tn(o))Dt(i)&&sh(i,t,e)}function ah(o){return Array.from(o.getElementsByTagName("*")).some(t=>Zi(t)&&oh(t))}function ch(o,t){let e=new Map,r=Array.from(o.getElementsByTagName("*")).filter(i=>Dt(i)&&!(i.parentElement&&Dt(i.parentElement)));for(let i of r)sh(i,t,e)}var lh=o=>o.children.length===0&&Array.from(o.attributes).every(t=>t.name==="shuffle"||t.name==="xmlns"||t.name.startsWith("xmlns:")),ef=o=>Array.from(o.children).filter(t=>qo(t)&&lh(t)&&_e(t,"shuffle")),rf=(o,t)=>Br(`${o}:${t}`),nf=o=>Cc(o,"visible")&&Cc(o,"keep-together","keeptogether");function of(o,t){if(!t)return;let e=Array.from(o.children).find(xo);e||(e=o.ownerDocument.createElementNS(t.namespaceURI,t.tagName),o.insertBefore(e,o.firstChild));for(let r of Array.from(t.attributes))e.hasAttribute(r.name)||e.setAttribute(r.name,r.value)}function sf(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" (visible="false", keep-together="false") is merged into its parent by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function dh(o){if(Qr(o))return[{node:o,fixed:_e(o,"fixed")}];if(!nf(o))return[{node:o,fixed:_e(o,"fixed")}];let t=Array.from(o.children).find(xo),e=[],r=[];for(let i of Array.from(o.children))Qr(i)||Dt(i)?(of(i,t),r.push(...dh(i))):!qo(i)&&!Zi(i)&&!xo(i)&&e.push(i.localName);return sf(o,e),r}function hh(o,t){for(let c of Array.from(o.children))Dt(c)&&hh(c,t);let e=ef(o);if(e.length===0)return;let r=tn(o),i=r.flatMap(dh),n=r.length>0?r[r.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=vo(i,rf(t,s));for(let c of r)c.remove();for(let c of a)o.insertBefore(c.node,n);for(let c of e)c.remove()}function ph(o){return Array.from(o.getElementsByTagName("*")).some(t=>qo(t)&&lh(t)&&_e(t,"shuffle"))}function uh(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Dt(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&Dt(i)||hh(r,t)}}var Xr=()=>{let o,t="",e=i=>{let n=typeof i=="string"?i.trim():i;if(n!=null&&n!=="")return n;let s=t||"default-test-seed";return yo("qtiTransformTest",s),s},r={async load(i,n){o=await Ie(i,n),t=i;let s=i.substring(0,i.lastIndexOf("/"));return await ih(o,s,n),r.path(s),r},parse(i){return o=Ur(i),t="",wc(o)&&console.warn("[qtiTransformTest] qti-assessment-section-ref needs the test's location: load() the test by URL to include referenced sections."),r},path:i=>(Wr(o,i),r),fn(i){return i(o),r},applySelection(i){return ah(o)&&ch(o,e(i)),r},shuffleOrdering(i){return ph(o)&&uh(o,e(i)),r},items(){return Zd(o)},html(){return new XMLSerializer().serializeToString(Hr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(i){return Hr(o,i)},xmlDoc(){return o}};return r};var mh=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},kc=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},Gr=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new kc(this,t);this.dispatchEvent(e);let r=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(t){let r=(await Jt().load(this.href).then(i=>i.htmlDoc()))?.querySelector("qti-assessment-stimulus");r&&(t.innerHTML="",t.append(r))}};mh([p({type:String})],Gr.prototype,"identifier",void 0);mh([p({type:String})],Gr.prototype,"href",void 0);var wo=class extends C{};var af=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},en=class extends C{render(){return v`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let n=i;n.mathVariable!==!0||n.value===null||n.value===void 0||t.set(n.identifier,this.#e(n.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let n=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(n);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",n);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",n),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};af([_({context:F,subscribe:!0}),I()],en.prototype,"context",void 0);var fh=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Yr=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[w`
83
+ `;var yo=class extends C{static{this.styles=Od}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function Dd(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function $d(o,t,e,r="qti-portable-custom-interaction"){let i=[],n=o.querySelectorAll(r);if(n.length===0)return;let s=null,a=null,c=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let l of Array.from(n)){l.setAttribute("data-base-url",t);let d=l.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,l.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=l.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await c();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let w of y){let u=w.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],b=Array.isArray(g)?g[0]:g;if(w.setAttribute("primary-path",b),a&&a.paths&&a.paths[u]){let q=a.paths[u];Array.isArray(q)?w.setAttribute("fallback-path",q[0]):w.setAttribute("fallback-path",q)}}}if(m.paths){for(let w in m.paths)if(!h.querySelector(`qti-interaction-module[id="${w}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",w);let b=Array.isArray(m.paths[w])?m.paths[w][0]:m.paths[w];if(g.setAttribute("primary-path",b),a&&a.paths&&a.paths[w]){let q=a.paths[w];Array.isArray(q)?g.setAttribute("fallback-path",q[0]):g.setAttribute("fallback-path",q)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await c(),s){l.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),l.appendChild(h)):h=l.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let w=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=w.map((b,q)=>{let A=u.length>q?u[q]:"";return{primaryPath:b,fallbackPath:A}});for(let b of u)g.some(q=>q.fallbackPath===b)||g.push({primaryPath:w.length>0?w[0]:b,fallbackPath:b});for(let b of g){let q=o.createElement("qti-interaction-module");b.fallbackPath&&q.setAttribute("fallback-path",b.fallbackPath),q.setAttribute("id",f),q.setAttribute("primary-path",b.primaryPath),h&&h.appendChild(q)}}}}}function Nd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===t||n.localName?.toLowerCase()===t.toLowerCase()).forEach(n=>{let s=`${t}-${e}`,a=Vd(n,s);n.replaceWith(a)})}function Ld(o,t){o.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let n=i.slice(`${t}:`.length),s=`${e.nodeName}-${n}`,a=Vd(e,s);e.replaceWith(a)}})})}function Vd(o,t){let e=o.ownerDocument.createElement(t);for(let r of o.attributes)e.setAttribute(r.name,r.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function jd(o,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let i of e)o.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}function Te(o,...t){let e=o.childNodes,r=[];for(let i=0;i<e.length;i++){let n=e[i];n.nodeType===1&&t.includes(n.localName??"")&&r.push(n)}return r}var ue=(o,t)=>Te(o,t)[0]??null;function Ot(o,t){let e=o.getAttribute(t)?.trim();if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1}function Fd(o,t){let e=o.getAttribute(t)?.trim();return e&&/^[+-]?\d+$/.test(e)?Number(e):void 0}var Gm=Object.freeze({maxAttempts:1,showFeedback:!1,allowReview:!0,showSolution:!1,allowComment:!1,allowSkipping:!0,validateResponses:!1});function zd(o){if(o.localName!=="qti-assessment-test")throw new TypeError(`Expected a qti-assessment-test element, not ${String(o.localName)}.`);return{identifier:o.getAttribute("identifier")??"",title:o.getAttribute("title")??"",testParts:Te(o,"qti-test-part").map(Ym)}}function Ym(o){let t=yc(Gm,o);return{identifier:o.getAttribute("identifier")??"",navigationMode:o.getAttribute("navigation-mode")==="linear"?"linear":"nonlinear",submissionMode:o.getAttribute("submission-mode")==="simultaneous"?"simultaneous":"individual",sessionControl:t,sections:Te(o,"qti-assessment-section").map(e=>Bd(e,t))}}function Bd(o,t){let e=yc(t,o);return{kind:"section",identifier:o.getAttribute("identifier")??"",title:o.getAttribute("title")??"",visible:Ot(o,"visible")??!0,sessionControl:e,content:Te(o,"qti-assessment-section","qti-assessment-item-ref").map(r=>r.localName==="qti-assessment-section"?Bd(r,e):Jm(r,e))}}function Jm(o,t){let e=o.getAttribute("category")?.trim();return{kind:"itemRef",identifier:o.getAttribute("identifier")??"",href:o.getAttribute("href")??"",categories:e?e.split(/\s+/):[],sessionControl:yc(t,o),declaredSessionControl:Ud(o)}}function yc(o,t){return{...o,...Ud(t)}}function Ud(o){let t=ue(o,"qti-item-session-control");if(!t)return{};let e={maxAttempts:Fd(t,"max-attempts"),showFeedback:Ot(t,"show-feedback"),allowReview:Ot(t,"allow-review"),showSolution:Ot(t,"show-solution"),allowComment:Ot(t,"allow-comment"),allowSkipping:Ot(t,"allow-skipping"),validateResponses:Ot(t,"validate-responses")};return Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))}var Hd=o=>o.content.filter(t=>t.kind==="itemRef");function qc(o){return o.flatMap(t=>[t,...qc(t.content.filter(e=>e.kind==="section"))])}function pr(o){return o.flatMap(t=>t.kind==="itemRef"?[t]:pr(t.content))}function Wd(o){if(o.localName!=="qti-assessment-item")throw new TypeError(`Expected a qti-assessment-item element, not ${String(o.localName)}.`);let t=Te(o,"qti-response-declaration"),e=Te(o,"qti-outcome-declaration").find(r=>r.getAttribute("identifier")==="SCORE");return{identifier:o.getAttribute("identifier")??"",adaptive:Ot(o,"adaptive")??!1,timeDependent:Ot(o,"time-dependent")??!1,hasCorrectResponse:t.some(Km),hasResponseProcessing:ue(o,"qti-response-processing")!==null,externalScored:Zm(e),label:o.getAttribute("label"),title:o.getAttribute("title")??""}}function Km(o){if(ue(o,"qti-correct-response"))return!0;let t=ue(o,"qti-mapping");if(t&&ue(t,"qti-map-entry"))return!0;let e=ue(o,"qti-area-mapping");return e!==null&&ue(e,"qti-area-map-entry")!==null}function Zm(o){let t=o?.getAttribute("external-scored")?.trim();return t==="human"||t==="externalMachine"?t:null}var tf={initial:{beginAttempt:[{to:"interacting",when:["attemptsLeft"]}],endItemSession:"closed"},interacting:{endAttempt:[{to:"closed",when:["individualSubmission"],unless:["attemptsLeft"]},{to:"modalFeedback",when:["individualSubmission","attemptsLeft","modalFeedback"]},{to:"interacting",when:["individualSubmission","attemptsLeft"]}],endCandidateSession:"suspended",endItemSession:"closed"},modalFeedback:{beginAttempt:[{to:"interacting",when:["attemptsLeft"]}],endCandidateSession:"suspended",endItemSession:"closed"},suspended:{beginCandidateSession:[{to:"interacting",when:["mayResume"]}],endItemSession:"closed"},closed:{beginReview:[{to:"review",when:["allowReview"]}],beginSolution:[{to:"solution",when:["showSolution"]}]},review:{endReview:"closed"},solution:{endSolution:"closed"}};function Jt(o,t,e){let r=tf[o][t];return r===void 0?null:typeof r=="string"?r:r.find(({when:n=[],unless:s=[]})=>n.every(a=>e[a])&&!s.some(a=>e[a]))?.to??null}function Qd({sessionControl:{maxAttempts:o},adaptive:t,numAttempts:e,completionStatus:r}){return t?r!=="completed":o===0||e<o}function qo(o){return{attemptsLeft:Qd(o),individualSubmission:o.submissionMode==="individual",modalFeedback:o.modalFeedback,mayResume:o.navigationMode==="nonlinear"||!o.left,allowReview:o.sessionControl.allowReview,showSolution:o.sessionControl.showSolution}}function Ki(o){return!Qd(o)||o.passed?"closed":o.presented?"interacting":o.numAttempts===0?"initial":"suspended"}function Xd(o){let{state:t,sessionControl:e,adaptive:r}=o,i=qo(o),n=i.individualSubmission,s=!n||e.allowSkipping||!o.skipped,a=s&&(!n||!e.validateResponses||o.valid);return{attemptsLeft:i.attemptsLeft,attemptsUsed:!i.attemptsLeft,interactive:t==="interacting",done:t==="closed"||t==="review"||t==="solution",mayEndAttempt:a&&Jt(t,"endAttempt",i)!==null,maySubmit:a,maySkip:s,mayShowFeedback:i.attemptsLeft||e.showFeedback||t==="review"&&r&&e.allowReview,mayBeginReview:Jt(t,"beginReview",i)!==null,mayBeginSolution:Jt(t,"beginSolution",i)!==null}}var Gd=o=>qo({...o,left:o.passed,modalFeedback:!1}),ef=["closed","review","solution"];function wc(o,t){let{numAttempts:e}=t;if(!o||o.numAttempts!==e)return{state:Ki(t),numAttempts:e};let r=Gd(t),i=o.state;return t.passed?ef.includes(i)||(i=Jt(i,"endItemSession",r)??i):t.presented?i==="initial"?i=Jt(i,"beginAttempt",r)??i:i==="suspended"&&(i=Jt(i,"beginCandidateSession",r)??i):(i==="interacting"||i==="modalFeedback")&&(i=Jt(i,"endCandidateSession",r)??i),{state:i,numAttempts:e}}function Yd(o,t){let{numAttempts:e}=t;return o?.state!=="interacting"?{state:Ki({...t,presented:!0}),numAttempts:e}:{state:Jt("interacting","endAttempt",Gd(t))??"interacting",numAttempts:e}}var xc=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=nf(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=rf(`${t}`),e}random(){this.#t|=0,this.#t=this.#t+1831565813|0;let t=Math.imul(this.#t^this.#t>>>15,1|this.#t);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}};function Hr(o){return xc.fromSeedKey(o)}function rf(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o.charCodeAt(e),3432918353),t=t<<13|t>>>19;return Jd(t)}function nf(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return Jd(t)}function Jd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var Kd=o=>typeof o=="function"?o():o.random();function Zd(o,t,e){let{select:r,withReplacement:i=!1}=t;if(!Number.isInteger(r)||r<0)throw new RangeError(`qti-selection select="${r}" is not a whole number of zero or more.`);let n=o.flatMap((l,d)=>l.required?[d]:[]);if(r<n.length)throw new RangeError(`qti-selection select="${r}" is less than the ${n.length} required items and subsections.`);if(r>o.length&&(!i||o.length===0))throw new RangeError(`qti-selection select="${r}" is more than the ${o.length} items and subsections, without with-replacement="true".`);let s=o.flatMap((l,d)=>l.required?[]:[d]),a=Math.min(r,o.length)-n.length;if(a<s.length)for(let l=0;l<a;l++){let d=l+Math.floor(Kd(e)*(s.length-l));[s[l],s[d]]=[s[d],s[l]]}let c=new Array(o.length).fill(0);for(let l of[...n,...s.slice(0,a)])c[l]=1;for(let l=o.length;l<r;l++)c[Math.floor(Kd(e)*o.length)]++;return c.flatMap((l,d)=>new Array(l).fill(d))}var of=o=>typeof o=="function"?o():o.random();function wo(o,t){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let n=Math.floor(of(t)*(i+1));[e[i],e[n]]=[e[n],e[i]]}let r=0;return o.map(i=>i.fixed?i:e[r++])}var th=(o,t=1)=>t===1?o:`${o}#${t}`;function sf(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}function Cc(o,t){let e=o.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,n=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let c=a.getAttribute("response-identifier")??`${s}`;s++;let l=sf(a.tagName.toLowerCase()),d=Array.isArray(l)?l:[l],h=!1,f=0;for(let m of d){if(!m)continue;let y=i?Hr(`${t}:${n}:${c}:${f}`):Math.random;f++;let w=Array.from(a.querySelectorAll(m)).filter(q=>q.parentElement!==null);if(w.filter(q=>q.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=w[0].parentElement;if(!u||w.some(q=>q.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=w[w.length-1].nextSibling,b=wo(w.map(q=>({element:q,fixed:q.getAttribute("fixed")==="true"})),y);for(let q of w)q.remove();for(let{element:q}of b)u.insertBefore(q,g);h=!0}h&&a.removeAttribute("shuffle")}}function eh(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var af={"qti-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-choice-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-drawing-interaction":{baseTypes:["file"],cardinalities:["single"]},"qti-end-attempt-interaction":{baseTypes:["boolean"],cardinalities:["single"]},"qti-extended-text-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","multiple","ordered","record"]},"qti-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["multiple"]},"qti-graphic-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-hotspot-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-hottext-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-inline-choice-interaction":{baseTypes:["identifier"],cardinalities:["single"]},"qti-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-media-interaction":{baseTypes:["integer"],cardinalities:["single"]},"qti-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-position-object-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-select-point-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:0}},"qti-slider-interaction":{baseTypes:["integer","float"],cardinalities:["single"]},"qti-text-entry-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","record"]},"qti-upload-interaction":{baseTypes:["file"],cardinalities:["single"]}},rh=o=>o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o[o.length-1]}`;function ih(o){let t=new Map(Array.from(o.querySelectorAll("qti-response-declaration"),r=>[r.getAttribute("identifier"),r])),e=[];for(let[r,i]of Object.entries(af))for(let n of Array.from(o.querySelectorAll(r))){let s=n.getAttribute("response-identifier"),a=t.get(s);if(!a)continue;let c=`${r} (response "${s}")`,l=a.getAttribute("cardinality"),d=a.getAttribute("base-type");if(l&&!i.cardinalities.includes(l))e.push(`${c}: ${l} cardinality is not permitted; it must be ${rh(i.cardinalities)}`);else if(l&&i.max&&l!=="multiple"){let h=n.getAttribute(i.max.attribute),f=h===null?i.max.default:Number(h);(f===0||f>1)&&e.push(`${c}: ${i.max.attribute} ${f} requires multiple cardinality, not ${l}`)}l!=="record"&&d&&!i.baseTypes.includes(d)&&e.push(`${c}: base-type ${d} is not permitted; it must be ${rh(i.baseTypes)}`)}if(e.length>0)throw new Error(`QTI validation error: ${e.join("; ")}.`)}var nh=!1;function xo(o,t){nh||(nh=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function cf(o){return(o.textContent||"").replace(/\s+/g," ").trim().replace(/^This page contains the following errors:\s*/i,"").replace(/\s*Below is a rendering of the page up to the first error\.?\s*$/i,"").trim()||"malformed XML"}function oh(o,t){let r=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),i=r.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??r.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(i)throw new Error(t(cf(i)));return r}function Re(o,t){return fetch(o,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>oh(e,r=>`is not well-formed XML: ${r}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Wr(o){return oh(o,t=>`Failed to parse XML: ${t}`)}function sh(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let r=o,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):i=t.createElementNS(r.namespaceURI,r.tagName);for(let n=0;n<r.attributes.length;n++){let s=r.attributes[n];i.setAttribute(s.localName,s.value)}for(let n=0;n<r.childNodes.length;n++)i.appendChild(sh(r.childNodes[n],t,e));return i}return o.cloneNode(!1)}function Qr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild(sh(o.childNodes[r],document,t));return e}function Xr(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let n=r.getAttribute(i)?.trim();if(n&&!/^(data:|https?:|blob:)/.test(n)){let s=t+encodeURI(n);r.setAttribute(i,s)}}})}var Kt=()=>{let o,t="",e={load(r,i){return t=r,Re(r,i).then(n=>(o=n,e))},parse(r){return o=Wr(r),t="",e},path:r=>(Xr(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return jd(o,r),e},async configurePci(r,i,n="qti-portable-custom-interaction"){return await $d(o,r,i,n),e},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-item-seed";return xo("qtiTransformItem",n),Cc(o,n),e}return Cc(o,i),e},extendElementName:(r,i)=>(Nd(o,r,i),e),extendElementsWithClass:(r="extend")=>(Ld(o,r),e),customInteraction(r,i){let n=o.querySelector("qti-custom-interaction"),s=n.querySelector("object");return n.setAttribute("data-base-ref",r),n.setAttribute("data-base-item",r+i),n.setAttribute("data",s.getAttribute("data")),n.setAttribute("width",s.getAttribute("width")),n.setAttribute("height",s.getAttribute("height")),n.removeChild(s),e},convertCDATAtoComment(){return Dd(o),e},stripStyleSheets(){return eh(o),e},validateBindings(){return ih(o),e},html(){return t!==null&&Xr(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Qr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&Xr(o,t.substring(0,t.lastIndexOf("/"))),Qr(o,r)},xmlDoc(){return o}};return e};var ah=()=>{let o,t={async load(e,r){return o=await Re(e,r),t},parse(e){o=Wr(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function ch(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:i,category:n})}),t}var Zi="qti-assessment-section-ref",lh="qti-assessment-section",dh="qti-assessment-item-ref",lf=["src","href","srcset","poster"],kc=/^(data:|https?:|blob:)/,Ec=(o,t)=>o.localName===t||o.localName?.toLowerCase()===t,hh=o=>Array.from(o.getElementsByTagName("*")).filter(t=>Ec(t,Zi)),df=o=>o.slice(0,o.lastIndexOf("/")+1),hf=o=>new URL(o,"https://base.invalid/").href;function pf(o,t){if(t)for(let e of[o,...Array.from(o.getElementsByTagName("*"))])for(let r of lf){let i=e.getAttribute(r)?.trim();i&&!kc.test(i)&&e.setAttribute(r,t+i)}}async function ph(o,t,e){if(!Sc(o))return;await uh(o,t,e,[]);let r=new Set;for(let i of Array.from(o.getElementsByTagName("*")).filter(n=>Ec(n,dh))){let n=i.getAttribute("identifier")??"";if(r.has(n))throw new Error(`The test repeats ${dh} "${n}" once its ${Zi}s are included; item-ref identifiers must be unique.`);r.add(n)}}async function uh(o,t,e,r){let i=t.endsWith("/")?t:`${t}/`;for(let n of hh(o)){let s=n.getAttribute("href")?.trim();if(!s)throw new Error(`${Zi} "${n.getAttribute("identifier")}" has no href.`);let a=kc.test(s)?s:i+encodeURI(s),c=hf(a);if(r.includes(c))throw new Error(`${Zi} "${s}" refers back to itself.`);let l=await Re(a,e),d=l?.documentElement;if(!d||!Ec(d,lh))throw new Error(`${Zi} "${s}" does not hold a single ${lh}.`);await uh(l,a.slice(0,a.lastIndexOf("/")+1),e,[...r,c]),kc.test(s)||pf(d,df(s));let h=n.getAttribute("identifier");h&&d.setAttribute("identifier",h),n.replaceWith(o.importNode(d,!0))}}var Sc=o=>hh(o).length>0;var tn=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Gr=o=>tn(o,"qti-assessment-item-ref","assessmentitemref"),Dt=o=>tn(o,"qti-assessment-section","assessmentsection"),_e=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),Ac=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),Co=o=>tn(o,"qti-ordering","ordering"),en=o=>tn(o,"qti-selection","selection"),ko=o=>tn(o,"qti-item-session-control","itemsessioncontrol"),rn=o=>Array.from(o.children).filter(t=>Gr(t)||Dt(t));var mh=o=>o.children.length===0&&Array.from(o.attributes).every(t=>t.name==="select"||t.name==="with-replacement"||t.name==="xmlns"||t.name.startsWith("xmlns:")),uf=o=>Array.from(o.children).find(t=>en(t)&&mh(t));function mf(o,t){for(let e of[o,...Array.from(o.getElementsByTagName("*"))]){if(!Gr(e)&&!Dt(e))continue;let r=e.getAttribute("identifier")??"",i=(t.get(r)??1)+1;t.set(r,i),e.setAttribute("identifier",th(r,i))}}function fh(o,t,e){let r=uf(o);if(r){let i=o.getAttribute("identifier")??"",n=rn(o),s;try{s=Zd(n.map(d=>({required:_e(d,"required")})),{select:Number(r.getAttribute("select")??Number.NaN),withReplacement:_e(r,"with-replacement")},Hr(`${t}:select:${i}`))}catch(d){throw new RangeError(`[qtiTransformTest] Section "${i}": ${d.message}`)}let a=new Set(s);for(let[d,h]of n.entries())a.has(d)||h.remove();let c=null,l=null;for(let d of s){if(d!==c)l=n[d];else{let h=n[d].cloneNode(!0);mf(h,e),l.after(h),l=h}c=d}r.remove()}for(let i of rn(o))Dt(i)&&fh(i,t,e)}function gh(o){return Array.from(o.getElementsByTagName("*")).some(t=>en(t)&&mh(t))}function bh(o,t){let e=new Map,r=Array.from(o.getElementsByTagName("*")).filter(i=>Dt(i)&&!(i.parentElement&&Dt(i.parentElement)));for(let i of r)fh(i,t,e)}var vh=o=>o.children.length===0&&Array.from(o.attributes).every(t=>t.name==="shuffle"||t.name==="xmlns"||t.name.startsWith("xmlns:")),ff=o=>Array.from(o.children).filter(t=>Co(t)&&vh(t)&&_e(t,"shuffle")),gf=(o,t)=>Hr(`${o}:${t}`),bf=o=>Ac(o,"visible")&&Ac(o,"keep-together","keeptogether");function vf(o,t){if(!t)return;let e=Array.from(o.children).find(ko);e||(e=o.ownerDocument.createElementNS(t.namespaceURI,t.tagName),o.insertBefore(e,o.firstChild));for(let r of Array.from(t.attributes))e.hasAttribute(r.name)||e.setAttribute(r.name,r.value)}function yf(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" (visible="false", keep-together="false") is merged into its parent by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function yh(o){if(Gr(o))return[{node:o,fixed:_e(o,"fixed")}];if(!bf(o))return[{node:o,fixed:_e(o,"fixed")}];let t=Array.from(o.children).find(ko),e=[],r=[];for(let i of Array.from(o.children))Gr(i)||Dt(i)?(vf(i,t),r.push(...yh(i))):!Co(i)&&!en(i)&&!ko(i)&&e.push(i.localName);return yf(o,e),r}function qh(o,t){for(let c of Array.from(o.children))Dt(c)&&qh(c,t);let e=ff(o);if(e.length===0)return;let r=rn(o),i=r.flatMap(yh),n=r.length>0?r[r.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=wo(i,gf(t,s));for(let c of r)c.remove();for(let c of a)o.insertBefore(c.node,n);for(let c of e)c.remove()}function wh(o){return Array.from(o.getElementsByTagName("*")).some(t=>Co(t)&&vh(t)&&_e(t,"shuffle"))}function xh(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Dt(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&Dt(i)||qh(r,t)}}var Yr=()=>{let o,t="",e=i=>{let n=typeof i=="string"?i.trim():i;if(n!=null&&n!=="")return n;let s=t||"default-test-seed";return xo("qtiTransformTest",s),s},r={async load(i,n){o=await Re(i,n),t=i;let s=i.substring(0,i.lastIndexOf("/"));return await ph(o,s,n),r.path(s),r},parse(i){return o=Wr(i),t="",Sc(o)&&console.warn("[qtiTransformTest] qti-assessment-section-ref needs the test's location: load() the test by URL to include referenced sections."),r},path:i=>(Xr(o,i),r),fn(i){return i(o),r},applySelection(i){return gh(o)&&bh(o,e(i)),r},shuffleOrdering(i){return wh(o)&&xh(o,e(i)),r},items(){return ch(o)},html(){return new XMLSerializer().serializeToString(Qr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(i){return Qr(o,i)},xmlDoc(){return o}};return r};var Ch=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ic=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},Jr=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new Ic(this,t);this.dispatchEvent(e);let r=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(t){let r=(await Kt().load(this.href).then(i=>i.htmlDoc()))?.querySelector("qti-assessment-stimulus");r&&(t.innerHTML="",t.append(r))}};Ch([p({type:String})],Jr.prototype,"identifier",void 0);Ch([p({type:String})],Jr.prototype,"href",void 0);var Eo=class extends C{};var qf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},nn=class extends C{render(){return v`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let n=i;n.mathVariable!==!0||n.value===null||n.value===void 0||t.set(n.identifier,this.#e(n.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let n=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(n);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",n);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",n),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};qf([R({context:F,subscribe:!0}),T()],nn.prototype,"context",void 0);var kh=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Kr=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[x`
84
84
  :host {
85
85
  display: none;
86
86
  }
87
- `]}render(){return v`<slot></slot>`}};fh([p({type:String})],Yr.prototype,"identifier",void 0);fh([p({type:String})],Yr.prototype,"cardinality",void 0);var cf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},rn=class extends C{#t;render(){return v`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.#t=new Function("context","fn","item",t?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t=this.getAttribute("definition");if(t)return this.#e(t);let e={variable:i=>this._context?.variables.find(n=>n.identifier===i)?.value??"",correct:i=>this._context?.variables.find(n=>n.identifier===i)?.correctResponse??""},r={getVariable:i=>this._context?.variables.find(n=>n.identifier===i),updateOutcomeVariable:(i,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:n}}))}};return this.#t(this._context,e,r)}#e(t){let e=wd(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let r=Array.from(this.children).map(i=>{let n=i.calculate;return typeof n=="function"?n.call(i):null});return e(r)}};cf([_({context:F,subscribe:!0}),I()],rn.prototype,"_context",void 0);function ue(o,t,e,r){let i=o.closest("qti-assessment-item")?.getAttribute("identifier")??void 0,n={kind:e,identifier:r,outcomeIdentifier:o.outcomeIdentifier,element:o,...i?{itemIdentifier:i}:{}};return xt(o,t,n,!0)}var Co=class extends ut{static{this.styles=w`
87
+ `]}render(){return v`<slot></slot>`}};kh([p({type:String})],Kr.prototype,"identifier",void 0);kh([p({type:String})],Kr.prototype,"cardinality",void 0);var wf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},on=class extends C{#t;render(){return v`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.#t=new Function("context","fn","item",t?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t=this.getAttribute("definition");if(t)return this.#e(t);let e={variable:i=>this._context?.variables.find(n=>n.identifier===i)?.value??"",correct:i=>this._context?.variables.find(n=>n.identifier===i)?.correctResponse??""},r={getVariable:i=>this._context?.variables.find(n=>n.identifier===i),updateOutcomeVariable:(i,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:n}}))}};return this.#t(this._context,e,r)}#e(t){let e=Ad(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let r=Array.from(this.children).map(i=>{let n=i.calculate;return typeof n=="function"?n.call(i):null});return e(r)}};wf([R({context:F,subscribe:!0}),T()],on.prototype,"_context",void 0);function me(o,t,e,r){let i=o.closest("qti-assessment-item")?.getAttribute("identifier")??void 0,n={kind:e,identifier:r,outcomeIdentifier:o.outcomeIdentifier,element:o,...i?{itemIdentifier:i}:{}};return wt(o,t,n,!0)}var So=class extends ut{static{this.styles=x`
88
88
  :host {
89
89
  display: block;
90
90
  }
@@ -94,18 +94,18 @@ Make sure to test your application with a production build as repeat registratio
94
94
  .off {
95
95
  display: none;
96
96
  }
97
- `}render(){return v` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}feedbackShowing(){return ue(this,"qc-feedback-show","block",this.identifier)}feedbackHiding(){return ue(this,"qc-feedback-hide","block",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Ct=o=>o??P;var ko=class extends ut{constructor(){super(...arguments),this.render=()=>v` <slot part="feedback" class="${Ct(this.showStatus)}"></slot> `}static{this.styles=w`
97
+ `}render(){return v` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}feedbackShowing(){return me(this,"qc-feedback-show","block",this.identifier)}feedbackHiding(){return me(this,"qc-feedback-hide","block",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Ct=o=>o??P;var Ao=class extends ut{constructor(){super(...arguments),this.render=()=>v` <slot part="feedback" class="${Ct(this.showStatus)}"></slot> `}static{this.styles=x`
98
98
  .on {
99
99
  display: inline-block;
100
100
  }
101
101
  .off {
102
102
  display: none;
103
103
  }
104
- `}feedbackShowing(){return ue(this,"qc-feedback-show","inline",this.identifier)}feedbackHiding(){return ue(this,"qc-feedback-hide","inline",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var gh=w`
104
+ `}feedbackShowing(){return me(this,"qc-feedback-show","inline",this.identifier)}feedbackHiding(){return me(this,"qc-feedback-hide","inline",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Eh=x`
105
105
  :host {
106
106
  display: block;
107
107
  }
108
- `;var Eo=class extends C{static{this.styles=gh}render(){return v`<slot part="rubrics qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Jr=class extends ut{static{this.styles=w`
108
+ `;var Io=class extends C{static{this.styles=Eh}render(){return v`<slot part="rubrics qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Zr=class extends ut{static{this.styles=x`
109
109
  .cito-dialog {
110
110
  background: var(--qti-bg);
111
111
  border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
@@ -150,15 +150,15 @@ Make sure to test your application with a production build as repeat registratio
150
150
  <button class="button close-button" @click="${this.closeFeedback}">Close</button>
151
151
  </div>
152
152
  </dialog>
153
- `}openFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}closeFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&t.open&&(t.close(),this.showStatus="off")}feedbackShowing(){return ue(this,"qc-feedback-show","modal",this.identifier)}feedbackHiding(){return ue(this,"qc-feedback-hide","modal",this.identifier)}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(t){t.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var nn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},me=class extends $r{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[w`
153
+ `}openFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}closeFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&t.open&&(t.close(),this.showStatus="off")}feedbackShowing(){return me(this,"qc-feedback-show","modal",this.identifier)}feedbackHiding(){return me(this,"qc-feedback-hide","modal",this.identifier)}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(t){t.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var sn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fe=class extends Lr{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[x`
154
154
  :host {
155
155
  display: none;
156
156
  }
157
- `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let r of t.querySelectorAll("qti-interpolation-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=parseFloat(r.getAttribute("target-value"));if(Number.isNaN(i)||Number.isNaN(n)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:i,targetValue:n,includeBoundary:r.getAttribute("include-boundary")!=="false"})}return e}get matchTable(){let t=this.querySelector("qti-match-table");if(!t)return null;let e=new Map;for(let r of t.querySelectorAll("qti-match-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=r.getAttribute("target-value");if(Number.isNaN(i)||n===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(i,n)}return e}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:t,type:"outcome",value:null,interpolationTable:this.interpolationTable,matchTable:this.matchTable,externalScored:this.externalScored};e.value=t,(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};nn([p({type:String,attribute:"base-type"})],me.prototype,"baseType",void 0);nn([p({type:String,attribute:"external-scored"})],me.prototype,"externalScored",void 0);nn([p({type:String})],me.prototype,"identifier",void 0);nn([p({type:String})],me.prototype,"cardinality",void 0);nn([_({context:F,subscribe:!0}),I()],me.prototype,"itemContext",void 0);var So=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Re=class extends $r{static{this.styles=[w`
157
+ `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let r of t.querySelectorAll("qti-interpolation-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=parseFloat(r.getAttribute("target-value"));if(Number.isNaN(i)||Number.isNaN(n)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:i,targetValue:n,includeBoundary:r.getAttribute("include-boundary")!=="false"})}return e}get matchTable(){let t=this.querySelector("qti-match-table");if(!t)return null;let e=new Map;for(let r of t.querySelectorAll("qti-match-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=r.getAttribute("target-value");if(Number.isNaN(i)||n===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(i,n)}return e}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:t,type:"outcome",value:null,interpolationTable:this.interpolationTable,matchTable:this.matchTable,externalScored:this.externalScored};e.value=t,(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};sn([p({type:String,attribute:"base-type"})],fe.prototype,"baseType",void 0);sn([p({type:String,attribute:"external-scored"})],fe.prototype,"externalScored",void 0);sn([p({type:String})],fe.prototype,"identifier",void 0);sn([p({type:String})],fe.prototype,"cardinality",void 0);sn([R({context:F,subscribe:!0}),T()],fe.prototype,"itemContext",void 0);var To=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Me=class extends Lr{static{this.styles=[x`
158
158
  :host {
159
159
  display: none;
160
160
  }
161
- `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:r}=this.#t(),i={baseType:this.baseType,identifier:this.identifier,correctResponse:e,...r?{fieldBaseTypes:r}:{},cardinality:this.cardinality||"single",mapping:this.#i,defaultValue:t,areaMapping:this.#n,value:null,type:"response",candidateResponse:null};i.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:i}}))}#t(){if(this.cardinality!=="record")return{correctResponse:this.#r};let t=this.querySelector("qti-correct-response");if(!t)return{correctResponse:void 0};let e=Array.from(t.querySelectorAll("qti-value")),{value:r,baseTypes:i}=Xi(e);return e.forEach(n=>n.remove()),{correctResponse:Object.keys(r).length?r:void 0,fieldBaseTypes:i}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=Xi(t);return Object.keys(e).length?e:null}get#r(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){t=[];for(let i=0;i<r.length;i++)t.push(r[i].textContent.trim()),r[i].remove()}}return t}get#i(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(r)?null:r,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(n=>({mapKey:n.getAttribute("map-key")||"",mappedValue:Number(n.getAttribute("mapped-value"))||0,caseSensitive:n.hasAttribute("case-sensitive")?n.getAttribute("case-sensitive")!=="false":!1}))}}get#n(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,r=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound")),n=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(r)?null:r,upperBound:isNaN(i)?null:i,areaMapEntries:n}}};So([p({type:String,attribute:"base-type"})],Re.prototype,"baseType",void 0);So([p({type:String})],Re.prototype,"identifier",void 0);So([p({type:String})],Re.prototype,"cardinality",void 0);So([_({context:F,subscribe:!0}),I()],Re.prototype,"itemContext",void 0);var bh=`<qti-response-condition>
161
+ `]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:r}=this.#t(),i={baseType:this.baseType,identifier:this.identifier,correctResponse:e,...r?{fieldBaseTypes:r}:{},cardinality:this.cardinality||"single",mapping:this.#i,defaultValue:t,areaMapping:this.#n,value:null,type:"response",candidateResponse:null};i.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:i}}))}#t(){if(this.cardinality!=="record")return{correctResponse:this.#r};let t=this.querySelector("qti-correct-response");if(!t)return{correctResponse:void 0};let e=Array.from(t.querySelectorAll("qti-value")),{value:r,baseTypes:i}=Yi(e);return e.forEach(n=>n.remove()),{correctResponse:Object.keys(r).length?r:void 0,fieldBaseTypes:i}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=Yi(t);return Object.keys(e).length?e:null}get#r(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){t=[];for(let i=0;i<r.length;i++)t.push(r[i].textContent.trim()),r[i].remove()}}return t}get#i(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(r)?null:r,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(n=>({mapKey:n.getAttribute("map-key")||"",mappedValue:Number(n.getAttribute("mapped-value"))||0,caseSensitive:n.hasAttribute("case-sensitive")?n.getAttribute("case-sensitive")!=="false":!1}))}}get#n(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,r=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound")),n=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(r)?null:r,upperBound:isNaN(i)?null:i,areaMapEntries:n}}};To([p({type:String,attribute:"base-type"})],Me.prototype,"baseType",void 0);To([p({type:String})],Me.prototype,"identifier",void 0);To([p({type:String})],Me.prototype,"cardinality",void 0);To([R({context:F,subscribe:!0}),T()],Me.prototype,"itemContext",void 0);var Sh=`<qti-response-condition>
162
162
  <qti-response-if>
163
163
  <qti-match>
164
164
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -173,7 +173,7 @@ Make sure to test your application with a production build as repeat registratio
173
173
  <qti-base-value base-type="float">0</qti-base-value>
174
174
  </qti-set-outcome-value>
175
175
  </qti-response-else>
176
- </qti-response-condition>`,vh=`<qti-response-condition>
176
+ </qti-response-condition>`,Ah=`<qti-response-condition>
177
177
  <qti-response-if>
178
178
  <qti-is-null>
179
179
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -187,7 +187,7 @@ Make sure to test your application with a production build as repeat registratio
187
187
  <qti-map-response identifier="RESPONSE"> </qti-map-response>
188
188
  </qti-set-outcome-value>
189
189
  </qti-response-else>
190
- </qti-response-condition>`,yh=`<qti-response-condition>
190
+ </qti-response-condition>`,Ih=`<qti-response-condition>
191
191
  <qti-response-if>
192
192
  <qti-is-null>
193
193
  <qti-variable identifier="RESPONSE"></qti-variable>
@@ -201,27 +201,27 @@ Make sure to test your application with a production build as repeat registratio
201
201
  <qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
202
202
  </qti-set-outcome-value>
203
203
  </qti-response-else>
204
- </qti-response-condition>`;var lf={map_response:vh,map_response_point:yh,match_correct:bh},Ao=class extends C{static{this.styles=[w`
204
+ </qti-response-condition>`;var xf={map_response:Ah,map_response_point:Ih,match_correct:Sh},Ro=class extends C{static{this.styles=[x`
205
205
  :host {
206
206
  display: none;
207
207
  }
208
- `]}#t=new Ht(this,{context:F});#e;constructor(){super(),new at(this,{context:F,subscribe:!0,callback:t=>{this.#e={...t,variables:t.variables.map(e=>({...e}))},this.#t.setValue(this.#e)}}),this.addEventListener("qti-set-outcome-value",t=>{t.stopImmediatePropagation();let e=this.#e?.variables.find(i=>i.identifier===t.detail.outcomeIdentifier);if(!e){console.warn(`Can not set qti-outcome-identifier: ${t.detail.outcomeIdentifier}, it is not available`);return}let{value:r}=t.detail;e.value=e.cardinality==="single"||Array.isArray(r)?r:[r]})}render(){return v`<slot></slot>`}processResponse({numAttempts:t}){let e=this.#e;if(!e)return;let r=this.closest("qti-assessment-item")?.getAttribute("adaptive")!=="true";for(let i of e.variables)i.identifier==="numAttempts"&&(i.value=String(t)),i.type==="outcome"&&r&&i.identifier!=="completionStatus"&&(i.value=df(i));this.#r(),xt(this,"qc-item-set-outcomes",{outcomes:e.variables.filter(i=>i.type==="outcome"||i.identifier==="numAttempts").map(({identifier:i,value:n})=>({identifier:i,value:n})),responseProcessed:!0})}#r(){let t=[...this.children];try{for(let e of t)e.process()}catch(e){if(!(e instanceof Nr))throw e}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let r=e.split("/").pop().replace(".xml",""),i=lf[r];i&&(this.innerHTML=i)}};function df(o){let t=("defaultValue"in o?o.defaultValue:null)??null;return t===null&&(o.baseType==="integer"||o.baseType==="float")?"0":t}function N(o,t){let e={waitUntilFirstUpdate:!1,...t};return(r,i)=>{let{update:n}=r,s=Array.isArray(o)?o:[o];r.update=function(a){s.forEach(c=>{let l=c;if(a.has(l)){let d=a.get(l),h=this[l];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,h)}}),n.call(this,a)}}}var Kr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},$t=o=>(...t)=>({_$litDirective$:o,values:t}),Me=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:hf}=et,qh=o=>o,wh=o=>o===null||typeof o!="object"&&typeof o!="function";var Ch=o=>o.strings===void 0,xh=()=>document.createComment(""),Zr=(o,t,e)=>{let r=o._$AA.parentNode,i=t===void 0?o._$AB:t._$AA;if(e===void 0){let n=r.insertBefore(xh(),i),s=r.insertBefore(xh(),i);e=new hf(n,s,o,o.options)}else{let n=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let c;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(c=o._$AU)!==s._$AU&&e._$AP(c)}if(n!==i||a){let c=e._$AA;for(;c!==n;){let l=qh(c).nextSibling;qh(r).insertBefore(c,i),c=l}}}return e},Pe=(o,t,e=o)=>(o._$AI(t,e),o),pf={},kh=(o,t=pf)=>o._$AH=t,Eh=o=>o._$AH,To=o=>{o._$AR(),o._$AA.remove()};var on=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),on(r,t);return!0},Io=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},Sh=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),ff(t)}};function uf(o){this._$AN!==void 0?(Io(this),this._$AM=o,Sh(this)):this._$AM=o}function mf(o,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let n=e;n<r.length;n++)on(r[n],!1),Io(r[n]);else r!=null&&(on(r,!1),Io(r));else on(this,o)}var ff=o=>{o.type==Kr.CHILD&&(o._$AP??=mf,o._$AQ??=uf)},Oe=class extends Me{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Sh(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(on(this,t),Io(this))}setValue(t){if(Ch(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Ec=class extends Oe{constructor(){super(...arguments),this.prevData={}}render(t){return P}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},P}apply(t){let e=this.#t(t),{prevData:r,element:i}=this;for(let n in e){let s=e[n];s!==r[n]&&(s===!0?i.setAttribute(n,""):s===!1?i.removeAttribute(n):s!=null?i.setAttribute(n,String(s)):i.removeAttribute(n))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let i=t?this.#t(t):{};for(let n in e)(!i||!(n in i))&&r.removeAttribute(n)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>typeof r=="function"?!1:e==="max-choices"&&r===0?!0:!(r===""||r===null||r===void 0)))}},FC=$t(Ec);var sn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fe=class extends C{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!xt(this,"qc-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=w`
208
+ `]}#t=new Ht(this,{context:F});#e;constructor(){super(),new at(this,{context:F,subscribe:!0,callback:t=>{this.#e={...t,variables:t.variables.map(e=>({...e}))},this.#t.setValue(this.#e)}}),this.addEventListener("qti-set-outcome-value",t=>{t.stopImmediatePropagation();let e=this.#e?.variables.find(i=>i.identifier===t.detail.outcomeIdentifier);if(!e){console.warn(`Can not set qti-outcome-identifier: ${t.detail.outcomeIdentifier}, it is not available`);return}let{value:r}=t.detail;e.value=e.cardinality==="single"||Array.isArray(r)?r:[r]})}render(){return v`<slot></slot>`}processResponse({numAttempts:t}){let e=this.#e;if(!e)return;let r=this.closest("qti-assessment-item")?.getAttribute("adaptive")!=="true";for(let i of e.variables)i.identifier==="numAttempts"&&(i.value=String(t)),i.type==="outcome"&&r&&i.identifier!=="completionStatus"&&(i.value=Cf(i));this.#r(),wt(this,"qc-item-set-outcomes",{outcomes:e.variables.filter(i=>i.type==="outcome"||i.identifier==="numAttempts").map(({identifier:i,value:n})=>({identifier:i,value:n})),responseProcessed:!0})}#r(){let t=[...this.children];try{for(let e of t)e.process()}catch(e){if(!(e instanceof Vr))throw e}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let r=e.split("/").pop().replace(".xml",""),i=xf[r];i&&(this.innerHTML=i)}};function Cf(o){let t=("defaultValue"in o?o.defaultValue:null)??null;return t===null&&(o.baseType==="integer"||o.baseType==="float")?"0":t}function N(o,t){let e={waitUntilFirstUpdate:!1,...t};return(r,i)=>{let{update:n}=r,s=Array.isArray(o)?o:[o];r.update=function(a){s.forEach(c=>{let l=c;if(a.has(l)){let d=a.get(l),h=this[l];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,h)}}),n.call(this,a)}}}var ti={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},$t=o=>(...t)=>({_$litDirective$:o,values:t}),Pe=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:kf}=et,Th=o=>o,_h=o=>o===null||typeof o!="object"&&typeof o!="function";var Mh=o=>o.strings===void 0,Rh=()=>document.createComment(""),ei=(o,t,e)=>{let r=o._$AA.parentNode,i=t===void 0?o._$AB:t._$AA;if(e===void 0){let n=r.insertBefore(Rh(),i),s=r.insertBefore(Rh(),i);e=new kf(n,s,o,o.options)}else{let n=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let c;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(c=o._$AU)!==s._$AU&&e._$AP(c)}if(n!==i||a){let c=e._$AA;for(;c!==n;){let l=Th(c).nextSibling;Th(r).insertBefore(c,i),c=l}}}return e},Oe=(o,t,e=o)=>(o._$AI(t,e),o),Ef={},Ph=(o,t=Ef)=>o._$AH=t,Oh=o=>o._$AH,_o=o=>{o._$AR(),o._$AA.remove()};var an=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),an(r,t);return!0},Mo=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},Dh=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),If(t)}};function Sf(o){this._$AN!==void 0?(Mo(this),this._$AM=o,Dh(this)):this._$AM=o}function Af(o,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let n=e;n<r.length;n++)an(r[n],!1),Mo(r[n]);else r!=null&&(an(r,!1),Mo(r));else an(this,o)}var If=o=>{o.type==ti.CHILD&&(o._$AP??=Af,o._$AQ??=Sf)},De=class extends Pe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Dh(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(an(this,t),Mo(this))}setValue(t){if(Mh(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Tc=class extends De{constructor(){super(...arguments),this.prevData={}}render(t){return P}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},P}apply(t){let e=this.#t(t),{prevData:r,element:i}=this;for(let n in e){let s=e[n];s!==r[n]&&(s===!0?i.setAttribute(n,""):s===!1?i.removeAttribute(n):s!=null?i.setAttribute(n,String(s)):i.removeAttribute(n))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let i=t?this.#t(t):{};for(let n in e)(!i||!(n in i))&&r.removeAttribute(n)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>typeof r=="function"?!1:e==="max-choices"&&r===0?!0:!(r===""||r===null||r===void 0)))}},sk=$t(Tc);var cn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ge=class extends C{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!wt(this,"qc-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=x`
209
209
  :host {
210
210
  display: block;
211
211
  }
212
- `}render(){return v`<slot></slot>`}};sn([p({type:String})],fe.prototype,"id",void 0);sn([p({type:String})],fe.prototype,"use",void 0);sn([p({type:String})],fe.prototype,"view",void 0);sn([p({type:String,attribute:"class"})],fe.prototype,"classNames",void 0);sn([N("classNames",{waitUntilFirstUpdate:!0})],fe.prototype,"handleclassNamesChange",null);var _o=class extends C{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(r=>r.text()).then(r=>{let i=this.#e(r);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}).catch(r=>{console.error("Failed to load stylesheet:",r)}),this.textContent!==null&&this.textContent.trim()!==""){let r=this.#e(this.textContent);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${r}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}}#e(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.#t)try{this.#t.remove()}catch(t){console.error("Could not remove stylesheet:",t)}super.disconnectedCallback()}};var Ro=class extends C{render(){return v`<slot></slot>`}calculate(){let t=[...this.children];if(t.length!==1)return console.error("qti-template-constraint must have exactly one child expression"),!0;try{return!!t[0].calculate()}catch(e){return console.error("Error evaluating template constraint:",e),!0}}getSubRules(){return[]}process(){let t=this.calculate();return t||console.debug("Template constraint not satisfied, restarting template processing"),t}};var an=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ge=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[w`
212
+ `}render(){return v`<slot></slot>`}};cn([p({type:String})],ge.prototype,"id",void 0);cn([p({type:String})],ge.prototype,"use",void 0);cn([p({type:String})],ge.prototype,"view",void 0);cn([p({type:String,attribute:"class"})],ge.prototype,"classNames",void 0);cn([N("classNames",{waitUntilFirstUpdate:!0})],ge.prototype,"handleclassNamesChange",null);var Po=class extends C{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(r=>r.text()).then(r=>{let i=this.#e(r);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}).catch(r=>{console.error("Failed to load stylesheet:",r)}),this.textContent!==null&&this.textContent.trim()!==""){let r=this.#e(this.textContent);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${r}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}}#e(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.#t)try{this.#t.remove()}catch(t){console.error("Could not remove stylesheet:",t)}super.disconnectedCallback()}};var Oo=class extends C{render(){return v`<slot></slot>`}calculate(){let t=[...this.children];if(t.length!==1)return console.error("qti-template-constraint must have exactly one child expression"),!0;try{return!!t[0].calculate()}catch(e){return console.error("Error evaluating template constraint:",e),!0}}getSubRules(){return[]}process(){let t=this.calculate();return t||console.debug("Template constraint not satisfied, restarting template processing"),t}};var ln=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},be=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[x`
213
213
  :host {
214
214
  display: none;
215
215
  }
216
- `]}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#i()})}#e(){let t=this.querySelector("qti-default-value");if(!t)return;let e=t.textContent?.trim()||"";this.#t=this.#r(e)}#r(t){if(!t)return null;switch(this.baseType){case"integer":return parseInt(t,10);case"float":case"duration":return parseFloat(t);case"boolean":return t.toLowerCase()==="true";default:return t}}#i(){let e={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:this.#t,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:this.#t?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};an([p({type:String})],ge.prototype,"identifier",void 0);an([p({type:String})],ge.prototype,"cardinality",void 0);an([p({type:String,attribute:"base-type"})],ge.prototype,"baseType",void 0);an([p({type:Boolean,attribute:"math-variable"})],ge.prototype,"mathVariable",void 0);an([p({type:Boolean,attribute:"param-variable"})],ge.prototype,"paramVariable",void 0);var Mo=class extends C{static{this.styles=[w`
216
+ `]}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#i()})}#e(){let t=this.querySelector("qti-default-value");if(!t)return;let e=t.textContent?.trim()||"";this.#t=this.#r(e)}#r(t){if(!t)return null;switch(this.baseType){case"integer":return parseInt(t,10);case"float":case"duration":return parseFloat(t);case"boolean":return t.toLowerCase()==="true";default:return t}}#i(){let e={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:this.#t,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:this.#t?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};ln([p({type:String})],be.prototype,"identifier",void 0);ln([p({type:String})],be.prototype,"cardinality",void 0);ln([p({type:String,attribute:"base-type"})],be.prototype,"baseType",void 0);ln([p({type:Boolean,attribute:"math-variable"})],be.prototype,"mathVariable",void 0);ln([p({type:Boolean,attribute:"param-variable"})],be.prototype,"paramVariable",void 0);var Do=class extends C{static{this.styles=[x`
217
217
  :host {
218
218
  display: none;
219
219
  }
220
- `]}#t=100;render(){return v`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,r=!1;do{if(r=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let i=[...this.children];for(let n of i)if(n.tagName.toLowerCase()==="qti-template-constraint"){if(n.calculate()===!1){r=!0;break}}else n.process()}catch(i){console.error("Error during template processing:",i);break}}while(r);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var Ah=[{tag:"qti-assessment-item",ctor:mt},{tag:"qti-assessment-stimulus",ctor:bo},{tag:"qti-assessment-stimulus-ref",ctor:Gr},{tag:"qti-companion-materials-info",ctor:wo},{tag:"qti-content-body",ctor:en},{tag:"qti-context-declaration",ctor:Yr},{tag:"qti-custom-operator",ctor:rn},{tag:"qti-feedback-block",ctor:Co},{tag:"qti-feedback-inline",ctor:ko},{tag:"qti-item-body",ctor:Eo},{tag:"qti-modal-feedback",ctor:Jr},{tag:"qti-outcome-declaration",ctor:me},{tag:"qti-response-declaration",ctor:Re},{tag:"qti-response-processing",ctor:Ao},{tag:"qti-rubric-block",ctor:fe},{tag:"qti-stylesheet",ctor:_o},{tag:"qti-template-constraint",ctor:Ro},{tag:"qti-template-declaration",ctor:ge},{tag:"qti-template-processing",ctor:Mo}];var gf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},cn=class extends Jr{constructor(){super(...arguments),this.access="atEnd"}static{this.styles=w`
220
+ `]}#t=100;render(){return v`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,r=!1;do{if(r=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let i=[...this.children];for(let n of i)if(n.tagName.toLowerCase()==="qti-template-constraint"){if(n.calculate()===!1){r=!0;break}}else n.process()}catch(i){console.error("Error during template processing:",i);break}}while(r);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var $h=[{tag:"qti-assessment-item",ctor:mt},{tag:"qti-assessment-stimulus",ctor:yo},{tag:"qti-assessment-stimulus-ref",ctor:Jr},{tag:"qti-companion-materials-info",ctor:Eo},{tag:"qti-content-body",ctor:nn},{tag:"qti-context-declaration",ctor:Kr},{tag:"qti-custom-operator",ctor:on},{tag:"qti-feedback-block",ctor:So},{tag:"qti-feedback-inline",ctor:Ao},{tag:"qti-item-body",ctor:Io},{tag:"qti-modal-feedback",ctor:Zr},{tag:"qti-outcome-declaration",ctor:fe},{tag:"qti-response-declaration",ctor:Me},{tag:"qti-response-processing",ctor:Ro},{tag:"qti-rubric-block",ctor:ge},{tag:"qti-stylesheet",ctor:Po},{tag:"qti-template-constraint",ctor:Oo},{tag:"qti-template-declaration",ctor:be},{tag:"qti-template-processing",ctor:Do}];var Tf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},dn=class extends Zr{constructor(){super(...arguments),this.access="atEnd"}static{this.styles=x`
221
221
  :host {
222
222
  color: gray;
223
223
  }
224
- `}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return v``}};gf([p({type:String})],cn.prototype,"access",void 0);var Po=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},De=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return v` <slot></slot>`}};Po([p({type:String})],De.prototype,"identifier",void 0);Po([p({type:String})],De.prototype,"class",void 0);Po([p({type:String,attribute:"navigation-mode"})],De.prototype,"navigationMode",void 0);Po([p({type:String,attribute:"submission-mode"})],De.prototype,"submissionMode",void 0);var bf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ln=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",r=this.getAttribute("variable-identifier"),i=zr(t,Fr(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new Sc(this._testContext,r,i).calculate()}calculate(){return this.getResult()}};bf([_({context:nt,subscribe:!0})],ln.prototype,"_testContext",void 0);var Sc=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let t=this.testContext?.items??[],e=0,r=[...new Set(this.includedItems.map(i=>i.item))];return t.forEach(i=>{if(r.includes(i.identifier)){let n=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;if(n){let a=Number(n.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var Oo=Symbol("itemFacts");var dn="qti-assessment-section",Do="qti-test-part",Nt=o=>o.identifier||o.getAttribute("identifier")||"";function Th(o,t){let e=o[t],r=t+1,i=vf(e,o,t);if(i){let s=yf(i,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map(Nt)};s>t?r=s:console.warn(`qti-branch-rule target "${i.target}" is not ahead of "${Nt(e)}", ignored`)}let n=o.slice(t+1,r).map(Nt);for(let s=r;s<o.length;s++){if(_h(o[s],e))return{id:Nt(o[s]),skipped:n};n.push(Nt(o[s]))}return{id:null,skipped:n}}function Ih(o){let t=[];for(let e of o){if(_h(e,null))return{id:Nt(e),skipped:t};t.push(Nt(e))}return{id:null,skipped:t}}function vf(o,t,e){let r=[o];for(let i=o.parentElement;i&&(i.localName===dn||i.localName===Do)&&!i.contains(t[e+1]??null);i=i.parentElement)r.push(i);for(let i of r)for(let n of i.querySelectorAll(":scope > qti-branch-rule"))if(n.evaluate?.())return n;return null}function yf(o,t,e){let r=o.parentElement,i=n=>{if(!n)return null;let s=t.findLastIndex(a=>n.contains(a));return s+1<t.length?s+1:null};switch(o.target){case he.EXIT_TEST:return null;case he.EXIT_TESTPART:return i(r.closest(Do));case he.EXIT_SECTION:{let n=r.localName===dn?r:r.closest(dn);return i(n??r)}default:{let n=t.findIndex(c=>Nt(c)===o.target);if(n>=0)return n;let s=[...r.closest("qti-assessment-test")?.querySelectorAll(`${dn}, ${Do}`)??[]].find(c=>c.getAttribute("identifier")===o.target),a=s?t.findIndex(c=>s.contains(c)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function _h(o,t){let e=[o];for(let r=o.parentElement;r&&(r.localName===dn||r.localName===Do);r=r.parentElement)(!t||!r.contains(t))&&e.push(r);return e.every(r=>[...r.querySelectorAll(":scope > qti-pre-condition")].every(i=>i.evaluate?.()??!0))}var hn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Rh=o=>{class t extends o{constructor(...r){super(...r),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this.itemFacts=new Map,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(r,i){let n=i||this._getDefaultNavigationId(r);n&&j(this,"qc-test-navigate",{type:r,id:n})}_bindEventHandlers(){B(this,"qc-test-navigate",this._handleNavigationRequest.bind(this)),B(this,"qc-test-loaded",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(r){this._testElement=r.detail,this.itemFacts=new Map,this._initializeNavigation()}_handleItemConnected(r){let i=r.detail;this._loadingState.connectedItems++;let n=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:n}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:n.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,n),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.href)}}_getDefaultNavigationId(r){return r==="section"?this.sessionContext?.navSectionId??this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let r=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(i[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let n=Ih(i);if(n.skipped.length&&j(this,"qc-test-items-skipped",{ids:n.skipped}),n.id===null){j(this,"qc-test-end-reached",{});return}r=n.id}}r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,i){let n=this.sessionContext?.navItemRefId;if(!n||r==="item"&&i===n)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!s||s.closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return!1;let a=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),c=a.findIndex(l=>l.identifier===n);if(r==="item"){let l=a.findIndex(d=>d.identifier===i);return l===-1||c===-1?!1:l!==c+1}return!0}_resolveLinearNext(r,i){if(r!=="item"||!this._testElement)return;let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=n.findIndex(c=>Nt(c)===this.sessionContext?.navItemRefId);if(s<0||!n[s+1]||Nt(n[s+1])!==i||n[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=Th(n,s);if(a.id!==i)return a}async _handleNavigationRequest({detail:r}){if(!r?.id)return;let i=this._resolveLinearNext(r.type,r.id);if(i?.id===null){i.skipped.length&&j(this,"qc-test-items-skipped",{ids:i.skipped}),j(this,"qc-test-end-reached",{});return}let n=i?.id??r.id;if(!i&&this._isLinearNavigationRestricted(r.type,n)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(r.type,n),this._activeController=a,await this._executeNavigation(r.type,n,s,a),i?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&j(this,"qc-test-items-skipped",{ids:i.skipped})}catch(c){this._handleNavigationError(c,r.type,n)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(r.type,n)}}_handleNavigationError(r,i,n){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,n))}async _executeNavigation(r,i,n,s){r==="item"?await this._navigateToItem(i,n,s):await this._navigateToSection(i,n,s)}async _navigateToItem(r,i,n){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"item",r)}async _navigateToSection(r,i,n){let a=this._findSection(r)?.closest("qti-test-part")?.identifier,c=this._getSectionItemIds(r);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:this.navigate==="item"?c[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=c.length,await this._loadItems(c,i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"section",r)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let r=this._loadingState.connectedItems>=this._loadingState.expectedItems,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,i))return;await new Promise(n=>setTimeout(n,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let n=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,r,i)}_applyStimulusContent(r,i,n){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],c=n.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(c)a.push(c),console.info("Found specific target:",c);else{let l=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.identifier}"]`));if(l.length>0)a=l,console.info("Found targets by identifier:",l.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((l,d)=>{l.innerHTML="",l.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,i,n){if(!this._testElement||r.length===0)return;let s=r.map(d=>this._findItemRef(d));this._clearLoadedItems(),this._clearStimulusRef();let c=(await Promise.all(s.map(d=>this._loadSingleItem(d,i,n)))).filter(Boolean);if(this._isStaleNavigation(i,n))return;let l=new Map(this.itemFacts);c.forEach(({itemRef:d,doc:h,facts:f})=>{d&&h&&(d.xmlDoc=h),d&&f&&l.set(d.identifier,f)}),this.itemFacts=l,c.forEach(({itemRef:d})=>{let h=d?.identifier;if(!d||!h)return;let f=this.testContext.items.find(m=>m.identifier===h)?.state;f!==void 0&&d.updateComplete.then(()=>{let m=d.assessmentItem;m&&(m.state=f)})}),this._loadResults=c}async _loadSingleItem(r,i,n){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Jt().load(r.href,n.signal)).shuffleInteractions(s);if(this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,n))return null;let c=a.xmlDoc().documentElement,l=c?.localName==="qti-assessment-item"?Fd(c):null;return{itemRef:r,doc:a.htmlDoc(this._customElementRegistry()),facts:l}}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 Jt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!i)throw new Error(`Item with identifier "${r}" not found`);return i}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,i){let n=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:s,navItemRefId:i}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,i){return i.signal.aborted||r!==this._navigationId}_createNavigationError(r,i,n){return{message:r.message||`Failed to load ${i}: ${n}`,details:r,itemId:i==="item"?n:void 0,sectionId:i==="section"?n:void 0}}_dispatchLoadingStarted(r,i){j(this,"qc-test-navigation-started",{type:r,id:i})}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchError(r){j(this,"qc-test-navigation-failed",r)}_dispatchTestLoaded(r,i,n){requestAnimationFrame(()=>{j(this,"qc-test-rendered",r.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),j(this,"qc-test-navigated",{type:i,id:n})})}}return hn([p({type:String})],t.prototype,"navigate",void 0),hn([p({type:Number})],t.prototype,"requestTimeout",void 0),hn([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),hn([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),hn([I(),Q({context:Oo})],t.prototype,"itemFacts",void 0),t};var Mh=o=>{class t extends o{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},B(this,"qc-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),B(this,"qc-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(r){super.willUpdate(r),r.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let n=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;n&&this.updateAssessmentItemView(n,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return t};var Ph=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ac=o=>{class t extends o{constructor(...r){super(...r),this.testContext=nc,this.sessionContext=ic,this._updateItemInTestContext=i=>{let n=i.itemContext,s=n.identifier,a=n.variables,c=this.testContext.items.find(l=>l?.identifier===s);if(!c){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(c.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,n.valid);else{let l=[...i.variables];for(let d of c.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=l.find(f=>f.identifier===d.identifier);h?h.value=d.value:l.push(d)}i.variables=l,this.#t(s,l.find(d=>d.identifier==="completionStatus")?.value),c.state&&(i.state=c.state)}},this._initializeEventListeners()}updateItemVariables(r,i,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==r)return a;let c=[...a.variables??[]];for(let{identifier:l,type:d,value:h}of i){let f=c.findIndex(y=>y.identifier===l),m={...f>=0?c[f]:{},identifier:l,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?c[f]=m:c.push(m)}return{...a,variables:c,...n?{state:{...n}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(r)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===r)?.variables??[]],n&&(s.state=n))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=nc,this.sessionContext=ic}),B(this,"qc-test-loaded",r=>{this._testElement=r.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(n=>({href:n.href,identifier:n.identifier,category:n.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",r=>{let i=r.detail,n=i.closest("qti-assessment-item-ref")?.identifier;n&&(i.assessmentItemRefId=n),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables,r.detail.itemContext.state,r.detail.itemContext.valid)})}_updateItemVariablesInTestContext(r,i,n,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:i.map(c=>{let l=a.variables.find(d=>d.identifier===c.identifier);return l?{...l,...c}:c}),...n!==void 0?{state:n?{...n}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(r,i){typeof i!="string"||i==="not_attempted"||this.testContext.items.find(a=>a.identifier===r)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:a.variables.map(c=>c.identifier==="completionStatus"?{...c,value:i}:c)})})}}return Ph([p({attribute:!1,type:Object}),Q({context:nt})],t.prototype,"testContext",void 0),Ph([p({attribute:!1,type:Object}),Q({context:lo})],t.prototype,"sessionContext",void 0),t},Oh=class extends Ac(C){};var pn=1;var qf=["response","outcome","template","context"],Dh=o=>o==null?null:Array.isArray(o)?o.map(String):String(o),xf=({identifier:o,type:t,value:e})=>({identifier:o,...qf.includes(t)?{type:t}:{},value:Dh(e)}),$h=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e?.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(xf),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:Dh(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}});var wf=o=>Array.isArray(o)?[...o]:o??null,Cf=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},Nh=o=>{class t extends o{#t=null;#e=null;#r=!1;#i=null;constructor(...r){super(...r),this.addEventListener("qti-testdoc-loaded",()=>{this.#r=!1,this.#i=null}),B(this,"qc-test-update-plugin-state",({detail:i})=>this.#n(i)),B(this,"qc-test-loaded",()=>{this.#t&&(this.#o(this.#t),this.#t=null),this.#r=!0,this.#e&&(j(this,"qc-test-state-refused",this.#e),this.#e=null)})}#n({plugin:r,value:i}){if(typeof r!="string"||r==="")return;let{[r]:n,...s}=this.sessionContext.plugins??{},a=s;if(i!=null)try{a={...s,[r]:JSON.parse(JSON.stringify(i))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${r}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return $h(this.testContext,this.sessionContext)}set state(r){if(!Cf(r)){let a=`Ignoring a state that is not a version ${1} QtiTestState.`;console.warn(`[qti-test] ${a}`),this.#r?j(this,"qc-test-state-refused",{message:a,state:r}):this.#e={message:a,state:r};return}if(!this.#r){this.#t=r;return}let{navItemRefId:i,navSectionId:n}=this.sessionContext;this.#o(r);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==i?this.#c("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==n&&this.#c("section",s.navSectionId)}updated(r){if(super.updated(r),!this.#r||!(r.has("testContext")||r.has("sessionContext")))return;let i=this.state,n=JSON.stringify(i);n!==this.#i&&(this.#i=n,j(this,"qc-test-state-changed",i))}#o(r){for(let n of r.test.items)this.updateItemVariables(n.identifier,n.variables,n.state);this.#s(r);let i=new Map(r.test.outcomes.map(n=>[n.identifier,n.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>i.has(n.identifier)?{...n,value:wf(i.get(n.identifier))}:n)},this.sessionContext={...this.sessionContext,...this.#a(r.session),plugins:r.session.plugins&&typeof r.session.plugins=="object"?{...r.session.plugins}:{}}}#s(r){let i=new Set(this.testContext.items.map(s=>s.identifier)),n=r.test.items.map(s=>s.identifier).filter(s=>!i.has(s));n.length!==0&&console.warn(`[qti-test] The state has answers for items this test does not present (not selected, or no longer in it); they are not restored: ${n.join(", ")}.`)}#a(r){let i=(n,s)=>!!s&&!!this._testElement?.querySelector(`${n}[identifier="${CSS.escape(s)}"]`);return{...i("qti-test-part",r.navPartId)?{navPartId:r.navPartId}:{},...i("qti-assessment-section",r.navSectionId)?{navSectionId:r.navSectionId}:{},...this.testContext.items.some(n=>n.identifier===r.navItemRefId)?{navItemRefId:r.navItemRefId}:{}}}#c(r,i){j(this,"qc-test-navigate",{type:r,id:i})}}return t};var Lh=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),B(this,"qc-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:n,value:s}=i.detail;this.updateOutcomeVariable(n,s),i.stopPropagation()})}outcomeProcessing(){let r=(this._testElement??this).querySelector("qti-outcome-processing");return r?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>({...i,value:i.defaultValue??null}))},r.process(),!0):!1}submit(){return this.outcomeProcessing()?(j(this,"qc-test-submitted",{}),!0):!1}getTestFeedback(r){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(n=>(!r||n.access===r)&&n.matches(this.getOutcome(n.outcomeIdentifier)?.value))}updateOutcomeVariable(r,i){let n=this.getOutcome(r);if(!n){console.warn(`Can not set qti-outcome-identifier: ${r}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==r?s:{...s,value:n.cardinality==="single"?i:[...s.value,i]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===r)||null}}return t};var Vh=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},$e=class extends Rh(Mh(Lh(Nh(Ac(C))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Ht(this,{context:Se,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};Vh([I(),Q({context:yt})],$e.prototype,"configContext",void 0);Vh([I(),Q({context:qt})],$e.prototype,"qtiContext",void 0);var $o=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},No=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var jh=o=>!wh(o)&&typeof o.then=="function",Fh=1073741823,Tc=class extends Oe{constructor(){super(...arguments),this._$Cwt=Fh,this._$Cbt=[],this._$CK=new $o(this),this._$CX=new No}render(...t){return t.find(e=>!jh(e))??it}update(t,e){let r=this._$Cbt,i=r.length;this._$Cbt=e;let n=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let c=e[a];if(!jh(c))return this._$Cwt=a,c;a<i&&c===r[a]||(this._$Cwt=Fh,i=0,Promise.resolve(c).then(async l=>{for(;s.get();)await s.get();let d=n.deref();if(d!==void 0){let h=d._$Cbt.indexOf(c);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(l))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Lo=$t(Tc);var Vo=`
224
+ `}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return v``}};Tf([p({type:String})],dn.prototype,"access",void 0);var $o=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},$e=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return v` <slot></slot>`}};$o([p({type:String})],$e.prototype,"identifier",void 0);$o([p({type:String})],$e.prototype,"class",void 0);$o([p({type:String,attribute:"navigation-mode"})],$e.prototype,"navigationMode",void 0);$o([p({type:String,attribute:"submission-mode"})],$e.prototype,"submissionMode",void 0);var Rf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},hn=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",r=this.getAttribute("variable-identifier"),i=Ur(t,Br(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new Rc(this._testContext,r,i).calculate()}calculate(){return this.getResult()}};Rf([R({context:nt,subscribe:!0})],hn.prototype,"_testContext",void 0);var Rc=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let t=this.testContext?.items??[],e=0,r=[...new Set(this.includedItems.map(i=>i.item))];return t.forEach(i=>{if(r.includes(i.identifier)){let n=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;if(n){let a=Number(n.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var No=Symbol("itemFacts");var pn="qti-assessment-section",Lo="qti-test-part",Nt=o=>o.identifier||o.getAttribute("identifier")||"";function Nh(o,t){let e=o[t],r=t+1,i=_f(e,o,t);if(i){let s=Mf(i,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map(Nt)};s>t?r=s:console.warn(`qti-branch-rule target "${i.target}" is not ahead of "${Nt(e)}", ignored`)}let n=o.slice(t+1,r).map(Nt);for(let s=r;s<o.length;s++){if(Vh(o[s],e))return{id:Nt(o[s]),skipped:n};n.push(Nt(o[s]))}return{id:null,skipped:n}}function Lh(o){let t=[];for(let e of o){if(Vh(e,null))return{id:Nt(e),skipped:t};t.push(Nt(e))}return{id:null,skipped:t}}function _f(o,t,e){let r=[o];for(let i=o.parentElement;i&&(i.localName===pn||i.localName===Lo)&&!i.contains(t[e+1]??null);i=i.parentElement)r.push(i);for(let i of r)for(let n of i.querySelectorAll(":scope > qti-branch-rule"))if(n.evaluate?.())return n;return null}function Mf(o,t,e){let r=o.parentElement,i=n=>{if(!n)return null;let s=t.findLastIndex(a=>n.contains(a));return s+1<t.length?s+1:null};switch(o.target){case pe.EXIT_TEST:return null;case pe.EXIT_TESTPART:return i(r.closest(Lo));case pe.EXIT_SECTION:{let n=r.localName===pn?r:r.closest(pn);return i(n??r)}default:{let n=t.findIndex(c=>Nt(c)===o.target);if(n>=0)return n;let s=[...r.closest("qti-assessment-test")?.querySelectorAll(`${pn}, ${Lo}`)??[]].find(c=>c.getAttribute("identifier")===o.target),a=s?t.findIndex(c=>s.contains(c)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function Vh(o,t){let e=[o];for(let r=o.parentElement;r&&(r.localName===pn||r.localName===Lo);r=r.parentElement)(!t||!r.contains(t))&&e.push(r);return e.every(r=>[...r.querySelectorAll(":scope > qti-pre-condition")].every(i=>i.evaluate?.()??!0))}var un=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},jh=o=>{class t extends o{constructor(...r){super(...r),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this.itemFacts=new Map,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(r,i){let n=i||this._getDefaultNavigationId(r);n&&j(this,"qc-test-navigate",{type:r,id:n})}_bindEventHandlers(){B(this,"qc-test-navigate",this._handleNavigationRequest.bind(this)),B(this,"qc-test-loaded",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(r){this._testElement=r.detail,this.itemFacts=new Map,this._initializeNavigation()}_handleItemConnected(r){let i=r.detail;this._loadingState.connectedItems++;let n=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:n}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:n.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,n),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.href)}}_getDefaultNavigationId(r){return r==="section"?this.sessionContext?.navSectionId??this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let r=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(i[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let n=Lh(i);if(n.skipped.length&&j(this,"qc-test-items-skipped",{ids:n.skipped}),n.id===null){j(this,"qc-test-end-reached",{});return}r=n.id}}r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,i){let n=this.sessionContext?.navItemRefId;if(!n||r==="item"&&i===n)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!s||s.closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return!1;let a=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),c=a.findIndex(l=>l.identifier===n);if(r==="item"){let l=a.findIndex(d=>d.identifier===i);return l===-1||c===-1?!1:l!==c+1}return!0}_resolveLinearNext(r,i){if(r!=="item"||!this._testElement)return;let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=n.findIndex(c=>Nt(c)===this.sessionContext?.navItemRefId);if(s<0||!n[s+1]||Nt(n[s+1])!==i||n[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=Nh(n,s);if(a.id!==i)return a}async _handleNavigationRequest({detail:r}){if(!r?.id)return;let i=this._resolveLinearNext(r.type,r.id);if(i?.id===null){i.skipped.length&&j(this,"qc-test-items-skipped",{ids:i.skipped}),j(this,"qc-test-end-reached",{});return}let n=i?.id??r.id;if(!i&&this._isLinearNavigationRestricted(r.type,n)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(r.type,n),this._activeController=a,await this._executeNavigation(r.type,n,s,a),i?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&j(this,"qc-test-items-skipped",{ids:i.skipped})}catch(c){this._handleNavigationError(c,r.type,n)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(r.type,n)}}_handleNavigationError(r,i,n){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,n))}async _executeNavigation(r,i,n,s){r==="item"?await this._navigateToItem(i,n,s):await this._navigateToSection(i,n,s)}async _navigateToItem(r,i,n){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"item",r)}async _navigateToSection(r,i,n){let a=this._findSection(r)?.closest("qti-test-part")?.identifier,c=this._getSectionItemIds(r);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:this.navigate==="item"?c[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=c.length,await this._loadItems(c,i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"section",r)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let r=this._loadingState.connectedItems>=this._loadingState.expectedItems,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,i))return;await new Promise(n=>setTimeout(n,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let n=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,r,i)}_applyStimulusContent(r,i,n){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],c=n.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(c)a.push(c),console.info("Found specific target:",c);else{let l=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.identifier}"]`));if(l.length>0)a=l,console.info("Found targets by identifier:",l.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((l,d)=>{l.innerHTML="",l.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,i,n){if(!this._testElement||r.length===0)return;let s=r.map(d=>this._findItemRef(d));this._clearLoadedItems(),this._clearStimulusRef();let c=(await Promise.all(s.map(d=>this._loadSingleItem(d,i,n)))).filter(Boolean);if(this._isStaleNavigation(i,n))return;let l=new Map(this.itemFacts);c.forEach(({itemRef:d,doc:h,facts:f})=>{d&&h&&(d.xmlDoc=h),d&&f&&l.set(d.identifier,f)}),this.itemFacts=l,c.forEach(({itemRef:d})=>{let h=d?.identifier;if(!d||!h)return;let f=this.testContext.items.find(m=>m.identifier===h)?.state;f!==void 0&&d.updateComplete.then(()=>{let m=d.assessmentItem;m&&(m.state=f)})}),this._loadResults=c}async _loadSingleItem(r,i,n){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Kt().load(r.href,n.signal)).shuffleInteractions(s);if(this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,n))return null;let c=a.xmlDoc().documentElement,l=c?.localName==="qti-assessment-item"?Wd(c):null;return{itemRef:r,doc:a.htmlDoc(this._customElementRegistry()),facts:l}}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 Kt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!i)throw new Error(`Item with identifier "${r}" not found`);return i}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,i){let n=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:s,navItemRefId:i}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,i){return i.signal.aborted||r!==this._navigationId}_createNavigationError(r,i,n){return{message:r.message||`Failed to load ${i}: ${n}`,details:r,itemId:i==="item"?n:void 0,sectionId:i==="section"?n:void 0}}_dispatchLoadingStarted(r,i){j(this,"qc-test-navigation-started",{type:r,id:i})}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchError(r){j(this,"qc-test-navigation-failed",r)}_dispatchTestLoaded(r,i,n){requestAnimationFrame(()=>{j(this,"qc-test-rendered",r.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),j(this,"qc-test-navigated",{type:i,id:n})})}}return un([p({type:String})],t.prototype,"navigate",void 0),un([p({type:Number})],t.prototype,"requestTimeout",void 0),un([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),un([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),un([T(),Q({context:No})],t.prototype,"itemFacts",void 0),t};var Fh=o=>{class t extends o{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},B(this,"qc-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),B(this,"qc-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(r){super.willUpdate(r),r.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let n=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;n&&this.updateAssessmentItemView(n,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return t};var zh=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},_c=o=>{class t extends o{constructor(...r){super(...r),this.testContext=ac,this.sessionContext=sc,this._updateItemInTestContext=i=>{let n=i.itemContext,s=n.identifier,a=n.variables,c=this.testContext.items.find(l=>l?.identifier===s);if(!c){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(c.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,n.valid);else{let l=[...i.variables];for(let d of c.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=l.find(f=>f.identifier===d.identifier);h?h.value=d.value:l.push(d)}i.variables=l,this.#t(s,l.find(d=>d.identifier==="completionStatus")?.value),c.state&&(i.state=c.state)}},this._initializeEventListeners()}updateItemVariables(r,i,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==r)return a;let c=[...a.variables??[]];for(let{identifier:l,type:d,value:h}of i){let f=c.findIndex(y=>y.identifier===l),m={...f>=0?c[f]:{},identifier:l,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?c[f]=m:c.push(m)}return{...a,variables:c,...n?{state:{...n}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(r)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===r)?.variables??[]],n&&(s.state=n))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=ac,this.sessionContext=sc}),B(this,"qc-test-loaded",r=>{this._testElement=r.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(n=>({href:n.href,identifier:n.identifier,category:n.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",r=>{let i=r.detail,n=i.closest("qti-assessment-item-ref")?.identifier;n&&(i.assessmentItemRefId=n),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables,r.detail.itemContext.state,r.detail.itemContext.valid)})}_updateItemVariablesInTestContext(r,i,n,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:i.map(c=>{let l=a.variables.find(d=>d.identifier===c.identifier);return l?{...l,...c}:c}),...n!==void 0?{state:n?{...n}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(r,i){typeof i!="string"||i==="not_attempted"||this.testContext.items.find(a=>a.identifier===r)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:a.variables.map(c=>c.identifier==="completionStatus"?{...c,value:i}:c)})})}}return zh([p({attribute:!1,type:Object}),Q({context:nt})],t.prototype,"testContext",void 0),zh([p({attribute:!1,type:Object}),Q({context:po})],t.prototype,"sessionContext",void 0),t},Bh=class extends _c(C){};var mn=1;var Pf=["response","outcome","template","context"],Uh=o=>o==null?null:Array.isArray(o)?o.map(String):String(o),Of=({identifier:o,type:t,value:e})=>({identifier:o,...Pf.includes(t)?{type:t}:{},value:Uh(e)}),Hh=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e?.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(Of),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:Uh(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}});var Df=o=>Array.isArray(o)?[...o]:o??null,$f=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},Wh=o=>{class t extends o{#t=null;#e=null;#r=!1;#i=null;constructor(...r){super(...r),this.addEventListener("qti-testdoc-loaded",()=>{this.#r=!1,this.#i=null}),B(this,"qc-test-update-plugin-state",({detail:i})=>this.#n(i)),B(this,"qc-test-loaded",()=>{this.#t&&(this.#o(this.#t),this.#t=null),this.#r=!0,this.#e&&(j(this,"qc-test-state-refused",this.#e),this.#e=null)})}#n({plugin:r,value:i}){if(typeof r!="string"||r==="")return;let{[r]:n,...s}=this.sessionContext.plugins??{},a=s;if(i!=null)try{a={...s,[r]:JSON.parse(JSON.stringify(i))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${r}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return Hh(this.testContext,this.sessionContext)}set state(r){if(!$f(r)){let a=`Ignoring a state that is not a version ${1} QtiTestState.`;console.warn(`[qti-test] ${a}`),this.#r?j(this,"qc-test-state-refused",{message:a,state:r}):this.#e={message:a,state:r};return}if(!this.#r){this.#t=r;return}let{navItemRefId:i,navSectionId:n}=this.sessionContext;this.#o(r);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==i?this.#c("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==n&&this.#c("section",s.navSectionId)}updated(r){if(super.updated(r),!this.#r||!(r.has("testContext")||r.has("sessionContext")))return;let i=this.state,n=JSON.stringify(i);n!==this.#i&&(this.#i=n,j(this,"qc-test-state-changed",i))}#o(r){for(let n of r.test.items)this.updateItemVariables(n.identifier,n.variables,n.state);this.#s(r);let i=new Map(r.test.outcomes.map(n=>[n.identifier,n.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>i.has(n.identifier)?{...n,value:Df(i.get(n.identifier))}:n)},this.sessionContext={...this.sessionContext,...this.#a(r.session),plugins:r.session.plugins&&typeof r.session.plugins=="object"?{...r.session.plugins}:{}}}#s(r){let i=new Set(this.testContext.items.map(s=>s.identifier)),n=r.test.items.map(s=>s.identifier).filter(s=>!i.has(s));n.length!==0&&console.warn(`[qti-test] The state has answers for items this test does not present (not selected, or no longer in it); they are not restored: ${n.join(", ")}.`)}#a(r){let i=(n,s)=>!!s&&!!this._testElement?.querySelector(`${n}[identifier="${CSS.escape(s)}"]`);return{...i("qti-test-part",r.navPartId)?{navPartId:r.navPartId}:{},...i("qti-assessment-section",r.navSectionId)?{navSectionId:r.navSectionId}:{},...this.testContext.items.some(n=>n.identifier===r.navItemRefId)?{navItemRefId:r.navItemRefId}:{}}}#c(r,i){j(this,"qc-test-navigate",{type:r,id:i})}}return t};var Qh=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),B(this,"qc-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:n,value:s}=i.detail;this.updateOutcomeVariable(n,s),i.stopPropagation()})}outcomeProcessing(){let r=(this._testElement??this).querySelector("qti-outcome-processing");return r?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>({...i,value:i.defaultValue??null}))},r.process(),!0):!1}submit(){return this.outcomeProcessing()?(j(this,"qc-test-submitted",{}),!0):!1}getTestFeedback(r){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(n=>(!r||n.access===r)&&n.matches(this.getOutcome(n.outcomeIdentifier)?.value))}updateOutcomeVariable(r,i){let n=this.getOutcome(r);if(!n){console.warn(`Can not set qti-outcome-identifier: ${r}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==r?s:{...s,value:n.cardinality==="single"?i:[...s.value,i]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===r)||null}}return t};var Xh=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ne=class extends jh(Fh(Qh(Wh(_c(C))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Ht(this,{context:Ae,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};Xh([T(),Q({context:yt})],Ne.prototype,"configContext",void 0);Xh([T(),Q({context:qt})],Ne.prototype,"qtiContext",void 0);var Vo=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},jo=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var Gh=o=>!_h(o)&&typeof o.then=="function",Yh=1073741823,Mc=class extends De{constructor(){super(...arguments),this._$Cwt=Yh,this._$Cbt=[],this._$CK=new Vo(this),this._$CX=new jo}render(...t){return t.find(e=>!Gh(e))??it}update(t,e){let r=this._$Cbt,i=r.length;this._$Cbt=e;let n=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let c=e[a];if(!Gh(c))return this._$Cwt=a,c;a<i&&c===r[a]||(this._$Cwt=Yh,i=0,Promise.resolve(c).then(async l=>{for(;s.get();)await s.get();let d=n.deref();if(d!==void 0){let h=d._$Cbt.indexOf(c);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(l))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Fo=$t(Mc);var zo=`
225
225
  @layer qti-base, qti-components, qti-extended;
226
226
 
227
227
  @layer qti-components.reset, qti-components.global, qti-components.interactions.base,
@@ -6307,16 +6307,16 @@ div.full-correct-response-inline {
6307
6307
  display: inline-block;
6308
6308
  }
6309
6309
  }
6310
- `;var Ne=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},kt=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.testURL=null,this.testDoc=null,this.testXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleTestURLChange(){if(this.testURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Xr().load(this.testURL)).applySelection(t).shuffleOrdering(t),r=this.testHost;if(r?.postLoadTestTransformCallback){let n=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");n&&(e=await r.postLoadTestTransformCallback(e,n))}this.#r(e.htmlDoc(this.#e??void 0))}catch(t){console.error("Error loading or parsing XML:",t)}}#r(t){this.testDoc=t,this.dispatchEvent(new CustomEvent("qti-testdoc-loaded",{bubbles:!0,composed:!0}))}handleTestXMLChange(){if(this.testXML)try{let t=this.qtiContext?.QTI_CONTEXT?.seed;this.#r(Xr().parse(this.testXML).applySelection(t).shuffleOrdering(t).htmlDoc(this.#e??void 0))}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#i(),this.#n(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:v``}#n(){let t=new CSSStyleSheet;t.replaceSync(Vo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
6310
+ `;var Le=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},kt=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.testURL=null,this.testDoc=null,this.testXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleTestURLChange(){if(this.testURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Yr().load(this.testURL)).applySelection(t).shuffleOrdering(t),r=this.testHost;if(r?.postLoadTestTransformCallback){let n=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");n&&(e=await r.postLoadTestTransformCallback(e,n))}this.#r(e.htmlDoc(this.#e??void 0))}catch(t){console.error("Error loading or parsing XML:",t)}}#r(t){this.testDoc=t,this.dispatchEvent(new CustomEvent("qti-testdoc-loaded",{bubbles:!0,composed:!0}))}handleTestXMLChange(){if(this.testXML)try{let t=this.qtiContext?.QTI_CONTEXT?.seed;this.#r(Yr().parse(this.testXML).applySelection(t).shuffleOrdering(t).htmlDoc(this.#e??void 0))}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#i(),this.#n(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:v``}#n(){let t=new CSSStyleSheet;t.replaceSync(zo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
6311
6311
  ${this.#t}
6312
6312
  <slot></slot>
6313
- ${Lo(this.testDoc,v`<span>Loading...</span>`)}
6314
- `}};Ne([p({attribute:!1})],kt.prototype,"customElementRegistry",void 0);Ne([p({type:String,attribute:"test-url"})],kt.prototype,"testURL",void 0);Ne([I()],kt.prototype,"testDoc",void 0);Ne([I()],kt.prototype,"testXML",void 0);Ne([_({context:Se,subscribe:!0})],kt.prototype,"testHost",void 0);Ne([I(),_({context:qt,subscribe:!0})],kt.prototype,"qtiContext",void 0);Ne([N("testURL",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestURLChange",null);Ne([N("testXML",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestXMLChange",null);var jo=w`var(--qti-color-base-100, var(--qc-color-base-100, var(--cito-color-base-100, Canvas)))`,Ic=w`var(--qti-color-base-content, var(--qc-color-base-content, var(--cito-color-base-content, CanvasText)))`,Fo=w`var(--qti-color-neutral, var(--qc-color-neutral, var(--cito-color-neutral, CanvasText)))`,_c=w`var(--qti-color-neutral-content, var(--qc-color-neutral-content, var(--cito-color-neutral-content, Canvas)))`,zh=w`var(--button-border-radius, var(--test-button-border-radius, var(--qti-radius-field, var(--qc-radius-field, var(--cito-radius-field, 0.2rem)))))`,Bh=w`var(--qti-border-width, var(--qc-border-width, var(--cito-border-width, 1px)))`,kf=w`
6313
+ ${Fo(this.testDoc,v`<span>Loading...</span>`)}
6314
+ `}};Le([p({attribute:!1})],kt.prototype,"customElementRegistry",void 0);Le([p({type:String,attribute:"test-url"})],kt.prototype,"testURL",void 0);Le([T()],kt.prototype,"testDoc",void 0);Le([T()],kt.prototype,"testXML",void 0);Le([R({context:Ae,subscribe:!0})],kt.prototype,"testHost",void 0);Le([T(),R({context:qt,subscribe:!0})],kt.prototype,"qtiContext",void 0);Le([N("testURL",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestURLChange",null);Le([N("testXML",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestXMLChange",null);var Bo=x`var(--qti-color-base-100, var(--qc-color-base-100, var(--cito-color-base-100, Canvas)))`,Pc=x`var(--qti-color-base-content, var(--qc-color-base-content, var(--cito-color-base-content, CanvasText)))`,Uo=x`var(--qti-color-neutral, var(--qc-color-neutral, var(--cito-color-neutral, CanvasText)))`,Oc=x`var(--qti-color-neutral-content, var(--qc-color-neutral-content, var(--cito-color-neutral-content, Canvas)))`,Jh=x`var(--button-border-radius, var(--test-button-border-radius, var(--qti-radius-field, var(--qc-radius-field, var(--cito-radius-field, 0.2rem)))))`,Kh=x`var(--qti-border-width, var(--qc-border-width, var(--cito-border-width, 1px)))`,Nf=x`
6315
6315
  display: inline-flex;
6316
6316
  cursor: pointer;
6317
6317
  user-select: none;
6318
- border-radius: ${zh};
6319
- `,Uh=w`
6318
+ border-radius: ${Jh};
6319
+ `,Zh=x`
6320
6320
  display: flex;
6321
6321
  flex: 1 1 auto;
6322
6322
  align-items: center;
@@ -6329,69 +6329,69 @@ div.full-correct-response-inline {
6329
6329
  line-height: 1.25;
6330
6330
  cursor: pointer;
6331
6331
  user-select: none;
6332
- border-radius: ${zh};
6333
- `,Ef=w`
6334
- ${Uh};
6335
- background-color: var(--button-background-color, var(--test-button-background-color, ${jo}));
6332
+ border-radius: ${Jh};
6333
+ `,Lf=x`
6334
+ ${Zh};
6335
+ background-color: var(--button-background-color, var(--test-button-background-color, ${Bo}));
6336
6336
  color: var(--button-color, var(--test-button-color, inherit));
6337
- border: ${Bh} solid
6337
+ border: ${Kh} solid
6338
6338
  var(
6339
6339
  --button-border-color,
6340
- var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${Ic} 45%, ${jo})))
6340
+ var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${Pc} 45%, ${Bo})))
6341
6341
  );
6342
- `,Sf=w`
6343
- background-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${Fo}));
6344
- color: var(--button-primary-color, var(--test-button-primary-color, ${_c}));
6345
- border-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${Fo}));
6346
- `,Af=w`
6342
+ `,Vf=x`
6343
+ background-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${Uo}));
6344
+ color: var(--button-primary-color, var(--test-button-primary-color, ${Oc}));
6345
+ border-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${Uo}));
6346
+ `,jf=x`
6347
6347
  background-color: var(
6348
6348
  --button-hover-background-color,
6349
- var(--test-button-hover-background-color, color-mix(in oklab, ${jo}, ${Ic} var(--qti-hover-mix, 8%)))
6349
+ var(--test-button-hover-background-color, color-mix(in oklab, ${Bo}, ${Pc} var(--qti-hover-mix, 8%)))
6350
6350
  );
6351
- `,Tf=w`
6351
+ `,Ff=x`
6352
6352
  background-color: var(
6353
6353
  --button-primary-hover-background-color,
6354
6354
  var(
6355
6355
  --test-button-primary-hover-background-color,
6356
- color-mix(in oklab, ${Fo}, ${_c} var(--qti-hover-mix, 8%))
6356
+ color-mix(in oklab, ${Uo}, ${Oc} var(--qti-hover-mix, 8%))
6357
6357
  )
6358
6358
  );
6359
- `,If=w`
6359
+ `,zf=x`
6360
6360
  background-color: var(
6361
6361
  --button-active-background-color,
6362
- var(--test-button-active-background-color, color-mix(in oklab, ${jo}, ${Ic} var(--qti-active-mix, 16%)))
6362
+ var(--test-button-active-background-color, color-mix(in oklab, ${Bo}, ${Pc} var(--qti-active-mix, 16%)))
6363
6363
  );
6364
- `,_f=w`
6364
+ `,Bf=x`
6365
6365
  background-color: var(
6366
6366
  --button-primary-active-background-color,
6367
6367
  var(
6368
6368
  --test-button-primary-active-background-color,
6369
- color-mix(in oklab, ${Fo}, ${_c} var(--qti-active-mix, 16%))
6369
+ color-mix(in oklab, ${Uo}, ${Oc} var(--qti-active-mix, 16%))
6370
6370
  )
6371
6371
  );
6372
- `,Rf=w`
6372
+ `,Uf=x`
6373
6373
  outline: var(--qti-focus-border-width, 2px) solid var(--qti-focus-color, Highlight);
6374
6374
  outline-offset: var(--qti-focus-offset, 2px);
6375
- `,Mf=w`
6375
+ `,Hf=x`
6376
6376
  cursor: not-allowed;
6377
6377
  opacity: 0.45;
6378
- `,ZE=w`
6379
- ${Uh};
6380
- border: ${Bh} solid var(--qti-border-color, GrayText);
6381
- `,Le=v`<span class="control" part="button"><slot></slot></span>`,Ve=w`
6378
+ `,vS=x`
6379
+ ${Zh};
6380
+ border: ${Kh} solid var(--qti-border-color, GrayText);
6381
+ `,Ve=v`<span class="control" part="button"><slot></slot></span>`,je=x`
6382
6382
  :host {
6383
- ${kf};
6383
+ ${Nf};
6384
6384
  }
6385
6385
  .control {
6386
- ${Ef};
6386
+ ${Lf};
6387
6387
  }
6388
6388
  @media (hover: hover) and (pointer: fine) {
6389
6389
  :host(:hover:not([disabled])) .control {
6390
- ${Af};
6390
+ ${jf};
6391
6391
  }
6392
6392
  }
6393
6393
  :host(:active:not([disabled])) .control {
6394
- ${If};
6394
+ ${zf};
6395
6395
  }
6396
6396
  /* The press the theme gives a choice (qti-motion.css), from the same knob: a touch smaller while
6397
6397
  the button is down, springing back on release; 0 motion means no press. */
@@ -6404,31 +6404,31 @@ div.full-correct-response-inline {
6404
6404
  scale: calc(1 - 0.03 * var(--qti-motion, 1));
6405
6405
  }
6406
6406
  :host(:focus-visible) {
6407
- ${Rf};
6407
+ ${Uf};
6408
6408
  }
6409
6409
  :host([disabled]) {
6410
- ${Mf};
6410
+ ${Hf};
6411
6411
  }
6412
6412
  :host([disabled]) .control {
6413
6413
  cursor: not-allowed;
6414
6414
  }
6415
- `,Hh=w`
6415
+ `,tp=x`
6416
6416
  .control {
6417
- ${Sf};
6417
+ ${Vf};
6418
6418
  }
6419
6419
  @media (hover: hover) and (pointer: fine) {
6420
6420
  :host(:hover:not([disabled])) .control {
6421
- ${Tf};
6421
+ ${Ff};
6422
6422
  }
6423
6423
  }
6424
6424
  :host(:active:not([disabled])) .control {
6425
- ${_f};
6425
+ ${Bf};
6426
6426
  }
6427
- `;var un=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Wh=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?Wh(e.host):void 0},be=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=Ve}constructor(){super(),this._internalDisabled=!1,this.requireAnswer=!1,this.addEventListener("click",t=>{if(t.preventDefault(),!this._internalDisabled){let e=this.#t;j(this,"qc-test-end-attempt",e?{itemId:e}:{})}})}get#t(){return this.item||Wh(this)}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts,e=this.#t,r=t?.find(a=>a.active);if(!t||!e&&!r)return;let i=e?t.flatMap(a=>a.sections.flatMap(c=>c.items)).find(a=>a.identifier===e):r.sections.flatMap(a=>a.items).find(a=>a.active);if(!i){this._internalDisabled=!1;return}let n=i.sessionControl?.maxAttempts??1,s=i.numAttempts||0;if(!i.adaptive&&i.optimal){this._internalDisabled=!0;return}if(i.adaptive&&i.completionStatus==="completed"){this._internalDisabled=!0;return}if(!i.adaptive&&n>0&&s>=n){this._internalDisabled=!0;return}this.requireAnswer||i.sessionControl?.allowSkipping===!1?this._internalDisabled=i.valid===!1||i.isDefaultResponse:this._internalDisabled=!1}render(){return Le}};un([_({context:ct,subscribe:!0}),p({attribute:!1})],be.prototype,"computedContext",void 0);un([p({type:Boolean,reflect:!0,attribute:"disabled"})],be.prototype,"_internalDisabled",void 0);un([p({reflect:!0})],be.prototype,"item",void 0);un([p({type:Boolean,reflect:!0,attribute:"require-answer"})],be.prototype,"requireAnswer",void 0);un([N("computedContext")],be.prototype,"_handleTestElementChange",null);function Xh(o){let{model:t,sessionContext:e,itemElement:r}=o,i=Df(t.testParts.flatMap(n=>Yi(n.sections)),o.infoItemCategory);return{itemElement:r,identifier:t.identifier,title:t.title,view:e?.view,plugins:e?.plugins??{},testParts:t.testParts.map(n=>({active:e?.navPartId===n.identifier,identifier:n.identifier,navigationMode:n.navigationMode,submissionMode:n.submissionMode,allowSkipping:n.sessionControl.allowSkipping,itemOrder:Yi(n.sections).map(s=>s.identifier),sections:bc(n.sections).map(s=>({active:e?.navSectionId===s.identifier,identifier:s.identifier,title:s.title,allowSkipping:s.sessionControl.allowSkipping,completed:Yi(s.content).every(a=>ti(Gh(o,a.identifier),"completionStatus")==="completed"),items:jd(s).map(a=>Pf(o,a,i.get(a.identifier)??null))}))}))}}function Pf(o,t,e){let r=Gh(o,t.identifier),i={active:!1,identifier:t.identifier,categories:[...t.categories],href:t.href,variables:[],sessionControl:{...t.sessionControl},...Of(o.itemFacts,t.identifier),...r,...o.itemData?.find(y=>y.identifier===t.identifier)},n=ti(i,"SCORE"),s=n==null?null:parseFloat(n.toString()),a=ti(i,"MAXSCORE"),c=a==null?null:parseFloat(a.toString()),l=ti(i,"completionStatus"),d=ti(i,"RESPONSE")||"",h=Number(ti(i,"numAttempts"))||0,f=o.optimality.get(t.identifier),m=f??(r?Bo(r):"unscored");return{...i,completionStatus:l,numAttempts:h,score:s,response:d,index:e,active:o.sessionContext?.navItemRefId===t.identifier,valid:r?.valid??!0,isDefaultResponse:$f(r),maxScore:c,done:Rc(h,m,i.sessionControl?.maxAttempts,i.adaptive,l),optimal:f==="optimal"}}function Gh(o,t){return o.testContext?.items?.find(e=>e.identifier===t)}function ti(o,t){return o?.variables?.find(e=>e.identifier===t)?.value}function Of(o,t){let e=o?.get(t);if(!e)return{};let{identifier:r,...i}=e;return{...i,assessmentItemIdentifier:r}}function Df(o,t){let e=1;return new Map(o.map(r=>[r.identifier,r.categories.includes(t)?null:e++]))}function $f(o){return(o?.variables?.filter(e=>e.type==="response"&&e.identifier!=="numAttempts")||[]).every(e=>{if(e.value===void 0||e.value===null)return!0;let r;switch(e.baseType){case"integer":case"float":case"duration":r="0";break;case"boolean":r="false";break;default:r="";break}let i=e.defaultValue??r;if(Array.isArray(e.value)){let n=Array.isArray(i)?i:[i];return e.value.length===n.length&&e.value.every((s,a)=>s===n[a])}return e.value===i})}function Rc(o,t,e,r,i){if(o===0)return!1;if(r)return i==="completed";if(t!=="suboptimal")return!0;let n=e??1;return n>0&&o>=n}function Bo(o){let t=o.variables??[],e=Qh(t,"SCORE"),r=Qh(t,"MAXSCORE");if(e!==null&&r!==null)return e>=r?"optimal":"suboptimal";let i=t.filter(s=>s.type==="response"&&s.correctResponse!==void 0&&s.correctResponse!==null);return i.length===0?"unscored":i.every(s=>{let a=s.correctResponse,c=s.value;return c==null?!1:Array.isArray(a)&&Array.isArray(c)?a.length===c.length&&a.every(l=>c.includes(l)):Array.isArray(a)||Array.isArray(c)?!1:a===c})?"optimal":"suboptimal"}function Qh(o,t){let e=o?.find(i=>i.identifier===t)?.value;if(e==null||Array.isArray(e))return null;let r=parseFloat(e.toString());return Number.isNaN(r)?null:r}function Mc(o){return{nodeType:o.nodeType,localName:o.localName,get childNodes(){return Array.from(o.children,Mc)},getAttribute:t=>o.getAttribute(t)??(t==="title"?o.getAttribute("data-title"):null)}}var je=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Nf=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),lt=class extends C{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=Nf())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#r(t)}#t;#e;#r(t){let e=this.#n();e?e.qtiContext=t:this.#t=t}#i;#n(){return this.#i.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#i=new at(this,{context:Se,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#p=t=>this.#c(t)??null,this.#b=new WeakSet,B(this,"qc-test-loaded",this.#u.bind(this)),Sd(this,"qc-item-response-changed",this.#h.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),B(this,"qc-test-end-attempt",this.#l.bind(this)),B(this,"qc-test-update-outcome",this.#d.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=Bo(e);this.#s.set(e.identifier,r);let i=this.computedItemFor(e.identifier),n=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,Rc(n,r,i?.sessionControl?.maxAttempts,i?.adaptive,s))}afterAttemptEnded(t,e,r){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#c(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#p;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#l(t){let e=t.detail?.itemId,r=e?this.#c(e):this.activeAssessmentItem;if(!r)return;let i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#d(t){let e=this.#c(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#h(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}}}render(){return v`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let r=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#r({QTI_CONTEXT:{...r,testIdentifier:this.#o.identifier,environmentIdentifier:r.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(r=>{let i=this.#g(r);Object.keys(i).length>0&&this.#r({QTI_CONTEXT:{...i,...this.qtiContext.QTI_CONTEXT}})}),this.#m=Nd(Mc(this.#o)),this.computedContext=this.#f()}#m;#f(){return this.#v(),Xh({model:this.#m,itemFacts:this._itemFacts,testContext:this._testContext,sessionContext:this._sessionContext,infoItemCategory:this.configContext?.infoItemCategory,itemData:this.initContext,optimality:this.#s,itemElement:this.#p})}#v(){for(let t of this._testContext?.items??[]){if(!t.identifier||this.#s.has(t.identifier))continue;(Number(t.variables?.find(r=>r.identifier==="numAttempts")?.value)||0)>0&&this.#s.set(t.identifier,Bo(t))}}#g(t){let e={},r=t.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let s=n.getAttribute("field-identifier"),a=n.getAttribute("base-type")||"string",c=n.textContent?.trim()||"";if(s){let l=c;switch(a){case"integer":l=parseInt(c,10);break;case"float":case"duration":l=parseFloat(c);break;case"boolean":l=c.toLowerCase()==="true";break;default:l=c;break}e[s]=l}}),e}willUpdate(t){this.#m&&(this.computedContext=this.#f(),this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0})))}updated(t){super.updated(t),this.#y()}#b;#y(){if(!this.#o||!this.computedContext)return;let t=new Map(this.computedContext.testParts.flatMap(e=>e.submissionMode==="simultaneous"?[]:e.sections.flatMap(r=>r.items.map(i=>[i.identifier,i]))));for(let e of this.#o.querySelectorAll("qti-assessment-item-ref")){let r=e.assessmentItem;if(!r)continue;let i=this.#q(t.get(e.identifier),r);i&&!r.disabled?(r.disabled=!0,this.#b.add(r)):!i&&this.#b.has(r)&&(this.#b.delete(r),r.disabled=!1)}}#q(t,e){if(!t||this.autoScoreItems||t.adaptive||e.adaptive==="true")return!1;let r=t.sessionControl?.maxAttempts??1;return r>0&&(t.numAttempts??0)>=r}};je([p({type:String})],lt.prototype,"identifier",void 0);je([I()],lt.prototype,"initContext",void 0);je([I(),_({context:yt,subscribe:!0})],lt.prototype,"configContext",void 0);je([I(),_({context:nt,subscribe:!0})],lt.prototype,"_testContext",void 0);je([I(),_({context:lo,subscribe:!0})],lt.prototype,"_sessionContext",void 0);je([I(),_({context:Oo,subscribe:!0})],lt.prototype,"_itemFacts",void 0);je([I(),Q({context:ct})],lt.prototype,"computedContext",void 0);je([p({type:Boolean,attribute:"auto-score-items"})],lt.prototype,"autoScoreItems",void 0);var Uo=o=>{let t=o.sections.flatMap(r=>r.items);if(!o.itemOrder)return t;let e=new Map(t.map(r=>[r.identifier,r]));return o.itemOrder.flatMap(r=>e.get(r)??[])};var Pc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},hr=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[Ve,Hh]}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=Uo(e),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(i=>i.active);if(!t)return;let e=this.sectionItems[this.itemIndex],r=t.navigationMode==="linear"&&t.submissionMode==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||r&&!e?.done}_requestItem(t){j(this,"qc-test-navigate",{type:"item",id:t})}render(){return Le}};Pc([p({type:Boolean,reflect:!0,attribute:"disabled"})],hr.prototype,"_internalDisabled",void 0);Pc([_({context:ct,subscribe:!0})],hr.prototype,"computedContext",void 0);Pc([N("computedContext")],hr.prototype,"_handleTestElementChange",null);var Oc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pr=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=Ve}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=Uo(e),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let e=this.computedContext?.testParts.find(r=>r.active)?.navigationMode??"nonlinear";this._internalDisabled=e==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){j(this,"qc-test-navigate",{type:"item",id:t})}render(){return Le}};Oc([p({type:Boolean,reflect:!0,attribute:"disabled"})],pr.prototype,"_internalDisabled",void 0);Oc([_({context:ct,subscribe:!0})],pr.prototype,"computedContext",void 0);Oc([N("computedContext")],pr.prototype,"_handleTestElementChange",null);var Ho=class extends C{static{this.styles=Ve}constructor(){super(),this.addEventListener("click",()=>j(this,"qc-test-submit",{}))}render(){return Le}};var Yh=[{tag:"test-submit",ctor:Ho}];var Jh=[{tag:"qti-assessment-item-ref",ctor:wt},{tag:"qti-assessment-section",ctor:Yt},{tag:"qti-assessment-test",ctor:cr},{tag:"qti-branch-rule",ctor:he},{tag:"qti-item-session-control",ctor:Pt},{tag:"qti-number-presented",ctor:Gi},{tag:"qti-number-selected",ctor:mo},{tag:"qti-outcome-processing",ctor:go},{tag:"qti-pre-condition",ctor:fo},{tag:"qti-test",ctor:$e},{tag:"qti-test-feedback",ctor:cn},{tag:"qti-test-part",ctor:De},{tag:"qti-test-variables",ctor:ln},{tag:"test-container",ctor:kt},{tag:"test-end-attempt",ctor:be},{tag:"test-navigation",ctor:lt},{tag:"test-next",ctor:hr},{tag:"test-prev",ctor:pr},...Yh];for(let{tag:o,ctor:t}of Jh)customElements.get(o)||customElements.define(o,t);var $A=(o,t)=>o?.plugins?.[t];var ur=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Lt=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Jt().load(this.itemURL)).shuffleInteractions(t);this.itemDoc=e.htmlDoc(this.#e??void 0)}catch(t){console.error("Error loading or parsing XML:",t)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Jt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#r(){let t=this.querySelector("template");this.#t=t?t.content:v``}#i(){let t=new CSSStyleSheet;t.replaceSync(Vo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
6427
+ `;var fn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ep=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?ep(e.host):void 0},ve=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=je}constructor(){super(),this._internalDisabled=!1,this.requireAnswer=!1,this.addEventListener("click",t=>{if(t.preventDefault(),!this._internalDisabled){let e=this.#t;j(this,"qc-test-end-attempt",e?{itemId:e}:{})}})}get#t(){return this.item||ep(this)}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts,e=this.#t,r=t?.find(a=>a.active);if(!t||!e&&!r)return;let i=e?t.flatMap(a=>a.sections.flatMap(c=>c.items)).find(a=>a.identifier===e):r.sections.flatMap(a=>a.items).find(a=>a.active);if(!i){this._internalDisabled=!1;return}let n=i.sessionControl?.maxAttempts??1,s=i.numAttempts||0;if(!i.adaptive&&i.optimal){this._internalDisabled=!0;return}if(i.adaptive&&i.completionStatus==="completed"){this._internalDisabled=!0;return}if(!i.adaptive&&n>0&&s>=n){this._internalDisabled=!0;return}this.requireAnswer||i.sessionControl?.allowSkipping===!1?this._internalDisabled=i.valid===!1||i.isDefaultResponse:this._internalDisabled=!1}render(){return Ve}};fn([R({context:ct,subscribe:!0}),p({attribute:!1})],ve.prototype,"computedContext",void 0);fn([p({type:Boolean,reflect:!0,attribute:"disabled"})],ve.prototype,"_internalDisabled",void 0);fn([p({reflect:!0})],ve.prototype,"item",void 0);fn([p({type:Boolean,reflect:!0,attribute:"require-answer"})],ve.prototype,"requireAnswer",void 0);fn([N("computedContext")],ve.prototype,"_handleTestElementChange",null);function ip(o){let{model:t,sessionContext:e,itemElement:r}=o,i=Gf(t.testParts.flatMap(n=>pr(n.sections)),o.infoItemCategory);return{itemElement:r,identifier:t.identifier,title:t.title,view:e?.view,plugins:e?.plugins??{},testParts:t.testParts.map(n=>({active:e?.navPartId===n.identifier,identifier:n.identifier,navigationMode:n.navigationMode,submissionMode:n.submissionMode,allowSkipping:n.sessionControl.allowSkipping,itemOrder:pr(n.sections).map(s=>s.identifier),sections:qc(n.sections).map(s=>({active:e?.navSectionId===s.identifier,identifier:s.identifier,title:s.title,allowSkipping:s.sessionControl.allowSkipping,completed:pr(s.content).every(a=>ri(np(o,a.identifier),"completionStatus")==="completed"),items:Hd(s).map(a=>Wf(o,n,a,i.get(a.identifier)??null))}))}))}}function Wf(o,t,e,r){let i=np(o,e.identifier),n={active:!1,identifier:e.identifier,categories:[...e.categories],href:e.href,variables:[],sessionControl:{...e.sessionControl},...Xf(o.itemFacts,e.identifier),...i,...o.itemData?.find(w=>w.identifier===e.identifier)},s=ri(n,"SCORE"),a=s==null?null:parseFloat(s.toString()),c=ri(n,"MAXSCORE"),l=c==null?null:parseFloat(c.toString()),d=ri(n,"completionStatus"),h=ri(n,"RESPONSE")||"",f=Number(ri(n,"numAttempts"))||0,m=o.optimality.get(e.identifier),y=m??(i?Wo(i):"unscored");return{...n,completionStatus:d,numAttempts:f,score:a,response:h,index:r,active:o.sessionContext?.navItemRefId===e.identifier,valid:i?.valid??!0,isDefaultResponse:op(i),maxScore:l,done:Dc(f,y,n.sessionControl?.maxAttempts,n.adaptive,d),optimal:m==="optimal",...Qf(o,t,e,i,{numAttempts:f,completionStatus:d})}}function Qf(o,t,e,r,{numAttempts:i,completionStatus:n}){let s={sessionControl:e.sessionControl,adaptive:o.itemFacts?.get(e.identifier)?.adaptive??!1,navigationMode:t.navigationMode,submissionMode:t.submissionMode,numAttempts:i,completionStatus:n??null},a=o.lifecycle?.get(e.identifier)??Ki({...s,presented:o.sessionContext?.navItemRefId===e.identifier,passed:!1}),c=Xd({...s,state:a,left:!1,modalFeedback:!1,skipped:Yf(r),valid:r?.valid??!0});return{lifecycle:a,rules:c}}function np(o,t){return o.testContext?.items?.find(e=>e.identifier===t)}function ri(o,t){return o?.variables?.find(e=>e.identifier===t)?.value}function Xf(o,t){let e=o?.get(t);if(!e)return{};let{identifier:r,...i}=e;return{...i,assessmentItemIdentifier:r}}function Gf(o,t){let e=1;return new Map(o.map(r=>[r.identifier,r.categories.includes(t)?null:e++]))}function Yf(o){return o?!!o.variables?.filter(e=>e.type==="response"&&e.identifier!=="numAttempts"&&e.identifier!=="duration")?.length&&op(o):!0}function op(o){return(o?.variables?.filter(e=>e.type==="response"&&e.identifier!=="numAttempts")||[]).every(e=>{if(e.value===void 0||e.value===null)return!0;let r;switch(e.baseType){case"integer":case"float":case"duration":r="0";break;case"boolean":r="false";break;default:r="";break}let i=e.defaultValue??r;if(Array.isArray(e.value)){let n=Array.isArray(i)?i:[i];return e.value.length===n.length&&e.value.every((s,a)=>s===n[a])}return e.value===i})}function Dc(o,t,e,r,i){if(o===0)return!1;if(r)return i==="completed";if(t!=="suboptimal")return!0;let n=e??1;return n>0&&o>=n}function Wo(o){let t=o.variables??[],e=rp(t,"SCORE"),r=rp(t,"MAXSCORE");if(e!==null&&r!==null)return e>=r?"optimal":"suboptimal";let i=t.filter(s=>s.type==="response"&&s.correctResponse!==void 0&&s.correctResponse!==null);return i.length===0?"unscored":i.every(s=>{let a=s.correctResponse,c=s.value;return c==null?!1:Array.isArray(a)&&Array.isArray(c)?a.length===c.length&&a.every(l=>c.includes(l)):Array.isArray(a)||Array.isArray(c)?!1:a===c})?"optimal":"suboptimal"}function rp(o,t){let e=o?.find(i=>i.identifier===t)?.value;if(e==null||Array.isArray(e))return null;let r=parseFloat(e.toString());return Number.isNaN(r)?null:r}function sp(o,t,e,{current:r,presented:i}){let n=new Map;for(let s of o.testParts){let a=pr(s.sections),c=a.findIndex(l=>l.identifier===r);a.forEach((l,d)=>{let h=e?.find(f=>f.identifier===l.identifier);n.set(l.identifier,{...$c(h),sessionControl:l.sessionControl,adaptive:t?.get(l.identifier)?.adaptive??!1,navigationMode:s.navigationMode,submissionMode:s.submissionMode,presented:i.has(l.identifier),passed:s.navigationMode==="linear"&&c>=0&&d<c})})}return n}function $c(o){let t=r=>o?.variables?.find(i=>i.identifier===r)?.value,e=t("completionStatus");return{numAttempts:Number(t("numAttempts"))||0,completionStatus:typeof e=="string"?e:null}}function Nc(o){return{nodeType:o.nodeType,localName:o.localName,get childNodes(){return Array.from(o.children,Nc)},getAttribute:t=>o.getAttribute(t)??(t==="title"?o.getAttribute("data-title"):null)}}var Fe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Jf=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),lt=class extends C{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=Jf())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#r(t)}#t;#e;#r(t){let e=this.#n();e?e.qtiContext=t:this.#t=t}#i;#n(){return this.#i.value??null}#o;#s;#a;#c;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#i=new at(this,{context:Ae,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#a=new Map,this.#c=!1,this.#m=t=>this.#u(t)??null,this.#q=new WeakSet,B(this,"qc-test-loaded",this.#v.bind(this)),_d(this,"qc-item-response-changed",this.#g.bind(this)),this.addEventListener("qti-item-context-updated",this.#p.bind(this)),B(this,"qc-test-end-attempt",this.#f.bind(this)),B(this,"qc-test-update-outcome",this.#b.bind(this))}#p(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=Wo(e);this.#s.set(e.identifier,r),this.#l(e);let i=this.computedItemFor(e.identifier),n=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,Dc(n,r,i?.sessionControl?.maxAttempts,i?.adaptive,s))}#l(t){let e=this.#d().get(t.identifier);if(!e)return;let r={...e,...$c(t)},i=this.#a.get(t.identifier);this.#a.set(t.identifier,this.#c?{state:i?.state??wc(void 0,r).state,numAttempts:r.numAttempts}:Yd(i,r))}#d(){if(!this.#y)return new Map;let t=new Set([...this.#o?.querySelectorAll("qti-assessment-item-ref")??[]].filter(e=>e.assessmentItem).map(e=>e.identifier));return sp(this.#y,this._itemFacts,this._testContext?.items,{current:this._sessionContext?.navItemRefId,presented:t})}#h(){for(let[t,e]of this.#d())this.#a.set(t,wc(this.#a.get(t),e))}afterAttemptEnded(t,e,r){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#u(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#m;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#f(t){let e=t.detail?.itemId,r=e?this.#u(e):this.activeAssessmentItem;if(!r)return;let i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#b(t){let e=this.#u(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#g(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;this.#c=!0;try{e.processResponse(!0,i)}finally{this.#c=!1}}}}render(){return v`<slot></slot>`}#v(t){if(this.#o=t.detail,this.#s.clear(),this.#a.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let r=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#r({QTI_CONTEXT:{...r,testIdentifier:this.#o.identifier,environmentIdentifier:r.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(r=>{let i=this.#C(r);Object.keys(i).length>0&&this.#r({QTI_CONTEXT:{...i,...this.qtiContext.QTI_CONTEXT}})}),this.#y=zd(Nc(this.#o)),this.computedContext=this.#w()}#y;#w(){return this.#x(),this.#h(),ip({model:this.#y,itemFacts:this._itemFacts,testContext:this._testContext,sessionContext:this._sessionContext,infoItemCategory:this.configContext?.infoItemCategory,itemData:this.initContext,optimality:this.#s,lifecycle:new Map([...this.#a].map(([t,e])=>[t,e.state])),itemElement:this.#m})}#x(){for(let t of this._testContext?.items??[]){if(!t.identifier||this.#s.has(t.identifier))continue;(Number(t.variables?.find(r=>r.identifier==="numAttempts")?.value)||0)>0&&this.#s.set(t.identifier,Wo(t))}}#C(t){let e={},r=t.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let s=n.getAttribute("field-identifier"),a=n.getAttribute("base-type")||"string",c=n.textContent?.trim()||"";if(s){let l=c;switch(a){case"integer":l=parseInt(c,10);break;case"float":case"duration":l=parseFloat(c);break;case"boolean":l=c.toLowerCase()==="true";break;default:l=c;break}e[s]=l}}),e}willUpdate(t){this.#y&&(this.computedContext=this.#w(),this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0})))}updated(t){super.updated(t),this.#k()}#q;#k(){if(!this.#o||!this.computedContext)return;let t=new Map(this.computedContext.testParts.flatMap(e=>e.submissionMode==="simultaneous"?[]:e.sections.flatMap(r=>r.items.map(i=>[i.identifier,i]))));for(let e of this.#o.querySelectorAll("qti-assessment-item-ref")){let r=e.assessmentItem;if(!r)continue;let i=this.#E(t.get(e.identifier),r);i&&!r.disabled?(r.disabled=!0,this.#q.add(r)):!i&&this.#q.has(r)&&(this.#q.delete(r),r.disabled=!1)}}#E(t,e){if(!t||this.autoScoreItems||t.adaptive||e.adaptive==="true")return!1;let r=t.sessionControl?.maxAttempts??1;return r>0&&(t.numAttempts??0)>=r}};Fe([p({type:String})],lt.prototype,"identifier",void 0);Fe([T()],lt.prototype,"initContext",void 0);Fe([T(),R({context:yt,subscribe:!0})],lt.prototype,"configContext",void 0);Fe([T(),R({context:nt,subscribe:!0})],lt.prototype,"_testContext",void 0);Fe([T(),R({context:po,subscribe:!0})],lt.prototype,"_sessionContext",void 0);Fe([T(),R({context:No,subscribe:!0})],lt.prototype,"_itemFacts",void 0);Fe([T(),Q({context:ct})],lt.prototype,"computedContext",void 0);Fe([p({type:Boolean,attribute:"auto-score-items"})],lt.prototype,"autoScoreItems",void 0);var Qo=o=>{let t=o.sections.flatMap(r=>r.items);if(!o.itemOrder)return t;let e=new Map(t.map(r=>[r.identifier,r]));return o.itemOrder.flatMap(r=>e.get(r)??[])};var Lc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ur=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[je,tp]}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=Qo(e),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(i=>i.active);if(!t)return;let e=this.sectionItems[this.itemIndex],r=t.navigationMode==="linear"&&t.submissionMode==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||r&&!e?.done}_requestItem(t){j(this,"qc-test-navigate",{type:"item",id:t})}render(){return Ve}};Lc([p({type:Boolean,reflect:!0,attribute:"disabled"})],ur.prototype,"_internalDisabled",void 0);Lc([R({context:ct,subscribe:!0})],ur.prototype,"computedContext",void 0);Lc([N("computedContext")],ur.prototype,"_handleTestElementChange",null);var Vc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},mr=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=je}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=Qo(e),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let e=this.computedContext?.testParts.find(r=>r.active)?.navigationMode??"nonlinear";this._internalDisabled=e==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){j(this,"qc-test-navigate",{type:"item",id:t})}render(){return Ve}};Vc([p({type:Boolean,reflect:!0,attribute:"disabled"})],mr.prototype,"_internalDisabled",void 0);Vc([R({context:ct,subscribe:!0})],mr.prototype,"computedContext",void 0);Vc([N("computedContext")],mr.prototype,"_handleTestElementChange",null);var Xo=class extends C{static{this.styles=je}constructor(){super(),this.addEventListener("click",()=>j(this,"qc-test-submit",{}))}render(){return Ve}};var ap=[{tag:"test-submit",ctor:Xo}];var cp=[{tag:"qti-assessment-item-ref",ctor:xt},{tag:"qti-assessment-section",ctor:Yt},{tag:"qti-assessment-test",ctor:lr},{tag:"qti-branch-rule",ctor:pe},{tag:"qti-item-session-control",ctor:Pt},{tag:"qti-number-presented",ctor:Ji},{tag:"qti-number-selected",ctor:go},{tag:"qti-outcome-processing",ctor:vo},{tag:"qti-pre-condition",ctor:bo},{tag:"qti-test",ctor:Ne},{tag:"qti-test-feedback",ctor:dn},{tag:"qti-test-part",ctor:$e},{tag:"qti-test-variables",ctor:hn},{tag:"test-container",ctor:kt},{tag:"test-end-attempt",ctor:ve},{tag:"test-navigation",ctor:lt},{tag:"test-next",ctor:ur},{tag:"test-prev",ctor:mr},...ap];for(let{tag:o,ctor:t}of cp)customElements.get(o)||customElements.define(o,t);var nI=(o,t)=>o?.plugins?.[t];var fr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Lt=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Kt().load(this.itemURL)).shuffleInteractions(t);this.itemDoc=e.htmlDoc(this.#e??void 0)}catch(t){console.error("Error loading or parsing XML:",t)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Kt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#r(){let t=this.querySelector("template");this.#t=t?t.content:v``}#i(){let t=new CSSStyleSheet;t.replaceSync(zo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
6428
6428
  ${this.#t}
6429
6429
  <slot></slot>
6430
- ${Lo(this.itemDoc,v`<span>Loading...</span>`)}
6431
- `}};ur([p({attribute:!1})],Lt.prototype,"customElementRegistry",void 0);ur([p({type:String,attribute:"item-url"})],Lt.prototype,"itemURL",void 0);ur([I()],Lt.prototype,"itemDoc",void 0);ur([I()],Lt.prototype,"itemXML",void 0);ur([I(),_({context:qt,subscribe:!0})],Lt.prototype,"qtiContext",void 0);ur([N("itemURL",{waitUntilFirstUpdate:!0})],Lt.prototype,"handleItemURLChange",null);ur([N("itemXML",{waitUntilFirstUpdate:!0})],Lt.prototype,"handleItemXMLChange",null);var Lf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},mn=class extends C{static{this.styles=w`
6430
+ ${Fo(this.itemDoc,v`<span>Loading...</span>`)}
6431
+ `}};fr([p({attribute:!1})],Lt.prototype,"customElementRegistry",void 0);fr([p({type:String,attribute:"item-url"})],Lt.prototype,"itemURL",void 0);fr([T()],Lt.prototype,"itemDoc",void 0);fr([T()],Lt.prototype,"itemXML",void 0);fr([T(),R({context:qt,subscribe:!0})],Lt.prototype,"qtiContext",void 0);fr([N("itemURL",{waitUntilFirstUpdate:!0})],Lt.prototype,"handleItemURLChange",null);fr([N("itemXML",{waitUntilFirstUpdate:!0})],Lt.prototype,"handleItemXMLChange",null);var Kf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gn=class extends C{static{this.styles=x`
6432
6432
  table {
6433
6433
  width: 100%;
6434
6434
  border-collapse: collapse;
@@ -6475,7 +6475,7 @@ div.full-correct-response-inline {
6475
6475
  </table>
6476
6476
  `;return v`
6477
6477
  ${i(e,"Response Variables")} ${i(r,"Outcome Variables")}
6478
- `}};Lf([_({context:Ee,subscribe:!0})],mn.prototype,"computedContext",void 0);var Vf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Kh=o=>{class t extends o{#t;constructor(...r){super(...r),this.view="candidate",this.addEventListener("qti-assessment-item-connected",i=>{this.#t=i.detail,this.#e()}),this.addEventListener("item-switch-view",i=>{this.view=i.detail})}willUpdate(r){super.willUpdate(r),r.has("view")&&this.#e()}#e(){let r=this.#t;r&&(r.querySelectorAll("[view]").forEach(i=>{i.classList.toggle("show",i.getAttribute("view")===this.view)}),this.updateAssessmentItemView(r,this.view))}updateAssessmentItemView(r,i){}}return Vf([p({type:String})],t.prototype,"view",void 0),t};var Dc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ve=class extends Kh(C){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#r.bind(this),this.#e=this.#i.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#r(t){this.#n(t.detail.itemContext.identifier,t.detail?.itemContext?.variables||[])}#i(t){let e=t.detail._context.variables;this.assessmentItem=t.detail,this.computedContext=this.computedContext?.identifier===this.assessmentItem.identifier?{...this.computedContext,title:this.assessmentItem.title}:{identifier:this.assessmentItem.identifier,title:this.assessmentItem.title,adaptive:this.assessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:e},this.#n(this.assessmentItem.identifier,e||[])}#n(t,e){let r=e?.find(l=>l.identifier=="SCORE")?.value,i=parseFloat(r?.toString()),n=e?.find(l=>l.identifier==="completionStatus")?.value,s=i!==void 0&&!isNaN(i)&&i>0,a=i!==void 0&&!isNaN(i)&&i<=0,c=n==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:c,variables:e}}render(){return v`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};Dc([I(),Q({context:Ee})],ve.prototype,"computedContext",void 0);Dc([I(),Q({context:yt})],ve.prototype,"configContext",void 0);Dc([I(),Q({context:qt})],ve.prototype,"qtiContext",void 0);var Zh=[{tag:"item-container",ctor:Lt},{tag:"item-print-variables",ctor:mn},{tag:"qti-item",ctor:ve}];for(let{tag:o,ctor:t}of Zh)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ah)customElements.get(o)||customElements.define(o,t);var tp=(o,t,e)=>{let r=new Map;for(let i=t;i<=e;i++)r.set(o[i],i);return r},H=$t(class extends Me{constructor(o){if(super(o),o.type!==Kr.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let i=[],n=[],s=0;for(let a of o)i[s]=r?r(a,s):s,n[s]=e(a,s),s++;return{values:n,keys:i}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,r]){let i=Eh(o),{values:n,keys:s}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=s,n;let a=this.ut??=[],c=[],l,d,h=0,f=i.length-1,m=0,y=n.length-1;for(;h<=f&&m<=y;)if(i[h]===null)h++;else if(i[f]===null)f--;else if(a[h]===s[m])c[m]=Pe(i[h],n[m]),h++,m++;else if(a[f]===s[y])c[y]=Pe(i[f],n[y]),f--,y--;else if(a[h]===s[y])c[y]=Pe(i[h],n[y]),Zr(o,c[y+1],i[h]),h++,y--;else if(a[f]===s[m])c[m]=Pe(i[f],n[m]),Zr(o,i[h],i[f]),f--,m++;else if(l===void 0&&(l=tp(s,m,y),d=tp(a,h,f)),l.has(a[h]))if(l.has(a[f])){let x=d.get(s[m]),u=x!==void 0?i[x]:null;if(u===null){let g=Zr(o,i[h]);Pe(g,n[m]),c[m]=g}else c[m]=Pe(u,n[m]),Zr(o,i[h],u),i[x]=null;m++}else To(i[f]),f--;else To(i[h]),h++;for(;m<=y;){let x=Zr(o,c[y+1]);Pe(x,n[m]),c[m++]=x}for(;h<=f;){let x=i[h++];x!==null&&To(x)}return this.ut=s,kh(o,c),it}});var Fe=Symbol("dragDropContext");var ep=[R,Qt,w`
6478
+ `}};Kf([R({context:Se,subscribe:!0})],gn.prototype,"computedContext",void 0);var Zf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lp=o=>{class t extends o{#t;constructor(...r){super(...r),this.view="candidate",this.addEventListener("qti-assessment-item-connected",i=>{this.#t=i.detail,this.#e()}),this.addEventListener("item-switch-view",i=>{this.view=i.detail})}willUpdate(r){super.willUpdate(r),r.has("view")&&this.#e()}#e(){let r=this.#t;r&&(r.querySelectorAll("[view]").forEach(i=>{i.classList.toggle("show",i.getAttribute("view")===this.view)}),this.updateAssessmentItemView(r,this.view))}updateAssessmentItemView(r,i){}}return Zf([p({type:String})],t.prototype,"view",void 0),t};var jc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ye=class extends lp(C){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#r.bind(this),this.#e=this.#i.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#r(t){this.#n(t.detail.itemContext.identifier,t.detail?.itemContext?.variables||[])}#i(t){let e=t.detail._context.variables;this.assessmentItem=t.detail,this.computedContext=this.computedContext?.identifier===this.assessmentItem.identifier?{...this.computedContext,title:this.assessmentItem.title}:{identifier:this.assessmentItem.identifier,title:this.assessmentItem.title,adaptive:this.assessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:e},this.#n(this.assessmentItem.identifier,e||[])}#n(t,e){let r=e?.find(l=>l.identifier=="SCORE")?.value,i=parseFloat(r?.toString()),n=e?.find(l=>l.identifier==="completionStatus")?.value,s=i!==void 0&&!isNaN(i)&&i>0,a=i!==void 0&&!isNaN(i)&&i<=0,c=n==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:c,variables:e}}render(){return v`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};jc([T(),Q({context:Se})],ye.prototype,"computedContext",void 0);jc([T(),Q({context:yt})],ye.prototype,"configContext",void 0);jc([T(),Q({context:qt})],ye.prototype,"qtiContext",void 0);var dp=[{tag:"item-container",ctor:Lt},{tag:"item-print-variables",ctor:gn},{tag:"qti-item",ctor:ye}];for(let{tag:o,ctor:t}of dp)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of $h)customElements.get(o)||customElements.define(o,t);var hp=(o,t,e)=>{let r=new Map;for(let i=t;i<=e;i++)r.set(o[i],i);return r},H=$t(class extends Pe{constructor(o){if(super(o),o.type!==ti.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let i=[],n=[],s=0;for(let a of o)i[s]=r?r(a,s):s,n[s]=e(a,s),s++;return{values:n,keys:i}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,r]){let i=Oh(o),{values:n,keys:s}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=s,n;let a=this.ut??=[],c=[],l,d,h=0,f=i.length-1,m=0,y=n.length-1;for(;h<=f&&m<=y;)if(i[h]===null)h++;else if(i[f]===null)f--;else if(a[h]===s[m])c[m]=Oe(i[h],n[m]),h++,m++;else if(a[f]===s[y])c[y]=Oe(i[f],n[y]),f--,y--;else if(a[h]===s[y])c[y]=Oe(i[h],n[y]),ei(o,c[y+1],i[h]),h++,y--;else if(a[f]===s[m])c[m]=Oe(i[f],n[m]),ei(o,i[h],i[f]),f--,m++;else if(l===void 0&&(l=hp(s,m,y),d=hp(a,h,f)),l.has(a[h]))if(l.has(a[f])){let w=d.get(s[m]),u=w!==void 0?i[w]:null;if(u===null){let g=ei(o,i[h]);Oe(g,n[m]),c[m]=g}else c[m]=Oe(u,n[m]),ei(o,i[h],u),i[w]=null;m++}else _o(i[f]),f--;else _o(i[h]),h++;for(;m<=y;){let w=ei(o,c[y+1]);Oe(w,n[m]),c[m++]=w}for(;h<=f;){let w=i[h++];w!==null&&_o(w)}return this.ut=s,Ph(o,c),it}});var ze=Symbol("dragDropContext");var pp=[_,Qt,x`
6479
6479
  /* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
6480
6480
  custom properties on its host; the properties themselves live here. */
6481
6481
  :host {
@@ -6499,9 +6499,9 @@ div.full-correct-response-inline {
6499
6499
  [part~='chip'] {
6500
6500
  flex-shrink: 0;
6501
6501
  }
6502
- `];var rp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ei=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=ep}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return v`<div part="drop">
6502
+ `];var up=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ii=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=pp}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return v`<div part="drop">
6503
6503
  ${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6504
- </div>`}};rp([p({type:String,reflect:!0})],ei.prototype,"identifier",void 0);rp([_({context:Fe,subscribe:!0}),I()],ei.prototype,"_dragDrop",void 0);var ip=[{tag:"qti-associable-hotspot",ctor:ei}];var np=[R,Qt,w`
6504
+ </div>`}};up([p({type:String,reflect:!0})],ii.prototype,"identifier",void 0);up([R({context:ze,subscribe:!0}),T()],ii.prototype,"_dragDrop",void 0);var mp=[{tag:"qti-associable-hotspot",ctor:ii}];var fp=[_,Qt,x`
6505
6505
  /*
6506
6506
  * A drop target. The interaction measures its chips and publishes the result as custom
6507
6507
  * properties on its own host; the actual CSS properties live here, not in a style attribute.
@@ -6546,9 +6546,9 @@ div.full-correct-response-inline {
6546
6546
  min-height: var(--qti-dropzone-min-height, 0);
6547
6547
  min-width: var(--qti-dropzone-min-width, 0);
6548
6548
  }
6549
- `];var $c=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},mr=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=np}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`<div part="drop">
6549
+ `];var Fc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gr=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=fp}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`<div part="drop">
6550
6550
  ${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6551
- </div>`}};$c([p({type:Number,reflect:!0})],mr.prototype,"tabindex",void 0);$c([p({type:String,reflect:!0})],mr.prototype,"identifier",void 0);$c([_({context:Fe,subscribe:!0}),I()],mr.prototype,"_dragDrop",void 0);var op=[{tag:"qti-gap",ctor:mr}];var sp=[R,w`
6551
+ </div>`}};Fc([p({type:Number,reflect:!0})],gr.prototype,"tabindex",void 0);Fc([p({type:String,reflect:!0})],gr.prototype,"identifier",void 0);Fc([R({context:ze,subscribe:!0}),T()],gr.prototype,"_dragDrop",void 0);var gp=[{tag:"qti-gap",ctor:gr}];var bp=[_,x`
6552
6552
  /* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
6553
6553
  graphic-gap-match rules, on the host from the document. */
6554
6554
  :host {
@@ -6561,7 +6561,7 @@ div.full-correct-response-inline {
6561
6561
  anywhere else it is unset and the chip keeps its size. */
6562
6562
  zoom: var(--qti-graphic-scale, 1);
6563
6563
  }
6564
- `];var jf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fn=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=sp}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<slot part="label"></slot>`}};jf([p({type:Number,reflect:!0})],fn.prototype,"tabindex",void 0);var ap=[{tag:"qti-gap-img",ctor:fn}];var fr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},cp={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function Et(o,t,{activateOn:e="click"}={}){class r extends o{#t;#e;#r(){let s=this._interactionContext?.choiceRole??null;s!==this.#e&&(this.#e&&this.internals.states.delete(this.#e),this.#e=s,this.internals.role=s,s&&this.internals.states.add(s))}handleDisabledChange(n,s){s?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=s?-1:0}handleReadonlyChange(n,s){s?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...n){super(...n),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=!1,this.#e=null,this._onMouseDown=s=>{this.disabled&&s.preventDefault()},this._onPointerDown=s=>{this.#t=!1,!(e!=="press"||s.button!==0||!s.isPrimary)&&(this.hasAttribute("data-draggable")||this.disabled||this.readonly||(this.#t=!0,this.focus(),this._activate()))},this.internals=this.attachInternals()}willUpdate(n){super.willUpdate(n),this.#r()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.addEventListener("pointerdown",this._onPointerDown),this.addEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.removeEventListener("pointerdown",this._onPointerDown),this.removeEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(n){n.altKey||(n.code==="Space"||n.code==="Enter")&&(n.preventDefault(),this._activate())}_onClick(){if(this.#t){this.#t=!1;return}this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return v`<slot></slot>`}}return fr([p({type:String})],r.prototype,"identifier",void 0),fr([p({type:Number,reflect:!0,attribute:"tabindex"})],r.prototype,"tabIndex",void 0),fr([p({type:Boolean,attribute:"aria-disabled",converter:cp})],r.prototype,"disabled",void 0),fr([p({type:Boolean,attribute:"aria-readonly",converter:cp})],r.prototype,"readonly",void 0),fr([_({context:Or,subscribe:!0}),I()],r.prototype,"_interactionContext",void 0),fr([N("disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",null),fr([N("readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",null),r}var lp=[R,w`
6564
+ `];var tg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bn=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=bp}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<slot part="label"></slot>`}};tg([p({type:Number,reflect:!0})],bn.prototype,"tabindex",void 0);var vp=[{tag:"qti-gap-img",ctor:bn}];var br=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},yp={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function Et(o,t,{activateOn:e="click"}={}){class r extends o{#t;#e;#r(){let s=this._interactionContext?.choiceRole??null;s!==this.#e&&(this.#e&&this.internals.states.delete(this.#e),this.#e=s,this.internals.role=s,s&&this.internals.states.add(s))}handleDisabledChange(n,s){s?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=s?-1:0}handleReadonlyChange(n,s){s?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...n){super(...n),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=!1,this.#e=null,this._onMouseDown=s=>{this.disabled&&s.preventDefault()},this._onPointerDown=s=>{this.#t=!1,!(e!=="press"||s.button!==0||!s.isPrimary)&&(this.hasAttribute("data-draggable")||this.disabled||this.readonly||(this.#t=!0,this.focus(),this._activate()))},this.internals=this.attachInternals()}willUpdate(n){super.willUpdate(n),this.#r()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.addEventListener("pointerdown",this._onPointerDown),this.addEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.removeEventListener("pointerdown",this._onPointerDown),this.removeEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(n){n.altKey||(n.code==="Space"||n.code==="Enter")&&(n.preventDefault(),this._activate())}_onClick(){if(this.#t){this.#t=!1;return}this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return v`<slot></slot>`}}return br([p({type:String})],r.prototype,"identifier",void 0),br([p({type:Number,reflect:!0,attribute:"tabindex"})],r.prototype,"tabIndex",void 0),br([p({type:Boolean,attribute:"aria-disabled",converter:yp})],r.prototype,"disabled",void 0),br([p({type:Boolean,attribute:"aria-readonly",converter:yp})],r.prototype,"readonly",void 0),br([R({context:$r,subscribe:!0}),T()],r.prototype,"_interactionContext",void 0),br([N("disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",null),br([N("readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",null),r}var qp=[_,x`
6565
6565
  /*
6566
6566
  * A chip's own box. Both drag-drop interactions that use this element laid it out from the
6567
6567
  * theme — gap-match with 'display: flex !important; align-items: center !important',
@@ -6604,8 +6604,8 @@ div.full-correct-response-inline {
6604
6604
  align-items: center;
6605
6605
  justify-content: center;
6606
6606
  }
6607
- `];var Ff=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ze=class extends Et(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=lp}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<div part="control"></div>
6608
- <slot part="label"></slot>`}};Ff([p({type:Number,reflect:!0})],ze.prototype,"tabindex",void 0);var dp=[{tag:"qti-gap-text",ctor:ze}];var hp=[R,w`
6607
+ `];var eg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Be=class extends Et(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=qp}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<div part="control"></div>
6608
+ <slot part="label"></slot>`}};eg([p({type:Number,reflect:!0})],Be.prototype,"tabindex",void 0);var wp=[{tag:"qti-gap-text",ctor:Be}];var xp=[_,x`
6609
6609
  :host {
6610
6610
  display: flex;
6611
6611
  user-select: none;
@@ -6625,7 +6625,7 @@ div.full-correct-response-inline {
6625
6625
  display: grid;
6626
6626
  place-content: center;
6627
6627
  }
6628
- `];var zf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gr=class extends Et(C,"qti-hotspot-choice"){static{this.styles=hp}updated(t){super.updated(t),t.has("order")&&(this.order===void 0||this.order===null?this.removeAttribute("data-order"):this.setAttribute("data-order",String(this.order)))}};zf([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],gr.prototype,"order",void 0);var pp=[{tag:"qti-hotspot-choice",ctor:gr}];var up=[R,w`
6628
+ `];var rg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vr=class extends Et(C,"qti-hotspot-choice"){static{this.styles=xp}updated(t){super.updated(t),t.has("order")&&(this.order===void 0||this.order===null?this.removeAttribute("data-order"):this.setAttribute("data-order",String(this.order)))}};rg([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],vr.prototype,"order",void 0);var Cp=[{tag:"qti-hotspot-choice",ctor:vr}];var kp=[_,x`
6629
6629
  /* 'position: relative' is the containing block for the answer-key tick the theme draws as an
6630
6630
  absolutely positioned ::before. See CONTRACT.md §7. */
6631
6631
  :host {
@@ -6645,8 +6645,8 @@ div.full-correct-response-inline {
6645
6645
  [part='control'] {
6646
6646
  display: none;
6647
6647
  }
6648
- `];var br=class extends Et(C,"qti-hottext"){static{this.styles=up}render(){return v`<div part="control"><div part="control-mark"></div></div>
6649
- <slot part="label"></slot>`}};var mp=[{tag:"qti-hottext",ctor:br}];var Bf=w`
6648
+ `];var yr=class extends Et(C,"qti-hottext"){static{this.styles=kp}render(){return v`<div part="control"><div part="control-mark"></div></div>
6649
+ <slot part="label"></slot>`}};var Ep=[{tag:"qti-hottext",ctor:yr}];var ig=x`
6650
6650
  /*
6651
6651
  * An option row: one line, clipped, with its text centred against the row's min-height. All four
6652
6652
  * were in the theme, set on this host from the document — which is also why the 'display: block'
@@ -6669,13 +6669,13 @@ div.full-correct-response-inline {
6669
6669
  slot {
6670
6670
  display: inline;
6671
6671
  }
6672
- `,fp=Bf;var Uf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gn=class extends Et(C,"qti-inline-choice"){static{this.styles=fp}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#t),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#t)}render(){return v` <slot></slot> `}#t(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};Uf([p({type:String})],gn.prototype,"identifier",void 0);var gp=[{tag:"qti-inline-choice",ctor:gn}];var bp=[R,w`
6672
+ `,Sp=ig;var ng=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vn=class extends Et(C,"qti-inline-choice"){static{this.styles=Sp}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#t),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#t)}render(){return v` <slot></slot> `}#t(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};ng([p({type:String})],vn.prototype,"identifier",void 0);var Ap=[{tag:"qti-inline-choice",ctor:vn}];var Ip=[_,x`
6673
6673
  :host {
6674
6674
  display: block;
6675
6675
  margin: var(--qti-gap) 0;
6676
6676
  width: 100%;
6677
6677
  }
6678
- `];var Wo=class extends C{static{this.styles=bp}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var vp=[{tag:"qti-prompt",ctor:Wo}];var yp=[R,Qt,w`
6678
+ `];var Go=class extends C{static{this.styles=Ip}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var Tp=[{tag:"qti-prompt",ctor:Go}];var Rp=[_,Qt,x`
6679
6679
  /*
6680
6680
  * 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
6681
6681
  * way. In tabular match this element is a light-DOM *grandchild* of the slotted
@@ -6824,13 +6824,13 @@ div.full-correct-response-inline {
6824
6824
  align-items: center;
6825
6825
  justify-content: center;
6826
6826
  }
6827
- `];var Qo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Vt=class extends Et(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=yp}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`
6827
+ `];var Yo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Vt=class extends Et(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=Rp}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`
6828
6828
  <div part="control"></div>
6829
6829
  <slot part="label"></slot>
6830
6830
  <div part="drop">
6831
6831
  ${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
6832
6832
  </div>
6833
- `}};Qo([p({type:Number,attribute:"match-min"})],Vt.prototype,"matchMin",void 0);Qo([p({type:Number,attribute:"match-max"})],Vt.prototype,"matchMax",void 0);Qo([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Vt.prototype,"fixed",void 0);Qo([_({context:Fe,subscribe:!0}),I()],Vt.prototype,"_dragDrop",void 0);var qp=[{tag:"qti-simple-associable-choice",ctor:Vt}];var xp=[R,w`
6833
+ `}};Yo([p({type:Number,attribute:"match-min"})],Vt.prototype,"matchMin",void 0);Yo([p({type:Number,attribute:"match-max"})],Vt.prototype,"matchMax",void 0);Yo([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Vt.prototype,"fixed",void 0);Yo([R({context:ze,subscribe:!0}),T()],Vt.prototype,"_dragDrop",void 0);var _p=[{tag:"qti-simple-associable-choice",ctor:Vt}];var Mp=[_,x`
6834
6834
  /*
6835
6835
  * 'position: relative' unconditionally, because this element can carry a correction badge and a
6836
6836
  * badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
@@ -6866,9 +6866,9 @@ div.full-correct-response-inline {
6866
6866
  align-items: center;
6867
6867
  justify-content: center;
6868
6868
  }
6869
- `];var Xo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},jt=class extends Et(C,"qti-simple-choice",{activateOn:"press"}){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=xp}get checked(){return this.internals.states.has("checked")}render(){return v`<div part="control"><div part="control-mark"></div></div>
6869
+ `];var Jo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},jt=class extends Et(C,"qti-simple-choice",{activateOn:"press"}){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=Mp}get checked(){return this.internals.states.has("checked")}render(){return v`<div part="control"><div part="control-mark"></div></div>
6870
6870
  ${this.marker?v`<div id="label" part="marker">${this.marker}</div>`:P}
6871
- <slot part="label"></slot>`}};Xo([p({type:String,attribute:"template-identifier"})],jt.prototype,"templateIdentifier",void 0);Xo([p({type:String,attribute:"show-hide"})],jt.prototype,"showHide",void 0);Xo([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],jt.prototype,"fixed",void 0);Xo([p({type:String,attribute:!1})],jt.prototype,"marker",void 0);var wp=[{tag:"qti-simple-choice",ctor:jt}];var Cp=[...ip,...op,...ap,...dp,...pp,...mp,...gp,...vp,...qp,...wp];var Hf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n};function Wf(o,t,e,r,i={}){let n=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,c=0,l=r.length?r:[o],d=l.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));l.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),c=Math.max(c,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:c})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(o.style.setProperty("--qti-dropzone-min-width",`${c}px`),o.style.setProperty("--qti-drag-min-width",`${c}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(h.style.setProperty("--qti-dropzone-min-width",`${c}px`),h.style.setProperty("--qti-drag-min-width",`${c}px`))}))}var Nc=(o,t,e,r='slot[part~="bank"]')=>{class i extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#i=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#i;#n;collectAutoSizeTargets(){let s=(a,c)=>Array.from(c?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:c}=this.collectAutoSizeTargets();s.length!==0&&(Wf(this.dropzonePropertyTarget(),s,a,c,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:l=>{let d=this.#n;return d&&d.height===l.height&&d.width===l.width?!1:(this.#n=l,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#s()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let c of this.#e)a.has(c)||this.#t.unobserve(c);for(let c of a)this.#e.has(c)||this.#t.observe(c);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return Hf([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Kt,AbortSignal:Lc,WeakMap:Qf,WeakRef:Xf,Window:kp,reportError:Go=console.log}=globalThis,Be=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||Be(o.defaultView.parent.document)),vr=()=>!!kp&&globalThis instanceof kp,Vc=Symbol("unset"),[Ep,Gf]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((b,q)=>(x=b,u=q)),resolve:x,reject:u}};function r(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let i=new Qf,n={next(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.next(...x))},return(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.return?b.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>{if(!b.throw)throw b.return(),new TypeError("no throw method");return b.throw(...x)})}};function s(x){let u=Object.create(n);return i.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let b=r(x,g);return s(b)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(x,g)}let c="any"in Lc?Lc.any.bind(Lc):x=>{let u=new Kt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},l=x=>c(x.filter(Boolean));class d{constructor({next:u,error:g,complete:b}={}){i.set(this,{next:u,error:g,complete:b})}next(u){let{next:g}=i.get(this)||{};g&&g(u)}error(u){let{error:g}=i.get(this)||{};g?g(u):Go(u)}complete(){let{complete:u}=i.get(this)||{};u&&u()}}function h(x,u){let g=i.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let b of g.teardowns.reverse()){if(vr()&&!Be(document))return;try{b()}catch(q){Go(q)}}}}function f(x,u,g={}){if(vr()&&!Be(document))return;let b;typeof u=="function"?b=new d({next:u}):u&&!(u instanceof d)?b=new d(u):b=u||new d;let q=i.get(x),A=q.weakSubscriber?.deref();if(A?.active){let T=A,k=i.get(T);k.observers.add(b),g.signal&&(g.signal.aborted?k.observers.delete(b):g.signal.addEventListener("abort",()=>{let M=i.get(T);M?.active&&(M.observers.delete(b),M.observers.size==0&&h(T,g.signal.reason))}));return}let S=new m(b);if(q.weakSubscriber=new Xf(S),"signal"in g&&(g.signal.aborted?h(S,g.signal.reason):g.signal.addEventListener("abort",()=>{let T=i.get(S);T?.active&&(T.observers.delete(b),T.observers.size==0&&h(S,g.signal.reason))})),q.subscribeCallback)try{q.subscribeCallback(S)}catch(T){S.error(T)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Kt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active||vr()&&!Be(document))return;let b=new Set(g.observers);for(let q of b)q.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active){Go(u);return}if(vr()&&!Be(document))return;h(this,u);let b=new Set(g.observers);for(let q of b)q.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=i.get(this);if(!u?.active||vr()&&!Be(document))return;h(this);let g=new Set(u.observers);for(let b of g)b.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(vr()&&!Be(document))return;let g=i.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!i.has(this)){let u=new Kt;return u.abort(),u.signal}return i.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let A=function(S,T){if(S.signal.aborted)return;let k;try{let M=T.next();k=Promise.resolve(M)}catch(M){k=Promise.reject(M)}k.then(M=>{if(M===null||typeof M!="object"){S.error(new TypeError("Not an IteratorResult."));return}try{({done:q}=M)}catch(V){S.error(V);return}if(q){S.complete();return}let $;try{$=M.value}catch(V){S.error(V);return}S.next($),A(S,T)},M=>{S.error(M)})},q=!1;return new y(S=>{if(S.signal.aborted)return;let T;try{T=a(u,!0)}catch(M){S.error(M);return}let k=T;S.signal.aborted||(S.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||q)return;t(()=>k.return(S.signal.reason)).then($=>{if($===null||typeof $!="object")throw new TypeError("Iterator .return() must return an Object")})}),A(S,k))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(q=>{if(q.signal.aborted)return;let A;try{A=a(u,!1)}catch(k){q.error(k);return}let S=!1,T=A;if(!q.signal.aborted)for(q.signal.addEventListener("abort",()=>{if(typeof T.return!="function"||S)return;let k=T.return();if(k===null||typeof k!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let k=T.next();if({done:S}=k,S){q.complete();return}if(q.next(k.value),q.signal.aborted)break}catch(k){q.error(k);break}});if(u instanceof Promise||typeof u.then=="function")return new y(q=>{u.then(A=>{q.next(A),q.complete()},A=>{q.error(A)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,b=y.from(u);return new y(q=>{let A=new d({next(){q.complete()},error(){q.complete()}}),S={signal:q.signal};if(f(b,A,S),!q.active)return;let T=new d({next(k){q.next(k)},error(k){q.error(k)},complete(){q.complete()}});f(g,T,S)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,A=new d({next(T){let k;try{k=u(T,q)}catch(M){b.error(M);return}q+=1,b.next(k)},error(T){b.error(T)},complete(){b.complete()}}),S={signal:b.signal};f(g,A,S)})}inspect(u={}){let g=null,b=null,q=null,A=null,S=null;typeof u=="function"?b=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(b=u.next),"error"in u&&(q=u.error),"complete"in u&&(A=u.complete),"abort"in u&&(S=u.abort));let T=this;return new y(k=>{if(g!==null)try{g()}catch(L){k.error(L);return}let M=()=>{try{S!==null&&S(k.signal.reason)}catch(L){Go(L)}};k.signal.addEventListener("abort",M,{once:!0});let $=new d({next(L){if(b!==null)try{b(L)}catch(pt){k.signal.removeEventListener("abort",M),k.error(pt);return}k.next(L)},error(L){if(k.signal.removeEventListener("abort",M),q!==null)try{q(L)}catch(pt){k.error(pt);return}k.error(L)},complete(){if(k.signal.removeEventListener("abort",M),A!==null)try{A()}catch(L){k.error(L);return}k.complete()}}),V={signal:k.signal};f(T,$,V)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,A=new d({next(T){let k=!1;try{k=u(T,q)}catch(M){b.error(M);return}q+=1,k&&b.next(T)},error(T){b.error(T)},complete(){b.complete()}}),S={signal:b.signal};f(g,A,S)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u;if(q==0)return b.complete();let A=new d({next(T){b.next(T),q-=1,q==0&&b.complete()},error(T){b.error(T)},complete(){b.complete()}}),S={signal:b.signal};f(g,A,S)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u,A=new d({next(T){if(q>0)return q-=1;q==0&&b.next(T)},error(T){b.error(T)},complete(){b.complete()}}),S={signal:b.signal};f(g,A,S)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,A=!1,S=[];function T(V){let L;try{L=u(V,q)}catch(ne){return b.error(ne)}q+=1;let pt;try{pt=y.from(L)}catch(ne){return b.error(ne)}let Ra=new d({next(ne){b.next(ne)},error(ne){b.error(ne)},complete(){if(S.length){let ne=S.shift();T(ne)}else k=!1,A&&b.complete()}}),Bt={signal:b.signal};f(pt,Ra,Bt)}let k=!1,M=new d({next(V){k?S.push(V):(k=!0,T(V))},error(V){b.error(V)},complete(){A=!0,!k&&!S.length&&b.complete()}}),$={signal:b.signal};f(g,M,$)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,A=!1,S=null;function T($){let V;try{V=u($,q)}catch(Bt){return b.error(Bt)}q+=1;let L;try{L=y.from(V)}catch(Bt){return b.error(Bt)}let pt=new d({next(Bt){b.next(Bt)},error(Bt){b.error(Bt)},complete(Bt){A?b.complete():S=null}}),Ra={signal:l([S.signal,b.signal])};f(L,pt,Ra)}let k=new d({next($){S&&S.abort(),S=new Kt,T($)},error($){b.error($)},complete(){A=!0,S||b.complete()}}),M={signal:b.signal};f(g,k,M)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(q=>{let A=new d({next(T){q.next(T)},error(T){let k;try{k=u(T)}catch(L){q.error(L);return}let M;try{M=y.from(k)}catch(L){q.error(L);return}let $=new d({next(L){q.next(L)},error(L){q.error(L)},complete(){q.complete()}}),V={signal:q.signal};f(M,$,V)},complete(){q.complete()}}),S={signal:q.signal};f(g,A,S)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{b.addTeardown(u);let q=new d({next(S){b.next(S)},error(S){b.error(S)},complete(){b.complete()}}),A={signal:b.signal};f(g,q,A)})}toArray(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let A=[],S=new d({next(T){A.push(T)},error(T){q(T)},complete(){b(A)}});return f(this,S,u),g}forEach(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),S=new Kt,T={signal:l([S.signal,g.signal])};if(T.signal.aborted)return A(T.signal.reason),b;T.signal.addEventListener("abort",()=>{A(T.signal.reason)});let k=0,M=new d({next($){try{u($,k)}catch(V){A(V),S.abort(V)}k+=1},error($){A($)},complete(){q()}});return f(this,M,T),b}every(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),S=new Kt,T={signal:l([S.signal,g.signal])};if(T.signal.aborted)return A(T.signal.reason),b;T.signal.addEventListener("abort",()=>{A(T.signal.reason)});let k=0,M=new d({next($){let V=!1;try{V=u($,k)}catch(L){A(L),S.abort(L)}k+=1,V||(q(!1),S.abort())},error($){A($)},complete(){q(!0)}});return f(this,M,T),b}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e(),A=new Kt,S={signal:l([A.signal,u.signal])};if(S.signal.aborted)return q(S.signal.reason),g;S.signal.addEventListener("abort",()=>{q(S.signal.reason)});let T=new d({next(k){b(k),A.abort()},error(k){q(k)},complete(){q(new RangeError("No values in Observable"))}});return f(this,T,S),g}last(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return q(u.signal.reason),g;u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let A=null,S=!1,T=new d({next(k){S=!0,A=k},error(k){q(k)},complete(){S?b(A):q(new RangeError("No values in Observable"))}});return f(this,T,u),g}find(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),S=new Kt,T={signal:l([S.signal,g.signal])};if(T.signal.aborted)return A(T.signal.reason),b;T.signal.addEventListener("abort",()=>{A(T.signal.reason)});let k=0,M=new d({next($){let V=!1;try{V=u($,k)}catch(L){A(L),S.abort(L)}k+=1,V&&(q($),S.abort())},error($){A($)},complete(){q()}});return f(this,M,T),b}some(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),S=new Kt,T={signal:l([S.signal,g.signal])};if(T.signal.aborted)return A(T.signal.reason),b;T.signal.addEventListener("abort",()=>{A(T.signal.reason)});let k=0,M=new d({next($){let V=!1;try{V=u($,k)}catch(L){A(L),S.abort(L)}k+=1,V&&(q(!0),S.abort())},error($){A($)},complete(){q(!1)}});return f(this,M,T),b}reduce(u,g,b={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:q,resolve:A,reject:S}=e(),T=new Kt,k={signal:l([T.signal,b.signal])};if(k.signal.aborted)return S(k.signal.reason),q;k.signal.addEventListener("abort",()=>{S(k.signal.reason)},{once:!0});let M=0,$=arguments.length>1?g:Vc,V=new d({next(L){if($===Vc){$=L,M++;return}try{let pt=u($,L,M);M++,$=pt}catch(pt){S(pt),T.abort(pt);return}},error(L){S(L)},complete(){$!==Vc?A($):S(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,k),q}}return o(y.prototype,"subscribe"),[y,m]})();function Sp(){return typeof globalThis.Observable=="function"}function Ap(){Object.defineProperties(globalThis,{Observable:{value:Ep,configurable:!0,writable:!0},Subscriber:{value:Gf,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(vr()&&!Be(document))return;let e=this;return new Ep(r=>{if(!e||r.signal.aborted)return;let i=n=>{r.next(n)};e.addEventListener(o,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function jc(o,t,e){let r=o.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let n=i.getBoundingClientRect();if(t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom)return i}return null}function Tp(o,t,e,r){if(!r)return null;let i=o.filter(s=>!s.hasAttribute("disabled")),n=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom))return s}return null}function Ip(o,t,e,r){let i=o.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let n,s;if(r){let l=r.getBoundingClientRect();n=l.left+l.width/2,s=l.top+l.height/2}else n=t,s=e;let a=null,c=1/0;for(let l of i){let d=l.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(n-h,2)+Math.pow(s-f,2));m<c&&(c=m,a=l)}return a}function _p(o,t,e,r){let i=o.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let n;if(r){let c=r.getBoundingClientRect();n=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}]}else n=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let c of i){let l=c.getBoundingClientRect(),d=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}],h=0,f=0;for(let y of n)for(let x of d){let u=Math.sqrt(Math.pow(y.x-x.x,2)+Math.pow(y.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=c)}return s}function Yf(o,t,e){let r=o.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function Jf(o,t,e,r,i){let n=i&&i.length>0?o.filter(g=>i.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.split(/\s+/).includes("bank")),a=o.filter(g=>!n.includes(g));if(n.length===0&&a.length===0)return null;let c;if(r){let g=r.getBoundingClientRect();c=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else c=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let l=g=>{let b=g.getBoundingClientRect(),q=[{x:b.left,y:b.top},{x:b.right,y:b.top},{x:b.left,y:b.bottom},{x:b.right,y:b.bottom}],A=0,S=0;for(let T of c)for(let k of q){let M=Math.sqrt(Math.pow(T.x-k.x,2)+Math.pow(T.y-k.y,2));A+=M,S++}return A/S},d=null,h=1/0;for(let g of n){let b=l(g);b<h&&(h=b,d=g)}let f=null,m=1/0;for(let g of a){let b=l(g);b<m&&(m=b,f=g)}if(d&&r){let g=r.getBoundingClientRect(),b=d.getBoundingClientRect(),q=g.left+g.width/2,A=g.top+g.height/2;if(q>=b.left&&q<=b.right&&A>=b.top&&A<=b.bottom)return d}if(f&&Yf(f,t,e))return f;let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function Rp(o){switch(o){case"pointerWithin":return jc;case"rectangleIntersection":return Tp;case"closestCenter":return Ip;case"closestCorners":return _p;case"closestCornersWithInventoryPriority":return Jf;default:return jc}}function ri(o,t,e,r,i="pointerWithin",n){return Rp(i)(o,t,e,r,n)}function Ue(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("data-draggable"))return r;let i=r.closest(t)||r.closest('[data-draggable="true"]');if(i)return i}return null}function bn(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var Fc=o=>o?.internals;function ft(o,t,e){z(Fc(o)?.states,t,e)}function Yo(o,t){return Hi(Fc(o)?.states,t)}function vn(o){ft(o,"lifted",!1),ft(o,"used",!1),ft(o,"return-target",!1)}function yr(o){return Yo(o,"lifted")||Yo(o,"used")}var Mp={filled:[],full:[],"drag-active":["active","enabled"],"drag-over":["hover"]};function Zt(o,t,e){if(!o)return;let r=[t,...Mp[t]];for(let s of r)e?o.setAttribute(s,""):o.removeAttribute(s);let i=Fc(o)?.states;if(i){z(i,t,e,Mp[t]);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));if(!(!n.has("drop")&&!n.has("bank"))){for(let s of r)e?n.add(s):n.delete(s);o.setAttribute("part",[...n].join(" "))}}function qr(o,t){o&&(t?o.setAttribute("disabled",""):o.removeAttribute("disabled"),Zt(o,"full",t))}function ii(o,t){Zt(o,"filled",t)}function ni(o,t){let e=[];return o.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function Pp(o,t){let e=o.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var zc={origin:{x:0,y:0},scale:{x:1,y:1}},Jo=100,Kf=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},Zf=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},tg=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Bc=(o,t)=>{let e=o.ownerDocument??document,r=t??e.body,i=Kf(e);return i&&!tg(i,r)?Zf(i):r},Uc=(o,t=1)=>{let r=(o.ownerDocument??document).createElement("div");r.style.cssText=`position:fixed;left:0;top:0;width:${Jo}px;height:${Jo}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(r);let i=r.getBoundingClientRect();return r.remove(),{origin:{x:i.left,y:i.top},scale:{x:(i.width/Jo||1)*t,y:(i.height/Jo||1)*t}}},Op=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});Sp()||Ap();var Dp=new WeakSet;function eg(o){!o||Dp.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Dp.add(o))}var $p=o=>!!o.internals?.states,Ko=(o,t,e,r='slot[part~="bank"]',i="pointerWithin")=>{class n extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=zc,this.cursorBeforeDrag=null,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#r=a=>{let c=a;if(c.context!==Or)return;let l=c.contextTarget;l instanceof HTMLElement&&this.#e.add(l)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#r,{capture:!0}),eg(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,c){c.remove()}#e;#r;registeredMatching(a){for(let c of this.#e)c.isConnected||this.#e.delete(c);return[...this.#e].filter(c=>c.matches(a))}cacheInteractiveElements(){let a=(k,M)=>Array.from(M?.querySelectorAll(k)??[]),c=a(t,this),l=a(t,this.shadowRoot),d=a('[data-draggable="true"]:not([data-drag-clone])',this),h=a('[data-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...c,...l,...d,...h,...f]));let m=a(e,this),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let x=a(r,this),u=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),b=new Set(this.trackedDraggables),q=new Set(this.trackedDroppables),A=g?b:new Set,S=g?q:new Set,T=new Set([...b,...q].filter($p));for(let k of this.#t)T.has(k)||(z(k.internals.states,"chip",!1),z(k.internals.states,"drop",!1));for(let k of T){let M=A.has(k),$=!M&&S.has(k);z(k.internals.states,"chip",M),z(k.internals.states,"drop",$)}this.#t=T,this.trackedDraggables.forEach(k=>{let M=yr(k);g&&!M?(k.style.cursor="grab",k.style.userSelect="none",k.style.touchAction="none",k.style.webkitUserSelect="none",k.style.webkitTouchCallout="none",k.setAttribute("data-draggable","true"),k.setAttribute("tabindex","0")):(k.style.cursor="",k.style.userSelect="",k.style.touchAction="",k.style.webkitUserSelect="",k.style.webkitTouchCallout="",k.removeAttribute("data-draggable"),k.getAttribute("tabindex")==="0"&&k.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let c=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let y=Ue(m,t),x=this.disabled||this.readonly,u=bn(y)||yr(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=Ue(m,t);if(!y){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),l=a.when("mousedown").filter(m=>{let y=Ue(m,t),x=this.disabled||this.readonly,u=bn(y)||yr(y),g=m.button===0,b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Ue(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=Ue(m,t),x=this.disabled||this.readonly,u=bn(y)||yr(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Ue(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!y||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let y=this.trackedDraggables.filter(u=>!yr(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.endKeyboardDrag(),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.endKeyboardDrag(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=Ue(m,t),g=this.disabled||this.readonly,b=bn(u)||yr(u);u&&["Space","Enter"].includes(m.code)&&!g&&!b&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),ft(u,"lifted",!0),this.activateAllDroppables(this.trackedDroppables.some(q=>q.contains(u)||!!q.shadowRoot?.contains(u))),h={dragging:!0,dragElement:u,dragIndex:y.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>Zt(u,"drag-over",!1)),h.dragging&&h.dropElement&&(Zt(h.dropElement,"drag-over",!0),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(c,l,d,f)}initiateDrag(a,c,l,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let y=b=>b.contains(a)||!!b.shadowRoot?.contains(a),x=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||null;a.getAnimations().forEach(b=>b.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:c-g.left,y:l-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:c,y:l},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),qr(u,!1),u&&u.setAttribute("data-drag-source","true");let b=a.getAttribute("identifier");if(b){let q=ni(this.trackedDragContainers,b);q.forEach(A=>ft(A,"return-target",!0)),this.dragState.returnAnchorItems=q}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),ft(a,"lifted",!0);if(this.updateClonePosition(c,l),this.activateAllDroppables(x),this.watchDragCloneHost(),h==="pointer"){let b=this.ownerDocument.documentElement;this.cursorBeforeDrag=b.style.cursor,b.style.cursor="grabbing"}this.setupMoveObservables(d,h)}setupMoveObservables(a,c="pointer"){if(a==="touch"){if(c==="pointer")try{let q=this.dragState.dragSource,A=this.dragState.pointerId;q&&A!==void 0&&q.setPointerCapture&&q.setPointerCapture(A)}catch{}let g=q=>{q.cancelable&&(q.preventDefault(),c==="pointer"&&q.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let b=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),c==="pointer")try{let q=this.dragState.dragSource,A=this.dragState.pointerId;q&&A!==void 0&&q.releasePointerCapture&&q.releasePointerCapture(A)}catch{}};this.dragState.touchCleanup=b}let l=c==="mouse"?"mousemove":c==="touch"?"touchmove":"pointermove",d=c==="mouse"?"mouseup":c==="touch"?"touchend":"pointerup",h=g=>{let b=this.dragState.startedFromTrustedEvent;return b===void 0||g.isTrusted===b},f=document.when(l).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),c==="touch"){let b=g.touches?.[0]||g.changedTouches?.[0];if(!b)return;this.handleDragMove(b.clientX,b.clientY);return}if(c==="mouse"){let b=g;if(typeof b.buttons=="number"&&(b.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),y=c==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):c==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,c){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,c);let l=ri(this.allDropzones,a,c,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),d=Date.now(),h=d-(this.dragState.lastTargetChangeTime||0);l!==this.dragState.currentTarget&&(l===null||h>=50)&&(this.allDropzones.forEach(m=>Zt(m,"drag-over",!1)),l&&Zt(l,"drag-over",!0),this.dragState.currentTarget=l,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:c,currentTarget:l,sourceDroppable:d}=this.dragState,h=l;if(c){let y=c.getBoundingClientRect();h=ri(this.allDropzones,y.left+y.width/2,y.top+y.height/2,c,this.collisionDetectionAlgorithm,this.trackedDragContainers)??l}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),ft(a,"lifted",!1)):this.handleInvalidDrop(a),c&&c.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{ft(y,"return-target",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,c){return this.trackedDroppables.includes(c)||this.trackedDragContainers.includes(c)}handleInvalidDrop(a){vn(a)}createDragClone(a,c){let l=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];l.style.setProperty(m,d.getPropertyValue(m))}l.style.removeProperty("box-shadow");let h=Bc(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=Uc(h,this.cloneZoom),l.style.position="fixed",l.style.width=`${c.width/this.cloneFrame.scale.x}px`,l.style.height=`${c.height/this.cloneFrame.scale.y}px`,l.style.zIndex="9999",l.style.pointerEvents="none",l.style.touchAction="none",l.style.userSelect="none",l.removeAttribute("data-draggable"),l.removeAttribute("tabindex"),l.setAttribute("data-drag-clone","true"),l.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(l),l}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,c){if(this.dragState.lastCoordinates={x:a,y:c},!this.dragState.dragClone)return;let{startOffset:l}=this.dragState,{x:d,y:h}=Op(this.cloneFrame,a-l.x,c-l.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,c=()=>{let{dragClone:l,dragSource:d,lastCoordinates:h}=this.dragState;if(!l)return;let f=d?.isConnected?d:this,m=Bc(f,this.dragCloneRoot());m!==l.parentNode&&(m.appendChild(l),this.cloneFrame=Uc(m,this.cloneZoom),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",c),a.addEventListener("webkitfullscreenchange",c),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",c),a.removeEventListener("webkitfullscreenchange",c)}})}activateAllDroppables(a=!1){this.setDragActive(!0),this.allDropzones.forEach(c=>{let l=this.trackedDragContainers.includes(c);Zt(c,"drag-active",a||!l)})}deactivateAllDroppables(){this.setDragActive(!1),this.allDropzones.forEach(a=>{Zt(a,"drag-active",!1),Zt(a,"drag-over",!1)})}endKeyboardDrag(){this.trackedDraggables.forEach(a=>{a.hasAttribute("data-keyboard-dragging")&&ft(a,"lifted",!1),a.removeAttribute("data-keyboard-dragging")}),this.deactivateAllDroppables()}setDragActive(a){z(this._internals?.states,"drag-active",a,["dragzone-active","dragzone-enabled"])}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{ft(a,"return-target",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(c){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",c)}}),this.dragSubscriptions=[],this.cloneFrame=zc,this.cloneZoom=1,this.cursorBeforeDrag!==null&&(this.ownerDocument.documentElement.style.cursor=this.cursorBeforeDrag,this.cursorBeforeDrag=null),this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,c){let l=this._internals;l?.states&&(c?l.states.add(a):l.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)$p(a)&&(z(a.internals.states,"chip",!1),z(a.internals.states,"drop",!1));this.#t.clear(),this.resetDragState()}}return n};var Np={duration:250,easing:"ease",fill:"both"};function Hc(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Lp(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function He(o){let t=new Map;return o.forEach(e=>{t.set(e,Hc(e))}),t}function Vp(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function Zo(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function Wc(o){return Zo(o)>0}function ts(o,t,e={}){let r=Zo(o);if(r<=0)return null;let i=Hc(o),{deltaX:n,deltaY:s,deltaW:a,deltaH:c}=Vp(t,i);if(n===0&&s===0&&a===1&&c===1)return null;let{duration:l,easing:d,fill:h}={...Np,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${n}px, ${s}px) scale(${a}, ${c})`},{transformOrigin:"top left",transform:"none"}],{duration:l*r,easing:d,fill:h})}function We(o,t={}){let e=new Map;return o.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let n=ts(i,r,t);n&&e.set(i,n)}),e}var yn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ft=(o,t,e,r='slot[part~="bank"]',i="closestCornersWithInventoryPriority")=>{let n=Nc(o,t,e,r),s=Ko(n,t,e,r,i);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this.maxAssociations=0,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}#t;isSwapTarget(l){let d=this.dragState.sourceDroppable,h=parseInt(l.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(l)&&!!d&&d!==l&&this.trackedDroppables.includes(d)}isDeclarativeTarget(l){return l?l.acceptsDeclarativeDrops===!0?!0:l.hasAttribute("data-declarative-drops"):!1}chipsIn(l){return this.isDeclarativeTarget(l)?[...this.#t.get(l)??[]]:Array.from(l.querySelectorAll(t))}droppableHolding(l){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(l)||d.contains(l)||!!d.shadowRoot?.contains(l))??null}placeChip(l,d){this.#t.set(l,[...this.#t.get(l)??[],d])}removeChipFromDroppable(l,d){let h=l??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&ii(h,!1),this.syncDragDropState();return}d.remove()}clearChips(l){this.isDeclarativeTarget(l)?(this.#t.set(l,[]),this.syncDragDropState()):this.chipsIn(l).forEach(d=>d.remove()),ii(l,!1)}syncDragDropState(){let l={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),x=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[data-draggable="true"]'));l[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,x.length),h[m]=y}this._dragDrop={dragsByTarget:l,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:l}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(l[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((l,d)=>l+d,0)}droppableAtCapacityFromState(l){let d=parseInt(l.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=l.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(l){this._enableFlipAnimations=!l}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Wc(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let l=this.getResponse,d=typeof l=="function"?l.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(l){if(Array.isArray(l)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=l,this._internals.setFormValue(JSON.stringify(l));return}let d=this.getValue,h=typeof d=="function"?d.call(this,l):l,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof l=="string"&&l.length>0?[l]:[];this._internals.setFormValue(JSON.stringify(this._response)),this.trackedDroppables?.length&&this.validate()}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let l=this._pendingResponse;this._pendingResponse=void 0,this.response=l}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let l=this.dataset.choicesContainerWidth;l&&this.trackedDroppables.forEach(d=>{d.style.width=`${l}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(l){for(let h of l){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=l.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(l,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(l,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(l,d,h);let f=l.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity({trigger:"change"})}handleInvalidDrop(l){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!l)return;if(d&&f&&m)this.dropDraggableInDroppable(l,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(l,d,this.dragState.dragClone?.getBoundingClientRect());else if(Yo(l,"lifted")){this.restoreInventoryItem(l,this.dragState.dragClone?.getBoundingClientRect());let g=l.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),x=this.maxAssociations>0&&y>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity({trigger:"change"})}animateReturn(l,d){!l||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{ts(l,Lp(d),this.flipAnimationConfig)})}restoreInventoryItem(l,d){vn(l),l.style.display="",l.style.position="",this.animateReturn(l,d)}placeResponse(l){let[d,...h]=l.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=ni(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(l,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(l,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(l,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let A=l.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(l),l),A&&this.restoreOriginalInInventory(A,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,x=y===0||y>1,u=Array.from(d.querySelectorAll('[data-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?He(u):null;if(!x){let A=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[data-draggable="true"]'));if(A){let S=A.getAttribute("identifier"),T=A.getBoundingClientRect();this.removeChipFromDroppable(d,A);let k=this.dragState.sourceDroppable,M=this.isDeclarativeTarget(d)&&k&&k!==d&&this.isDeclarativeTarget(k)?k:null;M?(this.placeChip(M,A),ii(M,!0),this.animateReturn(A,T)):S&&this.restoreOriginalInInventory(S,T)}}let b=l.cloneNode(!0);b.removeAttribute("style"),b.removeAttribute("data-keyboard-dragging"),b.setAttribute("data-draggable","true"),b.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(b.setAttribute("part",b.localName==="qti-gap-text"?"chip text drag drag-text":"chip drag"),b.setAttribute("exportparts",["control: chip-control, control: drag-control, label: chip-label, label: drag-label","correction, candidate-correct, candidate-incorrect, candidate-partial","correction-correct, correction-incorrect, correction-partially-correct"].join(", ")),this.placeChip(d,b)):d.tagName==="SLOT"?b.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&b.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(b)),ii(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&We(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let A=b.getBoundingClientRect(),S=h.left-A.left,T=h.top-A.top;(S!==0||T!==0)&&b.animate([{transform:`translate(${S}px, ${T}px)`},{transform:"translate(0, 0)"}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let q=l.getAttribute("identifier");q&&this.updateInventoryBasedOnMatchMax(q),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(l,d){let h=l.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&ii(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(l,d){let h=ni(this.trackedDragContainers,l),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[data-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let y=this.enableFlipAnimations&&m.length>0?He(m):null;h.forEach(x=>{vn(x),x.style.display="",x.style.visibility="visible"}),y&&this.enableFlipAnimations&&We(y,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(l){let d=ni(this.trackedDragContainers,l),h=Pp(this.trackedDraggables,l),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(x=>x.getAttribute("identifier")===l).length:m+y.querySelectorAll(`[identifier="${l}"]`).length,0);d.forEach(m=>{ft(m,"used",h!==0&&f>=h)})}checkAllMaxAssociations(){let l=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1}),h=this.maxAssociations>0&&l>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source"),y=this.droppableAtCapacityFromState(f);qr(f,(y||d&&h)&&!m)})}saveResponse(l){let d=this.getResponse,h=l??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(l=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this.trackedDroppables.forEach(d=>qr(d,!1)),this.checkAllMaxAssociations(),this.resetValidityReport(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),l&&this.saveResponse()}validate(){let l=this.totalAssociationsFromState(),d=this.maxAssociations>0&&l>=this.maxAssociations,h=this.maxAssociations>0&&l>this.maxAssociations,f=this.minAssociations>0&&l<this.minAssociations,m="",y=!0,x="other";h?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):f?(x="min",m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let u=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,u,{suppressInline:!0,kind:x}),y}reportValidity(l){return super.reportValidity(l)}}return yn([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),yn([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",void 0),yn([Q({context:Fe})],a.prototype,"_dragDrop",void 0),yn([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),yn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Gt({emptyAs:[]})})],a.prototype,"response",null),a};var es=class{getInsertPosition(t,e,r,i,n){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),c=(n-a.top)/a.height,d=Math.min(1,Math.max(0,c))>.5;return{index:s,placeAfter:d}}};var jp=new es;var rg={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function qn(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function rs(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function is(o,t,e={}){let r={...rg,...e},i=document.createElement("div");return i.setAttribute("data-drop-preview","true"),i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(o).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(o).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*Zo(o)}ms ease`,i.style.pointerEvents="none",i}function Qc(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var zt=(o,t='[data-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=qn(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#n=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#r;#i;#n;#o;set allowReorder(i){this.#o=i}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(i){return Qc(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let n=this.#c(i);return n===0||n>1}#c(i){let n=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(n)?1:n}#p(i){return i.querySelectorAll(t).length}#l(i){let n=this.#c(i);return n===0?!1:this.#p(i)>=n}#d(){this.#i={hoveredSlot:null,originalPositions:new Map}}#h(i){if(!this.#t||i===this.#t){this.#u();return}if(this.#i.hoveredSlot===i)return;this.#u();let n=this.#s(i);if(!n){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#l(i)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#i.hoveredSlot=null;return}this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.isDeclarativeTarget(i)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#i.hoveredSlot=i;return}let a=He([n]);this.#i.originalPositions.set(n,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(n),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,We(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),n=i.length>0?He(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),n&&We(n,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,n,s,a,...c){this.#t=null,this.#r=qn(),this.#d();let l=this.findContainingDroppable(i);if(this.#e=l,l&&this.allowReorder){this.#t=l,this.#r.sortContainer=l;let h=i.getBoundingClientRect();this.#r.placeholder=is(i,h,this.sortablePlaceholderConfig);let f=i.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",l.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==l&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;qr(m,!1),this.#n.add(m)}})}let[d]=c;super.initiateDrag(i,n,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[n,s]of this.#i.originalPositions)s.appendChild(n);this.#r.placeholder&&this.#r.placeholder.remove(),rs(this.#r),this.#n.clear(),this.#t=null,this.#d()}onSortableDragMove(i,n){if(!this.isDraggingFromSlot)return;let s=ri(this.trackedDroppables,i,n,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#h(s):this.#u()}handleDragMove(i,n){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,n),this.onSortableDragMove(i,n)}allowDrop(i,n){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&n!==this.#e&&this.trackedDroppables.includes(n)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(n)?this.#a(n)?!this.#l(n):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(n)?!0:super.allowDrop(i,n)}handleDrop(i,n){super.handleDrop(i,n),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var Fp=[R,U,Qt,w`
6871
+ <slot part="label"></slot>`}};Jo([p({type:String,attribute:"template-identifier"})],jt.prototype,"templateIdentifier",void 0);Jo([p({type:String,attribute:"show-hide"})],jt.prototype,"showHide",void 0);Jo([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],jt.prototype,"fixed",void 0);Jo([p({type:String,attribute:!1})],jt.prototype,"marker",void 0);var Pp=[{tag:"qti-simple-choice",ctor:jt}];var Op=[...mp,...gp,...vp,...wp,...Cp,...Ep,...Ap,...Tp,..._p,...Pp];var og=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n};function sg(o,t,e,r,i={}){let n=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,c=0,l=r.length?r:[o],d=l.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));l.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),c=Math.max(c,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:c})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(o.style.setProperty("--qti-dropzone-min-width",`${c}px`),o.style.setProperty("--qti-drag-min-width",`${c}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(h.style.setProperty("--qti-dropzone-min-width",`${c}px`),h.style.setProperty("--qti-drag-min-width",`${c}px`))}))}var zc=(o,t,e,r='slot[part~="bank"]')=>{class i extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#i=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#i;#n;collectAutoSizeTargets(){let s=(a,c)=>Array.from(c?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:c}=this.collectAutoSizeTargets();s.length!==0&&(sg(this.dropzonePropertyTarget(),s,a,c,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:l=>{let d=this.#n;return d&&d.height===l.height&&d.width===l.width?!1:(this.#n=l,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#s()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let c of this.#e)a.has(c)||this.#t.unobserve(c);for(let c of a)this.#e.has(c)||this.#t.observe(c);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return og([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Zt,AbortSignal:Bc,WeakMap:ag,WeakRef:cg,Window:Dp,reportError:Ko=console.log}=globalThis,Ue=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||Ue(o.defaultView.parent.document)),qr=()=>!!Dp&&globalThis instanceof Dp,Uc=Symbol("unset"),[$p,lg]=(()=>{function o(w,u,g=!0){Object.defineProperty(w,u,{...Object.getOwnPropertyDescriptor(w,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(w,...u)=>new Promise(g=>g(w(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let w,u;return{promise:new Promise((b,q)=>(w=b,u=q)),resolve:w,reject:u}};function r(w,u){let g=u.call(w);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let i=new ag,n={next(...w){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.next(...w))},return(...w){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.return?b.return(...w):{value:void 0,done:!0})},throw(...w){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>{if(!b.throw)throw b.return(),new TypeError("no throw method");return b.throw(...w)})}};function s(w){let u=Object.create(n);return i.set(u,{syncIteratorRecord:w}),u}function a(w,u){let g;if(u){if(g=w[Symbol.asyncIterator],g==null){if(g=w[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let b=r(w,g);return s(b)}}else g=w[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(w,g)}let c="any"in Bc?Bc.any.bind(Bc):w=>{let u=new Zt;for(let g of w)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of w)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},l=w=>c(w.filter(Boolean));class d{constructor({next:u,error:g,complete:b}={}){i.set(this,{next:u,error:g,complete:b})}next(u){let{next:g}=i.get(this)||{};g&&g(u)}error(u){let{error:g}=i.get(this)||{};g?g(u):Ko(u)}complete(){let{complete:u}=i.get(this)||{};u&&u()}}function h(w,u){let g=i.get(w);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let b of g.teardowns.reverse()){if(qr()&&!Ue(document))return;try{b()}catch(q){Ko(q)}}}}function f(w,u,g={}){if(qr()&&!Ue(document))return;let b;typeof u=="function"?b=new d({next:u}):u&&!(u instanceof d)?b=new d(u):b=u||new d;let q=i.get(w),A=q.weakSubscriber?.deref();if(A?.active){let I=A,k=i.get(I);k.observers.add(b),g.signal&&(g.signal.aborted?k.observers.delete(b):g.signal.addEventListener("abort",()=>{let M=i.get(I);M?.active&&(M.observers.delete(b),M.observers.size==0&&h(I,g.signal.reason))}));return}let S=new m(b);if(q.weakSubscriber=new cg(S),"signal"in g&&(g.signal.aborted?h(S,g.signal.reason):g.signal.addEventListener("abort",()=>{let I=i.get(S);I?.active&&(I.observers.delete(b),I.observers.size==0&&h(S,g.signal.reason))})),q.subscribeCallback)try{q.subscribeCallback(S)}catch(I){S.error(I)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Zt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active||qr()&&!Ue(document))return;let b=new Set(g.observers);for(let q of b)q.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active){Ko(u);return}if(qr()&&!Ue(document))return;h(this,u);let b=new Set(g.observers);for(let q of b)q.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=i.get(this);if(!u?.active||qr()&&!Ue(document))return;h(this);let g=new Set(u.observers);for(let b of g)b.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(qr()&&!Ue(document))return;let g=i.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!i.has(this)){let u=new Zt;return u.abort(),u.signal}return i.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let A=function(S,I){if(S.signal.aborted)return;let k;try{let M=I.next();k=Promise.resolve(M)}catch(M){k=Promise.reject(M)}k.then(M=>{if(M===null||typeof M!="object"){S.error(new TypeError("Not an IteratorResult."));return}try{({done:q}=M)}catch(V){S.error(V);return}if(q){S.complete();return}let $;try{$=M.value}catch(V){S.error(V);return}S.next($),A(S,I)},M=>{S.error(M)})},q=!1;return new y(S=>{if(S.signal.aborted)return;let I;try{I=a(u,!0)}catch(M){S.error(M);return}let k=I;S.signal.aborted||(S.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||q)return;t(()=>k.return(S.signal.reason)).then($=>{if($===null||typeof $!="object")throw new TypeError("Iterator .return() must return an Object")})}),A(S,k))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(q=>{if(q.signal.aborted)return;let A;try{A=a(u,!1)}catch(k){q.error(k);return}let S=!1,I=A;if(!q.signal.aborted)for(q.signal.addEventListener("abort",()=>{if(typeof I.return!="function"||S)return;let k=I.return();if(k===null||typeof k!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let k=I.next();if({done:S}=k,S){q.complete();return}if(q.next(k.value),q.signal.aborted)break}catch(k){q.error(k);break}});if(u instanceof Promise||typeof u.then=="function")return new y(q=>{u.then(A=>{q.next(A),q.complete()},A=>{q.error(A)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,b=y.from(u);return new y(q=>{let A=new d({next(){q.complete()},error(){q.complete()}}),S={signal:q.signal};if(f(b,A,S),!q.active)return;let I=new d({next(k){q.next(k)},error(k){q.error(k)},complete(){q.complete()}});f(g,I,S)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,A=new d({next(I){let k;try{k=u(I,q)}catch(M){b.error(M);return}q+=1,b.next(k)},error(I){b.error(I)},complete(){b.complete()}}),S={signal:b.signal};f(g,A,S)})}inspect(u={}){let g=null,b=null,q=null,A=null,S=null;typeof u=="function"?b=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(b=u.next),"error"in u&&(q=u.error),"complete"in u&&(A=u.complete),"abort"in u&&(S=u.abort));let I=this;return new y(k=>{if(g!==null)try{g()}catch(L){k.error(L);return}let M=()=>{try{S!==null&&S(k.signal.reason)}catch(L){Ko(L)}};k.signal.addEventListener("abort",M,{once:!0});let $=new d({next(L){if(b!==null)try{b(L)}catch(pt){k.signal.removeEventListener("abort",M),k.error(pt);return}k.next(L)},error(L){if(k.signal.removeEventListener("abort",M),q!==null)try{q(L)}catch(pt){k.error(pt);return}k.error(L)},complete(){if(k.signal.removeEventListener("abort",M),A!==null)try{A()}catch(L){k.error(L);return}k.complete()}}),V={signal:k.signal};f(I,$,V)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,A=new d({next(I){let k=!1;try{k=u(I,q)}catch(M){b.error(M);return}q+=1,k&&b.next(I)},error(I){b.error(I)},complete(){b.complete()}}),S={signal:b.signal};f(g,A,S)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u;if(q==0)return b.complete();let A=new d({next(I){b.next(I),q-=1,q==0&&b.complete()},error(I){b.error(I)},complete(){b.complete()}}),S={signal:b.signal};f(g,A,S)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u,A=new d({next(I){if(q>0)return q-=1;q==0&&b.next(I)},error(I){b.error(I)},complete(){b.complete()}}),S={signal:b.signal};f(g,A,S)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,A=!1,S=[];function I(V){let L;try{L=u(V,q)}catch(oe){return b.error(oe)}q+=1;let pt;try{pt=y.from(L)}catch(oe){return b.error(oe)}let Oa=new d({next(oe){b.next(oe)},error(oe){b.error(oe)},complete(){if(S.length){let oe=S.shift();I(oe)}else k=!1,A&&b.complete()}}),Bt={signal:b.signal};f(pt,Oa,Bt)}let k=!1,M=new d({next(V){k?S.push(V):(k=!0,I(V))},error(V){b.error(V)},complete(){A=!0,!k&&!S.length&&b.complete()}}),$={signal:b.signal};f(g,M,$)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,A=!1,S=null;function I($){let V;try{V=u($,q)}catch(Bt){return b.error(Bt)}q+=1;let L;try{L=y.from(V)}catch(Bt){return b.error(Bt)}let pt=new d({next(Bt){b.next(Bt)},error(Bt){b.error(Bt)},complete(Bt){A?b.complete():S=null}}),Oa={signal:l([S.signal,b.signal])};f(L,pt,Oa)}let k=new d({next($){S&&S.abort(),S=new Zt,I($)},error($){b.error($)},complete(){A=!0,S||b.complete()}}),M={signal:b.signal};f(g,k,M)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(q=>{let A=new d({next(I){q.next(I)},error(I){let k;try{k=u(I)}catch(L){q.error(L);return}let M;try{M=y.from(k)}catch(L){q.error(L);return}let $=new d({next(L){q.next(L)},error(L){q.error(L)},complete(){q.complete()}}),V={signal:q.signal};f(M,$,V)},complete(){q.complete()}}),S={signal:q.signal};f(g,A,S)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{b.addTeardown(u);let q=new d({next(S){b.next(S)},error(S){b.error(S)},complete(){b.complete()}}),A={signal:b.signal};f(g,q,A)})}toArray(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let A=[],S=new d({next(I){A.push(I)},error(I){q(I)},complete(){b(A)}});return f(this,S,u),g}forEach(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),S=new Zt,I={signal:l([S.signal,g.signal])};if(I.signal.aborted)return A(I.signal.reason),b;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let k=0,M=new d({next($){try{u($,k)}catch(V){A(V),S.abort(V)}k+=1},error($){A($)},complete(){q()}});return f(this,M,I),b}every(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),S=new Zt,I={signal:l([S.signal,g.signal])};if(I.signal.aborted)return A(I.signal.reason),b;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let k=0,M=new d({next($){let V=!1;try{V=u($,k)}catch(L){A(L),S.abort(L)}k+=1,V||(q(!1),S.abort())},error($){A($)},complete(){q(!0)}});return f(this,M,I),b}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e(),A=new Zt,S={signal:l([A.signal,u.signal])};if(S.signal.aborted)return q(S.signal.reason),g;S.signal.addEventListener("abort",()=>{q(S.signal.reason)});let I=new d({next(k){b(k),A.abort()},error(k){q(k)},complete(){q(new RangeError("No values in Observable"))}});return f(this,I,S),g}last(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return q(u.signal.reason),g;u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let A=null,S=!1,I=new d({next(k){S=!0,A=k},error(k){q(k)},complete(){S?b(A):q(new RangeError("No values in Observable"))}});return f(this,I,u),g}find(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),S=new Zt,I={signal:l([S.signal,g.signal])};if(I.signal.aborted)return A(I.signal.reason),b;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let k=0,M=new d({next($){let V=!1;try{V=u($,k)}catch(L){A(L),S.abort(L)}k+=1,V&&(q($),S.abort())},error($){A($)},complete(){q()}});return f(this,M,I),b}some(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:A}=e(),S=new Zt,I={signal:l([S.signal,g.signal])};if(I.signal.aborted)return A(I.signal.reason),b;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let k=0,M=new d({next($){let V=!1;try{V=u($,k)}catch(L){A(L),S.abort(L)}k+=1,V&&(q(!0),S.abort())},error($){A($)},complete(){q(!1)}});return f(this,M,I),b}reduce(u,g,b={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:q,resolve:A,reject:S}=e(),I=new Zt,k={signal:l([I.signal,b.signal])};if(k.signal.aborted)return S(k.signal.reason),q;k.signal.addEventListener("abort",()=>{S(k.signal.reason)},{once:!0});let M=0,$=arguments.length>1?g:Uc,V=new d({next(L){if($===Uc){$=L,M++;return}try{let pt=u($,L,M);M++,$=pt}catch(pt){S(pt),I.abort(pt);return}},error(L){S(L)},complete(){$!==Uc?A($):S(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,k),q}}return o(y.prototype,"subscribe"),[y,m]})();function Np(){return typeof globalThis.Observable=="function"}function Lp(){Object.defineProperties(globalThis,{Observable:{value:$p,configurable:!0,writable:!0},Subscriber:{value:lg,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(qr()&&!Ue(document))return;let e=this;return new $p(r=>{if(!e||r.signal.aborted)return;let i=n=>{r.next(n)};e.addEventListener(o,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function Hc(o,t,e){let r=o.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let n=i.getBoundingClientRect();if(t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom)return i}return null}function Vp(o,t,e,r){if(!r)return null;let i=o.filter(s=>!s.hasAttribute("disabled")),n=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom))return s}return null}function jp(o,t,e,r){let i=o.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let n,s;if(r){let l=r.getBoundingClientRect();n=l.left+l.width/2,s=l.top+l.height/2}else n=t,s=e;let a=null,c=1/0;for(let l of i){let d=l.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(n-h,2)+Math.pow(s-f,2));m<c&&(c=m,a=l)}return a}function Fp(o,t,e,r){let i=o.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let n;if(r){let c=r.getBoundingClientRect();n=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}]}else n=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let c of i){let l=c.getBoundingClientRect(),d=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}],h=0,f=0;for(let y of n)for(let w of d){let u=Math.sqrt(Math.pow(y.x-w.x,2)+Math.pow(y.y-w.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=c)}return s}function dg(o,t,e){let r=o.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function hg(o,t,e,r,i){let n=i&&i.length>0?o.filter(g=>i.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.split(/\s+/).includes("bank")),a=o.filter(g=>!n.includes(g));if(n.length===0&&a.length===0)return null;let c;if(r){let g=r.getBoundingClientRect();c=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else c=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let l=g=>{let b=g.getBoundingClientRect(),q=[{x:b.left,y:b.top},{x:b.right,y:b.top},{x:b.left,y:b.bottom},{x:b.right,y:b.bottom}],A=0,S=0;for(let I of c)for(let k of q){let M=Math.sqrt(Math.pow(I.x-k.x,2)+Math.pow(I.y-k.y,2));A+=M,S++}return A/S},d=null,h=1/0;for(let g of n){let b=l(g);b<h&&(h=b,d=g)}let f=null,m=1/0;for(let g of a){let b=l(g);b<m&&(m=b,f=g)}if(d&&r){let g=r.getBoundingClientRect(),b=d.getBoundingClientRect(),q=g.left+g.width/2,A=g.top+g.height/2;if(q>=b.left&&q<=b.right&&A>=b.top&&A<=b.bottom)return d}if(f&&dg(f,t,e))return f;let w=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*w?d:f:d||f}function zp(o){switch(o){case"pointerWithin":return Hc;case"rectangleIntersection":return Vp;case"closestCenter":return jp;case"closestCorners":return Fp;case"closestCornersWithInventoryPriority":return hg;default:return Hc}}function ni(o,t,e,r,i="pointerWithin",n){return zp(i)(o,t,e,r,n)}function He(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("data-draggable"))return r;let i=r.closest(t)||r.closest('[data-draggable="true"]');if(i)return i}return null}function yn(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var Wc=o=>o?.internals;function ft(o,t,e){z(Wc(o)?.states,t,e)}function Zo(o,t){return Qi(Wc(o)?.states,t)}function qn(o){ft(o,"lifted",!1),ft(o,"used",!1),ft(o,"return-target",!1)}function wr(o){return Zo(o,"lifted")||Zo(o,"used")}var Bp={filled:[],full:[],"drag-active":["active","enabled"],"drag-over":["hover"]};function te(o,t,e){if(!o)return;let r=[t,...Bp[t]];for(let s of r)e?o.setAttribute(s,""):o.removeAttribute(s);let i=Wc(o)?.states;if(i){z(i,t,e,Bp[t]);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));if(!(!n.has("drop")&&!n.has("bank"))){for(let s of r)e?n.add(s):n.delete(s);o.setAttribute("part",[...n].join(" "))}}function xr(o,t){o&&(t?o.setAttribute("disabled",""):o.removeAttribute("disabled"),te(o,"full",t))}function oi(o,t){te(o,"filled",t)}function si(o,t){let e=[];return o.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function Up(o,t){let e=o.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var Qc={origin:{x:0,y:0},scale:{x:1,y:1}},ts=100,pg=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},ug=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},mg=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Xc=(o,t)=>{let e=o.ownerDocument??document,r=t??e.body,i=pg(e);return i&&!mg(i,r)?ug(i):r},Gc=(o,t=1)=>{let r=(o.ownerDocument??document).createElement("div");r.style.cssText=`position:fixed;left:0;top:0;width:${ts}px;height:${ts}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(r);let i=r.getBoundingClientRect();return r.remove(),{origin:{x:i.left,y:i.top},scale:{x:(i.width/ts||1)*t,y:(i.height/ts||1)*t}}},Hp=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});Np()||Lp();var Wp=new WeakSet;function fg(o){!o||Wp.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Wp.add(o))}var Qp=o=>!!o.internals?.states,es=(o,t,e,r='slot[part~="bank"]',i="pointerWithin")=>{class n extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Qc,this.cursorBeforeDrag=null,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#r=a=>{let c=a;if(c.context!==$r)return;let l=c.contextTarget;l instanceof HTMLElement&&this.#e.add(l)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#r,{capture:!0}),fg(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,c){c.remove()}#e;#r;registeredMatching(a){for(let c of this.#e)c.isConnected||this.#e.delete(c);return[...this.#e].filter(c=>c.matches(a))}cacheInteractiveElements(){let a=(k,M)=>Array.from(M?.querySelectorAll(k)??[]),c=a(t,this),l=a(t,this.shadowRoot),d=a('[data-draggable="true"]:not([data-drag-clone])',this),h=a('[data-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...c,...l,...d,...h,...f]));let m=a(e,this),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let w=a(r,this),u=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...w,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),b=new Set(this.trackedDraggables),q=new Set(this.trackedDroppables),A=g?b:new Set,S=g?q:new Set,I=new Set([...b,...q].filter(Qp));for(let k of this.#t)I.has(k)||(z(k.internals.states,"chip",!1),z(k.internals.states,"drop",!1));for(let k of I){let M=A.has(k),$=!M&&S.has(k);z(k.internals.states,"chip",M),z(k.internals.states,"drop",$)}this.#t=I,this.trackedDraggables.forEach(k=>{let M=wr(k);g&&!M?(k.style.cursor="grab",k.style.userSelect="none",k.style.touchAction="none",k.style.webkitUserSelect="none",k.style.webkitTouchCallout="none",k.setAttribute("data-draggable","true"),k.setAttribute("tabindex","0")):(k.style.cursor="",k.style.userSelect="",k.style.touchAction="",k.style.webkitUserSelect="",k.style.webkitTouchCallout="",k.removeAttribute("data-draggable"),k.getAttribute("tabindex")==="0"&&k.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let c=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let y=He(m,t),w=this.disabled||this.readonly,u=yn(y)||wr(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!w&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=He(m,t);if(!y){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let w=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),w===0){this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},w)}),l=a.when("mousedown").filter(m=>{let y=He(m,t),w=this.disabled||this.readonly,u=yn(y)||wr(y),g=m.button===0,b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!w&&!u&&!b}).subscribe(m=>{let y=He(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=He(m,t),w=this.disabled||this.readonly,u=yn(y)||wr(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!w&&!u&&!b}).subscribe(m=>{let y=He(m,t),w=m.touches?.[0]||m.changedTouches?.[0];!y||!w||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,w.clientX,w.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let y=this.trackedDraggables.filter(u=>!wr(u)),w=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%w.length;h={...h,dropIndex:u,dropElement:w[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+w.length)%w.length;h={...h,dropIndex:u,dropElement:w[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.endKeyboardDrag(),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.endKeyboardDrag(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=He(m,t),g=this.disabled||this.readonly,b=yn(u)||wr(u);u&&["Space","Enter"].includes(m.code)&&!g&&!b&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),ft(u,"lifted",!0),this.activateAllDroppables(this.trackedDroppables.some(q=>q.contains(u)||!!q.shadowRoot?.contains(u))),h={dragging:!0,dragElement:u,dragIndex:y.indexOf(u),dropIndex:0,dropElement:w[0]})}this.allDropzones.forEach(u=>te(u,"drag-over",!1)),h.dragging&&h.dropElement&&(te(h.dropElement,"drag-over",!0),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(c,l,d,f)}initiateDrag(a,c,l,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let y=b=>b.contains(a)||!!b.shadowRoot?.contains(a),w=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||null;a.getAnimations().forEach(b=>b.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:c-g.left,y:l-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:c,y:l},returnAnchorItems:[]},w){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),xr(u,!1),u&&u.setAttribute("data-drag-source","true");let b=a.getAttribute("identifier");if(b){let q=si(this.trackedDragContainers,b);q.forEach(A=>ft(A,"return-target",!0)),this.dragState.returnAnchorItems=q}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),ft(a,"lifted",!0);if(this.updateClonePosition(c,l),this.activateAllDroppables(w),this.watchDragCloneHost(),h==="pointer"){let b=this.ownerDocument.documentElement;this.cursorBeforeDrag=b.style.cursor,b.style.cursor="grabbing"}this.setupMoveObservables(d,h)}setupMoveObservables(a,c="pointer"){if(a==="touch"){if(c==="pointer")try{let q=this.dragState.dragSource,A=this.dragState.pointerId;q&&A!==void 0&&q.setPointerCapture&&q.setPointerCapture(A)}catch{}let g=q=>{q.cancelable&&(q.preventDefault(),c==="pointer"&&q.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let b=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),c==="pointer")try{let q=this.dragState.dragSource,A=this.dragState.pointerId;q&&A!==void 0&&q.releasePointerCapture&&q.releasePointerCapture(A)}catch{}};this.dragState.touchCleanup=b}let l=c==="mouse"?"mousemove":c==="touch"?"touchmove":"pointermove",d=c==="mouse"?"mouseup":c==="touch"?"touchend":"pointerup",h=g=>{let b=this.dragState.startedFromTrustedEvent;return b===void 0||g.isTrusted===b},f=document.when(l).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),c==="touch"){let b=g.touches?.[0]||g.changedTouches?.[0];if(!b)return;this.handleDragMove(b.clientX,b.clientY);return}if(c==="mouse"){let b=g;if(typeof b.buttons=="number"&&(b.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),y=c==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):c==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),w=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,w];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,c){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,c);let l=ni(this.allDropzones,a,c,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),d=Date.now(),h=d-(this.dragState.lastTargetChangeTime||0);l!==this.dragState.currentTarget&&(l===null||h>=50)&&(this.allDropzones.forEach(m=>te(m,"drag-over",!1)),l&&te(l,"drag-over",!0),this.dragState.currentTarget=l,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:c,currentTarget:l,sourceDroppable:d}=this.dragState,h=l;if(c){let y=c.getBoundingClientRect();h=ni(this.allDropzones,y.left+y.width/2,y.top+y.height/2,c,this.collisionDetectionAlgorithm,this.trackedDragContainers)??l}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),ft(a,"lifted",!1)):this.handleInvalidDrop(a),c&&c.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{ft(y,"return-target",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,c){return this.trackedDroppables.includes(c)||this.trackedDragContainers.includes(c)}handleInvalidDrop(a){qn(a)}createDragClone(a,c){let l=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];l.style.setProperty(m,d.getPropertyValue(m))}l.style.removeProperty("box-shadow");let h=Xc(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=Gc(h,this.cloneZoom),l.style.position="fixed",l.style.width=`${c.width/this.cloneFrame.scale.x}px`,l.style.height=`${c.height/this.cloneFrame.scale.y}px`,l.style.zIndex="9999",l.style.pointerEvents="none",l.style.touchAction="none",l.style.userSelect="none",l.removeAttribute("data-draggable"),l.removeAttribute("tabindex"),l.setAttribute("data-drag-clone","true"),l.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(l),l}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,c){if(this.dragState.lastCoordinates={x:a,y:c},!this.dragState.dragClone)return;let{startOffset:l}=this.dragState,{x:d,y:h}=Hp(this.cloneFrame,a-l.x,c-l.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,c=()=>{let{dragClone:l,dragSource:d,lastCoordinates:h}=this.dragState;if(!l)return;let f=d?.isConnected?d:this,m=Xc(f,this.dragCloneRoot());m!==l.parentNode&&(m.appendChild(l),this.cloneFrame=Gc(m,this.cloneZoom),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",c),a.addEventListener("webkitfullscreenchange",c),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",c),a.removeEventListener("webkitfullscreenchange",c)}})}activateAllDroppables(a=!1){this.setDragActive(!0),this.allDropzones.forEach(c=>{let l=this.trackedDragContainers.includes(c);te(c,"drag-active",a||!l)})}deactivateAllDroppables(){this.setDragActive(!1),this.allDropzones.forEach(a=>{te(a,"drag-active",!1),te(a,"drag-over",!1)})}endKeyboardDrag(){this.trackedDraggables.forEach(a=>{a.hasAttribute("data-keyboard-dragging")&&ft(a,"lifted",!1),a.removeAttribute("data-keyboard-dragging")}),this.deactivateAllDroppables()}setDragActive(a){z(this._internals?.states,"drag-active",a,["dragzone-active","dragzone-enabled"])}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{ft(a,"return-target",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(c){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",c)}}),this.dragSubscriptions=[],this.cloneFrame=Qc,this.cloneZoom=1,this.cursorBeforeDrag!==null&&(this.ownerDocument.documentElement.style.cursor=this.cursorBeforeDrag,this.cursorBeforeDrag=null),this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,c){let l=this._internals;l?.states&&(c?l.states.add(a):l.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)Qp(a)&&(z(a.internals.states,"chip",!1),z(a.internals.states,"drop",!1));this.#t.clear(),this.resetDragState()}}return n};var Xp={duration:250,easing:"ease",fill:"both"};function Yc(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Gp(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function We(o){let t=new Map;return o.forEach(e=>{t.set(e,Yc(e))}),t}function Yp(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function rs(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function Jc(o){return rs(o)>0}function is(o,t,e={}){let r=rs(o);if(r<=0)return null;let i=Yc(o),{deltaX:n,deltaY:s,deltaW:a,deltaH:c}=Yp(t,i);if(n===0&&s===0&&a===1&&c===1)return null;let{duration:l,easing:d,fill:h}={...Xp,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${n}px, ${s}px) scale(${a}, ${c})`},{transformOrigin:"top left",transform:"none"}],{duration:l*r,easing:d,fill:h})}function Qe(o,t={}){let e=new Map;return o.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let n=is(i,r,t);n&&e.set(i,n)}),e}var wn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ft=(o,t,e,r='slot[part~="bank"]',i="closestCornersWithInventoryPriority")=>{let n=zc(o,t,e,r),s=es(n,t,e,r,i);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this.maxAssociations=0,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}#t;isSwapTarget(l){let d=this.dragState.sourceDroppable,h=parseInt(l.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(l)&&!!d&&d!==l&&this.trackedDroppables.includes(d)}isDeclarativeTarget(l){return l?l.acceptsDeclarativeDrops===!0?!0:l.hasAttribute("data-declarative-drops"):!1}chipsIn(l){return this.isDeclarativeTarget(l)?[...this.#t.get(l)??[]]:Array.from(l.querySelectorAll(t))}droppableHolding(l){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(l)||d.contains(l)||!!d.shadowRoot?.contains(l))??null}placeChip(l,d){this.#t.set(l,[...this.#t.get(l)??[],d])}removeChipFromDroppable(l,d){let h=l??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&oi(h,!1),this.syncDragDropState();return}d.remove()}clearChips(l){this.isDeclarativeTarget(l)?(this.#t.set(l,[]),this.syncDragDropState()):this.chipsIn(l).forEach(d=>d.remove()),oi(l,!1)}syncDragDropState(){let l={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),w=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[data-draggable="true"]'));l[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,w.length),h[m]=y}this._dragDrop={dragsByTarget:l,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:l}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(l[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((l,d)=>l+d,0)}droppableAtCapacityFromState(l){let d=parseInt(l.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=l.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(l){this._enableFlipAnimations=!l}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Jc(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let l=this.getResponse,d=typeof l=="function"?l.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(l){if(Array.isArray(l)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=l,this._internals.setFormValue(JSON.stringify(l));return}let d=this.getValue,h=typeof d=="function"?d.call(this,l):l,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(w=>this.placeResponse(w));let m=this.getResponse,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof l=="string"&&l.length>0?[l]:[];this._internals.setFormValue(JSON.stringify(this._response)),this.trackedDroppables?.length&&this.validate()}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let l=this._pendingResponse;this._pendingResponse=void 0,this.response=l}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let l=this.dataset.choicesContainerWidth;l&&this.trackedDroppables.forEach(d=>{d.style.width=`${l}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(l){for(let h of l){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=l.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(l,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(l,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(l,d,h);let f=l.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity({trigger:"change"})}handleInvalidDrop(l){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!l)return;if(d&&f&&m)this.dropDraggableInDroppable(l,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(l,d,this.dragState.dragClone?.getBoundingClientRect());else if(Zo(l,"lifted")){this.restoreInventoryItem(l,this.dragState.dragClone?.getBoundingClientRect());let g=l.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),w=this.maxAssociations>0&&y>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&w,this.validate(),this.reportValidity({trigger:"change"})}animateReturn(l,d){!l||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{is(l,Gp(d),this.flipAnimationConfig)})}restoreInventoryItem(l,d){qn(l),l.style.display="",l.style.position="",this.animateReturn(l,d)}placeResponse(l){let[d,...h]=l.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let w=si(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);w&&this.dropDraggableInDroppable(w,f)})}dropDraggableInDroppable(l,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(l,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(l,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let A=l.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(l),l),A&&this.restoreOriginalInInventory(A,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,w=y===0||y>1,u=Array.from(d.querySelectorAll('[data-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?We(u):null;if(!w){let A=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[data-draggable="true"]'));if(A){let S=A.getAttribute("identifier"),I=A.getBoundingClientRect();this.removeChipFromDroppable(d,A);let k=this.dragState.sourceDroppable,M=this.isDeclarativeTarget(d)&&k&&k!==d&&this.isDeclarativeTarget(k)?k:null;M?(this.placeChip(M,A),oi(M,!0),this.animateReturn(A,I)):S&&this.restoreOriginalInInventory(S,I)}}let b=l.cloneNode(!0);b.removeAttribute("style"),b.removeAttribute("data-keyboard-dragging"),b.setAttribute("data-draggable","true"),b.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(b.setAttribute("part",b.localName==="qti-gap-text"?"chip text drag drag-text":"chip drag"),b.setAttribute("exportparts",["control: chip-control, control: drag-control, label: chip-label, label: drag-label","correction, candidate-correct, candidate-incorrect, candidate-partial","correction-correct, correction-incorrect, correction-partially-correct"].join(", ")),this.placeChip(d,b)):d.tagName==="SLOT"?b.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&b.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(b)),oi(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Qe(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let A=b.getBoundingClientRect(),S=h.left-A.left,I=h.top-A.top;(S!==0||I!==0)&&b.animate([{transform:`translate(${S}px, ${I}px)`},{transform:"translate(0, 0)"}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let q=l.getAttribute("identifier");q&&this.updateInventoryBasedOnMatchMax(q),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(l,d){let h=l.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&oi(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(l,d){let h=si(this.trackedDragContainers,l),f=new Set(h),m=[];this.trackedDragContainers.forEach(w=>{w.querySelectorAll('[data-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let y=this.enableFlipAnimations&&m.length>0?We(m):null;h.forEach(w=>{qn(w),w.style.display="",w.style.visibility="visible"}),y&&this.enableFlipAnimations&&Qe(y,this.flipAnimationConfig),h.forEach(w=>this.animateReturn(w,d))}updateInventoryBasedOnMatchMax(l){let d=si(this.trackedDragContainers,l),h=Up(this.trackedDraggables,l),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(w=>w.getAttribute("identifier")===l).length:m+y.querySelectorAll(`[identifier="${l}"]`).length,0);d.forEach(m=>{ft(m,"used",h!==0&&f>=h)})}checkAllMaxAssociations(){let l=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1}),h=this.maxAssociations>0&&l>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source"),y=this.droppableAtCapacityFromState(f);xr(f,(y||d&&h)&&!m)})}saveResponse(l){let d=this.getResponse,h=l??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(l=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this.trackedDroppables.forEach(d=>xr(d,!1)),this.checkAllMaxAssociations(),this.resetValidityReport(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),l&&this.saveResponse()}validate(){let l=this.totalAssociationsFromState(),d=this.maxAssociations>0&&l>=this.maxAssociations,h=this.maxAssociations>0&&l>this.maxAssociations,f=this.minAssociations>0&&l<this.minAssociations,m="",y=!0,w="other";h?(w="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(w="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):f?(w="min",m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let u=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,u,{suppressInline:!0,kind:w}),y}reportValidity(l){return super.reportValidity(l)}}return wn([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),wn([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",void 0),wn([Q({context:ze})],a.prototype,"_dragDrop",void 0),wn([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),wn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Gt({emptyAs:[]})})],a.prototype,"response",null),a};var ns=class{getInsertPosition(t,e,r,i,n){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),c=(n-a.top)/a.height,d=Math.min(1,Math.max(0,c))>.5;return{index:s,placeAfter:d}}};var Jp=new ns;var gg={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function xn(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function os(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function ss(o,t,e={}){let r={...gg,...e},i=document.createElement("div");return i.setAttribute("data-drop-preview","true"),i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(o).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(o).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*rs(o)}ms ease`,i.style.pointerEvents="none",i}function Kc(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var zt=(o,t='[data-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=xn(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#n=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#r;#i;#n;#o;set allowReorder(i){this.#o=i}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(i){return Kc(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let n=this.#c(i);return n===0||n>1}#c(i){let n=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(n)?1:n}#p(i){return i.querySelectorAll(t).length}#l(i){let n=this.#c(i);return n===0?!1:this.#p(i)>=n}#d(){this.#i={hoveredSlot:null,originalPositions:new Map}}#h(i){if(!this.#t||i===this.#t){this.#u();return}if(this.#i.hoveredSlot===i)return;this.#u();let n=this.#s(i);if(!n){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#l(i)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#i.hoveredSlot=null;return}this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.isDeclarativeTarget(i)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#i.hoveredSlot=i;return}let a=We([n]);this.#i.originalPositions.set(n,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(n),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,Qe(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),n=i.length>0?We(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),n&&Qe(n,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,n,s,a,...c){this.#t=null,this.#r=xn(),this.#d();let l=this.findContainingDroppable(i);if(this.#e=l,l&&this.allowReorder){this.#t=l,this.#r.sortContainer=l;let h=i.getBoundingClientRect();this.#r.placeholder=ss(i,h,this.sortablePlaceholderConfig);let f=i.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",l.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==l&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;xr(m,!1),this.#n.add(m)}})}let[d]=c;super.initiateDrag(i,n,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[n,s]of this.#i.originalPositions)s.appendChild(n);this.#r.placeholder&&this.#r.placeholder.remove(),os(this.#r),this.#n.clear(),this.#t=null,this.#d()}onSortableDragMove(i,n){if(!this.isDraggingFromSlot)return;let s=ni(this.trackedDroppables,i,n,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#h(s):this.#u()}handleDragMove(i,n){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,n),this.onSortableDragMove(i,n)}allowDrop(i,n){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&n!==this.#e&&this.trackedDroppables.includes(n)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(n)?this.#a(n)?!this.#l(n):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(n)?!0:super.allowDrop(i,n)}handleDrop(i,n){super.handleDrop(i,n),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var Kp=[_,U,Qt,x`
6872
6872
  :host {
6873
6873
  display: block; /* necessary to calculate scaling position */
6874
6874
  }
@@ -6925,7 +6925,7 @@ div.full-correct-response-inline {
6925
6925
  :host([answer-key]) ::slotted(qti-simple-associable-choice) {
6926
6926
  display: none;
6927
6927
  }
6928
- `];var cg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lg=Ft(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),xr=class extends zt(lg,'[data-draggable="true"]'){static{this.styles=Fp}constructor(){super(),this._childrenMap=[],this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(t){let e=t.composedPath()[0];if(this.shadowRoot?.contains(e))return;let r=e;this._childrenMap.includes(r)||(this._childrenMap=[...this._childrenMap,r])}#t(t,e){let r=this._dragDrop?.nodesByTarget?.[t]??[];return v`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
6928
+ `];var xg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Cg=Ft(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),Cr=class extends zt(Cg,'[data-draggable="true"]'){static{this.styles=Kp}constructor(){super(),this._childrenMap=[],this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(t){let e=t.composedPath()[0];if(this.shadowRoot?.contains(e))return;let r=e;this._childrenMap.includes(r)||(this._childrenMap=[...this._childrenMap,r])}#t(t,e){let r=this._dragDrop?.nodesByTarget?.[t]??[];return v`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
6929
6929
  ${H(r,i=>i.getAttribute("identifier"),i=>i)}
6930
6930
  </div>`}get#e(){return this.maxAssociations>0?this.maxAssociations:Math.ceil(this._childrenMap.length/2)}getResponse(){let t=[];for(let e=0;e<this.#e;e++){let r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),i=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),n=r&&this.chipsIn(r)[0]?.getAttribute("identifier"),s=i&&this.chipsIn(i)[0]?.getAttribute("identifier");n&&s&&t.push(`${n} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,r)=>{let i=e.split(" ");return i.length!==2?[]:[`${i[0]} droplist${r}_left`,`${i[1]} droplist${r}_right`]})??[]}render(){return v` <slot name="prompt"></slot>
6931
6931
  <slot part="bank drags" name="qti-simple-associable-choice"></slot>
@@ -6936,7 +6936,7 @@ div.full-correct-response-inline {
6936
6936
  </div>`)}
6937
6937
 
6938
6938
  <div role="alert" part="message" id="validation-message"></div>
6939
- </div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};cg([I()],xr.prototype,"_childrenMap",void 0);var ns=[{tag:"qti-associate-interaction",ctor:xr}];var Qe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Xe=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(i,n)=>{this._choiceElements.forEach(s=>s.disabled=n)},this._handleReadonlyChange=(i,n)=>{this._choiceElements.forEach(s=>s.readonly=n)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(i,n){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(i){this.maxChoices>1&&(typeof i=="string"||i===null)?this.response=i?i.toString().split(","):[]:this.response=i||""}firstUpdated(){super.firstUpdated(),this._updateChoiceSelection()}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#t.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t&&(this.#t.disconnect(),this.#t=null)}_syncChoicesFromDOM(){let i=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{i.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let n=new Set(this._choiceElements.map(s=>s.getAttribute("identifier")??s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>n.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!n.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let n=this._choiceElements.filter(d=>this._getChoiceChecked(d)).length,s=!0,a="",c="other";this.maxChoices!==0&&n>this.maxChoices?(s=!1,c="max",a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):n<this.minChoices&&(s=!1,c="min",a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(d=>this.contains(d))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0,kind:c}),s}reportValidity(i){return super.reportValidity(i)}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let i=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==i&&(this._interactionContext={...this._interactionContext,choiceRole:i})}_choiceElementSelectedHandler(i){this._toggleChoiceChecked(i.target);let n=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==i.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&n&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(i,n){i.internals?.states&&(n?(i.internals.states.add("checked"),i.internals.ariaChecked="true"):(i.internals.states.delete("checked"),i.internals.ariaChecked="false"))}_getChoiceChecked(i){return i.internals.states.has("checked")}_toggleChoiceChecked(i){let n=this._getChoiceChecked(i);this._setChoiceChecked(i,!n)}_handleChoiceSelection(){let n=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?n[0]||"":n,this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(this.response)}_updateChoiceSelection(){let i=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(n=>{let s=i.includes(n.identifier);this._setChoiceChecked(n,s)})}}return Qe([Pr("#validation-message")],e.prototype,"_validationMessageElement",void 0),Qe([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Qe([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Qe([N("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Qe([N("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Qe([N("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Qe([p({attribute:"response",reflect:!1,converter:Gt({emptyAs:""})})],e.prototype,"response",void 0),Qe([N("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var dg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},zp=(o,t)=>{class e extends o{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#r=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#i=null;set class(i){this.#t=this.#n(i),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(i,n,s){super.attributeChangedCallback(i,n,s),i==="class"&&n!==s&&(this.class=s??"")}updated(i){super.updated(i),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(i=>{i.some(n=>n.type==="childList"||n.type==="attributes"&&n.attributeName==="style")&&this.#o()}),this.#i.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){super.disconnectedCallback(),this.#i?.disconnect(),this.#i=null}#n(i){return i?i.split(/\s+/).map(n=>n.trim()).filter(Boolean).filter((n,s,a)=>a.indexOf(n)===s):[]}#o(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(c=>c),n=this.#s(i),s=this.#a(),a=this.#c();n.forEach((c,l)=>{c.marker=this.#p(l+1,s,a)})}#s(i){return i.map((n,s)=>{let a=Number(n.style.order);return{el:n,order:Number.isFinite(a)?a:s+1,index:s}}).sort((n,s)=>n.order-s.order||n.index-s.index).map(n=>n.el)}#a(){return this.#t.filter(i=>this.#e.includes(i)).pop()??null}#c(){return this.#t.filter(i=>this.#r.includes(i)).pop()??null}#p(i,n,s){let a=n;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let c="";switch(a){case"qti-labels-decimal":c=`${i}`;break;case"qti-labels-lower-alpha":c=this.#l(i,"lower");break;case"qti-labels-upper-alpha":c=this.#l(i,"upper");break}return s==="qti-labels-suffix-period"?`${c}.`:s==="qti-labels-suffix-parenthesis"?`${c})`:c}#l(i,n){let s=i,a="",c=n==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(c+s%26)+a,s=Math.floor(s/26);return a}}return dg([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var Bp=[R,U,w`
6939
+ </div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};xg([T()],Cr.prototype,"_childrenMap",void 0);var as=[{tag:"qti-associate-interaction",ctor:Cr}];var Xe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ge=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(i,n)=>{this._choiceElements.forEach(s=>s.disabled=n)},this._handleReadonlyChange=(i,n)=>{this._choiceElements.forEach(s=>s.readonly=n)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(i,n){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(i){this.maxChoices>1&&(typeof i=="string"||i===null)?this.response=i?i.toString().split(","):[]:this.response=i||""}firstUpdated(){super.firstUpdated(),this._updateChoiceSelection()}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#t.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t&&(this.#t.disconnect(),this.#t=null)}_syncChoicesFromDOM(){let i=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{i.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let n=new Set(this._choiceElements.map(s=>s.getAttribute("identifier")??s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>n.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!n.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let n=this._choiceElements.filter(d=>this._getChoiceChecked(d)).length,s=!0,a="",c="other";this.maxChoices!==0&&n>this.maxChoices?(s=!1,c="max",a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):n<this.minChoices&&(s=!1,c="min",a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(d=>this.contains(d))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0,kind:c}),s}reportValidity(i){return super.reportValidity(i)}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let i=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==i&&(this._interactionContext={...this._interactionContext,choiceRole:i})}_choiceElementSelectedHandler(i){this._toggleChoiceChecked(i.target);let n=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==i.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&n&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(i,n){i.internals?.states&&(n?(i.internals.states.add("checked"),i.internals.ariaChecked="true"):(i.internals.states.delete("checked"),i.internals.ariaChecked="false"))}_getChoiceChecked(i){return i.internals.states.has("checked")}_toggleChoiceChecked(i){let n=this._getChoiceChecked(i);this._setChoiceChecked(i,!n)}_handleChoiceSelection(){let n=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?n[0]||"":n,this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(this.response)}_updateChoiceSelection(){let i=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(n=>{let s=i.includes(n.identifier);this._setChoiceChecked(n,s)})}}return Xe([Dr("#validation-message")],e.prototype,"_validationMessageElement",void 0),Xe([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Xe([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Xe([N("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Xe([N("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Xe([N("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Xe([p({attribute:"response",reflect:!1,converter:Gt({emptyAs:""})})],e.prototype,"response",void 0),Xe([N("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var kg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Zp=(o,t)=>{class e extends o{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#r=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#i=null;set class(i){this.#t=this.#n(i),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(i,n,s){super.attributeChangedCallback(i,n,s),i==="class"&&n!==s&&(this.class=s??"")}updated(i){super.updated(i),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(i=>{i.some(n=>n.type==="childList"||n.type==="attributes"&&n.attributeName==="style")&&this.#o()}),this.#i.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){super.disconnectedCallback(),this.#i?.disconnect(),this.#i=null}#n(i){return i?i.split(/\s+/).map(n=>n.trim()).filter(Boolean).filter((n,s,a)=>a.indexOf(n)===s):[]}#o(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(c=>c),n=this.#s(i),s=this.#a(),a=this.#c();n.forEach((c,l)=>{c.marker=this.#p(l+1,s,a)})}#s(i){return i.map((n,s)=>{let a=Number(n.style.order);return{el:n,order:Number.isFinite(a)?a:s+1,index:s}}).sort((n,s)=>n.order-s.order||n.index-s.index).map(n=>n.el)}#a(){return this.#t.filter(i=>this.#e.includes(i)).pop()??null}#c(){return this.#t.filter(i=>this.#r.includes(i)).pop()??null}#p(i,n,s){let a=n;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let c="";switch(a){case"qti-labels-decimal":c=`${i}`;break;case"qti-labels-lower-alpha":c=this.#l(i,"lower");break;case"qti-labels-upper-alpha":c=this.#l(i,"upper");break}return s==="qti-labels-suffix-period"?`${c}.`:s==="qti-labels-suffix-parenthesis"?`${c})`:c}#l(i,n){let s=i,a="",c=n==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(c+s%26)+a,s=Math.floor(s/26);return a}}return kg([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var tu=[_,U,x`
6940
6940
  :host {
6941
6941
  display: block;
6942
6942
  }
@@ -7005,16 +7005,16 @@ div.full-correct-response-inline {
7005
7005
  :host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
7006
7006
  grid-row: auto;
7007
7007
  }
7008
- `];var hg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},wr=class extends zp(Xe(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=Bp}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return v`
7008
+ `];var Eg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},kr=class extends Zp(Ge(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=tu}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return v`
7009
7009
  <slot part="prompt" name="prompt"></slot>
7010
7010
  <slot part="choices slot" @slotchange=${this.#t}></slot>
7011
7011
  <div part="message" role="alert" id="validation-message"></div>
7012
- `}};hg([p({type:String})],wr.prototype,"orientation",void 0);var os=[{tag:"qti-choice-interaction",ctor:wr}];var Up=[R,w`
7012
+ `}};Eg([p({type:String})],kr.prototype,"orientation",void 0);var cs=[{tag:"qti-choice-interaction",ctor:kr}];var eu=[_,x`
7013
7013
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
7014
7014
  :host {
7015
7015
  display: block;
7016
7016
  }
7017
- `];var xn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Xc=`
7017
+ `];var Cn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Zc=`
7018
7018
  const postToParentWindows = (type, data) => {
7019
7019
  window.top.postMessage(data ? { type, data } : { type }, '*');
7020
7020
  let w = window.parent;
@@ -7081,7 +7081,7 @@ window.CES = {
7081
7081
  },
7082
7082
  };
7083
7083
  CES.load();
7084
- `,pg=`
7084
+ `,Sg=`
7085
7085
  (function() {
7086
7086
  var blobUrlReceived = null;
7087
7087
 
@@ -7125,7 +7125,7 @@ CES.load();
7125
7125
  requestBlobUrl();
7126
7126
  }
7127
7127
  })();
7128
- `,ye=class extends D{#t;#e;#r;static{this.styles=Up}constructor(){super(),this.#t="",this.#e=null,this.#r=null,this._errorMessage=null,this.#i=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#i;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let r=this.querySelector("object[data]");if(r){t=r.getAttribute("data");let i=r.getAttribute("width"),n=r.getAttribute("height");i&&this.setAttribute("width",i),n&&this.setAttribute("height",n)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:ho((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}async setupCES(){await this.updateComplete;let t=this.shadowRoot?.querySelector("#pciContainer");if(!t){this._errorMessage="pciContainer iframe not found";return}t.getAttribute("src")||t.setAttribute("src","about:blank");let e=t.contentDocument??t.contentWindow?.document??null;if(e||(await new Promise(d=>t.addEventListener("load",()=>d(),{once:!0})),e=t.contentDocument??t.contentWindow?.document??null),!e){this._errorMessage="pciContainer iframe document not available";return}if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let r=this.manifest.style[0],i=this.#a(),n=await this.#l(r,i),s=n.url;if(n.baseUrl&&!this.#r&&(this.#r=n.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#l(h,i,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#r&&(this.#r=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+Xc+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let x=new Blob([m],{type:"text/html"});this.#i=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",y=await this.#l(m,i,{returnText:!0});if(d=y.url,y.baseUrl&&!this.#r&&(this.#r=y.baseUrl),y.text){let x=y.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let b="<script>"+Xc+"</script>",q=x.indexOf("<head>");q!==-1?x=x.slice(0,q+6)+b+x.slice(q+6):x=b+x}let g=new Blob([x],{type:"text/html"});this.#i=URL.createObjectURL(g)}}if(d&&!this.#i)try{let h=await fetch(d);if(h.ok){let f=await h.text();if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let x="<script>"+Xc+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let y=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(y)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let c=`<script>${pg}</script>`;window.addEventListener("message",this.handlePostMessage);let l=`
7128
+ `,qe=class extends D{#t;#e;#r;static{this.styles=eu}constructor(){super(),this.#t="",this.#e=null,this.#r=null,this._errorMessage=null,this.#i=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#i;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let r=this.querySelector("object[data]");if(r){t=r.getAttribute("data");let i=r.getAttribute("width"),n=r.getAttribute("height");i&&this.setAttribute("width",i),n&&this.setAttribute("height",n)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:uo((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}async setupCES(){await this.updateComplete;let t=this.shadowRoot?.querySelector("#pciContainer");if(!t){this._errorMessage="pciContainer iframe not found";return}t.getAttribute("src")||t.setAttribute("src","about:blank");let e=t.contentDocument??t.contentWindow?.document??null;if(e||(await new Promise(d=>t.addEventListener("load",()=>d(),{once:!0})),e=t.contentDocument??t.contentWindow?.document??null),!e){this._errorMessage="pciContainer iframe document not available";return}if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let r=this.manifest.style[0],i=this.#a(),n=await this.#l(r,i),s=n.url;if(n.baseUrl&&!this.#r&&(this.#r=n.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#l(h,i,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#r&&(this.#r=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+Zc+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let w=new Blob([m],{type:"text/html"});this.#i=URL.createObjectURL(w)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",y=await this.#l(m,i,{returnText:!0});if(d=y.url,y.baseUrl&&!this.#r&&(this.#r=y.baseUrl),y.text){let w=y.text;if(!(w.includes("postToParentWindows")||w.includes("window.CES"))){let b="<script>"+Zc+"</script>",q=w.indexOf("<head>");q!==-1?w=w.slice(0,q+6)+b+w.slice(q+6):w=b+w}let g=new Blob([w],{type:"text/html"});this.#i=URL.createObjectURL(g)}}if(d&&!this.#i)try{let h=await fetch(d);if(h.ok){let f=await h.text();if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let w="<script>"+Zc+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+w+f.slice(u+6):f=w+f}let y=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(y)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let c=`<script>${Sg}</script>`;window.addEventListener("message",this.handlePostMessage);let l=`
7129
7129
  <!DOCTYPE html>
7130
7130
  <html>
7131
7131
  <head>
@@ -7145,9 +7145,9 @@ CES.load();
7145
7145
  ${this._errorMessage&&v`<div style="color:red">
7146
7146
  <h1>Error</h1>
7147
7147
  ${this._errorMessage}
7148
- </div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(i=>new URL(i,window.location.href).toString()),r=this.#p();return r&&e.push(r),[...new Set(e)]}#c(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let i of e){let n=new URL(i,window.location.href).toString(),s=new URL(t,n.endsWith("/")?n:`${n}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let c=await a.text();return{url:s,baseUrl:n,text:c}}return{url:s,baseUrl:n}}}catch{}}return{url:"",baseUrl:null}}};xn([p({type:String,attribute:"data"})],ye.prototype,"data",void 0);xn([p({type:String,attribute:"data-base-item"})],ye.prototype,"baseItemUrl",void 0);xn([p({type:String,attribute:"data-base-ref"})],ye.prototype,"baseRefUrl",void 0);xn([p({type:String,attribute:"id"})],ye.prototype,"id",void 0);xn([I()],ye.prototype,"_errorMessage",void 0);var ss=[{tag:"qti-custom-interaction",ctor:ye}];var Hp=[R];var wn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qe=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=Hp}get#t(){let t=this._itemContext;if(!t)return!1;if(t.disabled||t.readonly)return!0;let e=this.closest("qti-assessment-item")?.getAttribute("adaptive")==="true",r=t.variables?.find(i=>i.identifier==="completionStatus")?.value;return e&&r==="completed"}render(){return v`<button ?disabled=${this.disabled||this.#t} part="button" @click=${this.endAttempt}>
7148
+ </div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(i=>new URL(i,window.location.href).toString()),r=this.#p();return r&&e.push(r),[...new Set(e)]}#c(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let i of e){let n=new URL(i,window.location.href).toString(),s=new URL(t,n.endsWith("/")?n:`${n}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let c=await a.text();return{url:s,baseUrl:n,text:c}}return{url:s,baseUrl:n}}}catch{}}return{url:"",baseUrl:null}}};Cn([p({type:String,attribute:"data"})],qe.prototype,"data",void 0);Cn([p({type:String,attribute:"data-base-item"})],qe.prototype,"baseItemUrl",void 0);Cn([p({type:String,attribute:"data-base-ref"})],qe.prototype,"baseRefUrl",void 0);Cn([p({type:String,attribute:"id"})],qe.prototype,"id",void 0);Cn([T()],qe.prototype,"_errorMessage",void 0);var ls=[{tag:"qti-custom-interaction",ctor:qe}];var ru=[_];var kn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},we=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=ru}get#t(){let t=this._itemContext;if(!t)return!1;if(t.disabled||t.readonly)return!0;let e=this.closest("qti-assessment-item")?.getAttribute("adaptive")==="true",r=t.variables?.find(i=>i.identifier==="completionStatus")?.value;return e&&r==="completed"}render(){return v`<button ?disabled=${this.disabled||this.#t} part="button" @click=${this.endAttempt}>
7149
7149
  ${this.title}
7150
- </button>`}endAttempt(t){this.disabled||this.#t||this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt!=="false"}}))}};wn([p({type:String,attribute:"response-identifier"})],qe.prototype,"responseIdentifier",void 0);wn([p({reflect:!0,type:Boolean})],qe.prototype,"disabled",void 0);wn([_({context:F,subscribe:!0}),I()],qe.prototype,"_itemContext",void 0);wn([p({type:String,attribute:"count-attempt"})],qe.prototype,"countAttempt",void 0);wn([p({type:String})],qe.prototype,"title",void 0);var as=[{tag:"qti-end-attempt-interaction",ctor:qe}];var Wp=[R,w`
7150
+ </button>`}endAttempt(t){this.disabled||this.#t||this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt!=="false"}}))}};kn([p({type:String,attribute:"response-identifier"})],we.prototype,"responseIdentifier",void 0);kn([p({reflect:!0,type:Boolean})],we.prototype,"disabled",void 0);kn([R({context:F,subscribe:!0}),T()],we.prototype,"_itemContext",void 0);kn([p({type:String,attribute:"count-attempt"})],we.prototype,"countAttempt",void 0);kn([p({type:String})],we.prototype,"title",void 0);var ds=[{tag:"qti-end-attempt-interaction",ctor:we}];var iu=[_,x`
7151
7151
  /* PK: display host as block, else design will be collapsed */
7152
7152
  /* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
7153
7153
  :host {
@@ -7160,7 +7160,7 @@ CES.load();
7160
7160
  height: 100%;
7161
7161
  border: 0;
7162
7162
  }
7163
- `];var gt=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Qp=5,ug=50,Xp="qti-height-lines-",Gp=!1,X=class extends D{constructor(){super(...arguments),this._rows=Qp,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||Gp||(Gp=!0,console.warn('<qti-extended-text-interaction format="xhtml"> renders as plain text. The interaction has no rich-text editor; the recorded response will contain no markup.'))},this.minStrings=0,this.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Wp}_handleRowsInputChange(){this._rows=this.#t()}#t(){let t=this.#e();return t!==null?t:this.expectedLines>0?this.expectedLines:this.expectedLength>0?Math.ceil(this.expectedLength/ug):Qp}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(Xp))continue;let e=parseInt(t.slice(Xp.length),10);if(!Number.isNaN(e)&&e>0)return e}return null}get value(){return this.response||null}set value(t){this.response=t||null}validate(){let t=this.shadowRoot.querySelector("textarea");if(!t)return!1;let e="",r=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let n=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,s=new RegExp(n);r=t.checkValidity()&&s.test(t.value),r||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else r=t.checkValidity();let i="other";return r&&!this.response&&this.minStrings>=1&&(r=!1,i="min"),!r&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(r,e,t,{suppressInline:!0,kind:i}),r}reportValidity(t){return this.validate(),super.reportValidity(t)}renderPrompt(){return v`<slot name="prompt"></slot>`}renderTextarea(){return v`<textarea
7163
+ `];var gt=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},nu=5,Ag=50,ou="qti-height-lines-",su=!1,X=class extends D{constructor(){super(...arguments),this._rows=nu,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||su||(su=!0,console.warn('<qti-extended-text-interaction format="xhtml"> renders as plain text. The interaction has no rich-text editor; the recorded response will contain no markup.'))},this.minStrings=0,this.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=iu}_handleRowsInputChange(){this._rows=this.#t()}#t(){let t=this.#e();return t!==null?t:this.expectedLines>0?this.expectedLines:this.expectedLength>0?Math.ceil(this.expectedLength/Ag):nu}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(ou))continue;let e=parseInt(t.slice(ou.length),10);if(!Number.isNaN(e)&&e>0)return e}return null}get value(){return this.response||null}set value(t){this.response=t||null}validate(){let t=this.shadowRoot.querySelector("textarea");if(!t)return!1;let e="",r=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let n=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,s=new RegExp(n);r=t.checkValidity()&&s.test(t.value),r||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else r=t.checkValidity();let i="other";return r&&!this.response&&this.minStrings>=1&&(r=!1,i="min"),!r&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(r,e,t,{suppressInline:!0,kind:i}),r}reportValidity(t){return this.validate(),super.reportValidity(t)}renderPrompt(){return v`<slot name="prompt"></slot>`}renderTextarea(){return v`<textarea
7164
7164
  part="textarea"
7165
7165
  name="${this.responseIdentifier}"
7166
7166
  spellcheck="false"
@@ -7175,7 +7175,7 @@ CES.load();
7175
7175
  ?disabled="${this.disabled}"
7176
7176
  ?readonly="${this.readonly}"
7177
7177
  .value=${this.response}
7178
- ></textarea>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value),this.reportValidity({trigger:"change"}))}};gt([I()],X.prototype,"_rows",void 0);gt([p({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",void 0);gt([p({type:Number,attribute:"expected-lines"})],X.prototype,"expectedLines",void 0);gt([p({type:String,reflect:!0})],X.prototype,"format",void 0);gt([N("format")],X.prototype,"_handleFormatChange",void 0);gt([p({type:Number,attribute:"min-strings"})],X.prototype,"minStrings",void 0);gt([p({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",void 0);gt([p({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",void 0);gt([p({type:String,attribute:"data-patternmask-message"})],X.prototype,"dataPatternmaskMessage",void 0);gt([p({type:String,attribute:"class"})],X.prototype,"classNames",void 0);gt([N(["classNames","expectedLines","expectedLength"])],X.prototype,"_handleRowsInputChange",null);gt([p({type:String,attribute:"response",reflect:!1})],X.prototype,"response",void 0);gt([N("response",{waitUntilFirstUpdate:!0})],X.prototype,"_handleResponseChange",void 0);var cs=[{tag:"qti-extended-text-interaction",ctor:X}];var Yp=[R,U,w`
7178
+ ></textarea>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value),this.reportValidity({trigger:"change"}))}};gt([T()],X.prototype,"_rows",void 0);gt([p({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",void 0);gt([p({type:Number,attribute:"expected-lines"})],X.prototype,"expectedLines",void 0);gt([p({type:String,reflect:!0})],X.prototype,"format",void 0);gt([N("format")],X.prototype,"_handleFormatChange",void 0);gt([p({type:Number,attribute:"min-strings"})],X.prototype,"minStrings",void 0);gt([p({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",void 0);gt([p({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",void 0);gt([p({type:String,attribute:"data-patternmask-message"})],X.prototype,"dataPatternmaskMessage",void 0);gt([p({type:String,attribute:"class"})],X.prototype,"classNames",void 0);gt([N(["classNames","expectedLines","expectedLength"])],X.prototype,"_handleRowsInputChange",null);gt([p({type:String,attribute:"response",reflect:!1})],X.prototype,"response",void 0);gt([N("response",{waitUntilFirstUpdate:!0})],X.prototype,"_handleResponseChange",void 0);var hs=[{tag:"qti-extended-text-interaction",ctor:X}];var au=[_,U,x`
7179
7179
  :host {
7180
7180
  display: flex;
7181
7181
  align-items: flex-start;
@@ -7223,10 +7223,10 @@ CES.load();
7223
7223
  :host([answer-key]) [part~='bank'] {
7224
7224
  display: none;
7225
7225
  }
7226
- `];var oi=class extends zt(Ft(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1}static{this.styles=Yp}render(){return v`<slot name="prompt"> </slot>
7226
+ `];var ai=class extends zt(Ft(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1}static{this.styles=au}render(){return v`<slot name="prompt"> </slot>
7227
7227
  <slot part="bank drags" name="drags"></slot>
7228
7228
  <slot part="drops"></slot>
7229
- <div role="alert" part="message" id="validation-message"></div>`}};var ls=[{tag:"qti-gap-match-interaction",ctor:oi}];function tu(o){return o.querySelector('img, object[type^="image"]')}function Jp(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let r=parseFloat(e);return Number.isFinite(r)&&r>0?r:null}var eu=new WeakMap,Kp=new WeakMap;function mg(o){let t=Kp.get(o);return t||(t=new Promise(e=>{let r=o.data;if(!r){e(null);return}let i=new Image;i.onload=()=>{let n={width:i.naturalWidth,height:i.naturalHeight};if(!(n.width>0)||!(n.height>0)){e(null);return}eu.set(o,n),e(n)},i.onerror=()=>e(null),i.src=r}),Kp.set(o,t)),t}function fg(o){if(o.localName==="object")return eu.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function ds(o){let t=Jp(o,"width"),e=Jp(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let r=fg(o);return r?{width:t??r.width,height:e??r.height}:null}function gg(o){let t=ds(o);if(t)return Promise.resolve(t);if(o.localName==="object")return mg(o).then(()=>ds(o));let e=o;return e.complete?Promise.resolve(null):new Promise(r=>{let i=()=>{e.removeEventListener("load",i),e.removeEventListener("error",i),r(ds(o))};e.addEventListener("load",i),e.addEventListener("error",i)})}function te(o,t,e,r){let i=ds(e);if(i){Zp(o,t,i,r);return}gg(e).then(n=>{if(!n){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}Zp(o,t,n,r)})}function Zp(o,t,{width:e,height:r},i){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[n,s,a]=t,c=n/e*100,l=s/r*100,d=a/e*100,h=a/r*100;i.style.left=c-d+"%",i.style.top=l-h+"%",i.style.width=2*d+"%",i.style.height=2*h+"%",i.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[n,s,a,c]=t,l=n/e*100,d=s/r*100,h=a/e*100,f=c/r*100;i.style.left=l+"%",i.style.top=d+"%",i.style.width=h-l+"%",i.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[n,s,a,c]=t,l=n/e*100,d=s/r*100,h=a/e*100,f=c/r*100;i.style.left=l-h+"%",i.style.top=d-f+"%",i.style.width=2*h+"%",i.style.height=2*f+"%",i.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let n=[];for(let b=0;b<t.length;b+=2)n.push({x:t[b],y:t[b+1]});let s=Math.min(...n.map(b=>b.x)),a=Math.max(...n.map(b=>b.x)),c=Math.min(...n.map(b=>b.y)),l=Math.max(...n.map(b=>b.y)),d=s/e*100,h=c/r*100,f=a/e*100,m=l/r*100;i.style.left=d+"%",i.style.top=h+"%",i.style.width=f-d+"%",i.style.height=m-h+"%";let y=n.map(b=>({x:(b.x-s)/(a-s)*100,y:(b.y-c)/(l-c)*100})),x=y.map(b=>`${b.x}% ${b.y}%`).join(",");i.style.clipPath=`polygon(${x})`;let u=y.map(b=>`${b.x},${b.y}`).join(" "),g=b=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${u}' fill='none' stroke='black' stroke-width='${b}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;i.style.setProperty("--qti-shape-outline",g(4)),i.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":i.style.left="0%",i.style.top="0%",i.style.width="100%",i.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var ru=[R,U,w`
7229
+ <div role="alert" part="message" id="validation-message"></div>`}};var ps=[{tag:"qti-gap-match-interaction",ctor:ai}];function hu(o){return o.querySelector('img, object[type^="image"]')}function cu(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let r=parseFloat(e);return Number.isFinite(r)&&r>0?r:null}var pu=new WeakMap,lu=new WeakMap;function Ig(o){let t=lu.get(o);return t||(t=new Promise(e=>{let r=o.data;if(!r){e(null);return}let i=new Image;i.onload=()=>{let n={width:i.naturalWidth,height:i.naturalHeight};if(!(n.width>0)||!(n.height>0)){e(null);return}pu.set(o,n),e(n)},i.onerror=()=>e(null),i.src=r}),lu.set(o,t)),t}function Tg(o){if(o.localName==="object")return pu.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function us(o){let t=cu(o,"width"),e=cu(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let r=Tg(o);return r?{width:t??r.width,height:e??r.height}:null}function Rg(o){let t=us(o);if(t)return Promise.resolve(t);if(o.localName==="object")return Ig(o).then(()=>us(o));let e=o;return e.complete?Promise.resolve(null):new Promise(r=>{let i=()=>{e.removeEventListener("load",i),e.removeEventListener("error",i),r(us(o))};e.addEventListener("load",i),e.addEventListener("error",i)})}function ee(o,t,e,r){let i=us(e);if(i){du(o,t,i,r);return}Rg(e).then(n=>{if(!n){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}du(o,t,n,r)})}function du(o,t,{width:e,height:r},i){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[n,s,a]=t,c=n/e*100,l=s/r*100,d=a/e*100,h=a/r*100;i.style.left=c-d+"%",i.style.top=l-h+"%",i.style.width=2*d+"%",i.style.height=2*h+"%",i.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[n,s,a,c]=t,l=n/e*100,d=s/r*100,h=a/e*100,f=c/r*100;i.style.left=l+"%",i.style.top=d+"%",i.style.width=h-l+"%",i.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[n,s,a,c]=t,l=n/e*100,d=s/r*100,h=a/e*100,f=c/r*100;i.style.left=l-h+"%",i.style.top=d-f+"%",i.style.width=2*h+"%",i.style.height=2*f+"%",i.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let n=[];for(let b=0;b<t.length;b+=2)n.push({x:t[b],y:t[b+1]});let s=Math.min(...n.map(b=>b.x)),a=Math.max(...n.map(b=>b.x)),c=Math.min(...n.map(b=>b.y)),l=Math.max(...n.map(b=>b.y)),d=s/e*100,h=c/r*100,f=a/e*100,m=l/r*100;i.style.left=d+"%",i.style.top=h+"%",i.style.width=f-d+"%",i.style.height=m-h+"%";let y=n.map(b=>({x:(b.x-s)/(a-s)*100,y:(b.y-c)/(l-c)*100})),w=y.map(b=>`${b.x}% ${b.y}%`).join(",");i.style.clipPath=`polygon(${w})`;let u=y.map(b=>`${b.x},${b.y}`).join(" "),g=b=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${u}' fill='none' stroke='black' stroke-width='${b}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;i.style.setProperty("--qti-shape-outline",g(4)),i.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":i.style.left="0%",i.style.top="0%",i.style.width="100%",i.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var uu=[_,U,x`
7230
7230
  /* Containing block for the absolutely positioned hotspots over the image. Was on this host in
7231
7231
  the theme, together with a 'display: block' this component now owns. */
7232
7232
  :host {
@@ -7275,7 +7275,7 @@ CES.load();
7275
7275
  ::slotted(qti-associable-hotspot) {
7276
7276
  cursor: pointer;
7277
7277
  }
7278
- `];var Cr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bt=class extends D{static{this.styles=ru}#t;#e;constructor(){super(),this.#t=[],this.#e=null,this._response=[],this.minAssociations=0,this.maxAssociations=1,this.addEventListener("qti-register-hotspot",this.#o)}reset(){this.resetValidityReport(),this._response=[],this._internals.setFormValue(null),this.validate(),this.#e=null,this.#h()}validate(){let t=this.#n().length,e=this.maxAssociations>0&&t>this.maxAssociations,r=t<this.minAssociations,i="other",n="";e?(i="max",n=this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):r&&(i="min",n=this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`);let s=!e&&!r;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:i}),s}reportValidity(t){return super.reportValidity(t)}set response(t){this._response=this.#i(t),this.#r(!1),this.#h()}#r(t){let e=this.#n();this._internals.setFormValue(e.length?JSON.stringify(e):null),this.validate(),t&&this.reportValidity({trigger:"change"})}get response(){return this._response}#i(t){return t==null||t===""?[]:Array.isArray(t)?t:[t]}#n(){return this.#i(this._response)}renderSupplementalLines(){return P}render(){return v`<slot name="prompt"></slot>
7278
+ `];var Er=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bt=class extends D{static{this.styles=uu}#t;#e;constructor(){super(),this.#t=[],this.#e=null,this._response=[],this.minAssociations=0,this.maxAssociations=1,this.addEventListener("qti-register-hotspot",this.#o)}reset(){this.resetValidityReport(),this._response=[],this._internals.setFormValue(null),this.validate(),this.#e=null,this.#h()}validate(){let t=this.#n().length,e=this.maxAssociations>0&&t>this.maxAssociations,r=t<this.minAssociations,i="other",n="";e?(i="max",n=this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):r&&(i="min",n=this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`);let s=!e&&!r;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:i}),s}reportValidity(t){return super.reportValidity(t)}set response(t){this._response=this.#i(t),this.#r(!1),this.#h()}#r(t){let e=this.#n();this._internals.setFormValue(e.length?JSON.stringify(e):null),this.validate(),t&&this.reportValidity({trigger:"change"})}get response(){return this._response}#i(t){return t==null||t===""?[]:Array.isArray(t)?t:[t]}#n(){return this.#i(this._response)}renderSupplementalLines(){return P}render(){return v`<slot name="prompt"></slot>
7279
7279
  <line-container
7280
7280
  @click=${t=>{this.#e&&!t.composedPath().some(e=>this.#t.includes(e))&&this.#a()}}
7281
7281
  >
@@ -7284,7 +7284,7 @@ CES.load();
7284
7284
  height=${Ct(this.grImage[0]?.height)}
7285
7285
  viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
7286
7286
  >
7287
- ${H(this.#n(),t=>t,(t,e)=>{let[r,i]=t.split(" "),n=this.querySelector(`[identifier=${r}]`),s=this.querySelector(`[identifier=${i}]`);if(!n||!s)return P;let a=parseInt(n.style.left),c=parseInt(n.style.top),l=parseInt(s.style.left),d=parseInt(s.style.top),h=f=>{f.stopPropagation(),this.#c(e)};return Vi`
7287
+ ${H(this.#n(),t=>t,(t,e)=>{let[r,i]=t.split(" "),n=this.querySelector(`[identifier=${r}]`),s=this.querySelector(`[identifier=${i}]`);if(!n||!s)return P;let a=parseInt(n.style.left),c=parseInt(n.style.top),l=parseInt(s.style.left),d=parseInt(s.style.top),h=f=>{f.stopPropagation(),this.#c(e)};return Fi`
7288
7288
  <line part="line" x1=${a} y1=${c} x2=${l} y2=${d} stroke="currentColor" stroke-width="3" />
7289
7289
  <line
7290
7290
  data-hit
@@ -7300,7 +7300,7 @@ CES.load();
7300
7300
  ><title>Remove line ${r} – ${i}</title></line>
7301
7301
  `})}
7302
7302
  ${this.renderSupplementalLines()}
7303
- ${this.#e&&Vi`<line
7303
+ ${this.#e&&Fi`<line
7304
7304
  part="point"
7305
7305
  x1=${this.startCoord.x}
7306
7306
  y1=${this.startCoord.y}
@@ -7312,7 +7312,7 @@ CES.load();
7312
7312
  </svg>
7313
7313
  <slot></slot>
7314
7314
  </line-container>
7315
- <div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),n=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));te(n,s,e,r)}firstUpdated(){super.firstUpdated(),this.#t=Array.from(this.querySelectorAll("qti-associable-hotspot")),this.addEventListener("mousemove",t=>{let e=this.grImage[0];if(!e)return;let r=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-r.left,y:t.clientY-r.top}}),this.#t.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.tabIndex=0,t.setAttribute("role","button"),t.hasAttribute("aria-label")||t.setAttribute("aria-label",t.getAttribute("hotspot-label")||t.getAttribute("identifier")),t.addEventListener("click",()=>this.#s(t)),t.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.#s(t))})}),this.addEventListener("keydown",t=>{t.key==="Escape"&&this.#e&&this.#a()}),this.#h()}#s(t){if(this.disabled||this.readonly)return;if(!this.#e){if(this.#l(t))return;this.#e=t,this.startCoord=this.#d(t),this.mouseCoord=this.startCoord,this.#h();return}if(t===this.#e){this.#a();return}let e=this.#e.getAttribute("identifier"),r=t.getAttribute("identifier"),i=this.#n(),n=i.some(a=>this.#p(a,e,r)),s=this.maxAssociations===0||i.length<this.maxAssociations;!n&&s&&!this.#l(t)&&(this._response=[...i,`${e} ${r}`],this.saveResponse(this.response),this.#r(!0)),this.#a()}#a(){this.#e=null,this.#h(),this.requestUpdate()}#c(t){this.disabled||this.readonly||(this._response=this.#n().filter((e,r)=>r!==t),this.saveResponse(this.response),this.#r(!0),this.#h())}#p(t,e,r){let[i,n]=t.split(" ");return i===e&&n===r||i===r&&n===e}#l(t){let e=Number(t.getAttribute("match-max")??0);if(!e)return!1;let r=t.getAttribute("identifier");return this.#n().filter(i=>i.split(" ").includes(r)).length>=e}#d(t){let[e,r]=(t.getAttribute("coords")??"0,0").split(",").map(i=>parseInt(i));return{x:e,y:r}}#h(){for(let t of this.#t){let e=t.internals?.states;z(e,"checked",t===this.#e),z(e,"full",this.#l(t))}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};Cr([I()],bt.prototype,"startCoord",void 0);Cr([I()],bt.prototype,"mouseCoord",void 0);Cr([rd({selector:"img"})],bt.prototype,"grImage",void 0);Cr([I()],bt.prototype,"_response",void 0);Cr([p({type:Number,attribute:"min-associations"})],bt.prototype,"minAssociations",void 0);Cr([p({type:Number,attribute:"max-associations"})],bt.prototype,"maxAssociations",void 0);Cr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Gt({emptyAs:[]})})],bt.prototype,"response",null);var hs=[{tag:"qti-graphic-associate-interaction",ctor:bt}];var iu=[R,U,w`
7315
+ <div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),n=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));ee(n,s,e,r)}firstUpdated(){super.firstUpdated(),this.#t=Array.from(this.querySelectorAll("qti-associable-hotspot")),this.addEventListener("mousemove",t=>{let e=this.grImage[0];if(!e)return;let r=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-r.left,y:t.clientY-r.top}}),this.#t.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.tabIndex=0,t.setAttribute("role","button"),t.hasAttribute("aria-label")||t.setAttribute("aria-label",t.getAttribute("hotspot-label")||t.getAttribute("identifier")),t.addEventListener("click",()=>this.#s(t)),t.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.#s(t))})}),this.addEventListener("keydown",t=>{t.key==="Escape"&&this.#e&&this.#a()}),this.#h()}#s(t){if(this.disabled||this.readonly)return;if(!this.#e){if(this.#l(t))return;this.#e=t,this.startCoord=this.#d(t),this.mouseCoord=this.startCoord,this.#h();return}if(t===this.#e){this.#a();return}let e=this.#e.getAttribute("identifier"),r=t.getAttribute("identifier"),i=this.#n(),n=i.some(a=>this.#p(a,e,r)),s=this.maxAssociations===0||i.length<this.maxAssociations;!n&&s&&!this.#l(t)&&(this._response=[...i,`${e} ${r}`],this.saveResponse(this.response),this.#r(!0)),this.#a()}#a(){this.#e=null,this.#h(),this.requestUpdate()}#c(t){this.disabled||this.readonly||(this._response=this.#n().filter((e,r)=>r!==t),this.saveResponse(this.response),this.#r(!0),this.#h())}#p(t,e,r){let[i,n]=t.split(" ");return i===e&&n===r||i===r&&n===e}#l(t){let e=Number(t.getAttribute("match-max")??0);if(!e)return!1;let r=t.getAttribute("identifier");return this.#n().filter(i=>i.split(" ").includes(r)).length>=e}#d(t){let[e,r]=(t.getAttribute("coords")??"0,0").split(",").map(i=>parseInt(i));return{x:e,y:r}}#h(){for(let t of this.#t){let e=t.internals?.states;z(e,"checked",t===this.#e),z(e,"full",this.#l(t))}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};Er([T()],bt.prototype,"startCoord",void 0);Er([T()],bt.prototype,"mouseCoord",void 0);Er([ad({selector:"img"})],bt.prototype,"grImage",void 0);Er([T()],bt.prototype,"_response",void 0);Er([p({type:Number,attribute:"min-associations"})],bt.prototype,"minAssociations",void 0);Er([p({type:Number,attribute:"max-associations"})],bt.prototype,"maxAssociations",void 0);Er([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Gt({emptyAs:[]})})],bt.prototype,"response",null);var ms=[{tag:"qti-graphic-associate-interaction",ctor:bt}];var mu=[_,U,x`
7316
7316
  :host {
7317
7317
  display: flex;
7318
7318
  align-items: flex-start;
@@ -7401,10 +7401,10 @@ CES.load();
7401
7401
  user-select: none;
7402
7402
  pointer-events: none;
7403
7403
  }
7404
- `];var bg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vg=Ft(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='bank']"),kr=class extends zt(vg,'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1,this.autoSizeDropzones=!1,this._graphicScale=1,this.#t=null,this.#e=null,this.#s=t=>{this.#n(t.target)}}static{this.styles=iu}#t;#e;render(){let t=`--qti-graphic-scale: ${this._graphicScale}`;return v` <slot name="prompt"></slot>
7404
+ `];var _g=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Mg=Ft(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='bank']"),Sr=class extends zt(Mg,'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1,this.autoSizeDropzones=!1,this._graphicScale=1,this.#t=null,this.#e=null,this.#s=t=>{this.#n(t.target)}}static{this.styles=mu}#t;#e;render(){let t=`--qti-graphic-scale: ${this._graphicScale}`;return v` <slot name="prompt"></slot>
7405
7405
  <slot part="image" style=${t}></slot>
7406
7406
  <slot part="bank drags" name="drags" class="hover-border" style=${t}></slot>
7407
- <div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#r(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#i(t){if(t.style.aspectRatio)return;let e=n=>{let s=(t.getAttribute(n)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},r=e("width"),i=e("height");r&&i&&(t.style.aspectRatio=`${r} / ${i}`)}#n(t){let e=this.#r(),r=t.getAttribute("coords"),i=t.getAttribute("shape");!e||!r||!i||(this.#i(e),this.#o(e),te(i,r.split(",").map(n=>parseFloat(n)),e,t))}#o(t){this.#e!==t&&(this.#t?.disconnect(),this.#e=t,this.#t=new ResizeObserver(()=>{let e=parseFloat(t.getAttribute("width")??""),r=t.getBoundingClientRect().width,i=e>0&&r>0?Math.min(1,r/e):1,n=Math.round(i*1e3)/1e3;n!==this._graphicScale&&(this._graphicScale=n)}),this.#t.observe(t))}#s;connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#s),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#n(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s),this.#t?.disconnect(),this.#t=null,this.#e=null}};bg([I()],kr.prototype,"_graphicScale",void 0);var ps=[{tag:"qti-graphic-gap-match-interaction",ctor:kr}];var nu=[R,U,w`
7407
+ <div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#r(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#i(t){if(t.style.aspectRatio)return;let e=n=>{let s=(t.getAttribute(n)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},r=e("width"),i=e("height");r&&i&&(t.style.aspectRatio=`${r} / ${i}`)}#n(t){let e=this.#r(),r=t.getAttribute("coords"),i=t.getAttribute("shape");!e||!r||!i||(this.#i(e),this.#o(e),ee(i,r.split(",").map(n=>parseFloat(n)),e,t))}#o(t){this.#e!==t&&(this.#t?.disconnect(),this.#e=t,this.#t=new ResizeObserver(()=>{let e=parseFloat(t.getAttribute("width")??""),r=t.getBoundingClientRect().width,i=e>0&&r>0?Math.min(1,r/e):1,n=Math.round(i*1e3)/1e3;n!==this._graphicScale&&(this._graphicScale=n)}),this.#t.observe(t))}#s;connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#s),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#n(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s),this.#t?.disconnect(),this.#t=null,this.#e=null}};_g([T()],Sr.prototype,"_graphicScale",void 0);var fs=[{tag:"qti-graphic-gap-match-interaction",ctor:Sr}];var fu=[_,U,x`
7408
7408
  /* The order pins are anchored outside their hotspot's box. */
7409
7409
  :host {
7410
7410
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
@@ -7442,11 +7442,11 @@ CES.load();
7442
7442
  pointer-events: none;
7443
7443
  user-select: none;
7444
7444
  }
7445
- `];var ou=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ge=class o extends Xe(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#n=t=>{this.#i(t.target),this.refreshLocatorPins()}}static{this.styles=nu}static#t="cito-graphic-order-marker";render(){return v`
7445
+ `];var gu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ye=class o extends Ge(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#n=t=>{this.#i(t.target),this.refreshLocatorPins()}}static{this.styles=fu}static#t="cito-graphic-order-marker";render(){return v`
7446
7446
  <slot name="prompt"></slot>
7447
7447
  <slot></slot>
7448
7448
  <div role="alert" part="message" id="validation-message"></div>
7449
- `}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(n=>n.identifier===e))return;let r=[...this.#e()],i=r.indexOf(e);if(i>=0)r.splice(i,1);else{let n=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(r.length>=n)return;r.push(e)}this.response=r,this.saveResponse(this.response),this.updateComplete.then(()=>{this.validate(),this.reportValidity({trigger:"change"})})}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#r(t){return`--qti-graphic-order-${(t.identifier||t.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(t){return"var(--qti-selected-bg)"}refreshLocatorPins(){let t=this.#e();for(let n of this._choiceElements){let s=t.indexOf(n.identifier);n.order=s>=0?s+1:null}let e=this._choiceElements.filter(n=>n.order!=null).sort((n,s)=>n.order-s.order),r=Array.from(this.querySelectorAll(`.${o.#t}`));r.length===e.length&&e.every((n,s)=>{let a=r[s];return a.textContent===String(n.order)&&a.style.getPropertyValue("position-anchor")===this.#r(n)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(n)})||(r.forEach(n=>n.remove()),this._choiceElements.forEach(n=>{n.style.removeProperty("anchor-name")}),e.forEach(n=>{let s=this.#r(n);n.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(n)),n.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(n.order),this.append(a)}))}#i(t){let e=tu(this),r=t.getAttribute("coords"),i=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let n=r.split(",").map(s=>parseInt(s));te(i,n,e,t)}#n;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#n),this.refreshLocatorPins(),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#i(t))}disconnectedCallback(){this.querySelectorAll(`.${o.#t}`).forEach(t=>t.remove()),super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#n)}};ou([p({type:Number,attribute:"max-choices"})],Ge.prototype,"maxChoices",void 0);ou([N("response")],Ge.prototype,"handleOrderedResponseChange",null);var us=[{tag:"qti-graphic-order-interaction",ctor:Ge}];var su=[R,U,w`
7449
+ `}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(n=>n.identifier===e))return;let r=[...this.#e()],i=r.indexOf(e);if(i>=0)r.splice(i,1);else{let n=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(r.length>=n)return;r.push(e)}this.response=r,this.saveResponse(this.response),this.updateComplete.then(()=>{this.validate(),this.reportValidity({trigger:"change"})})}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#r(t){return`--qti-graphic-order-${(t.identifier||t.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(t){return"var(--qti-selected-bg)"}refreshLocatorPins(){let t=this.#e();for(let n of this._choiceElements){let s=t.indexOf(n.identifier);n.order=s>=0?s+1:null}let e=this._choiceElements.filter(n=>n.order!=null).sort((n,s)=>n.order-s.order),r=Array.from(this.querySelectorAll(`.${o.#t}`));r.length===e.length&&e.every((n,s)=>{let a=r[s];return a.textContent===String(n.order)&&a.style.getPropertyValue("position-anchor")===this.#r(n)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(n)})||(r.forEach(n=>n.remove()),this._choiceElements.forEach(n=>{n.style.removeProperty("anchor-name")}),e.forEach(n=>{let s=this.#r(n);n.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(n)),n.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(n.order),this.append(a)}))}#i(t){let e=hu(this),r=t.getAttribute("coords"),i=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let n=r.split(",").map(s=>parseInt(s));ee(i,n,e,t)}#n;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#n),this.refreshLocatorPins(),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#i(t))}disconnectedCallback(){this.querySelectorAll(`.${o.#t}`).forEach(t=>t.remove()),super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#n)}};gu([p({type:Number,attribute:"max-choices"})],Ye.prototype,"maxChoices",void 0);gu([N("response")],Ye.prototype,"handleOrderedResponseChange",null);var gs=[{tag:"qti-graphic-order-interaction",ctor:Ye}];var bu=[_,U,x`
7450
7450
  :host {
7451
7451
  display: block;
7452
7452
  }
@@ -7495,17 +7495,17 @@ CES.load();
7495
7495
  max-width: 100%;
7496
7496
  height: auto;
7497
7497
  }
7498
- `];var si=class extends Xe(D,"qti-hotspot-choice"){static{this.styles=su}render(){return v`
7498
+ `];var ci=class extends Ge(D,"qti-hotspot-choice"){static{this.styles=bu}render(){return v`
7499
7499
  <slot name="prompt"></slot>
7500
7500
  <slot></slot>
7501
7501
  <div part="message" role="alert" id="validation-message"></div>
7502
- `}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let r=()=>{t.removeEventListener("load",r),e(t)};t.addEventListener("load",r)})),this.#t}async#r(t){let e=this.querySelector("img");if(!e)return;let r=t.getAttribute("coords"),i=t.getAttribute("shape"),n=r.split(",").map(a=>parseInt(a)),s=await this.#e(e);te(i,n,s,t)}#i=t=>{this.#r(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#i),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var ms=[{tag:"qti-hotspot-interaction",ctor:si}];var au=[R,U,w`
7502
+ `}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let r=()=>{t.removeEventListener("load",r),e(t)};t.addEventListener("load",r)})),this.#t}async#r(t){let e=this.querySelector("img");if(!e)return;let r=t.getAttribute("coords"),i=t.getAttribute("shape"),n=r.split(",").map(a=>parseInt(a)),s=await this.#e(e);ee(i,n,s,t)}#i=t=>{this.#r(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#i),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var bs=[{tag:"qti-hotspot-interaction",ctor:ci}];var vu=[_,U,x`
7503
7503
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
7504
7504
  :host {
7505
7505
  display: block;
7506
7506
  }
7507
- `];var ai=class extends Xe(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>v`<slot></slot>
7508
- <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=au}};var fs=[{tag:"qti-hottext-interaction",ctor:ai}];var Gc=(o,t="[part='menu']",e="[part='trigger']",r="--qti-inline-choice-width")=>{class i extends o{#t=null;#e=null;#r=null;#i=0;#n=null;shouldAutoSizeMenu(){return!1}menuAutoSizeExtraWidth(){return 0}menuAutoSizePropertyTarget(){return this.renderRoot?.querySelector(e)??null}menuAutoSizeRows(){let s=this.renderRoot?.querySelector(t);return s?Array.from(s.children).flatMap(a=>a instanceof HTMLSlotElement?a.assignedElements().filter(c=>c instanceof HTMLElement):a instanceof HTMLElement?[a]:[]):[]}withMenuMeasurable(s){let a=this.renderRoot?.querySelector(t);if(!a)return s();let c=a.matches(":popover-open"),l=a.style.visibility,d=a.style.display;c||(a.style.visibility="hidden",a.style.display="block",a.showPopover?.());try{return s()}finally{c||(a.hidePopover?.(),a.style.visibility=l,a.style.display=d)}}updateMenuWidth(){if(!this.isConnected||!this.shouldAutoSizeMenu())return;let s=this.menuAutoSizePropertyTarget();if(!s)return;let a=this.renderRoot?.querySelector(t);a&&this.#c(a),this.#s();let c=this.#o()+this.menuAutoSizeExtraWidth();c<=0||c===this.#n||(this.#n=c,s.style.setProperty(r,`${c}px`))}#o(){return this.withMenuMeasurable(()=>{let s=0;for(let l of this.menuAutoSizeRows()){let d=l.style.width;l.style.width="max-content",s=Math.max(s,l.getBoundingClientRect().width),l.style.width=d}if(s<=0)return 0;let a=this.renderRoot?.querySelector(t);if(!a)return s;let c=getComputedStyle(a);return s+parseFloat(c.paddingLeft)+parseFloat(c.paddingRight)})}#s(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#a()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#a(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMenuWidth()}))}#c(s){typeof ResizeObserver>"u"||this.#e===s||(this.#t??=new ResizeObserver(()=>{this.#e?.matches(":popover-open")&&this.#a()}),this.#e&&this.#t.unobserve(this.#e),this.#t.observe(s),this.#e=s)}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e=null,this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return i};var yg=w`
7507
+ `];var li=class extends Ge(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>v`<slot></slot>
7508
+ <div part="message" role="alert" id="validation-message"></div>`}static{this.styles=vu}};var vs=[{tag:"qti-hottext-interaction",ctor:li}];var tl=(o,t="[part='menu']",e="[part='trigger']",r="--qti-inline-choice-width")=>{class i extends o{#t=null;#e=null;#r=null;#i=0;#n=null;shouldAutoSizeMenu(){return!1}menuAutoSizeExtraWidth(){return 0}menuAutoSizePropertyTarget(){return this.renderRoot?.querySelector(e)??null}menuAutoSizeRows(){let s=this.renderRoot?.querySelector(t);return s?Array.from(s.children).flatMap(a=>a instanceof HTMLSlotElement?a.assignedElements().filter(c=>c instanceof HTMLElement):a instanceof HTMLElement?[a]:[]):[]}withMenuMeasurable(s){let a=this.renderRoot?.querySelector(t);if(!a)return s();let c=a.matches(":popover-open"),l=a.style.visibility,d=a.style.display;c||(a.style.visibility="hidden",a.style.display="block",a.showPopover?.());try{return s()}finally{c||(a.hidePopover?.(),a.style.visibility=l,a.style.display=d)}}updateMenuWidth(){if(!this.isConnected||!this.shouldAutoSizeMenu())return;let s=this.menuAutoSizePropertyTarget();if(!s)return;let a=this.renderRoot?.querySelector(t);a&&this.#c(a),this.#s();let c=this.#o()+this.menuAutoSizeExtraWidth();c<=0||c===this.#n||(this.#n=c,s.style.setProperty(r,`${c}px`))}#o(){return this.withMenuMeasurable(()=>{let s=0;for(let l of this.menuAutoSizeRows()){let d=l.style.width;l.style.width="max-content",s=Math.max(s,l.getBoundingClientRect().width),l.style.width=d}if(s<=0)return 0;let a=this.renderRoot?.querySelector(t);if(!a)return s;let c=getComputedStyle(a);return s+parseFloat(c.paddingLeft)+parseFloat(c.paddingRight)})}#s(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#a()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#a(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMenuWidth()}))}#c(s){typeof ResizeObserver>"u"||this.#e===s||(this.#t??=new ResizeObserver(()=>{this.#e?.matches(":popover-open")&&this.#a()}),this.#e&&this.#t.unobserve(this.#e),this.#t.observe(s),this.#e=s)}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e=null,this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return i};var Pg=x`
7509
7509
  /* ── Host ──────────────────────────────────────────────────────────────────
7510
7510
  Inline-block so the element flows with surrounding text.
7511
7511
  --qti-inline-choice-width is the single width control surface:
@@ -7723,7 +7723,7 @@ CES.load();
7723
7723
  z-index: var(--qti-overlay-z-index);
7724
7724
  white-space: nowrap;
7725
7725
  }
7726
- `,qg=yg,cu=qg;var ee=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},xg=0,rt=class extends Gc(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${xg++}`,this._handleDataPromptChange=()=>{this.#r()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity({trigger:"change"})},this._pendingResponse=void 0,this.#o=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#s=t=>{this.disabled||this.readonly||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#n(!0))},this.#a=t=>{let r=t.newState==="open";this._dropdownOpen!==r&&(this._dropdownOpen=r),r?this._internals.states.add("open"):this._internals.states.delete("open")},this.#c=t=>{if(!this._dropdownOpen)return;if(t.key==="Escape"){t.preventDefault(),this.#n(!1),this.#p();return}let e=this.#b(),r=this.renderRoot.activeElement,i=this.#l(),n=r||(i instanceof HTMLElement&&this.#d(i)?i:null),s=e.findIndex(a=>a===n);if(t.key==="ArrowDown"&&(t.preventDefault(),e[Math.min(e.length-1,Math.max(0,s+1))]?.focus()),t.key==="ArrowUp"&&(t.preventDefault(),e[Math.max(0,s-1)]?.focus()),t.key==="Enter"||t.key===" "){if(!n)return;if(t.preventDefault(),n instanceof HTMLButtonElement)n.click();else{let a=n.getAttribute("identifier")??"";this.#i(a)}}},this.#m=()=>{this.#r()},this.#f=t=>{if(this.disabled||this.readonly)return;let r=t.currentTarget.getAttribute("identifier")??"";this.#i(r)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[cu]}renderTrigger(){let t=this.#e();return v`
7726
+ `,Og=Pg,yu=Og;var re=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Dg=0,rt=class extends tl(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${Dg++}`,this._handleDataPromptChange=()=>{this.#r()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity({trigger:"change"})},this._pendingResponse=void 0,this.#o=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#s=t=>{this.disabled||this.readonly||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#n(!0))},this.#a=t=>{let r=t.newState==="open";this._dropdownOpen!==r&&(this._dropdownOpen=r),r?this._internals.states.add("open"):this._internals.states.delete("open")},this.#c=t=>{if(!this._dropdownOpen)return;if(t.key==="Escape"){t.preventDefault(),this.#n(!1),this.#p();return}let e=this.#v(),r=this.renderRoot.activeElement,i=this.#l(),n=r||(i instanceof HTMLElement&&this.#d(i)?i:null),s=e.findIndex(a=>a===n);if(t.key==="ArrowDown"&&(t.preventDefault(),e[Math.min(e.length-1,Math.max(0,s+1))]?.focus()),t.key==="ArrowUp"&&(t.preventDefault(),e[Math.max(0,s-1)]?.focus()),t.key==="Enter"||t.key===" "){if(!n)return;if(t.preventDefault(),n instanceof HTMLButtonElement)n.click();else{let a=n.getAttribute("identifier")??"";this.#i(a)}}},this.#m=()=>{this.#r()},this.#f=t=>{if(this.disabled||this.readonly)return;let r=t.currentTarget.getAttribute("identifier")??"";this.#i(r)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[yu]}renderTrigger(){let t=this.#e();return v`
7727
7727
  <button
7728
7728
  part="trigger"
7729
7729
  type="button"
@@ -7767,7 +7767,7 @@ CES.load();
7767
7767
  </button>
7768
7768
  <slot @slotchange=${this.#m}></slot>
7769
7769
  </div>
7770
- `}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#r(),this.#u(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#v(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#r()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#g(),this.#b()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#g()}#t(){let t=this.options[0]?.content;return typeof t=="string"&&t.trim()===""}menuAutoSizeRows(){let t=super.menuAutoSizeRows();return this.#t()?t.filter(e=>!e.matches('button[part~="option-prompt"]')):t}#e(){return this.options.find(t=>t.selected)??this.options[0]}#r(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt??this.configContext?.inlineChoicePrompt??"select",r=this._pendingResponse,i=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",n=[{content:e,value:"",selected:i===""},...t.map(a=>{let c=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(l=>l.cloneNode(!0)),value:c,selected:c!==""&&c===i}})],s=n.some(a=>a.selected);this.options=s?n:n.map((a,c)=>({...a,selected:c===0})),this._pendingResponse=void 0,this.#g(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize===!1?!1:!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-"))}menuAutoSizeExtraWidth(){let t=this.renderRoot.querySelector('span[part~="icon"]');if(!t)return 0;let e=this.renderRoot.querySelector('button[part="trigger"]'),r=e&&parseFloat(getComputedStyle(e).columnGap)||0;return t.offsetWidth+r}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,r=this.required||this.minChoices>=1,i=e||!r,n=this.dataset.minSelectionsMessage||this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(i,i?"":n,this,{suppressInline:!0,kind:"min"}),i}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this.#n(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#g()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(r=>({...r,selected:r.value===e})),this.#g()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#i(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#g(),this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(t),this.#n(!1)}#n(t){let e=this.#h();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#o;#s;#a;#c;#p(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#l(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#d(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#h(){return this.renderRoot.querySelector(`#${this._menuId}`)}#u(){this._slotObserver=new MutationObserver(()=>this.#r()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#m;#f;#v(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#f),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#g(){this._internals.setFormValue(this.response),await this.updateComplete;let t=this.options.find(r=>r.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let r of e){let n=(r.getAttribute("identifier")??"")===t;r.removeEventListener("click",this.#f),r.addEventListener("click",this.#f),r.disabled=this.disabled,r.readonly=this.readonly,r.internals.role="option",r.internals.ariaSelected=n?"true":"false",r.internals.ariaChecked=n?"true":"false",r.internals.ariaDisabled=this.disabled?"true":"false",r.internals.ariaReadOnly=this.readonly?"true":"false",n?r.internals.states.add("checked"):r.internals.states.delete("checked"),r.tabIndex=-1}}#b(){let t=this.renderRoot.querySelector('button[part~="option"]:not([hidden])'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};ee([I()],rt.prototype,"options",void 0);ee([I()],rt.prototype,"_dropdownOpen",void 0);ee([_({context:yt,subscribe:!0}),p({attribute:!1})],rt.prototype,"configContext",void 0);ee([p({type:String,attribute:"data-prompt"})],rt.prototype,"dataPrompt",void 0);ee([p({type:String,attribute:"data-clear-label"})],rt.prototype,"dataClearLabel",void 0);ee([N("dataPrompt",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleDataPromptChange",void 0);ee([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],rt.prototype,"required",void 0);ee([p({type:Number,attribute:"min-choices"})],rt.prototype,"minChoices",void 0);ee([N(["required","minChoices"],{waitUntilFirstUpdate:!0})],rt.prototype,"_handleRequiredChange",void 0);ee([p({attribute:"response",reflect:!1,noAccessor:!0})],rt.prototype,"response",null);var gs=[{tag:"qti-inline-choice-interaction",ctor:rt}];var lu=[R,U,w`
7770
+ `}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#r(),this.#u(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#r()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#g(),this.#v()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#g()}#t(){let t=this.options[0]?.content;return typeof t=="string"&&t.trim()===""}menuAutoSizeRows(){let t=super.menuAutoSizeRows();return this.#t()?t.filter(e=>!e.matches('button[part~="option-prompt"]')):t}#e(){return this.options.find(t=>t.selected)??this.options[0]}#r(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt??this.configContext?.inlineChoicePrompt??"select",r=this._pendingResponse,i=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",n=[{content:e,value:"",selected:i===""},...t.map(a=>{let c=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(l=>l.cloneNode(!0)),value:c,selected:c!==""&&c===i}})],s=n.some(a=>a.selected);this.options=s?n:n.map((a,c)=>({...a,selected:c===0})),this._pendingResponse=void 0,this.#g(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize===!1?!1:!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-"))}menuAutoSizeExtraWidth(){let t=this.renderRoot.querySelector('span[part~="icon"]');if(!t)return 0;let e=this.renderRoot.querySelector('button[part="trigger"]'),r=e&&parseFloat(getComputedStyle(e).columnGap)||0;return t.offsetWidth+r}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,r=this.required||this.minChoices>=1,i=e||!r,n=this.dataset.minSelectionsMessage||this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(i,i?"":n,this,{suppressInline:!0,kind:"min"}),i}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this.#n(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#g()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(r=>({...r,selected:r.value===e})),this.#g()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#i(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#g(),this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(t),this.#n(!1)}#n(t){let e=this.#h();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#o;#s;#a;#c;#p(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#l(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#d(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#h(){return this.renderRoot.querySelector(`#${this._menuId}`)}#u(){this._slotObserver=new MutationObserver(()=>this.#r()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#m;#f;#b(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#f),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#g(){this._internals.setFormValue(this.response),await this.updateComplete;let t=this.options.find(r=>r.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let r of e){let n=(r.getAttribute("identifier")??"")===t;r.removeEventListener("click",this.#f),r.addEventListener("click",this.#f),r.disabled=this.disabled,r.readonly=this.readonly,r.internals.role="option",r.internals.ariaSelected=n?"true":"false",r.internals.ariaChecked=n?"true":"false",r.internals.ariaDisabled=this.disabled?"true":"false",r.internals.ariaReadOnly=this.readonly?"true":"false",n?r.internals.states.add("checked"):r.internals.states.delete("checked"),r.tabIndex=-1}}#v(){let t=this.renderRoot.querySelector('button[part~="option"]:not([hidden])'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};re([T()],rt.prototype,"options",void 0);re([T()],rt.prototype,"_dropdownOpen",void 0);re([R({context:yt,subscribe:!0}),p({attribute:!1})],rt.prototype,"configContext",void 0);re([p({type:String,attribute:"data-prompt"})],rt.prototype,"dataPrompt",void 0);re([p({type:String,attribute:"data-clear-label"})],rt.prototype,"dataClearLabel",void 0);re([N("dataPrompt",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleDataPromptChange",void 0);re([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],rt.prototype,"required",void 0);re([p({type:Number,attribute:"min-choices"})],rt.prototype,"minChoices",void 0);re([N(["required","minChoices"],{waitUntilFirstUpdate:!0})],rt.prototype,"_handleRequiredChange",void 0);re([p({attribute:"response",reflect:!1,noAccessor:!0})],rt.prototype,"response",null);var ys=[{tag:"qti-inline-choice-interaction",ctor:rt}];var qu=[_,U,x`
7771
7771
  /*
7772
7772
  * A custom element is inline unless it says otherwise, and this one never did. Its shadow content
7773
7773
  * is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
@@ -7873,7 +7873,7 @@ CES.load();
7873
7873
  :host(:disabled:not(.qti-match-tabular)) ::slotted(qti-simple-match-set:first-of-type) {
7874
7874
  display: none;
7875
7875
  }
7876
- `];var du=[R,w`
7876
+ `];var wu=[_,x`
7877
7877
  :host(.qti-match-tabular) slot:not([hidden]) {
7878
7878
  display: contents;
7879
7879
  }
@@ -7962,7 +7962,7 @@ CES.load();
7962
7962
  justify-content: center;
7963
7963
  flex-shrink: 0;
7964
7964
  }
7965
- `];var bs=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},re=class extends zt(Ft(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[data-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.maxAssociations=1,this.minAssociations=0,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,r=e.value,i=e.name,n=e.type;e.checked?(this.response?this.response.indexOf(r)===-1&&(n==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(i)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==r),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}static{this.styles=[lu,du]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(t){this.classList.contains("qti-match-tabular")?this._response=t:super.response=t}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...t){this.classList.contains("qti-match-tabular")||super.initiateDrag(...t)}afterCache(){this.classList.contains("qti-match-tabular")||super.afterCache()}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.syncTabularSlotting()}willUpdate(t){super.willUpdate?.(t),t.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let t=this.classList.contains("qti-match-tabular"),e=this.querySelectorAll(":scope > qti-simple-match-set"),r=e[0],i=e[1],n=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(r?.setAttribute("slot","match-rows"),i?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{n(s),s.setAttribute("role","rowheader"),s.tabIndex=-1}),this.targetChoices?.forEach(s=>{n(s),s.setAttribute("role","columnheader"),s.tabIndex=-1})):(r?.removeAttribute("slot"),i?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}),this.targetChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return v`
7965
+ `];var qs=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ie=class extends zt(Ft(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[data-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.maxAssociations=1,this.minAssociations=0,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,r=e.value,i=e.name,n=e.type;e.checked?(this.response?this.response.indexOf(r)===-1&&(n==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(i)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==r),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}static{this.styles=[qu,wu]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(t){this.classList.contains("qti-match-tabular")?this._response=t:super.response=t}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...t){this.classList.contains("qti-match-tabular")||super.initiateDrag(...t)}afterCache(){this.classList.contains("qti-match-tabular")||super.afterCache()}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.syncTabularSlotting()}willUpdate(t){super.willUpdate?.(t),t.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let t=this.classList.contains("qti-match-tabular"),e=this.querySelectorAll(":scope > qti-simple-match-set"),r=e[0],i=e[1],n=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(r?.setAttribute("slot","match-rows"),i?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{n(s),s.setAttribute("role","rowheader"),s.tabIndex=-1}),this.targetChoices?.forEach(s=>{n(s),s.setAttribute("role","columnheader"),s.tabIndex=-1})):(r?.removeAttribute("slot"),i?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}),this.targetChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return v`
7966
7966
  <slot name="prompt"></slot>
7967
7967
  <slot ?hidden=${t}></slot>
7968
7968
 
@@ -7980,7 +7980,7 @@ CES.load();
7980
7980
  <div part="cells checkbox-grid">
7981
7981
  ${this.sourceChoices.map((e,r)=>v`
7982
7982
  <div role="row" style="display: contents;">
7983
- ${this.targetChoices.map((i,n)=>{let s=e.getAttribute("identifier"),a=i.getAttribute("identifier"),c=`${s} ${a}`,l=(this.response||[]).filter(g=>g.split(" ")[0]===s).length||0,d=this.response?.includes(c)||!1,h=e.matchMax===1?"radio":"checkbox",f=this.getCellStateVariant(c,d),m=d?"checked":"",y=`control ${h} ${m} ${f}`.trim(),x=`control-mark ${h} ${m} ${f}`.trim(),u=e.matchMax===1?!1:e.matchMax!==0&&l>=e.matchMax&&!d;return v`
7983
+ ${this.targetChoices.map((i,n)=>{let s=e.getAttribute("identifier"),a=i.getAttribute("identifier"),c=`${s} ${a}`,l=(this.response||[]).filter(g=>g.split(" ")[0]===s).length||0,d=this.response?.includes(c)||!1,h=e.matchMax===1?"radio":"checkbox",f=this.getCellStateVariant(c,d),m=d?"checked":"",y=`control ${h} ${m} ${f}`.trim(),w=`control-mark ${h} ${m} ${f}`.trim(),u=e.matchMax===1?!1:e.matchMax!==0&&l>=e.matchMax&&!d;return v`
7984
7984
  <label
7985
7985
  part="cell input-cell"
7986
7986
  role="gridcell"
@@ -7996,7 +7996,7 @@ CES.load();
7996
7996
  @click=${g=>e.matchMax===1?this.handleRadioClick(g):null}
7997
7997
  />
7998
7998
  <span part=${y} role=${h} aria-checked=${d?"true":"false"}>
7999
- <span part=${x}></span>
7999
+ <span part=${w}></span>
8000
8000
  </span>
8001
8001
  </label>
8002
8002
  `})}
@@ -8007,13 +8007,13 @@ CES.load();
8007
8007
  `:P}
8008
8008
 
8009
8009
  <div role="alert" part="message" id="validation-message"></div>
8010
- `}};bs([p({type:String})],re.prototype,"class",void 0);bs([p({type:String,attribute:"data-first-column-header"})],re.prototype,"dataFirstColumnHeader",void 0);bs([I()],re.prototype,"_response",void 0);bs([p({type:String,attribute:"response-identifier"})],re.prototype,"responseIdentifier",void 0);var vs=[{tag:"qti-match-interaction",ctor:re}];var hu=[R,w`
8010
+ `}};qs([p({type:String})],ie.prototype,"class",void 0);qs([p({type:String,attribute:"data-first-column-header"})],ie.prototype,"dataFirstColumnHeader",void 0);qs([T()],ie.prototype,"_response",void 0);qs([p({type:String,attribute:"response-identifier"})],ie.prototype,"responseIdentifier",void 0);var ws=[{tag:"qti-match-interaction",ctor:ie}];var xu=[_,x`
8011
8011
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
8012
8012
  :host {
8013
8013
  display: block;
8014
8014
  }
8015
- `];var ys=class extends D{static{this.styles=hu}#t=null;reset(){this.#t=null}validate(){return!0}get response(){return this.#t?this.#t.toString():null}set response(t){if(t)if(!isNaN(parseInt(t?.toString())))this.#t=parseInt(t.toString());else throw new Error(`Value must be a number ${t}`)}static get properties(){return{...D.properties,step:{type:Number,attribute:"step",default:10}}}render(){return v` <slot name="prompt"></slot>
8016
- <slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var qs=[{tag:"qti-media-interaction",ctor:ys}];var pu=[R,U,Qt,w`
8015
+ `];var xs=class extends D{static{this.styles=xu}#t=null;reset(){this.#t=null}validate(){return!0}get response(){return this.#t?this.#t.toString():null}set response(t){if(t)if(!isNaN(parseInt(t?.toString())))this.#t=parseInt(t.toString());else throw new Error(`Value must be a number ${t}`)}static get properties(){return{...D.properties,step:{type:Number,attribute:"step",default:10}}}render(){return v` <slot name="prompt"></slot>
8016
+ <slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var Cs=[{tag:"qti-media-interaction",ctor:xs}];var Cu=[_,U,Qt,x`
8017
8017
  /* The box this element already had. See the note in qti-match-interaction.styles.ts. */
8018
8018
  :host {
8019
8019
  display: block;
@@ -8231,7 +8231,7 @@ CES.load();
8231
8231
  :host([answer-key]) [part~='drags'] {
8232
8232
  display: none;
8233
8233
  }
8234
- `];var uu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},wg=Ft(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Ye=class extends zt(wg,'[data-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=pu}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),v` <slot name="prompt"> </slot>
8234
+ `];var ku=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},$g=Ft(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Je=class extends zt($g,'[data-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=Cu}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),v` <slot name="prompt"> </slot>
8235
8235
  <div part="container">
8236
8236
  <slot part="bank drags"> </slot>
8237
8237
  <div part="drops">
@@ -8240,7 +8240,7 @@ CES.load();
8240
8240
  </div>`})}
8241
8241
  </div>
8242
8242
  <div id="validation-message" part="message" role="alert" style="display:none;"></div>
8243
- </div>`}getValue(t){return t?.map((e,r)=>`${e} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};uu([I()],Ye.prototype,"nrChoices",void 0);uu([p({type:String})],Ye.prototype,"orientation",void 0);var xs=[{tag:"qti-order-interaction",ctor:Ye}];var mu=`@layer qti-base {
8243
+ </div>`}getValue(t){return t?.map((e,r)=>`${e} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};ku([T()],Je.prototype,"nrChoices",void 0);ku([p({type:String})],Je.prototype,"orientation",void 0);var ks=[{tag:"qti-order-interaction",ctor:Je}];var Eu=`@layer qti-base {
8244
8244
  /* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */
8245
8245
  /* ============================
8246
8246
  QTI 3 shared css
@@ -9796,7 +9796,7 @@ CES.load();
9796
9796
  }
9797
9797
  }
9798
9798
  }
9799
- `;var fu=[R,w`
9799
+ `;var Su=[_,x`
9800
9800
  :host {
9801
9801
  display: block;
9802
9802
  width: 100%;
@@ -9806,18 +9806,18 @@ CES.load();
9806
9806
  ::slotted(qti-interaction-markup) {
9807
9807
  display: none;
9808
9808
  }
9809
- `];var Cn=o=>o==="file",ws=o=>typeof o=="object"&&o!==null&&typeof o.data=="string",kn=o=>o==null||o===""?null:typeof o=="string"?o:!ws(o)||o.data===""?null:o.data.startsWith("data:")?o.data:`data:${o.mime||"application/octet-stream"};base64,${o.data}`,En=o=>{if(o==null||o==="")return null;if(typeof o=="object")return ws(o)?o:null;let t=String(o),e=/^data:([^;,]*)((?:;[^;,]*)*),([\s\S]*)$/.exec(t);if(!e)return{data:t,mime:"application/octet-stream"};let[,r,i,n]=e;if(i.split(";").includes("base64"))return{data:n,mime:r||"text/plain"};let s="";return new TextEncoder().encode(decodeURIComponent(n)).forEach(a=>s+=String.fromCharCode(a)),{data:btoa(s),mime:r||"text/plain"}};var Cg=new Set(["point","pair","directedPair"]),ci=(o,t)=>{if(o==null)return o;if(Cn(t))return En(o);switch(t){case"integer":{if(typeof o=="number")return o;let e=parseInt(String(o),10);return Number.isNaN(e)?o:e}case"float":case"duration":{if(typeof o=="number")return o;let e=parseFloat(String(o));return Number.isNaN(e)?o:e}case"boolean":{if(typeof o=="boolean")return o;if(typeof o=="string"){let e=o.toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return o}case"point":{let r=(Array.isArray(o)?o:String(o).trim().split(/[\s,]+/)).map(i=>typeof i=="number"?i:parseFloat(String(i)));return r.length===2&&r.every(Number.isFinite)?r:o}case"pair":case"directedPair":{let e=Array.isArray(o)?o:String(o).trim().split(/\s+/);return e.length===2?e.map(String):o}default:return String(o)}},kg=(o,t,e)=>{if(e)return Array.isArray(t)&&!Cg.has(e)?{name:o,list:{[e]:t.map(r=>ci(r,e))}}:t==null?{name:o,base:null}:{name:o,base:{[e]:ci(t,e)}};if(Array.isArray(t)){let r=t.filter(i=>i!=null);if(r.length&&r.every(i=>typeof i=="boolean"))return{name:o,list:{boolean:r}};if(r.length&&r.every(i=>typeof i=="number")){let i=r,n=i.every(s=>Number.isInteger(s));return{name:o,list:{[n?"integer":"float"]:i}}}return{name:o,list:{string:t.map(i=>i==null?"":String(i))}}}if(typeof t=="boolean")return{name:o,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:o,base:{integer:t}}:{name:o,base:{float:t}};if(t==null)return{name:o,base:{string:""}};if(typeof t=="object")try{return{name:o,base:{string:JSON.stringify(t)}}}catch{return{name:o,base:{string:String(t)}}}return{name:o,base:{string:String(t)}}},Cs=(o,t={})=>{if(!de(o))return{record:[]};let e=[];for(let[r,i]of Object.entries(o))e.push(kg(r,i,t[r]));return{record:e}},Eg=(o,t={})=>{if(!de(o))return{...t};let e={};for(let[r,i]of Object.entries(o))e[r]=t[r]??po(Array.isArray(i)?i[0]:i);return e},vu=(o,t={})=>Cs(o,Eg(o,t)),gu=o=>{if(o==null)return null;if(Array.isArray(o))return o.map(String).join(" ");if(ws(o))return kn(o);if(typeof o=="object")try{return JSON.stringify(o)}catch{return String(o)}return String(o)},bu=o=>{if(o)for(let t of Object.keys(o)){let e=o[t];if(e!=null)return e}},yu=o=>{let t={};for(let e of o)if(!(!e||typeof e.name!="string"||!e.name))if(e.list){let r=bu(e.list);t[e.name]=Array.isArray(r)?r.map(gu).filter(i=>i!==null):[]}else t[e.name]=gu(bu(e.base));return t};var qu=`/** vim: et:ts=4:sw=4:sts=4
9809
+ `];var En=o=>o==="file",Es=o=>typeof o=="object"&&o!==null&&typeof o.data=="string",Sn=o=>o==null||o===""?null:typeof o=="string"?o:!Es(o)||o.data===""?null:o.data.startsWith("data:")?o.data:`data:${o.mime||"application/octet-stream"};base64,${o.data}`,An=o=>{if(o==null||o==="")return null;if(typeof o=="object")return Es(o)?o:null;let t=String(o),e=/^data:([^;,]*)((?:;[^;,]*)*),([\s\S]*)$/.exec(t);if(!e)return{data:t,mime:"application/octet-stream"};let[,r,i,n]=e;if(i.split(";").includes("base64"))return{data:n,mime:r||"text/plain"};let s="";return new TextEncoder().encode(decodeURIComponent(n)).forEach(a=>s+=String.fromCharCode(a)),{data:btoa(s),mime:r||"text/plain"}};var Ng=new Set(["point","pair","directedPair"]),di=(o,t)=>{if(o==null)return o;if(En(t))return An(o);switch(t){case"integer":{if(typeof o=="number")return o;let e=parseInt(String(o),10);return Number.isNaN(e)?o:e}case"float":case"duration":{if(typeof o=="number")return o;let e=parseFloat(String(o));return Number.isNaN(e)?o:e}case"boolean":{if(typeof o=="boolean")return o;if(typeof o=="string"){let e=o.toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return o}case"point":{let r=(Array.isArray(o)?o:String(o).trim().split(/[\s,]+/)).map(i=>typeof i=="number"?i:parseFloat(String(i)));return r.length===2&&r.every(Number.isFinite)?r:o}case"pair":case"directedPair":{let e=Array.isArray(o)?o:String(o).trim().split(/\s+/);return e.length===2?e.map(String):o}default:return String(o)}},Lg=(o,t,e)=>{if(e)return Array.isArray(t)&&!Ng.has(e)?{name:o,list:{[e]:t.map(r=>di(r,e))}}:t==null?{name:o,base:null}:{name:o,base:{[e]:di(t,e)}};if(Array.isArray(t)){let r=t.filter(i=>i!=null);if(r.length&&r.every(i=>typeof i=="boolean"))return{name:o,list:{boolean:r}};if(r.length&&r.every(i=>typeof i=="number")){let i=r,n=i.every(s=>Number.isInteger(s));return{name:o,list:{[n?"integer":"float"]:i}}}return{name:o,list:{string:t.map(i=>i==null?"":String(i))}}}if(typeof t=="boolean")return{name:o,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:o,base:{integer:t}}:{name:o,base:{float:t}};if(t==null)return{name:o,base:{string:""}};if(typeof t=="object")try{return{name:o,base:{string:JSON.stringify(t)}}}catch{return{name:o,base:{string:String(t)}}}return{name:o,base:{string:String(t)}}},Ss=(o,t={})=>{if(!he(o))return{record:[]};let e=[];for(let[r,i]of Object.entries(o))e.push(Lg(r,i,t[r]));return{record:e}},Vg=(o,t={})=>{if(!he(o))return{...t};let e={};for(let[r,i]of Object.entries(o))e[r]=t[r]??mo(Array.isArray(i)?i[0]:i);return e},Tu=(o,t={})=>Ss(o,Vg(o,t)),Au=o=>{if(o==null)return null;if(Array.isArray(o))return o.map(String).join(" ");if(Es(o))return Sn(o);if(typeof o=="object")try{return JSON.stringify(o)}catch{return String(o)}return String(o)},Iu=o=>{if(o)for(let t of Object.keys(o)){let e=o[t];if(e!=null)return e}},Ru=o=>{let t={};for(let e of o)if(!(!e||typeof e.name!="string"||!e.name))if(e.list){let r=Iu(e.list);t[e.name]=Array.isArray(r)?r.map(Au).filter(i=>i!==null):[]}else t[e.name]=Au(Iu(e.base));return t};var _u=`/** vim: et:ts=4:sw=4:sts=4
9810
9810
  * @license RequireJS 2.3.8 Copyright jQuery Foundation and other contributors.
9811
9811
  * Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
9812
9812
  */var requirejs,require,define;(function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.8",commentRegExp=/\\/\\*[\\s\\S]*?\\*\\/|([^:"'=]|^)\\/\\/.*$/mg,cjsRequireRegExp=/[^.]\\s*require\\s*\\(\\s*["']([^'"\\s]+)["']\\s*\\)/g,jsSuffixRegExp=/\\.js$/,currDirRegExp=/^\\.\\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!!(typeof window<"u"&&typeof navigator<"u"&&window.document),isWebWorker=!isBrowser&&typeof importScripts<"u",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera<"u"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(r,a){return a||""}function isFunction(r){return ostring.call(r)==="[object Function]"}function isArray(r){return ostring.call(r)==="[object Array]"}function each(r,a){if(r){var c;for(c=0;c<r.length&&!(r[c]&&a(r[c],c,r));c+=1);}}function eachReverse(r,a){if(r){var c;for(c=r.length-1;c>-1&&!(r[c]&&a(r[c],c,r));c-=1);}}function hasProp(r,a){return hasOwn.call(r,a)}function getOwn(r,a){return hasProp(r,a)&&r[a]}function eachProp(r,a){var c;for(c in r)if(hasProp(r,c)&&c!=="__proto__"&&c!=="constructor"&&a(r[c],c))break}function mixin(r,a,c,u){return a&&eachProp(a,function(h,q){(c||!hasProp(r,q))&&(u&&typeof h=="object"&&h&&!isArray(h)&&!isFunction(h)&&!(h instanceof RegExp)?(r[q]||(r[q]={}),mixin(r[q],h,c,u)):r[q]=h)}),r}function bind(r,a){return function(){return a.apply(r,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(r){throw r}function getGlobal(r){if(!r)return r;var a=global;return each(r.split("."),function(c){a=a[c]}),a}function makeError(r,a,c,u){var h=new Error(a+\`
9813
- https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var St=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Sg=o=>o.replace(/<\/(script)/gi,"<\\/$1"),Ag=o=>o.replace(/<\/(style)/gi,"<\\/$1"),Tg=["solution","review"];function Ig(o){return o==null?!1:Array.isArray(o)?o.length>0:de(o)?Object.keys(o).length>0:o!==""}var G=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#i=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#C(),this.#b(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let r=e?.params?.value,i=r&&typeof r=="object"?this.#d(r):null,n=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;n!==null&&(this.#o=n,n&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,c;if(a===void 0)c=void 0;else if(a===null)c=null;else if(typeof a=="string")c=a;else try{c=`__qti_json__::${JSON.stringify(a)}`}catch{c=null}if(i===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,c);break}let l=i;this.response=l,this.validate(),this.saveResponse(l,c);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#x=null}#t;static{this.styles=[fu,w`
9813
+ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var St=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},jg=o=>o.replace(/<\/(script)/gi,"<\\/$1"),Fg=o=>o.replace(/<\/(style)/gi,"<\\/$1"),zg=["solution","review"];function Bg(o){return o==null?!1:Array.isArray(o)?o.length>0:he(o)?Object.keys(o).length>0:o!==""}var G=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#i=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#C(),this.#v(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let r=e?.params?.value,i=r&&typeof r=="object"?this.#d(r):null,n=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;n!==null&&(this.#o=n,n&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,c;if(a===void 0)c=void 0;else if(a===null)c=null;else if(typeof a=="string")c=a;else try{c=`__qti_json__::${JSON.stringify(a)}`}catch{c=null}if(i===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,c);break}let l=i;this.response=l,this.validate(),this.saveResponse(l,c);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#q=null}#t;static{this.styles=[Su,x`
9814
9814
  :host {
9815
9815
  display: block;
9816
9816
  width: 100%;
9817
9817
  min-height: 50px;
9818
9818
  }
9819
- `]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},r=t.correctResponse;return Ig(r)&&(e.correctResponse={value:r}),e}#r(){let t=this.responseDeclaration;if(!t?.correctResponse||Tg.includes(this.status))return t;let{correctResponse:e,...r}=t;return r}#i;#n;#o;#s;#a(){if(this.#i===null&&this.requirePathsJson)try{let t=JSON.parse(this.requirePathsJson);if(Array.isArray(t)||!t||typeof t!="object")throw new Error("Require paths must be a JSON object.");this.#i=t}catch(t){console.error("Error parsing require paths JSON:",t),this._errorMessage=`Error parsing require paths JSON: ${t.message}`,this.#i={}}return this.#i||{}}#c(){if(this.#n===null&&this.requireShimJson)try{this.#n=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#n={}}return this.#n||{}}#p(){return this.#a()}#l(){return this.#c()}#d(t){if(t&&Array.isArray(t.record)){let e=yu(t.record);return Object.keys(e).length?e:null}for(let e in t)if(t.hasOwnProperty(e)){let r=t[e];if(r){for(let i in r)if(r.hasOwnProperty(i)){let n=r[i];if(i==="file"){if(Array.isArray(n))return n.map(kn).filter(a=>a!==null);let s=kn(n);if(s!==null)return s;continue}if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(r=>r.tagName.toLowerCase()===e)}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,r){if(e==="record"||r==="record")return Cs(t);if(e!=="single"){let i=this.normalizeListValue(t).map(n=>ci(n,r));return{list:{[r]:i}}}return{base:{[r]:ci(t,r)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=i.querySelector("qti-default-value");if(!n)return;let{value:s,baseTypes:a}=Xi(n.querySelectorAll("qti-value"));for(let[c,l]of Object.entries(s))e[c]=ci(l,a[c]??"string")}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},r={...t,...e};if(!Object.keys(r).length)return null;let i={candidateIdentifier:r.candidateIdentifier??"",testIdentifier:r.testIdentifier??"",environmentIdentifier:r.environmentIdentifier??"",...r};return Cs(i)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("template-identifier")||r.getAttribute("identifier")||"";if(!i)return;let n=this.context?.variables?.find(c=>c.identifier===i);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[i]=this.variableToQtiVariableJSON(n.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("identifier")||"";if(!i)return;if(i==="QTI_CONTEXT"){let c=this.getQtiContextRecord();c&&(t[i]=c);return}let n=this.context?.variables?.find(c=>c.identifier===i);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[i]=this.variableToQtiVariableJSON(n.value,s,a)}),t}#h(t){let e={...t};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);e[i]=t[r]}return e}#u(t){let e={...t},r=(i,n,s)=>{let a=i;for(let c=0;c<n.length;c+=1){let l=n[c];if(c===n.length-1){a[l]=s;return}(!a[l]||typeof a[l]!="object"||Array.isArray(a[l]))&&(a[l]={}),a=a[l]}};for(let[i,n]of Object.entries(t)){if(!i.includes("__"))continue;let s=i.split("__").filter(Boolean);s.length<2||r(e,s,n)}return e}responseVariablesToQtiVariableJSON(t,e,r,i){if(e==="record")return vu(t,i);if(e!=="single"){let n={list:{}};return n.list[r]=Cn(r)?this.normalizeListValue(t).map(En).filter(Boolean):t,n}else{let n={base:{}};return n.base[r]=Cn(r)?En(t):t,n}}#m(){return this.response===null||this.response===void 0?!1:de(this.response)?Object.values(this.response).some(t=>t!==""&&t!==null&&t!==void 0):Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#f(t,e){let r=this.dataset.invalidresponsemessage||"Invalid response.",i=t?"":e&&e.trim().length>0?e:r;this._internals.setValidity(t?{}:{customError:!0},i)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#m();return this.#f(t,this.#s),t}set value(t){t===null?this.#t=[]:this.#t=Array.isArray(t)?t:t.split(",")}get value(){return this.#t===null||this.#t===void 0?null:de(this.#t)?JSON.stringify(this.#t):Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#d(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={},e=this.context?.variables?.find(r=>r.identifier===this.responseIdentifier);if(e){let r=e.cardinality||"single",i=e.baseType||"string",n=e.value||null,s=e.fieldBaseTypes,a=this.responseVariablesToQtiVariableJSON(n,r,i,s);t[this.responseIdentifier]=a}return t}#v(t){return t&&t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/g,"/").replace(/&#x60;/g,"`").replace(/&#x3D;/g,"=")}#g(t){let e={};for(let[r,i]of Object.entries(t))typeof i=="string"?e[r]=this.#v(i):e[r]=i;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let r=this.iframe?.contentWindow;if(!this._iframeLoaded||!r){this._pendingMessages.push({method:t,params:e});return}r.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#b(){this._pendingMessages.length&&(this._pendingMessages.forEach(t=>{this.sendMessageToIframe(t.method,t.params)}),this._pendingMessages=[])}createIframe(){this._interactionReady=!1,this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this.#w(),this.#y()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let{sandbox:e,allow:r}=this.configContext?.pciIframe??{};e!==void 0&&this.iframe.setAttribute("sandbox",e),r&&this.iframe.setAttribute("allow",r);let i=this.generateIframeContent();this.iframe.srcdoc=i,this.appendChild(this.iframe)}#y(){let t=this.#h(this.#u(this.#g({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],r=typeof e=="string"&&e.length>0?e:null,i={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:ho(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#q(),boundTo:r?null:this.boundTo,responseDeclaration:this.#r(),status:this.status,state:r};this.sendMessageToIframe("initialize",i)}#q(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let r=e.querySelectorAll("qti-interaction-module");for(let i of r)t.push({id:i.getAttribute("id"),primaryPath:i.getAttribute("primary-path"),fallbackPath:i.getAttribute("fallback-path")})}return t}#w(){let t=this.querySelector("qti-interaction-markup");t&&this.sendMessageToIframe("setMarkup",t.innerHTML);let e=Array.from(this.querySelectorAll("qti-stylesheet"));if(e.length){let i=e.map(n=>n.outerHTML).join(`
9820
- `);this.sendMessageToIframe("setStylesheets",i)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#C(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#p()),r=JSON.stringify(this.#l()),i=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",n=i?i.endsWith("/")?i:`${i}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=this.dataset.componentsCdnUrl,c=this.dataset.componentsCssUrl,l=this.requireJsUrl?`<script src="${this.requireJsUrl}"></script>`:`<script>${Sg(qu)}</script>`,d=`
9819
+ `]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},r=t.correctResponse;return Bg(r)&&(e.correctResponse={value:r}),e}#r(){let t=this.responseDeclaration;if(!t?.correctResponse||zg.includes(this.status))return t;let{correctResponse:e,...r}=t;return r}#i;#n;#o;#s;#a(){if(this.#i===null&&this.requirePathsJson)try{let t=JSON.parse(this.requirePathsJson);if(Array.isArray(t)||!t||typeof t!="object")throw new Error("Require paths must be a JSON object.");this.#i=t}catch(t){console.error("Error parsing require paths JSON:",t),this._errorMessage=`Error parsing require paths JSON: ${t.message}`,this.#i={}}return this.#i||{}}#c(){if(this.#n===null&&this.requireShimJson)try{this.#n=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#n={}}return this.#n||{}}#p(){return this.#a()}#l(){return this.#c()}#d(t){if(t&&Array.isArray(t.record)){let e=Ru(t.record);return Object.keys(e).length?e:null}for(let e in t)if(t.hasOwnProperty(e)){let r=t[e];if(r){for(let i in r)if(r.hasOwnProperty(i)){let n=r[i];if(i==="file"){if(Array.isArray(n))return n.map(Sn).filter(a=>a!==null);let s=Sn(n);if(s!==null)return s;continue}if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(r=>r.tagName.toLowerCase()===e)}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,r){if(e==="record"||r==="record")return Ss(t);if(e!=="single"){let i=this.normalizeListValue(t).map(n=>di(n,r));return{list:{[r]:i}}}return{base:{[r]:di(t,r)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=i.querySelector("qti-default-value");if(!n)return;let{value:s,baseTypes:a}=Yi(n.querySelectorAll("qti-value"));for(let[c,l]of Object.entries(s))e[c]=di(l,a[c]??"string")}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},r={...t,...e};if(!Object.keys(r).length)return null;let i={candidateIdentifier:r.candidateIdentifier??"",testIdentifier:r.testIdentifier??"",environmentIdentifier:r.environmentIdentifier??"",...r};return Ss(i)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("template-identifier")||r.getAttribute("identifier")||"";if(!i)return;let n=this.context?.variables?.find(c=>c.identifier===i);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[i]=this.variableToQtiVariableJSON(n.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("identifier")||"";if(!i)return;if(i==="QTI_CONTEXT"){let c=this.getQtiContextRecord();c&&(t[i]=c);return}let n=this.context?.variables?.find(c=>c.identifier===i);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[i]=this.variableToQtiVariableJSON(n.value,s,a)}),t}#h(t){let e={...t};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);e[i]=t[r]}return e}#u(t){let e={...t},r=(i,n,s)=>{let a=i;for(let c=0;c<n.length;c+=1){let l=n[c];if(c===n.length-1){a[l]=s;return}(!a[l]||typeof a[l]!="object"||Array.isArray(a[l]))&&(a[l]={}),a=a[l]}};for(let[i,n]of Object.entries(t)){if(!i.includes("__"))continue;let s=i.split("__").filter(Boolean);s.length<2||r(e,s,n)}return e}responseVariablesToQtiVariableJSON(t,e,r,i){if(e==="record")return Tu(t,i);if(e!=="single"){let n={list:{}};return n.list[r]=En(r)?this.normalizeListValue(t).map(An).filter(Boolean):t,n}else{let n={base:{}};return n.base[r]=En(r)?An(t):t,n}}#m(){return this.response===null||this.response===void 0?!1:he(this.response)?Object.values(this.response).some(t=>t!==""&&t!==null&&t!==void 0):Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#f(t,e){let r=this.dataset.invalidresponsemessage||"Invalid response.",i=t?"":e&&e.trim().length>0?e:r;this._internals.setValidity(t?{}:{customError:!0},i)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#m();return this.#f(t,this.#s),t}set value(t){t===null?this.#t=[]:this.#t=Array.isArray(t)?t:t.split(",")}get value(){return this.#t===null||this.#t===void 0?null:he(this.#t)?JSON.stringify(this.#t):Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#d(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={},e=this.context?.variables?.find(r=>r.identifier===this.responseIdentifier);if(e){let r=e.cardinality||"single",i=e.baseType||"string",n=e.value||null,s=e.fieldBaseTypes,a=this.responseVariablesToQtiVariableJSON(n,r,i,s);t[this.responseIdentifier]=a}return t}#b(t){return t&&t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/g,"/").replace(/&#x60;/g,"`").replace(/&#x3D;/g,"=")}#g(t){let e={};for(let[r,i]of Object.entries(t))typeof i=="string"?e[r]=this.#b(i):e[r]=i;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let r=this.iframe?.contentWindow;if(!this._iframeLoaded||!r){this._pendingMessages.push({method:t,params:e});return}r.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#v(){this._pendingMessages.length&&(this._pendingMessages.forEach(t=>{this.sendMessageToIframe(t.method,t.params)}),this._pendingMessages=[])}createIframe(){this._interactionReady=!1,this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this.#x(),this.#y()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let{sandbox:e,allow:r}=this.configContext?.pciIframe??{};e!==void 0&&this.iframe.setAttribute("sandbox",e),r&&this.iframe.setAttribute("allow",r);let i=this.generateIframeContent();this.iframe.srcdoc=i,this.appendChild(this.iframe)}#y(){let t=this.#h(this.#u(this.#g({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],r=typeof e=="string"&&e.length>0?e:null,i={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:uo(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#w(),boundTo:r?null:this.boundTo,responseDeclaration:this.#r(),status:this.status,state:r};this.sendMessageToIframe("initialize",i)}#w(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let r=e.querySelectorAll("qti-interaction-module");for(let i of r)t.push({id:i.getAttribute("id"),primaryPath:i.getAttribute("primary-path"),fallbackPath:i.getAttribute("fallback-path")})}return t}#x(){let t=this.querySelector("qti-interaction-markup");t&&this.sendMessageToIframe("setMarkup",t.innerHTML);let e=Array.from(this.querySelectorAll("qti-stylesheet"));if(e.length){let i=e.map(n=>n.outerHTML).join(`
9820
+ `);this.sendMessageToIframe("setStylesheets",i)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#C(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#p()),r=JSON.stringify(this.#l()),i=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",n=i?i.endsWith("/")?i:`${i}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=this.dataset.componentsCdnUrl,c=this.dataset.componentsCssUrl,l=this.requireJsUrl?`<script src="${this.requireJsUrl}"></script>`:`<script>${jg(_u)}</script>`,d=`
9821
9821
  font-family: ${t.getPropertyValue("font-family")};
9822
9822
  font-size: ${t.getPropertyValue("font-size")};
9823
9823
  line-height: ${t.getPropertyValue("line-height")};
@@ -9830,7 +9830,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
9830
9830
  <title>QTI PCI Container</title>
9831
9831
  <base href="${n}" />
9832
9832
  ${a?`<script type="module">import '${a}';</script>`:""}
9833
- <style>${Ag(mu)}</style>
9833
+ <style>${Fg(Eu)}</style>
9834
9834
  <style>
9835
9835
  body, html {
9836
9836
  margin: 0;
@@ -10710,13 +10710,13 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10710
10710
  <body>
10711
10711
  <div id="pci-container"></div>
10712
10712
  </body>
10713
- </html>`}disable(){if(this.#x={pointerEvents:this.style.pointerEvents,position:this.style.position},this.sendMessageToIframe("setState",{state:"disabled"}),!this.querySelector(".pci-interaction-overlay")){let e=document.createElement("div");e.className="pci-interaction-overlay",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.backgroundColor="rgba(200, 200, 200, 0.3)",e.style.zIndex="100",e.style.pointerEvents="all",e.style.cursor="not-allowed",getComputedStyle(this).position==="static"&&(this.style.position="relative"),this.appendChild(e)}}enable(){let t=this.querySelector(".pci-interaction-overlay");t&&t.remove(),this.#x&&(this.#x.pointerEvents&&(this.style.pointerEvents=this.#x.pointerEvents),this.#x.position&&(this.style.position=this.#x.position),this.#x=null),this.sendMessageToIframe("setState",{state:"interacting"})}#x;render(){return v`
10713
+ </html>`}disable(){if(this.#q={pointerEvents:this.style.pointerEvents,position:this.style.position},this.sendMessageToIframe("setState",{state:"disabled"}),!this.querySelector(".pci-interaction-overlay")){let e=document.createElement("div");e.className="pci-interaction-overlay",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.backgroundColor="rgba(200, 200, 200, 0.3)",e.style.zIndex="100",e.style.pointerEvents="all",e.style.cursor="not-allowed",getComputedStyle(this).position==="static"&&(this.style.position="relative"),this.appendChild(e)}}enable(){let t=this.querySelector(".pci-interaction-overlay");t&&t.remove(),this.#q&&(this.#q.pointerEvents&&(this.style.pointerEvents=this.#q.pointerEvents),this.#q.position&&(this.style.position=this.#q.position),this.#q=null),this.sendMessageToIframe("setState",{state:"interacting"})}#q;render(){return v`
10714
10714
  <slot></slot>
10715
10715
  ${this._errorMessage?v`<div style="color:red">
10716
10716
  <h1>Error</h1>
10717
10717
  ${this._errorMessage}
10718
10718
  </div>`:""}
10719
- `}};St([p({type:String,attribute:"module"})],G.prototype,"module",void 0);St([p({type:String,attribute:"custom-interaction-type-identifier"})],G.prototype,"customInteractionTypeIdentifier",void 0);St([p({type:String,attribute:"data-require-paths"})],G.prototype,"requirePathsJson",void 0);St([p({type:String,attribute:"data-require-shim"})],G.prototype,"requireShimJson",void 0);St([p({type:String,attribute:"data-require-js-url"})],G.prototype,"requireJsUrl",void 0);St([p({type:String,attribute:"data-base-url"})],G.prototype,"baseUrl",void 0);St([p({type:Boolean,attribute:"data-use-default-paths"})],G.prototype,"useDefaultPaths",void 0);St([p({type:String,attribute:"data-status"})],G.prototype,"status",void 0);St([I()],G.prototype,"_errorMessage",void 0);St([_({context:F,subscribe:!0}),I()],G.prototype,"context",void 0);St([_({context:qt,subscribe:!0}),I()],G.prototype,"qtiContext",void 0);St([p({attribute:"response",reflect:!1,converter:Gt({emptyAs:null})})],G.prototype,"response",void 0);var ks=class extends G{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,r)=>{let i=()=>{window.clearTimeout(n),e()},n=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",i),r(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",i,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,r=i=>{let{data:n}=i;n?.source==="qti-pci-iframe"&&(!n?.responseIdentifier||n?.responseIdentifier===this.responseIdentifier)&&n?.method==="getContentResponse"&&n?.messageId===e&&(window.removeEventListener("message",r),t(n.content))};window.addEventListener("message",r),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",r),t("")},5e3)})}setTestContext(t){this.context=t,this.updateComplete.then(()=>{this.value=t?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#t=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#t=!1}}disconnectedCallback(){this.#t||super.disconnectedCallback()}async iFrameMouseClick(t,e){return new Promise(r=>{let i=`click-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r())};window.addEventListener("message",n),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let r=`click-selector-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let r=`click-text-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(r=>{let i=`set-value-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let r=`get-bounding-rect-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(r=>{let i=`set-value-text-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let r=`mousedown-selector-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
10719
+ `}};St([p({type:String,attribute:"module"})],G.prototype,"module",void 0);St([p({type:String,attribute:"custom-interaction-type-identifier"})],G.prototype,"customInteractionTypeIdentifier",void 0);St([p({type:String,attribute:"data-require-paths"})],G.prototype,"requirePathsJson",void 0);St([p({type:String,attribute:"data-require-shim"})],G.prototype,"requireShimJson",void 0);St([p({type:String,attribute:"data-require-js-url"})],G.prototype,"requireJsUrl",void 0);St([p({type:String,attribute:"data-base-url"})],G.prototype,"baseUrl",void 0);St([p({type:Boolean,attribute:"data-use-default-paths"})],G.prototype,"useDefaultPaths",void 0);St([p({type:String,attribute:"data-status"})],G.prototype,"status",void 0);St([T()],G.prototype,"_errorMessage",void 0);St([R({context:F,subscribe:!0}),T()],G.prototype,"context",void 0);St([R({context:qt,subscribe:!0}),T()],G.prototype,"qtiContext",void 0);St([p({attribute:"response",reflect:!1,converter:Gt({emptyAs:null})})],G.prototype,"response",void 0);var As=class extends G{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,r)=>{let i=()=>{window.clearTimeout(n),e()},n=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",i),r(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",i,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,r=i=>{let{data:n}=i;n?.source==="qti-pci-iframe"&&(!n?.responseIdentifier||n?.responseIdentifier===this.responseIdentifier)&&n?.method==="getContentResponse"&&n?.messageId===e&&(window.removeEventListener("message",r),t(n.content))};window.addEventListener("message",r),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",r),t("")},5e3)})}setTestContext(t){this.context=t,this.updateComplete.then(()=>{this.value=t?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#t=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#t=!1}}disconnectedCallback(){this.#t||super.disconnectedCallback()}async iFrameMouseClick(t,e){return new Promise(r=>{let i=`click-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r())};window.addEventListener("message",n),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let r=`click-selector-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let r=`click-text-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(r=>{let i=`set-value-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let r=`get-bounding-rect-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(r=>{let i=`set-value-text-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let r=`mousedown-selector-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
10720
10720
  // Test helper functions for QtiPortableCustomInteractionTest
10721
10721
  // Base iframe implementation already provides PCIManager.getContent
10722
10722
 
@@ -10909,7 +10909,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10909
10909
  }
10910
10910
  },
10911
10911
  true
10912
- );`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var Es=[{tag:"qti-portable-custom-interaction",ctor:G},{tag:"qti-portable-custom-interaction-test",ctor:ks}];var xu="important",_g=" !"+xu,Er=$t(class extends Me{constructor(o){if(super(o),o.type!==Kr.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let r=o[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let i=t[r];if(i!=null){this.ft.add(r);let n=typeof i=="string"&&i.endsWith(_g);r.includes("-")||n?e.setProperty(r,n?i.slice(0,-11):i,n?xu:""):e[r]=i}}return it}});var wu=[R,U,w`
10912
+ );`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var Is=[{tag:"qti-portable-custom-interaction",ctor:G},{tag:"qti-portable-custom-interaction-test",ctor:As}];var Mu="important",Ug=" !"+Mu,Ar=$t(class extends Pe{constructor(o){if(super(o),o.type!==ti.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let r=o[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let i=t[r];if(i!=null){this.ft.add(r);let n=typeof i=="string"&&i.endsWith(Ug);r.includes("-")||n?e.setProperty(r,n?i.slice(0,-11):i,n?Mu:""):e[r]=i}}return it}});var Pu=[_,U,x`
10913
10913
  /* Not positioned on purpose: the placed copies are absolutely positioned against the stage
10914
10914
  (qti-position-object-stage), so they land on its image wherever this tray sits. */
10915
10915
  :host {
@@ -10944,7 +10944,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10944
10944
  [part~='point'][data-ghost] {
10945
10945
  pointer-events: none;
10946
10946
  }
10947
- `];var Je=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Rg=4,At=class extends D{constructor(){super(...arguments),this.maxChoices=1,this.minChoices=0,this.centerPoint=null,this.response=null,this._layout=0,this._drag=null,this._armed=!1,this.#t=null,this.#e=new ResizeObserver(()=>this._layout++),this._handleResponseChange=()=>{this._internals.setFormValue(ar(this.response)||null),this.validate(),z(this._internals.states,"used",this.#n())},this.#m=t=>{if(!this._drag)return;let e={x:t.clientX,y:t.clientY},r=this._drag.moved||Math.hypot(e.x-this._drag.start.x,e.y-this._drag.start.y)>Rg;this._drag={...this._drag,client:e,moved:r}},this.#f=t=>{window.removeEventListener("pointermove",this.#m);let e=this._drag;if(this._drag=null,!e)return;if(!e.moved){e.index===-1&&(this._armed=!this._armed);return}let r=this.#p({x:t.clientX,y:t.clientY}),i=this.#r();e.index===-1?r&&this.#h(r):r?(i[e.index]=r,this.#i(i)):this.#i(i.filter((n,s)=>s!==e.index))},this.#v=t=>{if(!this._armed||this.#d)return;let e=this.#p({x:t.clientX,y:t.clientY});e&&(this._armed=!1,this.#h(e))}}static{this.styles=wu}#t;#e;#r(){return(this.response??[]).map(t=>{let[e,r]=t.split(" ").map(Number);return{x:e,y:r}})}#i(t){this.response=t.map(e=>`${Math.round(e.x)} ${Math.round(e.y)}`),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})}#n(){return this.maxChoices>0&&(this.response?.length??0)>=this.maxChoices}validate(){let t=this.response?.length??0,e=this.maxChoices>0&&t>this.maxChoices,r=t<this.minChoices,i="other",n="";e?(i="max",n=this.dataset.maxSelectionsMessage||`Please place no more than ${this.maxChoices} ${this.maxChoices===1?"position":"positions"}.`):r&&(i="min",n=this.dataset.minSelectionsMessage||`Please place at least ${this.minChoices} ${this.minChoices===1?"position":"positions"}.`);let s=!e&&!r;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:i}),s}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this._armed=!1,this.response=[],this._internals.setFormValue(null)}get#o(){return this.closest("qti-position-object-stage")}#s(){let t=this.#t;return t?{width:parseFloat(t.getAttribute("width")??"")||t.naturalWidth||t.clientWidth||1,height:parseFloat(t.getAttribute("height")??"")||t.naturalHeight||t.clientHeight||1}:{width:1,height:1}}#a(){let t=this.#t?.getBoundingClientRect();return!t||t.width===0?1:this.#s().width/t.width}#c(){let t=this.querySelector("img"),e=parseFloat(t?.getAttribute("width")??"")||t?.naturalWidth||30,r=parseFloat(t?.getAttribute("height")??"")||t?.naturalHeight||30,[i,n]=(this.centerPoint??"").split(/[\s,]+/).map(Number);return{width:e,height:r,centre:Number.isFinite(i)&&Number.isFinite(n)?{x:i,y:n}:{x:e/2,y:r/2}}}#p(t){let e=this.#t?.getBoundingClientRect();if(!e||t.x<e.left||t.x>e.right||t.y<e.top||t.y>e.bottom)return null;let r=this.#a();return{x:(t.x-e.left)*r,y:(t.y-e.top)*r}}#l(t){let e=this.#o?.getBoundingClientRect(),r=this.#t?.getBoundingClientRect();if(!e||!r)return{display:"none"};let i=this.#a(),n=this.#c();return{left:`${r.left-e.left+t.x/i-n.centre.x/i}px`,top:`${r.top-e.top+t.y/i-n.centre.y/i}px`,width:`${n.width/i}px`,height:`${n.height/i}px`}}get#d(){return this.disabled||this.readonly}#h(t){this.#n()||this.#i([...this.#r(),t])}#u(t,e){if(this.#d||t.button!==0||e===-1&&this.#n())return;t.preventDefault();let r={x:t.clientX,y:t.clientY};this._drag={index:e,client:r,start:r,moved:!1},window.addEventListener("pointermove",this.#m),window.addEventListener("pointerup",this.#f,{once:!0})}#m;#f;#v;#g(t){if(!this.#d)if(t.key==="Enter"||t.key===" "){if(t.preventDefault(),this.#n())return;let{width:e,height:r}=this.#s();this.#h({x:e/2,y:r/2}),this.updateComplete.then(()=>{let i=this.shadowRoot?.querySelectorAll('[part~="point"]');i?.[i.length-1]?.focus()})}else t.key==="Escape"&&(this._armed=!1)}#b(t,e){if(this.#d)return;let r=t.shiftKey?10:1,i={ArrowLeft:{x:-r,y:0},ArrowRight:{x:r,y:0},ArrowUp:{x:0,y:-r},ArrowDown:{x:0,y:r}},n=this.#r();if(i[t.key]){t.preventDefault();let{width:s,height:a}=this.#s(),c=n[e];n[e]={x:Math.min(s,Math.max(0,c.x+i[t.key].x)),y:Math.min(a,Math.max(0,c.y+i[t.key].y))},this.#i(n),this.updateComplete.then(()=>this.shadowRoot?.querySelectorAll('[part~="point"]')[e]?.focus())}else(t.key==="Delete"||t.key==="Backspace")&&(t.preventDefault(),this.#i(n.filter((s,a)=>a!==e)),this.updateComplete.then(()=>this.shadowRoot?.querySelector('[part~="object"]')?.focus()))}connectedCallback(){super.connectedCallback(),this.#t=this.#o?.querySelector(":scope > img, :scope > picture img")??null,this.#t&&(this.#e.observe(this.#t),this.#t.addEventListener("load",()=>this._layout++),this.#t.addEventListener("click",this.#v))}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect(),this.#t?.removeEventListener("click",this.#v),window.removeEventListener("pointermove",this.#m)}render(){this._layout;let t=this.querySelector("img")?.currentSrc||this.querySelector("img")?.src||"",e=this.querySelector("img")?.getAttribute("alt")||"object",r=this.#n(),i=["object",this._armed?"selected":"",r?"used":""].filter(Boolean).join(" "),n=this.#r(),s=this._drag,a=s&&s.moved&&this.#t?(()=>{let c=this.#t.getBoundingClientRect(),l=this.#a();return{x:(s.client.x-c.left)*l,y:(s.client.y-c.top)*l}})():null;return v`
10947
+ `];var Ke=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Hg=4,At=class extends D{constructor(){super(...arguments),this.maxChoices=1,this.minChoices=0,this.centerPoint=null,this.response=null,this._layout=0,this._drag=null,this._armed=!1,this.#t=null,this.#e=new ResizeObserver(()=>this._layout++),this._handleResponseChange=()=>{this._internals.setFormValue(cr(this.response)||null),this.validate(),z(this._internals.states,"used",this.#n())},this.#m=t=>{if(!this._drag)return;let e={x:t.clientX,y:t.clientY},r=this._drag.moved||Math.hypot(e.x-this._drag.start.x,e.y-this._drag.start.y)>Hg;this._drag={...this._drag,client:e,moved:r}},this.#f=t=>{window.removeEventListener("pointermove",this.#m);let e=this._drag;if(this._drag=null,!e)return;if(!e.moved){e.index===-1&&(this._armed=!this._armed);return}let r=this.#p({x:t.clientX,y:t.clientY}),i=this.#r();e.index===-1?r&&this.#h(r):r?(i[e.index]=r,this.#i(i)):this.#i(i.filter((n,s)=>s!==e.index))},this.#b=t=>{if(!this._armed||this.#d)return;let e=this.#p({x:t.clientX,y:t.clientY});e&&(this._armed=!1,this.#h(e))}}static{this.styles=Pu}#t;#e;#r(){return(this.response??[]).map(t=>{let[e,r]=t.split(" ").map(Number);return{x:e,y:r}})}#i(t){this.response=t.map(e=>`${Math.round(e.x)} ${Math.round(e.y)}`),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})}#n(){return this.maxChoices>0&&(this.response?.length??0)>=this.maxChoices}validate(){let t=this.response?.length??0,e=this.maxChoices>0&&t>this.maxChoices,r=t<this.minChoices,i="other",n="";e?(i="max",n=this.dataset.maxSelectionsMessage||`Please place no more than ${this.maxChoices} ${this.maxChoices===1?"position":"positions"}.`):r&&(i="min",n=this.dataset.minSelectionsMessage||`Please place at least ${this.minChoices} ${this.minChoices===1?"position":"positions"}.`);let s=!e&&!r;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:i}),s}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this._armed=!1,this.response=[],this._internals.setFormValue(null)}get#o(){return this.closest("qti-position-object-stage")}#s(){let t=this.#t;return t?{width:parseFloat(t.getAttribute("width")??"")||t.naturalWidth||t.clientWidth||1,height:parseFloat(t.getAttribute("height")??"")||t.naturalHeight||t.clientHeight||1}:{width:1,height:1}}#a(){let t=this.#t?.getBoundingClientRect();return!t||t.width===0?1:this.#s().width/t.width}#c(){let t=this.querySelector("img"),e=parseFloat(t?.getAttribute("width")??"")||t?.naturalWidth||30,r=parseFloat(t?.getAttribute("height")??"")||t?.naturalHeight||30,[i,n]=(this.centerPoint??"").split(/[\s,]+/).map(Number);return{width:e,height:r,centre:Number.isFinite(i)&&Number.isFinite(n)?{x:i,y:n}:{x:e/2,y:r/2}}}#p(t){let e=this.#t?.getBoundingClientRect();if(!e||t.x<e.left||t.x>e.right||t.y<e.top||t.y>e.bottom)return null;let r=this.#a();return{x:(t.x-e.left)*r,y:(t.y-e.top)*r}}#l(t){let e=this.#o?.getBoundingClientRect(),r=this.#t?.getBoundingClientRect();if(!e||!r)return{display:"none"};let i=this.#a(),n=this.#c();return{left:`${r.left-e.left+t.x/i-n.centre.x/i}px`,top:`${r.top-e.top+t.y/i-n.centre.y/i}px`,width:`${n.width/i}px`,height:`${n.height/i}px`}}get#d(){return this.disabled||this.readonly}#h(t){this.#n()||this.#i([...this.#r(),t])}#u(t,e){if(this.#d||t.button!==0||e===-1&&this.#n())return;t.preventDefault();let r={x:t.clientX,y:t.clientY};this._drag={index:e,client:r,start:r,moved:!1},window.addEventListener("pointermove",this.#m),window.addEventListener("pointerup",this.#f,{once:!0})}#m;#f;#b;#g(t){if(!this.#d)if(t.key==="Enter"||t.key===" "){if(t.preventDefault(),this.#n())return;let{width:e,height:r}=this.#s();this.#h({x:e/2,y:r/2}),this.updateComplete.then(()=>{let i=this.shadowRoot?.querySelectorAll('[part~="point"]');i?.[i.length-1]?.focus()})}else t.key==="Escape"&&(this._armed=!1)}#v(t,e){if(this.#d)return;let r=t.shiftKey?10:1,i={ArrowLeft:{x:-r,y:0},ArrowRight:{x:r,y:0},ArrowUp:{x:0,y:-r},ArrowDown:{x:0,y:r}},n=this.#r();if(i[t.key]){t.preventDefault();let{width:s,height:a}=this.#s(),c=n[e];n[e]={x:Math.min(s,Math.max(0,c.x+i[t.key].x)),y:Math.min(a,Math.max(0,c.y+i[t.key].y))},this.#i(n),this.updateComplete.then(()=>this.shadowRoot?.querySelectorAll('[part~="point"]')[e]?.focus())}else(t.key==="Delete"||t.key==="Backspace")&&(t.preventDefault(),this.#i(n.filter((s,a)=>a!==e)),this.updateComplete.then(()=>this.shadowRoot?.querySelector('[part~="object"]')?.focus()))}connectedCallback(){super.connectedCallback(),this.#t=this.#o?.querySelector(":scope > img, :scope > picture img")??null,this.#t&&(this.#e.observe(this.#t),this.#t.addEventListener("load",()=>this._layout++),this.#t.addEventListener("click",this.#b))}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect(),this.#t?.removeEventListener("click",this.#b),window.removeEventListener("pointermove",this.#m)}render(){this._layout;let t=this.querySelector("img")?.currentSrc||this.querySelector("img")?.src||"",e=this.querySelector("img")?.getAttribute("alt")||"object",r=this.#n(),i=["object",this._armed?"selected":"",r?"used":""].filter(Boolean).join(" "),n=this.#r(),s=this._drag,a=s&&s.moved&&this.#t?(()=>{let c=this.#t.getBoundingClientRect(),l=this.#a();return{x:(s.client.x-c.left)*l,y:(s.client.y-c.top)*l}})():null;return v`
10948
10948
  <div
10949
10949
  part=${i}
10950
10950
  role="button"
@@ -10964,13 +10964,13 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10964
10964
  role="button"
10965
10965
  tabindex=${this.#d?-1:0}
10966
10966
  draggable="false"
10967
- style=${Er(this.#l(d))}
10967
+ style=${Ar(this.#l(d))}
10968
10968
  @pointerdown=${h=>this.#u(h,l)}
10969
- @keydown=${h=>this.#b(h,l)}
10969
+ @keydown=${h=>this.#v(h,l)}
10970
10970
  />`})}
10971
- ${s&&s.index===-1&&a?v`<img part="point" data-ghost src=${t} alt="" style=${Er(this.#l(a))} />`:P}
10971
+ ${s&&s.index===-1&&a?v`<img part="point" data-ghost src=${t} alt="" style=${Ar(this.#l(a))} />`:P}
10972
10972
  <div part="message" role="alert" id="validation-message" style="display:none;"></div>
10973
- `}};Je([p({type:Number,attribute:"max-choices"})],At.prototype,"maxChoices",void 0);Je([p({type:Number,attribute:"min-choices"})],At.prototype,"minChoices",void 0);Je([p({type:String,attribute:"center-point"})],At.prototype,"centerPoint",void 0);Je([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Qi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>ar(o)}})],At.prototype,"response",void 0);Je([I()],At.prototype,"_layout",void 0);Je([I()],At.prototype,"_drag",void 0);Je([I()],At.prototype,"_armed",void 0);Je([N("response")],At.prototype,"_handleResponseChange",void 0);var Cu=[R,w`
10973
+ `}};Ke([p({type:Number,attribute:"max-choices"})],At.prototype,"maxChoices",void 0);Ke([p({type:Number,attribute:"min-choices"})],At.prototype,"minChoices",void 0);Ke([p({type:String,attribute:"center-point"})],At.prototype,"centerPoint",void 0);Ke([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Gi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>cr(o)}})],At.prototype,"response",void 0);Ke([T()],At.prototype,"_layout",void 0);Ke([T()],At.prototype,"_drag",void 0);Ke([T()],At.prototype,"_armed",void 0);Ke([N("response")],At.prototype,"_handleResponseChange",void 0);var Ou=[_,x`
10974
10974
  /* The containing block of every placed copy. */
10975
10975
  :host {
10976
10976
  display: inline-block;
@@ -10983,7 +10983,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
10983
10983
  height: auto;
10984
10984
  user-select: none;
10985
10985
  }
10986
- `];var Ss=class extends C{static{this.styles=Cu}render(){return v`<slot></slot>`}};var As=[{tag:"qti-position-object-interaction",ctor:At},{tag:"qti-position-object-stage",ctor:Ss}];var ku=[R,w`
10986
+ `];var Ts=class extends C{static{this.styles=Ou}render(){return v`<slot></slot>`}};var Rs=[{tag:"qti-position-object-interaction",ctor:At},{tag:"qti-position-object-stage",ctor:Ts}];var Du=[_,x`
10987
10987
  :host {
10988
10988
  display: block;
10989
10989
  --qti-select-point-marker-size: 1.5rem;
@@ -11047,12 +11047,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11047
11047
  -webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
11048
11048
  mask: var(--qti-select-point-icon) no-repeat center / contain;
11049
11049
  }
11050
- `];var Sr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},dt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleResponseChange=()=>{this._internals.setFormValue(ar(this.response)||null),this.validate()},this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#r=1,this.#i=1,this.#n=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#c();let e=this.#e.getBoundingClientRect(),r=(t.clientX-e.left)*this.#r,i=(t.clientY-e.top)*this.#i,n=`${r.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[n]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],n]),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})},this.#a=()=>{this.#c()}}static{this.styles=ku}#t(){try{let t=JSON.parse(this.areaMappings||"[]");if(!Array.isArray(t)){this._areaEntries=[];return}this._areaEntries=t.filter(e=>e&&(e.shape==="circle"||e.shape==="rect")&&typeof e.coords=="string").map(e=>({shape:e.shape,coords:String(e.coords),mappedValue:Number(e.mappedValue??1),defaultValue:Number(e.defaultValue??0)}))}catch{this._areaEntries=[]}}get _effectiveAreaEntries(){let t=this.responseVariable?.areaMapping?.areaMapEntries;return t?.length?t:this._areaEntries}#e;#r;#i;#n;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let t=this.response;return(Array.isArray(t)?t:t?[t]:[]).filter(r=>r).map(r=>{let[i,n]=r.split(" ").map(Number);return{x:i,y:n}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let r of t){let i=r.dataset.coord,n=r.dataset.shape;!i||!n||te(n,i.split(",").map(s=>+s),e,r)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return v` <slot name="prompt"></slot>
11050
+ `];var Ir=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},dt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleResponseChange=()=>{this._internals.setFormValue(cr(this.response)||null),this.validate()},this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#r=1,this.#i=1,this.#n=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#c();let e=this.#e.getBoundingClientRect(),r=(t.clientX-e.left)*this.#r,i=(t.clientY-e.top)*this.#i,n=`${r.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[n]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],n]),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})},this.#a=()=>{this.#c()}}static{this.styles=Du}#t(){try{let t=JSON.parse(this.areaMappings||"[]");if(!Array.isArray(t)){this._areaEntries=[];return}this._areaEntries=t.filter(e=>e&&(e.shape==="circle"||e.shape==="rect")&&typeof e.coords=="string").map(e=>({shape:e.shape,coords:String(e.coords),mappedValue:Number(e.mappedValue??1),defaultValue:Number(e.defaultValue??0)}))}catch{this._areaEntries=[]}}get _effectiveAreaEntries(){let t=this.responseVariable?.areaMapping?.areaMapEntries;return t?.length?t:this._areaEntries}#e;#r;#i;#n;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let t=this.response;return(Array.isArray(t)?t:t?[t]:[]).filter(r=>r).map(r=>{let[i,n]=r.split(" ").map(Number);return{x:i,y:n}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let r of t){let i=r.dataset.coord,n=r.dataset.shape;!i||!n||ee(n,i.split(",").map(s=>+s),e,r)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return v` <slot name="prompt"></slot>
11051
11051
  <point-container>
11052
11052
  ${H(e.filter(r=>r),r=>r,(r,i)=>{let[n,s]=r.split(" ").map(Number),a=n/(this.#n||1)*100,c=s/(this.#o||1)*100;return v`
11053
11053
  <button
11054
11054
  part=${this.pointPart(r,i)}
11055
- style=${Er({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${c}%`})}
11055
+ style=${Ar({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${c}%`})}
11056
11056
  aria-label="Remove point at ${r}"
11057
11057
  ?disabled=${this.disabled}
11058
11058
  @click=${l=>{l.stopPropagation(),this.response=(this.response||[]).filter((d,h)=>h!==i),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})}}
@@ -11061,7 +11061,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11061
11061
  ${this.renderSupplementalLayer()}
11062
11062
  <slot></slot>
11063
11063
  </point-container>
11064
- <div part="message" role="alert" id="validation-message" style="display:none;"></div>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,i=!0,n="",s="other";return e?(i=!1,s="max",n=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(i=!1,s="min",n=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(i,n,this.#e??this,{suppressInline:!0,kind:s}),i}reportValidity(t){return super.reportValidity(t)}#c(){this.#n=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#r=t.width===0?1:this.#n/t.width,this.#i=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#c(),this.requestUpdate(),this.#e.addEventListener("click",this.#s)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#a),this.#e&&this.#e.removeEventListener("click",this.#s)}};Sr([p({type:Number,attribute:"max-choices"})],dt.prototype,"maxChoices",void 0);Sr([p({type:Number,attribute:"min-choices"})],dt.prototype,"minChoices",void 0);Sr([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Qi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>ar(o)}})],dt.prototype,"response",void 0);Sr([p({attribute:"area-mappings"})],dt.prototype,"areaMappings",void 0);Sr([I()],dt.prototype,"_areaEntries",void 0);Sr([N("response")],dt.prototype,"_handleResponseChange",void 0);Sr([N("areaMappings")],dt.prototype,"_handleAreaMappingsChange",void 0);var Ts=[{tag:"qti-select-point-interaction",ctor:dt}];var Eu=[R,w`
11064
+ <div part="message" role="alert" id="validation-message" style="display:none;"></div>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,i=!0,n="",s="other";return e?(i=!1,s="max",n=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(i=!1,s="min",n=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(i,n,this.#e??this,{suppressInline:!0,kind:s}),i}reportValidity(t){return super.reportValidity(t)}#c(){this.#n=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#r=t.width===0?1:this.#n/t.width,this.#i=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#c(),this.requestUpdate(),this.#e.addEventListener("click",this.#s)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#a),this.#e&&this.#e.removeEventListener("click",this.#s)}};Ir([p({type:Number,attribute:"max-choices"})],dt.prototype,"maxChoices",void 0);Ir([p({type:Number,attribute:"min-choices"})],dt.prototype,"minChoices",void 0);Ir([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Gi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>cr(o)}})],dt.prototype,"response",void 0);Ir([p({attribute:"area-mappings"})],dt.prototype,"areaMappings",void 0);Ir([T()],dt.prototype,"_areaEntries",void 0);Ir([N("response")],dt.prototype,"_handleResponseChange",void 0);Ir([N("areaMappings")],dt.prototype,"_handleAreaMappingsChange",void 0);var _s=[{tag:"qti-select-point-interaction",ctor:dt}];var $u=[_,x`
11065
11065
  :host {
11066
11066
  display: block;
11067
11067
  --show-bounds: true;
@@ -11129,7 +11129,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11129
11129
  text-align: center;
11130
11130
  color: #6b7280; /* text-gray-500 */
11131
11131
  }
11132
- `];var Sn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Tt=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=Eu}#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}willUpdate(t){super.willUpdate(t),this._internals.ariaValueMin=String(this.min),this._internals.ariaValueMax=String(this.max)}get response(){return this.#t===null?null:this.#t.toString()}set response(t){if(t==null||t===""){this.#e(null);return}let e=parseFloat(t);isNaN(e)||this.#e(e)}renderRailSupplement(){return P}#e(t){let e=this.#t;if(this.#t=t===null?null:Math.min(this.max,Math.max(this.min,t)),this.#t===e)return!1;if(this.#t===null)this.style.removeProperty("--value-percentage"),this._internals.setFormValue(null),this._internals.ariaValueNow=null;else{let r=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${r}%`),this._internals.setFormValue(this.value),this._internals.ariaValueNow=String(this.#t)}return this.requestUpdate(),!0}#r(t){this.#e(t)&&this.saveResponse(this.response)}render(){return v`
11132
+ `];var In=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},It=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=$u}#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}willUpdate(t){super.willUpdate(t),this._internals.ariaValueMin=String(this.min),this._internals.ariaValueMax=String(this.max)}get response(){return this.#t===null?null:this.#t.toString()}set response(t){if(t==null||t===""){this.#e(null);return}let e=parseFloat(t);isNaN(e)||this.#e(e)}renderRailSupplement(){return P}#e(t){let e=this.#t;if(this.#t=t===null?null:Math.min(this.max,Math.max(this.min,t)),this.#t===e)return!1;if(this.#t===null)this.style.removeProperty("--value-percentage"),this._internals.setFormValue(null),this._internals.ariaValueNow=null;else{let r=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${r}%`),this._internals.setFormValue(this.value),this._internals.ariaValueNow=String(this.#t)}return this.requestUpdate(),!0}#r(t){this.#e(t)&&this.saveResponse(this.response)}render(){return v`
11133
11133
  <slot name="prompt"></slot>
11134
11134
  <div id="slider" part="slider">
11135
11135
  <div id="bounds" part="bounds">
@@ -11147,7 +11147,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11147
11147
  ${this.renderRailSupplement()}
11148
11148
  </div>
11149
11149
  </div>
11150
- `}#i(t){this.#o(t.pageX);let e=i=>this.#s(i.pageX),r=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",r)}#n(t){this.#o(t.touches[0].pageX);let e=i=>this.#s(i.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),r=t-e.left,i=Math.min(1,Math.max(0,r/e.width)),n=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#r(n)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};Sn([Pr("#rail")],Tt.prototype,"_rail",void 0);Sn([p({type:Number,attribute:"lower-bound"})],Tt.prototype,"min",void 0);Sn([p({type:Number,attribute:"upper-bound"})],Tt.prototype,"max",void 0);Sn([p({type:Number,attribute:"step"})],Tt.prototype,"step",void 0);Sn([p({attribute:"response",reflect:!1,noAccessor:!0})],Tt.prototype,"response",null);var Is=[{tag:"qti-slider-interaction",ctor:Tt}];var Su=()=>new Jc,Jc=class{},Yc=new WeakMap,o3=$t(class extends Oe{render(o){return P}update(o,[t]){let e=t!==this.G;return e&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),P}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Yc.get(t);e===void 0&&(e=new WeakMap,Yc.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?Yc.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 Au=[R,w`
11150
+ `}#i(t){this.#o(t.pageX);let e=i=>this.#s(i.pageX),r=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",r)}#n(t){this.#o(t.touches[0].pageX);let e=i=>this.#s(i.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),r=t-e.left,i=Math.min(1,Math.max(0,r/e.width)),n=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#r(n)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};In([Dr("#rail")],It.prototype,"_rail",void 0);In([p({type:Number,attribute:"lower-bound"})],It.prototype,"min",void 0);In([p({type:Number,attribute:"upper-bound"})],It.prototype,"max",void 0);In([p({type:Number,attribute:"step"})],It.prototype,"step",void 0);In([p({attribute:"response",reflect:!1,noAccessor:!0})],It.prototype,"response",null);var Ms=[{tag:"qti-slider-interaction",ctor:It}];var Nu=()=>new rl,rl=class{},el=new WeakMap,A3=$t(class extends De{render(o){return P}update(o,[t]){let e=t!==this.G;return e&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),P}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=el.get(t);e===void 0&&(e=new WeakMap,el.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?el.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 Lu=[_,x`
11151
11151
  :host {
11152
11152
  display: inline-flex;
11153
11153
  align-items: center;
@@ -11236,7 +11236,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11236
11236
  :host(.qti-input-width-72) {
11237
11237
  --qti-input-width: 72;
11238
11238
  }
11239
- `];var Ar=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ht=class extends D{constructor(){super(...arguments),this.inputRef=Su(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Au}get value(){return this.response||null}set value(t){this.response=t||null}get isInline(){return!0}validate(){if(!this._input)return!1;let t="",e=!1;this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),e=this._input.checkValidity(),e||(t=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):e=this._input.checkValidity();let r="other";return e&&this.response===""&&(e=!1,r="min"),!e&&!t&&(t=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(e,t,this._input,{suppressInline:!0,kind:r}),e}renderAnswer(){return v`<div part="answer-key answer" aria-hidden="true"></div>`}renderInput(){return v`<input
11239
+ `];var Tr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ht=class extends D{constructor(){super(...arguments),this.inputRef=Nu(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Lu}get value(){return this.response||null}set value(t){this.response=t||null}get isInline(){return!0}validate(){if(!this._input)return!1;let t="",e=!1;this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),e=this._input.checkValidity(),e||(t=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):e=this._input.checkValidity();let r="other";return e&&this.response===""&&(e=!1,r="min"),!e&&!t&&(t=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(e,t,this._input,{suppressInline:!0,kind:r}),e}renderAnswer(){return v`<div part="answer-key answer" aria-hidden="true"></div>`}renderInput(){return v`<input
11240
11240
  part="input"
11241
11241
  name="${this.responseIdentifier}"
11242
11242
  spellcheck="false"
@@ -11252,7 +11252,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11252
11252
  maxlength=${1e3}
11253
11253
  ?disabled="${this.disabled}"
11254
11254
  ?readonly="${this.readonly}"
11255
- />`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(t){return this.validate(),super.reportValidity(t)}reset(){this.response=""}};Ar([p({type:Number,attribute:"expected-length"})],ht.prototype,"expectedLength",void 0);Ar([p({type:String,attribute:"pattern-mask"})],ht.prototype,"patternMask",void 0);Ar([p({type:String,attribute:"placeholder-text"})],ht.prototype,"placeholderText",void 0);Ar([p({type:String,attribute:"data-patternmask-message"})],ht.prototype,"dataPatternmaskMessage",void 0);Ar([p({type:String,attribute:"response",reflect:!1})],ht.prototype,"response",void 0);Ar([Pr("input")],ht.prototype,"_input",void 0);Ar([N("response",{waitUntilFirstUpdate:!0})],ht.prototype,"_handleValueChange",void 0);var _s=[{tag:"qti-text-entry-interaction",ctor:ht}];var Tu=[R,w`
11255
+ />`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(t){return this.validate(),super.reportValidity(t)}reset(){this.response=""}};Tr([p({type:Number,attribute:"expected-length"})],ht.prototype,"expectedLength",void 0);Tr([p({type:String,attribute:"pattern-mask"})],ht.prototype,"patternMask",void 0);Tr([p({type:String,attribute:"placeholder-text"})],ht.prototype,"placeholderText",void 0);Tr([p({type:String,attribute:"data-patternmask-message"})],ht.prototype,"dataPatternmaskMessage",void 0);Tr([p({type:String,attribute:"response",reflect:!1})],ht.prototype,"response",void 0);Tr([Dr("input")],ht.prototype,"_input",void 0);Tr([N("response",{waitUntilFirstUpdate:!0})],ht.prototype,"_handleValueChange",void 0);var Ps=[{tag:"qti-text-entry-interaction",ctor:ht}];var Vu=[_,x`
11256
11256
  :host {
11257
11257
  display: block;
11258
11258
  margin: 1em 0;
@@ -11261,7 +11261,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11261
11261
  display: block;
11262
11262
  margin-top: 0.5em;
11263
11263
  }
11264
- `];var Rs=class extends D{static{this.styles=Tu}#t=null;#e=null;reset(){this.resetValidityReport(),this.#t=null,this.#e=null,this._internals.setFormValue(null),this.saveResponse(null)}validate(){return this.#e!==null}get response(){return this.#e}set response(t){if(typeof t=="string")this.#e=t,this._internals.setFormValue(t),this.saveResponse(t);else if(t===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...D.properties}}render(){return v`
11264
+ `];var Os=class extends D{static{this.styles=Vu}#t=null;#e=null;reset(){this.resetValidityReport(),this.#t=null,this.#e=null,this._internals.setFormValue(null),this.saveResponse(null)}validate(){return this.#e!==null}get response(){return this.#e}set response(t){if(typeof t=="string")this.#e=t,this._internals.setFormValue(t),this.saveResponse(t);else if(t===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...D.properties}}render(){return v`
11265
11265
  <div>
11266
11266
  <slot name="prompt"></slot>
11267
11267
  <input
@@ -11272,7 +11272,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11272
11272
  ?readonly="${this.readonly}"
11273
11273
  />
11274
11274
  </div>
11275
- `}async#r(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#i(this.#t),this._internals.setFormValue(this.#e),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#i(t){return new Promise((e,r)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(t)})}};var Ms=[{tag:"qti-upload-interaction",ctor:Rs}];var Iu=[...ns,...os,...ss,...as,...cs,...ls,...hs,...ps,...us,...ms,...fs,...gs,...vs,...qs,...xs,...Es,...As,...Ts,...Is,..._s,...Ms,...Cp];for(let{tag:o,ctor:t}of Iu)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ns)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of os)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ss)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of as)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of cs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ls)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of hs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ps)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of us)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ms)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of fs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of gs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of vs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of qs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of xs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of As)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ts)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Is)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of _s)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ms)customElements.get(o)||customElements.define(o,t);var D2=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await Kd().load(`${o}`).then(a=>a.assessmentTest()),r=await Xr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Xr().load(`${t}/${e.href}`).then(a=>a.items()),n=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:n,items:i,testIdentifier:e.identifier}},$2=async o=>Jt().load(o).then(t=>t.htmlDoc().firstElementChild);var Ps=class extends Mg(Xt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Mg(o){return class extends o{calculateChildren(e){return e.map(i=>{let n=i;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=n.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var _u=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},li=class extends E{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let r of t){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(r.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(r.value===null||r.value===void 0)return null;r.value==="true"&&e++}return e>=this.min&&e<=this.max}};_u([p({type:Number})],li.prototype,"min",void 0);_u([p({type:Number})],li.prototype,"max",void 0);var Pg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},An=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Pg([p({type:String,attribute:"base-type"})],An.prototype,"baseType",void 0);var Os=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var Ds=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let i=this.#t(t.value),n=this.#t(e.value);return n.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(i,n,r):this.#r(i,n,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return J.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let i=[...t];return e.every(n=>{let s=i.findIndex(a=>this.#e(a,n,r));return s===-1?!1:(i.splice(s,1),!0)})}#i(t,e,r){for(let i=0;i+e.length<=t.length;i++)if(e.every((n,s)=>this.#e(t[i+s],n,r)))return!0;return!1}};var $s=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var Kc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Tr=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let n=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!n)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(n=>n.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Kc([p({type:String})],Tr.prototype,"identifier",void 0);Kc([_({context:F,subscribe:!0}),I()],Tr.prototype,"context",void 0);Kc([I(),_({context:nt,subscribe:!0})],Tr.prototype,"_testContext",void 0);var Ns=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(n=>!e.value.includes(n))}return null}};var Ls=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Vs=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var js=class extends E{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Og=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Tn=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let i=parseFloat(e.value),n=parseFloat(r.value);if(!isNaN(i)&&!isNaN(n))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};Og([p({type:String,attribute:"rounding-mode"})],Tn.prototype,"roundingMode",void 0);var Ru=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},di=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?J.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(c=>parseFloat(c));if(r.length===0||r.some(c=>Number.isNaN(c)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[i,n=i]=r,[s,a]=this.toleranceMode==="absolute"?[e-i,e+n]:[e*(1-i/100),e*(1+n/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};Ru([p({type:String,attribute:"tolerance-mode"})],di.prototype,"toleranceMode",void 0);Ru([p({type:String})],di.prototype,"tolerance",void 0);var Y=class extends C{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var Fs=class extends Y{process(){throw new Nr}};var zs=class extends Y{process(){throw new Lr}};var Bs=class extends E{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],r=e?.cardinality==="record"||e?.baseType==="record";if(r&&(e.value===null||e.value===void 0))return null;if(!e||!r||!de(e.value))return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i==null?null:(this.#t=e.fieldBaseTypes?.[t]??po(Array.isArray(i)?i[0]:i),i)}};var Us=class extends E{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(r.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(r.cardinality==="multiple"||r.cardinality==="ordered"){if(!Array.isArray(r.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of r.value){if(i==null)return null;let n=parseInt(i,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let r=1;r<t.length&&(e=this.#e(e,Math.abs(t[r])),e!==1);r++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let r=e;e=t%e,t=r}return t}};var It=o=>o==null||o==="";var Hs=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(It(e?.value)||It(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Ws=class extends Xt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return It(e?.value)||It(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var Dg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},In=class extends E{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let r=this.#t(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(r)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let r=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>r.length?null:r[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(r=>r.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Dg([p({type:String})],In.prototype,"n",void 0);var Mu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},hi=class extends E{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),i=this.#e(this.coords);if(!r||i.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,i);case"rect":return this.#i(r,i);case"ellipse":return this.#n(r,i);case"poly":case"polygon":return this.#o(r,i);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(n=>n.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,n]=e;return(t.x-r)**2+(t.y-i)**2<=n**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,n,s]=e,a=Math.min(r,n),c=Math.max(r,n),l=Math.min(i,s),d=Math.max(i,s);return t.x>=a&&t.x<=c&&t.y>=l&&t.y<=d}#n(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,i,n,s]=e;return n===0||s===0?!1:(t.x-r)**2/n**2+(t.y-i)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,n=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],c=e[n],l=e[n+1];a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a||Number.EPSILON)+s&&(r=!r),n=i}return r}};Mu([p({type:String})],hi.prototype,"shape",void 0);Mu([p({type:String})],hi.prototype,"coords",void 0);var Qs=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};var Xs=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};var Gs=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var Ys=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var Js=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);continue}if(r.cardinality!=="multiple"&&r.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(r.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let i of r.value){let n=Number.parseInt(i,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n)}}return e}#e(t,e){let r=Math.abs(t),i=Math.abs(e);for(;i!==0;){let n=r%i;r=i,i=n}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var Pu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pi=class extends Y{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(n=>n.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let r=parseFloat(this.childExpression.calculate()),i;return e.matchTable?.size?i=e.matchTable.get(r):e.interpolationTable&&(i=this.#t(r,e.interpolationTable)),i==null?(console.warn(`lookupOutcomeValue: no table entry matches ${r} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Mt(i)}})),i)}#t(t,e){if(!Number.isNaN(t))return e.find(r=>r.includeBoundary?t>=r.sourceValue:t>r.sourceValue)?.targetValue}};Pu([p({type:String})],pi.prototype,"identifier",void 0);Pu([_({context:F,subscribe:!0}),I()],pi.prototype,"context",void 0);var Ks=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(It(e?.value)||It(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var Zs=class extends Xt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return It(e?.value)||It(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var $g=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},_n=class extends E{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=(Array.isArray(t.value)?t.value:[t.value]).filter(s=>typeof s=="string"&&s.length>0);if(r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,n=new Set;for(let s of r)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;if(J.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){i+=a.mappedValue??0,n.add(a.coords);break}}return n.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};$g([p({type:String})],_n.prototype,"identifier",void 0);var Ng=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Rn=class extends E{getResult(){let t=this.context.variables.find(n=>n.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let n of r){let s=e.mapEntries.filter(c=>t.baseType==="string"&&!c.caseSensitive?J.compareSingleValues(c.mapKey.toLowerCase(),n.toLowerCase(),t.baseType):J.compareSingleValues(c.mapKey,n,t.baseType)),a=s.reduce((c,l)=>c.mappedValue>l.mappedValue?c:l,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};Ng([p({type:String})],Rn.prototype,"identifier",void 0);var ta=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):J.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!J.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let n=null,s=[...t.value];for(let a of s)if(J.compareSingleValues(i,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Lg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Mn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};Lg([p({type:String})],Mn.prototype,"name",void 0);var Vg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Pn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let i=parseFloat(r.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],i=e[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(e.length!==2)return null;let r=e[0],i=e[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};Vg([p({type:String})],Pn.prototype,"name",void 0);var ea=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var ra=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};var ia=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var na=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var oa=class extends E{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var sa=class extends E{getResult(){return null}};var aa=class extends Xt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),n=!1;if(typeof i=="string")if(i==="true")n=!0;else if(i==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(n=i);return n}).some(e=>typeof e=="boolean"&&e)}};var ca=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var la=class extends C{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},ui=class extends la{shouldProcess(){return!0}getSubRules(){return[...this.children]}},mi=class extends la{shouldProcess(){let e=this.firstElementChild.calculate();return e===!0||e==="true"}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},fi=class extends Y{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var da=class extends fi{};var gi=class extends mi{};var ha=class extends gi{};var pa=class extends ui{};var jg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},On=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=this.#t();return r?r.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};jg([p({type:String})],On.prototype,"pattern",void 0);var ua=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),n=parseFloat(r.value);if(isNaN(i)||isNaN(n))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&n<=0||i<0&&!Number.isInteger(n))return null;let s;try{s=Math.pow(i,n)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),c=Math.max(0,14-a),l=Math.pow(10,c);s=Math.round(s*l)/l}return s}};var Fg=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function zg(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function Dn(o,t){return zg(t===void 0?o.toExponential():o.toExponential(t))}function Ou(o){let[t,e]=o.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,i=e===void 0?"":`e${e}`;return`${r}${i}`}function Du(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?Ou(Dn(o,e-1)):Ou(o.toFixed(Math.max(0,e-1-r)))}function Bg(o,t,e,r){if(o==="s"||o==="c"){let l=o==="c"?r.slice(0,1):r;return e===void 0?l:l.slice(0,e)}let i=Number(r);if(r.trim()===""||!Number.isFinite(i))return r;let n=Math.abs(i),s,a=i<0;switch(o){case"d":case"i":s=String(Math.trunc(n));break;case"u":s=String(Math.trunc(n)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(n).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(n).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(n).toString(16).toUpperCase()}`;break;case"f":case"F":s=n.toFixed(e??6);break;case"e":s=Dn(n,e??6);break;case"E":s=Dn(n,e??6).toUpperCase();break;case"g":s=Du(n,e??6);break;case"G":s=Du(n,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function Ug(o,t,e){if(o.length>=e)return o;let r=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(r)}`;if(t.includes("0")){let[,i,n]=/^([-+ ]?)(.*)$/.exec(o);return`${i}${"0".repeat(r)}${n}`}return`${" ".repeat(r)}${o}`}function $u(o,t){return o.replace(Fg,(e,r,i,n,s,a)=>r?"%":Ug(Bg(a,i??"",s===void 0?void 0:Number(s),t),i??"",n===void 0?0:Number(n)))}var xe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vt=class extends C{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:v`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let r=e[this.index-1];return r==null?null:this.#e(r,t.baseType)}return e.map(r=>this.#e(r,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let r=e;if(this.field!==void 0){let n=r[this.field];return n==null?null:this.#e(n,t.baseType)}let i=Object.entries(r).filter(([,n])=>n!=null);return i.length===0?null:i.map(([n,s])=>`${n}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let r=Array.isArray(t)?t.join(" "):String(t);if(this.format)return $u(this.format,r);if(e==="integer"&&this.base!==10){let i=Number.parseInt(r,10);if(Number.isFinite(i))return i.toString(this.base)}if(this.powerForm){let i=Number(r);if(r.trim()!==""&&Number.isFinite(i))return Dn(i)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};xe([p({type:String})],vt.prototype,"identifier",void 0);xe([p({type:String})],vt.prototype,"format",void 0);xe([p({type:Number})],vt.prototype,"base",void 0);xe([p({type:Number})],vt.prototype,"index",void 0);xe([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);xe([p({type:String})],vt.prototype,"field",void 0);xe([p({type:String})],vt.prototype,"delimiter",void 0);xe([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);xe([_({context:F,subscribe:!0}),I()],vt.prototype,"context",void 0);var ma=class extends E{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};var Zc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ir=class extends E{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),e++}if(t.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let r=Math.floor(Math.random()*t.length);return t[r]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};Zc([p({type:Number})],Ir.prototype,"min",void 0);Zc([p({type:Number})],Ir.prototype,"max",void 0);Zc([p({type:Number})],Ir.prototype,"step",void 0);var fa=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let r=Math.floor(Math.random()*e.length);return e[r]}return e}return console.error("unexpected number of children in match"),null}};var Hg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},tl=1e3,$n=class extends E{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let i=0;i<t;i++){let n=e.calculate(),s=this.#r(n);s&&r.push(s)}return r}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,n=parseInt(i?.toString()??"",10);return Number.isNaN(n)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(n)}#e(t){return t>tl?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${tl} limit, truncating`),tl):t}#r(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};Hg([p({type:String,attribute:"number-repeats"})],$n.prototype,"numberRepeats",void 0);var ga=class extends fi{};var bi=class extends mi{};var ba=class extends bi{};var va=class extends ui{};var ya=class extends Y{process(){for(let t of[...this.children])t.process()}};var Nu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vi=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),i=Math.pow(10,e-r-1);return Math.round(t*i)/i}};Nu([p({type:String,attribute:"rounding-mode"})],vi.prototype,"roundingMode",void 0);Nu([p({type:Number})],vi.prototype,"figures",void 0);var qa=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var xa=class extends Y{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new el(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},el=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var wa=class extends Y{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new rl(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(Mt):t!==null?Mt(t):null}},rl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>e.value?e.value:e):t}};var Ca=class extends Y{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new il(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},il=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var Wg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Nn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#i(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#r(t,t.length);case"popsd":return Math.sqrt(this.#r(t,t.length));case"samplevariance":return t.length<2?null:this.#r(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#r(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,r)=>e+r,0)/t.length}#e(t){let e=[...t].sort((i,n)=>i-n),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}#r(t,e){let r=this.#t(t);return t.reduce((i,n)=>i+Math.pow(n-r,2),0)/e}#i(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};Wg([p({type:String})],Nn.prototype,"name",void 0);var Qg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ln=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return J.compareSingleValues(i,n,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Qg([p({type:String,attribute:"case-sensitive"})],Ln.prototype,"caseSensitive",void 0);var Xg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Vn=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let i=e.value.toString(),n=r.value.toString();return this.caseSensitive!=="true"?n.toLowerCase().includes(i.toLowerCase()):n.includes(i)}};Xg([p({type:String,attribute:"case-sensitive"})],Vn.prototype,"caseSensitive",void 0);var ka=class extends Gg(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function Gg(o){return class extends o{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=i.calculate();return Number.isNaN(n)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(n)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var Ea=class extends E{getResult(){return new nl(Array.from(this.children)).calculate()}},nl=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(r=>r.calculate!==void 0).some(r=>r.calculate()===null)?null:this.expressions.map(r=>{let i=r.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((r,i)=>r+i,0)}};var Sa=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var Aa=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var Lu=[{tag:"qti-and",ctor:Ps},{tag:"qti-any-n",ctor:li},{tag:"qti-base-value",ctor:An},{tag:"qti-container-size",ctor:Os},{tag:"qti-contains",ctor:Ds},{tag:"qti-correct",ctor:$s},{tag:"qti-default",ctor:Tr},{tag:"qti-delete",ctor:Ns},{tag:"qti-divide",ctor:Ls},{tag:"qti-duration-gte",ctor:Vs},{tag:"qti-duration-lt",ctor:js},{tag:"qti-equal",ctor:di},{tag:"qti-equal-rounded",ctor:Tn},{tag:"qti-exit-response",ctor:Fs},{tag:"qti-exit-test",ctor:zs},{tag:"qti-field-value",ctor:Bs},{tag:"qti-gcd",ctor:Us},{tag:"qti-gt",ctor:Hs},{tag:"qti-gte",ctor:Ws},{tag:"qti-index",ctor:In},{tag:"qti-inside",ctor:hi},{tag:"qti-integer-divide",ctor:Qs},{tag:"qti-integer-modulus",ctor:Xs},{tag:"qti-integer-to-float",ctor:Gs},{tag:"qti-is-null",ctor:Ys},{tag:"qti-lcm",ctor:Js},{tag:"qti-lookup-outcome-value",ctor:pi},{tag:"qti-lt",ctor:Ks},{tag:"qti-lte",ctor:Zs},{tag:"qti-map-response",ctor:Rn},{tag:"qti-map-response-point",ctor:_n},{tag:"qti-match",ctor:ta},{tag:"qti-math-constant",ctor:Mn},{tag:"qti-math-operator",ctor:Pn},{tag:"qti-max",ctor:ea},{tag:"qti-member",ctor:ra},{tag:"qti-min",ctor:ia},{tag:"qti-multiple",ctor:na},{tag:"qti-not",ctor:oa},{tag:"qti-null",ctor:sa},{tag:"qti-or",ctor:aa},{tag:"qti-ordered",ctor:ca},{tag:"qti-outcome-condition",ctor:da},{tag:"qti-outcome-else",ctor:pa},{tag:"qti-outcome-else-if",ctor:ha},{tag:"qti-outcome-if",ctor:gi},{tag:"qti-pattern-match",ctor:On},{tag:"qti-power",ctor:ua},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:ma},{tag:"qti-random",ctor:fa},{tag:"qti-random-integer",ctor:Ir},{tag:"qti-repeat",ctor:$n},{tag:"qti-response-condition",ctor:ga},{tag:"qti-response-else",ctor:va},{tag:"qti-response-else-if",ctor:ba},{tag:"qti-response-if",ctor:bi},{tag:"qti-response-processing-fragment",ctor:ya},{tag:"qti-round",ctor:qa},{tag:"qti-round-to",ctor:vi},{tag:"qti-rule",ctor:Y},{tag:"qti-set-correct-response",ctor:xa},{tag:"qti-set-outcome-value",ctor:wa},{tag:"qti-set-template-value",ctor:Ca},{tag:"qti-stats-operator",ctor:Nn},{tag:"qti-string-match",ctor:Ln},{tag:"qti-substring",ctor:Vn},{tag:"qti-subtract",ctor:ka},{tag:"qti-sum",ctor:Ea},{tag:"qti-truncate",ctor:Sa},{tag:"qti-variable",ctor:Aa}];for(let{tag:o,ctor:t}of Lu)customElements.get(o)||customElements.define(o,t);var we=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Z;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(Z||(Z={}));var ol=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,i)=>{this.toggleCandidateCorrection(i)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""),z(this._internals.states,"answer-key",!0,[]))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let i=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",i)}get correctness(){let r=this.correctResponse;if(!r)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let n=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let c=a.filter(d=>n.includes(d)).length,l=a.filter(d=>!n.includes(d)).length;return c===n.length&&l===0&&a.length===n.length?Z.Correct:c>0&&(c<n.length||l>0)?Z.PartiallyCorrect:Z.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let i=this.nextSibling,n=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==Z.Correct))){if(!n)return;this.parentElement?.removeChild(i);return}if(n)return;let c=this.cloneNode(!0);c.removeAttribute("show-full-correct-response"),c.removeAttribute("show-correct-response"),c.removeAttribute("show-candidate-correction");let l=document.createElement("div");l.classList.add("full-correct-response"),this.isInline?l.classList.add("full-correct-response-inline"):l.classList.add("full-correct-response-block"),l.role="full-correct-response",l.appendChild(c),c.isFullCorrectResponse=!0,this.parentElement?.insertBefore(l,this.nextSibling),await c.updateComplete,c.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){z(this._internals.states,"answer-key-shown",!!(r&&this.correctResponse),["show-correct-response"])}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return we([p({attribute:"correct-response",reflect:!0,converter:Gt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),we([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),we([N("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),we([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),we([N("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),we([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),we([N("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),we([I()],t.prototype,"_isFullCorrectResponse",void 0),we([I()],t.prototype,"_correctResponse",void 0),t};var st=w`
11275
+ `}async#r(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#i(this.#t),this._internals.setFormValue(this.#e),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#i(t){return new Promise((e,r)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(t)})}};var Ds=[{tag:"qti-upload-interaction",ctor:Os}];var ju=[...as,...cs,...ls,...ds,...hs,...ps,...ms,...fs,...gs,...bs,...vs,...ys,...ws,...Cs,...ks,...Is,...Rs,..._s,...Ms,...Ps,...Ds,...Op];for(let{tag:o,ctor:t}of ju)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of as)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of cs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ls)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of hs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ps)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ms)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of fs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of gs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of bs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of vs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ys)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ws)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Cs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ks)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Is)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Rs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of _s)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ms)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ps)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ds)customElements.get(o)||customElements.define(o,t);var iL=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await ah().load(`${o}`).then(a=>a.assessmentTest()),r=await Yr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Yr().load(`${t}/${e.href}`).then(a=>a.items()),n=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:n,items:i,testIdentifier:e.identifier}},nL=async o=>Kt().load(o).then(t=>t.htmlDoc().firstElementChild);var $s=class extends Wg(Xt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Wg(o){return class extends o{calculateChildren(e){return e.map(i=>{let n=i;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=n.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var Fu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},hi=class extends E{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let r of t){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(r.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(r.value===null||r.value===void 0)return null;r.value==="true"&&e++}return e>=this.min&&e<=this.max}};Fu([p({type:Number})],hi.prototype,"min",void 0);Fu([p({type:Number})],hi.prototype,"max",void 0);var Qg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Tn=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Qg([p({type:String,attribute:"base-type"})],Tn.prototype,"baseType",void 0);var Ns=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var Ls=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let i=this.#t(t.value),n=this.#t(e.value);return n.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(i,n,r):this.#r(i,n,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return J.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let i=[...t];return e.every(n=>{let s=i.findIndex(a=>this.#e(a,n,r));return s===-1?!1:(i.splice(s,1),!0)})}#i(t,e,r){for(let i=0;i+e.length<=t.length;i++)if(e.every((n,s)=>this.#e(t[i+s],n,r)))return!0;return!1}};var Vs=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var il=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Rr=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let n=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!n)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(n=>n.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};il([p({type:String})],Rr.prototype,"identifier",void 0);il([R({context:F,subscribe:!0}),T()],Rr.prototype,"context",void 0);il([T(),R({context:nt,subscribe:!0})],Rr.prototype,"_testContext",void 0);var js=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(n=>!e.value.includes(n))}return null}};var Fs=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var zs=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Bs=class extends E{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Xg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Rn=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let i=parseFloat(e.value),n=parseFloat(r.value);if(!isNaN(i)&&!isNaN(n))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};Xg([p({type:String,attribute:"rounding-mode"})],Rn.prototype,"roundingMode",void 0);var zu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pi=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?J.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(c=>parseFloat(c));if(r.length===0||r.some(c=>Number.isNaN(c)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[i,n=i]=r,[s,a]=this.toleranceMode==="absolute"?[e-i,e+n]:[e*(1-i/100),e*(1+n/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};zu([p({type:String,attribute:"tolerance-mode"})],pi.prototype,"toleranceMode",void 0);zu([p({type:String})],pi.prototype,"tolerance",void 0);var Y=class extends C{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var Us=class extends Y{process(){throw new Vr}};var Hs=class extends Y{process(){throw new jr}};var Ws=class extends E{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],r=e?.cardinality==="record"||e?.baseType==="record";if(r&&(e.value===null||e.value===void 0))return null;if(!e||!r||!he(e.value))return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i==null?null:(this.#t=e.fieldBaseTypes?.[t]??mo(Array.isArray(i)?i[0]:i),i)}};var Qs=class extends E{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(r.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(r.cardinality==="multiple"||r.cardinality==="ordered"){if(!Array.isArray(r.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of r.value){if(i==null)return null;let n=parseInt(i,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let r=1;r<t.length&&(e=this.#e(e,Math.abs(t[r])),e!==1);r++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let r=e;e=t%e,t=r}return t}};var Tt=o=>o==null||o==="";var Xs=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Tt(e?.value)||Tt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Gs=class extends Xt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Tt(e?.value)||Tt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var Gg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},_n=class extends E{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let r=this.#t(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(r)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let r=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>r.length?null:r[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(r=>r.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Gg([p({type:String})],_n.prototype,"n",void 0);var Bu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ui=class extends E{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),i=this.#e(this.coords);if(!r||i.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,i);case"rect":return this.#i(r,i);case"ellipse":return this.#n(r,i);case"poly":case"polygon":return this.#o(r,i);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(n=>n.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,n]=e;return(t.x-r)**2+(t.y-i)**2<=n**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,n,s]=e,a=Math.min(r,n),c=Math.max(r,n),l=Math.min(i,s),d=Math.max(i,s);return t.x>=a&&t.x<=c&&t.y>=l&&t.y<=d}#n(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,i,n,s]=e;return n===0||s===0?!1:(t.x-r)**2/n**2+(t.y-i)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,n=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],c=e[n],l=e[n+1];a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a||Number.EPSILON)+s&&(r=!r),n=i}return r}};Bu([p({type:String})],ui.prototype,"shape",void 0);Bu([p({type:String})],ui.prototype,"coords",void 0);var Ys=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};var Js=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};var Ks=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var Zs=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var ta=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);continue}if(r.cardinality!=="multiple"&&r.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(r.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let i of r.value){let n=Number.parseInt(i,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n)}}return e}#e(t,e){let r=Math.abs(t),i=Math.abs(e);for(;i!==0;){let n=r%i;r=i,i=n}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var Uu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},mi=class extends Y{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(n=>n.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let r=parseFloat(this.childExpression.calculate()),i;return e.matchTable?.size?i=e.matchTable.get(r):e.interpolationTable&&(i=this.#t(r,e.interpolationTable)),i==null?(console.warn(`lookupOutcomeValue: no table entry matches ${r} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Mt(i)}})),i)}#t(t,e){if(!Number.isNaN(t))return e.find(r=>r.includeBoundary?t>=r.sourceValue:t>r.sourceValue)?.targetValue}};Uu([p({type:String})],mi.prototype,"identifier",void 0);Uu([R({context:F,subscribe:!0}),T()],mi.prototype,"context",void 0);var ea=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Tt(e?.value)||Tt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var ra=class extends Xt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Tt(e?.value)||Tt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var Yg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Mn=class extends E{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=(Array.isArray(t.value)?t.value:[t.value]).filter(s=>typeof s=="string"&&s.length>0);if(r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,n=new Set;for(let s of r)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;if(J.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){i+=a.mappedValue??0,n.add(a.coords);break}}return n.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Yg([p({type:String})],Mn.prototype,"identifier",void 0);var Jg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Pn=class extends E{getResult(){let t=this.context.variables.find(n=>n.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let n of r){let s=e.mapEntries.filter(c=>t.baseType==="string"&&!c.caseSensitive?J.compareSingleValues(c.mapKey.toLowerCase(),n.toLowerCase(),t.baseType):J.compareSingleValues(c.mapKey,n,t.baseType)),a=s.reduce((c,l)=>c.mappedValue>l.mappedValue?c:l,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};Jg([p({type:String})],Pn.prototype,"identifier",void 0);var ia=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):J.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!J.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let n=null,s=[...t.value];for(let a of s)if(J.compareSingleValues(i,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Kg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},On=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};Kg([p({type:String})],On.prototype,"name",void 0);var Zg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Dn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let i=parseFloat(r.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],i=e[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(e.length!==2)return null;let r=e[0],i=e[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};Zg([p({type:String})],Dn.prototype,"name",void 0);var na=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var oa=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};var sa=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var aa=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var ca=class extends E{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var la=class extends E{getResult(){return null}};var da=class extends Xt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),n=!1;if(typeof i=="string")if(i==="true")n=!0;else if(i==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(n=i);return n}).some(e=>typeof e=="boolean"&&e)}};var ha=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var pa=class extends C{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},fi=class extends pa{shouldProcess(){return!0}getSubRules(){return[...this.children]}},gi=class extends pa{shouldProcess(){let e=this.firstElementChild.calculate();return e===!0||e==="true"}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},bi=class extends Y{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var ua=class extends bi{};var vi=class extends gi{};var ma=class extends vi{};var fa=class extends fi{};var tb=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},$n=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=this.#t();return r?r.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};tb([p({type:String})],$n.prototype,"pattern",void 0);var ga=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),n=parseFloat(r.value);if(isNaN(i)||isNaN(n))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&n<=0||i<0&&!Number.isInteger(n))return null;let s;try{s=Math.pow(i,n)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),c=Math.max(0,14-a),l=Math.pow(10,c);s=Math.round(s*l)/l}return s}};var eb=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function rb(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function Nn(o,t){return rb(t===void 0?o.toExponential():o.toExponential(t))}function Hu(o){let[t,e]=o.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,i=e===void 0?"":`e${e}`;return`${r}${i}`}function Wu(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?Hu(Nn(o,e-1)):Hu(o.toFixed(Math.max(0,e-1-r)))}function ib(o,t,e,r){if(o==="s"||o==="c"){let l=o==="c"?r.slice(0,1):r;return e===void 0?l:l.slice(0,e)}let i=Number(r);if(r.trim()===""||!Number.isFinite(i))return r;let n=Math.abs(i),s,a=i<0;switch(o){case"d":case"i":s=String(Math.trunc(n));break;case"u":s=String(Math.trunc(n)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(n).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(n).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(n).toString(16).toUpperCase()}`;break;case"f":case"F":s=n.toFixed(e??6);break;case"e":s=Nn(n,e??6);break;case"E":s=Nn(n,e??6).toUpperCase();break;case"g":s=Wu(n,e??6);break;case"G":s=Wu(n,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function nb(o,t,e){if(o.length>=e)return o;let r=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(r)}`;if(t.includes("0")){let[,i,n]=/^([-+ ]?)(.*)$/.exec(o);return`${i}${"0".repeat(r)}${n}`}return`${" ".repeat(r)}${o}`}function Qu(o,t){return o.replace(eb,(e,r,i,n,s,a)=>r?"%":nb(ib(a,i??"",s===void 0?void 0:Number(s),t),i??"",n===void 0?0:Number(n)))}var xe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vt=class extends C{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:v`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let r=e[this.index-1];return r==null?null:this.#e(r,t.baseType)}return e.map(r=>this.#e(r,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let r=e;if(this.field!==void 0){let n=r[this.field];return n==null?null:this.#e(n,t.baseType)}let i=Object.entries(r).filter(([,n])=>n!=null);return i.length===0?null:i.map(([n,s])=>`${n}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let r=Array.isArray(t)?t.join(" "):String(t);if(this.format)return Qu(this.format,r);if(e==="integer"&&this.base!==10){let i=Number.parseInt(r,10);if(Number.isFinite(i))return i.toString(this.base)}if(this.powerForm){let i=Number(r);if(r.trim()!==""&&Number.isFinite(i))return Nn(i)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};xe([p({type:String})],vt.prototype,"identifier",void 0);xe([p({type:String})],vt.prototype,"format",void 0);xe([p({type:Number})],vt.prototype,"base",void 0);xe([p({type:Number})],vt.prototype,"index",void 0);xe([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);xe([p({type:String})],vt.prototype,"field",void 0);xe([p({type:String})],vt.prototype,"delimiter",void 0);xe([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);xe([R({context:F,subscribe:!0}),T()],vt.prototype,"context",void 0);var ba=class extends E{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};var nl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},_r=class extends E{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),e++}if(t.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let r=Math.floor(Math.random()*t.length);return t[r]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};nl([p({type:Number})],_r.prototype,"min",void 0);nl([p({type:Number})],_r.prototype,"max",void 0);nl([p({type:Number})],_r.prototype,"step",void 0);var va=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let r=Math.floor(Math.random()*e.length);return e[r]}return e}return console.error("unexpected number of children in match"),null}};var ob=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ol=1e3,Ln=class extends E{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let i=0;i<t;i++){let n=e.calculate(),s=this.#r(n);s&&r.push(s)}return r}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,n=parseInt(i?.toString()??"",10);return Number.isNaN(n)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(n)}#e(t){return t>ol?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${ol} limit, truncating`),ol):t}#r(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};ob([p({type:String,attribute:"number-repeats"})],Ln.prototype,"numberRepeats",void 0);var ya=class extends bi{};var yi=class extends gi{};var qa=class extends yi{};var wa=class extends fi{};var xa=class extends Y{process(){for(let t of[...this.children])t.process()}};var Xu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qi=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),i=Math.pow(10,e-r-1);return Math.round(t*i)/i}};Xu([p({type:String,attribute:"rounding-mode"})],qi.prototype,"roundingMode",void 0);Xu([p({type:Number})],qi.prototype,"figures",void 0);var Ca=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var ka=class extends Y{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new sl(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},sl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var Ea=class extends Y{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new al(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(Mt):t!==null?Mt(t):null}},al=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>e.value?e.value:e):t}};var Sa=class extends Y{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new cl(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},cl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var sb=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Vn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#i(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#r(t,t.length);case"popsd":return Math.sqrt(this.#r(t,t.length));case"samplevariance":return t.length<2?null:this.#r(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#r(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,r)=>e+r,0)/t.length}#e(t){let e=[...t].sort((i,n)=>i-n),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}#r(t,e){let r=this.#t(t);return t.reduce((i,n)=>i+Math.pow(n-r,2),0)/e}#i(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};sb([p({type:String})],Vn.prototype,"name",void 0);var ab=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},jn=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return J.compareSingleValues(i,n,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};ab([p({type:String,attribute:"case-sensitive"})],jn.prototype,"caseSensitive",void 0);var cb=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Fn=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let i=e.value.toString(),n=r.value.toString();return this.caseSensitive!=="true"?n.toLowerCase().includes(i.toLowerCase()):n.includes(i)}};cb([p({type:String,attribute:"case-sensitive"})],Fn.prototype,"caseSensitive",void 0);var Aa=class extends lb(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function lb(o){return class extends o{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=i.calculate();return Number.isNaN(n)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(n)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var Ia=class extends E{getResult(){return new ll(Array.from(this.children)).calculate()}},ll=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(r=>r.calculate!==void 0).some(r=>r.calculate()===null)?null:this.expressions.map(r=>{let i=r.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((r,i)=>r+i,0)}};var Ta=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var Ra=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var Gu=[{tag:"qti-and",ctor:$s},{tag:"qti-any-n",ctor:hi},{tag:"qti-base-value",ctor:Tn},{tag:"qti-container-size",ctor:Ns},{tag:"qti-contains",ctor:Ls},{tag:"qti-correct",ctor:Vs},{tag:"qti-default",ctor:Rr},{tag:"qti-delete",ctor:js},{tag:"qti-divide",ctor:Fs},{tag:"qti-duration-gte",ctor:zs},{tag:"qti-duration-lt",ctor:Bs},{tag:"qti-equal",ctor:pi},{tag:"qti-equal-rounded",ctor:Rn},{tag:"qti-exit-response",ctor:Us},{tag:"qti-exit-test",ctor:Hs},{tag:"qti-field-value",ctor:Ws},{tag:"qti-gcd",ctor:Qs},{tag:"qti-gt",ctor:Xs},{tag:"qti-gte",ctor:Gs},{tag:"qti-index",ctor:_n},{tag:"qti-inside",ctor:ui},{tag:"qti-integer-divide",ctor:Ys},{tag:"qti-integer-modulus",ctor:Js},{tag:"qti-integer-to-float",ctor:Ks},{tag:"qti-is-null",ctor:Zs},{tag:"qti-lcm",ctor:ta},{tag:"qti-lookup-outcome-value",ctor:mi},{tag:"qti-lt",ctor:ea},{tag:"qti-lte",ctor:ra},{tag:"qti-map-response",ctor:Pn},{tag:"qti-map-response-point",ctor:Mn},{tag:"qti-match",ctor:ia},{tag:"qti-math-constant",ctor:On},{tag:"qti-math-operator",ctor:Dn},{tag:"qti-max",ctor:na},{tag:"qti-member",ctor:oa},{tag:"qti-min",ctor:sa},{tag:"qti-multiple",ctor:aa},{tag:"qti-not",ctor:ca},{tag:"qti-null",ctor:la},{tag:"qti-or",ctor:da},{tag:"qti-ordered",ctor:ha},{tag:"qti-outcome-condition",ctor:ua},{tag:"qti-outcome-else",ctor:fa},{tag:"qti-outcome-else-if",ctor:ma},{tag:"qti-outcome-if",ctor:vi},{tag:"qti-pattern-match",ctor:$n},{tag:"qti-power",ctor:ga},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:ba},{tag:"qti-random",ctor:va},{tag:"qti-random-integer",ctor:_r},{tag:"qti-repeat",ctor:Ln},{tag:"qti-response-condition",ctor:ya},{tag:"qti-response-else",ctor:wa},{tag:"qti-response-else-if",ctor:qa},{tag:"qti-response-if",ctor:yi},{tag:"qti-response-processing-fragment",ctor:xa},{tag:"qti-round",ctor:Ca},{tag:"qti-round-to",ctor:qi},{tag:"qti-rule",ctor:Y},{tag:"qti-set-correct-response",ctor:ka},{tag:"qti-set-outcome-value",ctor:Ea},{tag:"qti-set-template-value",ctor:Sa},{tag:"qti-stats-operator",ctor:Vn},{tag:"qti-string-match",ctor:jn},{tag:"qti-substring",ctor:Fn},{tag:"qti-subtract",ctor:Aa},{tag:"qti-sum",ctor:Ia},{tag:"qti-truncate",ctor:Ta},{tag:"qti-variable",ctor:Ra}];for(let{tag:o,ctor:t}of Gu)customElements.get(o)||customElements.define(o,t);var Ce=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Z;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(Z||(Z={}));var dl=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,i)=>{this.toggleCandidateCorrection(i)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""),z(this._internals.states,"answer-key",!0,[]))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let i=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",i)}get correctness(){let r=this.correctResponse;if(!r)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let n=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let c=a.filter(d=>n.includes(d)).length,l=a.filter(d=>!n.includes(d)).length;return c===n.length&&l===0&&a.length===n.length?Z.Correct:c>0&&(c<n.length||l>0)?Z.PartiallyCorrect:Z.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let i=this.nextSibling,n=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==Z.Correct))){if(!n)return;this.parentElement?.removeChild(i);return}if(n)return;let c=this.cloneNode(!0);c.removeAttribute("show-full-correct-response"),c.removeAttribute("show-correct-response"),c.removeAttribute("show-candidate-correction");let l=document.createElement("div");l.classList.add("full-correct-response"),this.isInline?l.classList.add("full-correct-response-inline"):l.classList.add("full-correct-response-block"),l.role="full-correct-response",l.appendChild(c),c.isFullCorrectResponse=!0,this.parentElement?.insertBefore(l,this.nextSibling),await c.updateComplete,c.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){z(this._internals.states,"answer-key-shown",!!(r&&this.correctResponse),["show-correct-response"])}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return Ce([p({attribute:"correct-response",reflect:!0,converter:Gt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),Ce([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),Ce([N("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),Ce([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),Ce([N("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),Ce([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),Ce([N("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),Ce([T()],t.prototype,"_isFullCorrectResponse",void 0),Ce([T()],t.prototype,"_correctResponse",void 0),t};var st=x`
11276
11276
  /* Nothing at all until the item judges this element. */
11277
11277
  [part~='correction'] {
11278
11278
  display: none;
@@ -11305,21 +11305,21 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11305
11305
 
11306
11306
  pointer-events: none;
11307
11307
  }
11308
- `;var Vu=o=>o==="partially-correct"?"candidate-partial":`candidate-${o}`,Yg=["candidate-correct","candidate-incorrect","candidate-partial"],sl=o=>o?`correction ${Vu(o)} correction-${o}`:"correction",al=(o,t)=>{for(let e of Yg)z(o,e,!1);t&&z(o,Vu(t),!0)},_t=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(r){if(this.#t===r)return;let i=this.#t;this.#t=r,al(this.internals.states,r),this.requestUpdate("candidateCorrection",i)}get correctionPart(){return sl(this.#t)}}return t};var Jg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},K=o=>{class t extends ol(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return sl(this._candidateCorrection)}toggleCandidateCorrection(r){this.showCandidateCorrection!==r&&(this.showCandidateCorrection=r),super.toggleCandidateCorrection(r);let i=this._internals,n=null;r&&(this.correctness===Z.Correct&&(n="correct"),this.correctness===Z.PartiallyCorrect&&(n="partially-correct"),this.correctness===Z.Incorrect&&(n="incorrect")),al(i.states,n),this._candidateCorrection!==n&&(this._candidateCorrection=n)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return Jg([I()],t.prototype,"_candidateCorrection",void 0),t};var _r=o=>{class t extends K(o){toggleInternalCorrectResponse(r){super.toggleInternalCorrectResponse(r);let i=this.correctResponse,n=i?Array.isArray(i)?i:[i]:[];for(let s of this._choiceElements){let a=r&&n.includes(s.identifier);z(s.internals.states,"answer-key",a,["correct-response"])}}toggleCandidateCorrection(r){super.toggleCandidateCorrection(r);for(let s of this._choiceElements)s.candidateCorrection=null;if(!r||!this.correctResponse)return;let i=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],n=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)n.includes(s.identifier)&&(s.candidateCorrection=i.includes(s.identifier)?"correct":"incorrect")}}return t};var cl=class extends _t(ze){static{this.styles=[ze.styles,st]}render(){return v`<div part="control"></div>
11308
+ `;var Yu=o=>o==="partially-correct"?"candidate-partial":`candidate-${o}`,db=["candidate-correct","candidate-incorrect","candidate-partial"],hl=o=>o?`correction ${Yu(o)} correction-${o}`:"correction",pl=(o,t)=>{for(let e of db)z(o,e,!1);t&&z(o,Yu(t),!0)},Rt=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(r){if(this.#t===r)return;let i=this.#t;this.#t=r,pl(this.internals.states,r),this.requestUpdate("candidateCorrection",i)}get correctionPart(){return hl(this.#t)}}return t};var hb=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},K=o=>{class t extends dl(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return hl(this._candidateCorrection)}toggleCandidateCorrection(r){this.showCandidateCorrection!==r&&(this.showCandidateCorrection=r),super.toggleCandidateCorrection(r);let i=this._internals,n=null;r&&(this.correctness===Z.Correct&&(n="correct"),this.correctness===Z.PartiallyCorrect&&(n="partially-correct"),this.correctness===Z.Incorrect&&(n="incorrect")),pl(i.states,n),this._candidateCorrection!==n&&(this._candidateCorrection=n)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return hb([T()],t.prototype,"_candidateCorrection",void 0),t};var Mr=o=>{class t extends K(o){toggleInternalCorrectResponse(r){super.toggleInternalCorrectResponse(r);let i=this.correctResponse,n=i?Array.isArray(i)?i:[i]:[];for(let s of this._choiceElements){let a=r&&n.includes(s.identifier);z(s.internals.states,"answer-key",a,["correct-response"])}}toggleCandidateCorrection(r){super.toggleCandidateCorrection(r);for(let s of this._choiceElements)s.candidateCorrection=null;if(!r||!this.correctResponse)return;let i=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],n=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)n.includes(s.identifier)&&(s.candidateCorrection=i.includes(s.identifier)?"correct":"incorrect")}}return t};var ul=class extends Rt(Be){static{this.styles=[Be.styles,st]}render(){return v`<div part="control"></div>
11309
11309
  <slot part="label"></slot>
11310
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Kg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ta=class extends _t(gr){constructor(){super(...arguments),this.orderCorrect=null}updated(t){super.updated(t),t.has("orderCorrect")&&(this.orderCorrect==null?this.removeAttribute("data-order-correct"):this.setAttribute("data-order-correct",String(this.orderCorrect)))}};Kg([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],Ta.prototype,"orderCorrect",void 0);var ll=class extends _t(br){static{this.styles=[br.styles,st]}render(){return v`<div part="control"><div part="control-mark"></div></div>
11310
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var pb=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},_a=class extends Rt(vr){constructor(){super(...arguments),this.orderCorrect=null}updated(t){super.updated(t),t.has("orderCorrect")&&(this.orderCorrect==null?this.removeAttribute("data-order-correct"):this.setAttribute("data-order-correct",String(this.orderCorrect)))}};pb([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],_a.prototype,"orderCorrect",void 0);var ml=class extends Rt(yr){static{this.styles=[yr.styles,st]}render(){return v`<div part="control"><div part="control-mark"></div></div>
11311
11311
  <slot part="label"></slot>
11312
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var dl=class extends _t(Vt){static{this.styles=[Vt.styles,st]}render(){return v`
11312
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var fl=class extends Rt(Vt){static{this.styles=[Vt.styles,st]}render(){return v`
11313
11313
  <div part="control"></div>
11314
11314
  <slot part="label"></slot>
11315
11315
  <span part=${this.correctionPart} aria-hidden="true"></span>
11316
11316
  <div part="drop">
11317
11317
  ${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
11318
11318
  </div>
11319
- `}};var hl=class extends _t(jt){static{this.styles=[jt.styles,st]}render(){return v`<div part="control"><div part="control-mark"></div></div>
11319
+ `}};var gl=class extends Rt(jt){static{this.styles=[jt.styles,st]}render(){return v`<div part="control"><div part="control-mark"></div></div>
11320
11320
  ${this.marker?v`<div id="label" part="marker">${this.marker}</div>`:P}
11321
11321
  <slot part="label"></slot>
11322
- <span part=${this.correctionPart} aria-hidden="true"></span>`}};var ju=class extends mt{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let r=this.getRootNode();for(;;){if(r.querySelectorAll(t).forEach(i=>i.shown=e),!(r instanceof ShadowRoot))return;r=r.host.getRootNode()}}};var Fu=class extends ve{#t=t=>{let e=t.detail;this.assessmentItem?.showCorrectResponse?.(e),this.updateControlState("item-show-correct-response",e)};#e=t=>{let e=t.detail;this.assessmentItem?.showCandidateCorrection?.(e),this.updateControlState("item-show-candidate-correction",e)};#r=t=>{this.assessmentItem?.showCorrectResponse?.(!1),this.configContext={...this.configContext,correctResponseMode:t.detail}};updateAssessmentItemView(t,e){t?.showCorrectResponse?.(e==="scorer"),this.updateControlState("item-show-correct-response",e==="scorer")}constructor(){super(),this.addEventListener("item-show-correct-response",this.#t),this.addEventListener("item-show-candidate-correction",this.#e),this.addEventListener("item-switch-correct-response-mode",this.#r)}updateControlState(t,e){this.querySelectorAll(t).forEach(r=>r.shown=e)}disconnectedCallback(){this.removeEventListener("item-show-correct-response",this.#t),this.removeEventListener("item-show-candidate-correction",this.#e),this.removeEventListener("item-switch-correct-response-mode",this.#r),super.disconnectedCallback()}};var zu=class extends lt{#t=t=>{this.activeAssessmentItem?.showCorrectResponse?.(t.detail)};#e=t=>{this.activeAssessmentItem?.showCandidateCorrection?.(t.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#t),this.addEventListener("test-show-candidate-correction",this.#e)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#t),this.removeEventListener("test-show-candidate-correction",this.#e),super.disconnectedCallback()}afterAttemptEnded(t,e,r){if(!t||!e?.sessionControl?.showSolution)return;let i=t;i.showCandidateCorrection?.(!0),i.showCorrectResponse?.(r)}},Bu=class extends $e{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}};var pl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},jn=class extends C{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return v`
11322
+ <span part=${this.correctionPart} aria-hidden="true"></span>`}};var Ju=class extends mt{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let r=this.getRootNode();for(;;){if(r.querySelectorAll(t).forEach(i=>i.shown=e),!(r instanceof ShadowRoot))return;r=r.host.getRootNode()}}};var Ku=class extends ye{#t=t=>{let e=t.detail;this.assessmentItem?.showCorrectResponse?.(e),this.updateControlState("item-show-correct-response",e)};#e=t=>{let e=t.detail;this.assessmentItem?.showCandidateCorrection?.(e),this.updateControlState("item-show-candidate-correction",e)};#r=t=>{this.assessmentItem?.showCorrectResponse?.(!1),this.configContext={...this.configContext,correctResponseMode:t.detail}};updateAssessmentItemView(t,e){t?.showCorrectResponse?.(e==="scorer"),this.updateControlState("item-show-correct-response",e==="scorer")}constructor(){super(),this.addEventListener("item-show-correct-response",this.#t),this.addEventListener("item-show-candidate-correction",this.#e),this.addEventListener("item-switch-correct-response-mode",this.#r)}updateControlState(t,e){this.querySelectorAll(t).forEach(r=>r.shown=e)}disconnectedCallback(){this.removeEventListener("item-show-correct-response",this.#t),this.removeEventListener("item-show-candidate-correction",this.#e),this.removeEventListener("item-switch-correct-response-mode",this.#r),super.disconnectedCallback()}};var Zu=class extends lt{#t=t=>{this.activeAssessmentItem?.showCorrectResponse?.(t.detail)};#e=t=>{this.activeAssessmentItem?.showCandidateCorrection?.(t.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#t),this.addEventListener("test-show-candidate-correction",this.#e)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#t),this.removeEventListener("test-show-candidate-correction",this.#e),super.disconnectedCallback()}afterAttemptEnded(t,e,r){if(!t||!e?.sessionControl?.showSolution)return;let i=t;i.showCandidateCorrection?.(!0),i.showCorrectResponse?.(r)}},tm=class extends Ne{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}};var bl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},zn=class extends C{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return v`
11323
11323
  <label part="label" for="modeSelect">${this.label}</label>
11324
11324
  <select
11325
11325
  part="select"
@@ -11330,12 +11330,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11330
11330
  ${this._options[t]}
11331
11331
  </option>`)}
11332
11332
  </select>
11333
- `}};pl([_({context:yt,subscribe:!0})],jn.prototype,"itemContext",void 0);pl([p({type:String})],jn.prototype,"label",void 0);pl([I()],jn.prototype,"_options",void 0);var yi=w`
11333
+ `}};bl([R({context:yt,subscribe:!0})],zn.prototype,"itemContext",void 0);bl([p({type:String})],zn.prototype,"label",void 0);bl([T()],zn.prototype,"_options",void 0);var wi=x`
11334
11334
  display: inline-flex;
11335
11335
  cursor: pointer;
11336
11336
  border-radius: 0.25rem;
11337
11337
  user-select: none;
11338
- `,Uu=w`
11338
+ `,em=x`
11339
11339
  display: flex;
11340
11340
  flex: 1 1 auto;
11341
11341
  align-items: center;
@@ -11343,50 +11343,50 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11343
11343
  padding: 0.5rem 1rem;
11344
11344
  border-radius: 0.25rem;
11345
11345
  user-select: none;
11346
- `,qi=w`
11346
+ `,xi=x`
11347
11347
  background-color: lightgray;
11348
- ${Uu};
11349
- `,xi=w`
11348
+ ${em};
11349
+ `,Ci=x`
11350
11350
  cursor: not-allowed;
11351
11351
  opacity: 0.8;
11352
- `,cU=w`
11353
- ${Uu};
11352
+ `,RU=x`
11353
+ ${em};
11354
11354
  border: 1px solid gray;
11355
- `;var wi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ke=class extends C{static{this.styles=w`
11355
+ `;var ki=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ze=class extends C{static{this.styles=x`
11356
11356
  :host {
11357
- ${yi};
11357
+ ${wi};
11358
11358
  }
11359
11359
  div {
11360
- ${qi};
11360
+ ${xi};
11361
11361
  }
11362
11362
  :host([disabled]) {
11363
- ${xi};
11363
+ ${Ci};
11364
11364
  }
11365
- `}#t;#e;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCandidateCorrectionText="Show candidate correction",this.hideCandidateCorrectionText="Hide candidate correction",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCandidateCorrectionText:this.showCandidateCorrectionText}render(){return v` <div @click="${this.#r}">${this.#i()}</div> `}};wi([_({context:Ee,subscribe:!0})],Ke.prototype,"computedContext",void 0);wi([p({type:Boolean,reflect:!0})],Ke.prototype,"shown",void 0);wi([p({type:Boolean,reflect:!0})],Ke.prototype,"disabled",void 0);wi([p({type:String})],Ke.prototype,"showCandidateCorrectionText",void 0);wi([p({type:String})],Ke.prototype,"hideCandidateCorrectionText",void 0);wi([p({type:String})],Ke.prototype,"noCorrectResponseText",void 0);var Ci=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ze=class extends C{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}static{this.styles=w`
11365
+ `}#t;#e;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCandidateCorrectionText="Show candidate correction",this.hideCandidateCorrectionText="Hide candidate correction",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCandidateCorrectionText:this.showCandidateCorrectionText}render(){return v` <div @click="${this.#r}">${this.#i()}</div> `}};ki([R({context:Se,subscribe:!0})],Ze.prototype,"computedContext",void 0);ki([p({type:Boolean,reflect:!0})],Ze.prototype,"shown",void 0);ki([p({type:Boolean,reflect:!0})],Ze.prototype,"disabled",void 0);ki([p({type:String})],Ze.prototype,"showCandidateCorrectionText",void 0);ki([p({type:String})],Ze.prototype,"hideCandidateCorrectionText",void 0);ki([p({type:String})],Ze.prototype,"noCorrectResponseText",void 0);var Ei=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},tr=class extends C{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}static{this.styles=x`
11366
11366
  :host {
11367
- ${yi};
11367
+ ${wi};
11368
11368
  }
11369
11369
  div {
11370
- ${qi};
11370
+ ${xi};
11371
11371
  }
11372
11372
  :host([disabled]) {
11373
- ${xi};
11373
+ ${Ci};
11374
11374
  }
11375
- `}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v` <div @click="${this.#r}">${this.#i()}</div> `}};Ci([_({context:Ee,subscribe:!0})],Ze.prototype,"computedContext",void 0);Ci([p({type:Boolean,reflect:!0})],Ze.prototype,"shown",void 0);Ci([p({type:Boolean,reflect:!0})],Ze.prototype,"disabled",void 0);Ci([p({type:String})],Ze.prototype,"showCorrectText",void 0);Ci([p({type:String})],Ze.prototype,"hideCorrectText",void 0);Ci([p({type:String})],Ze.prototype,"noCorrectResponseText",void 0);var ki=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},tr=class extends C{static{this.styles=w`
11375
+ `}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v` <div @click="${this.#r}">${this.#i()}</div> `}};Ei([R({context:Se,subscribe:!0})],tr.prototype,"computedContext",void 0);Ei([p({type:Boolean,reflect:!0})],tr.prototype,"shown",void 0);Ei([p({type:Boolean,reflect:!0})],tr.prototype,"disabled",void 0);Ei([p({type:String})],tr.prototype,"showCorrectText",void 0);Ei([p({type:String})],tr.prototype,"hideCorrectText",void 0);Ei([p({type:String})],tr.prototype,"noCorrectResponseText",void 0);var Si=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},er=class extends C{static{this.styles=x`
11376
11376
  :host {
11377
- ${yi};
11377
+ ${wi};
11378
11378
  }
11379
11379
  div {
11380
- ${qi};
11380
+ ${xi};
11381
11381
  }
11382
11382
  :host(:focus-visible) {
11383
11383
  outline: 2px solid currentColor;
11384
11384
  outline-offset: 2px;
11385
11385
  }
11386
11386
  :host([disabled]) {
11387
- ${xi};
11387
+ ${Ci};
11388
11388
  }
11389
- `}#t;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=this.attachInternals(),this.#t.role="button",this.addEventListener("click",()=>this.#r()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#r())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=0)}#e;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(i=>i.items)).find(r=>r.active);if(this.#e!==e?.identifier&&(this.shown=!1,this.#e=e?.identifier),e){let r=!!e?.variables?.some(n=>n.correctResponse),i=!!e?.variables?.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!i}else this.disabled=!0;this.#t.ariaDisabled=String(this.disabled),this.#t.ariaPressed=String(this.shown)}#r(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v`<div part="button">${this.#i()}</div>`}};ki([_({context:ct,subscribe:!0})],tr.prototype,"computedContext",void 0);ki([p({type:Boolean,reflect:!0})],tr.prototype,"shown",void 0);ki([p({type:Boolean,reflect:!0})],tr.prototype,"disabled",void 0);ki([p({type:String})],tr.prototype,"showCorrectText",void 0);ki([p({type:String})],tr.prototype,"hideCorrectText",void 0);ki([p({type:String})],tr.prototype,"noCorrectResponseText",void 0);var ie=o=>{class t extends K(o){toggleInternalCorrectResponse(r){this.showFullCorrectResponse||this.toggleFullCorrectResponse(r)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var ml=class extends ie(xr){};var fl=class extends _r(wr){};var Zg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ia=class extends _t(X){static{this.styles=[X.styles,st,w`
11389
+ `}#t;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=this.attachInternals(),this.#t.role="button",this.addEventListener("click",()=>this.#r()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#r())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=0)}#e;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(i=>i.items)).find(r=>r.active);if(this.#e!==e?.identifier&&(this.shown=!1,this.#e=e?.identifier),e){let r=!!e?.variables?.some(n=>n.correctResponse),i=!!e?.variables?.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!i}else this.disabled=!0;this.#t.ariaDisabled=String(this.disabled),this.#t.ariaPressed=String(this.shown)}#r(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v`<div part="button">${this.#i()}</div>`}};Si([R({context:ct,subscribe:!0})],er.prototype,"computedContext",void 0);Si([p({type:Boolean,reflect:!0})],er.prototype,"shown",void 0);Si([p({type:Boolean,reflect:!0})],er.prototype,"disabled",void 0);Si([p({type:String})],er.prototype,"showCorrectText",void 0);Si([p({type:String})],er.prototype,"hideCorrectText",void 0);Si([p({type:String})],er.prototype,"noCorrectResponseText",void 0);var ne=o=>{class t extends K(o){toggleInternalCorrectResponse(r){this.showFullCorrectResponse||this.toggleFullCorrectResponse(r)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var yl=class extends ne(Cr){};var ql=class extends Mr(kr){};var ub=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ma=class extends Rt(X){static{this.styles=[X.styles,st,x`
11390
11390
  /*
11391
11391
  * Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
11392
11392
  * is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
@@ -11450,7 +11450,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11450
11450
  }
11451
11451
  `]}render(){return v`${this.renderPrompt()}${this.renderTextarea()}
11452
11452
  <span part=${this.correctionPart} aria-hidden="true"></span>
11453
- ${this.renderValidationMessage()}`}};Zg([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],Ia.prototype,"candidateCorrection",void 0);var _a=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[r,i]=e.split(" ");return{source:r,target:i}}):[];var gl=class extends ie(oi){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=_a(this.correctResponse);for(let r of this.querySelectorAll("qti-gap")){let i=r.getAttribute("identifier"),n=r.drags;for(let s of n)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===i)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var bl=class extends K(bt){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",r)}renderSupplementalLines(){return H(this.#t,t=>t,t=>Vi`
11453
+ ${this.renderValidationMessage()}`}};ub([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],Ma.prototype,"candidateCorrection",void 0);var Pa=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[r,i]=e.split(" ");return{source:r,target:i}}):[];var wl=class extends ne(ai){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Pa(this.correctResponse);for(let r of this.querySelectorAll("qti-gap")){let i=r.getAttribute("identifier"),n=r.drags;for(let s of n)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===i)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var xl=class extends K(bt){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",r)}renderSupplementalLines(){return H(this.#t,t=>t,t=>Fi`
11454
11454
  <line
11455
11455
  part="line answer-key correct-line"
11456
11456
  x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
@@ -11461,7 +11461,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11461
11461
  stroke-width="3"
11462
11462
  stroke-dasharray="5,5"
11463
11463
  />
11464
- `)}};var vl=class extends ie(kr){};var yl=class extends K(Ge){resolvePinColor(t){let{internals:e}=t;return Hi(e.states,"candidate-incorrect")?"var(--qti-incorrect)":Hi(e.states,"candidate-correct")?"var(--qti-correct)":super.resolvePinColor(t)}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements){let n=r.indexOf(i.identifier);i.orderCorrect=t&&n>=0?n+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements)i.candidateCorrection=null,t&&i.order!=null&&(i.candidateCorrection=r[i.order-1]===i.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var ql=class extends _r(si){};var xl=class extends _r(ai){};var wl=class extends K(rt){static get styles(){return[rt.styles,st,w`
11464
+ `)}};var Cl=class extends ne(Sr){};var kl=class extends K(Ye){resolvePinColor(t){let{internals:e}=t;return Qi(e.states,"candidate-incorrect")?"var(--qti-incorrect)":Qi(e.states,"candidate-correct")?"var(--qti-correct)":super.resolvePinColor(t)}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements){let n=r.indexOf(i.identifier);i.orderCorrect=t&&n>=0?n+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements)i.candidateCorrection=null,t&&i.order!=null&&(i.candidateCorrection=r[i.order-1]===i.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var El=class extends Mr(ci){};var Sl=class extends Mr(li){};var Al=class extends K(rt){static get styles(){return[rt.styles,st,x`
11465
11465
  /*
11466
11466
  * Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
11467
11467
  * badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
@@ -11480,7 +11480,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11480
11480
  `]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return v`
11481
11481
  ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
11482
11482
  <span part=${this.correctionPart} aria-hidden="true"></span>
11483
- `}};var Cl=class extends ie(re){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=_a(this.correctResponse);this.#t=t?new Set(e.map(r=>`${r.source} ${r.target}`)):new Set;for(let r of this.targetChoices){let i=r.getAttribute("identifier"),n=r.drags;for(let s of n)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${i}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"candidate-correct correct":"candidate-incorrect incorrect"}};function tb(o){if(o.length===0)return new Set;let t=new Array(o.length).fill(1),e=new Array(o.length).fill(-1);for(let n=0;n<o.length;n++)for(let s=0;s<n;s++)o[s]<o[n]&&t[s]+1>t[n]&&(t[n]=t[s]+1,e[n]=s);let r=0;for(let n=1;n<o.length;n++)t[n]>t[r]&&(r=n);let i=new Set;for(let n=r;n!==-1;n=e[n])i.add(n);return i}function Hu(o,t){let e=new Map(t.map((a,c)=>[a,c])),r=o.filter(a=>e.has(a)),i=r.map(a=>e.get(a)),n=tb(i),s=new Set;return n.forEach(a=>s.add(r[a])),s}var kl=class extends ie(Ye){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let r=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(l=>this.chipsIn(l));for(let l of r)l.candidateCorrection=null;if(!t)return;let i=this.correctResponse,s=(i?Array.isArray(i)?i:[i]:[]).map((l,d)=>{let[h,f]=l.split(" "),m=f?.startsWith("droplist")?parseInt(f.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(m)?d:m}}).filter(l=>l.identifier).sort((l,d)=>l.dropIndex-d.dropIndex).map(l=>l.identifier);if(s.length===0)return;let a=r.map(l=>({choice:l,identifier:l.getAttribute("identifier")})).filter(l=>!!l.identifier),c=Hu(a.map(l=>l.identifier),s);for(let{choice:l,identifier:d}of a)l.candidateCorrection=c.has(d)?"correct":"incorrect"}};var El=class extends K(G){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,r=e?.correctResponse??this.correctResponse;this.correctResponse=t?r:e?.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${i}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let n=document.createElement("div");n.id=i,n.className="pci-correct-response-container",Object.assign(n.style,{position:"relative",marginTop:"20px",border:"2px solid green",padding:"16px",borderRadius:"4px",backgroundColor:"rgba(0, 128, 0, 0.05)"});let s=document.createElement("div");s.textContent="Correct Response:",Object.assign(s.style,{fontWeight:"bold",marginBottom:"10px",color:"green"}),n.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let c=this.responseIdentifier;a.responseIdentifier=`${c}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let l=this.correctResponse,d=e?.cardinality??(Array.isArray(l)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:l}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(l,d,h);a.sendMessageToIframe("setBoundTo",{[c]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",n.append(a),this.after(n)}};var Sl=class extends K(dt){#t=[];#e=[];static{this.styles=[dt.styles,w`
11483
+ `}};var Il=class extends ne(ie){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Pa(this.correctResponse);this.#t=t?new Set(e.map(r=>`${r.source} ${r.target}`)):new Set;for(let r of this.targetChoices){let i=r.getAttribute("identifier"),n=r.drags;for(let s of n)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${i}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"candidate-correct correct":"candidate-incorrect incorrect"}};function mb(o){if(o.length===0)return new Set;let t=new Array(o.length).fill(1),e=new Array(o.length).fill(-1);for(let n=0;n<o.length;n++)for(let s=0;s<n;s++)o[s]<o[n]&&t[s]+1>t[n]&&(t[n]=t[s]+1,e[n]=s);let r=0;for(let n=1;n<o.length;n++)t[n]>t[r]&&(r=n);let i=new Set;for(let n=r;n!==-1;n=e[n])i.add(n);return i}function rm(o,t){let e=new Map(t.map((a,c)=>[a,c])),r=o.filter(a=>e.has(a)),i=r.map(a=>e.get(a)),n=mb(i),s=new Set;return n.forEach(a=>s.add(r[a])),s}var Tl=class extends ne(Je){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let r=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(l=>this.chipsIn(l));for(let l of r)l.candidateCorrection=null;if(!t)return;let i=this.correctResponse,s=(i?Array.isArray(i)?i:[i]:[]).map((l,d)=>{let[h,f]=l.split(" "),m=f?.startsWith("droplist")?parseInt(f.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(m)?d:m}}).filter(l=>l.identifier).sort((l,d)=>l.dropIndex-d.dropIndex).map(l=>l.identifier);if(s.length===0)return;let a=r.map(l=>({choice:l,identifier:l.getAttribute("identifier")})).filter(l=>!!l.identifier),c=rm(a.map(l=>l.identifier),s);for(let{choice:l,identifier:d}of a)l.candidateCorrection=c.has(d)?"correct":"incorrect"}};var Rl=class extends K(G){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,r=e?.correctResponse??this.correctResponse;this.correctResponse=t?r:e?.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${i}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let n=document.createElement("div");n.id=i,n.className="pci-correct-response-container",Object.assign(n.style,{position:"relative",marginTop:"20px",border:"2px solid green",padding:"16px",borderRadius:"4px",backgroundColor:"rgba(0, 128, 0, 0.05)"});let s=document.createElement("div");s.textContent="Correct Response:",Object.assign(s.style,{fontWeight:"bold",marginBottom:"10px",color:"green"}),n.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let c=this.responseIdentifier;a.responseIdentifier=`${c}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let l=this.correctResponse,d=e?.cardinality??(Array.isArray(l)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:l}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(l,d,h);a.sendMessageToIframe("setBoundTo",{[c]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",n.append(a),this.after(n)}};var _l=class extends K(dt){#t=[];#e=[];static{this.styles=[dt.styles,x`
11484
11484
  [part~='candidate-correct'] {
11485
11485
  --qti-select-point-marker-color: var(--qti-correct);
11486
11486
  }
@@ -11488,12 +11488,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11488
11488
  --qti-select-point-marker-color: var(--qti-incorrect);
11489
11489
  }
11490
11490
  `]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let r=this._effectiveAreaEntries,i=this.responseVariable?.baseType,n=this.correctResponse;for(let s of this.responsePoints){let a=r.some(c=>J.isPointInArea(`${s.x} ${s.y}`,`${c.shape},${c.coords}`,i));!r.length&&n&&(a=(Array.isArray(n)?n:[n]).some(l=>{let[d,h]=l.split(" ").map(Number);return Number.isFinite(d)&&Number.isFinite(h)&&Math.hypot(s.x-d,s.y-h)<=10})),this.#e.push(a)}this.requestUpdate("responseCorrection",e)}toggleInternalCorrectResponse(t){if(super.toggleInternalCorrectResponse(t),!t){let i=this.#t;this.#t=[],this.requestUpdate("correctAreas",i);return}let e=this._effectiveAreaEntries;if(!e.length){let i=this.correctResponse,n=i?Array.isArray(i)?i:[i]:[];if(n.some(s=>s.split(" ").length<2)){console.error("No valid correct responses found.");return}e=n.map(s=>({shape:"circle",coords:`${s.split(" ").join(",")},10`,defaultValue:1,mappedValue:1}))}let r=this.#t;this.#t=e.map(i=>({shape:i.shape,coords:i.coords})),this.requestUpdate("correctAreas",r)}pointPart(t,e){let r=this.#e[e];return r===void 0?"point":r?"point candidate-correct correct":"point candidate-incorrect incorrect"}renderSupplementalLayer(){return H(this.#t,t=>`${t.shape}:${t.coords}`,(t,e)=>v`<div
11491
- style=${Er({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
11491
+ style=${Ar({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
11492
11492
  data-correction-area
11493
11493
  data-coord=${t.coords}
11494
11494
  data-shape=${t.shape}
11495
11495
  alt=${`correct-response-${e+1}`}
11496
- ></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var Al=class extends K(Tt){#t=null;static{this.styles=[Tt.styles,w`
11496
+ ></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var Ml=class extends K(It){#t=null;static{this.styles=[It.styles,x`
11497
11497
  [part~='knob'][part~='answer-key'] {
11498
11498
  background-color: var(--qti-correct-light);
11499
11499
  border: 2px solid var(--qti-correct);
@@ -11508,7 +11508,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11508
11508
  }
11509
11509
  `]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=Array.isArray(e)?e[0]:e,i=t&&r?parseFloat(r):NaN,n=this.#t;if(this.#t=Number.isFinite(i)?i:null,this.#t!==null){let s=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}else this.style.removeProperty("--value-percentage-correct");this.requestUpdate("correctResponseNumber",n)}renderRailSupplement(){return this.#t===null?P:v`<div id="knob-correct" part="knob answer-key knob-correct">
11510
11510
  <div id="value" part="value">${this.#t}</div>
11511
- </div>`}};var Tl=class extends K(ht){static{this.styles=[ht.styles,st,w`
11511
+ </div>`}};var Pl=class extends K(ht){static{this.styles=[ht.styles,st,x`
11512
11512
  /*
11513
11513
  * The trailing inset only — size and leading gap come from the shared sheet.
11514
11514
  *
@@ -11532,7 +11532,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
11532
11532
  ${this.renderAnswer()} ${this.renderInput()}
11533
11533
  <span part=${this.correctionPart} aria-hidden="true"></span>
11534
11534
  ${this.renderValidationMessage()}
11535
- `}};export{K as CandidateCorrectionMixin,_r as ChoiceCorrectionMixin,ol as CorrectResponseMixin,Z as Correctness,rc as CustomStateSetShim,ic as INITIAL_SESSION_CONTEXT,nc as INITIAL_TEST_CONTEXT,D as Interaction,ac as IsNullOrUndefined,Lt as ItemContainer,jn as ItemCorrectResponseMode,mn as ItemPrintVariables,Ke as ItemShowCandidateCorrection,Ze as ItemShowCorrectResponse,Kh as ItemViewMixin,Ed as PUBLIC_ITEM_EVENTS,pn as QTI_TEST_STATE_VERSION,Ps as QtiAnd,li as QtiAnyN,mt as QtiAssessmentItem,ju as QtiAssessmentItemCorrection,wt as QtiAssessmentItemRef,Yt as QtiAssessmentSection,bo as QtiAssessmentStimulus,Gr as QtiAssessmentStimulusRef,kc as QtiAssessmentStimulusRefConnectedEvent,cr as QtiAssessmentTest,ei as QtiAssociableHotspot,xr as QtiAssociateInteraction,ml as QtiAssociateInteractionCorrection,An as QtiBaseValue,he as QtiBranchRule,wr as QtiChoiceInteraction,fl as QtiChoiceInteractionCorrection,wo as QtiCompanionMaterialsInfo,Xt as QtiConditionExpression,Os as QtiContainerSize,Ds as QtiContains,en as QtiContentBody,Yr as QtiContextDeclaration,$s as QtiCorrect,ye as QtiCustomInteraction,rn as QtiCustomOperator,Tr as QtiDefault,Ns as QtiDelete,Ls as QtiDivide,Vs as QtiDurationGte,js as QtiDurationLt,qe as QtiEndAttemptInteraction,di as QtiEqual,Tn as QtiEqualRounded,Fs as QtiExitResponse,Nr as QtiExitResponseSignal,zs as QtiExitTest,Lr as QtiExitTestSignal,E as QtiExpression,X as QtiExtendedTextInteraction,Ia as QtiExtendedTextInteractionCorrection,ut as QtiFeedback,Co as QtiFeedbackBlock,ko as QtiFeedbackInline,Bs as QtiFieldValue,mr as QtiGap,fn as QtiGapImg,oi as QtiGapMatchInteraction,gl as QtiGapMatchInteractionCorrection,ze as QtiGapText,cl as QtiGapTextCorrection,Us as QtiGcd,bt as QtiGraphicAssociateInteraction,bl as QtiGraphicAssociateInteractionCorrection,kr as QtiGraphicGapMatchInteraction,vl as QtiGraphicGapMatchInteractionCorrection,Ge as QtiGraphicOrderInteraction,yl as QtiGraphicOrderInteractionCorrection,Hs as QtiGt,Ws as QtiGte,gr as QtiHotspotChoice,Ta as QtiHotspotChoiceCorrection,si as QtiHotspotInteraction,ql as QtiHotspotInteractionCorrection,br as QtiHottext,ll as QtiHottextCorrection,ai as QtiHottextInteraction,xl as QtiHottextInteractionCorrection,In as QtiIndex,gn as QtiInlineChoice,rt as QtiInlineChoiceInteraction,wl as QtiInlineChoiceInteractionCorrection,hi as QtiInside,Qs as QtiIntegerDivide,Xs as QtiIntegerModulus,Gs as QtiIntegerToFloat,Ys as QtiIsNull,ve as QtiItem,Eo as QtiItemBody,Fu as QtiItemCorrection,Pt as QtiItemSessionControl,Js as QtiLcm,pi as QtiLookupOutcomeValue,Ks as QtiLt,Zs as QtiLte,Rn as QtiMapResponse,_n as QtiMapResponsePoint,ta as QtiMatch,re as QtiMatchInteraction,Cl as QtiMatchInteractionCorrection,Mn as QtiMathConstant,Pn as QtiMathOperator,ea as QtiMax,ys as QtiMediaInteraction,ra as QtiMember,ia as QtiMin,Jr as QtiModalFeedback,na as QtiMultiple,oa as QtiNot,sa as QtiNull,Gi as QtiNumberPresented,mo as QtiNumberSelected,aa as QtiOr,Ye as QtiOrderInteraction,kl as QtiOrderInteractionCorrection,ca as QtiOrdered,da as QtiOutcomeCondition,me as QtiOutcomeDeclaration,pa as QtiOutcomeElse,ha as QtiOutcomeElseIf,gi as QtiOutcomeIf,go as QtiOutcomeProcessing,fc as QtiOutcomeProcessingProcessor,On as QtiPatternMatch,G as QtiPortableCustomInteraction,El as QtiPortableCustomInteractionCorrection,At as QtiPositionObjectInteraction,Ss as QtiPositionObjectStage,ua as QtiPower,fo as QtiPreCondition,vt as QtiPrintedVariable,ma as QtiProduct,Wo as QtiPrompt,fa as QtiRandom,Ir as QtiRandomInteger,$n as QtiRepeat,ga as QtiResponseCondition,Re as QtiResponseDeclaration,va as QtiResponseElse,ba as QtiResponseElseIf,bi as QtiResponseIf,Ao as QtiResponseProcessing,ya as QtiResponseProcessingFragment,qa as QtiRound,vi as QtiRoundTo,fe as QtiRubricBlock,xd as QtiRuleElement,dt as QtiSelectPointInteraction,Sl as QtiSelectPointInteractionCorrection,xa as QtiSetCorrectResponse,el as QtiSetCorrectResponseRule,wa as QtiSetOutcomeValue,rl as QtiSetOutcomeValueRule,Ca as QtiSetTemplateValue,il as QtiSetTemplateValueRule,Vt as QtiSimpleAssociableChoice,dl as QtiSimpleAssociableChoiceCorrection,jt as QtiSimpleChoice,hl as QtiSimpleChoiceCorrection,Tt as QtiSliderInteraction,Al as QtiSliderInteractionCorrection,Nn as QtiStatsOperator,Ln as QtiStringMatch,_o as QtiStylesheet,Vn as QtiSubstring,ka as QtiSubtract,Ea as QtiSum,nl as QtiSumExpression,Ro as QtiTemplateConstraint,ge as QtiTemplateDeclaration,Mo as QtiTemplateProcessing,$e as QtiTest,Bu as QtiTestCorrection,cn as QtiTestFeedback,De as QtiTestPart,ln as QtiTestVariables,Sc as QtiTestVariablesExpression,ht as QtiTextEntryInteraction,Tl as QtiTextEntryInteractionCorrection,Sa as QtiTruncate,Rs as QtiUploadInteraction,Aa as QtiVariable,$r as QtiVariableDeclaration,vd as STATE_ALIASES,J as ScoringHelper,kt as TestContainer,be as TestEndAttempt,lt as TestNavigation,zu as TestNavigationCorrection,hr as TestNext,pr as TestPrev,tr as TestShowCorrectResponse,Ho as TestSubmit,Ry as asSeed,R as boxSizing,Tm as classifyCustomStateSupport,ct as computedContext,Ee as computedItemContext,yt as configContext,Mt as convertNumberToUniversalFormat,st as correctionPart,cq as decimalSeparator,dc as dispatchDeclared,xt as dispatchPublic,Qt as dropRegion,wd as getCustomOperator,$2 as getItemByUri,D2 as getManifestInfo,Hi as hasState,po as inferRecordFieldBaseType,Sg as inlineScriptText,Ag as inlineStyleText,gd as installCustomStateSetFallback,Or as interactionContext,de as isRecordValue,_m as isSeed,F as itemContext,bd as itemContextVariables,Uo as itemsInOrder,bq as iterResponseValues,hc as listenDeclared,Sd as listenPublic,vq as parsePair,qq as parsePoint,Qi as parseResponseAttribute,Yh as pluginElements,$A as pluginState,Mg as qtiAndMixin,qt as qtiContext,Iu as qtiInteractionElements,Gg as qtiSubtractMixin,Jt as qtiTransformItem,Kd as qtiTransformManifest,Xr as qtiTransformTest,Xi as readRecordFieldValues,Sq as registerCustomOperator,ho as removeDoubleSlashes,Gt as responseAttributeConverter,yq as serializePair,xq as serializePoint,ar as serializeResponseAttribute,lo as sessionContext,z as setState,$h as stateFromContexts,nt as testContext,Aq as unregisterCustomOperator,U as validationMessage};
11535
+ `}};export{K as CandidateCorrectionMixin,Mr as ChoiceCorrectionMixin,dl as CorrectResponseMixin,Z as Correctness,oc as CustomStateSetShim,sc as INITIAL_SESSION_CONTEXT,ac as INITIAL_TEST_CONTEXT,D as Interaction,dc as IsNullOrUndefined,Lt as ItemContainer,zn as ItemCorrectResponseMode,gn as ItemPrintVariables,Ze as ItemShowCandidateCorrection,tr as ItemShowCorrectResponse,lp as ItemViewMixin,Rd as PUBLIC_ITEM_EVENTS,mn as QTI_TEST_STATE_VERSION,$s as QtiAnd,hi as QtiAnyN,mt as QtiAssessmentItem,Ju as QtiAssessmentItemCorrection,xt as QtiAssessmentItemRef,Yt as QtiAssessmentSection,yo as QtiAssessmentStimulus,Jr as QtiAssessmentStimulusRef,Ic as QtiAssessmentStimulusRefConnectedEvent,lr as QtiAssessmentTest,ii as QtiAssociableHotspot,Cr as QtiAssociateInteraction,yl as QtiAssociateInteractionCorrection,Tn as QtiBaseValue,pe as QtiBranchRule,kr as QtiChoiceInteraction,ql as QtiChoiceInteractionCorrection,Eo as QtiCompanionMaterialsInfo,Xt as QtiConditionExpression,Ns as QtiContainerSize,Ls as QtiContains,nn as QtiContentBody,Kr as QtiContextDeclaration,Vs as QtiCorrect,qe as QtiCustomInteraction,on as QtiCustomOperator,Rr as QtiDefault,js as QtiDelete,Fs as QtiDivide,zs as QtiDurationGte,Bs as QtiDurationLt,we as QtiEndAttemptInteraction,pi as QtiEqual,Rn as QtiEqualRounded,Us as QtiExitResponse,Vr as QtiExitResponseSignal,Hs as QtiExitTest,jr as QtiExitTestSignal,E as QtiExpression,X as QtiExtendedTextInteraction,Ma as QtiExtendedTextInteractionCorrection,ut as QtiFeedback,So as QtiFeedbackBlock,Ao as QtiFeedbackInline,Ws as QtiFieldValue,gr as QtiGap,bn as QtiGapImg,ai as QtiGapMatchInteraction,wl as QtiGapMatchInteractionCorrection,Be as QtiGapText,ul as QtiGapTextCorrection,Qs as QtiGcd,bt as QtiGraphicAssociateInteraction,xl as QtiGraphicAssociateInteractionCorrection,Sr as QtiGraphicGapMatchInteraction,Cl as QtiGraphicGapMatchInteractionCorrection,Ye as QtiGraphicOrderInteraction,kl as QtiGraphicOrderInteractionCorrection,Xs as QtiGt,Gs as QtiGte,vr as QtiHotspotChoice,_a as QtiHotspotChoiceCorrection,ci as QtiHotspotInteraction,El as QtiHotspotInteractionCorrection,yr as QtiHottext,ml as QtiHottextCorrection,li as QtiHottextInteraction,Sl as QtiHottextInteractionCorrection,_n as QtiIndex,vn as QtiInlineChoice,rt as QtiInlineChoiceInteraction,Al as QtiInlineChoiceInteractionCorrection,ui as QtiInside,Ys as QtiIntegerDivide,Js as QtiIntegerModulus,Ks as QtiIntegerToFloat,Zs as QtiIsNull,ye as QtiItem,Io as QtiItemBody,Ku as QtiItemCorrection,Pt as QtiItemSessionControl,ta as QtiLcm,mi as QtiLookupOutcomeValue,ea as QtiLt,ra as QtiLte,Pn as QtiMapResponse,Mn as QtiMapResponsePoint,ia as QtiMatch,ie as QtiMatchInteraction,Il as QtiMatchInteractionCorrection,On as QtiMathConstant,Dn as QtiMathOperator,na as QtiMax,xs as QtiMediaInteraction,oa as QtiMember,sa as QtiMin,Zr as QtiModalFeedback,aa as QtiMultiple,ca as QtiNot,la as QtiNull,Ji as QtiNumberPresented,go as QtiNumberSelected,da as QtiOr,Je as QtiOrderInteraction,Tl as QtiOrderInteractionCorrection,ha as QtiOrdered,ua as QtiOutcomeCondition,fe as QtiOutcomeDeclaration,fa as QtiOutcomeElse,ma as QtiOutcomeElseIf,vi as QtiOutcomeIf,vo as QtiOutcomeProcessing,vc as QtiOutcomeProcessingProcessor,$n as QtiPatternMatch,G as QtiPortableCustomInteraction,Rl as QtiPortableCustomInteractionCorrection,At as QtiPositionObjectInteraction,Ts as QtiPositionObjectStage,ga as QtiPower,bo as QtiPreCondition,vt as QtiPrintedVariable,ba as QtiProduct,Go as QtiPrompt,va as QtiRandom,_r as QtiRandomInteger,Ln as QtiRepeat,ya as QtiResponseCondition,Me as QtiResponseDeclaration,wa as QtiResponseElse,qa as QtiResponseElseIf,yi as QtiResponseIf,Ro as QtiResponseProcessing,xa as QtiResponseProcessingFragment,Ca as QtiRound,qi as QtiRoundTo,ge as QtiRubricBlock,Sd as QtiRuleElement,dt as QtiSelectPointInteraction,_l as QtiSelectPointInteractionCorrection,ka as QtiSetCorrectResponse,sl as QtiSetCorrectResponseRule,Ea as QtiSetOutcomeValue,al as QtiSetOutcomeValueRule,Sa as QtiSetTemplateValue,cl as QtiSetTemplateValueRule,Vt as QtiSimpleAssociableChoice,fl as QtiSimpleAssociableChoiceCorrection,jt as QtiSimpleChoice,gl as QtiSimpleChoiceCorrection,It as QtiSliderInteraction,Ml as QtiSliderInteractionCorrection,Vn as QtiStatsOperator,jn as QtiStringMatch,Po as QtiStylesheet,Fn as QtiSubstring,Aa as QtiSubtract,Ia as QtiSum,ll as QtiSumExpression,Oo as QtiTemplateConstraint,be as QtiTemplateDeclaration,Do as QtiTemplateProcessing,Ne as QtiTest,tm as QtiTestCorrection,dn as QtiTestFeedback,$e as QtiTestPart,hn as QtiTestVariables,Rc as QtiTestVariablesExpression,ht as QtiTextEntryInteraction,Pl as QtiTextEntryInteractionCorrection,Ta as QtiTruncate,Os as QtiUploadInteraction,Ra as QtiVariable,Lr as QtiVariableDeclaration,Cd as STATE_ALIASES,J as ScoringHelper,kt as TestContainer,ve as TestEndAttempt,lt as TestNavigation,Zu as TestNavigationCorrection,ur as TestNext,mr as TestPrev,er as TestShowCorrectResponse,Xo as TestSubmit,Hy as asSeed,_ as boxSizing,Vm as classifyCustomStateSupport,ct as computedContext,Se as computedItemContext,yt as configContext,Mt as convertNumberToUniversalFormat,st as correctionPart,xq as decimalSeparator,uc as dispatchDeclared,wt as dispatchPublic,Qt as dropRegion,Ad as getCustomOperator,nL as getItemByUri,iL as getManifestInfo,Qi as hasState,mo as inferRecordFieldBaseType,jg as inlineScriptText,Fg as inlineStyleText,wd as installCustomStateSetFallback,$r as interactionContext,he as isRecordValue,Fm as isSeed,F as itemContext,xd as itemContextVariables,Qo as itemsInOrder,_q as iterResponseValues,mc as listenDeclared,_d as listenPublic,Mq as parsePair,Oq as parsePoint,Gi as parseResponseAttribute,ap as pluginElements,nI as pluginState,Wg as qtiAndMixin,qt as qtiContext,ju as qtiInteractionElements,lb as qtiSubtractMixin,Kt as qtiTransformItem,ah as qtiTransformManifest,Yr as qtiTransformTest,Yi as readRecordFieldValues,jq as registerCustomOperator,uo as removeDoubleSlashes,Gt as responseAttributeConverter,Pq as serializePair,Dq as serializePoint,cr as serializeResponseAttribute,po as sessionContext,z as setState,Hh as stateFromContexts,nt as testContext,Fq as unregisterCustomOperator,U as validationMessage};
11536
11536
  /*! Bundled license information:
11537
11537
 
11538
11538
  @lit-labs/ssr-dom-shim/lib/element-internals.js: