@citolab/qti-components 7.17.0 → 7.17.1
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 +14 -18
- package/custom-elements.json +21 -1627
- package/dist/{chunk-O4XIWHTF.js → chunk-3IHVFNP6.js} +5 -8
- package/dist/chunk-3IHVFNP6.js.map +1 -0
- package/dist/{chunk-W4SQRNWO.js → chunk-3PDF4K62.js} +2 -6
- package/dist/{chunk-W4SQRNWO.js.map → chunk-3PDF4K62.js.map} +1 -1
- package/dist/{chunk-352OTVTY.js → chunk-ERONHL4R.js} +35 -23
- package/dist/chunk-ERONHL4R.js.map +1 -0
- package/dist/{chunk-2DOYPVF5.js → chunk-LAMJZ533.js} +2 -2
- package/dist/elements.js +1 -1
- package/dist/index.js +4 -4
- package/dist/item.css +1 -5
- package/dist/item.js +2 -2
- package/dist/qti-components-jsx.d.ts +1173 -1173
- package/dist/test.d.ts +21 -21
- package/dist/test.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-352OTVTY.js.map +0 -1
- package/dist/chunk-O4XIWHTF.js.map +0 -1
- package/dist/vscode.css-custom-data.json +0 -11
- package/dist/vscode.html-custom-data.json +0 -960
- /package/dist/{chunk-2DOYPVF5.js.map → chunk-LAMJZ533.js.map} +0 -0
package/cdn/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var an=Object.defineProperty;var ln=Object.getOwnPropertyDescriptor;var c=(o,r,e,t)=>{for(var i=t>1?void 0:t?ln(r,e):r,s=o.length-1,n;s>=0;s--)(n=o[s])&&(i=(t?n(r,e,i):n(i))||i);return t&&i&&an(r,e,i),i};var ks=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(r){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=r}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var se=function(o,r,e,t,i){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?o!==r||!i:!r.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?i.call(o,e):i?i.value=e:r.set(o,e),e},
|
|
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 "${r}" 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=r,this.__definitions.set(r,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,r),this.__pendingWhenDefineds.get(r)?.resolve(e),this.__pendingWhenDefineds.delete(r)}get(r){return this.__definitions.get(r)?.ctor}getName(r){return this.__reverseDefinitions.get(r)??null}upgrade(r){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(r){let e=this.__definitions.get(r);if(e)return e.ctor;let t=this.__pendingWhenDefineds.get(r);return t||(t=pn(),this.__pendingWhenDefineds.set(r,t)),t.promise}},un=Ai;var Ps=new un;var
|
|
1
|
+
var an=Object.defineProperty;var ln=Object.getOwnPropertyDescriptor;var c=(o,r,e,t)=>{for(var i=t>1?void 0:t?ln(r,e):r,s=o.length-1,n;s>=0;s--)(n=o[s])&&(i=(t?n(r,e,i):n(i))||i);return t&&i&&an(r,e,i),i};var ks=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(r){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=r}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var se=function(o,r,e,t,i){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?o!==r||!i:!r.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?i.call(o,e):i?i.value=e:r.set(o,e),e},D=function(o,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?o!==r||!t:!r.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(o):t?t.value:r.get(o)},nt,kr,Mr,Pt,qi,Vt,Ir,je,Ot,Ie,Lr,Ms,Is=o=>typeof o=="boolean"?o:o?.capture??!1;var Ci=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(r,e,t){if(e==null)return;let i=Is(t)?this.__captureEventListeners:this.__eventListeners,s=i.get(r);if(s===void 0)s=new Map,i.set(r,s);else if(s.has(e))return;let n=typeof t=="object"&&t?t:{};n.signal?.addEventListener("abort",()=>this.removeEventListener(r,e,t)),s.set(e,n??{})}removeEventListener(r,e,t){if(e==null)return;let i=Is(t)?this.__captureEventListeners:this.__eventListeners,s=i.get(r);s!==void 0&&(s.delete(e),s.size||i.delete(r))}dispatchEvent(r){let e=[this],t=this.__eventTargetParent;if(r.composed)for(;t;)e.push(t),t=t.__eventTargetParent;else for(;t&&t!==this.__host;)e.push(t),t=t.__eventTargetParent;let i=!1,s=!1,n=0,a=null,l=null,d=null,p=r.stopPropagation,m=r.stopImmediatePropagation;Object.defineProperties(r,{target:{get(){return a??l},...L},srcElement:{get(){return r.target},...L},currentTarget:{get(){return d},...L},eventPhase:{get(){return n},...L},composedPath:{value:()=>e,...L},stopPropagation:{value:()=>{i=!0,p.call(r)},...L},stopImmediatePropagation:{value:()=>{s=!0,m.call(r)},...L}});let f=(q,T,M)=>{typeof q=="function"?q(r):typeof q?.handleEvent=="function"&&q.handleEvent(r),T.once&&M.delete(q)},b=()=>(d=null,n=0,!r.defaultPrevented),y=e.slice().reverse();a=!this.__host||!r.composed?this:null;let C=q=>{for(l=this;l.__host&&q.includes(l.__host);)l=l.__host};for(let q of y){!a&&(!l||l===q.__host)&&C(y.slice(y.indexOf(q))),d=q,n=q===r.target?2:1;let T=q.__captureEventListeners.get(r.type);if(T){for(let[M,O]of T)if(f(M,O,T),s)return b()}if(i)return b()}let A=r.bubbles?e:[this];l=null;for(let q of A){!a&&(!l||q===l.__host)&&C(A.slice(0,A.indexOf(q)+1)),d=q,n=q===r.target?2:3;let T=q.__eventListeners.get(r.type);if(T){for(let[M,O]of T)if(f(M,O,T),s)return b()}if(i)return b()}return b()}},Ei=Ci;var L={__proto__:null};L.enumerable=!0;Object.freeze(L);var wi=(Ie=class{constructor(r,e={}){if(nt.set(this,!1),kr.set(this,!1),Mr.set(this,!1),Pt.set(this,!1),qi.set(this,Date.now()),Vt.set(this,!1),Ir.set(this,void 0),je.set(this,void 0),Ot.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:t,cancelable:i,composed:s}=e;se(this,nt,!!i,"f"),se(this,kr,!!t,"f"),se(this,Mr,!!s,"f"),se(this,Ir,`${r}`,"f"),se(this,je,null,"f"),se(this,Ot,!1,"f")}initEvent(r,e,t){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){se(this,Pt,!0,"f")}get target(){return D(this,je,"f")}get currentTarget(){return D(this,je,"f")}get srcElement(){return D(this,je,"f")}get type(){return D(this,Ir,"f")}get cancelable(){return D(this,nt,"f")}get defaultPrevented(){return D(this,nt,"f")&&D(this,Pt,"f")}get timeStamp(){return D(this,qi,"f")}composedPath(){return D(this,Ot,"f")?[D(this,je,"f")]:[]}get returnValue(){return!D(this,nt,"f")||!D(this,Pt,"f")}get bubbles(){return D(this,kr,"f")}get composed(){return D(this,Mr,"f")}get eventPhase(){return D(this,Ot,"f")?Ie.AT_TARGET:Ie.NONE}get cancelBubble(){return D(this,Vt,"f")}set cancelBubble(r){r&&se(this,Vt,!0,"f")}stopPropagation(){se(this,Vt,!0,"f")}get isTrusted(){return!1}},nt=new WeakMap,kr=new WeakMap,Mr=new WeakMap,Pt=new WeakMap,qi=new WeakMap,Vt=new WeakMap,Ir=new WeakMap,je=new WeakMap,Ot=new WeakMap,Ie.NONE=0,Ie.CAPTURING_PHASE=1,Ie.AT_TARGET=2,Ie.BUBBLING_PHASE=3,Ie);Object.defineProperties(wi.prototype,{initEvent:L,stopImmediatePropagation:L,preventDefault:L,target:L,currentTarget:L,srcElement:L,type:L,cancelable:L,defaultPrevented:L,timeStamp:L,composedPath:L,returnValue:L,bubbles:L,composed:L,eventPhase:L,cancelBubble:L,stopPropagation:L,isTrusted:L});var Ls=(Ms=class extends wi{constructor(r,e={}){super(r,e),Lr.set(this,void 0),se(this,Lr,e?.detail??null,"f")}initCustomEvent(r,e,t,i){throw new Error("Method not implemented.")}get detail(){return D(this,Lr,"f")}},Lr=new WeakMap,Ms);Object.defineProperties(Ls.prototype,{detail:L});var _i=wi,Ti=Ls;globalThis.Event??=_i;globalThis.CustomEvent??=Ti;var $s=new WeakMap,Nt=o=>{let r=$s.get(o);return r===void 0&&$s.set(o,r=new Map),r},cn=class extends Ei{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Nt(this)).map(([r,e])=>({name:r,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(r,e){Nt(this).set(r,String(e))}removeAttribute(r){Nt(this).delete(r)}toggleAttribute(r,e){if(this.hasAttribute(r)){if(e===void 0||!e)return this.removeAttribute(r),!1}else return e===void 0||e?(this.setAttribute(r,""),!0):!1;return!0}hasAttribute(r){return Nt(this).has(r)}attachShadow(r){let e={host:this};return this.__shadowRootMode=r.mode,r&&r.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let r=new ks(this);return this.__internals=r,r}getAttribute(r){return Nt(this).get(r)??null}};var dn=class extends cn{},Si=dn;globalThis.litServerRoot??=Object.defineProperty(new Si,"localName",{get(){return"lit-server-root"}});function pn(){let o,r;return{promise:new Promise((t,i)=>{o=t,r=i}),resolve:o,reject:r}}var Ai=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(r,e){if(this.__definitions.has(r))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${r}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
+
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${r}" 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=r,this.__definitions.set(r,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,r),this.__pendingWhenDefineds.get(r)?.resolve(e),this.__pendingWhenDefineds.delete(r)}get(r){return this.__definitions.get(r)?.ctor}getName(r){return this.__reverseDefinitions.get(r)??null}upgrade(r){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(r){let e=this.__definitions.get(r);if(e)return e.ctor;let t=this.__pendingWhenDefineds.get(r);return t||(t=pn(),this.__pendingWhenDefineds.set(r,t)),t.promise}},un=Ai;var Ps=new un;var Dt=globalThis,$r=Dt.ShadowRoot&&(Dt.ShadyCSS===void 0||Dt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ri=Symbol(),Vs=new WeakMap,Ht=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Ri)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if($r&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=Vs.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Vs.set(e,r))}return r}toString(){return this.cssText}},Os=o=>new Ht(typeof o=="string"?o:o+"",void 0,Ri),x=(o,...r)=>{let e=o.length===1?o[0]:r.reduce(((t,i,s)=>t+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1]),o[0]);return new Ht(e,o,Ri)},Ns=(o,r)=>{if($r)o.adoptedStyleSheets=r.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of r){let t=document.createElement("style"),i=Dt.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},ki=$r||Dt.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return Os(e)})(o):o;var{is:mn,defineProperty:hn,getOwnPropertyDescriptor:fn,getOwnPropertyNames:gn,getOwnPropertySymbols:bn,getPrototypeOf:vn}=Object,Ut=globalThis;Ut.customElements??=Ps;var Ds=Ut.trustedTypes,yn=Ds?Ds.emptyScript:"",xn=Ut.reactiveElementPolyfillSupport,zt=(o,r)=>o,Ft={toAttribute(o,r){switch(r){case Boolean:o=o?yn:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,r){let e=o;switch(r){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}},Pr=(o,r)=>!mn(o,r),Hs={attribute:!0,type:String,converter:Ft,reflect:!1,useDefault:!1,hasChanged:Pr};Symbol.metadata??=Symbol("metadata"),Ut.litPropertyMetadata??=new WeakMap;var ve=class extends(globalThis.HTMLElement??Si){static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Hs){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&hn(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:s}=fn(this.prototype,r)??{get(){return this[e]},set(n){this[e]=n}};return{get:i,set(n){let a=i?.call(this);s?.call(this,n),this.requestUpdate(r,a,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Hs}static _$Ei(){if(this.hasOwnProperty(zt("elementProperties")))return;let r=vn(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(zt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(zt("properties"))){let e=this.properties,t=[...gn(e),...bn(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(ki(i))}else r!==void 0&&e.push(ki(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.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((r=>this.enableUpdating=r)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((r=>r(this)))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ns(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((r=>r.hostConnected?.()))}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach((r=>r.hostDisconnected?.()))}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.constructor.elementProperties.get(r),i=this.constructor._$Eu(r,t);if(i!==void 0&&t.reflect===!0){let s=(t.converter?.toAttribute!==void 0?t.converter:Ft).toAttribute(e,t.type);this._$Em=r,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(r,e){let t=this.constructor,i=t._$Eh.get(r);if(i!==void 0&&this._$Em!==i){let s=t.getPropertyOptions(i),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Ft;this._$Em=i;let a=n.fromAttribute(e,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(r,e,t){if(r!==void 0){let i=this.constructor,s=this[r];if(t??=i.getPropertyOptions(r),!((t.hasChanged??Pr)(s,e)||t.useDefault&&t.reflect&&s===this._$Ej?.get(r)&&!this.hasAttribute(i._$Eu(r,t))))return;this.C(r,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(r,e,{useDefault:t,reflect:i,wrapped:s},n){t&&!(this._$Ej??=new Map).has(r)&&(this._$Ej.set(r,n??e??this[r]),s!==!0||n!==void 0)||(this._$AL.has(r)||(this.hasUpdated||t||(e=void 0),this._$AL.set(r,e)),i===!0&&this._$Em!==r&&(this._$Eq??=new Set).add(r))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let r=this.scheduleUpdate();return r!=null&&await r,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,s]of t){let{wrapped:n}=s,a=this[i];n!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let r=!1,e=this._$AL;try{r=this.shouldUpdate(e),r?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(t){throw r=!1,this._$EM(),t}r&&this._$AE(e)}willUpdate(r){}_$AE(r){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(r)),this.updated(r)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(r){return!0}update(r){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(r){}firstUpdated(r){}};ve.elementStyles=[],ve.shadowRootOptions={mode:"open"},ve[zt("elementProperties")]=new Map,ve[zt("finalized")]=new Map,xn?.({ReactiveElement:ve}),(Ut.reactiveElementVersions??=[]).push("2.1.1");var Fr=globalThis,Vr=Fr.trustedTypes,zs=Vr?Vr.createPolicy("lit-html",{createHTML:o=>o}):void 0,Ii="$lit$",ye=`lit$${Math.random().toFixed(9).slice(2)}$`,Li="?"+ye,qn=`<${Li}>`,Ge=Fr.document===void 0?{createTreeWalker:()=>({})}:document,jt=()=>Ge.createComment(""),Wt=o=>o===null||typeof o!="object"&&typeof o!="function",$i=Array.isArray,Xs=o=>$i(o)||typeof o?.[Symbol.iterator]=="function",Mi=`[
|
|
3
3
|
\f\r]`,Bt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fs=/-->/g,Us=/>/g,We=RegExp(`>|${Mi}(?:([^\\s"'>=/]+)(${Mi}*=${Mi}*(?:[^
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Bs=/'/g,js=/"/g,Gs=/^(?:script|style|textarea|title)$/i,Pi=o=>(r,...e)=>({_$litType$:o,strings:r,values:e}),h=Pi(1),Ur=Pi(2),wa=Pi(3),V=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),Ws=new WeakMap,Xe=Ge.createTreeWalker(Ge,129);function Ys(o,r){if(!$i(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return zs!==void 0?zs.createHTML(r):r}var Js=(o,r)=>{let e=o.length-1,t=[],i,s=r===2?"<svg>":r===3?"<math>":"",n=Bt;for(let a=0;a<e;a++){let l=o[a],d,p,m=-1,f=0;for(;f<l.length&&(n.lastIndex=f,p=n.exec(l),p!==null);)f=n.lastIndex,n===Bt?p[1]==="!--"?n=Fs:p[1]!==void 0?n=Us:p[2]!==void 0?(Gs.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=We):p[3]!==void 0&&(n=We):n===We?p[0]===">"?(n=i??Bt,m=-1):p[1]===void 0?m=-2:(m=n.lastIndex-p[2].length,d=p[1],n=p[3]===void 0?We:p[3]==='"'?js:Bs):n===js||n===Bs?n=We:n===Fs||n===Us?n=Bt:(n=We,i=void 0);let b=n===We&&o[a+1].startsWith("/>")?" ":"";s+=n===Bt?l+qn:m>=0?(t.push(d),l.slice(0,m)+Ii+l.slice(m)+ye+b):l+ye+(m===-2?a:b)}return[Ys(o,s+(o[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Xt=class o{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let s=0,n=0,a=r.length-1,l=this.parts,[d,p]=Js(r,e);if(this.el=o.createElement(d,t),Xe.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=Xe.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Ii)){let f=p[n++],b=i.getAttribute(m).split(ye),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:s,name:y[2],strings:b,ctor:y[1]==="."?
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Bs=/'/g,js=/"/g,Gs=/^(?:script|style|textarea|title)$/i,Pi=o=>(r,...e)=>({_$litType$:o,strings:r,values:e}),h=Pi(1),Ur=Pi(2),wa=Pi(3),V=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),Ws=new WeakMap,Xe=Ge.createTreeWalker(Ge,129);function Ys(o,r){if(!$i(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return zs!==void 0?zs.createHTML(r):r}var Js=(o,r)=>{let e=o.length-1,t=[],i,s=r===2?"<svg>":r===3?"<math>":"",n=Bt;for(let a=0;a<e;a++){let l=o[a],d,p,m=-1,f=0;for(;f<l.length&&(n.lastIndex=f,p=n.exec(l),p!==null);)f=n.lastIndex,n===Bt?p[1]==="!--"?n=Fs:p[1]!==void 0?n=Us:p[2]!==void 0?(Gs.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=We):p[3]!==void 0&&(n=We):n===We?p[0]===">"?(n=i??Bt,m=-1):p[1]===void 0?m=-2:(m=n.lastIndex-p[2].length,d=p[1],n=p[3]===void 0?We:p[3]==='"'?js:Bs):n===js||n===Bs?n=We:n===Fs||n===Us?n=Bt:(n=We,i=void 0);let b=n===We&&o[a+1].startsWith("/>")?" ":"";s+=n===Bt?l+qn:m>=0?(t.push(d),l.slice(0,m)+Ii+l.slice(m)+ye+b):l+ye+(m===-2?a:b)}return[Ys(o,s+(o[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Xt=class o{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let s=0,n=0,a=r.length-1,l=this.parts,[d,p]=Js(r,e);if(this.el=o.createElement(d,t),Xe.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=Xe.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Ii)){let f=p[n++],b=i.getAttribute(m).split(ye),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:s,name:y[2],strings:b,ctor:y[1]==="."?Nr:y[1]==="?"?Dr:y[1]==="@"?Hr:Je}),i.removeAttribute(m)}else m.startsWith(ye)&&(l.push({type:6,index:s}),i.removeAttribute(m));if(Gs.test(i.tagName)){let m=i.textContent.split(ye),f=m.length-1;if(f>0){i.textContent=Vr?Vr.emptyScript:"";for(let b=0;b<f;b++)i.append(m[b],jt()),Xe.nextNode(),l.push({type:2,index:++s});i.append(m[f],jt())}}}else if(i.nodeType===8)if(i.data===Li)l.push({type:2,index:s});else{let m=-1;for(;(m=i.data.indexOf(ye,m+1))!==-1;)l.push({type:7,index:s}),m+=ye.length-1}s++}}static createElement(r,e){let t=Ge.createElement("template");return t.innerHTML=r,t}};function Ye(o,r,e=o,t){if(r===V)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,s=Wt(r)?void 0:r._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Ye(o,i._$AS(o,r.values),i,t)),r}var Or=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Ge).importNode(e,!0);Xe.currentNode=i;let s=Xe.nextNode(),n=0,a=0,l=t[0];for(;l!==void 0;){if(n===l.index){let d;l.type===2?d=new at(s,s.nextSibling,this,r):l.type===1?d=new l.ctor(s,l.name,l.strings,this,r):l.type===6&&(d=new zr(s,this,r)),this._$AV.push(d),l=t[++a]}n!==l?.index&&(s=Xe.nextNode(),n++)}return Xe.currentNode=Ge,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},at=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Ye(this,r,e),Wt(r)?r===k||r==null||r===""?(this._$AH!==k&&this._$AR(),this._$AH=k):r!==this._$AH&&r!==V&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):Xs(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==k&&Wt(this._$AH)?this._$AA.nextSibling.data=r:this.T(Ge.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Xt.createElement(Ys(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new Or(i,this),n=s.u(this.options);s.p(e),this.T(n),this._$AH=s}}_$AC(r){let e=Ws.get(r.strings);return e===void 0&&Ws.set(r.strings,e=new Xt(r)),e}k(r){$i(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let s of r)i===e.length?e.push(t=new o(this.O(jt()),this.O(jt()),this,this.options)):t=e[i],t._$AI(s),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=r.nextSibling;r.remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Je=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,s){this.type=1,this._$AH=k,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=s,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=k}_$AI(r,e=this,t,i){let s=this.strings,n=!1;if(s===void 0)r=Ye(this,r,e,0),n=!Wt(r)||r!==this._$AH&&r!==V,n&&(this._$AH=r);else{let a=r,l,d;for(r=s[0],l=0;l<s.length-1;l++)d=Ye(this,a[t+l],e,l),d===V&&(d=this._$AH[l]),n||=!Wt(d)||d!==this._$AH[l],d===k?r=k:r!==k&&(r+=(d??"")+s[l+1]),this._$AH[l]=d}n&&!i&&this.j(r)}j(r){r===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,r??"")}},Nr=class extends Je{constructor(){super(...arguments),this.type=3}j(r){this.element[this.name]=r===k?void 0:r}},Dr=class extends Je{constructor(){super(...arguments),this.type=4}j(r){this.element.toggleAttribute(this.name,!!r&&r!==k)}},Hr=class extends Je{constructor(r,e,t,i,s){super(r,e,t,i,s),this.type=5}_$AI(r,e=this){if((r=Ye(this,r,e,0)??k)===V)return;let t=this._$AH,i=r===k&&t!==k||r.capture!==t.capture||r.once!==t.once||r.passive!==t.passive,s=r!==k&&(t===k||i);i&&this.element.removeEventListener(this.name,this,t),s&&this.element.addEventListener(this.name,this,r),this._$AH=r}handleEvent(r){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,r):this._$AH.handleEvent(r)}},zr=class{constructor(r,e,t){this.element=r,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(r){Ye(this,r)}},H={M:Ii,P:ye,A:Li,C:1,L:Js,R:Or,D:Xs,V:Ye,I:at,H:Je,N:Dr,U:Hr,B:Nr,F:zr},Cn=Fr.litHtmlPolyfillSupport;Cn?.(Xt,at),(Fr.litHtmlVersions??=[]).push("3.3.1");var Vi=(o,r,e)=>{let t=e?.renderBefore??r,i=t._$litPart$;if(i===void 0){let s=e?.renderBefore??null;t._$litPart$=i=new at(r.insertBefore(jt(),s),s,void 0,e??{})}return i._$AI(o),i};var Oi=globalThis,v=class extends ve{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let r=super.createRenderRoot();return this.renderOptions.renderBefore??=r.firstChild,r}update(r){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(r),this._$Do=Vi(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};v._$litElement$=!0,v.finalized=!0,Oi.litElementHydrateSupport?.({LitElement:v});var En=Oi.litElementPolyfillSupport;En?.({LitElement:v});(Oi.litElementVersions??=[]).push("4.2.1");var g=o=>(r,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(o,r)})):customElements.define(o,r)};var wn={attribute:!0,type:String,converter:Ft,reflect:!1,hasChanged:Pr},_n=(o=wn,r,e)=>{let{kind:t,metadata:i}=e,s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),t==="setter"&&((o=Object.create(o)).wrapped=!0),s.set(e.name,o),t==="accessor"){let{name:n}=e;return{set(a){let l=r.get.call(this);r.set.call(this,a),this.requestUpdate(n,l,o)},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(t==="setter"){let{name:n}=e;return function(a){let l=this[n];r.call(this,a),this.requestUpdate(n,l,o)}}throw Error("Unsupported decorator location: "+t)};function u(o){return(r,e)=>typeof e=="object"?_n(o,r,e):((t,i,s)=>{let n=i.hasOwnProperty(s);return i.constructor.createProperty(s,t),n?Object.getOwnPropertyDescriptor(i,s):void 0})(o,r,e)}function E(o){return u({...o,state:!0,attribute:!1})}var Le=(o,r,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof r!="object"&&Object.defineProperty(o,r,e),e);function lt(o,r){return(e,t,i)=>{let s=n=>n.renderRoot?.querySelector(o)??null;if(r){let{get:n,set:a}=typeof t=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(d){this[l]=d}}})();return Le(e,t,{get(){let l=n.call(this);return l===void 0&&(l=s(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return Le(e,t,{get(){return s(this)}})}}function Ks(o){return(r,e)=>{let{slot:t,selector:i}=o??{},s="slot"+(t?`[name=${t}]`:":not([name])");return Le(r,e,{get(){let n=this.renderRoot?.querySelector(s),a=n?.assignedElements(o)??[];return i===void 0?a:a.filter((l=>l.matches(i)))}})}}var Tn=String.raw,An=Tn`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
5
5
|
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
|
|
6
6
|
<xsl:template match="@*|node()">
|
|
7
7
|
<xsl:copy>
|
|
@@ -23,12 +23,12 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
23
23
|
<xsl:apply-templates/>
|
|
24
24
|
</xsl:element>
|
|
25
25
|
</xsl:template>
|
|
26
|
-
</xsl:stylesheet>`;function Zs(o,r,e){o.querySelectorAll(r).forEach(t=>{let i=`${r}-${e}`,s=eo(t,i);t.replaceWith(s)})}function Qs(o,r){o.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let s=i.slice(`${r}:`.length),n=`${e.nodeName}-${s}`,a=eo(e,n);e.replaceWith(a)}})})}function eo(o,r){let e=o.ownerDocument.createElement(r);for(let t of o.attributes)e.setAttribute(t.name,t.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function to(o){let r=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),s=e.getAttribute("category");r.push({identifier:t,href:i,category:s})}),r}function ct(o,r){return fetch(o,{signal:r}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>new DOMParser().parseFromString(e,"text/xml")).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function dt(o){return new DOMParser().parseFromString(o,"text/xml")}function pt(o){let r=new XSLTProcessor,e=new DOMParser().parseFromString(An,"text/xml");return r.importStylesheet(e),r.transformToFragment(o,document)}function ut(o,r){r.endsWith("/")||(r+="/"),o.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let t="";e.getAttribute("src")&&(t="src"),e.getAttribute("href")&&(t="href"),e.getAttribute("primary-path")&&(t="primary-path");let i=e.getAttribute(t)?.trim();if(!/^(data:|https?:|blob:)/.test(i)){let s=r+encodeURI(i);e.setAttribute(t,s)}})}function ro(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function io(o){o.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function so(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}}var oe=(o=!1)=>{let r,e="",t={load(i,s){e=i;let n=encodeURI(i);return o&&sessionStorage.getItem(n)?Promise.resolve(t.parse(sessionStorage.getItem(n))):ct(i,s).then(a=>(r=a,t.shuffleInteractions(),o&&sessionStorage.setItem(n,new XMLSerializer().serializeToString(r)),t))},parse(i){return r=dt(i),t},path:i=>(ut(r,i),e=null,t),fn(i){return i(r),t},pciHooks(i){let s=["hook","module"],n=i.substring(0,i.lastIndexOf("/"));for(let a of s)r.querySelectorAll("["+a+"]").forEach(d=>{let p=d.getAttribute(a);!p.startsWith("data:")&&!p.startsWith("http")&&(d.setAttribute("base-url",i),d.setAttribute("module",n+"/"+encodeURI(p+(p.endsWith(".js")?"":".js"))))});return t},async configurePci(i,s,n="qti-portable-custom-interaction"){let a=[],l=r.querySelectorAll(n),d=await s(i,"/modules/module_resolution.js"),p=await s(i,"/modules/fallback_module_resolution.js");if(l.length>0)for(let m of Array.from(l)){m.setAttribute("data-base-url",i);let f=m.getAttribute("custom-interaction-type-identifier");f&&a.includes(f)&&(f=f+a.length,m.setAttribute("custom-interaction-type-identifier",f),a.push(f)),f&&a.push(f);let b=m.querySelector("qti-interaction-modules");if(b&&b.getAttribute("primary-configuration")){let y=b.getAttribute("primary-configuration");if(y)try{let C=await s(i,`/${y}`),A=Array.from(b.querySelectorAll("qti-interaction-module"));for(let q of A){let T=q.getAttribute("id");if(T&&C.paths&&C.paths[T]){let M=C.paths[T],O=Array.isArray(M)?M[0]:M;if(q.setAttribute("primary-path",O),p&&p.paths&&p.paths[T]){let D=p.paths[T];Array.isArray(D)?q.setAttribute("fallback-path",D[0]):q.setAttribute("fallback-path",D)}}}if(C.paths){for(let q in C.paths)if(!b.querySelector(`qti-interaction-module[id="${q}"]`)){let M=r.createElement("qti-interaction-module");M.setAttribute("id",q);let O=Array.isArray(C.paths[q])?C.paths[q][0]:C.paths[q];if(M.setAttribute("primary-path",O),p&&p.paths&&p.paths[q]){let D=p.paths[q];Array.isArray(D)?M.setAttribute("fallback-path",D[0]):M.setAttribute("fallback-path",D)}b.appendChild(M)}}C.urlArgs&&b.setAttribute("url-args",C.urlArgs)}catch(C){console.warn(`Failed to load primary configuration: ${y}`,C)}}else if(d){m.querySelector("qti-interaction-modules")===null?(b=r.createElement("qti-interaction-modules"),m.appendChild(b)):b=m.querySelector("qti-interaction-modules");for(let y in d.paths){let C=d.paths[y],A="";p&&p.paths&&p.paths[y]&&(A=p.paths[y]);let q=Array.isArray(C)?C:[C],T=Array.isArray(A)?A:[A],M=q.map((O,D)=>{let nn=T.length>D?T[D]:"";return{primaryPath:O,fallbackPath:nn}});for(let O of T)M.some(D=>D.fallbackPath===O)||M.push({primaryPath:q.length>0?q[0]:O,fallbackPath:O});for(let O of M){let D=r.createElement("qti-interaction-module");O.fallbackPath&&D.setAttribute("fallback-path",O.fallbackPath),D.setAttribute("id",y),D.setAttribute("primary-path",O.primaryPath),b&&b.appendChild(D)}}}}return t},shuffleInteractions(){let i=r.querySelectorAll('[shuffle="true"]'),s=Array.from(i).filter(n=>n.tagName?.toLowerCase().endsWith("-interaction"));for(let n of s){let a=so(n.tagName.toLowerCase()),l=Array.isArray(a)?a:[a];for(let d of l){let p=Array.from(n.querySelectorAll(d)),m=p.map((q,T)=>({element:q,fixed:q.hasAttribute("fixed")&&q.getAttribute("fixed")==="true",originalOrder:T})).filter(q=>q.fixed),f=p.filter(q=>!q.hasAttribute("fixed")||q.getAttribute("fixed")!=="true");if(f.length<=1)return console.warn("Shuffling is not possible with fewer than 2 non-fixed elements."),t;let b=[...f],y=!1,C=0;for(;!y&&C<20;){C++;for(let q=f.length-1;q>0;q--){let T=Math.floor(Math.random()*(q+1));[f[q],f[T]]=[f[T],f[q]]}y=!f.every((q,T)=>q===b[T])}if(!y)return console.warn("Failed to shuffle the choices after multiple attempts."),null;n.removeAttribute("shuffle");let A=0;for(let q of f)q.parentElement.insertBefore(q,m[A]?.element),A++;for(let q of m)q.element.parentElement.insertBefore(q.element,f[q.originalOrder])}}return t},extendElementName:(i,s)=>(Zs(r,i,s),t),extendElementsWithClass:(i="extend")=>(Qs(r,i),t),customInteraction(i,s){let n=r.querySelector("qti-custom-interaction"),a=n.querySelector("object");return n.setAttribute("data-base-ref",i),n.setAttribute("data-base-item",i+s),n.setAttribute("data",a.getAttribute("data")),n.setAttribute("width",a.getAttribute("width")),n.setAttribute("height",a.getAttribute("height")),n.removeChild(a),t},convertCDATAtoComment(){return ro(r),t},stripStyleSheets(){return io(r),t},html(){return e!==null&&ut(r,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(pt(r))},xml(){return new XMLSerializer().serializeToString(r)},htmlDoc(){return e!==null&&ut(r,e.substring(0,e.lastIndexOf("/"))),pt(r)},xmlDoc(){return r}};return t};var oo=()=>{let o,r={async load(e,t){return new Promise(i=>{ct(e,t).then(s=>(o=s,i(r)))})},parse(e){o=dt(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return r};var mt=()=>{let o,r={async load(e,t){return new Promise((i,s)=>{ct(e,t).then(n=>(o=n,r.path(e.substring(0,e.lastIndexOf("/"))),i(r)))})},parse(e){return o=dt(e),r},path:e=>(ut(o,e),r),fn(e){return e(o),r},items(){return to(o)},html(){return new XMLSerializer().serializeToString(pt(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(){return pt(o)},xmlDoc(){return o}};return r};var no=o=>{class r extends o{constructor(...i){super(...i);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.postLoadTransformCallback=null;this.postLoadTestTransformCallback=null;this._activeController=null;this._loadResults=[];this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1};this._loadedStimulusHrefs=new Set;this._loadingStimulusHrefs=new Set;this._bindEventHandlers()}navigateTo(i,s){let n=s||this._getDefaultNavigationId(i);n&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:n},bubbles:!0,composed:!0}))}_bindEventHandlers(){this.addEventListener("qti-request-navigation",this._handleNavigationRequest.bind(this)),this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(i){this._testElement=i.detail,this._initializeNavigation()}_handleItemConnected(i){let s=i.detail;this._loadingState.connectedItems++;let n=s.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(i){i.preventDefault();let{element:s,item:n}=i;if(console.info("Stimulus ref connected:",{identifier:s.identifier,href:s.href,item:n.identifier}),this._loadedStimulusHrefs.has(s.href)){console.info("Stimulus already loaded, skipping:",s.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(s.href)){console.info("Stimulus already loading, skipping duplicate:",s.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(s.href),console.info("Starting stimulus load:",s.href);try{await this._loadStimulusRef(s,n),this._loadedStimulusHrefs.add(s.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",s.href),this._checkLoadingComplete()}catch(a){a.name!=="AbortError"&&console.warn(`Failed to load stimulus ${s.identifier}:`,a),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(s.href)}}_getDefaultNavigationId(i){return i==="section"?this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let i=this._getDefaultNavigationId(this.navigate);i&&this.navigateTo(this.navigate,i)}async _handleNavigationRequest({detail:i}){if(i?.id){this._cancelPreviousNavigation();try{this._dispatchLoadingStarted(i.type,i.id),this._activeController=new AbortController,await this._executeNavigation(i.type,i.id)}catch(s){this._handleNavigationError(s,i.type,i.id)}finally{this._activeController=null,this._dispatchLoadingEnded(i.type,i.id)}}}_handleNavigationError(i,s,n){i.name!=="AbortError"&&this._dispatchError(this._createNavigationError(i,s,n))}async _executeNavigation(i,s){i==="item"?await this._navigateToItem(s):await this._navigateToSection(s)}async _navigateToItem(i){let s=this._findItemRef(i);this._updateSessionContext(s,i),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([i]),await this._waitForLoadingComplete(),this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(i){let n=this._findSection(i)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:i,navItemRefId:null};let a=this._getSectionItemIds(i);this._resetLoadingState(),this._loadingState.expectedItems=a.length,await this._loadItems(a),await this._waitForLoadingComplete(),this._dispatchTestLoaded(this._loadResults)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let i=this._loadingState.connectedItems>=this._loadingState.expectedItems,s=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;i&&s&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(){for(;!this._loadingState.isComplete;)await new Promise(i=>setTimeout(i,10))}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(i,s){console.info("Loading stimulus:",i.href);let n=await this._loadStimulus(i.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,i,s)}_applyStimulusContent(i,s,n){if(!i){console.warn("No stimulus content to apply");return}let a=i.querySelectorAll("qti-stimulus-body, qti-stylesheet");if(console.info(`Found ${a.length} stimulus elements to apply for ${s.identifier}`),a.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let l=[],d=document.querySelector(`qti-assessment-item[identifier="${n.identifier}"] [data-stimulus-idref="${s.identifier}"]`);if(d)l.push(d),console.info("Found specific target:",d);else{let p=Array.from(this.querySelectorAll(`[data-stimulus-idref="${s.identifier}"]`));if(p.length>0)l=p,console.info("Found targets by identifier:",p.length);else{let m=Array.from(this.querySelectorAll("[data-stimulus-idref]"));l=m,console.info("Using fallback targets:",m.length)}}if(l.length===0){console.warn("No targets found for stimulus content");return}l.forEach((p,m)=>{p.innerHTML="";let f=Array.from(a).map(b=>b.cloneNode(!0));p.append(...f),console.info(`Applied stimulus content to target ${m+1}/${l.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(i){if(!this._testElement||i.length===0)return;let s=i.map(l=>this._findItemRef(l));this._clearLoadedItems(),this._clearStimulusRef();let a=(await Promise.all(s.map(l=>this._loadSingleItem(l)))).filter(Boolean);a.forEach(({itemRef:l,doc:d})=>{l&&d&&(l.xmlDoc=d)}),this._loadResults=a}async _loadSingleItem(i){try{let s=await oe(this.cacheTransform).load(i.href,this._activeController?.signal);return this.postLoadTransformCallback&&(s=await this.postLoadTransformCallback(s,i)),{itemRef:i,doc:s.htmlDoc()}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${i.identifier} was aborted`),s;return console.warn(`Failed to load item ${i.identifier}:`,s),null}}async _loadStimulus(i){return(await oe().load(i,this._activeController?.signal)).htmlDoc()}_findItemRef(i){let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)throw new Error(`Item with identifier "${i}" not found`);return s}_findSection(i){return this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`)||null}_updateSessionContext(i,s){let n=i.closest("qti-test-part")?.identifier,a=i.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:a,navItemRefId:s}}_getSectionItemIds(i){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(s=>s.identifier).filter(Boolean)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(i||[]).forEach(s=>{s.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(i=>i.innerHTML="")}_createNavigationError(i,s,n){return{message:i.message||`Failed to load ${s}: ${n}`,details:i,itemId:s==="item"?n:void 0,sectionId:s==="section"?n:void 0}}_dispatchLoadingStarted(i,s){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(i,s){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}_dispatchError(i){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:i,bubbles:!0,composed:!0}))}_dispatchTestLoaded(i){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:i.map(({itemRef:s})=>({identifier:s?.identifier,element:s})),bubbles:!0,composed:!0}))})}}return c([u({type:String})],r.prototype,"navigate",2),c([u({type:Boolean,attribute:"cache-transform"})],r.prototype,"cacheTransform",2),c([u({type:Number})],r.prototype,"requestTimeout",2),c([u({attribute:!1})],r.prototype,"postLoadTransformCallback",2),c([u({attribute:!1})],r.prototype,"postLoadTestTransformCallback",2),r};var ao=o=>{class r extends o{constructor(...t){super(...t),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(t){super.willUpdate(t),t.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(n=>{n.classList.toggle("show",n.getAttribute("view")===this.sessionContext.view)});let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;s&&s.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(t){t.showCorrectResponse(this.sessionContext.view==="scorer")}}return r};var $e=class extends Event{constructor(r,e,t,i){super("context-request",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e,this.callback=t,this.subscribe=i??!1}};var ht=class{constructor(r,e,t,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,n)),this.unsubscribe=n},this.host=r,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=t,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 $e(this.context,this.host,this.t,this.subscribe))}};var Br=class{get value(){return this.o}set value(r){this.setValue(r)}setValue(r,e=!1){let t=e||!Object.is(r,this.o);this.o=r,t&&this.updateObservers()}constructor(r){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},r!==void 0&&(this.value=r)}addCallback(r,e,t){if(!t)return void r(this.value);this.subscriptions.has(r)||this.subscriptions.set(r,{disposer:()=>{this.subscriptions.delete(r)},consumerHost:e});let{disposer:i}=this.subscriptions.get(r);r(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Di=class extends Event{constructor(r,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e}},ft=class extends Br{constructor(r,e,t){super(e.context!==void 0?e.initialValue:t),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new $e(this.context,a,n,!0)));i.stopPropagation()},this.host=r,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 Di(this.context,this.host))}};function X({context:o}){return(r,e)=>{let t=new WeakMap;if(typeof e=="object")return{get(){return r.get.call(this)},set(i){return t.get(this).setValue(i),r.set.call(this,i)},init(i){return t.set(this,new ft(this,{context:o,initialValue:i})),i}};{r.constructor.addInitializer((n=>{t.set(n,new ft(n,{context:o}))}));let i=Object.getOwnPropertyDescriptor(r,e),s;if(i===void 0){let n=new WeakMap;s={get(){return n.get(this)},set(a){t.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{let n=i.set;s={...i,set(a){t.get(this).setValue(a),n?.call(this,a)}}}return void Object.defineProperty(r,e,s)}}}function _({context:o,subscribe:r}){return(e,t)=>{typeof t=="object"?t.addInitializer((function(){new ht(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:r})})):e.constructor.addInitializer((i=>{new ht(i,{context:o,callback:s=>{i[t]=s},subscribe:r})}))}}var Pe=Symbol("computedItemContext");var $=Symbol("computedContext");var J=Symbol("configContext");var lo=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var P=Symbol("item");var jr=Symbol("qtiContext");var Ni={view:"candidate"},Ve=Symbol("testContext");var Hi={items:[],testOutcomeVariables:[]},ne=Symbol("testContext");var co=(t=>(t.Correct="correct",t.PartiallyCorrect="partially-correct",t.Incorrect="incorrect",t))(co||{}),R=class extends v{constructor(){super();this.disabled=!1;this.readonly=!1;this._internals=this.attachInternals()}static{this.formAssociated=!0}get internals(){return this._internals}get isFullCorrectResponse(){return this._isFullCorrectResponse}set isFullCorrectResponse(e){this._isFullCorrectResponse=e,e&&(this.disabled=!0,this.setAttribute("response-identifier",this.responseIdentifier+"_cr"))}get correctResponse(){return this._correctResponse}set correctResponse(e){this._correctResponse=e}get correctness(){let e=this.responseVariable;return!e||e.correctResponse===null?null:e.correctResponse===e.value?"correct":"incorrect"}get isInline(){return!1}get responseVariable(){let e=this._context.variables.filter(i=>i.type==="response"),t=this.getAttribute("response-identifier");return e.find(i=>i.identifier===t)}toggleCorrectResponse(e){(this?.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(e):this.toggleInternalCorrectResponse(e)}async toggleFullCorrectResponse(e){let t=this.nextSibling,i=t instanceof HTMLDivElement&&t?.classList.contains("full-correct-response"),s=this.responseVariable;if(!s)return;if(!(e&&(this?.configContext?.fullCorrectResponseOnlyWhenIncorrect===!1||this.correctness!=="correct"))){if(!i)return;this.parentElement?.removeChild(t)}if(i)return;let a=this.cloneNode(!0),l=document.createElement("div");l.classList.add("full-correct-response"),this.isInline?l.classList.add("full-correct-response-inline"):l.classList.add("full-correct-response-block"),l.role="full-correct-response",l.appendChild(a),a.isFullCorrectResponse=!0,this.parentElement?.insertBefore(l,this.nextSibling),await a.updateComplete,a.response=Array.isArray(s.correctResponse)?[...s.correctResponse]:s.correctResponse}toggleInternalCorrectResponse(e){let t=this.responseVariable;this.correctResponse=e?t?.correctResponse:t?.cardinality==="single"?"":[]}toggleCandidateCorrection(e){this.responseVariable&&(this._internals.states.delete("candidate-correct"),this._internals.states.delete("candidate-partially-correct"),this._internals.states.delete("candidate-incorrect"),e&&(this.correctness==="correct"&&this._internals.states.add("candidate-correct"),this.correctness==="partially-correct"&&this._internals.states.add("candidate-partially-correct"),this.correctness==="incorrect"&&this._internals.states.add("candidate-incorrect")))}get value(){return JSON.stringify(this.response)}set value(e){this.response=e?JSON.parse(e):null}reportValidity(){return this._internals.reportValidity()}reset(){this.response=null}connectedCallback(){super.connectedCallback(),!this.isFullCorrectResponse&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e}}))}};c([_({context:P,subscribe:!0})],R.prototype,"_context",2),c([_({context:J,subscribe:!0})],R.prototype,"configContext",2),c([u({type:String,attribute:"response-identifier"})],R.prototype,"responseIdentifier",2),c([u({reflect:!0,type:Boolean})],R.prototype,"disabled",2),c([u({reflect:!0,type:Boolean})],R.prototype,"readonly",2),c([E()],R.prototype,"_isFullCorrectResponse",2),c([E()],R.prototype,"_correctResponse",2);var gt=class extends v{render(){return h`<slot></slot>`}defaultValues(r){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(i=>i.innerHTML.trim());return t.length>1||r==="multiple"||r==="ordered"?t:t[0]}};var w=class extends v{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(console.debug("getVariables",e.tagName.toLowerCase()),e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return t==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.context.variables.find(s=>s.identifier===t)||null}case"qti-multiple":{let i=e.getResult();return console.debug("values",i),i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(s=>s.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(s=>s.value),cardinality:"ordered",type:"response"}:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",i=this.context?.variables?.find(s=>s.identifier===t)||null;return{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}}default:{try{return{baseType:"integer",value:e.getResult()?.toString()||null,cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}static{this.styles=x`
|
|
26
|
+
</xsl:stylesheet>`;function Zs(o,r,e){o.querySelectorAll(r).forEach(t=>{let i=`${r}-${e}`,s=eo(t,i);t.replaceWith(s)})}function Qs(o,r){o.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let s=i.slice(`${r}:`.length),n=`${e.nodeName}-${s}`,a=eo(e,n);e.replaceWith(a)}})})}function eo(o,r){let e=o.ownerDocument.createElement(r);for(let t of o.attributes)e.setAttribute(t.name,t.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function to(o){let r=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),s=e.getAttribute("category");r.push({identifier:t,href:i,category:s})}),r}function ct(o,r){return fetch(o,{signal:r}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>new DOMParser().parseFromString(e,"text/xml")).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function dt(o){return new DOMParser().parseFromString(o,"text/xml")}function pt(o){let r=new XSLTProcessor,e=new DOMParser().parseFromString(An,"text/xml");return r.importStylesheet(e),r.transformToFragment(o,document)}function ut(o,r){r.endsWith("/")||(r+="/"),o.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let t="";e.getAttribute("src")&&(t="src"),e.getAttribute("href")&&(t="href"),e.getAttribute("primary-path")&&(t="primary-path");let i=e.getAttribute(t)?.trim();if(!/^(data:|https?:|blob:)/.test(i)){let s=r+encodeURI(i);e.setAttribute(t,s)}})}function ro(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function io(o){o.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function so(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}}var oe=(o=!1)=>{let r,e="",t={load(i,s){e=i;let n=encodeURI(i);return o&&sessionStorage.getItem(n)?Promise.resolve(t.parse(sessionStorage.getItem(n))):ct(i,s).then(a=>(r=a,t.shuffleInteractions(),o&&sessionStorage.setItem(n,new XMLSerializer().serializeToString(r)),t))},parse(i){return r=dt(i),t},path:i=>(ut(r,i),e=null,t),fn(i){return i(r),t},pciHooks(i){let s=["hook","module"],n=i.substring(0,i.lastIndexOf("/"));for(let a of s)r.querySelectorAll("["+a+"]").forEach(d=>{let p=d.getAttribute(a);!p.startsWith("data:")&&!p.startsWith("http")&&(d.setAttribute("base-url",i),d.setAttribute("module",n+"/"+encodeURI(p+(p.endsWith(".js")?"":".js"))))});return t},async configurePci(i,s,n="qti-portable-custom-interaction"){let a=[],l=r.querySelectorAll(n),d=await s(i,"/modules/module_resolution.js"),p=await s(i,"/modules/fallback_module_resolution.js");if(l.length>0)for(let m of Array.from(l)){m.setAttribute("data-base-url",i);let f=m.getAttribute("custom-interaction-type-identifier");f&&a.includes(f)&&(f=f+a.length,m.setAttribute("custom-interaction-type-identifier",f),a.push(f)),f&&a.push(f);let b=m.querySelector("qti-interaction-modules");if(b&&b.getAttribute("primary-configuration")){let y=b.getAttribute("primary-configuration");if(y)try{let C=await s(i,`/${y}`),A=Array.from(b.querySelectorAll("qti-interaction-module"));for(let q of A){let T=q.getAttribute("id");if(T&&C.paths&&C.paths[T]){let M=C.paths[T],O=Array.isArray(M)?M[0]:M;if(q.setAttribute("primary-path",O),p&&p.paths&&p.paths[T]){let N=p.paths[T];Array.isArray(N)?q.setAttribute("fallback-path",N[0]):q.setAttribute("fallback-path",N)}}}if(C.paths){for(let q in C.paths)if(!b.querySelector(`qti-interaction-module[id="${q}"]`)){let M=r.createElement("qti-interaction-module");M.setAttribute("id",q);let O=Array.isArray(C.paths[q])?C.paths[q][0]:C.paths[q];if(M.setAttribute("primary-path",O),p&&p.paths&&p.paths[q]){let N=p.paths[q];Array.isArray(N)?M.setAttribute("fallback-path",N[0]):M.setAttribute("fallback-path",N)}b.appendChild(M)}}C.urlArgs&&b.setAttribute("url-args",C.urlArgs)}catch(C){console.warn(`Failed to load primary configuration: ${y}`,C)}}else if(d){m.querySelector("qti-interaction-modules")===null?(b=r.createElement("qti-interaction-modules"),m.appendChild(b)):b=m.querySelector("qti-interaction-modules");for(let y in d.paths){let C=d.paths[y],A="";p&&p.paths&&p.paths[y]&&(A=p.paths[y]);let q=Array.isArray(C)?C:[C],T=Array.isArray(A)?A:[A],M=q.map((O,N)=>{let nn=T.length>N?T[N]:"";return{primaryPath:O,fallbackPath:nn}});for(let O of T)M.some(N=>N.fallbackPath===O)||M.push({primaryPath:q.length>0?q[0]:O,fallbackPath:O});for(let O of M){let N=r.createElement("qti-interaction-module");O.fallbackPath&&N.setAttribute("fallback-path",O.fallbackPath),N.setAttribute("id",y),N.setAttribute("primary-path",O.primaryPath),b&&b.appendChild(N)}}}}return t},shuffleInteractions(){let i=r.querySelectorAll('[shuffle="true"]'),s=Array.from(i).filter(n=>n.tagName?.toLowerCase().endsWith("-interaction"));for(let n of s){let a=so(n.tagName.toLowerCase()),l=Array.isArray(a)?a:[a];for(let d of l){let p=Array.from(n.querySelectorAll(d)),m=p.map((q,T)=>({element:q,fixed:q.hasAttribute("fixed")&&q.getAttribute("fixed")==="true",originalOrder:T})).filter(q=>q.fixed),f=p.filter(q=>!q.hasAttribute("fixed")||q.getAttribute("fixed")!=="true");if(f.length<=1)return console.warn("Shuffling is not possible with fewer than 2 non-fixed elements."),t;let b=[...f],y=!1,C=0;for(;!y&&C<20;){C++;for(let q=f.length-1;q>0;q--){let T=Math.floor(Math.random()*(q+1));[f[q],f[T]]=[f[T],f[q]]}y=!f.every((q,T)=>q===b[T])}if(!y)return console.warn("Failed to shuffle the choices after multiple attempts."),null;n.removeAttribute("shuffle");let A=0;for(let q of f)q.parentElement.insertBefore(q,m[A]?.element),A++;for(let q of m)q.element.parentElement.insertBefore(q.element,f[q.originalOrder])}}return t},extendElementName:(i,s)=>(Zs(r,i,s),t),extendElementsWithClass:(i="extend")=>(Qs(r,i),t),customInteraction(i,s){let n=r.querySelector("qti-custom-interaction"),a=n.querySelector("object");return n.setAttribute("data-base-ref",i),n.setAttribute("data-base-item",i+s),n.setAttribute("data",a.getAttribute("data")),n.setAttribute("width",a.getAttribute("width")),n.setAttribute("height",a.getAttribute("height")),n.removeChild(a),t},convertCDATAtoComment(){return ro(r),t},stripStyleSheets(){return io(r),t},html(){return e!==null&&ut(r,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(pt(r))},xml(){return new XMLSerializer().serializeToString(r)},htmlDoc(){return e!==null&&ut(r,e.substring(0,e.lastIndexOf("/"))),pt(r)},xmlDoc(){return r}};return t};var oo=()=>{let o,r={async load(e,t){return new Promise(i=>{ct(e,t).then(s=>(o=s,i(r)))})},parse(e){o=dt(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return r};var mt=()=>{let o,r={async load(e,t){return new Promise((i,s)=>{ct(e,t).then(n=>(o=n,r.path(e.substring(0,e.lastIndexOf("/"))),i(r)))})},parse(e){return o=dt(e),r},path:e=>(ut(o,e),r),fn(e){return e(o),r},items(){return to(o)},html(){return new XMLSerializer().serializeToString(pt(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(){return pt(o)},xmlDoc(){return o}};return r};var no=o=>{class r extends o{constructor(...i){super(...i);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.postLoadTransformCallback=null;this.postLoadTestTransformCallback=null;this._activeController=null;this._loadResults=[];this._navigationId=0;this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1};this._loadedStimulusHrefs=new Set;this._loadingStimulusHrefs=new Set;this._bindEventHandlers()}navigateTo(i,s){let n=s||this._getDefaultNavigationId(i);n&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:n},bubbles:!0,composed:!0}))}_bindEventHandlers(){this.addEventListener("qti-request-navigation",this._handleNavigationRequest.bind(this)),this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(i){this._testElement=i.detail,this._initializeNavigation()}_handleItemConnected(i){let s=i.detail;this._loadingState.connectedItems++;let n=s.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(i){i.preventDefault();let{element:s,item:n}=i;if(console.info("Stimulus ref connected:",{identifier:s.identifier,href:s.href,item:n.identifier}),this._loadedStimulusHrefs.has(s.href)){console.info("Stimulus already loaded, skipping:",s.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(s.href)){console.info("Stimulus already loading, skipping duplicate:",s.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(s.href),console.info("Starting stimulus load:",s.href);try{await this._loadStimulusRef(s,n),this._loadedStimulusHrefs.add(s.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",s.href),this._checkLoadingComplete()}catch(a){a.name!=="AbortError"&&console.warn(`Failed to load stimulus ${s.identifier}:`,a),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(s.href)}}_getDefaultNavigationId(i){return i==="section"?this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let i=this._getDefaultNavigationId(this.navigate);i&&this.navigateTo(this.navigate,i)}async _handleNavigationRequest({detail:i}){if(!i?.id)return;this._cancelPreviousNavigation();let s=++this._navigationId,n=new AbortController;try{this._dispatchLoadingStarted(i.type,i.id),this._activeController=n,await this._executeNavigation(i.type,i.id,s,n)}catch(a){this._handleNavigationError(a,i.type,i.id)}finally{this._activeController===n&&(this._activeController=null),this._dispatchLoadingEnded(i.type,i.id)}}_handleNavigationError(i,s,n){i.name!=="AbortError"&&this._dispatchError(this._createNavigationError(i,s,n))}async _executeNavigation(i,s,n,a){i==="item"?await this._navigateToItem(s,n,a):await this._navigateToSection(s,n,a)}async _navigateToItem(i,s,n){let a=this._findItemRef(i);this._updateSessionContext(a,i),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([i],s,n),await this._waitForLoadingComplete(s,n),!this._isStaleNavigation(s,n)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(i,s,n){let l=this._findSection(i)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:l,navSectionId:i,navItemRefId:null};let d=this._getSectionItemIds(i);this._resetLoadingState(),this._loadingState.expectedItems=d.length,await this._loadItems(d,s,n),await this._waitForLoadingComplete(s,n),!this._isStaleNavigation(s,n)&&this._dispatchTestLoaded(this._loadResults)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let i=this._loadingState.connectedItems>=this._loadingState.expectedItems,s=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;i&&s&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(i,s){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(i,s))return;await new Promise(n=>setTimeout(n,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(i,s){console.info("Loading stimulus:",i.href);let n=await this._loadStimulus(i.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,i,s)}_applyStimulusContent(i,s,n){if(!i){console.warn("No stimulus content to apply");return}let a=i.querySelectorAll("qti-stimulus-body, qti-stylesheet");if(console.info(`Found ${a.length} stimulus elements to apply for ${s.identifier}`),a.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let l=[],d=document.querySelector(`qti-assessment-item[identifier="${n.identifier}"] [data-stimulus-idref="${s.identifier}"]`);if(d)l.push(d),console.info("Found specific target:",d);else{let p=Array.from(this.querySelectorAll(`[data-stimulus-idref="${s.identifier}"]`));if(p.length>0)l=p,console.info("Found targets by identifier:",p.length);else{let m=Array.from(this.querySelectorAll("[data-stimulus-idref]"));l=m,console.info("Using fallback targets:",m.length)}}if(l.length===0){console.warn("No targets found for stimulus content");return}l.forEach((p,m)=>{p.innerHTML="";let f=Array.from(a).map(b=>b.cloneNode(!0));p.append(...f),console.info(`Applied stimulus content to target ${m+1}/${l.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(i,s,n){if(!this._testElement||i.length===0)return;let a=i.map(p=>this._findItemRef(p));this._clearLoadedItems(),this._clearStimulusRef();let d=(await Promise.all(a.map(p=>this._loadSingleItem(p,s,n)))).filter(Boolean);this._isStaleNavigation(s,n)||(d.forEach(({itemRef:p,doc:m})=>{p&&m&&(p.xmlDoc=m)}),this._loadResults=d)}async _loadSingleItem(i,s,n){try{let a=await oe(this.cacheTransform).load(i.href,n.signal);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,i)),this._isStaleNavigation(s,n)?null:{itemRef:i,doc:a.htmlDoc()}}catch(a){if(a.name==="AbortError")throw console.info(`Item load for ${i.identifier} was aborted`),a;return console.warn(`Failed to load item ${i.identifier}:`,a),null}}async _loadStimulus(i){return(await oe().load(i,this._activeController?.signal)).htmlDoc()}_findItemRef(i){let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)throw new Error(`Item with identifier "${i}" not found`);return s}_findSection(i){return this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`)||null}_updateSessionContext(i,s){let n=i.closest("qti-test-part")?.identifier,a=i.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:a,navItemRefId:s}}_getSectionItemIds(i){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(s=>s.identifier).filter(Boolean)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(i||[]).forEach(s=>{s.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(i=>i.innerHTML="")}_isStaleNavigation(i,s){return s.signal.aborted||i!==this._navigationId}_createNavigationError(i,s,n){return{message:i.message||`Failed to load ${s}: ${n}`,details:i,itemId:s==="item"?n:void 0,sectionId:s==="section"?n:void 0}}_dispatchLoadingStarted(i,s){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(i,s){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}_dispatchError(i){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:i,bubbles:!0,composed:!0}))}_dispatchTestLoaded(i){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:i.map(({itemRef:s})=>({identifier:s?.identifier,element:s})),bubbles:!0,composed:!0}))})}}return c([u({type:String})],r.prototype,"navigate",2),c([u({type:Boolean,attribute:"cache-transform"})],r.prototype,"cacheTransform",2),c([u({type:Number})],r.prototype,"requestTimeout",2),c([u({attribute:!1})],r.prototype,"postLoadTransformCallback",2),c([u({attribute:!1})],r.prototype,"postLoadTestTransformCallback",2),r};var ao=o=>{class r extends o{constructor(...t){super(...t),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(t){super.willUpdate(t),t.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(n=>{n.classList.toggle("show",n.getAttribute("view")===this.sessionContext.view)});let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;s&&s.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(t){t.showCorrectResponse(this.sessionContext.view==="scorer")}}return r};var $e=class extends Event{constructor(r,e,t,i){super("context-request",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e,this.callback=t,this.subscribe=i??!1}};var ht=class{constructor(r,e,t,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,n)),this.unsubscribe=n},this.host=r,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=t,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 $e(this.context,this.host,this.t,this.subscribe))}};var Br=class{get value(){return this.o}set value(r){this.setValue(r)}setValue(r,e=!1){let t=e||!Object.is(r,this.o);this.o=r,t&&this.updateObservers()}constructor(r){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},r!==void 0&&(this.value=r)}addCallback(r,e,t){if(!t)return void r(this.value);this.subscriptions.has(r)||this.subscriptions.set(r,{disposer:()=>{this.subscriptions.delete(r)},consumerHost:e});let{disposer:i}=this.subscriptions.get(r);r(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Ni=class extends Event{constructor(r,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e}},ft=class extends Br{constructor(r,e,t){super(e.context!==void 0?e.initialValue:t),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new $e(this.context,a,n,!0)));i.stopPropagation()},this.host=r,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 Ni(this.context,this.host))}};function X({context:o}){return(r,e)=>{let t=new WeakMap;if(typeof e=="object")return{get(){return r.get.call(this)},set(i){return t.get(this).setValue(i),r.set.call(this,i)},init(i){return t.set(this,new ft(this,{context:o,initialValue:i})),i}};{r.constructor.addInitializer((n=>{t.set(n,new ft(n,{context:o}))}));let i=Object.getOwnPropertyDescriptor(r,e),s;if(i===void 0){let n=new WeakMap;s={get(){return n.get(this)},set(a){t.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{let n=i.set;s={...i,set(a){t.get(this).setValue(a),n?.call(this,a)}}}return void Object.defineProperty(r,e,s)}}}function _({context:o,subscribe:r}){return(e,t)=>{typeof t=="object"?t.addInitializer((function(){new ht(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:r})})):e.constructor.addInitializer((i=>{new ht(i,{context:o,callback:s=>{i[t]=s},subscribe:r})}))}}var Pe=Symbol("computedItemContext");var $=Symbol("computedContext");var J=Symbol("configContext");var lo=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var P=Symbol("item");var jr=Symbol("qtiContext");var Di={view:"candidate"},Ve=Symbol("testContext");var Hi={items:[],testOutcomeVariables:[]},ne=Symbol("testContext");var co=(t=>(t.Correct="correct",t.PartiallyCorrect="partially-correct",t.Incorrect="incorrect",t))(co||{}),R=class extends v{constructor(){super();this.disabled=!1;this.readonly=!1;this._internals=this.attachInternals()}static{this.formAssociated=!0}get internals(){return this._internals}get isFullCorrectResponse(){return this._isFullCorrectResponse}set isFullCorrectResponse(e){this._isFullCorrectResponse=e,e&&(this.disabled=!0,this.setAttribute("response-identifier",this.responseIdentifier+"_cr"))}get correctResponse(){return this._correctResponse}set correctResponse(e){this._correctResponse=e}get correctness(){let e=this.responseVariable;return!e||e.correctResponse===null?null:e.correctResponse===e.value?"correct":"incorrect"}get isInline(){return!1}get responseVariable(){let e=this._context.variables.filter(i=>i.type==="response"),t=this.getAttribute("response-identifier");return e.find(i=>i.identifier===t)}toggleCorrectResponse(e){(this?.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(e):this.toggleInternalCorrectResponse(e)}async toggleFullCorrectResponse(e){let t=this.nextSibling,i=t instanceof HTMLDivElement&&t?.classList.contains("full-correct-response"),s=this.responseVariable;if(!s)return;if(!(e&&(this?.configContext?.fullCorrectResponseOnlyWhenIncorrect===!1||this.correctness!=="correct"))){if(!i)return;this.parentElement?.removeChild(t)}if(i)return;let a=this.cloneNode(!0),l=document.createElement("div");l.classList.add("full-correct-response"),this.isInline?l.classList.add("full-correct-response-inline"):l.classList.add("full-correct-response-block"),l.role="full-correct-response",l.appendChild(a),a.isFullCorrectResponse=!0,this.parentElement?.insertBefore(l,this.nextSibling),await a.updateComplete,a.response=Array.isArray(s.correctResponse)?[...s.correctResponse]:s.correctResponse}toggleInternalCorrectResponse(e){let t=this.responseVariable;this.correctResponse=e?t?.correctResponse:t?.cardinality==="single"?"":[]}toggleCandidateCorrection(e){this.responseVariable&&(this._internals.states.delete("candidate-correct"),this._internals.states.delete("candidate-partially-correct"),this._internals.states.delete("candidate-incorrect"),e&&(this.correctness==="correct"&&this._internals.states.add("candidate-correct"),this.correctness==="partially-correct"&&this._internals.states.add("candidate-partially-correct"),this.correctness==="incorrect"&&this._internals.states.add("candidate-incorrect")))}get value(){return JSON.stringify(this.response)}set value(e){this.response=e?JSON.parse(e):null}reportValidity(){return this._internals.reportValidity()}reset(){this.response=null}connectedCallback(){super.connectedCallback(),!this.isFullCorrectResponse&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e}}))}};c([_({context:P,subscribe:!0})],R.prototype,"_context",2),c([_({context:J,subscribe:!0})],R.prototype,"configContext",2),c([u({type:String,attribute:"response-identifier"})],R.prototype,"responseIdentifier",2),c([u({reflect:!0,type:Boolean})],R.prototype,"disabled",2),c([u({reflect:!0,type:Boolean})],R.prototype,"readonly",2),c([E()],R.prototype,"_isFullCorrectResponse",2),c([E()],R.prototype,"_correctResponse",2);var gt=class extends v{render(){return h`<slot></slot>`}defaultValues(r){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let t=e.map(i=>i.innerHTML.trim());return t.length>1||r==="multiple"||r==="ordered"?t:t[0]}};var w=class extends v{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(console.debug("getVariables",e.tagName.toLowerCase()),e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return t==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.context.variables.find(s=>s.identifier===t)||null}case"qti-multiple":{let i=e.getResult();return console.debug("values",i),i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(s=>s.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(s=>s.value),cardinality:"ordered",type:"response"}:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",i=this.context?.variables?.find(s=>s.identifier===t)||null;return{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}}default:{try{return{baseType:"integer",value:e.getResult()?.toString()||null,cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}static{this.styles=x`
|
|
27
27
|
slot {
|
|
28
28
|
display: none;
|
|
29
29
|
}
|
|
30
30
|
`}render(){return h`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
31
|
-
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};c([E()],w.prototype,"result",2),c([_({context:P,subscribe:!0}),E()],w.prototype,"context",2),c([_({context:jr,subscribe:!0}),E()],w.prototype,"qtiContext",2);var K=class extends w{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Sn=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Gt=o=>{if(typeof o=="string")return o;let r=Sn();return r==="."?o.toLocaleString():o.toString().replace(".","").replace(r,".")};function zi(o){return o==null}function Ze(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var G=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(r){let e=this._context.variables.find(i=>i.identifier===r)||null;if(this.outcomeIdentifier!==r||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!zi(this.identifier)&&!zi(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(r){this.showStatus=r&&this.showHide==="show"||!r&&this.showHide==="hide"?"on":"off"}};c([u({type:String,attribute:"show-hide"})],G.prototype,"showHide",2),c([u({type:String,attribute:"outcome-identifier"})],G.prototype,"outcomeIdentifier",2),c([u({type:String})],G.prototype,"identifier",2),c([u({type:String,attribute:!1})],G.prototype,"showStatus",2),c([_({context:P,subscribe:!0}),E()],G.prototype,"_context",2);var po=class extends v{};var z=class{static isPointInArea(r,e,t){if(t!=="point")return console.warn(`Base type ${t} is not supported for point area mapping.`),!1;let[i,s]=r.split(" ").map(Number),[n,...a]=e.split(","),l=a.map(Number);switch(n.toLowerCase()){case"circle":case"default":{let[d,p,m]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-d)**2+(s-p)**2)<=m}case"rect":{let[d,p,m,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=d&&i<=m&&s>=p&&s<=f}case"ellipse":{let[d,p,m,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let b=(i-d)**2/m**2,y=(s-p)**2/f**2;return b+y<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let d=[];for(let p=0;p<l.length;p+=2)d.push({x:l[p],y:l[p+1]});return this.isPointInPolygon({x:i,y:s},d)}default:return console.warn(`Unsupported shape type: ${n}`),!1}}static isPointInPolygon(r,e){let t=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let n=e[i].x,a=e[i].y,l=e[s].x,d=e[s].y;a>r.y!=d>r.y&&r.x<(l-n)*(r.y-a)/(d-a)+n&&(t=!t)}return t}static compareSingleValues(r,e,t){switch(t){case"identifier":case"string":return r===e;case"integer":{let i=parseInt(r,10),s=parseInt(e,10);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`Cannot convert ${r} and/or ${e} to int.`);break}case"float":{let i=parseFloat(r),s=parseFloat(e);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`couldn't convert ${r} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=r.split(" ").sort(),s=e.split(" ").sort();if(i.length===2&&s.length===2)return t==="pair"&&(i.sort(),s.sort()),i.join(" ")===s.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${r} 2: ${e}`);break}}return!1}};var Fi=o=>{class r extends o{constructor(...i){super(...i);this.testContext=Hi;this.sessionContext=Ni;this._updateItemInTestContext=i=>{let s=i._context,n=s.identifier,a=s.variables,l=this.testContext.items.find(d=>d?.identifier===n);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${n} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(n,a);else{let d=[...i.variables];for(let p of l.variables){let m=d.find(f=>f.identifier===p.identifier);m?m.value=p.value:d.push(p)}i.variables=d}};this._initializeEventListeners()}updateItemVariables(i,s){let n=this.testContext.items.find(l=>l.identifier===i);n&&(n.variables=n.variables.map(l=>{let d=s.find(p=>p.identifier===l.identifier);return d?{...l,...d}:l}));let a=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);a&&a.assessmentItem&&(a.assessmentItem.variables=s)}_initializeEventListeners(){this.addEventListener("qti-assessment-test-connected",i=>{if(this.testContext=Hi,this.sessionContext=Ni,this.testContext&&this.testContext.items.length>0)return;this._testElement=i.detail;let s=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:s}}),this.addEventListener("qti-assessment-item-connected",i=>{let s=i.detail,n=s.closest("qti-assessment-item-ref")?.identifier;n&&(s.assessmentItemRefId=n),this._updateItemInTestContext(i.detail)}),this.addEventListener("qti-item-context-updated",i=>{this._updateItemVariablesInTestContext(i.detail.itemContext.identifier,i.detail.itemContext.variables)})}_updateItemVariablesInTestContext(i,s){this.testContext={...this.testContext,items:this.testContext.items.map(n=>n.identifier!==i?n:{...n,variables:s.map(a=>{let l=n.variables.find(d=>d.identifier===a.identifier);return l?{...l,...a}:a})})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return c([u({attribute:!1,type:Object}),X({context:ne})],r.prototype,"testContext",2),c([u({attribute:!1,type:Object}),X({context:Ve})],r.prototype,"sessionContext",2),r},uo=class extends Fi(v){};var mo=o=>{class r extends o{constructor(...t){super(...t),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:s,value:n}=i.detail;this.updateOutcomeVariable(s,n),i.stopPropagation()})}outcomeProcessing(){let t=this.querySelector("qti-outcome-processing");return t?(t?.process(),!0):!1}updateOutcomeVariable(t,i){let s=this.getOutcome(t);if(!s){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>n.identifier!==t?n:{...n,value:s.cardinality==="single"?i:[...n.value,i]})}}getOutcome(t){return this.getVariable(t)}getVariable(t){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===t)||null}}return r};var Wr=class extends no(ao(mo(Fi(v)))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return h`<slot></slot>`}};Wr=c([g("qti-test")],Wr);var ho={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},xe=class extends v{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};c([u({type:String})],xe.prototype,"category",2),c([u({type:String})],xe.prototype,"identifier",2),c([u({type:Boolean,converter:ho})],xe.prototype,"required",2),c([u({type:Boolean,converter:ho})],xe.prototype,"fixed",2),c([u({type:String})],xe.prototype,"href",2),c([u({type:Object,attribute:!1})],xe.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",xe);var Ui={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},qe=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){this._title=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};c([u({type:String})],qe.prototype,"identifier",2),c([u({type:String})],qe.prototype,"required",2),c([u({type:Boolean,converter:Ui})],qe.prototype,"fixed",2),c([u({type:Boolean,converter:Ui})],qe.prototype,"visible",2),c([u({type:Boolean,converter:Ui,attribute:"keep-together"})],qe.prototype,"keepTogether",2),c([_({context:ne,subscribe:!0})],qe.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",qe);var Qe=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};c([u({type:String})],Qe.prototype,"identifier",2),c([u({type:String})],Qe.prototype,"title",1),c([_({context:ne,subscribe:!0})],Qe.prototype,"_testContext",2),Qe=c([g("qti-assessment-test")],Qe);var Ce=class extends v{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};c([u({type:String})],Ce.prototype,"identifier",2),c([u({type:String})],Ce.prototype,"class",2),c([u({type:String,attribute:"navigation-mode"})],Ce.prototype,"navigationMode",2),c([u({type:String,attribute:"submission-mode"})],Ce.prototype,"submissionMode",2),Ce=c([g("qti-test-part")],Ce);customElements.get("qti-test-part")||customElements.define("qti-test-part",Ce);function Xr(o,r){return(e,t)=>{let{connectedCallback:i,disconnectedCallback:s}=e;e.connectedCallback=function(){i.call(this);let n=this[t],a=m=>{let f=[],b=[];for(let q of m)q.type==="childList"&&(q.addedNodes.forEach(T=>{if(T.nodeType!==1)return;let M=T;M.matches?.(o)&&f.push(M),f.push(...M.querySelectorAll?.(o)??[])}),q.removedNodes.forEach(T=>{if(T.nodeType!==1)return;let M=T;M.matches?.(o)&&b.push(M),b.push(...M.querySelectorAll?.(o)??[])}));let y=q=>Array.from(new Set(q)),C=y(f),A=y(b);(C.length||A.length)&&n.call(this,C,A)},l=new MutationObserver(a);l.observe(this,{childList:!0,subtree:!0});let d=this.shadowRoot?new MutationObserver(a):null;d?.observe(this.shadowRoot,{childList:!0,subtree:!0}),this.__lqObservers=[l,d].filter(m=>!!m),(async()=>{r?.waitUntilFirstUpdate&&"updateComplete"in this&&await this.updateComplete;let m=[...this.querySelectorAll(o),...this.shadowRoot?.querySelectorAll(o)??[]];m.length&&n.call(this,m,[])})()},e.disconnectedCallback=function(){s.call(this),this.__lqObservers?.forEach(n=>n.disconnect()),this.__lqObservers=void 0}}}function I(o,r){let e={waitUntilFirstUpdate:!1,...r};return(t,i)=>{let{update:s}=t,n=Array.isArray(o)?o:[o];t.update=function(a){n.forEach(l=>{let d=l;if(a.has(d)){let p=a.get(d),m=this[d];p!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](p,m)}}),s.call(this,a)}}}var Y=class extends v{constructor(){super(...arguments);this._templateProcessing=null;this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{this._interactionElements.forEach(i=>i.disabled=t)};this._handleReadonlyChange=(e,t)=>this._interactionElements.forEach(i=>i.readonly=t);this._context={variables:lo};this._initialContext={...this._context,variables:this._context.variables};this._feedbackElements=[];this._interactionElements=[];this._handleRegisterVariable=e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},this._initialContext=this._context,e.stopPropagation()};this._handleRegisterFeedback=e=>{e.stopImmediatePropagation();let t=e.detail;this._feedbackElements.push(t),(Number(this._context.variables.find(s=>s.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)};this._handleRegisterInteraction=e=>{e.stopImmediatePropagation(),this._interactionElements.push(e.detail.interactionElement)};this._handleEndAttempt=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:i}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(i)};this._handleSetOutcomeValue=e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:i}=e.detail;this.updateOutcomeVariable(t,i),e.stopPropagation()};this._handleUpdateResponseVariable=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:i}=e.detail;this.updateResponseVariable(t,i),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}get title(){return this._itemTitle}set title(e){this._itemTitle=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let i=e.find(s=>s.identifier===t.identifier);return i?{...t,...i,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let i=this._interactionElements.find(s=>s.responseIdentifier===t.identifier);i&&(i.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&this._feedbackElements.forEach(i=>i.checkShowFeedback(t.identifier))})}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let s=this._interactionElements.find(n=>n.getAttribute("response-identifier")===t.responseIdentifier);s&&(s.response=t.response)}}render(){return h`<slot></slot>`}connectedCallback(){this._attachEventListeners(),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this._processTemplates()})}disconnectedCallback(){this._removeEventListeners(),super.disconnectedCallback()}_attachEventListeners(){this.addEventListener("qti-register-variable",this._handleRegisterVariable),this.addEventListener("qti-register-feedback",this._handleRegisterFeedback),this.addEventListener("qti-register-interaction",this._handleRegisterInteraction),this.addEventListener("end-attempt",this._handleEndAttempt),this.addEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.addEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}_removeEventListeners(){this.removeEventListener("qti-register-variable",this._handleRegisterVariable),this.removeEventListener("qti-register-feedback",this._handleRegisterFeedback),this.removeEventListener("qti-register-interaction",this._handleRegisterInteraction),this.removeEventListener("end-attempt",this._handleEndAttempt),this.removeEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.removeEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}showCorrectResponse(e){for(let t of this._interactionElements)t.toggleCorrectResponse(e);document.querySelectorAll("item-show-correct-response").forEach(t=>{t.shown=e})}showCandidateCorrection(e){for(let t of this._interactionElements)t.toggleCandidateCorrection(e);document.querySelectorAll("item-show-candidate-correction").forEach(t=>{t.shown=e})}_processTemplates(){this._templateProcessing=this.querySelector("qti-template-processing"),this._templateProcessing&&this._templateProcessing.process()}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(s=>s.identifier==="numAttempts")?.value+1).toString());let i=this.querySelector("qti-response-processing");return!i||!i.process?!1:(i.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:t})},this.showCandidateCorrection(!1),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(s=>s.identifier!==e?s:{...s,value:i.cardinality==="single"||Array.isArray(t)?t:[t]})},this._feedbackElements.forEach(s=>s.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(s=>s.identifier===e)?.value}}))}validate(e=!0){let t=this._interactionElements.every(i=>i.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of this._interactionElements)e.reportValidity()}_getCompletionStatus(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"}};c([u({type:String})],Y.prototype,"identifier",2),c([u({type:String})],Y.prototype,"adaptive",2),c([u({type:String})],Y.prototype,"timeDependent",2),c([u({type:String})],Y.prototype,"title",1),c([u({type:Boolean})],Y.prototype,"disabled",2),c([I("disabled",{waitUntilFirstUpdate:!0})],Y.prototype,"_handleDisabledChange",2),c([u({type:Boolean})],Y.prototype,"readonly",2),c([I("readonly",{waitUntilFirstUpdate:!0})],Y.prototype,"_handleReadonlyChange",2),c([X({context:P})],Y.prototype,"_context",2),Y=c([g("qti-assessment-item")],Y);var Bi=class o extends Event{constructor(e,t){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0});this.element=e;this.item=t}static{this.eventName="qti-assessment-stimulus-ref-connected"}},bt=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let e=this.closest("qti-assessment-item"),t=new Bi(this,e);this.dispatchEvent(t);let i=e?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!t.defaultPrevented&&i&&await this.updateStimulusRef(i)}async updateStimulusRef(e){let t=await oe().load(this.href).then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};c([u({type:String})],bt.prototype,"identifier",2),c([u({type:String})],bt.prototype,"href",2),bt=c([g("qti-assessment-stimulus-ref")],bt);var Gr=class extends v{};Gr=c([g("qti-companion-materials-info")],Gr);var Yt=class extends v{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let r=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",r?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let r={variable:t=>this._context?.variables.find(i=>i.identifier===t)?.value??"",correct:t=>this._context?.variables.find(i=>i.identifier===t)?.correctResponse??""},e={getVariable:t=>this._context?.variables.find(i=>i.identifier===t),updateOutcomeVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:i}}))},updateResponseVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,response:i}}))}};return this.operatorFunction(this._context,r,e)}};c([_({context:P,subscribe:!0}),E()],Yt.prototype,"_context",2),Yt=c([g("qti-custom-operator")],Yt);var Jt=class extends G{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Jt.styles=x`
|
|
31
|
+
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};c([E()],w.prototype,"result",2),c([_({context:P,subscribe:!0}),E()],w.prototype,"context",2),c([_({context:jr,subscribe:!0}),E()],w.prototype,"qtiContext",2);var K=class extends w{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Sn=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Gt=o=>{if(typeof o=="string")return o;let r=Sn();return r==="."?o.toLocaleString():o.toString().replace(".","").replace(r,".")};function zi(o){return o==null}function Ze(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var G=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(r){let e=this._context.variables.find(i=>i.identifier===r)||null;if(this.outcomeIdentifier!==r||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!zi(this.identifier)&&!zi(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(r){this.showStatus=r&&this.showHide==="show"||!r&&this.showHide==="hide"?"on":"off"}};c([u({type:String,attribute:"show-hide"})],G.prototype,"showHide",2),c([u({type:String,attribute:"outcome-identifier"})],G.prototype,"outcomeIdentifier",2),c([u({type:String})],G.prototype,"identifier",2),c([u({type:String,attribute:!1})],G.prototype,"showStatus",2),c([_({context:P,subscribe:!0}),E()],G.prototype,"_context",2);var po=class extends v{};var z=class{static isPointInArea(r,e,t){if(t!=="point")return console.warn(`Base type ${t} is not supported for point area mapping.`),!1;let[i,s]=r.split(" ").map(Number),[n,...a]=e.split(","),l=a.map(Number);switch(n.toLowerCase()){case"circle":case"default":{let[d,p,m]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-d)**2+(s-p)**2)<=m}case"rect":{let[d,p,m,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=d&&i<=m&&s>=p&&s<=f}case"ellipse":{let[d,p,m,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let b=(i-d)**2/m**2,y=(s-p)**2/f**2;return b+y<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let d=[];for(let p=0;p<l.length;p+=2)d.push({x:l[p],y:l[p+1]});return this.isPointInPolygon({x:i,y:s},d)}default:return console.warn(`Unsupported shape type: ${n}`),!1}}static isPointInPolygon(r,e){let t=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let n=e[i].x,a=e[i].y,l=e[s].x,d=e[s].y;a>r.y!=d>r.y&&r.x<(l-n)*(r.y-a)/(d-a)+n&&(t=!t)}return t}static compareSingleValues(r,e,t){switch(t){case"identifier":case"string":return r===e;case"integer":{let i=parseInt(r,10),s=parseInt(e,10);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`Cannot convert ${r} and/or ${e} to int.`);break}case"float":{let i=parseFloat(r),s=parseFloat(e);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`couldn't convert ${r} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=r.split(" ").sort(),s=e.split(" ").sort();if(i.length===2&&s.length===2)return t==="pair"&&(i.sort(),s.sort()),i.join(" ")===s.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${r} 2: ${e}`);break}}return!1}};var Fi=o=>{class r extends o{constructor(...i){super(...i);this.testContext=Hi;this.sessionContext=Di;this._updateItemInTestContext=i=>{let s=i._context,n=s.identifier,a=s.variables,l=this.testContext.items.find(d=>d?.identifier===n);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${n} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(n,a);else{let d=[...i.variables];for(let p of l.variables){let m=d.find(f=>f.identifier===p.identifier);m?m.value=p.value:d.push(p)}i.variables=d}};this._initializeEventListeners()}updateItemVariables(i,s){let n=this.testContext.items.find(l=>l.identifier===i);n&&(n.variables=n.variables.map(l=>{let d=s.find(p=>p.identifier===l.identifier);return d?{...l,...d}:l}));let a=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);a&&a.assessmentItem&&(a.assessmentItem.variables=s)}_initializeEventListeners(){this.addEventListener("qti-assessment-test-connected",i=>{if(this.testContext=Hi,this.sessionContext=Di,this.testContext&&this.testContext.items.length>0)return;this._testElement=i.detail;let s=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:s}}),this.addEventListener("qti-assessment-item-connected",i=>{let s=i.detail,n=s.closest("qti-assessment-item-ref")?.identifier;n&&(s.assessmentItemRefId=n),this._updateItemInTestContext(i.detail)}),this.addEventListener("qti-item-context-updated",i=>{this._updateItemVariablesInTestContext(i.detail.itemContext.identifier,i.detail.itemContext.variables)})}_updateItemVariablesInTestContext(i,s){this.testContext={...this.testContext,items:this.testContext.items.map(n=>n.identifier!==i?n:{...n,variables:s.map(a=>{let l=n.variables.find(d=>d.identifier===a.identifier);return l?{...l,...a}:a})})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return c([u({attribute:!1,type:Object}),X({context:ne})],r.prototype,"testContext",2),c([u({attribute:!1,type:Object}),X({context:Ve})],r.prototype,"sessionContext",2),r},uo=class extends Fi(v){};var mo=o=>{class r extends o{constructor(...t){super(...t),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:s,value:n}=i.detail;this.updateOutcomeVariable(s,n),i.stopPropagation()})}outcomeProcessing(){let t=this.querySelector("qti-outcome-processing");return t?(t?.process(),!0):!1}updateOutcomeVariable(t,i){let s=this.getOutcome(t);if(!s){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>n.identifier!==t?n:{...n,value:s.cardinality==="single"?i:[...n.value,i]})}}getOutcome(t){return this.getVariable(t)}getVariable(t){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===t)||null}}return r};var Wr=class extends no(ao(mo(Fi(v)))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return h`<slot></slot>`}};Wr=c([g("qti-test")],Wr);var ho={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},xe=class extends v{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};c([u({type:String})],xe.prototype,"category",2),c([u({type:String})],xe.prototype,"identifier",2),c([u({type:Boolean,converter:ho})],xe.prototype,"required",2),c([u({type:Boolean,converter:ho})],xe.prototype,"fixed",2),c([u({type:String})],xe.prototype,"href",2),c([u({type:Object,attribute:!1})],xe.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",xe);var Ui={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},qe=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){this._title=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};c([u({type:String})],qe.prototype,"identifier",2),c([u({type:String})],qe.prototype,"required",2),c([u({type:Boolean,converter:Ui})],qe.prototype,"fixed",2),c([u({type:Boolean,converter:Ui})],qe.prototype,"visible",2),c([u({type:Boolean,converter:Ui,attribute:"keep-together"})],qe.prototype,"keepTogether",2),c([_({context:ne,subscribe:!0})],qe.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",qe);var Qe=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};c([u({type:String})],Qe.prototype,"identifier",2),c([u({type:String})],Qe.prototype,"title",1),c([_({context:ne,subscribe:!0})],Qe.prototype,"_testContext",2),Qe=c([g("qti-assessment-test")],Qe);var Ce=class extends v{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};c([u({type:String})],Ce.prototype,"identifier",2),c([u({type:String})],Ce.prototype,"class",2),c([u({type:String,attribute:"navigation-mode"})],Ce.prototype,"navigationMode",2),c([u({type:String,attribute:"submission-mode"})],Ce.prototype,"submissionMode",2),Ce=c([g("qti-test-part")],Ce);customElements.get("qti-test-part")||customElements.define("qti-test-part",Ce);function Xr(o,r){return(e,t)=>{let{connectedCallback:i,disconnectedCallback:s}=e;e.connectedCallback=function(){i.call(this);let n=this[t],a=m=>{let f=[],b=[];for(let q of m)q.type==="childList"&&(q.addedNodes.forEach(T=>{if(T.nodeType!==1)return;let M=T;M.matches?.(o)&&f.push(M),f.push(...M.querySelectorAll?.(o)??[])}),q.removedNodes.forEach(T=>{if(T.nodeType!==1)return;let M=T;M.matches?.(o)&&b.push(M),b.push(...M.querySelectorAll?.(o)??[])}));let y=q=>Array.from(new Set(q)),C=y(f),A=y(b);(C.length||A.length)&&n.call(this,C,A)},l=new MutationObserver(a);l.observe(this,{childList:!0,subtree:!0});let d=this.shadowRoot?new MutationObserver(a):null;d?.observe(this.shadowRoot,{childList:!0,subtree:!0}),this.__lqObservers=[l,d].filter(m=>!!m),(async()=>{r?.waitUntilFirstUpdate&&"updateComplete"in this&&await this.updateComplete;let m=[...this.querySelectorAll(o),...this.shadowRoot?.querySelectorAll(o)??[]];m.length&&n.call(this,m,[])})()},e.disconnectedCallback=function(){s.call(this),this.__lqObservers?.forEach(n=>n.disconnect()),this.__lqObservers=void 0}}}function I(o,r){let e={waitUntilFirstUpdate:!1,...r};return(t,i)=>{let{update:s}=t,n=Array.isArray(o)?o:[o];t.update=function(a){n.forEach(l=>{let d=l;if(a.has(d)){let p=a.get(d),m=this[d];p!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](p,m)}}),s.call(this,a)}}}var Y=class extends v{constructor(){super(...arguments);this._templateProcessing=null;this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{this._interactionElements.forEach(i=>i.disabled=t)};this._handleReadonlyChange=(e,t)=>this._interactionElements.forEach(i=>i.readonly=t);this._context={variables:lo};this._initialContext={...this._context,variables:this._context.variables};this._feedbackElements=[];this._interactionElements=[];this._handleRegisterVariable=e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},this._initialContext=this._context,e.stopPropagation()};this._handleRegisterFeedback=e=>{e.stopImmediatePropagation();let t=e.detail;this._feedbackElements.push(t),(Number(this._context.variables.find(s=>s.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)};this._handleRegisterInteraction=e=>{e.stopImmediatePropagation(),this._interactionElements.push(e.detail.interactionElement)};this._handleEndAttempt=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:i}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(i)};this._handleSetOutcomeValue=e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:i}=e.detail;this.updateOutcomeVariable(t,i),e.stopPropagation()};this._handleUpdateResponseVariable=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:i}=e.detail;this.updateResponseVariable(t,i),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}get title(){return this._itemTitle}set title(e){this._itemTitle=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let i=e.find(s=>s.identifier===t.identifier);return i?{...t,...i,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let i=this._interactionElements.find(s=>s.responseIdentifier===t.identifier);i&&(i.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&this._feedbackElements.forEach(i=>i.checkShowFeedback(t.identifier))})}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let s=this._interactionElements.find(n=>n.getAttribute("response-identifier")===t.responseIdentifier);s&&(s.response=t.response)}}render(){return h`<slot></slot>`}connectedCallback(){this._attachEventListeners(),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this._processTemplates()})}disconnectedCallback(){this._removeEventListeners(),super.disconnectedCallback()}_attachEventListeners(){this.addEventListener("qti-register-variable",this._handleRegisterVariable),this.addEventListener("qti-register-feedback",this._handleRegisterFeedback),this.addEventListener("qti-register-interaction",this._handleRegisterInteraction),this.addEventListener("end-attempt",this._handleEndAttempt),this.addEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.addEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}_removeEventListeners(){this.removeEventListener("qti-register-variable",this._handleRegisterVariable),this.removeEventListener("qti-register-feedback",this._handleRegisterFeedback),this.removeEventListener("qti-register-interaction",this._handleRegisterInteraction),this.removeEventListener("end-attempt",this._handleEndAttempt),this.removeEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.removeEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}showCorrectResponse(e){for(let t of this._interactionElements)t.toggleCorrectResponse(e);document.querySelectorAll("item-show-correct-response").forEach(t=>{t.shown=e})}showCandidateCorrection(e){for(let t of this._interactionElements)t.toggleCandidateCorrection(e);document.querySelectorAll("item-show-candidate-correction").forEach(t=>{t.shown=e})}_processTemplates(){this._templateProcessing=this.querySelector("qti-template-processing"),this._templateProcessing&&this._templateProcessing.process()}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(n=>n.identifier==="numAttempts")?.value+1).toString());let i=this.querySelector("qti-response-processing"),s=!!(i&&typeof i.process=="function");return s&&i.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),s}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:t})},this.showCandidateCorrection(!1),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(s=>s.identifier!==e?s:{...s,value:i.cardinality==="single"||Array.isArray(t)?t:[t]})},this._feedbackElements.forEach(s=>s.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(s=>s.identifier===e)?.value}}))}validate(e=!0){let t=this._interactionElements.every(i=>i.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of this._interactionElements)e.reportValidity()}_getCompletionStatus(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"}};c([u({type:String})],Y.prototype,"identifier",2),c([u({type:String})],Y.prototype,"adaptive",2),c([u({type:String})],Y.prototype,"timeDependent",2),c([u({type:String})],Y.prototype,"title",1),c([u({type:Boolean})],Y.prototype,"disabled",2),c([I("disabled",{waitUntilFirstUpdate:!0})],Y.prototype,"_handleDisabledChange",2),c([u({type:Boolean})],Y.prototype,"readonly",2),c([I("readonly",{waitUntilFirstUpdate:!0})],Y.prototype,"_handleReadonlyChange",2),c([X({context:P})],Y.prototype,"_context",2),Y=c([g("qti-assessment-item")],Y);var Bi=class o extends Event{constructor(e,t){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0});this.element=e;this.item=t}static{this.eventName="qti-assessment-stimulus-ref-connected"}},bt=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let e=this.closest("qti-assessment-item"),t=new Bi(this,e);this.dispatchEvent(t);let i=e?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!t.defaultPrevented&&i&&await this.updateStimulusRef(i)}async updateStimulusRef(e){let t=await oe().load(this.href).then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};c([u({type:String})],bt.prototype,"identifier",2),c([u({type:String})],bt.prototype,"href",2),bt=c([g("qti-assessment-stimulus-ref")],bt);var Gr=class extends v{};Gr=c([g("qti-companion-materials-info")],Gr);var Yt=class extends v{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let r=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",r?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let r={variable:t=>this._context?.variables.find(i=>i.identifier===t)?.value??"",correct:t=>this._context?.variables.find(i=>i.identifier===t)?.correctResponse??""},e={getVariable:t=>this._context?.variables.find(i=>i.identifier===t),updateOutcomeVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:i}}))},updateResponseVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,response:i}}))}};return this.operatorFunction(this._context,r,e)}};c([_({context:P,subscribe:!0}),E()],Yt.prototype,"_context",2),Yt=c([g("qti-custom-operator")],Yt);var Jt=class extends G{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Jt.styles=x`
|
|
32
32
|
:host {
|
|
33
33
|
display: block;
|
|
34
34
|
}
|
|
@@ -187,14 +187,14 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
187
187
|
:host([disabled]) {
|
|
188
188
|
${B};
|
|
189
189
|
}
|
|
190
|
-
`,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],Oe.prototype,"_internalDisabled",2),c([_({context:$,subscribe:!0})],Oe.prototype,"computedContext",2),c([I("computedContext")],Oe.prototype,"_handleTestElementChange",1),Oe=c([g("test-next")],Oe);var
|
|
190
|
+
`,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],Oe.prototype,"_internalDisabled",2),c([_({context:$,subscribe:!0})],Oe.prototype,"computedContext",2),c([I("computedContext")],Oe.prototype,"_handleTestElementChange",1),Oe=c([g("test-next")],Oe);var Ne=class extends v{constructor(){super();this._internalDisabled=!0;this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return h`<slot></slot>`}};Ne.styles=x`
|
|
191
191
|
:host {
|
|
192
192
|
${U};
|
|
193
193
|
}
|
|
194
194
|
:host([disabled]) {
|
|
195
195
|
${B};
|
|
196
196
|
}
|
|
197
|
-
`,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],
|
|
197
|
+
`,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],Ne.prototype,"_internalDisabled",2),c([_({context:$,subscribe:!0})],Ne.prototype,"computedContext",2),c([I("computedContext")],Ne.prototype,"_handleTestElementChange",1),Ne=c([g("test-prev")],Ne);var j=class extends v{constructor(){super(...arguments);this.label="view";this._handleViewOptionsChange=()=>{this.updateViewOptions()};this._viewOptions=j.DEFAULT_VIEW_OPTIONS}connectedCallback(){super.connectedCallback(),this.updateViewOptions()}updateViewOptions(){if(this.viewOptions){let e=this.viewOptions.split(",").map(t=>t.trim());this._viewOptions=e.filter(t=>j.DEFAULT_VIEW_OPTIONS.includes(t))}else this._viewOptions=j.DEFAULT_VIEW_OPTIONS}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}render(){return h`
|
|
198
198
|
<label part="label" for="viewSelect">${this.label}</label>
|
|
199
199
|
<select
|
|
200
200
|
part="select"
|
|
@@ -225,7 +225,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
225
225
|
${B};
|
|
226
226
|
}
|
|
227
227
|
`,c([_({context:$,subscribe:!0})],ee.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],ee.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],ee.prototype,"disabled",2),c([u({type:String})],ee.prototype,"showCorrectText",2),c([u({type:String})],ee.prototype,"hideCorrectText",2),c([u({type:String})],ee.prototype,"noCorrectResponseText",2),ee=c([g("test-show-correct-response")],ee);var Zr=["this"],xo=["+","-","!"],qo=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],ji={"!":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},Qr=13;var Rn=["==","!=","<=",">=","||","&&","??","|>"],kn=["===","!=="],S;(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"})(S||(S={}));var de=(o,r,e=0)=>({kind:o,value:r,precedence:e}),Mn=o=>o===9||o===10||o===13||o===32,Co=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),In=o=>Co(o)||rr(o),Ln=o=>Zr.indexOf(o)!==-1,$n=o=>o===34||o===39,rr=o=>48<=o&&o<=57,Pn=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,Vn=o=>o===40||o===41||o===91||o===93||o===123||o===125,On=o=>o.replace(/\\(.)/g,(r,e)=>{switch(e){case"n":return`
|
|
228
|
-
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),ei=class{#s;#n=-1;#i=0;#t;constructor(r){this.#s=r,this.#e()}nextToken(){for(;Mn(this.#t);)this.#e(!0);if($n(this.#t))return this.#l();if(Co(this.#t))return this.#d();if(rr(this.#t))return this.#p();if(this.#t===46)return this.#a();if(this.#t===44)return this.#u();if(this.#t===58)return this.#c();if(Pn(this.#t))return this.#h();if(Vn(this.#t))return this.#f();if(this.#e(),this.#t!==void 0)throw new Error(`Expected end of input, got ${this.#t}`)}#e(r){this.#n++,this.#n<this.#s.length?(this.#t=this.#s.charCodeAt(this.#n),r===!0&&(this.#i=this.#n)):this.#t=void 0}#r(r=0){let e=this.#s.substring(this.#i,this.#n+r);return r===0&&this.#o(),e}#o(){this.#i=this.#n}#l(){let r="unterminated string",e=this.#t;for(this.#e(!0);this.#t!==e;){if(this.#t===void 0)throw new Error(r);if(this.#t===92&&(this.#e(),this.#t===void 0))throw new Error(r);this.#e()}let t=de(S.STRING,On(this.#r()));return this.#e(),t}#d(){do this.#e();while(In(this.#t));let r=this.#r(),e=Ln(r)?S.KEYWORD:S.IDENTIFIER;return de(e,r)}#p(){do this.#e();while(rr(this.#t));return this.#t===46?this.#a():de(S.INTEGER,this.#r())}#a(){return this.#e(),rr(this.#t)?this.#m():(this.#o(),de(S.DOT,".",Qr))}#u(){return this.#e(!0),de(S.COMMA,",")}#c(){return this.#e(!0),de(S.COLON,":")}#m(){do this.#e();while(rr(this.#t));return de(S.DECIMAL,this.#r())}#h(){this.#e();let r=this.#r(2);if(kn.indexOf(r)!==-1)this.#e(),this.#e();else{if(r=this.#r(1),r==="=>")return this.#e(),de(S.ARROW,r);Rn.indexOf(r)!==-1&&this.#e()}return r=this.#r(),de(S.OPERATOR,r,ji[r])}#f(){let r=String.fromCharCode(this.#t),e=de(S.GROUPER,r,ji[r]);return this.#e(!0),e}};var Wi=(o,r)=>new ir(o,r).parse(),ir=class{#s;#n;#i;#t;#e;constructor(r,e){this.#n=new ei(r),this.#i=e}parse(){return this.#r(),this.#o()}#r(r,e){if(!this._matches(r,e))throw new Error(`Expected kind ${r} (${e}), was ${this.#t?.kind} (${this.#t?.value})`);let t=this.#n.nextToken();this.#t=t,this.#s=t?.kind,this.#e=t?.value}_matches(r,e){return!(r&&this.#s!==r||e&&this.#e!==e)}#o(){if(!this.#t)return this.#i.empty();let r=this.#a();return r===void 0?void 0:this.#l(r,0)}#l(r,e){if(r===void 0)throw new Error("Expected left to be defined.");for(;this.#t;)if(this._matches(S.GROUPER,"(")){let t=this.#g();r=this.#i.invoke(r,void 0,t)}else if(this._matches(S.GROUPER,"[")){let t=this.#x();r=this.#i.index(r,t)}else if(this._matches(S.DOT)){this.#r();let t=this.#a();r=this.#d(r,t)}else{if(this._matches(S.KEYWORD))break;if(this._matches(S.OPERATOR)&&this.#t.precedence>=e)r=this.#e==="?"?this.#u(r):this.#p(r,this.#t);else break}return r}#d(r,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#i.getter(r,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let t=e.receiver;return this.#i.invoke(r,t.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(r,e){if(qo.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#r();let t=this.#a();for(;(this.#s===S.OPERATOR||this.#s===S.DOT||this.#s===S.GROUPER)&&this.#t.precedence>e.precedence;)t=this.#l(t,this.#t.precedence);return this.#i.binary(r,e.value,t)}#a(){if(this._matches(S.OPERATOR)){let r=this.#e;if(this.#r(),r==="+"||r==="-"){if(this._matches(S.INTEGER))return this.#b(r);if(this._matches(S.DECIMAL))return this.#v(r)}if(xo.indexOf(r)===-1)throw new Error(`unexpected token: ${r}`);let e=this.#l(this.#c(),Qr);return this.#i.unary(r,e)}return this.#c()}#u(r){this.#r(S.OPERATOR,"?");let e=this.#o();this.#r(S.COLON);let t=this.#o();return this.#i.ternary(r,e,t)}#c(){switch(this.#s){case S.KEYWORD:let r=this.#e;if(r==="this")return this.#r(),this.#i.id(r);throw Zr.indexOf(r)!==-1?new Error(`unexpected keyword: ${r}`):new Error(`unrecognized keyword: ${r}`);case S.IDENTIFIER:return this.#f();case S.STRING:return this.#C();case S.INTEGER:return this.#b();case S.DECIMAL:return this.#v();case S.GROUPER:return this.#e==="("?this.#q():this.#e==="{"?this.#h():this.#e==="["?this.#m():void 0;case S.COLON:throw new Error('unexpected token ":"');default:return}}#m(){let r=[];do{if(this.#r(),this._matches(S.GROUPER,"]"))break;r.push(this.#o())}while(this._matches(S.COMMA));return this.#r(S.GROUPER,"]"),this.#i.list(r)}#h(){let r={};do{if(this.#r(),this._matches(S.GROUPER,"}"))break;let e=this.#e;(this._matches(S.STRING)||this._matches(S.IDENTIFIER))&&this.#r(),this.#r(S.COLON),r[e]=this.#o()}while(this._matches(S.COMMA));return this.#r(S.GROUPER,"}"),this.#i.map(r)}#f(){let r=this.#e;if(r==="true")return this.#r(),this.#i.literal(!0);if(r==="false")return this.#r(),this.#i.literal(!1);if(r==="null")return this.#r(),this.#i.literal(null);if(r==="undefined")return this.#r(),this.#i.literal(void 0);let e=this.#y(),t=this.#g();return t?this.#i.invoke(e,void 0,t):e}#y(){if(!this._matches(S.IDENTIFIER))throw new Error(`expected identifier: ${this.#e}`);let r=this.#e;return this.#r(),this.#i.id(r)}#g(){if(!this._matches(S.GROUPER,"("))return;let r=[];do{if(this.#r(),this._matches(S.GROUPER,")"))break;let e=this.#o();r.push(e)}while(this._matches(S.COMMA));return this.#r(S.GROUPER,")"),r}#x(){this.#r();let r=this.#o();return this.#r(S.GROUPER,"]"),r}#q(){let r=this.#g();if(this._matches(S.ARROW)){this.#r();let e=this.#o(),t=r?.map(i=>i.value)??[];return this.#i.arrowFunction(t,e)}else return this.#i.paren(r[0])}#C(){let r=this.#i.literal(this.#e);return this.#r(),r}#b(r=""){let e=this.#i.literal(parseInt(`${r}${this.#e}`,10));return this.#r(),e}#v(r=""){let e=this.#i.literal(parseFloat(`${r}${this.#e}`));return this.#r(),e}};var{hasOwn:Eo,fromEntries:Dn}=Object,Nn={"+":(o,r)=>o+r,"-":(o,r)=>o-r,"*":(o,r)=>o*r,"/":(o,r)=>o/r,"%":(o,r)=>o%r,"==":(o,r)=>o==r,"!=":(o,r)=>o!=r,"===":(o,r)=>o===r,"!==":(o,r)=>o!==r,">":(o,r)=>o>r,">=":(o,r)=>o>=r,"<":(o,r)=>o<r,"<=":(o,r)=>o<=r,"||":(o,r)=>o||r,"&&":(o,r)=>o&&r,"??":(o,r)=>o??r,"|":(o,r)=>r(o),"|>":(o,r)=>r(o)},Hn={"+":o=>o,"-":o=>-o,"!":o=>!o},ti=class{empty(){return{type:"Empty",evaluate(r){return r},getIds(r){return r}}}literal(r){return{type:"Literal",value:r,evaluate(e){return this.value},getIds(e){return e}}}id(r){return{type:"ID",value:r,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(r,e){let t=Hn[r];return{type:"Unary",operator:r,child:e,evaluate(i){return t(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(r,e,t){let i=Nn[e];return{type:"Binary",operator:e,left:r,right:t,evaluate(s){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 n=this.right.evaluate(s),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(s),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(s),l=this.left.argument.evaluate(s)):this.left.type==="ID"&&(a=s,l=this.left.value),a===void 0?void 0:a[l]=n}return i(this.left.evaluate(s),this.right.evaluate(s))},getIds(s){return this.left.getIds(s),this.right.getIds(s),s}}}getter(r,e){return{type:"Getter",receiver:r,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(r,e,t){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:r,method:e,arguments:t,evaluate(i){let s=this.receiver.evaluate(i),n=this.method?s:i?.this??i,a=this.method?s?.[e]:s,d=(this.arguments??[]).map(p=>p?.evaluate(i));return a?.apply?.(n,d)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(s=>s?.getIds(i)),i}}}paren(r){return r}index(r,e){return{type:"Index",receiver:r,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(r,e,t){return{type:"Ternary",condition:r,trueExpr:e,falseExpr:t,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(r){return{type:"Map",entries:r,evaluate(e){let t={};if(r&&this.entries)for(let i in r){let s=this.entries[i];s&&(t[i]=s.evaluate(e))}return t},getIds(e){if(r&&this.entries)for(let t in r){let i=this.entries[t];i&&i.getIds(e)}return e}}}list(r){return{type:"List",items:r,evaluate(e){return this.items?.map(t=>t?.evaluate(e))},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(r,e){return{type:"ArrowFunction",params:r,body:e,evaluate(t){let i=this.params,s=this.body;return function(...n){let a=Dn(i.map((d,p)=>[d,n[p]])),l=new Proxy(t??{},{set(d,p,m){return Eo(a,p)&&(a[p]=m),d[p]=m},get(d,p){return Eo(a,p)?a[p]:d[p]}});return s.evaluate(l)}},getIds(t){return this.body.getIds(t).filter(i=>!this.params.includes(i))}}}};var Xi=null,wo={boundAttributeSuffix:H.M,marker:H.P,markerMatch:H.A,HTML_RESULT:H.C,getTemplateHtml:H.L,overrideDirectiveResolve:(o,r)=>class extends o{_$AS(e,t){return r(this,t)}},patchDirectiveResolve:(o,r)=>{if(o.prototype._$AS.name!==r.name){Xi??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Xi))return void(e[Xi]=r);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,r){o._$litDirective$=r},getAttributePartCommittedValue:(o,r,e)=>{let t=V;return o.j=i=>t=i,o._$AI(r,o,e),t},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:H.V,AttributePart:H.H,PropertyPart:H.B,BooleanAttributePart:H.N,EventPart:H.U,ElementPart:H.F,TemplateInstance:H.R,isIterable:H.D,ChildPart:H.I};var{AttributePart:zn,PropertyPart:Fn,BooleanAttributePart:Un,EventPart:Bn}=wo,Yi=new ti,Gi=new Map,_o=o=>o.replace(/-(-|\w)/g,(r,e)=>e.toUpperCase()),ri=(o,r)=>{let e=Gi.get(o);if(e===void 0){if(Gi.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let t=o.substring(2,o.length-2).trim();e=new ir(t,Yi).parse(),Gi.set(o,e)}}return e?.evaluate(r)},jn=(o,r,e,t)=>{let i=o.getAttribute("if");if(i!==null&&ri(i,r))return ii(o,r,e,t)},To=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Ao=o=>/(?:\\{{)|(?:\\}})/g.test(o),sr=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Wn=(o,r,e,t)=>{let i=o.getAttribute("repeat");if(i!==null){let s=ri(i,r);if(!s[Symbol.iterator])return k;let n=or(o),a=-1,l=[];for(let d of s){a++;let p=Object.create(r);p.item=d,p.index=a,p.this=r.this??r;let m=[];for(let b of n.parts){let y=b.update(p,e,t);b.type===1?m.push(...y):m.push(y)}let f={_$litType$:n,values:m};l.push(f)}return l}},Ro={if:jn,repeat:Wn},pe=(o,r=Ro,e={},t)=>{let s=or(o).renderers;if(t){let a=or(t).renderers,l=s.super;l!==void 0?e={...s,...e,super:(d,p,m)=>(m={...a,...m,super:(f,b,y)=>ii(t,f,b,y)},l(d,p,m))}:(e={...a,...s,...e},o=t)}else e={...s,...e};return n=>ii(o,n,r,e)};var ii=(o,r,e=Ro,t={})=>{let i=or(o),s=[];for(let a of i.parts){let l=a.update(r,e,t);a.type===1?s.push(...l):s.push(l)}return{_$litType$:i,values:s}},So=new Map,or=o=>{let r=So.get(o);return r===void 0&&So.set(o,r=Xn(o)),r},Xn=o=>{let r={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(r.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),t=e.currentNode,i=-1,s=[];for(;(t=e.nextNode())!==null;)if(t.nodeType===Node.COMMENT_NODE)i++;else if(t.nodeType===Node.ELEMENT_NODE){i++;let n=t;if(n.tagName==="TEMPLATE"){let l=n.getAttribute("type"),d=n.getAttribute("name"),p=n.getAttribute("call");if(p!==null||l!==null||d!==null){n.parentNode.insertBefore(document.createComment(""),n),s.push(n);let m;if(p!==null){let f=p.trim(),b=f.startsWith("{{")&&f.endsWith("}}");m=(y,C,A)=>{let q=n.getAttribute("data"),T=q===null?void 0:ri(q,y);return(b?ri(f,y):A[p])?.(T,C,A)}}else l!==null?m=(f,b,y)=>{let C=b[l];return C?.(n,f,b,y)}:(d==="super"?r.renderers.super=(f,b,y)=>{let C=y.super,A=or(n);return y={...y,...A.renderers},C(f,b,y)}:r.renderers[d]=(f,b,y)=>ii(n,f,b,y),m=(f,b,y)=>{let C=y[d];return C?.(f,b,y)});r.parts.push({type:2,index:i,update:m});continue}}let a=n.getAttributeNames();for(let l of a){let d=n.getAttribute(l),p=d.split(To);if(p.length===1){Ao(d)&&n.setAttribute(l,sr(d));continue}n.removeAttribute(l);let m=l,f=zn,b=l[0];b==="."?(m=_o(l.substring(1)),f=Fn):b==="?"?(m=l.substring(1),f=Un):b==="@"&&(m=_o(l.substring(1)),f=Bn);let y=[sr(p[0])],C=[];for(let A=1;A<p.length;A+=2){let q=p[A];C.push(Wi(q,Yi)),y.push(sr(p[A+1]))}r.parts.push({type:1,index:i,name:m,strings:y,ctor:f,update:(A,q,T)=>C.map(M=>M.evaluate(A))})}}else if(t.nodeType===Node.TEXT_NODE){let n=t,a=n.textContent,l=a.split(To);l.length>1?n.textContent=sr(l[0]):Ao(a)&&(n.textContent=sr(a));for(let d=1;d<l.length;d+=2){let p=l[d],m=Wi(p,Yi);r.parts.push({type:2,index:++i,update:(b,y)=>m.evaluate(b)});let f=new Text(l[d+1].replace("\\{{","{{"));n.parentNode.insertBefore(f,n.nextSibling),n.parentNode.insertBefore(document.createComment(""),n.nextSibling),n=f,e.currentNode=f}}for(let n of s)n.remove();return r};var nr=class extends v{createRenderRoot(){return this}constructor(){super(),this._internals=this.attachInternals(),this._internals.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");this.myTemplate=pe(r)}render(){if(!this.computedContext)return h``;let r=this.computedContext.testParts.flatMap(e=>e.sections.flatMap(t=>t.items));return h` ${r.map(e=>this.myTemplate({item:e,view:this.computedContext.view}))} `}};c([_({context:$,subscribe:!0})],nr.prototype,"computedContext",2),nr=c([g("test-paging-buttons-stamp")],nr);var{I:Gn}=H,Mo=o=>o===null||typeof o!="object"&&typeof o!="function";var Io=o=>o.strings===void 0,ko=()=>document.createComment(""),yt=(o,r,e)=>{let t=o._$AA.parentNode,i=r===void 0?o._$AB:r._$AA;if(e===void 0){let s=t.insertBefore(ko(),i),n=t.insertBefore(ko(),i);e=new Gn(s,n,o,o.options)}else{let s=e._$AB.nextSibling,n=e._$AM,a=n!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==n._$AU&&e._$AP(l)}if(s!==i||a){let l=e._$AA;for(;l!==s;){let d=l.nextSibling;t.insertBefore(l,i),l=d}}}return e},Ne=(o,r,e=o)=>(o._$AI(r,e),o),Yn={},Lo=(o,r=Yn)=>o._$AH=r,$o=o=>o._$AH,si=o=>{o._$AR(),o._$AA.remove()};var He={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},te=o=>(...r)=>({_$litDirective$:o,values:r}),ue=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var ar=(o,r)=>{let e=o._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(r,!1),ar(t,r);return!0},oi=o=>{let r,e;do{if((r=o._$AM)===void 0)break;e=r._$AN,e.delete(o),o=r}while(e?.size===0)},Po=o=>{for(let r;r=o._$AM;o=r){let e=r._$AN;if(e===void 0)r._$AN=e=new Set;else if(e.has(o))break;e.add(o),Zn(r)}};function Jn(o){this._$AN!==void 0?(oi(this),this._$AM=o,Po(this)):this._$AM=o}function Kn(o,r=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(r)if(Array.isArray(t))for(let s=e;s<t.length;s++)ar(t[s],!1),oi(t[s]);else t!=null&&(ar(t,!1),oi(t));else ar(this,o)}var Zn=o=>{o.type==He.CHILD&&(o._$AP??=Kn,o._$AQ??=Jn)},xt=class extends ue{constructor(){super(...arguments),this._$AN=void 0}_$AT(r,e,t){super._$AT(r,e,t),Po(this),this.isConnected=r._$AU}_$AO(r,e=!0){r!==this.isConnected&&(this.isConnected=r,r?this.reconnected?.():this.disconnected?.()),e&&(ar(this,r),oi(this))}setValue(r){if(Io(this._$Ct))this._$Ct._$AI(r,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=r,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ni=class{constructor(r){this.G=r}disconnect(){this.G=void 0}reconnect(r){this.G=r}deref(){return this.G}},ai=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise((r=>this.Z=r))}resume(){this.Z?.(),this.Y=this.Z=void 0}};var Vo=o=>!Mo(o)&&typeof o.then=="function",Oo=1073741823,Ji=class extends xt{constructor(){super(...arguments),this._$Cwt=Oo,this._$Cbt=[],this._$CK=new ni(this),this._$CX=new ai}render(...r){return r.find((e=>!Vo(e)))??V}update(r,e){let t=this._$Cbt,i=t.length;this._$Cbt=e;let s=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!Vo(l))return this._$Cwt=a,l;a<i&&l===t[a]||(this._$Cwt=Oo,i=0,Promise.resolve(l).then((async d=>{for(;n.get();)await n.get();let p=s.deref();if(p!==void 0){let m=p._$Cbt.indexOf(l);m>-1&&m<p._$Cwt&&(p._$Cwt=m,p.setValue(d))}})))}return V}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},li=te(Ji);var ci=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
|
|
228
|
+
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),ei=class{#s;#n=-1;#i=0;#t;constructor(r){this.#s=r,this.#e()}nextToken(){for(;Mn(this.#t);)this.#e(!0);if($n(this.#t))return this.#l();if(Co(this.#t))return this.#d();if(rr(this.#t))return this.#p();if(this.#t===46)return this.#a();if(this.#t===44)return this.#u();if(this.#t===58)return this.#c();if(Pn(this.#t))return this.#h();if(Vn(this.#t))return this.#f();if(this.#e(),this.#t!==void 0)throw new Error(`Expected end of input, got ${this.#t}`)}#e(r){this.#n++,this.#n<this.#s.length?(this.#t=this.#s.charCodeAt(this.#n),r===!0&&(this.#i=this.#n)):this.#t=void 0}#r(r=0){let e=this.#s.substring(this.#i,this.#n+r);return r===0&&this.#o(),e}#o(){this.#i=this.#n}#l(){let r="unterminated string",e=this.#t;for(this.#e(!0);this.#t!==e;){if(this.#t===void 0)throw new Error(r);if(this.#t===92&&(this.#e(),this.#t===void 0))throw new Error(r);this.#e()}let t=de(S.STRING,On(this.#r()));return this.#e(),t}#d(){do this.#e();while(In(this.#t));let r=this.#r(),e=Ln(r)?S.KEYWORD:S.IDENTIFIER;return de(e,r)}#p(){do this.#e();while(rr(this.#t));return this.#t===46?this.#a():de(S.INTEGER,this.#r())}#a(){return this.#e(),rr(this.#t)?this.#m():(this.#o(),de(S.DOT,".",Qr))}#u(){return this.#e(!0),de(S.COMMA,",")}#c(){return this.#e(!0),de(S.COLON,":")}#m(){do this.#e();while(rr(this.#t));return de(S.DECIMAL,this.#r())}#h(){this.#e();let r=this.#r(2);if(kn.indexOf(r)!==-1)this.#e(),this.#e();else{if(r=this.#r(1),r==="=>")return this.#e(),de(S.ARROW,r);Rn.indexOf(r)!==-1&&this.#e()}return r=this.#r(),de(S.OPERATOR,r,ji[r])}#f(){let r=String.fromCharCode(this.#t),e=de(S.GROUPER,r,ji[r]);return this.#e(!0),e}};var Wi=(o,r)=>new ir(o,r).parse(),ir=class{#s;#n;#i;#t;#e;constructor(r,e){this.#n=new ei(r),this.#i=e}parse(){return this.#r(),this.#o()}#r(r,e){if(!this._matches(r,e))throw new Error(`Expected kind ${r} (${e}), was ${this.#t?.kind} (${this.#t?.value})`);let t=this.#n.nextToken();this.#t=t,this.#s=t?.kind,this.#e=t?.value}_matches(r,e){return!(r&&this.#s!==r||e&&this.#e!==e)}#o(){if(!this.#t)return this.#i.empty();let r=this.#a();return r===void 0?void 0:this.#l(r,0)}#l(r,e){if(r===void 0)throw new Error("Expected left to be defined.");for(;this.#t;)if(this._matches(S.GROUPER,"(")){let t=this.#g();r=this.#i.invoke(r,void 0,t)}else if(this._matches(S.GROUPER,"[")){let t=this.#x();r=this.#i.index(r,t)}else if(this._matches(S.DOT)){this.#r();let t=this.#a();r=this.#d(r,t)}else{if(this._matches(S.KEYWORD))break;if(this._matches(S.OPERATOR)&&this.#t.precedence>=e)r=this.#e==="?"?this.#u(r):this.#p(r,this.#t);else break}return r}#d(r,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#i.getter(r,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let t=e.receiver;return this.#i.invoke(r,t.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(r,e){if(qo.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#r();let t=this.#a();for(;(this.#s===S.OPERATOR||this.#s===S.DOT||this.#s===S.GROUPER)&&this.#t.precedence>e.precedence;)t=this.#l(t,this.#t.precedence);return this.#i.binary(r,e.value,t)}#a(){if(this._matches(S.OPERATOR)){let r=this.#e;if(this.#r(),r==="+"||r==="-"){if(this._matches(S.INTEGER))return this.#b(r);if(this._matches(S.DECIMAL))return this.#v(r)}if(xo.indexOf(r)===-1)throw new Error(`unexpected token: ${r}`);let e=this.#l(this.#c(),Qr);return this.#i.unary(r,e)}return this.#c()}#u(r){this.#r(S.OPERATOR,"?");let e=this.#o();this.#r(S.COLON);let t=this.#o();return this.#i.ternary(r,e,t)}#c(){switch(this.#s){case S.KEYWORD:let r=this.#e;if(r==="this")return this.#r(),this.#i.id(r);throw Zr.indexOf(r)!==-1?new Error(`unexpected keyword: ${r}`):new Error(`unrecognized keyword: ${r}`);case S.IDENTIFIER:return this.#f();case S.STRING:return this.#C();case S.INTEGER:return this.#b();case S.DECIMAL:return this.#v();case S.GROUPER:return this.#e==="("?this.#q():this.#e==="{"?this.#h():this.#e==="["?this.#m():void 0;case S.COLON:throw new Error('unexpected token ":"');default:return}}#m(){let r=[];do{if(this.#r(),this._matches(S.GROUPER,"]"))break;r.push(this.#o())}while(this._matches(S.COMMA));return this.#r(S.GROUPER,"]"),this.#i.list(r)}#h(){let r={};do{if(this.#r(),this._matches(S.GROUPER,"}"))break;let e=this.#e;(this._matches(S.STRING)||this._matches(S.IDENTIFIER))&&this.#r(),this.#r(S.COLON),r[e]=this.#o()}while(this._matches(S.COMMA));return this.#r(S.GROUPER,"}"),this.#i.map(r)}#f(){let r=this.#e;if(r==="true")return this.#r(),this.#i.literal(!0);if(r==="false")return this.#r(),this.#i.literal(!1);if(r==="null")return this.#r(),this.#i.literal(null);if(r==="undefined")return this.#r(),this.#i.literal(void 0);let e=this.#y(),t=this.#g();return t?this.#i.invoke(e,void 0,t):e}#y(){if(!this._matches(S.IDENTIFIER))throw new Error(`expected identifier: ${this.#e}`);let r=this.#e;return this.#r(),this.#i.id(r)}#g(){if(!this._matches(S.GROUPER,"("))return;let r=[];do{if(this.#r(),this._matches(S.GROUPER,")"))break;let e=this.#o();r.push(e)}while(this._matches(S.COMMA));return this.#r(S.GROUPER,")"),r}#x(){this.#r();let r=this.#o();return this.#r(S.GROUPER,"]"),r}#q(){let r=this.#g();if(this._matches(S.ARROW)){this.#r();let e=this.#o(),t=r?.map(i=>i.value)??[];return this.#i.arrowFunction(t,e)}else return this.#i.paren(r[0])}#C(){let r=this.#i.literal(this.#e);return this.#r(),r}#b(r=""){let e=this.#i.literal(parseInt(`${r}${this.#e}`,10));return this.#r(),e}#v(r=""){let e=this.#i.literal(parseFloat(`${r}${this.#e}`));return this.#r(),e}};var{hasOwn:Eo,fromEntries:Nn}=Object,Dn={"+":(o,r)=>o+r,"-":(o,r)=>o-r,"*":(o,r)=>o*r,"/":(o,r)=>o/r,"%":(o,r)=>o%r,"==":(o,r)=>o==r,"!=":(o,r)=>o!=r,"===":(o,r)=>o===r,"!==":(o,r)=>o!==r,">":(o,r)=>o>r,">=":(o,r)=>o>=r,"<":(o,r)=>o<r,"<=":(o,r)=>o<=r,"||":(o,r)=>o||r,"&&":(o,r)=>o&&r,"??":(o,r)=>o??r,"|":(o,r)=>r(o),"|>":(o,r)=>r(o)},Hn={"+":o=>o,"-":o=>-o,"!":o=>!o},ti=class{empty(){return{type:"Empty",evaluate(r){return r},getIds(r){return r}}}literal(r){return{type:"Literal",value:r,evaluate(e){return this.value},getIds(e){return e}}}id(r){return{type:"ID",value:r,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(r,e){let t=Hn[r];return{type:"Unary",operator:r,child:e,evaluate(i){return t(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(r,e,t){let i=Dn[e];return{type:"Binary",operator:e,left:r,right:t,evaluate(s){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 n=this.right.evaluate(s),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(s),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(s),l=this.left.argument.evaluate(s)):this.left.type==="ID"&&(a=s,l=this.left.value),a===void 0?void 0:a[l]=n}return i(this.left.evaluate(s),this.right.evaluate(s))},getIds(s){return this.left.getIds(s),this.right.getIds(s),s}}}getter(r,e){return{type:"Getter",receiver:r,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(r,e,t){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:r,method:e,arguments:t,evaluate(i){let s=this.receiver.evaluate(i),n=this.method?s:i?.this??i,a=this.method?s?.[e]:s,d=(this.arguments??[]).map(p=>p?.evaluate(i));return a?.apply?.(n,d)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(s=>s?.getIds(i)),i}}}paren(r){return r}index(r,e){return{type:"Index",receiver:r,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(r,e,t){return{type:"Ternary",condition:r,trueExpr:e,falseExpr:t,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(r){return{type:"Map",entries:r,evaluate(e){let t={};if(r&&this.entries)for(let i in r){let s=this.entries[i];s&&(t[i]=s.evaluate(e))}return t},getIds(e){if(r&&this.entries)for(let t in r){let i=this.entries[t];i&&i.getIds(e)}return e}}}list(r){return{type:"List",items:r,evaluate(e){return this.items?.map(t=>t?.evaluate(e))},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(r,e){return{type:"ArrowFunction",params:r,body:e,evaluate(t){let i=this.params,s=this.body;return function(...n){let a=Nn(i.map((d,p)=>[d,n[p]])),l=new Proxy(t??{},{set(d,p,m){return Eo(a,p)&&(a[p]=m),d[p]=m},get(d,p){return Eo(a,p)?a[p]:d[p]}});return s.evaluate(l)}},getIds(t){return this.body.getIds(t).filter(i=>!this.params.includes(i))}}}};var Xi=null,wo={boundAttributeSuffix:H.M,marker:H.P,markerMatch:H.A,HTML_RESULT:H.C,getTemplateHtml:H.L,overrideDirectiveResolve:(o,r)=>class extends o{_$AS(e,t){return r(this,t)}},patchDirectiveResolve:(o,r)=>{if(o.prototype._$AS.name!==r.name){Xi??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Xi))return void(e[Xi]=r);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,r){o._$litDirective$=r},getAttributePartCommittedValue:(o,r,e)=>{let t=V;return o.j=i=>t=i,o._$AI(r,o,e),t},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:H.V,AttributePart:H.H,PropertyPart:H.B,BooleanAttributePart:H.N,EventPart:H.U,ElementPart:H.F,TemplateInstance:H.R,isIterable:H.D,ChildPart:H.I};var{AttributePart:zn,PropertyPart:Fn,BooleanAttributePart:Un,EventPart:Bn}=wo,Yi=new ti,Gi=new Map,_o=o=>o.replace(/-(-|\w)/g,(r,e)=>e.toUpperCase()),ri=(o,r)=>{let e=Gi.get(o);if(e===void 0){if(Gi.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let t=o.substring(2,o.length-2).trim();e=new ir(t,Yi).parse(),Gi.set(o,e)}}return e?.evaluate(r)},jn=(o,r,e,t)=>{let i=o.getAttribute("if");if(i!==null&&ri(i,r))return ii(o,r,e,t)},To=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Ao=o=>/(?:\\{{)|(?:\\}})/g.test(o),sr=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Wn=(o,r,e,t)=>{let i=o.getAttribute("repeat");if(i!==null){let s=ri(i,r);if(!s[Symbol.iterator])return k;let n=or(o),a=-1,l=[];for(let d of s){a++;let p=Object.create(r);p.item=d,p.index=a,p.this=r.this??r;let m=[];for(let b of n.parts){let y=b.update(p,e,t);b.type===1?m.push(...y):m.push(y)}let f={_$litType$:n,values:m};l.push(f)}return l}},Ro={if:jn,repeat:Wn},pe=(o,r=Ro,e={},t)=>{let s=or(o).renderers;if(t){let a=or(t).renderers,l=s.super;l!==void 0?e={...s,...e,super:(d,p,m)=>(m={...a,...m,super:(f,b,y)=>ii(t,f,b,y)},l(d,p,m))}:(e={...a,...s,...e},o=t)}else e={...s,...e};return n=>ii(o,n,r,e)};var ii=(o,r,e=Ro,t={})=>{let i=or(o),s=[];for(let a of i.parts){let l=a.update(r,e,t);a.type===1?s.push(...l):s.push(l)}return{_$litType$:i,values:s}},So=new Map,or=o=>{let r=So.get(o);return r===void 0&&So.set(o,r=Xn(o)),r},Xn=o=>{let r={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(r.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),t=e.currentNode,i=-1,s=[];for(;(t=e.nextNode())!==null;)if(t.nodeType===Node.COMMENT_NODE)i++;else if(t.nodeType===Node.ELEMENT_NODE){i++;let n=t;if(n.tagName==="TEMPLATE"){let l=n.getAttribute("type"),d=n.getAttribute("name"),p=n.getAttribute("call");if(p!==null||l!==null||d!==null){n.parentNode.insertBefore(document.createComment(""),n),s.push(n);let m;if(p!==null){let f=p.trim(),b=f.startsWith("{{")&&f.endsWith("}}");m=(y,C,A)=>{let q=n.getAttribute("data"),T=q===null?void 0:ri(q,y);return(b?ri(f,y):A[p])?.(T,C,A)}}else l!==null?m=(f,b,y)=>{let C=b[l];return C?.(n,f,b,y)}:(d==="super"?r.renderers.super=(f,b,y)=>{let C=y.super,A=or(n);return y={...y,...A.renderers},C(f,b,y)}:r.renderers[d]=(f,b,y)=>ii(n,f,b,y),m=(f,b,y)=>{let C=y[d];return C?.(f,b,y)});r.parts.push({type:2,index:i,update:m});continue}}let a=n.getAttributeNames();for(let l of a){let d=n.getAttribute(l),p=d.split(To);if(p.length===1){Ao(d)&&n.setAttribute(l,sr(d));continue}n.removeAttribute(l);let m=l,f=zn,b=l[0];b==="."?(m=_o(l.substring(1)),f=Fn):b==="?"?(m=l.substring(1),f=Un):b==="@"&&(m=_o(l.substring(1)),f=Bn);let y=[sr(p[0])],C=[];for(let A=1;A<p.length;A+=2){let q=p[A];C.push(Wi(q,Yi)),y.push(sr(p[A+1]))}r.parts.push({type:1,index:i,name:m,strings:y,ctor:f,update:(A,q,T)=>C.map(M=>M.evaluate(A))})}}else if(t.nodeType===Node.TEXT_NODE){let n=t,a=n.textContent,l=a.split(To);l.length>1?n.textContent=sr(l[0]):Ao(a)&&(n.textContent=sr(a));for(let d=1;d<l.length;d+=2){let p=l[d],m=Wi(p,Yi);r.parts.push({type:2,index:++i,update:(b,y)=>m.evaluate(b)});let f=new Text(l[d+1].replace("\\{{","{{"));n.parentNode.insertBefore(f,n.nextSibling),n.parentNode.insertBefore(document.createComment(""),n.nextSibling),n=f,e.currentNode=f}}for(let n of s)n.remove();return r};var nr=class extends v{createRenderRoot(){return this}constructor(){super(),this._internals=this.attachInternals(),this._internals.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");this.myTemplate=pe(r)}render(){if(!this.computedContext)return h``;let r=this.computedContext.testParts.flatMap(e=>e.sections.flatMap(t=>t.items));return h` ${r.map(e=>this.myTemplate({item:e,view:this.computedContext.view}))} `}};c([_({context:$,subscribe:!0})],nr.prototype,"computedContext",2),nr=c([g("test-paging-buttons-stamp")],nr);var{I:Gn}=H,Mo=o=>o===null||typeof o!="object"&&typeof o!="function";var Io=o=>o.strings===void 0,ko=()=>document.createComment(""),yt=(o,r,e)=>{let t=o._$AA.parentNode,i=r===void 0?o._$AB:r._$AA;if(e===void 0){let s=t.insertBefore(ko(),i),n=t.insertBefore(ko(),i);e=new Gn(s,n,o,o.options)}else{let s=e._$AB.nextSibling,n=e._$AM,a=n!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==n._$AU&&e._$AP(l)}if(s!==i||a){let l=e._$AA;for(;l!==s;){let d=l.nextSibling;t.insertBefore(l,i),l=d}}}return e},De=(o,r,e=o)=>(o._$AI(r,e),o),Yn={},Lo=(o,r=Yn)=>o._$AH=r,$o=o=>o._$AH,si=o=>{o._$AR(),o._$AA.remove()};var He={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},te=o=>(...r)=>({_$litDirective$:o,values:r}),ue=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var ar=(o,r)=>{let e=o._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(r,!1),ar(t,r);return!0},oi=o=>{let r,e;do{if((r=o._$AM)===void 0)break;e=r._$AN,e.delete(o),o=r}while(e?.size===0)},Po=o=>{for(let r;r=o._$AM;o=r){let e=r._$AN;if(e===void 0)r._$AN=e=new Set;else if(e.has(o))break;e.add(o),Zn(r)}};function Jn(o){this._$AN!==void 0?(oi(this),this._$AM=o,Po(this)):this._$AM=o}function Kn(o,r=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(r)if(Array.isArray(t))for(let s=e;s<t.length;s++)ar(t[s],!1),oi(t[s]);else t!=null&&(ar(t,!1),oi(t));else ar(this,o)}var Zn=o=>{o.type==He.CHILD&&(o._$AP??=Kn,o._$AQ??=Jn)},xt=class extends ue{constructor(){super(...arguments),this._$AN=void 0}_$AT(r,e,t){super._$AT(r,e,t),Po(this),this.isConnected=r._$AU}_$AO(r,e=!0){r!==this.isConnected&&(this.isConnected=r,r?this.reconnected?.():this.disconnected?.()),e&&(ar(this,r),oi(this))}setValue(r){if(Io(this._$Ct))this._$Ct._$AI(r,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=r,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ni=class{constructor(r){this.G=r}disconnect(){this.G=void 0}reconnect(r){this.G=r}deref(){return this.G}},ai=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise((r=>this.Z=r))}resume(){this.Z?.(),this.Y=this.Z=void 0}};var Vo=o=>!Mo(o)&&typeof o.then=="function",Oo=1073741823,Ji=class extends xt{constructor(){super(...arguments),this._$Cwt=Oo,this._$Cbt=[],this._$CK=new ni(this),this._$CX=new ai}render(...r){return r.find((e=>!Vo(e)))??V}update(r,e){let t=this._$Cbt,i=t.length;this._$Cbt=e;let s=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!Vo(l))return this._$Cwt=a,l;a<i&&l===t[a]||(this._$Cwt=Oo,i=0,Promise.resolve(l).then((async d=>{for(;n.get();)await n.get();let p=s.deref();if(p!==void 0){let m=p._$Cbt.indexOf(l);m>-1&&m<p._$Cwt&&(p._$Cwt=m,p.setValue(d))}})))}return V}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},li=te(Ji);var ci=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
|
|
229
229
|
|
|
230
230
|
:root,
|
|
231
231
|
:host {
|
|
@@ -2045,8 +2045,6 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2045
2045
|
text-orientation: upright;
|
|
2046
2046
|
}
|
|
2047
2047
|
|
|
2048
|
-
/* stylelint-disable number-max-precision */
|
|
2049
|
-
|
|
2050
2048
|
@layer qti-base {
|
|
2051
2049
|
.qti-layout-row {
|
|
2052
2050
|
display: flex;
|
|
@@ -2339,7 +2337,6 @@ qti-response-declaration {
|
|
|
2339
2337
|
}
|
|
2340
2338
|
}
|
|
2341
2339
|
|
|
2342
|
-
/* stylelint-disable-next-line no-descending-specificity */
|
|
2343
2340
|
& qti-simple-choice {
|
|
2344
2341
|
width: -moz-fit-content;
|
|
2345
2342
|
width: fit-content;
|
|
@@ -2348,7 +2345,6 @@ qti-response-declaration {
|
|
|
2348
2345
|
/* Keep the checkmark for non-hidden input controls */
|
|
2349
2346
|
&:state(correct-response),
|
|
2350
2347
|
&[data-correct-response='true'] {
|
|
2351
|
-
/* stylelint-disable-next-line no-descending-specificity */
|
|
2352
2348
|
&::after {
|
|
2353
2349
|
content: '\\02714';
|
|
2354
2350
|
color: var(--qti-correct);
|
|
@@ -2594,7 +2590,7 @@ qti-response-declaration {
|
|
|
2594
2590
|
&:focus {
|
|
2595
2591
|
box-shadow: 0 0 0 var(--qti-focus-border-width) var(--qti-focus-color);
|
|
2596
2592
|
}
|
|
2597
|
-
|
|
2593
|
+
|
|
2598
2594
|
&:state(candidate-correct) {
|
|
2599
2595
|
background-color: var(--qti-correct);
|
|
2600
2596
|
}
|
|
@@ -4048,7 +4044,7 @@ div.full-correct-response-inline {
|
|
|
4048
4044
|
${this._options[e]}
|
|
4049
4045
|
</option>`)}
|
|
4050
4046
|
</select>
|
|
4051
|
-
`}};c([_({context:J,subscribe:!0})],st.prototype,"itemContext",2),c([u({type:String})],st.prototype,"label",2),c([E()],st.prototype,"_options",2),st=c([g("item-correct-response-mode")],st);var
|
|
4047
|
+
`}};c([_({context:J,subscribe:!0})],st.prototype,"itemContext",2),c([u({type:String})],st.prototype,"label",2),c([E()],st.prototype,"_options",2),st=c([g("item-correct-response-mode")],st);var No=x`
|
|
4052
4048
|
display: inline-flex;
|
|
4053
4049
|
align-items: center;
|
|
4054
4050
|
cursor: pointer;
|
|
@@ -4057,12 +4053,12 @@ div.full-correct-response-inline {
|
|
|
4057
4053
|
user-select: none;
|
|
4058
4054
|
`,di=x`
|
|
4059
4055
|
background-color: lightgray;
|
|
4060
|
-
${
|
|
4056
|
+
${No};
|
|
4061
4057
|
`,pi=x`
|
|
4062
4058
|
cursor: not-allowed;
|
|
4063
4059
|
opacity: 0.8;
|
|
4064
4060
|
`,Lg=x`
|
|
4065
|
-
${
|
|
4061
|
+
${No};
|
|
4066
4062
|
border: 1px solid gray;
|
|
4067
4063
|
`;var re=class extends v{constructor(){super();this.shown=!1;this.disabled=!1;this.showCandidateCorrectionText="Show candidate correction";this.hideCandidateCorrectionText="Hide candidate correction";this.noCorrectResponseText="No correct response specified";this._hasCorrectResponse=!1;this._previousActiveItem=""}updated(){if(!this._hasCorrectResponse||this._previousActiveItem!==this.computedContext?.identifier){this._previousActiveItem=this.computedContext?.identifier;let e=!!this.computedContext?.variables.some(i=>i.correctResponse),t=!!this.computedContext?.variables.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this._hasCorrectResponse=e||t}this.disabled=!this._hasCorrectResponse}_toggleState(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))}_getDisplayedText(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCandidateCorrectionText:this.showCandidateCorrectionText}render(){return h` <div @click="${this._toggleState}">${this._getDisplayedText()}</div> `}};re.styles=x`
|
|
4068
4064
|
:host {
|
|
@@ -4325,7 +4321,7 @@ div.full-correct-response-inline {
|
|
|
4325
4321
|
`;var ur=class extends me(R,"qti-gap-text","qti-gap","slot[part='drags']"){render(){return h`<slot name="prompt"> </slot>
|
|
4326
4322
|
<slot part="drags" name="drags"></slot>
|
|
4327
4323
|
<slot part="drops"></slot>
|
|
4328
|
-
<div role="alert" part="message" id="validation-message"></div>`}toggleCorrectResponse(r){let e=this.responseVariable;if(r&&e?.correctResponse){let t=[],i=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse];i&&(t=i.map(n=>{let a=n.split(" ");return{text:a[0],gap:a[1]}})),this.querySelectorAll("qti-gap").forEach(n=>{let a=n.getAttribute("identifier"),l=t.find(p=>p.gap===a)?.text,d=this.querySelector(`qti-gap-text[identifier="${l}"]`)?.textContent.trim();if(l&&d){if(!n.nextElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),p.textContent=d,p.style.border="1px solid var(--qti-correct)",p.style.borderRadius="4px",p.style.padding="2px 4px",p.style.display="inline-block",n.insertAdjacentElement("afterend",p)}}else n.nextElementSibling?.classList.contains("correct-option")&&n.nextElementSibling.remove()})}else this.querySelectorAll(".correct-option").forEach(i=>{i.remove()})}getMatches(r){if(!r.correctResponse)return[];let e=Array.isArray(r.correctResponse)?r.correctResponse:[r.correctResponse],t=[];return e&&e.forEach(i=>{let s=i.split(" ");t.push({source:s[0],target:s[1]})}),t}toggleCandidateCorrection(r){let e=this.responseVariable;if(!e?.correctResponse)return;let t=this.getMatches(e);Array.from(this.querySelectorAll("qti-gap")).forEach(s=>{let n=s.getAttribute("identifier"),a=t.filter(d=>d.target===n);s.querySelectorAll("qti-gap-text").forEach(d=>{if(d.internals.states.delete("candidate-correct"),d.internals.states.delete("candidate-incorrect"),!r)return;a.find(m=>m.source===d.identifier)?.source!==void 0?d.internals.states.add("candidate-correct"):d.internals.states.add("candidate-incorrect")})})}};ur.styles=jo,ur=c([g("qti-gap-match-interaction")],ur);var Wo=(o,r,e)=>{let t=new Map;for(let i=r;i<=e;i++)t.set(o[i],i);return t},St=te(class extends ue{constructor(o){if(super(o),o.type!==He.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,r,e){let t;e===void 0?e=r:r!==void 0&&(t=r);let i=[],s=[],n=0;for(let a of o)i[n]=t?t(a,n):n,s[n]=e(a,n),n++;return{values:s,keys:i}}render(o,r,e){return this.dt(o,r,e).values}update(o,[r,e,t]){let i=$o(o),{values:s,keys:n}=this.dt(r,e,t);if(!Array.isArray(i))return this.ut=n,s;let a=this.ut??=[],l=[],d,p,m=0,f=i.length-1,b=0,y=s.length-1;for(;m<=f&&b<=y;)if(i[m]===null)m++;else if(i[f]===null)f--;else if(a[m]===n[b])l[b]=
|
|
4324
|
+
<div role="alert" part="message" id="validation-message"></div>`}toggleCorrectResponse(r){let e=this.responseVariable;if(r&&e?.correctResponse){let t=[],i=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse];i&&(t=i.map(n=>{let a=n.split(" ");return{text:a[0],gap:a[1]}})),this.querySelectorAll("qti-gap").forEach(n=>{let a=n.getAttribute("identifier"),l=t.find(p=>p.gap===a)?.text,d=this.querySelector(`qti-gap-text[identifier="${l}"]`)?.textContent.trim();if(l&&d){if(!n.nextElementSibling?.classList.contains("correct-option")){let p=document.createElement("span");p.classList.add("correct-option"),p.textContent=d,p.style.border="1px solid var(--qti-correct)",p.style.borderRadius="4px",p.style.padding="2px 4px",p.style.display="inline-block",n.insertAdjacentElement("afterend",p)}}else n.nextElementSibling?.classList.contains("correct-option")&&n.nextElementSibling.remove()})}else this.querySelectorAll(".correct-option").forEach(i=>{i.remove()})}getMatches(r){if(!r.correctResponse)return[];let e=Array.isArray(r.correctResponse)?r.correctResponse:[r.correctResponse],t=[];return e&&e.forEach(i=>{let s=i.split(" ");t.push({source:s[0],target:s[1]})}),t}toggleCandidateCorrection(r){let e=this.responseVariable;if(!e?.correctResponse)return;let t=this.getMatches(e);Array.from(this.querySelectorAll("qti-gap")).forEach(s=>{let n=s.getAttribute("identifier"),a=t.filter(d=>d.target===n);s.querySelectorAll("qti-gap-text").forEach(d=>{if(d.internals.states.delete("candidate-correct"),d.internals.states.delete("candidate-incorrect"),!r)return;a.find(m=>m.source===d.identifier)?.source!==void 0?d.internals.states.add("candidate-correct"):d.internals.states.add("candidate-incorrect")})})}};ur.styles=jo,ur=c([g("qti-gap-match-interaction")],ur);var Wo=(o,r,e)=>{let t=new Map;for(let i=r;i<=e;i++)t.set(o[i],i);return t},St=te(class extends ue{constructor(o){if(super(o),o.type!==He.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,r,e){let t;e===void 0?e=r:r!==void 0&&(t=r);let i=[],s=[],n=0;for(let a of o)i[n]=t?t(a,n):n,s[n]=e(a,n),n++;return{values:s,keys:i}}render(o,r,e){return this.dt(o,r,e).values}update(o,[r,e,t]){let i=$o(o),{values:s,keys:n}=this.dt(r,e,t);if(!Array.isArray(i))return this.ut=n,s;let a=this.ut??=[],l=[],d,p,m=0,f=i.length-1,b=0,y=s.length-1;for(;m<=f&&b<=y;)if(i[m]===null)m++;else if(i[f]===null)f--;else if(a[m]===n[b])l[b]=De(i[m],s[b]),m++,b++;else if(a[f]===n[y])l[y]=De(i[f],s[y]),f--,y--;else if(a[m]===n[y])l[y]=De(i[m],s[y]),yt(o,l[y+1],i[m]),m++,y--;else if(a[f]===n[b])l[b]=De(i[f],s[b]),yt(o,i[m],i[f]),f--,b++;else if(d===void 0&&(d=Wo(n,b,y),p=Wo(a,m,f)),d.has(a[m]))if(d.has(a[f])){let C=p.get(n[b]),A=C!==void 0?i[C]:null;if(A===null){let q=yt(o,i[m]);De(q,s[b]),l[b]=q}else l[b]=De(A,s[b]),yt(o,i[m],A),i[C]=null;b++}else si(i[f]),f--;else si(i[m]),m++;for(;b<=y;){let C=yt(o,l[y+1]);De(C,s[b]),l[b++]=C}for(;m<=f;){let C=i[m++];C!==null&&si(C)}return this.ut=n,Lo(o,l),V}});function Ue(o,r,e,t){let i=e.getAttribute("width")?parseFloat(e.getAttribute("width")):e.naturalWidth,s=e.getAttribute("height")?parseFloat(e.getAttribute("height")):e.naturalHeight;switch(o){case"circle":{if(r.length!==3){console.error("Invalid circle coordinates:",r);return}let[n,a,l]=r,d=n/i*100,p=a/s*100,m=l/i*100,f=l/s*100;t.style.left=d-m+"%",t.style.top=p-f+"%",t.style.width=2*m+"%",t.style.height=2*f+"%",t.style.borderRadius="50%"}break;case"rect":{if(r.length!==4){console.error("Invalid rectangle coordinates:",r);return}let[n,a,l,d]=r,p=n/i*100,m=a/s*100,f=l/i*100,b=d/s*100;t.style.left=p+"%",t.style.top=m+"%",t.style.width=f-p+"%",t.style.height=b-m+"%"}break;case"ellipse":{if(r.length!==4){console.error("Invalid ellipse coordinates:",r);return}let[n,a,l,d]=r,p=n/i*100,m=a/s*100,f=l/i*100,b=d/s*100;t.style.left=p-f+"%",t.style.top=m-b+"%",t.style.width=2*f+"%",t.style.height=2*b+"%",t.style.borderRadius="50%"}break;case"poly":{if(r.length<6||r.length%2!==0){console.error("Invalid polygon coordinates:",r);return}let n=[];for(let q=0;q<r.length;q+=2)n.push({x:r[q],y:r[q+1]});let a=Math.min(...n.map(q=>q.x)),l=Math.max(...n.map(q=>q.x)),d=Math.min(...n.map(q=>q.y)),p=Math.max(...n.map(q=>q.y)),m=a/i*100,f=d/s*100,b=l/i*100,y=p/s*100;t.style.left=m+"%",t.style.top=f+"%",t.style.width=b-m+"%",t.style.height=y-f+"%";let A=n.map(q=>({x:(q.x-a)/(l-a)*100,y:(q.y-d)/(p-d)*100})).map(q=>`${q.x}% ${q.y}%`).join(",");t.style.clipPath=`polygon(${A})`}break;default:console.error(`Unsupported shape: ${o}`);break}}var Xo=x`
|
|
4329
4325
|
slot:not([name='prompt']) {
|
|
4330
4326
|
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
4331
4327
|
display: block;
|
|
@@ -5454,7 +5450,7 @@ div.full-correct-response-inline {
|
|
|
5454
5450
|
user-select: none;
|
|
5455
5451
|
position: absolute;
|
|
5456
5452
|
}
|
|
5457
|
-
`,Er=c([g("qti-associable-hotspot")],Er);var WC=async o=>{let r=o.substring(0,o.lastIndexOf("/")),e=await oo().load(`${o}`).then(a=>a.assessmentTest()),t=await mt().load(`${r}/${e.href}`).then(a=>a.htmlDoc()),i=await mt().load(`${r}/${e.href}`).then(a=>a.items()),s=`${r}/${e.href}`,n=`${r}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:t,testURI:n,testURL:s,items:i,testIdentifier:e.identifier}},XC=async o=>oe().load(o).then(r=>r.htmlDoc().firstElementChild);var be=class extends v{render(){return h`<slot></slot>`}process(){throw new Error("Not implemented")}};be=c([g("qti-rule")],be);var wr=class extends be{get childExpression(){return this.firstElementChild}process(){let r=this.getAttribute("identifier"),e=this.context.variables.find(i=>i.identifier===r)||null,t;return e.interpolationTable&&(t=e.interpolationTable.get(parseFloat(this.childExpression.calculate()))),t==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Gt(t)}})),t)}};c([u({type:String})],wr.prototype,"identifier",2),c([_({context:P,subscribe:!0}),E()],wr.prototype,"context",2);customElements.define("qti-lookup-outcome-value",wr);var ts=class extends be{render(){return h`<slot></slot>`}process(){let r=[...this.children];for(let e=0;e<r.length;e++){let t=r[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",ts);var rs=class extends be{process(){let r=this.getAttribute("identifier");if(!r){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new is(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:this.formatValue(i)}}))}formatValue(r){return Array.isArray(r)?r.map(Gt):r!==null?Gt(r):null}},is=class{constructor(r){this.expression=r}process(){let r=this.expression.calculate()??null;return r===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(r)?r.map(e=>e.value?e.value:e):r}};customElements.define("qti-set-outcome-value",rs);var _r=class extends v{render(){return h`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let r=this.getSubRules();for(let e=0;e<r.length;e++)r[e].process()}};customElements.define("qti-response-else",_r);var Tr=class extends _r{calculate(){return this.firstElementChild.calculate()}getSubRules(){let r=[];for(let e=1;e<this.children.length;e++)r.push(this.children[e]);return r}};customElements.define("qti-response-if",Tr);var ss=class extends Tr{render(){return h`${super.render()}`}};customElements.define("qti-response-else-if",ss);var ui=class extends ta(K){calculate(){return this.calculateChildren(Array.from(this.children))}};ui=c([g("qti-and")],ui);function ta(o){return class extends o{calculateChildren(e){return e.map(i=>{let s=i;if(!s.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=s.calculate(),a=!1;if(typeof n=="string")if(n==="true")a=!0;else if(n==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(a=n);return a}).every(i=>typeof i=="boolean"&&i)}}}var mi=class extends w{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};c([u({type:String,attribute:"base-type"})],mi.prototype,"baseType",2);customElements.define("qti-base-value",mi);var os=class extends w{getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let r=this.getVariables();if(!r||r?.length===0)return 0;let e=r[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)}};customElements.define("qti-container-size",os);var ns=class extends K{getResult(){let r=this.getVariables();if(this.children.length===2){let e=r[0],t=r[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,s=t.value;return i.filter(l=>s.includes(l)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return t.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",ns);var as=class extends w{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let r=this.getAttribute("identifier")||"",e=this.context.variables.find(t=>t.identifier===r)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",as);var Lt=class extends w{constructor(){super(...arguments);this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let e=this.identifier.split("."),t=null,i;if(e.length===2)t=e[0],i=e[1];else if(e.length===1)i=e[0];else return console.error("qti-default: invalid identifier format"),null;if(t){let n=this._testContext.items.find(l=>l.identifier===t);if(console.debug(`itemContext: ${JSON.stringify(n)}`),!this._testContext||!n)return console.warn(`qti-default: item "${t}" not found in test context`),null;let a=this._testContext.items.find(l=>l.identifier===t)?.variables.find(l=>l.identifier===i);return a?a.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item "${t}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let s=this.context.variables.find(n=>n.identifier===i);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item context`),null)}};c([u({type:String})],Lt.prototype,"identifier",2),c([_({context:P,subscribe:!0}),E()],Lt.prototype,"context",2),c([E(),_({context:ne,subscribe:!0})],Lt.prototype,"_testContext",2);customElements.define("qti-default",Lt);var hi=class extends w{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let s=parseFloat(t.value),n=parseFloat(i.value);if(!isNaN(s)&&!isNaN(n))return this.roundingMode==="significantFigures"?s.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(s*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: ${s}, ${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}};c([u({type:String})],hi.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",hi);var ls=class extends w{getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=r[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 t=parseFloat(e.value);return isNaN(t)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(t)?Math.floor(t+.5):t===1/0?1/0:t===-1/0?-1/0:null}};customElements.define("qti-round",ls);var Ar=class extends w{constructor(){super(...arguments);this.roundingMode="significantFigures";this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let i=parseFloat(t.value);return isNaN(i)?null:isFinite(i)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this._roundToDecimalPlaces(i,this.figures):this._roundToSignificantFigures(i,this.figures):i===1/0?1/0:i===-1/0?-1/0:null}_roundToDecimalPlaces(e,t){if(e===0)return 0;let i=Math.pow(10,t);return Math.round(e*i)/i}_roundToSignificantFigures(e,t){if(e===0)return 0;let i=Math.floor(Math.log10(Math.abs(e))),s=Math.pow(10,t-i-1);return Math.round(e*s)/s}};c([u({type:String,attribute:"rounding-mode"})],Ar.prototype,"roundingMode",2),c([u({type:Number})],Ar.prototype,"figures",2);customElements.define("qti-round-to",Ar);var fi=class extends w{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):z.compareSingleValues(t.value,i.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};c([u({type:String})],fi.prototype,"toleranceMode",2);customElements.define("qti-equal",fi);var cs=class extends w{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(t.value===null||t.value===void 0)return null;if(t.cardinality==="single"){if(Array.isArray(t.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(t.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(t.cardinality==="multiple"||t.cardinality==="ordered"){if(!Array.isArray(t.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of t.value){if(i==null)return null;let s=parseInt(i,10);if(isNaN(s))return console.error("qti-gcd non-numerical value"),null;e.push(s)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this._calculateGcd(e)}_calculateGcd(r){if(r.length===0)return 0;if(r.length===1)return Math.abs(r[0]);let e=Math.abs(r[0]);for(let t=1;t<r.length&&(e=this._gcdTwoNumbers(e,Math.abs(r[t])),e!==1);t++);return e}_gcdTwoNumbers(r,e){if(r===0&&e===0)return 0;if(r===0)return e;if(e===0)return r;for(;e!==0;){let t=e;e=r%e,r=t}return r}};customElements.define("qti-gcd",cs);var ds=class extends w{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",ds);var ps=class extends K{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value>=+t.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",ps);var us=class extends w{getResult(){return null}};customElements.define("qti-null",us);var ms=class extends w{getResult(){if(this.children.length===1){let r=this.getVariables();if(!r)return!0;let e=r[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",ms);var hs=class extends w{getResult(){let r=this.getAttribute("field-identifier");if(!r)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let t=this.getVariables()[0];if(t.baseType!=="record"||t.value===null)throw new Error("qti-field-value child expression must return a record");let i=t.value[r];if(i===void 0)throw new Error(`Field "${r}" not found in record`);return i}};customElements.define("qti-field-value",hs);var fs=class extends w{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",fs);var gs=class extends K{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value<=+t.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",gs);var gi=class extends w{getResult(){let r=this.context.variables.find(s=>s.identifier===this.identifier);if(!r||!r.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=r.mapping,t=Array.isArray(r.value)?r.value:[r.value],i=0;for(let s of t){let n=e.mapEntries.filter(l=>r.baseType==="string"&&!l.caseSensitive?z.compareSingleValues(l.mapKey.toLowerCase(),s.toLowerCase(),r.baseType):z.compareSingleValues(l.mapKey,s,r.baseType)),a=n.reduce((l,d)=>l.mappedValue>d.mappedValue?l:d,n.length>0?n[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}};c([u({type:String})],gi.prototype,"identifier",2);customElements.define("qti-map-response",gi);var bi=class extends w{getResult(){let r=this.context.variables.find(n=>n.identifier===this.identifier);if(!r)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=r.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let t=Array.isArray(r.value)?r.value:[r.value];if(!t||t.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,s=new Set;for(let n of t)for(let a of e.areaMapEntries){if(s.has(a.coords))continue;z.isPointInArea(n,`${a.shape},${a.coords}`,r.baseType)&&(i+=a.mappedValue??0,s.add(a.coords))}return s.size<t.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};c([u({type:String})],bi.prototype,"identifier",2);customElements.define("qti-map-response-point",bi);var vi=class extends w{constructor(){super(...arguments);this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let i of e){if(i.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(i.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(i.value===null||i.value===void 0)return null;if(i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let s=parseFloat(i.value);if(isNaN(s))return console.error("qti-math-operator non-numerical value"),null;t.push(s)}return this._performOperation(this.name,t)}_performOperation(e,t){try{switch(e.toLowerCase()){case"sin":return t.length!==1?null:Math.sin(t[0]);case"cos":return t.length!==1?null:Math.cos(t[0]);case"tan":return t.length!==1?null:Math.tan(t[0]);case"asin":return t.length!==1||t[0]<-1||t[0]>1?null:Math.asin(t[0]);case"acos":return t.length!==1||t[0]<-1||t[0]>1?null:Math.acos(t[0]);case"atan":return t.length!==1?null:Math.atan(t[0]);case"sinh":return t.length!==1?null:Math.sinh(t[0]);case"cosh":return t.length!==1?null:Math.cosh(t[0]);case"tanh":return t.length!==1?null:Math.tanh(t[0]);case"log":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"ln":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"log10":return t.length!==1||t[0]<=0?null:Math.log10(t[0]);case"exp":return t.length!==1?null:Math.exp(t[0]);case"abs":return t.length!==1?null:Math.abs(t[0]);case"sqrt":return t.length!==1||t[0]<0?null:Math.sqrt(t[0]);case"signum":return t.length!==1?null:Math.sign(t[0]);case"floor":return t.length!==1?null:Math.floor(t[0]);case"ceil":return t.length!==1?null:Math.ceil(t[0]);case"round":return t.length!==1?null:Math.round(t[0]);case"atan2":return t.length!==2?null:Math.atan2(t[0],t[1]);case"pow":{if(t.length!==2)return null;let i=t[0],s=t[1];return i===0&&s<=0||i<0&&!Number.isInteger(s)?null:Math.pow(i,s)}case"log_base":{if(t.length!==2)return null;let i=t[0],s=t[1];return i<=0||s<=0||s===1?null:Math.log(i)/Math.log(s)}case"mod":return t.length!==2||t[1]===0?null:t[0]%t[1];case"max":return t.length<1?null:Math.max(...t);case"min":return t.length<1?null:Math.min(...t);default:return console.error(`qti-math-operator: unknown operation "${e}"`),null}}catch(i){return console.error(`qti-math-operator: error performing operation "${e}":`,i),null}}};c([u({type:String})],vi.prototype,"name",2);customElements.define("qti-math-operator",vi);var bs=class o extends w{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return o.match(e,t)}return console.error("unexpected number of children in match"),null}static match(r,e){if(r.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(r.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):z.compareSingleValues(r.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;for(let t=0;t<r.value.length;t++)if(!z.compareSingleValues(e.value[t],r.value[t],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;let t=0;for(let i of e.value){let s=null,n=[...r.value];for(let a of n)if(z.compareSingleValues(i,a,e.baseType)){s=a;break}if(s!==null)n.splice(n.indexOf(s),1);else return!1;t++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",bs);var vs=class extends w{getResult(){let r=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=r;if(e.baseType===t.baseType||e.baseType==="integer"&&t.baseType==="float"||e.baseType==="float"&&t.baseType==="integer"||console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let i=e.value;return t.value.includes(i)}};customElements.define("qti-member",vs);var ys=class extends w{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return r}};customElements.define("qti-multiple",ys);var xs=class extends w{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",xs);var qs=class extends K{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=t.calculate(),s=!1;if(typeof i=="string")if(i==="true")s=!0;else if(i==="false")s=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(s=i);return s}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",qs);var Cs=class extends w{getResult(){let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return r}};customElements.define("qti-ordered",Cs);var Es=class extends w{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let r=this.getVariables();if(!r||r.length!==2)return null;let[e,t]=r;if(e.cardinality!=="single"||t.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(t.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||t.value===null||t.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),s=parseFloat(t.value);if(isNaN(i)||isNaN(s))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&s<=0||i<0&&!Number.isInteger(s))return null;let n;try{n=Math.pow(i,s)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(n))return null;if(n===1/0||n===-1/0)return n;if(!isFinite(n)||Math.abs(n)>Number.MAX_VALUE||n!==0&&Math.abs(n)<Number.MIN_VALUE)return null;if(isFinite(n)&&n!==0){let a=Math.floor(Math.log10(Math.abs(n))),l=Math.max(0,14-a),d=Math.pow(10,l);n=Math.round(n*d)/d}return n}};customElements.define("qti-power",Es);var Sr=class extends v{render(){let r=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return r===null?k:h`${JSON.stringify(r,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};c([u({type:String})],Sr.prototype,"identifier",2),c([_({context:P,subscribe:!0}),E()],Sr.prototype,"context",2);customElements.define("qti-printed-variable",Sr);var ws=class extends w{getResult(){return this.getVariables().reduce((t,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return t*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return t},1)}};customElements.define("qti-product",ws);var yi=class extends ra(w){getResult(){return this.calculateChildren(Array.from(this.children))}};function ra(o){return class extends o{calculateChildren(e){let t=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=i.calculate();return Number.isNaN(s)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(s)});return t.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):t[0]-t[1]}}}customElements.define("qti-subtract",yi);var xi=class extends w{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let s=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),n=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return z.compareSingleValues(s,n,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};c([u({type:String,attribute:"case-sensitive"})],xi.prototype,"caseSensitive",2);customElements.define("qti-string-match",xi);var _s=class extends w{constructor(){super(),this._expression=new Ts(Array.from(this.children))}getResult(){return this._expression.calculate()}},Ts=class{constructor(r){this.expressions=r}calculate(){return this.expressions.filter(t=>t.calculate!==void 0).some(t=>t.calculate()===null)?null:this.expressions.map(t=>{let i=t.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((t,i)=>t+i,0)}};customElements.define("qti-sum",_s);var As=class extends w{getResult(){let r=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===r).value}};customElements.define("qti-variable",As);var $t=class extends w{constructor(){super(...arguments);this.min=0;this.max=10;this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let e=[],t=0;for(;;){let s=this.min+this.step*t;if(s>this.max)break;Number.isInteger(s)&&e.push(s),t++}if(e.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let i=Math.floor(Math.random()*e.length);return e[i]}getPossibleValues(){let e=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let t=0;for(;;){let i=this.min+this.step*t;if(i>this.max)break;Number.isInteger(i)&&e.push(i),t++}return e.length>0?e:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};c([u({type:Number})],$t.prototype,"min",2),c([u({type:Number})],$t.prototype,"max",2),c([u({type:Number})],$t.prototype,"step",2);customElements.define("qti-random-integer",$t);var Ss=class extends w{getResult(){let r=this.getVariables();if(r.length===1){let e=r[0].value;if(Array.isArray(e)){let t=Math.floor(Math.random()*e.length);return e[t]}return e}return console.error("unexpected number of children in match"),null}};customElements.define("qti-random",Ss);var Rs=class extends w{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return e.cardinality!=="single"||!Array.isArray(t.value)?(console.error("unexpected cardinality in qti equal"),null):r[0].baseType!==r[1].baseType?(console.error("The baseType of the two variables is different"),null):t.value.filter(s=>!e.value.includes(s))}return null}};customElements.define("qti-delete",Rs);var Rr=class extends w{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 r=this.getVariables()[0];if(!r)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let t=this.lookupVariableValue(this.n);if(t===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(t)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(r.cardinality==="ordered"){let t=Array.isArray(r.value)?r.value:[r.value];return r.value===null||e>t.length?null:t[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}lookupVariableValue(r){let e=this.context.variables.find(t=>t.identifier===r)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};c([u({type:String})],Rr.prototype,"n",2),Rr=c([g("qti-index")],Rr);export{co as Correctness,Ni as INITIAL_SESSION_CONTEXT,Hi as INITIAL_TEST_CONTEXT,R as Interaction,zi as IsNullOrUndefined,_e as ItemContainer,st as ItemCorrectResponseMode,wt as ItemPrintVariables,re as ItemShowCandidateCorrection,ie as ItemShowCorrectResponse,ui as QtiAnd,Y as QtiAssessmentItem,xe as QtiAssessmentItemRef,qe as QtiAssessmentSection,bt as QtiAssessmentStimulusRef,Bi as QtiAssessmentStimulusRefConnectedEvent,Qe as QtiAssessmentTest,Er as QtiAssociableHotspot,Tt as QtiAssociateInteraction,mi as QtiBaseValue,At as QtiChoiceInteraction,Gr as QtiCompanionMaterialsInfo,K as QtiConditionExpression,os as QtiContainerSize,ns as QtiContains,Jr as QtiContentBody,as as QtiCorrect,Te as QtiCustomInteraction,Yt as QtiCustomOperator,Lt as QtiDefault,Rs as QtiDelete,Fe as QtiEndAttemptInteraction,fi as QtiEqual,hi as QtiEqualRounded,w as QtiExpression,W as QtiExtendedTextInteraction,G as QtiFeedback,Jt as QtiFeedbackBlock,Kt as QtiFeedbackInline,hs as QtiFieldValue,It as QtiGap,kt as QtiGapImg,ur as QtiGapMatchInteraction,Mt as QtiGapText,cs as QtiGcd,he as QtiGraphicAssociateInteraction,mr as QtiGraphicGapMatchInteraction,hr as QtiGraphicOrderInteraction,ds as QtiGt,ps as QtiGte,ot as QtiHotspotChoice,fr as QtiHotspotInteraction,Cr as QtiHottext,gr as QtiHottextInteraction,Rr as QtiIndex,qr as QtiInlineChoice,Ae as QtiInlineChoiceInteraction,ms as QtiIsNull,_t as QtiItem,Zt as QtiItemBody,wr as QtiLookupOutcomeValue,fs as QtiLt,gs as QtiLte,gi as QtiMapResponse,bi as QtiMapResponsePoint,bs as QtiMatch,Se as QtiMatchInteraction,vi as QtiMathOperator,vr as QtiMediaInteraction,vs as QtiMember,et as QtiModalFeedback,ys as QtiMultiple,xs as QtiNot,us as QtiNull,qs as QtiOr,Re as QtiOrderInteraction,Cs as QtiOrdered,ce as QtiOutcomeDeclaration,F as QtiPortableCustomInteraction,Ki as QtiPositionObjectInteraction,yr as QtiPositionObjectStage,Es as QtiPower,Sr as QtiPrintedVariable,ws as QtiProduct,Yr as QtiPrompt,Ss as QtiRandom,$t as QtiRandomInteger,ts as QtiResponseCondition,Ee as QtiResponseDeclaration,_r as QtiResponseElse,ss as QtiResponseElseIf,Tr as QtiResponseIf,Qt as QtiResponseProcessing,ls as QtiRound,Ar as QtiRoundTo,le as QtiRubricBlock,po as QtiRuleElement,fe as QtiSelectPointInteraction,rs as QtiSetOutcomeValue,is as QtiSetOutcomeValueRule,Be as QtiSimpleAssociableChoice,Me as QtiSimpleChoice,ke as QtiSliderInteraction,xi as QtiStringMatch,Kr as QtiStylesheet,yi as QtiSubtract,_s as QtiSum,Ts as QtiSumExpression,Wr as QtiTest,er as QtiTestFeedback,Ce as QtiTestPart,Q as QtiTextEntryInteraction,xr as QtiUploadInteraction,As as QtiVariable,gt as QtiVariableDeclaration,z as ScoringHelper,pr as TestCheckItem,we as TestContainer,tr as TestEndAttempt,vt as TestItemLink,Z as TestNavigation,Oe as TestNext,nr as TestPagingButtonsStamp,De as TestPrev,cr as TestPrintContext,qt as TestPrintVariables,it as TestScoringButtons,Et as TestScoringFeedback,lr as TestSectionButtonsStamp,Ct as TestSectionLink,ee as TestShowCorrectResponse,rt as TestStamp,j as TestView,dr as TestViewToggle,$ as computedContext,Pe as computedItemContext,J as configContext,Gt as convertNumberToUniversalFormat,Sn as decimalSeparator,XC as getItemByUri,WC as getManifestInfo,P as itemContext,lo as itemContextVariables,ta as qtiAndMixin,jr as qtiContext,ra as qtiSubtractMixin,oe as qtiTransformItem,oo as qtiTransformManifest,mt as qtiTransformTest,Ze as removeDoubleSlashes,Ve as sessionContext,ne as testContext};
|
|
5453
|
+
`,Er=c([g("qti-associable-hotspot")],Er);var WC=async o=>{let r=o.substring(0,o.lastIndexOf("/")),e=await oo().load(`${o}`).then(a=>a.assessmentTest()),t=await mt().load(`${r}/${e.href}`).then(a=>a.htmlDoc()),i=await mt().load(`${r}/${e.href}`).then(a=>a.items()),s=`${r}/${e.href}`,n=`${r}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:t,testURI:n,testURL:s,items:i,testIdentifier:e.identifier}},XC=async o=>oe().load(o).then(r=>r.htmlDoc().firstElementChild);var be=class extends v{render(){return h`<slot></slot>`}process(){throw new Error("Not implemented")}};be=c([g("qti-rule")],be);var wr=class extends be{get childExpression(){return this.firstElementChild}process(){let r=this.getAttribute("identifier"),e=this.context.variables.find(i=>i.identifier===r)||null,t;return e.interpolationTable&&(t=e.interpolationTable.get(parseFloat(this.childExpression.calculate()))),t==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Gt(t)}})),t)}};c([u({type:String})],wr.prototype,"identifier",2),c([_({context:P,subscribe:!0}),E()],wr.prototype,"context",2);customElements.define("qti-lookup-outcome-value",wr);var ts=class extends be{render(){return h`<slot></slot>`}process(){let r=[...this.children];for(let e=0;e<r.length;e++){let t=r[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",ts);var rs=class extends be{process(){let r=this.getAttribute("identifier");if(!r){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new is(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:this.formatValue(i)}}))}formatValue(r){return Array.isArray(r)?r.map(Gt):r!==null?Gt(r):null}},is=class{constructor(r){this.expression=r}process(){let r=this.expression.calculate()??null;return r===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(r)?r.map(e=>e.value?e.value:e):r}};customElements.define("qti-set-outcome-value",rs);var _r=class extends v{render(){return h`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let r=this.getSubRules();for(let e=0;e<r.length;e++)r[e].process()}};customElements.define("qti-response-else",_r);var Tr=class extends _r{calculate(){return this.firstElementChild.calculate()}getSubRules(){let r=[];for(let e=1;e<this.children.length;e++)r.push(this.children[e]);return r}};customElements.define("qti-response-if",Tr);var ss=class extends Tr{render(){return h`${super.render()}`}};customElements.define("qti-response-else-if",ss);var ui=class extends ta(K){calculate(){return this.calculateChildren(Array.from(this.children))}};ui=c([g("qti-and")],ui);function ta(o){return class extends o{calculateChildren(e){return e.map(i=>{let s=i;if(!s.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=s.calculate(),a=!1;if(typeof n=="string")if(n==="true")a=!0;else if(n==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(a=n);return a}).every(i=>typeof i=="boolean"&&i)}}}var mi=class extends w{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};c([u({type:String,attribute:"base-type"})],mi.prototype,"baseType",2);customElements.define("qti-base-value",mi);var os=class extends w{getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let r=this.getVariables();if(!r||r?.length===0)return 0;let e=r[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)}};customElements.define("qti-container-size",os);var ns=class extends K{getResult(){let r=this.getVariables();if(this.children.length===2){let e=r[0],t=r[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,s=t.value;return i.filter(l=>s.includes(l)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return t.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",ns);var as=class extends w{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let r=this.getAttribute("identifier")||"",e=this.context.variables.find(t=>t.identifier===r)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",as);var Lt=class extends w{constructor(){super(...arguments);this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let e=this.identifier.split("."),t=null,i;if(e.length===2)t=e[0],i=e[1];else if(e.length===1)i=e[0];else return console.error("qti-default: invalid identifier format"),null;if(t){let n=this._testContext.items.find(l=>l.identifier===t);if(console.debug(`itemContext: ${JSON.stringify(n)}`),!this._testContext||!n)return console.warn(`qti-default: item "${t}" not found in test context`),null;let a=this._testContext.items.find(l=>l.identifier===t)?.variables.find(l=>l.identifier===i);return a?a.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item "${t}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let s=this.context.variables.find(n=>n.identifier===i);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${i}" not found in item context`),null)}};c([u({type:String})],Lt.prototype,"identifier",2),c([_({context:P,subscribe:!0}),E()],Lt.prototype,"context",2),c([E(),_({context:ne,subscribe:!0})],Lt.prototype,"_testContext",2);customElements.define("qti-default",Lt);var hi=class extends w{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let s=parseFloat(t.value),n=parseFloat(i.value);if(!isNaN(s)&&!isNaN(n))return this.roundingMode==="significantFigures"?s.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(s*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: ${s}, ${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}};c([u({type:String})],hi.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",hi);var ls=class extends w{getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=r[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 t=parseFloat(e.value);return isNaN(t)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(t)?Math.floor(t+.5):t===1/0?1/0:t===-1/0?-1/0:null}};customElements.define("qti-round",ls);var Ar=class extends w{constructor(){super(...arguments);this.roundingMode="significantFigures";this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=e[0];if(t.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(t.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(t.value===null||t.value===void 0)return null;if(t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let i=parseFloat(t.value);return isNaN(i)?null:isFinite(i)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this._roundToDecimalPlaces(i,this.figures):this._roundToSignificantFigures(i,this.figures):i===1/0?1/0:i===-1/0?-1/0:null}_roundToDecimalPlaces(e,t){if(e===0)return 0;let i=Math.pow(10,t);return Math.round(e*i)/i}_roundToSignificantFigures(e,t){if(e===0)return 0;let i=Math.floor(Math.log10(Math.abs(e))),s=Math.pow(10,t-i-1);return Math.round(e*s)/s}};c([u({type:String,attribute:"rounding-mode"})],Ar.prototype,"roundingMode",2),c([u({type:Number})],Ar.prototype,"figures",2);customElements.define("qti-round-to",Ar);var fi=class extends w{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):z.compareSingleValues(t.value,i.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};c([u({type:String})],fi.prototype,"toleranceMode",2);customElements.define("qti-equal",fi);var cs=class extends w{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let r=this.getVariables();if(!r||r.length===0)return null;let e=[];for(let t of r){if(t.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(t.value===null||t.value===void 0)return null;if(t.cardinality==="single"){if(Array.isArray(t.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(t.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(t.cardinality==="multiple"||t.cardinality==="ordered"){if(!Array.isArray(t.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of t.value){if(i==null)return null;let s=parseInt(i,10);if(isNaN(s))return console.error("qti-gcd non-numerical value"),null;e.push(s)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this._calculateGcd(e)}_calculateGcd(r){if(r.length===0)return 0;if(r.length===1)return Math.abs(r[0]);let e=Math.abs(r[0]);for(let t=1;t<r.length&&(e=this._gcdTwoNumbers(e,Math.abs(r[t])),e!==1);t++);return e}_gcdTwoNumbers(r,e){if(r===0&&e===0)return 0;if(r===0)return e;if(e===0)return r;for(;e!==0;){let t=e;e=r%e,r=t}return r}};customElements.define("qti-gcd",cs);var ds=class extends w{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",ds);var ps=class extends K{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value>=+t.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",ps);var us=class extends w{getResult(){return null}};customElements.define("qti-null",us);var ms=class extends w{getResult(){if(this.children.length===1){let r=this.getVariables();if(!r)return!0;let e=r[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",ms);var hs=class extends w{getResult(){let r=this.getAttribute("field-identifier");if(!r)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let t=this.getVariables()[0];if(t.baseType!=="record"||t.value===null)throw new Error("qti-field-value child expression must return a record");let i=t.value[r];if(i===void 0)throw new Error(`Field "${r}" not found in record`);return i}};customElements.define("qti-field-value",hs);var fs=class extends w{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];if((e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",fs);var gs=class extends K{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return(e.baseType==="integer"||e.baseType==="float")&&(t.baseType==="integer"||t.baseType==="float")?+e.value<=+t.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",gs);var gi=class extends w{getResult(){let r=this.context.variables.find(s=>s.identifier===this.identifier);if(!r||!r.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=r.mapping,t=Array.isArray(r.value)?r.value:[r.value],i=0;for(let s of t){let n=e.mapEntries.filter(l=>r.baseType==="string"&&!l.caseSensitive?z.compareSingleValues(l.mapKey.toLowerCase(),s.toLowerCase(),r.baseType):z.compareSingleValues(l.mapKey,s,r.baseType)),a=n.reduce((l,d)=>l.mappedValue>d.mappedValue?l:d,n.length>0?n[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}};c([u({type:String})],gi.prototype,"identifier",2);customElements.define("qti-map-response",gi);var bi=class extends w{getResult(){let r=this.context.variables.find(n=>n.identifier===this.identifier);if(!r)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=r.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let t=Array.isArray(r.value)?r.value:[r.value];if(!t||t.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,s=new Set;for(let n of t)for(let a of e.areaMapEntries){if(s.has(a.coords))continue;z.isPointInArea(n,`${a.shape},${a.coords}`,r.baseType)&&(i+=a.mappedValue??0,s.add(a.coords))}return s.size<t.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};c([u({type:String})],bi.prototype,"identifier",2);customElements.define("qti-map-response-point",bi);var vi=class extends w{constructor(){super(...arguments);this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let e=this.getVariables();if(!e||e.length===0)return null;let t=[];for(let i of e){if(i.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(i.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(i.value===null||i.value===void 0)return null;if(i.baseType!=="integer"&&i.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let s=parseFloat(i.value);if(isNaN(s))return console.error("qti-math-operator non-numerical value"),null;t.push(s)}return this._performOperation(this.name,t)}_performOperation(e,t){try{switch(e.toLowerCase()){case"sin":return t.length!==1?null:Math.sin(t[0]);case"cos":return t.length!==1?null:Math.cos(t[0]);case"tan":return t.length!==1?null:Math.tan(t[0]);case"asin":return t.length!==1||t[0]<-1||t[0]>1?null:Math.asin(t[0]);case"acos":return t.length!==1||t[0]<-1||t[0]>1?null:Math.acos(t[0]);case"atan":return t.length!==1?null:Math.atan(t[0]);case"sinh":return t.length!==1?null:Math.sinh(t[0]);case"cosh":return t.length!==1?null:Math.cosh(t[0]);case"tanh":return t.length!==1?null:Math.tanh(t[0]);case"log":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"ln":return t.length!==1||t[0]<=0?null:Math.log(t[0]);case"log10":return t.length!==1||t[0]<=0?null:Math.log10(t[0]);case"exp":return t.length!==1?null:Math.exp(t[0]);case"abs":return t.length!==1?null:Math.abs(t[0]);case"sqrt":return t.length!==1||t[0]<0?null:Math.sqrt(t[0]);case"signum":return t.length!==1?null:Math.sign(t[0]);case"floor":return t.length!==1?null:Math.floor(t[0]);case"ceil":return t.length!==1?null:Math.ceil(t[0]);case"round":return t.length!==1?null:Math.round(t[0]);case"atan2":return t.length!==2?null:Math.atan2(t[0],t[1]);case"pow":{if(t.length!==2)return null;let i=t[0],s=t[1];return i===0&&s<=0||i<0&&!Number.isInteger(s)?null:Math.pow(i,s)}case"log_base":{if(t.length!==2)return null;let i=t[0],s=t[1];return i<=0||s<=0||s===1?null:Math.log(i)/Math.log(s)}case"mod":return t.length!==2||t[1]===0?null:t[0]%t[1];case"max":return t.length<1?null:Math.max(...t);case"min":return t.length<1?null:Math.min(...t);default:return console.error(`qti-math-operator: unknown operation "${e}"`),null}}catch(i){return console.error(`qti-math-operator: error performing operation "${e}":`,i),null}}};c([u({type:String})],vi.prototype,"name",2);customElements.define("qti-math-operator",vi);var bs=class o extends w{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return o.match(e,t)}return console.error("unexpected number of children in match"),null}static match(r,e){if(r.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(r.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):z.compareSingleValues(r.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;for(let t=0;t<r.value.length;t++)if(!z.compareSingleValues(e.value[t],r.value[t],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(r.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(r.value.length!==e.value.length)return!1;let t=0;for(let i of e.value){let s=null,n=[...r.value];for(let a of n)if(z.compareSingleValues(i,a,e.baseType)){s=a;break}if(s!==null)n.splice(n.indexOf(s),1);else return!1;t++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",bs);var vs=class extends w{getResult(){let r=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=r;if(e.baseType===t.baseType||e.baseType==="integer"&&t.baseType==="float"||e.baseType==="float"&&t.baseType==="integer"||console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let i=e.value;return t.value.includes(i)}};customElements.define("qti-member",vs);var ys=class extends w{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return r}};customElements.define("qti-multiple",ys);var xs=class extends w{render(){return h`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",xs);var qs=class extends K{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=t.calculate(),s=!1;if(typeof i=="string")if(i==="true")s=!0;else if(i==="false")s=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(s=i);return s}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",qs);var Cs=class extends w{getResult(){let r=this.getVariables();if(r.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of r)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return r}};customElements.define("qti-ordered",Cs);var Es=class extends w{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let r=this.getVariables();if(!r||r.length!==2)return null;let[e,t]=r;if(e.cardinality!=="single"||t.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(t.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||t.value===null||t.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||t.baseType!=="integer"&&t.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),s=parseFloat(t.value);if(isNaN(i)||isNaN(s))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&s<=0||i<0&&!Number.isInteger(s))return null;let n;try{n=Math.pow(i,s)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(n))return null;if(n===1/0||n===-1/0)return n;if(!isFinite(n)||Math.abs(n)>Number.MAX_VALUE||n!==0&&Math.abs(n)<Number.MIN_VALUE)return null;if(isFinite(n)&&n!==0){let a=Math.floor(Math.log10(Math.abs(n))),l=Math.max(0,14-a),d=Math.pow(10,l);n=Math.round(n*d)/d}return n}};customElements.define("qti-power",Es);var Sr=class extends v{render(){let r=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return r===null?k:h`${JSON.stringify(r,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};c([u({type:String})],Sr.prototype,"identifier",2),c([_({context:P,subscribe:!0}),E()],Sr.prototype,"context",2);customElements.define("qti-printed-variable",Sr);var ws=class extends w{getResult(){return this.getVariables().reduce((t,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return t*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return t},1)}};customElements.define("qti-product",ws);var yi=class extends ra(w){getResult(){return this.calculateChildren(Array.from(this.children))}};function ra(o){return class extends o{calculateChildren(e){let t=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=i.calculate();return Number.isNaN(s)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(s)});return t.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):t[0]-t[1]}}}customElements.define("qti-subtract",yi);var xi=class extends w{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],i=e[1];if(t.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let s=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),n=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return z.compareSingleValues(s,n,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};c([u({type:String,attribute:"case-sensitive"})],xi.prototype,"caseSensitive",2);customElements.define("qti-string-match",xi);var _s=class extends w{constructor(){super(),this._expression=new Ts(Array.from(this.children))}getResult(){return this._expression.calculate()}},Ts=class{constructor(r){this.expressions=r}calculate(){return this.expressions.filter(t=>t.calculate!==void 0).some(t=>t.calculate()===null)?null:this.expressions.map(t=>{let i=t.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((t,i)=>t+i,0)}};customElements.define("qti-sum",_s);var As=class extends w{getResult(){let r=this.getAttribute("identifier");return this.context.variables.find(t=>t.identifier===r).value}};customElements.define("qti-variable",As);var $t=class extends w{constructor(){super(...arguments);this.min=0;this.max=10;this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let e=[],t=0;for(;;){let s=this.min+this.step*t;if(s>this.max)break;Number.isInteger(s)&&e.push(s),t++}if(e.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let i=Math.floor(Math.random()*e.length);return e[i]}getPossibleValues(){let e=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let t=0;for(;;){let i=this.min+this.step*t;if(i>this.max)break;Number.isInteger(i)&&e.push(i),t++}return e.length>0?e:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};c([u({type:Number})],$t.prototype,"min",2),c([u({type:Number})],$t.prototype,"max",2),c([u({type:Number})],$t.prototype,"step",2);customElements.define("qti-random-integer",$t);var Ss=class extends w{getResult(){let r=this.getVariables();if(r.length===1){let e=r[0].value;if(Array.isArray(e)){let t=Math.floor(Math.random()*e.length);return e[t]}return e}return console.error("unexpected number of children in match"),null}};customElements.define("qti-random",Ss);var Rs=class extends w{getResult(){if(this.children.length===2){let r=this.getVariables(),e=r[0],t=r[1];return e.cardinality!=="single"||!Array.isArray(t.value)?(console.error("unexpected cardinality in qti equal"),null):r[0].baseType!==r[1].baseType?(console.error("The baseType of the two variables is different"),null):t.value.filter(s=>!e.value.includes(s))}return null}};customElements.define("qti-delete",Rs);var Rr=class extends w{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 r=this.getVariables()[0];if(!r)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let t=this.lookupVariableValue(this.n);if(t===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(t)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(r.cardinality==="ordered"){let t=Array.isArray(r.value)?r.value:[r.value];return r.value===null||e>t.length?null:t[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}lookupVariableValue(r){let e=this.context.variables.find(t=>t.identifier===r)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};c([u({type:String})],Rr.prototype,"n",2),Rr=c([g("qti-index")],Rr);export{co as Correctness,Di as INITIAL_SESSION_CONTEXT,Hi as INITIAL_TEST_CONTEXT,R as Interaction,zi as IsNullOrUndefined,_e as ItemContainer,st as ItemCorrectResponseMode,wt as ItemPrintVariables,re as ItemShowCandidateCorrection,ie as ItemShowCorrectResponse,ui as QtiAnd,Y as QtiAssessmentItem,xe as QtiAssessmentItemRef,qe as QtiAssessmentSection,bt as QtiAssessmentStimulusRef,Bi as QtiAssessmentStimulusRefConnectedEvent,Qe as QtiAssessmentTest,Er as QtiAssociableHotspot,Tt as QtiAssociateInteraction,mi as QtiBaseValue,At as QtiChoiceInteraction,Gr as QtiCompanionMaterialsInfo,K as QtiConditionExpression,os as QtiContainerSize,ns as QtiContains,Jr as QtiContentBody,as as QtiCorrect,Te as QtiCustomInteraction,Yt as QtiCustomOperator,Lt as QtiDefault,Rs as QtiDelete,Fe as QtiEndAttemptInteraction,fi as QtiEqual,hi as QtiEqualRounded,w as QtiExpression,W as QtiExtendedTextInteraction,G as QtiFeedback,Jt as QtiFeedbackBlock,Kt as QtiFeedbackInline,hs as QtiFieldValue,It as QtiGap,kt as QtiGapImg,ur as QtiGapMatchInteraction,Mt as QtiGapText,cs as QtiGcd,he as QtiGraphicAssociateInteraction,mr as QtiGraphicGapMatchInteraction,hr as QtiGraphicOrderInteraction,ds as QtiGt,ps as QtiGte,ot as QtiHotspotChoice,fr as QtiHotspotInteraction,Cr as QtiHottext,gr as QtiHottextInteraction,Rr as QtiIndex,qr as QtiInlineChoice,Ae as QtiInlineChoiceInteraction,ms as QtiIsNull,_t as QtiItem,Zt as QtiItemBody,wr as QtiLookupOutcomeValue,fs as QtiLt,gs as QtiLte,gi as QtiMapResponse,bi as QtiMapResponsePoint,bs as QtiMatch,Se as QtiMatchInteraction,vi as QtiMathOperator,vr as QtiMediaInteraction,vs as QtiMember,et as QtiModalFeedback,ys as QtiMultiple,xs as QtiNot,us as QtiNull,qs as QtiOr,Re as QtiOrderInteraction,Cs as QtiOrdered,ce as QtiOutcomeDeclaration,F as QtiPortableCustomInteraction,Ki as QtiPositionObjectInteraction,yr as QtiPositionObjectStage,Es as QtiPower,Sr as QtiPrintedVariable,ws as QtiProduct,Yr as QtiPrompt,Ss as QtiRandom,$t as QtiRandomInteger,ts as QtiResponseCondition,Ee as QtiResponseDeclaration,_r as QtiResponseElse,ss as QtiResponseElseIf,Tr as QtiResponseIf,Qt as QtiResponseProcessing,ls as QtiRound,Ar as QtiRoundTo,le as QtiRubricBlock,po as QtiRuleElement,fe as QtiSelectPointInteraction,rs as QtiSetOutcomeValue,is as QtiSetOutcomeValueRule,Be as QtiSimpleAssociableChoice,Me as QtiSimpleChoice,ke as QtiSliderInteraction,xi as QtiStringMatch,Kr as QtiStylesheet,yi as QtiSubtract,_s as QtiSum,Ts as QtiSumExpression,Wr as QtiTest,er as QtiTestFeedback,Ce as QtiTestPart,Q as QtiTextEntryInteraction,xr as QtiUploadInteraction,As as QtiVariable,gt as QtiVariableDeclaration,z as ScoringHelper,pr as TestCheckItem,we as TestContainer,tr as TestEndAttempt,vt as TestItemLink,Z as TestNavigation,Oe as TestNext,nr as TestPagingButtonsStamp,Ne as TestPrev,cr as TestPrintContext,qt as TestPrintVariables,it as TestScoringButtons,Et as TestScoringFeedback,lr as TestSectionButtonsStamp,Ct as TestSectionLink,ee as TestShowCorrectResponse,rt as TestStamp,j as TestView,dr as TestViewToggle,$ as computedContext,Pe as computedItemContext,J as configContext,Gt as convertNumberToUniversalFormat,Sn as decimalSeparator,XC as getItemByUri,WC as getManifestInfo,P as itemContext,lo as itemContextVariables,ta as qtiAndMixin,jr as qtiContext,ra as qtiSubtractMixin,oe as qtiTransformItem,oo as qtiTransformManifest,mt as qtiTransformTest,Ze as removeDoubleSlashes,Ve as sessionContext,ne as testContext};
|
|
5458
5454
|
/*! Bundled license information:
|
|
5459
5455
|
|
|
5460
5456
|
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|