@citolab/qti-components 10.0.0-next.23 → 10.0.0-next.24
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.global.js +1 -1
- package/cdn/index.js +15 -15
- package/dist/{chunk-IJKHXJSM.js → chunk-2NHZOI3W.js} +14 -3
- package/dist/chunk-2NHZOI3W.js.map +1 -0
- package/dist/{chunk-ULJ22VKL.js → chunk-DU6RX3TX.js} +2 -2
- package/dist/{chunk-DJQE4M7B.js → chunk-FP3KXADH.js} +2 -2
- package/dist/{chunk-J6VX4N7M.js → chunk-HUM7ST4L.js} +3 -1
- package/dist/chunk-HUM7ST4L.js.map +1 -0
- package/dist/corrections.d.ts +1 -1
- package/dist/corrections.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/qti-components-jsx.d.ts +12 -0
- package/dist/{qti-test.d-CN2JZwAz.d.ts → qti-test.d-DADK63uc.d.ts} +6 -0
- package/dist/test-plugin-api.d.ts +14 -5
- package/dist/test-plugin-api.js +1 -1
- package/dist/test.d.ts +2 -2
- package/dist/test.js +3 -3
- package/package.json +3 -3
- package/dist/chunk-IJKHXJSM.js.map +0 -1
- package/dist/chunk-J6VX4N7M.js.map +0 -1
- /package/dist/{chunk-ULJ22VKL.js.map → chunk-DU6RX3TX.js.map} +0 -0
- /package/dist/{chunk-DJQE4M7B.js.map → chunk-FP3KXADH.js.map} +0 -0
package/cdn/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var bc=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){thi
|
|
|
2
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=bu(),this.__pendingWhenDefineds.set(t,r)),r.promise}},vu=Ln;var Ia=new vu,yu=new kc(_a);var Ei=globalThis,Vn=Ei.ShadowRoot&&(Ei.ShadyCSS===void 0||Ei.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ra=Symbol(),_c=new WeakMap,Si=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Ra)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(Vn&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=_c.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&_c.set(e,t))}return t}toString(){return this.cssText}},Tc=o=>new Si(typeof o=="string"?o:o+"",void 0,Ra),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 Si(e,o,Ra)},Ic=(o,t)=>{if(Vn)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Ei.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,o.appendChild(r)}},Ma=Vn||Ei.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Tc(e)})(o):o;var{is:qu,defineProperty:xu,getOwnPropertyDescriptor:wu,getOwnPropertyNames:Cu,getOwnPropertySymbols:ku,getPrototypeOf:Eu}=Object,Ti=globalThis;Ti.customElements??=Ia;var Rc=Ti.trustedTypes,Su=Rc?Rc.emptyScript:"",Au=Ti.reactiveElementPolyfillSupport,Ai=(o,t)=>o,_i={toAttribute(o,t){switch(t){case Boolean:o=o?Su: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}},jn=(o,t)=>!qu(o,t),Mc={attribute:!0,type:String,converter:_i,reflect:!1,useDefault:!1,hasChanged:jn};Symbol.metadata??=Symbol("metadata"),Ti.litPropertyMetadata??=new WeakMap;var se=class extends(globalThis.HTMLElement??Ta){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Mc){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&&xu(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:n}=wu(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)??Mc}static _$Ei(){if(this.hasOwnProperty(Ai("elementProperties")))return;let t=Eu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ai("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ai("properties"))){let e=this.properties,r=[...Cu(e),...ku(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(Ma(i))}else t!==void 0&&e.push(Ma(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 Ic(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:_i).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:_i;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??jn)(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){}};se.elementStyles=[],se.shadowRootOptions={mode:"open"},se[Ai("elementProperties")]=new Map,se[Ai("finalized")]=new Map,Au?.({ReactiveElement:se}),(Ti.reactiveElementVersions??=[]).push("2.1.2");var Qn=globalThis,Pc=o=>o,Fn=Qn.trustedTypes,Oc=Fn?Fn.createPolicy("lit-html",{createHTML:o=>o}):void 0,Oa="$lit$",ae=`lit$${Math.random().toFixed(9).slice(2)}$`,Da="?"+ae,_u=`<${Da}>`,er=Qn.document===void 0?{createTreeWalker:()=>({})}:document,Ri=()=>er.createComment(""),Mi=o=>o===null||typeof o!="object"&&typeof o!="function",$a=Array.isArray,jc=o=>$a(o)||typeof o?.[Symbol.iterator]=="function",Pa=`[
|
|
3
3
|
\f\r]`,Ii=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Dc=/-->/g,$c=/>/g,Ze=RegExp(`>|${Pa}(?:([^\\s"'>=/]+)(${Pa}*=${Pa}*(?:[^
|
|
4
4
|
\f\r"'\`<>=]|("|')|))|$)`,"g"),Nc=/'/g,Lc=/"/g,Fc=/^(?:script|style|textarea|title)$/i,Na=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=Na(1),Oi=Na(2),eb=Na(3),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Vc=new WeakMap,tr=er.createTreeWalker(er,129);function zc(o,t){if(!$a(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Oc!==void 0?Oc.createHTML(t):t}var Bc=(o,t)=>{let e=o.length-1,r=[],i,n=t===2?"<svg>":t===3?"<math>":"",s=Ii;for(let a=0;a<e;a++){let l=o[a],c,d,h=-1,f=0;for(;f<l.length&&(s.lastIndex=f,d=s.exec(l),d!==null);)f=s.lastIndex,s===Ii?d[1]==="!--"?s=Dc:d[1]!==void 0?s=$c:d[2]!==void 0?(Fc.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=Ze):d[3]!==void 0&&(s=Ze):s===Ze?d[0]===">"?(s=i??Ii,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Ze:d[3]==='"'?Lc:Nc):s===Lc||s===Nc?s=Ze:s===Dc||s===$c?s=Ii:(s=Ze,i=void 0);let m=s===Ze&&o[a+1].startsWith("/>")?" ":"";n+=s===Ii?l+_u:h>=0?(r.push(c),l.slice(0,h)+Oa+l.slice(h)+ae+m):l+ae+(h===-2?a:m)}return[zc(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Pi=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,s=0,a=t.length-1,l=this.parts,[c,d]=Bc(t,e);if(this.el=o.createElement(c,r),tr.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=tr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Oa)){let f=d[s++],m=i.getAttribute(h).split(ae),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?Bn:y[1]==="?"?Un:y[1]==="@"?Hn:ir}),i.removeAttribute(h)}else h.startsWith(ae)&&(l.push({type:6,index:n}),i.removeAttribute(h));if(Fc.test(i.tagName)){let h=i.textContent.split(ae),f=h.length-1;if(f>0){i.textContent=Fn?Fn.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],Ri()),tr.nextNode(),l.push({type:2,index:++n});i.append(h[f],Ri())}}}else if(i.nodeType===8)if(i.data===Da)l.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(ae,h+1))!==-1;)l.push({type:7,index:n}),h+=ae.length-1}n++}}static createElement(t,e){let r=er.createElement("template");return r.innerHTML=t,r}};function rr(o,t,e=o,r){if(t===it)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,n=Mi(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=rr(o,i._$AS(o,t.values),i,r)),t}var zn=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??er).importNode(e,!0);tr.currentNode=i;let n=tr.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Tr(n,n.nextSibling,this,t):l.type===1?c=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(c=new Wn(n,this,t)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(n=tr.nextNode(),s++)}return tr.currentNode=er,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++}},Tr=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=rr(this,t,e),Mi(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):jc(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&&Mi(this._$AH)?this._$AA.nextSibling.data=t:this.T(er.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=Pi.createElement(zc(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new zn(i,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(t){let e=Vc.get(t.strings);return e===void 0&&Vc.set(t.strings,e=new Pi(t)),e}k(t){$a(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(Ri()),this.O(Ri()),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=Pc(t).nextSibling;Pc(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ir=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=rr(this,t,e,0),s=!Mi(t)||t!==this._$AH&&t!==it,s&&(this._$AH=t);else{let a=t,l,c;for(t=n[0],l=0;l<n.length-1;l++)c=rr(this,a[r+l],e,l),c===it&&(c=this._$AH[l]),s||=!Mi(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+n[l+1]),this._$AH[l]=c}s&&!i&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Bn=class extends ir{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Un=class extends ir{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Hn=class extends ir{constructor(t,e,r,i,n){super(t,e,r,i,n),this.type=5}_$AI(t,e=this){if((t=rr(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)}},Wn=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){rr(this,t)}},et={M:Oa,P:ae,A:Da,C:1,L:Bc,R:zn,D:jc,V:rr,I:Tr,H:ir,N:Un,U:Hn,B:Bn,F:Wn},Tu=Qn.litHtmlPolyfillSupport;Tu?.(Pi,Tr),(Qn.litHtmlVersions??=[]).push("3.3.3");var La=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let n=e?.renderBefore??null;r._$litPart$=i=new Tr(t.insertBefore(Ri(),n),n,void 0,e??{})}return i._$AI(o),i};var Va=globalThis,E=class extends se{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=La(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};E._$litElement$=!0,E.finalized=!0,Va.litElementHydrateSupport?.({LitElement:E});var Iu=Va.litElementPolyfillSupport;Iu?.({LitElement:E});(Va.litElementVersions??=[]).push("4.2.2");var Ru={attribute:!0,type:String,converter:_i,reflect:!1,hasChanged:jn},Mu=(o=Ru,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 l=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,l,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,o,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(o){return(t,e)=>typeof e=="object"?Mu(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 Ce=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Ir(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 l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return Ce(e,r,{get(){let l=s.call(this);return l===void 0&&(l=n(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return Ce(e,r,{get(){return n(this)}})}}function Uc(o){return(t,e)=>{let{slot:r,selector:i}=o??{},n="slot"+(r?`[name=${r}]`:":not([name])");return Ce(t,e,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(o)??[];return i===void 0?a:a.filter(l=>l.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 Xn=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}},Ut=class extends Xn{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 ja(this.context,this.host))}};var Di=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 Ut(this,{context:o,initialValue:i})),i}};{t.constructor.addInitializer((s=>{r.set(s,new Ut(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 I({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 Gn=["this"],Hc=["+","-","!"],Wc=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Fa={"!":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},Jn=13;var Pu=["==","!=","<=",">=","||","&&","??","|>"],Ou=["===","!=="],O;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(O||(O={}));var Ht=(o,t,e=0)=>({kind:o,value:t,precedence:e}),Du=o=>o===9||o===10||o===13||o===32,Qc=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),$u=o=>Qc(o)||$i(o),Nu=o=>Gn.indexOf(o)!==-1,Lu=o=>o===34||o===39,$i=o=>48<=o&&o<=57,Vu=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,ju=o=>o===40||o===41||o===91||o===93||o===123||o===125,Fu=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}}),Yn=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;Du(this.#i);)this.#n(!0);if(Lu(this.#i))return this.#a();if(Qc(this.#i))return this.#l();if($i(this.#i))return this.#p();if(this.#i===46)return this.#c();if(this.#i===44)return this.#d();if(this.#i===58)return this.#h();if(Vu(this.#i))return this.#f();if(ju(this.#i))return this.#m();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(t);this.#n()}let r=Ht(O.STRING,Fu(this.#o()));return this.#n(),r}#l(){do this.#n();while($u(this.#i));let t=this.#o(),e=Nu(t)?O.KEYWORD:O.IDENTIFIER;return Ht(e,t)}#p(){do this.#n();while($i(this.#i));return this.#i===46?this.#c():Ht(O.INTEGER,this.#o())}#c(){return this.#n(),$i(this.#i)?this.#u():(this.#s(),Ht(O.DOT,".",Jn))}#d(){return this.#n(!0),Ht(O.COMMA,",")}#h(){return this.#n(!0),Ht(O.COLON,":")}#u(){do this.#n();while($i(this.#i));return Ht(O.DECIMAL,this.#o())}#f(){this.#n();let t=this.#o(2);if(Ou.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Ht(O.ARROW,t);Pu.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Ht(O.OPERATOR,t,Fa[t])}#m(){let t=String.fromCharCode(this.#i),e=Ht(O.GROUPER,t,Fa[t]);return this.#n(!0),e}};var za=(o,t)=>new Ni(o,t).parse(),Ni=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new Yn(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.#c();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.#c();t=this.#l(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}#l(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(Wc.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#c();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)}#c(){if(this._matches(O.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(O.INTEGER))return this.#C(t);if(this._matches(O.DECIMAL))return this.#w(t)}if(Hc.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#h(),Jn);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 Gn.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case O.IDENTIFIER:return this.#m();case O.STRING:return this.#x();case O.INTEGER:return this.#C();case O.DECIMAL:return this.#w();case O.GROUPER:return this.#n==="("?this.#y():this.#n==="{"?this.#f():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)}#f(){let t={};do{if(this.#o(),this._matches(O.GROUPER,"}"))break;let e=this.#n;(this._matches(O.STRING)||this._matches(O.IDENTIFIER))&&this.#o(),this.#o(O.COLON),t[e]=this.#s()}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"}"),this.#r.map(t)}#m(){let t=this.#n;if(t==="true")return this.#o(),this.#r.literal(!0);if(t==="false")return this.#o(),this.#r.literal(!1);if(t==="null")return this.#o(),this.#r.literal(null);if(t==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#b(),r=this.#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])}#x(){let t=this.#r.literal(this.#n);return this.#o(),t}#C(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#w(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:Xc,fromEntries:zu}=Object,Bu={"+":(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)},Uu={"+":o=>o,"-":o=>-o,"!":o=>!o},Kn=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=Uu[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=Bu[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,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),l=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,l=this.left.value),a===void 0?void 0:a[l]=s}return 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,c=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,c)},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=zu(i.map((c,d)=>[c,s[d]])),l=new Proxy(r??{},{set(c,d,h){return Xc(a,d)&&(a[d]=h),c[d]=h},get(c,d){return Xc(a,d)?a[d]:c[d]}});return n.evaluate(l)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var Ba=null,Gc={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){Ba??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Ba))return void(e[Ba]=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:Hu,PropertyPart:Wu,BooleanAttributePart:Qu,EventPart:Xu}=Gc,Ha=new Kn,Ua=new Map,Jc=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),Zn=(o,t)=>{let e=Ua.get(o);if(e===void 0){if(Ua.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new Ni(r,Ha).parse(),Ua.set(o,e)}}return e?.evaluate(t)},Gu=(o,t,e,r)=>{let i=o.getAttribute("if");if(i!==null&&Zn(i,t))return to(o,t,e,r)},Yc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Kc=o=>/(?:\\{{)|(?:\\}})/g.test(o),Li=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Ju=(o,t,e,r)=>{let i=o.getAttribute("repeat");if(i!==null){let n=Zn(i,t);if(!n[Symbol.iterator])return P;let s=Vi(o),a=-1,l=[];for(let c of n){a++;let d=Object.create(t);d.item=c,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let y=m.update(d,e,r);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};l.push(f)}return l}},td={if:Gu,repeat:Ju},ed=(o,t=td,e={},r)=>{let n=Vi(o).renderers;if(r){let a=Vi(r).renderers,l=n.super;l!==void 0?e={...n,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,y)=>to(r,f,m,y)},l(c,d,h))}:(e={...a,...n,...e},o=r)}else e={...n,...e};return s=>to(o,s,t,e)};var to=(o,t,e=td,r={})=>{let i=Vi(o),n=[];for(let a of i.parts){let l=a.update(t,e,r);a.type===1?n.push(...l):n.push(l)}return{_$litType$:i,values:n}},Zc=new Map,Vi=o=>{let t=Zc.get(o);return t===void 0&&Zc.set(o,t=Yu(o)),t},Yu=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 l=s.getAttribute("type"),c=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||l!==null||c!==null){s.parentNode.insertBefore(document.createComment(""),s),n.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:Zn(g,y);return(m?Zn(f,y):u[d])?.(b,x,u)}}else l!==null?h=(f,m,y)=>{let x=m[l];return x?.(s,f,m,y)}:(c==="super"?t.renderers.super=(f,m,y)=>{let x=y.super,u=Vi(s);return y={...y,...u.renderers},x(f,m,y)}:t.renderers[c]=(f,m,y)=>to(s,f,m,y),h=(f,m,y)=>{let x=y[c];return x?.(f,m,y)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(Yc);if(d.length===1){Kc(c)&&s.setAttribute(l,Li(c));continue}s.removeAttribute(l);let h=l,f=Hu,m=l[0];m==="."?(h=Jc(l.substring(1)),f=Wu):m==="?"?(h=l.substring(1),f=Qu):m==="@"&&(h=Jc(l.substring(1)),f=Xu);let y=[Li(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(za(g,Ha)),y.push(Li(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,l=a.split(Yc);l.length>1?s.textContent=Li(l[0]):Kc(a)&&(s.textContent=Li(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=za(d,Ha);t.parts.push({type:2,index:++i,update:(m,y)=>h.evaluate(m)});let f=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of n)s.remove();return t};var Wa=Symbol.for("qti-components.context-root"),Ku=()=>{if(typeof document>"u")return;let o=globalThis;o[Wa]||(o[Wa]=new Di,o[Wa].attach(document.documentElement))};Ku();var rd=[];var Xa=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(" "))}},Qa="custom-state-support-probe";function Zu(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(Qa)||customElements.define(Qa,class extends HTMLElement{});let t=o.call(document.createElement(Qa)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var id=!1;function nd(){if(id)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Zu(o);return t==="modern"||(id=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new Xa(this)}),r}),t}nd();for(let{tag:o,ctor:t}of rd)customElements.get(o)||customElements.define(o,t);var ke=Symbol("computedItemContext");var lt=Symbol("computedContext");var yt=Symbol("configContext");var Rr=Symbol("interactionContext");var j=Symbol("item");var od=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var tm=/^[A-Za-z0-9-]+$/,em=o=>typeof o=="string"&&tm.test(o),Qv=o=>em(o)?o:void 0,qt=Symbol("qtiContext");var Ga={view:"candidate"},eo=Symbol("sessionContext");var Ja={items:[],testOutcomeVariables:[]},nt=Symbol("testContext");var M=w`
|
|
5
|
+
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Yn=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;Du(this.#i);)this.#n(!0);if(Lu(this.#i))return this.#a();if(Qc(this.#i))return this.#l();if($i(this.#i))return this.#p();if(this.#i===46)return this.#c();if(this.#i===44)return this.#d();if(this.#i===58)return this.#h();if(Vu(this.#i))return this.#f();if(ju(this.#i))return this.#m();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(t);this.#n()}let r=Ht(O.STRING,Fu(this.#o()));return this.#n(),r}#l(){do this.#n();while($u(this.#i));let t=this.#o(),e=Nu(t)?O.KEYWORD:O.IDENTIFIER;return Ht(e,t)}#p(){do this.#n();while($i(this.#i));return this.#i===46?this.#c():Ht(O.INTEGER,this.#o())}#c(){return this.#n(),$i(this.#i)?this.#u():(this.#s(),Ht(O.DOT,".",Jn))}#d(){return this.#n(!0),Ht(O.COMMA,",")}#h(){return this.#n(!0),Ht(O.COLON,":")}#u(){do this.#n();while($i(this.#i));return Ht(O.DECIMAL,this.#o())}#f(){this.#n();let t=this.#o(2);if(Ou.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Ht(O.ARROW,t);Pu.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Ht(O.OPERATOR,t,Fa[t])}#m(){let t=String.fromCharCode(this.#i),e=Ht(O.GROUPER,t,Fa[t]);return this.#n(!0),e}};var za=(o,t)=>new Ni(o,t).parse(),Ni=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new Yn(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.#c();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.#c();t=this.#l(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}#l(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(Wc.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#c();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)}#c(){if(this._matches(O.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(O.INTEGER))return this.#C(t);if(this._matches(O.DECIMAL))return this.#w(t)}if(Hc.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#h(),Jn);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 Gn.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case O.IDENTIFIER:return this.#m();case O.STRING:return this.#x();case O.INTEGER:return this.#C();case O.DECIMAL:return this.#w();case O.GROUPER:return this.#n==="("?this.#y():this.#n==="{"?this.#f():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)}#f(){let t={};do{if(this.#o(),this._matches(O.GROUPER,"}"))break;let e=this.#n;(this._matches(O.STRING)||this._matches(O.IDENTIFIER))&&this.#o(),this.#o(O.COLON),t[e]=this.#s()}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"}"),this.#r.map(t)}#m(){let t=this.#n;if(t==="true")return this.#o(),this.#r.literal(!0);if(t==="false")return this.#o(),this.#r.literal(!1);if(t==="null")return this.#o(),this.#r.literal(null);if(t==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#b(),r=this.#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])}#x(){let t=this.#r.literal(this.#n);return this.#o(),t}#C(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#w(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:Xc,fromEntries:zu}=Object,Bu={"+":(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)},Uu={"+":o=>o,"-":o=>-o,"!":o=>!o},Kn=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=Uu[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=Bu[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,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),l=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,l=this.left.value),a===void 0?void 0:a[l]=s}return 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,c=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,c)},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=zu(i.map((c,d)=>[c,s[d]])),l=new Proxy(r??{},{set(c,d,h){return Xc(a,d)&&(a[d]=h),c[d]=h},get(c,d){return Xc(a,d)?a[d]:c[d]}});return n.evaluate(l)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var Ba=null,Gc={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){Ba??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Ba))return void(e[Ba]=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:Hu,PropertyPart:Wu,BooleanAttributePart:Qu,EventPart:Xu}=Gc,Ha=new Kn,Ua=new Map,Jc=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),Zn=(o,t)=>{let e=Ua.get(o);if(e===void 0){if(Ua.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new Ni(r,Ha).parse(),Ua.set(o,e)}}return e?.evaluate(t)},Gu=(o,t,e,r)=>{let i=o.getAttribute("if");if(i!==null&&Zn(i,t))return to(o,t,e,r)},Yc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Kc=o=>/(?:\\{{)|(?:\\}})/g.test(o),Li=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Ju=(o,t,e,r)=>{let i=o.getAttribute("repeat");if(i!==null){let n=Zn(i,t);if(!n[Symbol.iterator])return P;let s=Vi(o),a=-1,l=[];for(let c of n){a++;let d=Object.create(t);d.item=c,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let y=m.update(d,e,r);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};l.push(f)}return l}},td={if:Gu,repeat:Ju},ed=(o,t=td,e={},r)=>{let n=Vi(o).renderers;if(r){let a=Vi(r).renderers,l=n.super;l!==void 0?e={...n,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,y)=>to(r,f,m,y)},l(c,d,h))}:(e={...a,...n,...e},o=r)}else e={...n,...e};return s=>to(o,s,t,e)};var to=(o,t,e=td,r={})=>{let i=Vi(o),n=[];for(let a of i.parts){let l=a.update(t,e,r);a.type===1?n.push(...l):n.push(l)}return{_$litType$:i,values:n}},Zc=new Map,Vi=o=>{let t=Zc.get(o);return t===void 0&&Zc.set(o,t=Yu(o)),t},Yu=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 l=s.getAttribute("type"),c=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||l!==null||c!==null){s.parentNode.insertBefore(document.createComment(""),s),n.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:Zn(g,y);return(m?Zn(f,y):u[d])?.(b,x,u)}}else l!==null?h=(f,m,y)=>{let x=m[l];return x?.(s,f,m,y)}:(c==="super"?t.renderers.super=(f,m,y)=>{let x=y.super,u=Vi(s);return y={...y,...u.renderers},x(f,m,y)}:t.renderers[c]=(f,m,y)=>to(s,f,m,y),h=(f,m,y)=>{let x=y[c];return x?.(f,m,y)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(Yc);if(d.length===1){Kc(c)&&s.setAttribute(l,Li(c));continue}s.removeAttribute(l);let h=l,f=Hu,m=l[0];m==="."?(h=Jc(l.substring(1)),f=Wu):m==="?"?(h=l.substring(1),f=Qu):m==="@"&&(h=Jc(l.substring(1)),f=Xu);let y=[Li(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(za(g,Ha)),y.push(Li(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,l=a.split(Yc);l.length>1?s.textContent=Li(l[0]):Kc(a)&&(s.textContent=Li(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=za(d,Ha);t.parts.push({type:2,index:++i,update:(m,y)=>h.evaluate(m)});let f=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of n)s.remove();return t};var Wa=Symbol.for("qti-components.context-root"),Ku=()=>{if(typeof document>"u")return;let o=globalThis;o[Wa]||(o[Wa]=new Di,o[Wa].attach(document.documentElement))};Ku();var rd=[];var Xa=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(" "))}},Qa="custom-state-support-probe";function Zu(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(Qa)||customElements.define(Qa,class extends HTMLElement{});let t=o.call(document.createElement(Qa)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var id=!1;function nd(){if(id)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Zu(o);return t==="modern"||(id=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new Xa(this)}),r}),t}nd();for(let{tag:o,ctor:t}of rd)customElements.get(o)||customElements.define(o,t);var ke=Symbol("computedItemContext");var lt=Symbol("computedContext");var yt=Symbol("configContext");var Rr=Symbol("interactionContext");var F=Symbol("item");var od=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var tm=/^[A-Za-z0-9-]+$/,em=o=>typeof o=="string"&&tm.test(o),Qv=o=>em(o)?o:void 0,qt=Symbol("qtiContext");var Ga={view:"candidate"},eo=Symbol("sessionContext");var Ja={items:[],testOutcomeVariables:[]},nt=Symbol("testContext");var M=w`
|
|
6
6
|
:host {
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
@@ -56,11 +56,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
56
56
|
[part~='message'] {
|
|
57
57
|
display: none;
|
|
58
58
|
}
|
|
59
|
-
`;var sd={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??sd[t]??[]];for(let n of i)e?o.add(n):o.delete(n)}function ji(o,t){return o?o.has(t)?!0:(sd[t]??[]).some(e=>o.has(e)):!1}var Mr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 E{#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))}#l;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.#l||(this.#l=!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:
|
|
59
|
+
`;var sd={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??sd[t]??[]];for(let n of i)e?o.add(n):o.delete(n)}function ji(o,t){return o?o.has(t)?!0:(sd[t]??[]).some(e=>o.has(e)):!1}var Mr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 E{#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))}#l;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.#l||(this.#l=!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.#l=!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){}};Mr([I({context:yt,subscribe:!0})],D.prototype,"configContext",void 0);Mr([Q({context:Rr})],D.prototype,"_interactionContext",void 0);Mr([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Mr([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Mr([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Mr([p({type:String})],D.prototype,"name",void 0);var Pr=class extends E{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 Ka=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ya=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??ad(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??ad(o),value:String(o),cardinality:"single",type:"response"},ad=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},S=class extends E{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 Ya(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}"`),Ya(null))}default:{try{let r=e,i=r.getResult();return Ya(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`
|
|
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}};Ka([I({context:j,subscribe:!0})],S.prototype,"context",void 0);Ka([I({context:qt,subscribe:!0})],S.prototype,"qtiContext",void 0);Ka([I({context:nt,subscribe:!0})],S.prototype,"_testContext",void 0);var Qt=class extends S{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var ky=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Mt=o=>typeof o=="string"?o:o.toString();function Za(o){return o==null}function ro(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Fi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ut=class extends E{constructor(){super(...arguments),this.showHide="show",this.#t=new at(this,{context:j,subscribe:!0,callback:t=>this.#r(t)}),this.#i=!1}#t;get _context(){return this.#t.value}#e;#r(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let r=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),i=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,n=this.#e===void 0?i>0:this.#e!==r||i>0;this.#e=r,n&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!Za(this.identifier)&&!Za(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}};Fi([p({type:String,attribute:"show-hide"})],ut.prototype,"showHide",void 0);Fi([p({type:String,attribute:"outcome-identifier"})],ut.prototype,"outcomeIdentifier",void 0);Fi([p({type:String})],ut.prototype,"identifier",void 0);Fi([p({type:String,attribute:!1})],ut.prototype,"showStatus",void 0);Fi([I({context:lt,subscribe:!0}),T()],ut.prototype,"_computedContext",void 0);function zi(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 nr(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*Py(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 Oy(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 Dy(o,t){return`${o} ${t}`}function $y(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 Ny(o,t){return`${o} ${t}`}function Xt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=zi(r);return i===null?t:i},toAttribute:r=>e(r)?null:nr(r)}}var ce=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Bi=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}},ld=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,io=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(ld.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(r=>ld.test(r))?"point":"string"};var cd=class extends E{},Or=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Dr=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var im=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},tl=o=>t=>{let e=im(t);return e===null?null:o(e)},nm=["depcp","questify","qade"],om={Trim:tl(o=>o.trim()),ToAscii:tl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:tl(o=>o.replace(",","."))},sm=new Map(nm.flatMap(o=>Object.entries(om).map(([t,e])=>[`${o}:${t}`,e]))),el=new Map,zy=(o,t)=>{el.set(o,t)},By=o=>{el.delete(o)},dd=o=>el.get(o)??sm.get(o)??null;var hd={true:!0,1:!0,false:!1,0:!1},Y=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,n]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-c)**2+(n-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=c&&i<=h&&n>=d&&n<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-c)**2/h**2,y=(n-d)**2/f**2;return m+y<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:i,y:n},c)}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,l=e[n].x,c=e[n].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"boolean":{let i=hd[t.trim().toLowerCase()];return i!==void 0&&i===hd[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 Ee=Symbol("testHost");var ud={"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 rl(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 pd=new Set;function il(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||(pd.has(n)||(pd.add(n),console.warn(`[qti-components] The event "${n}" is deprecated; dispatch "${e}" instead.`)),r(s))})}function xt(o,t,e,r=!1){return rl(o,ud,t,e,r)}function md(o,t,e){il(o,ud,t,e)}var fd={"qc-test-navigate":{kind:"request",scope:"test",deprecated:"cito-test-navigate"},"qc-test-end-attempt":{kind:"request",scope:"test",deprecated:"cito-test-end-attempt"},"qc-test-submit":{kind:"request",scope:"test",deprecated:"cito-test-submit"},"qc-test-update-outcome":{kind:"request",scope:"test",deprecated:"cito-test-update-outcome"},"qc-test-update-plugin-state":{kind:"request",scope:"test",deprecated:"cito-test-update-plugin-state"},"qc-test-switch-view":{kind:"request",scope:"test",deprecated:"cito-test-switch-view"},"qc-test-submitted":{kind:"notification",scope:"test",deprecated:"cito-test-submitted"},"qc-test-navigated":{kind:"notification",scope:"test",deprecated:"cito-test-navigated"},"qc-test-navigation-started":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-started"},"qc-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-failed"},"qc-test-rendered":{kind:"notification",scope:"test",deprecated:"cito-test-rendered"},"qc-test-loaded":{kind:"notification",scope:"test",deprecated:"cito-test-loaded"},"qc-test-state-changed":{kind:"notification",scope:"test",deprecated:"cito-test-state-changed"},"qc-test-items-skipped":{kind:"notification",scope:"test",deprecated:"cito-test-items-skipped"},"qc-test-end-reached":{kind:"notification",scope:"test",deprecated:"cito-test-end-reached"},"qc-item-ref-connected":{kind:"notification",scope:"item",deprecated:"cito-item-ref-connected"}};function F(o,t,e){rl(o,fd,t,e)}function B(o,t,e){il(o,fd,t,e)}var Se=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},wt=class extends E{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?ed(t):null,this.requestUpdate(),await this.updateComplete,F(this,"qc-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let r=e.items.find(i=>i.identifier===this.identifier);if(r)return r}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};Se([p({type:String})],wt.prototype,"category",void 0);Se([p({type:String})],wt.prototype,"identifier",void 0);Se([p({type:Boolean,converter:gd})],wt.prototype,"required",void 0);Se([p({type:Boolean,converter:gd})],wt.prototype,"fixed",void 0);Se([p({type:String})],wt.prototype,"href",void 0);Se([T(),I({context:lt,subscribe:!0})],wt.prototype,"computedContext",void 0);Se([p({type:Object,attribute:!1})],wt.prototype,"xmlDoc",void 0);Se([I({context:Ee,subscribe:!0})],wt.prototype,"testHost",void 0);var $r=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},nl={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Gt=class extends E{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>`}};$r([p({type:String})],Gt.prototype,"identifier",void 0);$r([p({type:String})],Gt.prototype,"required",void 0);$r([p({type:Boolean,converter:nl})],Gt.prototype,"fixed",void 0);$r([p({type:Boolean,converter:nl})],Gt.prototype,"visible",void 0);$r([p({type:Boolean,converter:nl,attribute:"keep-together"})],Gt.prototype,"keepTogether",void 0);$r([I({context:nt,subscribe:!0})],Gt.prototype,"_testContext",void 0);var ol=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},or=class extends E{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,F(this,"qc-test-loaded",this)}render(){return v` <slot></slot>`}};ol([p({type:String})],or.prototype,"identifier",void 0);ol([p({type:String})],or.prototype,"title",null);ol([I({context:nt,subscribe:!0})],or.prototype,"_testContext",void 0);function no(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 am=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},de=class extends E{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}};Ka([I({context:F,subscribe:!0})],S.prototype,"context",void 0);Ka([I({context:qt,subscribe:!0})],S.prototype,"qtiContext",void 0);Ka([I({context:nt,subscribe:!0})],S.prototype,"_testContext",void 0);var Qt=class extends S{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var ky=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Mt=o=>typeof o=="string"?o:o.toString();function Za(o){return o==null}function ro(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Fi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ut=class extends E{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=!Za(this.identifier)&&!Za(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}};Fi([p({type:String,attribute:"show-hide"})],ut.prototype,"showHide",void 0);Fi([p({type:String,attribute:"outcome-identifier"})],ut.prototype,"outcomeIdentifier",void 0);Fi([p({type:String})],ut.prototype,"identifier",void 0);Fi([p({type:String,attribute:!1})],ut.prototype,"showStatus",void 0);Fi([I({context:lt,subscribe:!0}),T()],ut.prototype,"_computedContext",void 0);function zi(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 nr(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*Py(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 Oy(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 Dy(o,t){return`${o} ${t}`}function $y(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 Ny(o,t){return`${o} ${t}`}function Xt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=zi(r);return i===null?t:i},toAttribute:r=>e(r)?null:nr(r)}}var ce=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Bi=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}},ld=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,io=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(ld.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(r=>ld.test(r))?"point":"string"};var cd=class extends E{},Or=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Dr=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var im=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},tl=o=>t=>{let e=im(t);return e===null?null:o(e)},nm=["depcp","questify","qade"],om={Trim:tl(o=>o.trim()),ToAscii:tl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:tl(o=>o.replace(",","."))},sm=new Map(nm.flatMap(o=>Object.entries(om).map(([t,e])=>[`${o}:${t}`,e]))),el=new Map,zy=(o,t)=>{el.set(o,t)},By=o=>{el.delete(o)},dd=o=>el.get(o)??sm.get(o)??null;var hd={true:!0,1:!0,false:!1,0:!1},Y=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,n]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-c)**2+(n-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=c&&i<=h&&n>=d&&n<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-c)**2/h**2,y=(n-d)**2/f**2;return m+y<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:i,y:n},c)}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,l=e[n].x,c=e[n].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"boolean":{let i=hd[t.trim().toLowerCase()];return i!==void 0&&i===hd[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 Ee=Symbol("testHost");var ud={"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 rl(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 pd=new Set;function il(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||(pd.has(n)||(pd.add(n),console.warn(`[qti-components] The event "${n}" is deprecated; dispatch "${e}" instead.`)),r(s))})}function xt(o,t,e,r=!1){return rl(o,ud,t,e,r)}function md(o,t,e){il(o,ud,t,e)}var fd={"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){rl(o,fd,t,e)}function B(o,t,e){il(o,fd,t,e)}var Se=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},wt=class extends E{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?ed(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)}};Se([p({type:String})],wt.prototype,"category",void 0);Se([p({type:String})],wt.prototype,"identifier",void 0);Se([p({type:Boolean,converter:gd})],wt.prototype,"required",void 0);Se([p({type:Boolean,converter:gd})],wt.prototype,"fixed",void 0);Se([p({type:String})],wt.prototype,"href",void 0);Se([T(),I({context:lt,subscribe:!0})],wt.prototype,"computedContext",void 0);Se([p({type:Object,attribute:!1})],wt.prototype,"xmlDoc",void 0);Se([I({context:Ee,subscribe:!0})],wt.prototype,"testHost",void 0);var $r=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},nl={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Gt=class extends E{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>`}};$r([p({type:String})],Gt.prototype,"identifier",void 0);$r([p({type:String})],Gt.prototype,"required",void 0);$r([p({type:Boolean,converter:nl})],Gt.prototype,"fixed",void 0);$r([p({type:Boolean,converter:nl})],Gt.prototype,"visible",void 0);$r([p({type:Boolean,converter:nl,attribute:"keep-together"})],Gt.prototype,"keepTogether",void 0);$r([I({context:nt,subscribe:!0})],Gt.prototype,"_testContext",void 0);var ol=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},or=class extends E{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>`}};ol([p({type:String})],or.prototype,"identifier",void 0);ol([p({type:String})],or.prototype,"title",null);ol([I({context:nt,subscribe:!0})],or.prototype,"_testContext",void 0);function no(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 am=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},de=class extends E{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=w`
|
|
64
64
|
:host {
|
|
65
65
|
display: none;
|
|
66
66
|
}
|
|
@@ -72,7 +72,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
72
72
|
:host {
|
|
73
73
|
display: none;
|
|
74
74
|
}
|
|
75
|
-
`]}render(){return v`<slot></slot>`}process(){let t=new al,e=[...this.children];t.process(e)}},al=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Dr))throw e}}};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},mt=class extends E{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:od},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.#l=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.#c=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.#x(!1)),r&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),r=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||r)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...r?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(n=>!("identifier"in n))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,r=t.filter(n=>n.value!==null&&n.value!==void 0&&(n.type==="template"||e.some(s=>s.identifier===n.identifier&&s.type==="template")));r.forEach(n=>this.#i.set(n.identifier,n.value));let i=r.some(n=>JSON.stringify(e.find(s=>s.identifier===n.identifier)?.value)!==JSON.stringify(n.value));this._context={...this._context,variables:this._context.variables.map(n=>{let s=t.find(a=>a.identifier===n.identifier);return s?{...n,...s,interpolationTable:n.interpolationTable,matchTable:n.matchTable}:n})},this.#n&&i&&this.#m(),this.updateComplete.then(()=>this.#w()),this.isConnected&&this.#v()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#i;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(n=>n.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#v(),xt(this,"qc-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#f()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#l),this.addEventListener("end-attempt",this.#p),this.addEventListener("qc-item-set-outcomes",this.#c),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.#l),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qc-item-set-outcomes",this.#c),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#h),this.removeEventListener("qti-interaction-response",this.#u)}#a;#l;#p;#c;#d;#h;#u;async#f(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#m()}#m(){this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#b(t,e)}#b(t,e,r){this.#x(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.#v()}#v(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),xt(this,"qc-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let r=this._context.variables.find(n=>n.identifier===t&&n.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){this.#y([{identifier:t,value:e}])}#y(t,e){let r=new Map;for(let{identifier:n,value:s}of t){let a=this.getVariable(n);if(!a){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);continue}r.set(n,a.cardinality==="single"||Array.isArray(s)?s:[s])}let i=e!==void 0&&e!==this._context.valid;if(!(r.size===0&&!i)&&(this._context={...this._context,...i?{valid:e}:{},variables:this._context.variables.map(n=>r.has(n.identifier)?{...n,value:r.get(n.identifier)}:n)},r.size>0)){for(let[n,s]of r)xt(this,"qc-item-outcome-changed",{item:this.identifier,outcomeIdentifier:n,value:s});xt(this,"qc-item-outcomes-changed",{item:this.identifier,outcomes:[...r].map(([n,s])=>({identifier:n,value:s}))})}}validate(t=!0){let e=this.#x(t);return this.#C(e),e}#x(t){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}#C(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#w(){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()}};ar([p({type:String})],mt.prototype,"identifier",void 0);ar([p({type:String})],mt.prototype,"adaptive",void 0);ar([p({type:String,attribute:"time-dependent"})],mt.prototype,"timeDependent",void 0);ar([p({type:String})],mt.prototype,"title",null);ar([p({type:Boolean})],mt.prototype,"disabled",void 0);ar([p({type:Boolean})],mt.prototype,"readonly",void 0);ar([Q({context:j})],mt.prototype,"_context",void 0);var bd=w`
|
|
75
|
+
`]}render(){return v`<slot></slot>`}process(){let t=new al,e=[...this.children];t.process(e)}},al=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Dr))throw e}}};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},mt=class extends E{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:od},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.#l=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.#c=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.#x(!1)),r&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),r=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||r)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...r?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(n=>!("identifier"in n))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,r=t.filter(n=>n.value!==null&&n.value!==void 0&&(n.type==="template"||e.some(s=>s.identifier===n.identifier&&s.type==="template")));r.forEach(n=>this.#i.set(n.identifier,n.value));let i=r.some(n=>JSON.stringify(e.find(s=>s.identifier===n.identifier)?.value)!==JSON.stringify(n.value));this._context={...this._context,variables:this._context.variables.map(n=>{let s=t.find(a=>a.identifier===n.identifier);return s?{...n,...s,interpolationTable:n.interpolationTable,matchTable:n.matchTable}:n})},this.#n&&i&&this.#m(),this.updateComplete.then(()=>this.#w()),this.isConnected&&this.#v()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#i;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(n=>n.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#v(),xt(this,"qc-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#f()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#l),this.addEventListener("end-attempt",this.#p),this.addEventListener("qc-item-set-outcomes",this.#c),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.#l),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qc-item-set-outcomes",this.#c),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#h),this.removeEventListener("qti-interaction-response",this.#u)}#a;#l;#p;#c;#d;#h;#u;async#f(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#m()}#m(){this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#b(t,e)}#b(t,e,r){this.#x(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.#v()}#v(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),xt(this,"qc-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let r=this._context.variables.find(n=>n.identifier===t&&n.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){this.#y([{identifier:t,value:e}])}#y(t,e){let r=new Map;for(let{identifier:n,value:s}of t){let a=this.getVariable(n);if(!a){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);continue}r.set(n,a.cardinality==="single"||Array.isArray(s)?s:[s])}let i=e!==void 0&&e!==this._context.valid;if(!(r.size===0&&!i)&&(this._context={...this._context,...i?{valid:e}:{},variables:this._context.variables.map(n=>r.has(n.identifier)?{...n,value:r.get(n.identifier)}:n)},r.size>0)){for(let[n,s]of r)xt(this,"qc-item-outcome-changed",{item:this.identifier,outcomeIdentifier:n,value:s});xt(this,"qc-item-outcomes-changed",{item:this.identifier,outcomes:[...r].map(([n,s])=>({identifier:n,value:s}))})}}validate(t=!0){let e=this.#x(t);return this.#C(e),e}#x(t){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}#C(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#w(){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()}};ar([p({type:String})],mt.prototype,"identifier",void 0);ar([p({type:String})],mt.prototype,"adaptive",void 0);ar([p({type:String,attribute:"time-dependent"})],mt.prototype,"timeDependent",void 0);ar([p({type:String})],mt.prototype,"title",null);ar([p({type:Boolean})],mt.prototype,"disabled",void 0);ar([p({type:Boolean})],mt.prototype,"readonly",void 0);ar([Q({context:F})],mt.prototype,"_context",void 0);var bd=w`
|
|
76
76
|
:host {
|
|
77
77
|
display: contents;
|
|
78
78
|
}
|
|
@@ -80,11 +80,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
80
80
|
::slotted(qti-catalog-info) {
|
|
81
81
|
display: none;
|
|
82
82
|
}
|
|
83
|
-
`;var lo=class extends E{static{this.styles=bd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function vd(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 yd(o,t,e,r="qti-portable-custom-interaction"){let i=[],n=o.querySelectorAll(r);if(n.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(n)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,c.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of y){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],b=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",b),a&&a.paths&&a.paths[u]){let q=a.paths[u];Array.isArray(q)?x.setAttribute("fallback-path",q[0]):x.setAttribute("fallback-path",q)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let b=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",b),a&&a.paths&&a.paths[x]){let q=a.paths[x];Array.isArray(q)?g.setAttribute("fallback-path",q[0]):g.setAttribute("fallback-path",q)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=x.map((b,q)=>{let _=u.length>q?u[q]:"";return{primaryPath:b,fallbackPath:_}});for(let b of u)g.some(q=>q.fallbackPath===b)||g.push({primaryPath:x.length>0?x[0]:b,fallbackPath:b});for(let b of g){let q=o.createElement("qti-interaction-module");b.fallbackPath&&q.setAttribute("fallback-path",b.fallbackPath),q.setAttribute("id",f),q.setAttribute("primary-path",b.primaryPath),h&&h.appendChild(q)}}}}}function qd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===t||n.localName?.toLowerCase()===t.toLowerCase()).forEach(n=>{let s=`${t}-${e}`,a=wd(n,s);n.replaceWith(a)})}function xd(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=wd(e,s);e.replaceWith(a)}})})}function wd(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 Cd(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 Ae(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 he=(o,t)=>Ae(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 kd(o,t){let e=o.getAttribute(t)?.trim();return e&&/^[+-]?\d+$/.test(e)?Number(e):void 0}var cm=Object.freeze({maxAttempts:1,showFeedback:!1,allowReview:!0,showSolution:!1,allowComment:!1,allowSkipping:!0,validateResponses:!1});function Ed(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:Ae(o,"qti-test-part").map(dm)}}function dm(o){let t=ll(cm,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:Ae(o,"qti-assessment-section").map(e=>Sd(e,t))}}function Sd(o,t){let e=ll(t,o);return{kind:"section",identifier:o.getAttribute("identifier")??"",title:o.getAttribute("title")??"",visible:Ot(o,"visible")??!0,sessionControl:e,content:Ae(o,"qti-assessment-section","qti-assessment-item-ref").map(r=>r.localName==="qti-assessment-section"?Sd(r,e):hm(r,e))}}function hm(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:ll(t,o),declaredSessionControl:Ad(o)}}function ll(o,t){return{...o,...Ad(t)}}function Ad(o){let t=he(o,"qti-item-session-control");if(!t)return{};let e={maxAttempts:kd(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 _d=o=>o.content.filter(t=>t.kind==="itemRef");function co(o){return o.flatMap(t=>[t,...co(t.content.filter(e=>e.kind==="section"))])}function ho(o){return o.flatMap(t=>t.kind==="itemRef"?[t]:ho(t.content))}function Td(o){if(o.localName!=="qti-assessment-item")throw new TypeError(`Expected a qti-assessment-item element, not ${String(o.localName)}.`);let t=Ae(o,"qti-response-declaration"),e=Ae(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(pm),hasResponseProcessing:he(o,"qti-response-processing")!==null,externalScored:um(e),label:o.getAttribute("label"),title:o.getAttribute("title")??""}}function pm(o){if(he(o,"qti-correct-response"))return!0;let t=he(o,"qti-mapping");if(t&&he(t,"qti-map-entry"))return!0;let e=he(o,"qti-area-mapping");return e!==null&&he(e,"qti-area-map-entry")!==null}function um(o){let t=o?.getAttribute("external-scored")?.trim();return t==="human"||t==="externalMachine"?t:null}var cl=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=fm(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=mm(`${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 po(o){return cl.fromSeedKey(o)}function mm(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 Id(t)}function fm(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 Id(t)}function Id(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var gm=o=>typeof o=="function"?o():o.random();function uo(o,t){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let n=Math.floor(gm(t)*(i+1));[e[i],e[n]]=[e[n],e[i]]}let r=0;return o.map(i=>i.fixed?i:e[r++])}function bm(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 dl(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 l=a.getAttribute("response-identifier")??`${s}`;s++;let c=bm(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let y=i?po(`${t}:${n}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(q=>q.parentElement!==null);if(x.filter(q=>q.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(q=>q.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=uo(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 Rd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var vm={"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"]}},Md=o=>o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o[o.length-1]}`;function Pd(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(vm))for(let n of Array.from(o.querySelectorAll(r))){let s=n.getAttribute("response-identifier"),a=t.get(s);if(!a)continue;let l=`${r} (response "${s}")`,c=a.getAttribute("cardinality"),d=a.getAttribute("base-type");if(c&&!i.cardinalities.includes(c))e.push(`${l}: ${c} cardinality is not permitted; it must be ${Md(i.cardinalities)}`);else if(c&&i.max&&c!=="multiple"){let h=n.getAttribute(i.max.attribute),f=h===null?i.max.default:Number(h);(f===0||f>1)&&e.push(`${l}: ${i.max.attribute} ${f} requires multiple cardinality, not ${c}`)}c!=="record"&&d&&!i.baseTypes.includes(d)&&e.push(`${l}: base-type ${d} is not permitted; it must be ${Md(i.baseTypes)}`)}if(e.length>0)throw new Error(`QTI validation error: ${e.join("; ")}.`)}var Od=!1;function mo(o,t){Od||(Od=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function ym(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 Dd(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(ym(i)));return r}function jr(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=>Dd(e,r=>`is not well-formed XML: ${r}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Fr(o){return Dd(o,t=>`Failed to parse XML: ${t}`)}function $d(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($d(r.childNodes[n],t,e));return i}return o.cloneNode(!1)}function zr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild($d(o.childNodes[r],document,t));return e}function Br(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,jr(r,i).then(n=>(o=n,e))},parse(r){return o=Fr(r),t="",e},path:r=>(Br(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return Cd(o,r),e},async configurePci(r,i,n="qti-portable-custom-interaction"){return await yd(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 mo("qtiTransformItem",n),dl(o,n),e}return dl(o,i),e},extendElementName:(r,i)=>(qd(o,r,i),e),extendElementsWithClass:(r="extend")=>(xd(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 vd(o),e},stripStyleSheets(){return Rd(o),e},validateBindings(){return Pd(o),e},html(){return t!==null&&Br(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(zr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&Br(o,t.substring(0,t.lastIndexOf("/"))),zr(o,r)},xmlDoc(){return o}};return e};var Nd=()=>{let o,t={async load(e,r){return o=await jr(e,r),t},parse(e){o=Fr(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Ld(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 fo=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Vd=o=>fo(o,"qti-assessment-item-ref","assessmentitemref"),Wi=o=>fo(o,"qti-assessment-section","assessmentsection"),Hi=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),qm=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),hl=o=>fo(o,"qti-ordering","ordering"),xm=o=>fo(o,"qti-selection","selection"),wm=o=>Array.from(o.children).filter(t=>hl(t)&&Hi(t,"shuffle")),Cm=(o,t)=>po(`${o}:${t}`);function km(o){let t=[],e=[],r=i=>{for(let n of Array.from(i.children))Vd(n)?t.push(n):Wi(n)?r(n):!hl(n)&&!xm(n)&&e.push(n.localName)};return r(o),{itemRefs:t,dropped:e}}function Em(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function jd(o,t){for(let l of Array.from(o.children))Wi(l)&&jd(l,t);let e=wm(o);if(e.length===0)return;let r=[],i=[];for(let l of Array.from(o.children))if(Vd(l))r.push({nodes:[l],fixed:Hi(l,"fixed")}),i.push(l);else if(Wi(l)){let{itemRefs:c,dropped:d}=km(l);if(Em(l,d),qm(l,"keep-together","keeptogether"))for(let h of c)r.push({nodes:[h],fixed:Hi(h,"fixed")});else c.length>0&&r.push({nodes:c,fixed:Hi(l,"fixed")});i.push(l)}let n=i.length>0?i[i.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=uo(r,Cm(t,s));for(let l of i)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,n);for(let l of e)l.remove()}function Fd(o){return Array.from(o.getElementsByTagName("*")).some(t=>hl(t)&&Hi(t,"shuffle"))}function pl(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Wi(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&Wi(i)||jd(r,t)}}var Ur=()=>{let o,t="",e={async load(r,i){return o=await jr(r,i),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return o=Fr(r),t="",e},path:r=>(Br(o,r),e),fn(r){return r(o),e},shuffleOrdering(r){if(!Fd(o))return e;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-test-seed";return mo("qtiTransformTest",n),pl(o,n),e}return pl(o,i),e},items(){return Ld(o)},html(){return new XMLSerializer().serializeToString(zr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return zr(o,r)},xmlDoc(){return o}};return e};var zd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ul=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}},Hr=class extends E{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new ul(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))}};zd([p({type:String})],Hr.prototype,"identifier",void 0);zd([p({type:String})],Hr.prototype,"href",void 0);var go=class extends E{};var Sm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Qi=class extends E{render(){return v`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let n=i;n.mathVariable!==!0||n.value===null||n.value===void 0||t.set(n.identifier,this.#e(n.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let n=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(n);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",n);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",n),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Sm([I({context:j,subscribe:!0}),T()],Qi.prototype,"context",void 0);var Bd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 E{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[w`
|
|
83
|
+
`;var lo=class extends E{static{this.styles=bd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function vd(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 yd(o,t,e,r="qti-portable-custom-interaction"){let i=[],n=o.querySelectorAll(r);if(n.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(n)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,c.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of y){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],b=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",b),a&&a.paths&&a.paths[u]){let q=a.paths[u];Array.isArray(q)?x.setAttribute("fallback-path",q[0]):x.setAttribute("fallback-path",q)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let b=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",b),a&&a.paths&&a.paths[x]){let q=a.paths[x];Array.isArray(q)?g.setAttribute("fallback-path",q[0]):g.setAttribute("fallback-path",q)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=x.map((b,q)=>{let _=u.length>q?u[q]:"";return{primaryPath:b,fallbackPath:_}});for(let b of u)g.some(q=>q.fallbackPath===b)||g.push({primaryPath:x.length>0?x[0]:b,fallbackPath:b});for(let b of g){let q=o.createElement("qti-interaction-module");b.fallbackPath&&q.setAttribute("fallback-path",b.fallbackPath),q.setAttribute("id",f),q.setAttribute("primary-path",b.primaryPath),h&&h.appendChild(q)}}}}}function qd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===t||n.localName?.toLowerCase()===t.toLowerCase()).forEach(n=>{let s=`${t}-${e}`,a=wd(n,s);n.replaceWith(a)})}function xd(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=wd(e,s);e.replaceWith(a)}})})}function wd(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 Cd(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 Ae(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 he=(o,t)=>Ae(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 kd(o,t){let e=o.getAttribute(t)?.trim();return e&&/^[+-]?\d+$/.test(e)?Number(e):void 0}var cm=Object.freeze({maxAttempts:1,showFeedback:!1,allowReview:!0,showSolution:!1,allowComment:!1,allowSkipping:!0,validateResponses:!1});function Ed(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:Ae(o,"qti-test-part").map(dm)}}function dm(o){let t=ll(cm,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:Ae(o,"qti-assessment-section").map(e=>Sd(e,t))}}function Sd(o,t){let e=ll(t,o);return{kind:"section",identifier:o.getAttribute("identifier")??"",title:o.getAttribute("title")??"",visible:Ot(o,"visible")??!0,sessionControl:e,content:Ae(o,"qti-assessment-section","qti-assessment-item-ref").map(r=>r.localName==="qti-assessment-section"?Sd(r,e):hm(r,e))}}function hm(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:ll(t,o),declaredSessionControl:Ad(o)}}function ll(o,t){return{...o,...Ad(t)}}function Ad(o){let t=he(o,"qti-item-session-control");if(!t)return{};let e={maxAttempts:kd(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 _d=o=>o.content.filter(t=>t.kind==="itemRef");function co(o){return o.flatMap(t=>[t,...co(t.content.filter(e=>e.kind==="section"))])}function ho(o){return o.flatMap(t=>t.kind==="itemRef"?[t]:ho(t.content))}function Td(o){if(o.localName!=="qti-assessment-item")throw new TypeError(`Expected a qti-assessment-item element, not ${String(o.localName)}.`);let t=Ae(o,"qti-response-declaration"),e=Ae(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(pm),hasResponseProcessing:he(o,"qti-response-processing")!==null,externalScored:um(e),label:o.getAttribute("label"),title:o.getAttribute("title")??""}}function pm(o){if(he(o,"qti-correct-response"))return!0;let t=he(o,"qti-mapping");if(t&&he(t,"qti-map-entry"))return!0;let e=he(o,"qti-area-mapping");return e!==null&&he(e,"qti-area-map-entry")!==null}function um(o){let t=o?.getAttribute("external-scored")?.trim();return t==="human"||t==="externalMachine"?t:null}var cl=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=fm(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=mm(`${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 po(o){return cl.fromSeedKey(o)}function mm(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 Id(t)}function fm(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 Id(t)}function Id(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var gm=o=>typeof o=="function"?o():o.random();function uo(o,t){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let n=Math.floor(gm(t)*(i+1));[e[i],e[n]]=[e[n],e[i]]}let r=0;return o.map(i=>i.fixed?i:e[r++])}function bm(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 dl(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 l=a.getAttribute("response-identifier")??`${s}`;s++;let c=bm(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let y=i?po(`${t}:${n}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(q=>q.parentElement!==null);if(x.filter(q=>q.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(q=>q.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=uo(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 Rd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var vm={"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"]}},Md=o=>o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o[o.length-1]}`;function Pd(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(vm))for(let n of Array.from(o.querySelectorAll(r))){let s=n.getAttribute("response-identifier"),a=t.get(s);if(!a)continue;let l=`${r} (response "${s}")`,c=a.getAttribute("cardinality"),d=a.getAttribute("base-type");if(c&&!i.cardinalities.includes(c))e.push(`${l}: ${c} cardinality is not permitted; it must be ${Md(i.cardinalities)}`);else if(c&&i.max&&c!=="multiple"){let h=n.getAttribute(i.max.attribute),f=h===null?i.max.default:Number(h);(f===0||f>1)&&e.push(`${l}: ${i.max.attribute} ${f} requires multiple cardinality, not ${c}`)}c!=="record"&&d&&!i.baseTypes.includes(d)&&e.push(`${l}: base-type ${d} is not permitted; it must be ${Md(i.baseTypes)}`)}if(e.length>0)throw new Error(`QTI validation error: ${e.join("; ")}.`)}var Od=!1;function mo(o,t){Od||(Od=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function ym(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 Dd(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(ym(i)));return r}function jr(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=>Dd(e,r=>`is not well-formed XML: ${r}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Fr(o){return Dd(o,t=>`Failed to parse XML: ${t}`)}function $d(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($d(r.childNodes[n],t,e));return i}return o.cloneNode(!1)}function zr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild($d(o.childNodes[r],document,t));return e}function Br(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,jr(r,i).then(n=>(o=n,e))},parse(r){return o=Fr(r),t="",e},path:r=>(Br(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return Cd(o,r),e},async configurePci(r,i,n="qti-portable-custom-interaction"){return await yd(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 mo("qtiTransformItem",n),dl(o,n),e}return dl(o,i),e},extendElementName:(r,i)=>(qd(o,r,i),e),extendElementsWithClass:(r="extend")=>(xd(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 vd(o),e},stripStyleSheets(){return Rd(o),e},validateBindings(){return Pd(o),e},html(){return t!==null&&Br(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(zr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&Br(o,t.substring(0,t.lastIndexOf("/"))),zr(o,r)},xmlDoc(){return o}};return e};var Nd=()=>{let o,t={async load(e,r){return o=await jr(e,r),t},parse(e){o=Fr(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Ld(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 fo=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Vd=o=>fo(o,"qti-assessment-item-ref","assessmentitemref"),Wi=o=>fo(o,"qti-assessment-section","assessmentsection"),Hi=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),qm=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),hl=o=>fo(o,"qti-ordering","ordering"),xm=o=>fo(o,"qti-selection","selection"),wm=o=>Array.from(o.children).filter(t=>hl(t)&&Hi(t,"shuffle")),Cm=(o,t)=>po(`${o}:${t}`);function km(o){let t=[],e=[],r=i=>{for(let n of Array.from(i.children))Vd(n)?t.push(n):Wi(n)?r(n):!hl(n)&&!xm(n)&&e.push(n.localName)};return r(o),{itemRefs:t,dropped:e}}function Em(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function jd(o,t){for(let l of Array.from(o.children))Wi(l)&&jd(l,t);let e=wm(o);if(e.length===0)return;let r=[],i=[];for(let l of Array.from(o.children))if(Vd(l))r.push({nodes:[l],fixed:Hi(l,"fixed")}),i.push(l);else if(Wi(l)){let{itemRefs:c,dropped:d}=km(l);if(Em(l,d),qm(l,"keep-together","keeptogether"))for(let h of c)r.push({nodes:[h],fixed:Hi(h,"fixed")});else c.length>0&&r.push({nodes:c,fixed:Hi(l,"fixed")});i.push(l)}let n=i.length>0?i[i.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=uo(r,Cm(t,s));for(let l of i)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,n);for(let l of e)l.remove()}function Fd(o){return Array.from(o.getElementsByTagName("*")).some(t=>hl(t)&&Hi(t,"shuffle"))}function pl(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Wi(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&Wi(i)||jd(r,t)}}var Ur=()=>{let o,t="",e={async load(r,i){return o=await jr(r,i),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return o=Fr(r),t="",e},path:r=>(Br(o,r),e),fn(r){return r(o),e},shuffleOrdering(r){if(!Fd(o))return e;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-test-seed";return mo("qtiTransformTest",n),pl(o,n),e}return pl(o,i),e},items(){return Ld(o)},html(){return new XMLSerializer().serializeToString(zr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return zr(o,r)},xmlDoc(){return o}};return e};var zd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ul=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}},Hr=class extends E{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new ul(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))}};zd([p({type:String})],Hr.prototype,"identifier",void 0);zd([p({type:String})],Hr.prototype,"href",void 0);var go=class extends E{};var Sm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Qi=class extends E{render(){return v`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let n=i;n.mathVariable!==!0||n.value===null||n.value===void 0||t.set(n.identifier,this.#e(n.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let n=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(n);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",n);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",n),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Sm([I({context:F,subscribe:!0}),T()],Qi.prototype,"context",void 0);var Bd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 E{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[w`
|
|
84
84
|
:host {
|
|
85
85
|
display: none;
|
|
86
86
|
}
|
|
87
|
-
`]}render(){return v`<slot></slot>`}};Bd([p({type:String})],Wr.prototype,"identifier",void 0);Bd([p({type:String})],Wr.prototype,"cardinality",void 0);var Am=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Xi=class extends E{#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=dd(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let r=Array.from(this.children).map(i=>{let n=i.calculate;return typeof n=="function"?n.call(i):null});return e(r)}};Am([I({context:
|
|
87
|
+
`]}render(){return v`<slot></slot>`}};Bd([p({type:String})],Wr.prototype,"identifier",void 0);Bd([p({type:String})],Wr.prototype,"cardinality",void 0);var Am=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Xi=class extends E{#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=dd(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let r=Array.from(this.children).map(i=>{let n=i.calculate;return typeof n=="function"?n.call(i):null});return e(r)}};Am([I({context:F,subscribe:!0}),T()],Xi.prototype,"_context",void 0);function pe(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 bo=class extends ut{static{this.styles=w`
|
|
88
88
|
:host {
|
|
89
89
|
display: block;
|
|
90
90
|
}
|
|
@@ -154,11 +154,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
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}}))}};Gi([p({type:String,attribute:"base-type"})],ue.prototype,"baseType",void 0);Gi([p({type:String,attribute:"external-scored"})],ue.prototype,"externalScored",void 0);Gi([p({type:String})],ue.prototype,"identifier",void 0);Gi([p({type:String})],ue.prototype,"cardinality",void 0);Gi([I({context:
|
|
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}}))}};Gi([p({type:String,attribute:"base-type"})],ue.prototype,"baseType",void 0);Gi([p({type:String,attribute:"external-scored"})],ue.prototype,"externalScored",void 0);Gi([p({type:String})],ue.prototype,"identifier",void 0);Gi([p({type:String})],ue.prototype,"cardinality",void 0);Gi([I({context:F,subscribe:!0}),T()],ue.prototype,"itemContext",void 0);var qo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},_e=class extends Pr{static{this.styles=[w`
|
|
158
158
|
:host {
|
|
159
159
|
display: none;
|
|
160
160
|
}
|
|
161
|
-
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes: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}=Bi(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}=Bi(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}}};qo([p({type:String,attribute:"base-type"})],_e.prototype,"baseType",void 0);qo([p({type:String})],_e.prototype,"identifier",void 0);qo([p({type:String})],_e.prototype,"cardinality",void 0);qo([I({context:
|
|
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}=Bi(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}=Bi(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}}};qo([p({type:String,attribute:"base-type"})],_e.prototype,"baseType",void 0);qo([p({type:String})],_e.prototype,"identifier",void 0);qo([p({type:String})],_e.prototype,"cardinality",void 0);qo([I({context:F,subscribe:!0}),T()],_e.prototype,"itemContext",void 0);var Hd=`<qti-response-condition>
|
|
162
162
|
<qti-response-if>
|
|
163
163
|
<qti-match>
|
|
164
164
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -205,7 +205,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
205
205
|
:host {
|
|
206
206
|
display: none;
|
|
207
207
|
}
|
|
208
|
-
`]}#t=new Ut(this,{context:
|
|
208
|
+
`]}#t=new Ut(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=Tm(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 Or))throw e}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let r=e.split("/").pop().replace(".xml",""),i=_m[r];i&&(this.innerHTML=i)}};function Tm(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(l=>{let c=l;if(a.has(c)){let d=a.get(c),h=this[c];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,h)}}),n.call(this,a)}}}var Xr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Dt=o=>(...t)=>({_$litDirective$:o,values:t}),Te=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:Im}=et,Xd=o=>o,Jd=o=>o===null||typeof o!="object"&&typeof o!="function";var Yd=o=>o.strings===void 0,Gd=()=>document.createComment(""),Gr=(o,t,e)=>{let r=o._$AA.parentNode,i=t===void 0?o._$AB:t._$AA;if(e===void 0){let n=r.insertBefore(Gd(),i),s=r.insertBefore(Gd(),i);e=new Im(n,s,o,o.options)}else{let n=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==s._$AU&&e._$AP(l)}if(n!==i||a){let l=e._$AA;for(;l!==n;){let c=Xd(l).nextSibling;Xd(r).insertBefore(l,i),l=c}}}return e},Ie=(o,t,e=o)=>(o._$AI(t,e),o),Rm={},Kd=(o,t=Rm)=>o._$AH=t,Zd=o=>o._$AH,wo=o=>{o._$AR(),o._$AA.remove()};var Ji=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),Ji(r,t);return!0},Co=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},th=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),Om(t)}};function Mm(o){this._$AN!==void 0?(Co(this),this._$AM=o,th(this)):this._$AM=o}function Pm(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++)Ji(r[n],!1),Co(r[n]);else r!=null&&(Ji(r,!1),Co(r));else Ji(this,o)}var Om=o=>{o.type==Xr.CHILD&&(o._$AP??=Pm,o._$AQ??=Mm)},Re=class extends Te{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),th(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Ji(this,t),Co(this))}setValue(t){if(Yd(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 ml=class extends Re{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)))}},W0=Dt(ml);var Yi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 E{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!xt(this,"qc-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=w`
|
|
209
209
|
:host {
|
|
210
210
|
display: block;
|
|
211
211
|
}
|
|
@@ -221,7 +221,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
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``}};Dm([p({type:String})],Zi.prototype,"access",void 0);var Ao=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 E{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>`}};Ao([p({type:String})],Me.prototype,"identifier",void 0);Ao([p({type:String})],Me.prototype,"class",void 0);Ao([p({type:String,attribute:"navigation-mode"})],Me.prototype,"navigationMode",void 0);Ao([p({type:String,attribute:"submission-mode"})],Me.prototype,"submissionMode",void 0);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},tn=class extends S{#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=Vr(t,Lr(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new fl(this._testContext,r,i).calculate()}calculate(){return this.getResult()}};$m([I({context:nt,subscribe:!0})],tn.prototype,"_testContext",void 0);var fl=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 _o=Symbol("itemFacts");var en="qti-assessment-section",To="qti-test-part",$t=o=>o.identifier||o.getAttribute("identifier")||"";function rh(o,t){let e=o[t],r=t+1,i=Nm(e,o,t);if(i){let s=Lm(i,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map($t)};s>t?r=s:console.warn(`qti-branch-rule target "${i.target}" is not ahead of "${$t(e)}", ignored`)}let n=o.slice(t+1,r).map($t);for(let s=r;s<o.length;s++){if(nh(o[s],e))return{id:$t(o[s]),skipped:n};n.push($t(o[s]))}return{id:null,skipped:n}}function ih(o){let t=[];for(let e of o){if(nh(e,null))return{id:$t(e),skipped:t};t.push($t(e))}return{id:null,skipped:t}}function Nm(o,t,e){let r=[o];for(let i=o.parentElement;i&&(i.localName===en||i.localName===To)&&!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 Lm(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 de.EXIT_TEST:return null;case de.EXIT_TESTPART:return i(r.closest(To));case de.EXIT_SECTION:{let n=r.localName===en?r:r.closest(en);return i(n??r)}default:{let n=t.findIndex(l=>$t(l)===o.target);if(n>=0)return n;let s=[...r.closest("qti-assessment-test")?.querySelectorAll(`${en}, ${To}`)??[]].find(l=>l.getAttribute("identifier")===o.target),a=s?t.findIndex(l=>s.contains(l)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function nh(o,t){let e=[o];for(let r=o.parentElement;r&&(r.localName===en||r.localName===To);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 rn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},oh=o=>{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&&F(this,"qc-test-navigate",{type:r,id:n})}_bindEventHandlers(){B(this,"qc-test-navigate",this._handleNavigationRequest.bind(this)),B(this,"qc-test-loaded",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(r){this._testElement=r.detail,this.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&&F(this,"qc-test-items-skipped",{ids:n.skipped}),n.id===null){F(this,"qc-test-end-reached",{});return}r=n.id}}r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,i){let n=this.sessionContext?.navItemRefId;if(!n||r==="item"&&i===n)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!s||s.closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return!1;let a=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),l=a.findIndex(c=>c.identifier===n);if(r==="item"){let c=a.findIndex(d=>d.identifier===i);return c===-1||l===-1?!1:c!==l+1}return!0}_resolveLinearNext(r,i){if(r!=="item"||!this._testElement)return;let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=n.findIndex(l=>$t(l)===this.sessionContext?.navItemRefId);if(s<0||!n[s+1]||$t(n[s+1])!==i||n[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=rh(n,s);if(a.id!==i)return a}async _handleNavigationRequest({detail:r}){if(!r?.id)return;let i=this._resolveLinearNext(r.type,r.id);if(i?.id===null){i.skipped.length&&F(this,"qc-test-items-skipped",{ids:i.skipped}),F(this,"qc-test-end-reached",{});return}let n=i?.id??r.id;if(!i&&this._isLinearNavigationRestricted(r.type,n)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(r.type,n),this._activeController=a,await this._executeNavigation(r.type,n,s,a),i?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&F(this,"qc-test-items-skipped",{ids:i.skipped})}catch(l){this._handleNavigationError(l,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,l=this._getSectionItemIds(r);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:this.navigate==="item"?l[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,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=[],l=n.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.identifier}"]`));if(c.length>0)a=c,console.info("Found targets by identifier:",c.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((c,d)=>{c.innerHTML="",c.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,i,n){if(!this._testElement||r.length===0)return;let s=r.map(d=>this._findItemRef(d));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(d=>this._loadSingleItem(d,i,n)))).filter(Boolean);if(this._isStaleNavigation(i,n))return;let c=new Map(this.itemFacts);l.forEach(({itemRef:d,doc:h,facts:f})=>{d&&h&&(d.xmlDoc=h),d&&f&&c.set(d.identifier,f)}),this.itemFacts=c,l.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=l}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 l=a.xmlDoc().documentElement,c=l?.localName==="qti-assessment-item"?Td(l):null;return{itemRef:r,doc:a.htmlDoc(this._customElementRegistry()),facts:c}}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){F(this,"qc-test-navigation-started",{type:r,id:i})}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchError(r){F(this,"qc-test-navigation-failed",r)}_dispatchTestLoaded(r,i,n){requestAnimationFrame(()=>{F(this,"qc-test-rendered",r.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),F(this,"qc-test-navigated",{type:i,id:n})})}}return rn([p({type:String})],t.prototype,"navigate",void 0),rn([p({type:Number})],t.prototype,"requestTimeout",void 0),rn([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),rn([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),rn([T(),Q({context:_o})],t.prototype,"itemFacts",void 0),t};var sh=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 ah=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gl=o=>{class t extends o{constructor(...r){super(...r),this.testContext=Ja,this.sessionContext=Ga,this._updateItemInTestContext=i=>{let n=i.itemContext,s=n.identifier,a=n.variables,l=this.testContext.items.find(c=>c?.identifier===s);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,n.valid);else{let c=[...i.variables];for(let d of l.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}i.variables=c,this.#t(s,c.find(d=>d.identifier==="completionStatus")?.value),l.state&&(i.state=l.state)}},this._initializeEventListeners()}updateItemVariables(r,i,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==r)return a;let l=[...a.variables??[]];for(let{identifier:c,type:d,value:h}of i){let f=l.findIndex(y=>y.identifier===c),m={...f>=0?l[f]:{},identifier:c,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?l[f]=m:l.push(m)}return{...a,variables:l,...n?{state:{...n}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(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=Ja,this.sessionContext=Ga}),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(l=>{let c=a.variables.find(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...n!==void 0?{state:n?{...n}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(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(l=>l.identifier==="completionStatus"?{...l,value:i}:l)})})}}return ah([p({attribute:!1,type:Object}),Q({context:nt})],t.prototype,"testContext",void 0),ah([p({attribute:!1,type:Object}),Q({context:eo})],t.prototype,"sessionContext",void 0),t},lh=class extends gl(E){};var nn=1;var Vm=["response","outcome","template","context"],ch=o=>o==null?null:Array.isArray(o)?o.map(String):String(o),jm=({identifier:o,type:t,value:e})=>({identifier:o,...Vm.includes(t)?{type:t}:{},value:ch(e)}),dh=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e?.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(jm),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:ch(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 Fm=o=>Array.isArray(o)?[...o]:o??null,zm=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},hh=o=>{class t extends o{#t=null;#e=!1;#r=null;constructor(...r){super(...r),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#r=null}),B(this,"qc-test-update-plugin-state",({detail:i})=>this.#i(i)),B(this,"qc-test-loaded",()=>{this.#t&&(this.#n(this.#t),this.#t=null),this.#e=!0})}#i({plugin:r,value:i}){if(typeof r!="string"||r==="")return;let{[r]:n,...s}=this.sessionContext.plugins??{},a=s;if(i!=null)try{a={...s,[r]:JSON.parse(JSON.stringify(i))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${r}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return dh(this.testContext,this.sessionContext)}set state(r){if(!zm(r)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=r;return}let{navItemRefId:i,navSectionId:n}=this.sessionContext;this.#n(r);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==i?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==n&&this.#s("section",s.navSectionId)}updated(r){if(super.updated(r),!this.#e||!(r.has("testContext")||r.has("sessionContext")))return;let i=this.state,n=JSON.stringify(i);n!==this.#r&&(this.#r=n,F(this,"qc-test-state-changed",i))}#n(r){for(let n of r.test.items)this.updateItemVariables(n.identifier,n.variables,n.state);let i=new Map(r.test.outcomes.map(n=>[n.identifier,n.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>i.has(n.identifier)?{...n,value:Fm(i.get(n.identifier))}:n)},this.sessionContext={...this.sessionContext,...this.#o(r.session),plugins:r.session.plugins&&typeof r.session.plugins=="object"?{...r.session.plugins}:{}}}#o(r){let i=(n,s)=>!!s&&!!this._testElement?.querySelector(`${n}[identifier="${CSS.escape(s)}"]`);return{...i("qti-test-part",r.navPartId)?{navPartId:r.navPartId}:{},...i("qti-assessment-section",r.navSectionId)?{navSectionId:r.navSectionId}:{},...this.testContext.items.some(n=>n.identifier===r.navItemRefId)?{navItemRefId:r.navItemRefId}:{}}}#s(r,i){F(this,"qc-test-navigate",{type:r,id:i})}}return t};var ph=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),B(this,"qc-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:n,value:s}=i.detail;this.updateOutcomeVariable(n,s),i.stopPropagation()})}outcomeProcessing(){let r=(this._testElement??this).querySelector("qti-outcome-processing");return r?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>({...i,value:i.defaultValue??null}))},r.process(),!0):!1}submit(){return this.outcomeProcessing()?(F(this,"qc-test-submitted",{}),!0):!1}getTestFeedback(r){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(n=>(!r||n.access===r)&&n.matches(this.getOutcome(n.outcomeIdentifier)?.value))}updateOutcomeVariable(r,i){let n=this.getOutcome(r);if(!n){console.warn(`Can not set qti-outcome-identifier: ${r}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==r?s:{...s,value:n.cardinality==="single"?i:[...s.value,i]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===r)||null}}return t};var uh=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 oh(sh(ph(hh(gl(E))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Ut(this,{context:Ee,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};uh([T(),Q({context:yt})],Pe.prototype,"configContext",void 0);uh([T(),Q({context:qt})],Pe.prototype,"qtiContext",void 0);var Io=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Ro=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 mh=o=>!Jd(o)&&typeof o.then=="function",fh=1073741823,bl=class extends Re{constructor(){super(...arguments),this._$Cwt=fh,this._$Cbt=[],this._$CK=new Io(this),this._$CX=new Ro}render(...t){return t.find(e=>!mh(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 l=e[a];if(!mh(l))return this._$Cwt=a,l;a<i&&l===r[a]||(this._$Cwt=fh,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=n.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Mo=Dt(bl);var Po=`
|
|
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``}};Dm([p({type:String})],Zi.prototype,"access",void 0);var Ao=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 E{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>`}};Ao([p({type:String})],Me.prototype,"identifier",void 0);Ao([p({type:String})],Me.prototype,"class",void 0);Ao([p({type:String,attribute:"navigation-mode"})],Me.prototype,"navigationMode",void 0);Ao([p({type:String,attribute:"submission-mode"})],Me.prototype,"submissionMode",void 0);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},tn=class extends S{#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=Vr(t,Lr(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new fl(this._testContext,r,i).calculate()}calculate(){return this.getResult()}};$m([I({context:nt,subscribe:!0})],tn.prototype,"_testContext",void 0);var fl=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 _o=Symbol("itemFacts");var en="qti-assessment-section",To="qti-test-part",$t=o=>o.identifier||o.getAttribute("identifier")||"";function rh(o,t){let e=o[t],r=t+1,i=Nm(e,o,t);if(i){let s=Lm(i,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map($t)};s>t?r=s:console.warn(`qti-branch-rule target "${i.target}" is not ahead of "${$t(e)}", ignored`)}let n=o.slice(t+1,r).map($t);for(let s=r;s<o.length;s++){if(nh(o[s],e))return{id:$t(o[s]),skipped:n};n.push($t(o[s]))}return{id:null,skipped:n}}function ih(o){let t=[];for(let e of o){if(nh(e,null))return{id:$t(e),skipped:t};t.push($t(e))}return{id:null,skipped:t}}function Nm(o,t,e){let r=[o];for(let i=o.parentElement;i&&(i.localName===en||i.localName===To)&&!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 Lm(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 de.EXIT_TEST:return null;case de.EXIT_TESTPART:return i(r.closest(To));case de.EXIT_SECTION:{let n=r.localName===en?r:r.closest(en);return i(n??r)}default:{let n=t.findIndex(l=>$t(l)===o.target);if(n>=0)return n;let s=[...r.closest("qti-assessment-test")?.querySelectorAll(`${en}, ${To}`)??[]].find(l=>l.getAttribute("identifier")===o.target),a=s?t.findIndex(l=>s.contains(l)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function nh(o,t){let e=[o];for(let r=o.parentElement;r&&(r.localName===en||r.localName===To);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 rn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},oh=o=>{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")||[]),l=a.findIndex(c=>c.identifier===n);if(r==="item"){let c=a.findIndex(d=>d.identifier===i);return c===-1||l===-1?!1:c!==l+1}return!0}_resolveLinearNext(r,i){if(r!=="item"||!this._testElement)return;let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=n.findIndex(l=>$t(l)===this.sessionContext?.navItemRefId);if(s<0||!n[s+1]||$t(n[s+1])!==i||n[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=rh(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(l){this._handleNavigationError(l,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,l=this._getSectionItemIds(r);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:this.navigate==="item"?l[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,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=[],l=n.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.identifier}"]`));if(c.length>0)a=c,console.info("Found targets by identifier:",c.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((c,d)=>{c.innerHTML="",c.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,i,n){if(!this._testElement||r.length===0)return;let s=r.map(d=>this._findItemRef(d));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(d=>this._loadSingleItem(d,i,n)))).filter(Boolean);if(this._isStaleNavigation(i,n))return;let c=new Map(this.itemFacts);l.forEach(({itemRef:d,doc:h,facts:f})=>{d&&h&&(d.xmlDoc=h),d&&f&&c.set(d.identifier,f)}),this.itemFacts=c,l.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=l}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 l=a.xmlDoc().documentElement,c=l?.localName==="qti-assessment-item"?Td(l):null;return{itemRef:r,doc:a.htmlDoc(this._customElementRegistry()),facts:c}}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 rn([p({type:String})],t.prototype,"navigate",void 0),rn([p({type:Number})],t.prototype,"requestTimeout",void 0),rn([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),rn([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),rn([T(),Q({context:_o})],t.prototype,"itemFacts",void 0),t};var sh=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 ah=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gl=o=>{class t extends o{constructor(...r){super(...r),this.testContext=Ja,this.sessionContext=Ga,this._updateItemInTestContext=i=>{let n=i.itemContext,s=n.identifier,a=n.variables,l=this.testContext.items.find(c=>c?.identifier===s);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,n.valid);else{let c=[...i.variables];for(let d of l.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}i.variables=c,this.#t(s,c.find(d=>d.identifier==="completionStatus")?.value),l.state&&(i.state=l.state)}},this._initializeEventListeners()}updateItemVariables(r,i,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==r)return a;let l=[...a.variables??[]];for(let{identifier:c,type:d,value:h}of i){let f=l.findIndex(y=>y.identifier===c),m={...f>=0?l[f]:{},identifier:c,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?l[f]=m:l.push(m)}return{...a,variables:l,...n?{state:{...n}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(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=Ja,this.sessionContext=Ga}),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(l=>{let c=a.variables.find(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...n!==void 0?{state:n?{...n}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(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(l=>l.identifier==="completionStatus"?{...l,value:i}:l)})})}}return ah([p({attribute:!1,type:Object}),Q({context:nt})],t.prototype,"testContext",void 0),ah([p({attribute:!1,type:Object}),Q({context:eo})],t.prototype,"sessionContext",void 0),t},lh=class extends gl(E){};var nn=1;var Vm=["response","outcome","template","context"],ch=o=>o==null?null:Array.isArray(o)?o.map(String):String(o),jm=({identifier:o,type:t,value:e})=>({identifier:o,...Vm.includes(t)?{type:t}:{},value:ch(e)}),dh=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e?.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(jm),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:ch(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 Fm=o=>Array.isArray(o)?[...o]:o??null,zm=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},hh=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 dh(this.testContext,this.sessionContext)}set state(r){if(!zm(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.#a("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==n&&this.#a("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);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:Fm(i.get(n.identifier))}:n)},this.sessionContext={...this.sessionContext,...this.#s(r.session),plugins:r.session.plugins&&typeof r.session.plugins=="object"?{...r.session.plugins}:{}}}#s(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}:{}}}#a(r,i){j(this,"qc-test-navigate",{type:r,id:i})}}return t};var ph=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 uh=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 oh(sh(ph(hh(gl(E))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Ut(this,{context:Ee,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};uh([T(),Q({context:yt})],Pe.prototype,"configContext",void 0);uh([T(),Q({context:qt})],Pe.prototype,"qtiContext",void 0);var Io=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Ro=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 mh=o=>!Jd(o)&&typeof o.then=="function",fh=1073741823,bl=class extends Re{constructor(){super(...arguments),this._$Cwt=fh,this._$Cbt=[],this._$CK=new Io(this),this._$CX=new Ro}render(...t){return t.find(e=>!mh(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 l=e[a];if(!mh(l))return this._$Cwt=a,l;a<i&&l===r[a]||(this._$Cwt=fh,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=n.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Mo=Dt(bl);var Po=`
|
|
225
225
|
@layer qti-base, qti-components, qti-extended;
|
|
226
226
|
|
|
227
227
|
@layer qti-components.reset, qti-components.global, qti-components.interactions.base,
|
|
@@ -6424,7 +6424,7 @@ div.full-correct-response-inline {
|
|
|
6424
6424
|
:host(:active:not([disabled])) .control {
|
|
6425
6425
|
${Gm};
|
|
6426
6426
|
}
|
|
6427
|
-
`;var on=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qh=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?qh(e.host):void 0},ge=class extends E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=$e}constructor(){super(),this._internalDisabled=!1,this.requireAnswer=!1,this.addEventListener("click",t=>{if(t.preventDefault(),!this._internalDisabled){let e=this.#t;F(this,"qc-test-end-attempt",e?{itemId:e}:{})}})}get#t(){return this.item||qh(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(l=>l.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 De}};on([I({context:lt,subscribe:!0}),p({attribute:!1})],ge.prototype,"computedContext",void 0);on([p({type:Boolean,reflect:!0,attribute:"disabled"})],ge.prototype,"_internalDisabled",void 0);on([p({reflect:!0})],ge.prototype,"item",void 0);on([p({type:Boolean,reflect:!0,attribute:"require-answer"})],ge.prototype,"requireAnswer",void 0);on([N("computedContext")],ge.prototype,"_handleTestElementChange",null);function ql(o){return{nodeType:o.nodeType,localName:o.localName,get childNodes(){return Array.from(o.children,ql)},getAttribute:t=>o.getAttribute(t)??(t==="title"?o.getAttribute("data-title"):null)}}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},Km=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),ct=class extends E{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=Km())}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:Ee,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.#l(t)??null,this.#f=new Map,this.#m=[],this.#y=new WeakSet,B(this,"qc-test-loaded",this.#u.bind(this)),md(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.#c.bind(this)),B(this,"qc-test-update-outcome",this.#d.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=this.#q(e);this.#s.set(e.identifier,r);let i=this.computedItemFor(e.identifier),n=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,this.#w(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)}#l(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}#c(t){let e=t.detail?.itemId,r=e?this.#l(e):this.activeAssessmentItem;if(!r)return;let i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#d(t){let e=this.#l(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#h(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}}}render(){return v`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#r({QTI_CONTEXT:{...i,testIdentifier:this.#o.identifier,environmentIdentifier:i.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=this.#g(i);Object.keys(n).length>0&&this.#r({QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let r=Ed(ql(this.#o));this.#f=new Map(r.testParts.flatMap(i=>co(i.sections).map(n=>[n.identifier,ho(n.content).map(s=>s.identifier)]))),this.#m=r.testParts.flatMap(i=>ho(i.sections)),this.computedContext={itemElement:this.#p,identifier:r.identifier,title:r.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:r.testParts.map(i=>({active:!1,identifier:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,allowSkipping:i.sessionControl.allowSkipping,sections:co(i.sections).map(n=>({active:!1,identifier:n.identifier,title:n.title,allowSkipping:n.sessionControl.allowSkipping,items:_d(n).map(s=>({...this.initContext?.find(a=>a.identifier===s.identifier),active:!1,identifier:s.identifier,categories:s.categories,href:s.href,variables:[],sessionControl:{...s.sessionControl}}))}))}))}}#f;#m;#b(){let t=1;return new Map(this.#m.map(e=>[e.identifier,e.categories.includes(this.configContext?.infoItemCategory)?null: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",l=n.textContent?.trim()||"";if(s){let c=l;switch(a){case"integer":c=parseInt(l,10);break;case"float":case"duration":c=parseFloat(l);break;case"boolean":c=l.toLowerCase()==="true";break;default:c=l;break}e[s]=c}}),e}#v(t){let e=this._itemFacts?.get(t);if(!e)return{};let{identifier:r,...i}=e;return{...i,assessmentItemIdentifier:r}}willUpdate(t){if(!this.computedContext)return;let e=this.#b();this.computedContext={...this.computedContext,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(r=>({...r,active:this._sessionContext?.navPartId===r.identifier||!1,sections:r.sections.map(i=>({...i,active:this._sessionContext?.navSectionId===i.identifier||!1,completed:(this.#f.get(i.identifier)??i.items.map(n=>n.identifier)).every(n=>this._testContext.items.find(s=>s.identifier===n)?.variables.find(s=>s.identifier==="completionStatus")?.value==="completed"),items:i.items.map(n=>{let s=this._testContext?.items.find(C=>C.identifier===n.identifier),a={...n,...this.#v(n.identifier),...s,...this.initContext?.find(C=>C.identifier===n.identifier)},l=a.variables?.find(C=>C.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(C=>C.identifier==="completionStatus")?.value,h=a.variables?.find(C=>C.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(C=>C.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(C=>C.type==="response"&&C.identifier!=="numAttempts")||[]).every(C=>{if(C.value===void 0||C.value===null)return!0;let k;switch(C.baseType){case"integer":case"float":case"duration":k="0";break;case"boolean":k="false";break;default:k="";break}let R=C.defaultValue??k;if(Array.isArray(C.value)){let $=Array.isArray(R)?R:[R];return C.value.length===$.length&&C.value.every((V,L)=>V===$[L])}return C.value===R}),g=e.get(n.identifier)??null,b=n.variables?.find(C=>C.identifier=="MAXSCORE")?.value,q=b==null?null:parseFloat(b?.toString()),_=this.#s.get(a.identifier);_===void 0&&(_=s?this.#q(s):"unscored",f>0&&this.#s.set(a.identifier,_));let A=this.#w(f,_,a.sessionControl?.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:y,isDefaultResponse:u,maxScore:q,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}updated(t){super.updated(t),this.#x()}#y;#x(){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.#C(t.get(e.identifier),r);i&&!r.disabled?(r.disabled=!0,this.#y.add(r)):!i&&this.#y.has(r)&&(this.#y.delete(r),r.disabled=!1)}}#C(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}#w(t,e,r,i,n){if(t===0)return!1;if(i)return n==="completed";if(e!=="suboptimal")return!0;let s=r??1;return s>0&&t>=s}#q(t){let e=t.variables??[],r=this.#k(e,"SCORE"),i=this.#k(e,"MAXSCORE");if(r!==null&&i!==null)return r>=i?"optimal":"suboptimal";let n=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return n.length===0?"unscored":n.every(a=>{let l=a.correctResponse,c=a.value;return c==null?!1:Array.isArray(l)&&Array.isArray(c)?l.length===c.length&&l.every(d=>c.includes(d)):Array.isArray(l)||Array.isArray(c)?!1:l===c})?"optimal":"suboptimal"}#k(t,e){let r=t?.find(n=>n.identifier===e)?.value;if(r==null||Array.isArray(r))return null;let i=parseFloat(r.toString());return Number.isNaN(i)?null:i}};Ne([p({type:String})],ct.prototype,"identifier",void 0);Ne([T()],ct.prototype,"initContext",void 0);Ne([T(),I({context:yt,subscribe:!0})],ct.prototype,"configContext",void 0);Ne([T(),I({context:nt,subscribe:!0})],ct.prototype,"_testContext",void 0);Ne([T(),I({context:eo,subscribe:!0})],ct.prototype,"_sessionContext",void 0);Ne([T(),I({context:_o,subscribe:!0})],ct.prototype,"_itemFacts",void 0);Ne([T(),Q({context:lt})],ct.prototype,"computedContext",void 0);Ne([p({type:Boolean,attribute:"auto-score-items"})],ct.prototype,"autoScoreItems",void 0);var xl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[$e,yh]}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(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){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return De}};xl([p({type:Boolean,reflect:!0,attribute:"disabled"})],lr.prototype,"_internalDisabled",void 0);xl([I({context:lt,subscribe:!0})],lr.prototype,"computedContext",void 0);xl([N("computedContext")],lr.prototype,"_handleTestElementChange",null);var wl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},cr=class extends E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=$e}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let e=this.computedContext?.testParts.find(r=>r.active)?.navigationMode??"nonlinear";this._internalDisabled=e==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return De}};wl([p({type:Boolean,reflect:!0,attribute:"disabled"})],cr.prototype,"_internalDisabled",void 0);wl([I({context:lt,subscribe:!0})],cr.prototype,"computedContext",void 0);wl([N("computedContext")],cr.prototype,"_handleTestElementChange",null);var No=class extends E{static{this.styles=$e}constructor(){super(),this.addEventListener("click",()=>F(this,"qc-test-submit",{}))}render(){return De}};var xh=[{tag:"test-submit",ctor:No}];var wh=[{tag:"qti-assessment-item-ref",ctor:wt},{tag:"qti-assessment-section",ctor:Gt},{tag:"qti-assessment-test",ctor:or},{tag:"qti-branch-rule",ctor:de},{tag:"qti-item-session-control",ctor:Pt},{tag:"qti-number-presented",ctor:Ui},{tag:"qti-number-selected",ctor:oo},{tag:"qti-outcome-processing",ctor:ao},{tag:"qti-pre-condition",ctor:so},{tag:"qti-test",ctor:Pe},{tag:"qti-test-feedback",ctor:Zi},{tag:"qti-test-part",ctor:Me},{tag:"qti-test-variables",ctor:tn},{tag:"test-container",ctor:kt},{tag:"test-end-attempt",ctor:ge},{tag:"test-navigation",ctor:ct},{tag:"test-next",ctor:lr},{tag:"test-prev",ctor:cr},...xh];for(let{tag:o,ctor:t}of wh)customElements.get(o)||customElements.define(o,t);var DS=(o,t)=>o?.plugins?.[t];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},Nt=class extends E{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(Po),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
|
|
6427
|
+
`;var on=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qh=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?qh(e.host):void 0},ge=class extends E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=$e}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||qh(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(l=>l.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 De}};on([I({context:lt,subscribe:!0}),p({attribute:!1})],ge.prototype,"computedContext",void 0);on([p({type:Boolean,reflect:!0,attribute:"disabled"})],ge.prototype,"_internalDisabled",void 0);on([p({reflect:!0})],ge.prototype,"item",void 0);on([p({type:Boolean,reflect:!0,attribute:"require-answer"})],ge.prototype,"requireAnswer",void 0);on([N("computedContext")],ge.prototype,"_handleTestElementChange",null);function ql(o){return{nodeType:o.nodeType,localName:o.localName,get childNodes(){return Array.from(o.children,ql)},getAttribute:t=>o.getAttribute(t)??(t==="title"?o.getAttribute("data-title"):null)}}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},Km=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),ct=class extends E{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=Km())}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:Ee,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.#l(t)??null,this.#f=new Map,this.#m=[],this.#y=new WeakSet,B(this,"qc-test-loaded",this.#u.bind(this)),md(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.#c.bind(this)),B(this,"qc-test-update-outcome",this.#d.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=this.#q(e);this.#s.set(e.identifier,r);let i=this.computedItemFor(e.identifier),n=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,this.#w(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)}#l(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}#c(t){let e=t.detail?.itemId,r=e?this.#l(e):this.activeAssessmentItem;if(!r)return;let i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#d(t){let e=this.#l(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#h(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}}}render(){return v`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#r({QTI_CONTEXT:{...i,testIdentifier:this.#o.identifier,environmentIdentifier:i.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=this.#g(i);Object.keys(n).length>0&&this.#r({QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let r=Ed(ql(this.#o));this.#f=new Map(r.testParts.flatMap(i=>co(i.sections).map(n=>[n.identifier,ho(n.content).map(s=>s.identifier)]))),this.#m=r.testParts.flatMap(i=>ho(i.sections)),this.computedContext={itemElement:this.#p,identifier:r.identifier,title:r.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:r.testParts.map(i=>({active:!1,identifier:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,allowSkipping:i.sessionControl.allowSkipping,sections:co(i.sections).map(n=>({active:!1,identifier:n.identifier,title:n.title,allowSkipping:n.sessionControl.allowSkipping,items:_d(n).map(s=>({...this.initContext?.find(a=>a.identifier===s.identifier),active:!1,identifier:s.identifier,categories:s.categories,href:s.href,variables:[],sessionControl:{...s.sessionControl}}))}))}))}}#f;#m;#b(){let t=1;return new Map(this.#m.map(e=>[e.identifier,e.categories.includes(this.configContext?.infoItemCategory)?null: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",l=n.textContent?.trim()||"";if(s){let c=l;switch(a){case"integer":c=parseInt(l,10);break;case"float":case"duration":c=parseFloat(l);break;case"boolean":c=l.toLowerCase()==="true";break;default:c=l;break}e[s]=c}}),e}#v(t){let e=this._itemFacts?.get(t);if(!e)return{};let{identifier:r,...i}=e;return{...i,assessmentItemIdentifier:r}}willUpdate(t){if(!this.computedContext)return;let e=this.#b();this.computedContext={...this.computedContext,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(r=>({...r,active:this._sessionContext?.navPartId===r.identifier||!1,sections:r.sections.map(i=>({...i,active:this._sessionContext?.navSectionId===i.identifier||!1,completed:(this.#f.get(i.identifier)??i.items.map(n=>n.identifier)).every(n=>this._testContext.items.find(s=>s.identifier===n)?.variables.find(s=>s.identifier==="completionStatus")?.value==="completed"),items:i.items.map(n=>{let s=this._testContext?.items.find(C=>C.identifier===n.identifier),a={...n,...this.#v(n.identifier),...s,...this.initContext?.find(C=>C.identifier===n.identifier)},l=a.variables?.find(C=>C.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(C=>C.identifier==="completionStatus")?.value,h=a.variables?.find(C=>C.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(C=>C.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(C=>C.type==="response"&&C.identifier!=="numAttempts")||[]).every(C=>{if(C.value===void 0||C.value===null)return!0;let k;switch(C.baseType){case"integer":case"float":case"duration":k="0";break;case"boolean":k="false";break;default:k="";break}let R=C.defaultValue??k;if(Array.isArray(C.value)){let $=Array.isArray(R)?R:[R];return C.value.length===$.length&&C.value.every((V,L)=>V===$[L])}return C.value===R}),g=e.get(n.identifier)??null,b=n.variables?.find(C=>C.identifier=="MAXSCORE")?.value,q=b==null?null:parseFloat(b?.toString()),_=this.#s.get(a.identifier);_===void 0&&(_=s?this.#q(s):"unscored",f>0&&this.#s.set(a.identifier,_));let A=this.#w(f,_,a.sessionControl?.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:y,isDefaultResponse:u,maxScore:q,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}updated(t){super.updated(t),this.#x()}#y;#x(){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.#C(t.get(e.identifier),r);i&&!r.disabled?(r.disabled=!0,this.#y.add(r)):!i&&this.#y.has(r)&&(this.#y.delete(r),r.disabled=!1)}}#C(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}#w(t,e,r,i,n){if(t===0)return!1;if(i)return n==="completed";if(e!=="suboptimal")return!0;let s=r??1;return s>0&&t>=s}#q(t){let e=t.variables??[],r=this.#k(e,"SCORE"),i=this.#k(e,"MAXSCORE");if(r!==null&&i!==null)return r>=i?"optimal":"suboptimal";let n=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return n.length===0?"unscored":n.every(a=>{let l=a.correctResponse,c=a.value;return c==null?!1:Array.isArray(l)&&Array.isArray(c)?l.length===c.length&&l.every(d=>c.includes(d)):Array.isArray(l)||Array.isArray(c)?!1:l===c})?"optimal":"suboptimal"}#k(t,e){let r=t?.find(n=>n.identifier===e)?.value;if(r==null||Array.isArray(r))return null;let i=parseFloat(r.toString());return Number.isNaN(i)?null:i}};Ne([p({type:String})],ct.prototype,"identifier",void 0);Ne([T()],ct.prototype,"initContext",void 0);Ne([T(),I({context:yt,subscribe:!0})],ct.prototype,"configContext",void 0);Ne([T(),I({context:nt,subscribe:!0})],ct.prototype,"_testContext",void 0);Ne([T(),I({context:eo,subscribe:!0})],ct.prototype,"_sessionContext",void 0);Ne([T(),I({context:_o,subscribe:!0})],ct.prototype,"_itemFacts",void 0);Ne([T(),Q({context:lt})],ct.prototype,"computedContext",void 0);Ne([p({type:Boolean,attribute:"auto-score-items"})],ct.prototype,"autoScoreItems",void 0);var xl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[$e,yh]}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(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 De}};xl([p({type:Boolean,reflect:!0,attribute:"disabled"})],lr.prototype,"_internalDisabled",void 0);xl([I({context:lt,subscribe:!0})],lr.prototype,"computedContext",void 0);xl([N("computedContext")],lr.prototype,"_handleTestElementChange",null);var wl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},cr=class extends E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=$e}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let 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 De}};wl([p({type:Boolean,reflect:!0,attribute:"disabled"})],cr.prototype,"_internalDisabled",void 0);wl([I({context:lt,subscribe:!0})],cr.prototype,"computedContext",void 0);wl([N("computedContext")],cr.prototype,"_handleTestElementChange",null);var No=class extends E{static{this.styles=$e}constructor(){super(),this.addEventListener("click",()=>j(this,"qc-test-submit",{}))}render(){return De}};var xh=[{tag:"test-submit",ctor:No}];var wh=[{tag:"qti-assessment-item-ref",ctor:wt},{tag:"qti-assessment-section",ctor:Gt},{tag:"qti-assessment-test",ctor:or},{tag:"qti-branch-rule",ctor:de},{tag:"qti-item-session-control",ctor:Pt},{tag:"qti-number-presented",ctor:Ui},{tag:"qti-number-selected",ctor:oo},{tag:"qti-outcome-processing",ctor:ao},{tag:"qti-pre-condition",ctor:so},{tag:"qti-test",ctor:Pe},{tag:"qti-test-feedback",ctor:Zi},{tag:"qti-test-part",ctor:Me},{tag:"qti-test-variables",ctor:tn},{tag:"test-container",ctor:kt},{tag:"test-end-attempt",ctor:ge},{tag:"test-navigation",ctor:ct},{tag:"test-next",ctor:lr},{tag:"test-prev",ctor:cr},...xh];for(let{tag:o,ctor:t}of wh)customElements.get(o)||customElements.define(o,t);var DS=(o,t)=>o?.plugins?.[t];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},Nt=class extends E{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(Po),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
|
|
6428
6428
|
${this.#t}
|
|
6429
6429
|
<slot></slot>
|
|
6430
6430
|
${Mo(this.itemDoc,v`<span>Loading...</span>`)}
|
|
@@ -7147,7 +7147,7 @@ CES.load();
|
|
|
7147
7147
|
${this._errorMessage}
|
|
7148
7148
|
</div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#l()].filter(Boolean).map(i=>new URL(i,window.location.href).toString()),r=this.#p();return r&&e.push(r),[...new Set(e)]}#l(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#c(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 l=await a.text();return{url:s,baseUrl:n,text:l}}return{url:s,baseUrl:n}}}catch{}}return{url:"",baseUrl:null}}};un([p({type:String,attribute:"data"})],ve.prototype,"data",void 0);un([p({type:String,attribute:"data-base-item"})],ve.prototype,"baseItemUrl",void 0);un([p({type:String,attribute:"data-base-ref"})],ve.prototype,"baseRefUrl",void 0);un([p({type:String,attribute:"id"})],ve.prototype,"id",void 0);un([T()],ve.prototype,"_errorMessage",void 0);var Ko=[{tag:"qti-custom-interaction",ctor:ve}];var gp=[M];var mn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 E{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=gp}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"}}))}};mn([p({type:String,attribute:"response-identifier"})],ye.prototype,"responseIdentifier",void 0);mn([p({reflect:!0,type:Boolean})],ye.prototype,"disabled",void 0);mn([I({context:
|
|
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"}}))}};mn([p({type:String,attribute:"response-identifier"})],ye.prototype,"responseIdentifier",void 0);mn([p({reflect:!0,type:Boolean})],ye.prototype,"disabled",void 0);mn([I({context:F,subscribe:!0}),T()],ye.prototype,"_itemContext",void 0);mn([p({type:String,attribute:"count-attempt"})],ye.prototype,"countAttempt",void 0);mn([p({type:String})],ye.prototype,"title",void 0);var Zo=[{tag:"qti-end-attempt-interaction",ctor:ye}];var bp=[M,w`
|
|
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 {
|
|
@@ -10716,7 +10716,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
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([T()],G.prototype,"_errorMessage",void 0);St([I({context:
|
|
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([I({context:F,subscribe:!0}),T()],G.prototype,"context",void 0);St([I({context:qt,subscribe:!0}),T()],G.prototype,"qtiContext",void 0);St([p({attribute:"response",reflect:!1,converter:Xt({emptyAs:null})})],G.prototype,"response",void 0);var gs=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
|
|
|
@@ -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 ks=[{tag:"qti-upload-interaction",ctor:Cs}];var tu=[...Jo,...Yo,...Ko,...Zo,...ts,...es,...is,...ns,...os,...ss,...as,...ls,...ds,...ps,...us,...bs,...ys,...qs,...xs,...ws,...ks,...Xh];for(let{tag:o,ctor:t}of tu)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Jo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Yo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ko)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Zo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ts)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of is)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 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 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 bs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ys)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of qs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of xs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ws)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ks)customElements.get(o)||customElements.define(o,t);var PN=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await Nd().load(`${o}`).then(a=>a.assessmentTest()),r=await Ur().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Ur().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}},ON=async o=>Jt().load(o).then(t=>t.htmlDoc().firstElementChild);var Es=class extends Xf(Qt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Xf(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 eu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ni=class extends S{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}};eu([p({type:Number})],ni.prototype,"min",void 0);eu([p({type:Number})],ni.prototype,"max",void 0);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},yn=class extends S{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Gf([p({type:String,attribute:"base-type"})],yn.prototype,"baseType",void 0);var Ss=class extends S{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 As=class extends S{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let i=this.#t(t.value),n=this.#t(e.value);return n.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(i,n,r):this.#r(i,n,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return Y.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let i=[...t];return e.every(n=>{let s=i.findIndex(a=>this.#e(a,n,r));return s===-1?!1:(i.splice(s,1),!0)})}#i(t,e,r){for(let i=0;i+e.length<=t.length;i++)if(e.every((n,s)=>this.#e(t[i+s],n,r)))return!0;return!1}};var _s=class extends S{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 jl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 S{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)}};jl([p({type:String})],Er.prototype,"identifier",void 0);jl([I({context:j,subscribe:!0}),T()],Er.prototype,"context",void 0);jl([T(),I({context:nt,subscribe:!0})],Er.prototype,"_testContext",void 0);var Ts=class extends S{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 Is=class extends S{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 Rs=class extends S{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 Ms=class extends S{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 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},qn=class extends S{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}};Jf([p({type:String,attribute:"rounding-mode"})],qn.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},oi=class extends S{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?Y.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(l=>parseFloat(l));if(r.length===0||r.some(l=>Number.isNaN(l)))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"})],oi.prototype,"toleranceMode",void 0);ru([p({type:String})],oi.prototype,"tolerance",void 0);var J=class extends E{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var Ps=class extends J{process(){throw new Or}};var Os=class extends J{process(){throw new Dr}};var Ds=class extends S{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],r=e?.cardinality==="record"||e?.baseType==="record";if(r&&(e.value===null||e.value===void 0))return null;if(!e||!r||!ce(e.value))return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i==null?null:(this.#t=e.fieldBaseTypes?.[t]??io(Array.isArray(i)?i[0]:i),i)}};var $s=class extends S{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 Ns=class extends S{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 Ls=class extends Qt{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 Yf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},xn=class extends S{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)}};Yf([p({type:String})],xn.prototype,"n",void 0);var iu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},si=class extends S{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),l=Math.max(r,n),c=Math.min(i,s),d=Math.max(i,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#n(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[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],l=e[n],c=e[n+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(r=!r),n=i}return r}};iu([p({type:String})],si.prototype,"shape",void 0);iu([p({type:String})],si.prototype,"coords",void 0);var Vs=class extends S{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 S{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 Fs=class extends S{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 S{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 Bs=class extends S{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 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},ai=class extends J{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}};nu([p({type:String})],ai.prototype,"identifier",void 0);nu([I({context:j,subscribe:!0}),T()],ai.prototype,"context",void 0);var Us=class extends S{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 Hs=class extends Qt{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 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},wn=class extends S{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=(Array.isArray(t.value)?t.value:[t.value]).filter(s=>typeof s=="string"&&s.length>0);if(r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,n=new Set;for(let s of r)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;if(Y.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){i+=a.mappedValue??0,n.add(a.coords);break}}return n.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Kf([p({type:String})],wn.prototype,"identifier",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},Cn=class extends S{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(l=>t.baseType==="string"&&!l.caseSensitive?Y.compareSingleValues(l.mapKey.toLowerCase(),n.toLowerCase(),t.baseType):Y.compareSingleValues(l.mapKey,n,t.baseType)),a=s.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?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}};Zf([p({type:String})],Cn.prototype,"identifier",void 0);var Ws=class o extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):Y.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!Y.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let n=null,s=[...t.value];for(let a of s)if(Y.compareSingleValues(i,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var 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},kn=class extends S{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}}};tg([p({type:String})],kn.prototype,"name",void 0);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},En=class extends S{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}}};eg([p({type:String})],En.prototype,"name",void 0);var Qs=class extends S{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 Xs=class extends S{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 Gs=class extends S{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 Js=class extends S{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 Ys=class extends S{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var Ks=class extends S{getResult(){return null}};var Zs=class extends Qt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),n=!1;if(typeof i=="string")if(i==="true")n=!0;else if(i==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(n=i);return n}).some(e=>typeof e=="boolean"&&e)}};var ta=class extends S{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 ea=class extends E{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},li=class extends ea{shouldProcess(){return!0}getSubRules(){return[...this.children]}},ci=class extends ea{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}},di=class extends J{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var ra=class extends di{};var hi=class extends ci{};var ia=class extends hi{};var na=class extends li{};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},Sn=class extends S{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}}}};rg([p({type:String})],Sn.prototype,"pattern",void 0);var oa=class extends S{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))),l=Math.max(0,14-a),c=Math.pow(10,l);s=Math.round(s*c)/c}return s}};var ig=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function ng(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function An(o,t){return ng(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 su(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?ou(An(o,e-1)):ou(o.toFixed(Math.max(0,e-1-r)))}function og(o,t,e,r){if(o==="s"||o==="c"){let c=o==="c"?r.slice(0,1):r;return e===void 0?c:c.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=An(n,e??6);break;case"E":s=An(n,e??6).toUpperCase();break;case"g":s=su(n,e??6);break;case"G":s=su(n,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function sg(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 au(o,t){return o.replace(ig,(e,r,i,n,s,a)=>r?"%":sg(og(a,i??"",s===void 0?void 0:Number(s),t),i??"",n===void 0?0:Number(n)))}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},vt=class extends E{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 au(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 An(i)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};qe([p({type:String})],vt.prototype,"identifier",void 0);qe([p({type:String})],vt.prototype,"format",void 0);qe([p({type:Number})],vt.prototype,"base",void 0);qe([p({type:Number})],vt.prototype,"index",void 0);qe([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);qe([p({type:String})],vt.prototype,"field",void 0);qe([p({type:String})],vt.prototype,"delimiter",void 0);qe([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);qe([I({context:j,subscribe:!0}),T()],vt.prototype,"context",void 0);var sa=class extends S{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 Fl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Sr=class extends S{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)]}};Fl([p({type:Number})],Sr.prototype,"min",void 0);Fl([p({type:Number})],Sr.prototype,"max",void 0);Fl([p({type:Number})],Sr.prototype,"step",void 0);var aa=class extends S{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 ag=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},zl=1e3,_n=class extends S{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>zl?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${zl} limit, truncating`),zl):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"}}};ag([p({type:String,attribute:"number-repeats"})],_n.prototype,"numberRepeats",void 0);var la=class extends di{};var pi=class extends ci{};var ca=class extends pi{};var da=class extends li{};var ha=class extends J{process(){for(let t of[...this.children])t.process()}};var lu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ui=class extends S{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}};lu([p({type:String,attribute:"rounding-mode"})],ui.prototype,"roundingMode",void 0);lu([p({type:Number})],ui.prototype,"figures",void 0);var pa=class extends S{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 ua=class extends J{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 Bl(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()??""}},Bl=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 ma=class extends J{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 Ul(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}},Ul=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 fa=class extends J{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 Hl(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()??""}},Hl=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 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},Tn=class extends S{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}};lg([p({type:String})],Tn.prototype,"name",void 0);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},In=class extends S{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return Y.compareSingleValues(i,n,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};cg([p({type:String,attribute:"case-sensitive"})],In.prototype,"caseSensitive",void 0);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},Rn=class extends S{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)}};dg([p({type:String,attribute:"case-sensitive"})],Rn.prototype,"caseSensitive",void 0);var ga=class extends hg(S){getResult(){return this.calculateChildren(Array.from(this.children))}};function hg(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 ba=class extends S{getResult(){return new Wl(Array.from(this.children)).calculate()}},Wl=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 va=class extends S{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 ya=class extends S{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var cu=[{tag:"qti-and",ctor:Es},{tag:"qti-any-n",ctor:ni},{tag:"qti-base-value",ctor:yn},{tag:"qti-container-size",ctor:Ss},{tag:"qti-contains",ctor:As},{tag:"qti-correct",ctor:_s},{tag:"qti-default",ctor:Er},{tag:"qti-delete",ctor:Ts},{tag:"qti-divide",ctor:Is},{tag:"qti-duration-gte",ctor:Rs},{tag:"qti-duration-lt",ctor:Ms},{tag:"qti-equal",ctor:oi},{tag:"qti-equal-rounded",ctor:qn},{tag:"qti-exit-response",ctor:Ps},{tag:"qti-exit-test",ctor:Os},{tag:"qti-field-value",ctor:Ds},{tag:"qti-gcd",ctor:$s},{tag:"qti-gt",ctor:Ns},{tag:"qti-gte",ctor:Ls},{tag:"qti-index",ctor:xn},{tag:"qti-inside",ctor:si},{tag:"qti-integer-divide",ctor:Vs},{tag:"qti-integer-modulus",ctor:js},{tag:"qti-integer-to-float",ctor:Fs},{tag:"qti-is-null",ctor:zs},{tag:"qti-lcm",ctor:Bs},{tag:"qti-lookup-outcome-value",ctor:ai},{tag:"qti-lt",ctor:Us},{tag:"qti-lte",ctor:Hs},{tag:"qti-map-response",ctor:Cn},{tag:"qti-map-response-point",ctor:wn},{tag:"qti-match",ctor:Ws},{tag:"qti-math-constant",ctor:kn},{tag:"qti-math-operator",ctor:En},{tag:"qti-max",ctor:Qs},{tag:"qti-member",ctor:Xs},{tag:"qti-min",ctor:Gs},{tag:"qti-multiple",ctor:Js},{tag:"qti-not",ctor:Ys},{tag:"qti-null",ctor:Ks},{tag:"qti-or",ctor:Zs},{tag:"qti-ordered",ctor:ta},{tag:"qti-outcome-condition",ctor:ra},{tag:"qti-outcome-else",ctor:na},{tag:"qti-outcome-else-if",ctor:ia},{tag:"qti-outcome-if",ctor:hi},{tag:"qti-pattern-match",ctor:Sn},{tag:"qti-power",ctor:oa},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:sa},{tag:"qti-random",ctor:aa},{tag:"qti-random-integer",ctor:Sr},{tag:"qti-repeat",ctor:_n},{tag:"qti-response-condition",ctor:la},{tag:"qti-response-else",ctor:da},{tag:"qti-response-else-if",ctor:ca},{tag:"qti-response-if",ctor:pi},{tag:"qti-response-processing-fragment",ctor:ha},{tag:"qti-round",ctor:pa},{tag:"qti-round-to",ctor:ui},{tag:"qti-rule",ctor:J},{tag:"qti-set-correct-response",ctor:ua},{tag:"qti-set-outcome-value",ctor:ma},{tag:"qti-set-template-value",ctor:fa},{tag:"qti-stats-operator",ctor:Tn},{tag:"qti-string-match",ctor:In},{tag:"qti-substring",ctor:Rn},{tag:"qti-subtract",ctor:ga},{tag:"qti-sum",ctor:ba},{tag:"qti-truncate",ctor:va},{tag:"qti-variable",ctor:ya}];for(let{tag:o,ctor:t}of cu)customElements.get(o)||customElements.define(o,t);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},Z;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(Z||(Z={}));var Ql=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 l=a.filter(d=>n.includes(d)).length,c=a.filter(d=>!n.includes(d)).length;return l===n.length&&c===0&&a.length===n.length?Z.Correct:l>0&&(l<n.length||c>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 l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){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 xe([p({attribute:"correct-response",reflect:!0,converter:Xt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),xe([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),xe([N("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),xe([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),xe([N("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),xe([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),xe([N("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),xe([T()],t.prototype,"_isFullCorrectResponse",void 0),xe([T()],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 ks=[{tag:"qti-upload-interaction",ctor:Cs}];var tu=[...Jo,...Yo,...Ko,...Zo,...ts,...es,...is,...ns,...os,...ss,...as,...ls,...ds,...ps,...us,...bs,...ys,...qs,...xs,...ws,...ks,...Xh];for(let{tag:o,ctor:t}of tu)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Jo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Yo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ko)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Zo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ts)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of is)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 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 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 bs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ys)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of qs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of xs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ws)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ks)customElements.get(o)||customElements.define(o,t);var PN=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await Nd().load(`${o}`).then(a=>a.assessmentTest()),r=await Ur().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Ur().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}},ON=async o=>Jt().load(o).then(t=>t.htmlDoc().firstElementChild);var Es=class extends Xf(Qt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Xf(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 eu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ni=class extends S{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}};eu([p({type:Number})],ni.prototype,"min",void 0);eu([p({type:Number})],ni.prototype,"max",void 0);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},yn=class extends S{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Gf([p({type:String,attribute:"base-type"})],yn.prototype,"baseType",void 0);var Ss=class extends S{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 As=class extends S{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let i=this.#t(t.value),n=this.#t(e.value);return n.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(i,n,r):this.#r(i,n,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return Y.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let i=[...t];return e.every(n=>{let s=i.findIndex(a=>this.#e(a,n,r));return s===-1?!1:(i.splice(s,1),!0)})}#i(t,e,r){for(let i=0;i+e.length<=t.length;i++)if(e.every((n,s)=>this.#e(t[i+s],n,r)))return!0;return!1}};var _s=class extends S{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 jl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(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 S{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)}};jl([p({type:String})],Er.prototype,"identifier",void 0);jl([I({context:F,subscribe:!0}),T()],Er.prototype,"context",void 0);jl([T(),I({context:nt,subscribe:!0})],Er.prototype,"_testContext",void 0);var Ts=class extends S{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 Is=class extends S{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 Rs=class extends S{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 Ms=class extends S{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 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},qn=class extends S{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}};Jf([p({type:String,attribute:"rounding-mode"})],qn.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},oi=class extends S{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?Y.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(l=>parseFloat(l));if(r.length===0||r.some(l=>Number.isNaN(l)))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"})],oi.prototype,"toleranceMode",void 0);ru([p({type:String})],oi.prototype,"tolerance",void 0);var J=class extends E{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var Ps=class extends J{process(){throw new Or}};var Os=class extends J{process(){throw new Dr}};var Ds=class extends S{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],r=e?.cardinality==="record"||e?.baseType==="record";if(r&&(e.value===null||e.value===void 0))return null;if(!e||!r||!ce(e.value))return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i==null?null:(this.#t=e.fieldBaseTypes?.[t]??io(Array.isArray(i)?i[0]:i),i)}};var $s=class extends S{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 Ns=class extends S{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 Ls=class extends Qt{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 Yf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},xn=class extends S{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)}};Yf([p({type:String})],xn.prototype,"n",void 0);var iu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},si=class extends S{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),l=Math.max(r,n),c=Math.min(i,s),d=Math.max(i,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#n(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[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],l=e[n],c=e[n+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(r=!r),n=i}return r}};iu([p({type:String})],si.prototype,"shape",void 0);iu([p({type:String})],si.prototype,"coords",void 0);var Vs=class extends S{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 S{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 Fs=class extends S{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 S{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 Bs=class extends S{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 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},ai=class extends J{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}};nu([p({type:String})],ai.prototype,"identifier",void 0);nu([I({context:F,subscribe:!0}),T()],ai.prototype,"context",void 0);var Us=class extends S{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 Hs=class extends Qt{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 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},wn=class extends S{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=(Array.isArray(t.value)?t.value:[t.value]).filter(s=>typeof s=="string"&&s.length>0);if(r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,n=new Set;for(let s of r)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;if(Y.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){i+=a.mappedValue??0,n.add(a.coords);break}}return n.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Kf([p({type:String})],wn.prototype,"identifier",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},Cn=class extends S{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(l=>t.baseType==="string"&&!l.caseSensitive?Y.compareSingleValues(l.mapKey.toLowerCase(),n.toLowerCase(),t.baseType):Y.compareSingleValues(l.mapKey,n,t.baseType)),a=s.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?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}};Zf([p({type:String})],Cn.prototype,"identifier",void 0);var Ws=class o extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):Y.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!Y.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let n=null,s=[...t.value];for(let a of s)if(Y.compareSingleValues(i,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var 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},kn=class extends S{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}}};tg([p({type:String})],kn.prototype,"name",void 0);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},En=class extends S{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}}};eg([p({type:String})],En.prototype,"name",void 0);var Qs=class extends S{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 Xs=class extends S{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 Gs=class extends S{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 Js=class extends S{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 Ys=class extends S{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var Ks=class extends S{getResult(){return null}};var Zs=class extends Qt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),n=!1;if(typeof i=="string")if(i==="true")n=!0;else if(i==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(n=i);return n}).some(e=>typeof e=="boolean"&&e)}};var ta=class extends S{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 ea=class extends E{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},li=class extends ea{shouldProcess(){return!0}getSubRules(){return[...this.children]}},ci=class extends ea{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}},di=class extends J{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var ra=class extends di{};var hi=class extends ci{};var ia=class extends hi{};var na=class extends li{};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},Sn=class extends S{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}}}};rg([p({type:String})],Sn.prototype,"pattern",void 0);var oa=class extends S{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))),l=Math.max(0,14-a),c=Math.pow(10,l);s=Math.round(s*c)/c}return s}};var ig=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function ng(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function An(o,t){return ng(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 su(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?ou(An(o,e-1)):ou(o.toFixed(Math.max(0,e-1-r)))}function og(o,t,e,r){if(o==="s"||o==="c"){let c=o==="c"?r.slice(0,1):r;return e===void 0?c:c.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=An(n,e??6);break;case"E":s=An(n,e??6).toUpperCase();break;case"g":s=su(n,e??6);break;case"G":s=su(n,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function sg(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 au(o,t){return o.replace(ig,(e,r,i,n,s,a)=>r?"%":sg(og(a,i??"",s===void 0?void 0:Number(s),t),i??"",n===void 0?0:Number(n)))}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},vt=class extends E{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 au(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 An(i)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};qe([p({type:String})],vt.prototype,"identifier",void 0);qe([p({type:String})],vt.prototype,"format",void 0);qe([p({type:Number})],vt.prototype,"base",void 0);qe([p({type:Number})],vt.prototype,"index",void 0);qe([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);qe([p({type:String})],vt.prototype,"field",void 0);qe([p({type:String})],vt.prototype,"delimiter",void 0);qe([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);qe([I({context:F,subscribe:!0}),T()],vt.prototype,"context",void 0);var sa=class extends S{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 Fl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Sr=class extends S{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)]}};Fl([p({type:Number})],Sr.prototype,"min",void 0);Fl([p({type:Number})],Sr.prototype,"max",void 0);Fl([p({type:Number})],Sr.prototype,"step",void 0);var aa=class extends S{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 ag=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},zl=1e3,_n=class extends S{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>zl?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${zl} limit, truncating`),zl):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"}}};ag([p({type:String,attribute:"number-repeats"})],_n.prototype,"numberRepeats",void 0);var la=class extends di{};var pi=class extends ci{};var ca=class extends pi{};var da=class extends li{};var ha=class extends J{process(){for(let t of[...this.children])t.process()}};var lu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ui=class extends S{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}};lu([p({type:String,attribute:"rounding-mode"})],ui.prototype,"roundingMode",void 0);lu([p({type:Number})],ui.prototype,"figures",void 0);var pa=class extends S{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 ua=class extends J{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 Bl(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()??""}},Bl=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 ma=class extends J{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 Ul(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}},Ul=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 fa=class extends J{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 Hl(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()??""}},Hl=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 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},Tn=class extends S{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}};lg([p({type:String})],Tn.prototype,"name",void 0);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},In=class extends S{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return Y.compareSingleValues(i,n,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};cg([p({type:String,attribute:"case-sensitive"})],In.prototype,"caseSensitive",void 0);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},Rn=class extends S{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)}};dg([p({type:String,attribute:"case-sensitive"})],Rn.prototype,"caseSensitive",void 0);var ga=class extends hg(S){getResult(){return this.calculateChildren(Array.from(this.children))}};function hg(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 ba=class extends S{getResult(){return new Wl(Array.from(this.children)).calculate()}},Wl=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 va=class extends S{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 ya=class extends S{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var cu=[{tag:"qti-and",ctor:Es},{tag:"qti-any-n",ctor:ni},{tag:"qti-base-value",ctor:yn},{tag:"qti-container-size",ctor:Ss},{tag:"qti-contains",ctor:As},{tag:"qti-correct",ctor:_s},{tag:"qti-default",ctor:Er},{tag:"qti-delete",ctor:Ts},{tag:"qti-divide",ctor:Is},{tag:"qti-duration-gte",ctor:Rs},{tag:"qti-duration-lt",ctor:Ms},{tag:"qti-equal",ctor:oi},{tag:"qti-equal-rounded",ctor:qn},{tag:"qti-exit-response",ctor:Ps},{tag:"qti-exit-test",ctor:Os},{tag:"qti-field-value",ctor:Ds},{tag:"qti-gcd",ctor:$s},{tag:"qti-gt",ctor:Ns},{tag:"qti-gte",ctor:Ls},{tag:"qti-index",ctor:xn},{tag:"qti-inside",ctor:si},{tag:"qti-integer-divide",ctor:Vs},{tag:"qti-integer-modulus",ctor:js},{tag:"qti-integer-to-float",ctor:Fs},{tag:"qti-is-null",ctor:zs},{tag:"qti-lcm",ctor:Bs},{tag:"qti-lookup-outcome-value",ctor:ai},{tag:"qti-lt",ctor:Us},{tag:"qti-lte",ctor:Hs},{tag:"qti-map-response",ctor:Cn},{tag:"qti-map-response-point",ctor:wn},{tag:"qti-match",ctor:Ws},{tag:"qti-math-constant",ctor:kn},{tag:"qti-math-operator",ctor:En},{tag:"qti-max",ctor:Qs},{tag:"qti-member",ctor:Xs},{tag:"qti-min",ctor:Gs},{tag:"qti-multiple",ctor:Js},{tag:"qti-not",ctor:Ys},{tag:"qti-null",ctor:Ks},{tag:"qti-or",ctor:Zs},{tag:"qti-ordered",ctor:ta},{tag:"qti-outcome-condition",ctor:ra},{tag:"qti-outcome-else",ctor:na},{tag:"qti-outcome-else-if",ctor:ia},{tag:"qti-outcome-if",ctor:hi},{tag:"qti-pattern-match",ctor:Sn},{tag:"qti-power",ctor:oa},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:sa},{tag:"qti-random",ctor:aa},{tag:"qti-random-integer",ctor:Sr},{tag:"qti-repeat",ctor:_n},{tag:"qti-response-condition",ctor:la},{tag:"qti-response-else",ctor:da},{tag:"qti-response-else-if",ctor:ca},{tag:"qti-response-if",ctor:pi},{tag:"qti-response-processing-fragment",ctor:ha},{tag:"qti-round",ctor:pa},{tag:"qti-round-to",ctor:ui},{tag:"qti-rule",ctor:J},{tag:"qti-set-correct-response",ctor:ua},{tag:"qti-set-outcome-value",ctor:ma},{tag:"qti-set-template-value",ctor:fa},{tag:"qti-stats-operator",ctor:Tn},{tag:"qti-string-match",ctor:In},{tag:"qti-substring",ctor:Rn},{tag:"qti-subtract",ctor:ga},{tag:"qti-sum",ctor:ba},{tag:"qti-truncate",ctor:va},{tag:"qti-variable",ctor:ya}];for(let{tag:o,ctor:t}of cu)customElements.get(o)||customElements.define(o,t);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},Z;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(Z||(Z={}));var Ql=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 l=a.filter(d=>n.includes(d)).length,c=a.filter(d=>!n.includes(d)).length;return l===n.length&&c===0&&a.length===n.length?Z.Correct:l>0&&(l<n.length||c>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 l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){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 xe([p({attribute:"correct-response",reflect:!0,converter:Xt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),xe([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),xe([N("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),xe([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),xe([N("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),xe([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),xe([N("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),xe([T()],t.prototype,"_isFullCorrectResponse",void 0),xe([T()],t.prototype,"_correctResponse",void 0),t};var st=w`
|
|
11276
11276
|
/* Nothing at all until the item judges this element. */
|
|
11277
11277
|
[part~='correction'] {
|
|
11278
11278
|
display: none;
|
|
@@ -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,Ar as ChoiceCorrectionMixin,Ql as CorrectResponseMixin,Z as Correctness,Xa as CustomStateSetShim,Ga as INITIAL_SESSION_CONTEXT,Ja as INITIAL_TEST_CONTEXT,D as Interaction,Za as IsNullOrUndefined,Nt as ItemContainer,Mn as ItemCorrectResponseMode,sn as ItemPrintVariables,Ge as ItemShowCandidateCorrection,Je as ItemShowCorrectResponse,Ch as ItemViewMixin,ud as PUBLIC_ITEM_EVENTS,nn as QTI_TEST_STATE_VERSION,Es as QtiAnd,ni as QtiAnyN,mt as QtiAssessmentItem,hu as QtiAssessmentItemCorrection,wt as QtiAssessmentItemRef,Gt as QtiAssessmentSection,lo as QtiAssessmentStimulus,Hr as QtiAssessmentStimulusRef,ul as QtiAssessmentStimulusRefConnectedEvent,or as QtiAssessmentTest,Jr as QtiAssociableHotspot,vr as QtiAssociateInteraction,rc as QtiAssociateInteractionCorrection,yn as QtiBaseValue,de as QtiBranchRule,yr as QtiChoiceInteraction,ic as QtiChoiceInteractionCorrection,go as QtiCompanionMaterialsInfo,Qt as QtiConditionExpression,Ss as QtiContainerSize,As as QtiContains,Qi as QtiContentBody,Wr as QtiContextDeclaration,_s as QtiCorrect,ve as QtiCustomInteraction,Xi as QtiCustomOperator,Er as QtiDefault,Ts as QtiDelete,Is as QtiDivide,Rs as QtiDurationGte,Ms as QtiDurationLt,ye as QtiEndAttemptInteraction,oi as QtiEqual,qn as QtiEqualRounded,Ps as QtiExitResponse,Or as QtiExitResponseSignal,Os as QtiExitTest,Dr as QtiExitTestSignal,S as QtiExpression,X as QtiExtendedTextInteraction,xa as QtiExtendedTextInteractionCorrection,ut as QtiFeedback,bo as QtiFeedbackBlock,vo as QtiFeedbackInline,Ds as QtiFieldValue,hr as QtiGap,an as QtiGapImg,ti as QtiGapMatchInteraction,nc as QtiGapMatchInteractionCorrection,Ve as QtiGapText,Jl as QtiGapTextCorrection,$s as QtiGcd,bt as QtiGraphicAssociateInteraction,oc as QtiGraphicAssociateInteractionCorrection,xr as QtiGraphicGapMatchInteraction,sc as QtiGraphicGapMatchInteractionCorrection,We as QtiGraphicOrderInteraction,ac as QtiGraphicOrderInteractionCorrection,Ns as QtiGt,Ls as QtiGte,ur as QtiHotspotChoice,qa as QtiHotspotChoiceCorrection,ei as QtiHotspotInteraction,lc as QtiHotspotInteractionCorrection,mr as QtiHottext,Yl as QtiHottextCorrection,ri as QtiHottextInteraction,cc as QtiHottextInteractionCorrection,xn as QtiIndex,ln as QtiInlineChoice,rt as QtiInlineChoiceInteraction,dc as QtiInlineChoiceInteractionCorrection,si as QtiInside,Vs as QtiIntegerDivide,js as QtiIntegerModulus,Fs as QtiIntegerToFloat,zs as QtiIsNull,be as QtiItem,yo as QtiItemBody,pu as QtiItemCorrection,Pt as QtiItemSessionControl,Bs as QtiLcm,ai as QtiLookupOutcomeValue,Us as QtiLt,Hs as QtiLte,Cn as QtiMapResponse,wn as QtiMapResponsePoint,Ws as QtiMatch,ee as QtiMatchInteraction,hc as QtiMatchInteractionCorrection,kn as QtiMathConstant,En as QtiMathOperator,Qs as QtiMax,hs as QtiMediaInteraction,Xs as QtiMember,Gs as QtiMin,Qr as QtiModalFeedback,Js as QtiMultiple,Ys as QtiNot,Ks as QtiNull,Ui as QtiNumberPresented,oo as QtiNumberSelected,Zs as QtiOr,Qe as QtiOrderInteraction,pc as QtiOrderInteractionCorrection,ta as QtiOrdered,ra as QtiOutcomeCondition,ue as QtiOutcomeDeclaration,na as QtiOutcomeElse,ia as QtiOutcomeElseIf,hi as QtiOutcomeIf,ao as QtiOutcomeProcessing,al as QtiOutcomeProcessingProcessor,Sn as QtiPatternMatch,G as QtiPortableCustomInteraction,uc as QtiPortableCustomInteractionCorrection,At as QtiPositionObjectInteraction,vs as QtiPositionObjectStage,oa as QtiPower,so as QtiPreCondition,vt as QtiPrintedVariable,sa as QtiProduct,Lo as QtiPrompt,aa as QtiRandom,Sr as QtiRandomInteger,_n as QtiRepeat,la as QtiResponseCondition,_e as QtiResponseDeclaration,da as QtiResponseElse,ca as QtiResponseElseIf,pi as QtiResponseIf,xo as QtiResponseProcessing,ha as QtiResponseProcessingFragment,pa as QtiRound,ui as QtiRoundTo,me as QtiRubricBlock,cd as QtiRuleElement,dt as QtiSelectPointInteraction,mc as QtiSelectPointInteractionCorrection,ua as QtiSetCorrectResponse,Bl as QtiSetCorrectResponseRule,ma as QtiSetOutcomeValue,Ul as QtiSetOutcomeValueRule,fa as QtiSetTemplateValue,Hl as QtiSetTemplateValueRule,Lt as QtiSimpleAssociableChoice,Kl as QtiSimpleAssociableChoiceCorrection,Vt as QtiSimpleChoice,Zl as QtiSimpleChoiceCorrection,_t as QtiSliderInteraction,fc as QtiSliderInteractionCorrection,Tn as QtiStatsOperator,In as QtiStringMatch,ko as QtiStylesheet,Rn as QtiSubstring,ga as QtiSubtract,ba as QtiSum,Wl as QtiSumExpression,Eo as QtiTemplateConstraint,fe as QtiTemplateDeclaration,So as QtiTemplateProcessing,Pe as QtiTest,mu as QtiTestCorrection,Zi as QtiTestFeedback,Me as QtiTestPart,tn as QtiTestVariables,fl as QtiTestVariablesExpression,ht as QtiTextEntryInteraction,gc as QtiTextEntryInteractionCorrection,va as QtiTruncate,Cs as QtiUploadInteraction,ya as QtiVariable,Pr as QtiVariableDeclaration,sd as STATE_ALIASES,Y as ScoringHelper,kt as TestContainer,ge as TestEndAttempt,ct as TestNavigation,uu as TestNavigationCorrection,lr as TestNext,cr as TestPrev,Ye as TestShowCorrectResponse,No as TestSubmit,Qv as asSeed,M as boxSizing,Zu as classifyCustomStateSupport,lt as computedContext,ke as computedItemContext,yt as configContext,Mt as convertNumberToUniversalFormat,st as correctionPart,ky as decimalSeparator,rl as dispatchDeclared,xt as dispatchPublic,Wt as dropRegion,dd as getCustomOperator,ON as getItemByUri,PN as getManifestInfo,ji as hasState,io as inferRecordFieldBaseType,zf as inlineScriptText,Bf as inlineStyleText,nd as installCustomStateSetFallback,Rr as interactionContext,ce as isRecordValue,em as isSeed,
|
|
11535
|
+
`}};export{K as CandidateCorrectionMixin,Ar as ChoiceCorrectionMixin,Ql as CorrectResponseMixin,Z as Correctness,Xa as CustomStateSetShim,Ga as INITIAL_SESSION_CONTEXT,Ja as INITIAL_TEST_CONTEXT,D as Interaction,Za as IsNullOrUndefined,Nt as ItemContainer,Mn as ItemCorrectResponseMode,sn as ItemPrintVariables,Ge as ItemShowCandidateCorrection,Je as ItemShowCorrectResponse,Ch as ItemViewMixin,ud as PUBLIC_ITEM_EVENTS,nn as QTI_TEST_STATE_VERSION,Es as QtiAnd,ni as QtiAnyN,mt as QtiAssessmentItem,hu as QtiAssessmentItemCorrection,wt as QtiAssessmentItemRef,Gt as QtiAssessmentSection,lo as QtiAssessmentStimulus,Hr as QtiAssessmentStimulusRef,ul as QtiAssessmentStimulusRefConnectedEvent,or as QtiAssessmentTest,Jr as QtiAssociableHotspot,vr as QtiAssociateInteraction,rc as QtiAssociateInteractionCorrection,yn as QtiBaseValue,de as QtiBranchRule,yr as QtiChoiceInteraction,ic as QtiChoiceInteractionCorrection,go as QtiCompanionMaterialsInfo,Qt as QtiConditionExpression,Ss as QtiContainerSize,As as QtiContains,Qi as QtiContentBody,Wr as QtiContextDeclaration,_s as QtiCorrect,ve as QtiCustomInteraction,Xi as QtiCustomOperator,Er as QtiDefault,Ts as QtiDelete,Is as QtiDivide,Rs as QtiDurationGte,Ms as QtiDurationLt,ye as QtiEndAttemptInteraction,oi as QtiEqual,qn as QtiEqualRounded,Ps as QtiExitResponse,Or as QtiExitResponseSignal,Os as QtiExitTest,Dr as QtiExitTestSignal,S as QtiExpression,X as QtiExtendedTextInteraction,xa as QtiExtendedTextInteractionCorrection,ut as QtiFeedback,bo as QtiFeedbackBlock,vo as QtiFeedbackInline,Ds as QtiFieldValue,hr as QtiGap,an as QtiGapImg,ti as QtiGapMatchInteraction,nc as QtiGapMatchInteractionCorrection,Ve as QtiGapText,Jl as QtiGapTextCorrection,$s as QtiGcd,bt as QtiGraphicAssociateInteraction,oc as QtiGraphicAssociateInteractionCorrection,xr as QtiGraphicGapMatchInteraction,sc as QtiGraphicGapMatchInteractionCorrection,We as QtiGraphicOrderInteraction,ac as QtiGraphicOrderInteractionCorrection,Ns as QtiGt,Ls as QtiGte,ur as QtiHotspotChoice,qa as QtiHotspotChoiceCorrection,ei as QtiHotspotInteraction,lc as QtiHotspotInteractionCorrection,mr as QtiHottext,Yl as QtiHottextCorrection,ri as QtiHottextInteraction,cc as QtiHottextInteractionCorrection,xn as QtiIndex,ln as QtiInlineChoice,rt as QtiInlineChoiceInteraction,dc as QtiInlineChoiceInteractionCorrection,si as QtiInside,Vs as QtiIntegerDivide,js as QtiIntegerModulus,Fs as QtiIntegerToFloat,zs as QtiIsNull,be as QtiItem,yo as QtiItemBody,pu as QtiItemCorrection,Pt as QtiItemSessionControl,Bs as QtiLcm,ai as QtiLookupOutcomeValue,Us as QtiLt,Hs as QtiLte,Cn as QtiMapResponse,wn as QtiMapResponsePoint,Ws as QtiMatch,ee as QtiMatchInteraction,hc as QtiMatchInteractionCorrection,kn as QtiMathConstant,En as QtiMathOperator,Qs as QtiMax,hs as QtiMediaInteraction,Xs as QtiMember,Gs as QtiMin,Qr as QtiModalFeedback,Js as QtiMultiple,Ys as QtiNot,Ks as QtiNull,Ui as QtiNumberPresented,oo as QtiNumberSelected,Zs as QtiOr,Qe as QtiOrderInteraction,pc as QtiOrderInteractionCorrection,ta as QtiOrdered,ra as QtiOutcomeCondition,ue as QtiOutcomeDeclaration,na as QtiOutcomeElse,ia as QtiOutcomeElseIf,hi as QtiOutcomeIf,ao as QtiOutcomeProcessing,al as QtiOutcomeProcessingProcessor,Sn as QtiPatternMatch,G as QtiPortableCustomInteraction,uc as QtiPortableCustomInteractionCorrection,At as QtiPositionObjectInteraction,vs as QtiPositionObjectStage,oa as QtiPower,so as QtiPreCondition,vt as QtiPrintedVariable,sa as QtiProduct,Lo as QtiPrompt,aa as QtiRandom,Sr as QtiRandomInteger,_n as QtiRepeat,la as QtiResponseCondition,_e as QtiResponseDeclaration,da as QtiResponseElse,ca as QtiResponseElseIf,pi as QtiResponseIf,xo as QtiResponseProcessing,ha as QtiResponseProcessingFragment,pa as QtiRound,ui as QtiRoundTo,me as QtiRubricBlock,cd as QtiRuleElement,dt as QtiSelectPointInteraction,mc as QtiSelectPointInteractionCorrection,ua as QtiSetCorrectResponse,Bl as QtiSetCorrectResponseRule,ma as QtiSetOutcomeValue,Ul as QtiSetOutcomeValueRule,fa as QtiSetTemplateValue,Hl as QtiSetTemplateValueRule,Lt as QtiSimpleAssociableChoice,Kl as QtiSimpleAssociableChoiceCorrection,Vt as QtiSimpleChoice,Zl as QtiSimpleChoiceCorrection,_t as QtiSliderInteraction,fc as QtiSliderInteractionCorrection,Tn as QtiStatsOperator,In as QtiStringMatch,ko as QtiStylesheet,Rn as QtiSubstring,ga as QtiSubtract,ba as QtiSum,Wl as QtiSumExpression,Eo as QtiTemplateConstraint,fe as QtiTemplateDeclaration,So as QtiTemplateProcessing,Pe as QtiTest,mu as QtiTestCorrection,Zi as QtiTestFeedback,Me as QtiTestPart,tn as QtiTestVariables,fl as QtiTestVariablesExpression,ht as QtiTextEntryInteraction,gc as QtiTextEntryInteractionCorrection,va as QtiTruncate,Cs as QtiUploadInteraction,ya as QtiVariable,Pr as QtiVariableDeclaration,sd as STATE_ALIASES,Y as ScoringHelper,kt as TestContainer,ge as TestEndAttempt,ct as TestNavigation,uu as TestNavigationCorrection,lr as TestNext,cr as TestPrev,Ye as TestShowCorrectResponse,No as TestSubmit,Qv as asSeed,M as boxSizing,Zu as classifyCustomStateSupport,lt as computedContext,ke as computedItemContext,yt as configContext,Mt as convertNumberToUniversalFormat,st as correctionPart,ky as decimalSeparator,rl as dispatchDeclared,xt as dispatchPublic,Wt as dropRegion,dd as getCustomOperator,ON as getItemByUri,PN as getManifestInfo,ji as hasState,io as inferRecordFieldBaseType,zf as inlineScriptText,Bf as inlineStyleText,nd as installCustomStateSetFallback,Rr as interactionContext,ce as isRecordValue,em as isSeed,F as itemContext,od as itemContextVariables,Py as iterResponseValues,il as listenDeclared,md as listenPublic,Oy as parsePair,$y as parsePoint,zi as parseResponseAttribute,xh as pluginElements,DS as pluginState,Xf as qtiAndMixin,qt as qtiContext,tu as qtiInteractionElements,hg as qtiSubtractMixin,Jt as qtiTransformItem,Nd as qtiTransformManifest,Ur as qtiTransformTest,Bi as readRecordFieldValues,zy as registerCustomOperator,ro as removeDoubleSlashes,Xt as responseAttributeConverter,Dy as serializePair,Ny as serializePoint,nr as serializeResponseAttribute,eo as sessionContext,z as setState,dh as stateFromContexts,nt as testContext,By as unregisterCustomOperator,U as validationMessage};
|
|
11536
11536
|
/*! Bundled license information:
|
|
11537
11537
|
|
|
11538
11538
|
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|