@citolab/qti-components 10.0.0-next.22 → 10.0.0-next.23
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 +143 -143
- package/dist/{chunk-BB2ZSJXP.js → chunk-DJQE4M7B.js} +2 -2
- package/dist/{chunk-373IRT4X.js → chunk-IJKHXJSM.js} +49 -34
- package/dist/chunk-IJKHXJSM.js.map +1 -0
- package/dist/{chunk-L73QXB6G.js → chunk-ULJ22VKL.js} +2 -2
- package/dist/corrections.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -4
- package/dist/test.d.ts +48 -2
- package/dist/test.js +6 -4
- package/package.json +2 -2
- package/dist/chunk-373IRT4X.js.map +0 -1
- /package/dist/{chunk-BB2ZSJXP.js.map → chunk-DJQE4M7B.js.map} +0 -0
- /package/dist/{chunk-L73QXB6G.js.map → chunk-ULJ22VKL.js.map} +0 -0
package/cdn/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var vc=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Bt=function(o,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(o,e):i?i.value=e:t.set(o,e),e},tt=function(o,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(o):r?r.value:t.get(o)},_r,Mn,Pn,qi,ka,xi,On,Ke,wi,we,Dn,yc;var W={__proto__:null};W.enumerable=!0;Object.freeze(W);var Ea=(we=class{constructor(t,e={}){if(_r.set(this,!1),Mn.set(this,!1),Pn.set(this,!1),qi.set(this,!1),ka.set(this,Date.now()),xi.set(this,!1),On.set(this,void 0),Ke.set(this,void 0),wi.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:n}=e;Bt(this,_r,!!i,"f"),Bt(this,Mn,!!r,"f"),Bt(this,Pn,!!n,"f"),Bt(this,On,`${t}`,"f"),Bt(this,Ke,null,"f"),Bt(this,wi,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Bt(this,qi,!0,"f")}get target(){return tt(this,Ke,"f")}get currentTarget(){return tt(this,Ke,"f")}get srcElement(){return tt(this,Ke,"f")}get type(){return tt(this,On,"f")}get cancelable(){return tt(this,_r,"f")}get defaultPrevented(){return tt(this,_r,"f")&&tt(this,qi,"f")}get timeStamp(){return tt(this,ka,"f")}composedPath(){return tt(this,wi,"f")?[tt(this,Ke,"f")]:[]}get returnValue(){return!tt(this,_r,"f")||!tt(this,qi,"f")}get bubbles(){return tt(this,Mn,"f")}get composed(){return tt(this,Pn,"f")}get eventPhase(){return tt(this,wi,"f")?we.AT_TARGET:we.NONE}get cancelBubble(){return tt(this,xi,"f")}set cancelBubble(t){t&&Bt(this,xi,!0,"f")}stopPropagation(){Bt(this,xi,!0,"f")}get isTrusted(){return!1}},_r=new WeakMap,Mn=new WeakMap,Pn=new WeakMap,qi=new WeakMap,ka=new WeakMap,xi=new WeakMap,On=new WeakMap,Ke=new WeakMap,wi=new WeakMap,we.NONE=0,we.CAPTURING_PHASE=1,we.AT_TARGET=2,we.BUBBLING_PHASE=3,we);Object.defineProperties(Ea.prototype,{initEvent:W,stopImmediatePropagation:W,preventDefault:W,target:W,currentTarget:W,srcElement:W,type:W,cancelable:W,defaultPrevented:W,timeStamp:W,composedPath:W,returnValue:W,bubbles:W,composed:W,eventPhase:W,cancelBubble:W,stopPropagation:W,isTrusted:W});var qc=(yc=class extends Ea{constructor(t,e={}){super(t,e),Dn.set(this,void 0),Bt(this,Dn,e?.detail??null,"f")}initCustomEvent(t,e,r,i){throw new Error("Method not implemented.")}get detail(){return tt(this,Dn,"f")}},Dn=new WeakMap,yc);Object.defineProperties(qc.prototype,{detail:W});var ne=Ea,Sa=qc;var ot;var yg=(ot=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},ot.STYLE_RULE=1,ot.CHARSET_RULE=2,ot.IMPORT_RULE=3,ot.MEDIA_RULE=4,ot.FONT_FACE_RULE=5,ot.PAGE_RULE=6,ot.NAMESPACE_RULE=10,ot.KEYFRAMES_RULE=7,ot.KEYFRAME_RULE=8,ot.SUPPORTS_RULE=12,ot.COUNTER_STYLE_RULE=11,ot.FONT_FEATURE_VALUES_RULE=14,ot.MARGIN_RULE=9,ot);globalThis.Event??=ne;globalThis.CustomEvent??=Sa;var _a=Symbol(),xc=o=>typeof o=="boolean"?o:o?.capture??!1,oe={__proto__:null};oe.enumerable=!0;Object.freeze(oe);var $n=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let i=xc(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);if(n===void 0)n=new Map,i.set(t,n);else if(n.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),n.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let i=xc(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);n!==void 0&&(n.delete(e),n.size||i.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,i=!1,n=ne.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...oe},srcElement:{get(){return t.target},...oe},currentTarget:{get(){return l},...oe},eventPhase:{get(){return n},...oe},composedPath:{value:()=>e,...oe},stopPropagation:{value:()=>{r=!0,c.call(t)},...oe},stopImmediatePropagation:{value:()=>{i=!0,d.call(t)},...oe}});let h=(u,g,b)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&b.delete(u)},f=()=>(l=null,n=ne.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),l=u,n=u===t.target?ne.AT_TARGET:ne.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&y(x.slice(0,x.indexOf(u)+1)),l=u,n=u===t.target?ne.AT_TARGET:ne.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,kc,vu]}};var wc=new WeakMap,Ci=o=>{let t=wc.get(o);return t===void 0&&wc.set(o,t=new Map),t},ki=class extends $n{getRootNode(t){return t?.composed?Aa:this.__host?.__shadowRoot??Aa}};var Cc=class extends ki{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var kc=new Cc,Aa=kc;var Ec=class extends ki{constructor(t){if(super(),t!==_a)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Nn,customElements:Ia,document:Aa,Document:Cc,Element:Sc,EventTarget:$n,HTMLElement:Ac,Node:ki,ShadowRoot:_c,window:this,Window:Ec})}};var Sc=class extends ki{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Ci(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){Ci(this).set(t,String(e))}removeAttribute(t){Ci(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return Ci(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new _c(_a,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new vc(this);return this.__internals=t,t}getAttribute(t){return Ci(this).get(t)??null}};var Ac=class extends Sc{},Ta=Ac;var _c=class extends ki{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new Ta,"localName",{get(){return"lit-server-root"}});function gu(){let o,t;return{promise:new Promise((r,i)=>{o=r,t=i}),resolve:o,reject:t}}var Nn=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
-
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let r=this.__pendingWhenDefineds.get(t);return r||(r=
|
|
3
|
-
\f\r]`,Ii=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,$c
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Lc=/'/g,Vc=/"/g,zc=/^(?:script|style|textarea|title)$/i,Na=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=Na(1),Oi=Na(2),Kg=Na(3),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),jc=new WeakMap,tr=er.createTreeWalker(er,129);function Bc(o,t){if(!$a(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Dc!==void 0?Dc.createHTML(t):t}var Uc=(o,t)=>{let e=o.length-1,r=[],i,n=t===2?"<svg>":t===3?"<math>":"",s=Ii;for(let a=0;a<e;a++){let l=o[a],c,d,h=-1,f=0;for(;f<l.length&&(s.lastIndex=f,d=s.exec(l),d!==null);)f=s.lastIndex,s===Ii?d[1]==="!--"?s=$c:d[1]!==void 0?s=Nc:d[2]!==void 0?(zc.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=Ze):d[3]!==void 0&&(s=Ze):s===Ze?d[0]===">"?(s=i??Ii,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Ze:d[3]==='"'?Vc:Lc):s===Vc||s===Lc?s=Ze:s===$c||s===Nc?s=Ii:(s=Ze,i=void 0);let m=s===Ze&&o[a+1].startsWith("/>")?" ":"";n+=s===Ii?l+Au:h>=0?(r.push(c),l.slice(0,h)+Oa+l.slice(h)+ae+m):l+ae+(h===-2?a:m)}return[Bc(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Pi=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,s=0,a=t.length-1,l=this.parts,[c,d]=Uc(t,e);if(this.el=o.createElement(c,r),tr.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=tr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Oa)){let f=d[s++],m=i.getAttribute(h).split(ae),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?zn:y[1]==="?"?Bn:y[1]==="@"?Un:ir}),i.removeAttribute(h)}else h.startsWith(ae)&&(l.push({type:6,index:n}),i.removeAttribute(h));if(zc.test(i.tagName)){let h=i.textContent.split(ae),f=h.length-1;if(f>0){i.textContent=jn?jn.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],Ri()),tr.nextNode(),l.push({type:2,index:++n});i.append(h[f],Ri())}}}else if(i.nodeType===8)if(i.data===Da)l.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(ae,h+1))!==-1;)l.push({type:7,index:n}),h+=ae.length-1}n++}}static createElement(t,e){let r=er.createElement("template");return r.innerHTML=t,r}};function rr(o,t,e=o,r){if(t===it)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,n=Mi(t)?void 0:t._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(o),i._$AT(o,e,r)),r!==void 0?(e._$Co??=[])[r]=i:e._$Cl=i),i!==void 0&&(t=rr(o,i._$AS(o,t.values),i,r)),t}var Fn=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??er).importNode(e,!0);tr.currentNode=i;let n=tr.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Tr(n,n.nextSibling,this,t):l.type===1?c=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(c=new Hn(n,this,t)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(n=tr.nextNode(),s++)}return tr.currentNode=er,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},Tr=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=rr(this,t,e),Mi(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Fc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==P&&Mi(this._$AH)?this._$AA.nextSibling.data=t:this.T(er.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Pi.createElement(Bc(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new Fn(i,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(t){let e=jc.get(t.strings);return e===void 0&&jc.set(t.strings,e=new Pi(t)),e}k(t){$a(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let n of t)i===e.length?e.push(r=new o(this.O(Ri()),this.O(Ri()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=Oc(t).nextSibling;Oc(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ir=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,n){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(t,e=this,r,i){let n=this.strings,s=!1;if(n===void 0)t=rr(this,t,e,0),s=!Mi(t)||t!==this._$AH&&t!==it,s&&(this._$AH=t);else{let a=t,l,c;for(t=n[0],l=0;l<n.length-1;l++)c=rr(this,a[r+l],e,l),c===it&&(c=this._$AH[l]),s||=!Mi(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+n[l+1]),this._$AH[l]=c}s&&!i&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},zn=class extends ir{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Bn=class extends ir{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Un=class extends ir{constructor(t,e,r,i,n){super(t,e,r,i,n),this.type=5}_$AI(t,e=this){if((t=rr(this,t,e,0)??P)===it)return;let r=this._$AH,i=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Hn=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){rr(this,t)}},et={M:Oa,P:ae,A:Da,C:1,L:Uc,R:Fn,D:Fc,V:rr,I:Tr,H:ir,N:Bn,U:Un,B:zn,F:Hn},_u=Wn.litHtmlPolyfillSupport;_u?.(Pi,Tr),(Wn.litHtmlVersions??=[]).push("3.3.3");var La=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let n=e?.renderBefore??null;r._$litPart$=i=new Tr(t.insertBefore(Ri(),n),n,void 0,e??{})}return i._$AI(o),i};var Va=globalThis,E=class extends se{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=La(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};E._$litElement$=!0,E.finalized=!0,Va.litElementHydrateSupport?.({LitElement:E});var Tu=Va.litElementPolyfillSupport;Tu?.({LitElement:E});(Va.litElementVersions??=[]).push("4.2.2");var Iu={attribute:!0,type:String,converter:_i,reflect:!1,hasChanged:Vn},Ru=(o=Iu,t,e)=>{let{kind:r,metadata:i}=e,n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),r==="setter"&&((o=Object.create(o)).wrapped=!0),n.set(e.name,o),r==="accessor"){let{name:s}=e;return{set(a){let l=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,l,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,o,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(o){return(t,e)=>typeof e=="object"?Ru(o,t,e):((r,i,n)=>{let s=i.hasOwnProperty(n);return i.constructor.createProperty(n,r),s?Object.getOwnPropertyDescriptor(i,n):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var Ce=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Ir(o,t){return(e,r,i)=>{let n=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return Ce(e,r,{get(){let l=s.call(this);return l===void 0&&(l=n(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return Ce(e,r,{get(){return n(this)}})}}function Hc(o){return(t,e)=>{let{slot:r,selector:i}=o??{},n="slot"+(r?`[name=${r}]`:":not([name])");return Ce(t,e,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(o)??[];return i===void 0?a:a.filter(l=>l.matches(i))}})}}var le=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var at=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new le(this.context,this.host,this.t,this.subscribe))}};var Qn=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var ja=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},Ut=class extends Qn{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let n=i.contextTarget??i.composedPath()[0];n!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,n,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let n=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)n.has(s)||(n.add(s),a.dispatchEvent(new le(this.context,a,s,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new ja(this.context,this.host))}};var Di=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:r}=e;for(let{elementRef:i,callbackRef:n}of r){let s=i.deref(),a=n.deref();s===void 0||a===void 0||s.dispatchEvent(new le(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],r=t.callback,i=this.pendingContextRequests.get(t.context);i===void 0&&this.pendingContextRequests.set(t.context,i={callbacks:new WeakMap,requests:[]});let n=i.callbacks.get(e);n===void 0&&i.callbacks.set(e,n=new WeakSet),n.has(r)||(n.add(r),i.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(r)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function Q({context:o}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return r.get(this).setValue(i),t.set.call(this,i)},init(i){return r.set(this,new Ut(this,{context:o,initialValue:i})),i}};{t.constructor.addInitializer((s=>{r.set(s,new Ut(s,{context:o}))}));let i=Object.getOwnPropertyDescriptor(t,e),n;if(i===void 0){let s=new WeakMap;n={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;n={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}function I({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new at(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new at(i,{context:o,callback:n=>{i[r]=n},subscribe:t})}))}}var Xn=["this"],Wc=["+","-","!"],Qc=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Fa={"!":0,":":0,",":0,")":0,"]":0,"}":0,"|>":1,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"{":13},Gn=13;var Mu=["==","!=","<=",">=","||","&&","??","|>"],Pu=["===","!=="],O;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(O||(O={}));var Ht=(o,t,e=0)=>({kind:o,value:t,precedence:e}),Ou=o=>o===9||o===10||o===13||o===32,Xc=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),Du=o=>Xc(o)||$i(o),$u=o=>Xn.indexOf(o)!==-1,Nu=o=>o===34||o===39,$i=o=>48<=o&&o<=57,Lu=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,Vu=o=>o===40||o===41||o===91||o===93||o===123||o===125,ju=o=>o.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
|
|
5
|
-
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Jn=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;Ou(this.#i);)this.#n(!0);if(Nu(this.#i))return this.#a();if(Xc(this.#i))return this.#l();if($i(this.#i))return this.#p();if(this.#i===46)return this.#c();if(this.#i===44)return this.#d();if(this.#i===58)return this.#h();if(Lu(this.#i))return this.#f();if(Vu(this.#i))return this.#m();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(t);this.#n()}let r=Ht(O.STRING,ju(this.#o()));return this.#n(),r}#l(){do this.#n();while(Du(this.#i));let t=this.#o(),e=$u(t)?O.KEYWORD:O.IDENTIFIER;return Ht(e,t)}#p(){do this.#n();while($i(this.#i));return this.#i===46?this.#c():Ht(O.INTEGER,this.#o())}#c(){return this.#n(),$i(this.#i)?this.#u():(this.#s(),Ht(O.DOT,".",Gn))}#d(){return this.#n(!0),Ht(O.COMMA,",")}#h(){return this.#n(!0),Ht(O.COLON,":")}#u(){do this.#n();while($i(this.#i));return Ht(O.DECIMAL,this.#o())}#f(){this.#n();let t=this.#o(2);if(Pu.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Ht(O.ARROW,t);Mu.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Ht(O.OPERATOR,t,Fa[t])}#m(){let t=String.fromCharCode(this.#i),e=Ht(O.GROUPER,t,Fa[t]);return this.#n(!0),e}};var za=(o,t)=>new Ni(o,t).parse(),Ni=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new Jn(t),this.#r=e}parse(){return this.#o(),this.#s()}#o(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let r=this.#e.nextToken();this.#i=r,this.#t=r?.kind,this.#n=r?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#n!==e)}#s(){if(!this.#i)return this.#r.empty();let t=this.#c();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(O.GROUPER,"(")){let r=this.#g();t=this.#r.invoke(t,void 0,r)}else if(this._matches(O.GROUPER,"[")){let r=this.#v();t=this.#r.index(t,r)}else if(this._matches(O.DOT)){this.#o();let r=this.#c();t=this.#l(t,r)}else{if(this._matches(O.KEYWORD))break;if(this._matches(O.OPERATOR)&&this.#i.precedence>=e)t=this.#n==="?"?this.#d(t):this.#p(t,this.#i);else break}return t}#l(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this.#r.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(Qc.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#c();for(;(this.#t===O.OPERATOR||this.#t===O.DOT||this.#t===O.GROUPER)&&this.#i.precedence>e.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(t,e.value,r)}#c(){if(this._matches(O.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(O.INTEGER))return this.#C(t);if(this._matches(O.DECIMAL))return this.#w(t)}if(Wc.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#h(),Gn);return this.#r.unary(t,e)}return this.#h()}#d(t){this.#o(O.OPERATOR,"?");let e=this.#s();this.#o(O.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#h(){switch(this.#t){case O.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#r.id(t);throw Xn.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case O.IDENTIFIER:return this.#m();case O.STRING:return this.#x();case O.INTEGER:return this.#C();case O.DECIMAL:return this.#w();case O.GROUPER:return this.#n==="("?this.#y():this.#n==="{"?this.#f():this.#n==="["?this.#u():void 0;case O.COLON:throw new Error('unexpected token ":"');default:return}}#u(){let t=[];do{if(this.#o(),this._matches(O.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"]"),this.#r.list(t)}#f(){let t={};do{if(this.#o(),this._matches(O.GROUPER,"}"))break;let e=this.#n;(this._matches(O.STRING)||this._matches(O.IDENTIFIER))&&this.#o(),this.#o(O.COLON),t[e]=this.#s()}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"}"),this.#r.map(t)}#m(){let t=this.#n;if(t==="true")return this.#o(),this.#r.literal(!0);if(t==="false")return this.#o(),this.#r.literal(!1);if(t==="null")return this.#o(),this.#r.literal(null);if(t==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#b(),r=this.#g();return r?this.#r.invoke(e,void 0,r):e}#b(){if(!this._matches(O.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let t=this.#n;return this.#o(),this.#r.id(t)}#g(){if(!this._matches(O.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(O.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(O.COMMA));return this.#o(O.GROUPER,")"),t}#v(){this.#o();let t=this.#s();return this.#o(O.GROUPER,"]"),t}#y(){let t=this.#g();if(this._matches(O.ARROW)){this.#o();let e=this.#s(),r=t?.map(i=>i.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#x(){let t=this.#r.literal(this.#n);return this.#o(),t}#C(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#w(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:Gc,fromEntries:Fu}=Object,zu={"+":(o,t)=>o+t,"-":(o,t)=>o-t,"*":(o,t)=>o*t,"/":(o,t)=>o/t,"%":(o,t)=>o%t,"==":(o,t)=>o==t,"!=":(o,t)=>o!=t,"===":(o,t)=>o===t,"!==":(o,t)=>o!==t,">":(o,t)=>o>t,">=":(o,t)=>o>=t,"<":(o,t)=>o<t,"<=":(o,t)=>o<=t,"||":(o,t)=>o||t,"&&":(o,t)=>o&&t,"??":(o,t)=>o??t,"|":(o,t)=>t(o),"|>":(o,t)=>t(o)},Bu={"+":o=>o,"-":o=>-o,"!":o=>!o},Yn=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let r=Bu[t];return{type:"Unary",operator:t,child:e,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,r){let i=zu[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(n){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(n),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),l=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,l=this.left.value),a===void 0?void 0:a[l]=s}return i(this.left.evaluate(n),this.right.evaluate(n))},getIds(n){return this.left.getIds(n),this.right.getIds(n),n}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let n=this.receiver.evaluate(i),s=this.method?n:i?.this??i,a=this.method?n?.[e]:n,c=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,c)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(n=>n?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let n=this.entries[i];n&&(r[i]=n.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,n=this.body;return function(...s){let a=Fu(i.map((c,d)=>[c,s[d]])),l=new Proxy(r??{},{set(c,d,h){return Gc(a,d)&&(a[d]=h),c[d]=h},get(c,d){return Gc(a,d)?a[d]:c[d]}});return n.evaluate(l)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var Ba=null,Jc={boundAttributeSuffix:et.M,marker:et.P,markerMatch:et.A,HTML_RESULT:et.C,getTemplateHtml:et.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){Ba??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Ba))return void(e[Ba]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let r=it;return o.j=i=>r=i,o._$AI(t,o,e),r},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:et.V,AttributePart:et.H,PropertyPart:et.B,BooleanAttributePart:et.N,EventPart:et.U,ElementPart:et.F,TemplateInstance:et.R,isIterable:et.D,ChildPart:et.I};var{AttributePart:Uu,PropertyPart:Hu,BooleanAttributePart:Wu,EventPart:Qu}=Jc,Ha=new Yn,Ua=new Map,Yc=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),Kn=(o,t)=>{let e=Ua.get(o);if(e===void 0){if(Ua.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new Ni(r,Ha).parse(),Ua.set(o,e)}}return e?.evaluate(t)},Xu=(o,t,e,r)=>{let i=o.getAttribute("if");if(i!==null&&Kn(i,t))return Zn(o,t,e,r)},Kc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Zc=o=>/(?:\\{{)|(?:\\}})/g.test(o),Li=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Gu=(o,t,e,r)=>{let i=o.getAttribute("repeat");if(i!==null){let n=Kn(i,t);if(!n[Symbol.iterator])return P;let s=Vi(o),a=-1,l=[];for(let c of n){a++;let d=Object.create(t);d.item=c,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let y=m.update(d,e,r);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};l.push(f)}return l}},ed={if:Xu,repeat:Gu},rd=(o,t=ed,e={},r)=>{let n=Vi(o).renderers;if(r){let a=Vi(r).renderers,l=n.super;l!==void 0?e={...n,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,y)=>Zn(r,f,m,y)},l(c,d,h))}:(e={...a,...n,...e},o=r)}else e={...n,...e};return s=>Zn(o,s,t,e)};var Zn=(o,t,e=ed,r={})=>{let i=Vi(o),n=[];for(let a of i.parts){let l=a.update(t,e,r);a.type===1?n.push(...l):n.push(l)}return{_$litType$:i,values:n}},td=new Map,Vi=o=>{let t=td.get(o);return t===void 0&&td.set(o,t=Ju(o)),t},Ju=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,n=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)i++;else if(r.nodeType===Node.ELEMENT_NODE){i++;let s=r;if(s.tagName==="TEMPLATE"){let l=s.getAttribute("type"),c=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||l!==null||c!==null){s.parentNode.insertBefore(document.createComment(""),s),n.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:Kn(g,y);return(m?Kn(f,y):u[d])?.(b,x,u)}}else l!==null?h=(f,m,y)=>{let x=m[l];return x?.(s,f,m,y)}:(c==="super"?t.renderers.super=(f,m,y)=>{let x=y.super,u=Vi(s);return y={...y,...u.renderers},x(f,m,y)}:t.renderers[c]=(f,m,y)=>Zn(s,f,m,y),h=(f,m,y)=>{let x=y[c];return x?.(f,m,y)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(Kc);if(d.length===1){Zc(c)&&s.setAttribute(l,Li(c));continue}s.removeAttribute(l);let h=l,f=Uu,m=l[0];m==="."?(h=Yc(l.substring(1)),f=Hu):m==="?"?(h=l.substring(1),f=Wu):m==="@"&&(h=Yc(l.substring(1)),f=Qu);let y=[Li(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(za(g,Ha)),y.push(Li(d[u+1]))}t.parts.push({type:1,index:i,name:h,strings:y,ctor:f,update:(u,g,b)=>x.map(q=>q.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,l=a.split(Kc);l.length>1?s.textContent=Li(l[0]):Zc(a)&&(s.textContent=Li(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=za(d,Ha);t.parts.push({type:2,index:++i,update:(m,y)=>h.evaluate(m)});let f=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of n)s.remove();return t};var Wa=Symbol.for("qti-components.context-root"),Yu=()=>{if(typeof document>"u")return;let o=globalThis;o[Wa]||(o[Wa]=new Di,o[Wa].attach(document.documentElement))};Yu();var id=[];var Xa=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#r():queueMicrotask(()=>this.#r())}#r(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},Qa="custom-state-support-probe";function Ku(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(Qa)||customElements.define(Qa,class extends HTMLElement{});let t=o.call(document.createElement(Qa)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var nd=!1;function od(){if(nd)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Ku(o);return t==="modern"||(nd=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new Xa(this)}),r}),t}od();for(let{tag:o,ctor:t}of id)customElements.get(o)||customElements.define(o,t);var ke=Symbol("computedItemContext");var lt=Symbol("computedContext");var yt=Symbol("configContext");var Rr=Symbol("interactionContext");var j=Symbol("item");var sd=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Zu=/^[A-Za-z0-9-]+$/,tm=o=>typeof o=="string"&&Zu.test(o),Uv=o=>tm(o)?o:void 0,qt=Symbol("qtiContext");var Ga={view:"candidate"},to=Symbol("sessionContext");var Ja={items:[],testOutcomeVariables:[]},nt=Symbol("testContext");var M=w`
|
|
1
|
+
var bc=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Bt=function(o,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(o,e):i?i.value=e:t.set(o,e),e},tt=function(o,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(o):r?r.value:t.get(o)},_r,Pn,On,qi,ka,xi,Dn,Ke,wi,we,$n,vc;var W={__proto__:null};W.enumerable=!0;Object.freeze(W);var Ea=(we=class{constructor(t,e={}){if(_r.set(this,!1),Pn.set(this,!1),On.set(this,!1),qi.set(this,!1),ka.set(this,Date.now()),xi.set(this,!1),Dn.set(this,void 0),Ke.set(this,void 0),wi.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:n}=e;Bt(this,_r,!!i,"f"),Bt(this,Pn,!!r,"f"),Bt(this,On,!!n,"f"),Bt(this,Dn,`${t}`,"f"),Bt(this,Ke,null,"f"),Bt(this,wi,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Bt(this,qi,!0,"f")}get target(){return tt(this,Ke,"f")}get currentTarget(){return tt(this,Ke,"f")}get srcElement(){return tt(this,Ke,"f")}get type(){return tt(this,Dn,"f")}get cancelable(){return tt(this,_r,"f")}get defaultPrevented(){return tt(this,_r,"f")&&tt(this,qi,"f")}get timeStamp(){return tt(this,ka,"f")}composedPath(){return tt(this,wi,"f")?[tt(this,Ke,"f")]:[]}get returnValue(){return!tt(this,_r,"f")||!tt(this,qi,"f")}get bubbles(){return tt(this,Pn,"f")}get composed(){return tt(this,On,"f")}get eventPhase(){return tt(this,wi,"f")?we.AT_TARGET:we.NONE}get cancelBubble(){return tt(this,xi,"f")}set cancelBubble(t){t&&Bt(this,xi,!0,"f")}stopPropagation(){Bt(this,xi,!0,"f")}get isTrusted(){return!1}},_r=new WeakMap,Pn=new WeakMap,On=new WeakMap,qi=new WeakMap,ka=new WeakMap,xi=new WeakMap,Dn=new WeakMap,Ke=new WeakMap,wi=new WeakMap,we.NONE=0,we.CAPTURING_PHASE=1,we.AT_TARGET=2,we.BUBBLING_PHASE=3,we);Object.defineProperties(Ea.prototype,{initEvent:W,stopImmediatePropagation:W,preventDefault:W,target:W,currentTarget:W,srcElement:W,type:W,cancelable:W,defaultPrevented:W,timeStamp:W,composedPath:W,returnValue:W,bubbles:W,composed:W,eventPhase:W,cancelBubble:W,stopPropagation:W,isTrusted:W});var yc=(vc=class extends Ea{constructor(t,e={}){super(t,e),$n.set(this,void 0),Bt(this,$n,e?.detail??null,"f")}initCustomEvent(t,e,r,i){throw new Error("Method not implemented.")}get detail(){return tt(this,$n,"f")}},$n=new WeakMap,vc);Object.defineProperties(yc.prototype,{detail:W});var ne=Ea,Sa=yc;var ot;var wg=(ot=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},ot.STYLE_RULE=1,ot.CHARSET_RULE=2,ot.IMPORT_RULE=3,ot.MEDIA_RULE=4,ot.FONT_FACE_RULE=5,ot.PAGE_RULE=6,ot.NAMESPACE_RULE=10,ot.KEYFRAMES_RULE=7,ot.KEYFRAME_RULE=8,ot.SUPPORTS_RULE=12,ot.COUNTER_STYLE_RULE=11,ot.FONT_FEATURE_VALUES_RULE=14,ot.MARGIN_RULE=9,ot);globalThis.Event??=ne;globalThis.CustomEvent??=Sa;var _a=Symbol(),qc=o=>typeof o=="boolean"?o:o?.capture??!1,oe={__proto__:null};oe.enumerable=!0;Object.freeze(oe);var Nn=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let i=qc(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);if(n===void 0)n=new Map,i.set(t,n);else if(n.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),n.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let i=qc(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);n!==void 0&&(n.delete(e),n.size||i.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,i=!1,n=ne.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...oe},srcElement:{get(){return t.target},...oe},currentTarget:{get(){return l},...oe},eventPhase:{get(){return n},...oe},composedPath:{value:()=>e,...oe},stopPropagation:{value:()=>{r=!0,c.call(t)},...oe},stopImmediatePropagation:{value:()=>{i=!0,d.call(t)},...oe}});let h=(u,g,b)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&b.delete(u)},f=()=>(l=null,n=ne.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),l=u,n=u===t.target?ne.AT_TARGET:ne.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&y(x.slice(0,x.indexOf(u)+1)),l=u,n=u===t.target?ne.AT_TARGET:ne.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,Cc,yu]}};var xc=new WeakMap,Ci=o=>{let t=xc.get(o);return t===void 0&&xc.set(o,t=new Map),t},ki=class extends Nn{getRootNode(t){return t?.composed?Aa:this.__host?.__shadowRoot??Aa}};var wc=class extends ki{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var Cc=new wc,Aa=Cc;var kc=class extends ki{constructor(t){if(super(),t!==_a)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Ln,customElements:Ia,document:Aa,Document:wc,Element:Ec,EventTarget:Nn,HTMLElement:Sc,Node:ki,ShadowRoot:Ac,window:this,Window:kc})}};var Ec=class extends ki{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Ci(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){Ci(this).set(t,String(e))}removeAttribute(t){Ci(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return Ci(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Ac(_a,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new bc(this);return this.__internals=t,t}getAttribute(t){return Ci(this).get(t)??null}};var Sc=class extends Ec{},Ta=Sc;var Ac=class extends ki{get host(){return this.__host}constructor(t,e){if(super(),t!==t)throw new TypeError("Illegal constructor");this.mode=e.mode}};globalThis.litServerRoot??=Object.defineProperty(new Ta,"localName",{get(){return"lit-server-root"}});function bu(){let o,t;return{promise:new Promise((r,i)=>{o=r,t=i}),resolve:o,reject:t}}var Ln=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
+
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let r=this.__pendingWhenDefineds.get(t);return r||(r=bu(),this.__pendingWhenDefineds.set(t,r)),r.promise}},vu=Ln;var Ia=new vu,yu=new kc(_a);var Ei=globalThis,Vn=Ei.ShadowRoot&&(Ei.ShadyCSS===void 0||Ei.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ra=Symbol(),_c=new WeakMap,Si=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Ra)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Vn&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=_c.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&_c.set(e,t))}return t}toString(){return this.cssText}},Tc=o=>new Si(typeof o=="string"?o:o+"",void 0,Ra),w=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,i,n)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[n+1],o[0]);return new Si(e,o,Ra)},Ic=(o,t)=>{if(Vn)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Ei.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,o.appendChild(r)}},Ma=Vn||Ei.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Tc(e)})(o):o;var{is:qu,defineProperty:xu,getOwnPropertyDescriptor:wu,getOwnPropertyNames:Cu,getOwnPropertySymbols:ku,getPrototypeOf:Eu}=Object,Ti=globalThis;Ti.customElements??=Ia;var Rc=Ti.trustedTypes,Su=Rc?Rc.emptyScript:"",Au=Ti.reactiveElementPolyfillSupport,Ai=(o,t)=>o,_i={toAttribute(o,t){switch(t){case Boolean:o=o?Su:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},jn=(o,t)=>!qu(o,t),Mc={attribute:!0,type:String,converter:_i,reflect:!1,useDefault:!1,hasChanged:jn};Symbol.metadata??=Symbol("metadata"),Ti.litPropertyMetadata??=new WeakMap;var se=class extends(globalThis.HTMLElement??Ta){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Mc){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&xu(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:n}=wu(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:i,set(s){let a=i?.call(this);n?.call(this,s),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Mc}static _$Ei(){if(this.hasOwnProperty(Ai("elementProperties")))return;let t=Eu(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Ai("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ai("properties"))){let e=this.properties,r=[...Cu(e),...ku(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(Ma(i))}else t!==void 0&&e.push(Ma(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ic(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:_i).toAttribute(e,r.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let n=r.getPropertyOptions(i),s=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:_i;this._$Em=i;let a=s.fromAttribute(e,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(t,e,r,i=!1,n){if(t!==void 0){let s=this.constructor;if(i===!1&&(n=this[t]),r??=s.getPropertyOptions(t),!((r.hasChanged??jn)(n,e)||r.useDefault&&r.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:i,wrapped:n},s){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),n!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,n]of r){let{wrapped:s}=n,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};se.elementStyles=[],se.shadowRootOptions={mode:"open"},se[Ai("elementProperties")]=new Map,se[Ai("finalized")]=new Map,Au?.({ReactiveElement:se}),(Ti.reactiveElementVersions??=[]).push("2.1.2");var Qn=globalThis,Pc=o=>o,Fn=Qn.trustedTypes,Oc=Fn?Fn.createPolicy("lit-html",{createHTML:o=>o}):void 0,Oa="$lit$",ae=`lit$${Math.random().toFixed(9).slice(2)}$`,Da="?"+ae,_u=`<${Da}>`,er=Qn.document===void 0?{createTreeWalker:()=>({})}:document,Ri=()=>er.createComment(""),Mi=o=>o===null||typeof o!="object"&&typeof o!="function",$a=Array.isArray,jc=o=>$a(o)||typeof o?.[Symbol.iterator]=="function",Pa=`[
|
|
3
|
+
\f\r]`,Ii=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Dc=/-->/g,$c=/>/g,Ze=RegExp(`>|${Pa}(?:([^\\s"'>=/]+)(${Pa}*=${Pa}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Nc=/'/g,Lc=/"/g,Fc=/^(?:script|style|textarea|title)$/i,Na=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=Na(1),Oi=Na(2),eb=Na(3),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Vc=new WeakMap,tr=er.createTreeWalker(er,129);function zc(o,t){if(!$a(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Oc!==void 0?Oc.createHTML(t):t}var Bc=(o,t)=>{let e=o.length-1,r=[],i,n=t===2?"<svg>":t===3?"<math>":"",s=Ii;for(let a=0;a<e;a++){let l=o[a],c,d,h=-1,f=0;for(;f<l.length&&(s.lastIndex=f,d=s.exec(l),d!==null);)f=s.lastIndex,s===Ii?d[1]==="!--"?s=Dc:d[1]!==void 0?s=$c:d[2]!==void 0?(Fc.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=Ze):d[3]!==void 0&&(s=Ze):s===Ze?d[0]===">"?(s=i??Ii,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?Ze:d[3]==='"'?Lc:Nc):s===Lc||s===Nc?s=Ze:s===Dc||s===$c?s=Ii:(s=Ze,i=void 0);let m=s===Ze&&o[a+1].startsWith("/>")?" ":"";n+=s===Ii?l+_u:h>=0?(r.push(c),l.slice(0,h)+Oa+l.slice(h)+ae+m):l+ae+(h===-2?a:m)}return[zc(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Pi=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,s=0,a=t.length-1,l=this.parts,[c,d]=Bc(t,e);if(this.el=o.createElement(c,r),tr.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=tr.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Oa)){let f=d[s++],m=i.getAttribute(h).split(ae),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?Bn:y[1]==="?"?Un:y[1]==="@"?Hn:ir}),i.removeAttribute(h)}else h.startsWith(ae)&&(l.push({type:6,index:n}),i.removeAttribute(h));if(Fc.test(i.tagName)){let h=i.textContent.split(ae),f=h.length-1;if(f>0){i.textContent=Fn?Fn.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],Ri()),tr.nextNode(),l.push({type:2,index:++n});i.append(h[f],Ri())}}}else if(i.nodeType===8)if(i.data===Da)l.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(ae,h+1))!==-1;)l.push({type:7,index:n}),h+=ae.length-1}n++}}static createElement(t,e){let r=er.createElement("template");return r.innerHTML=t,r}};function rr(o,t,e=o,r){if(t===it)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,n=Mi(t)?void 0:t._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(o),i._$AT(o,e,r)),r!==void 0?(e._$Co??=[])[r]=i:e._$Cl=i),i!==void 0&&(t=rr(o,i._$AS(o,t.values),i,r)),t}var zn=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??er).importNode(e,!0);tr.currentNode=i;let n=tr.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Tr(n,n.nextSibling,this,t):l.type===1?c=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(c=new Wn(n,this,t)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(n=tr.nextNode(),s++)}return tr.currentNode=er,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},Tr=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=rr(this,t,e),Mi(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):jc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==P&&Mi(this._$AH)?this._$AA.nextSibling.data=t:this.T(er.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Pi.createElement(zc(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new zn(i,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(t){let e=Vc.get(t.strings);return e===void 0&&Vc.set(t.strings,e=new Pi(t)),e}k(t){$a(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let n of t)i===e.length?e.push(r=new o(this.O(Ri()),this.O(Ri()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=Pc(t).nextSibling;Pc(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},ir=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,n){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(t,e=this,r,i){let n=this.strings,s=!1;if(n===void 0)t=rr(this,t,e,0),s=!Mi(t)||t!==this._$AH&&t!==it,s&&(this._$AH=t);else{let a=t,l,c;for(t=n[0],l=0;l<n.length-1;l++)c=rr(this,a[r+l],e,l),c===it&&(c=this._$AH[l]),s||=!Mi(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+n[l+1]),this._$AH[l]=c}s&&!i&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Bn=class extends ir{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Un=class extends ir{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Hn=class extends ir{constructor(t,e,r,i,n){super(t,e,r,i,n),this.type=5}_$AI(t,e=this){if((t=rr(this,t,e,0)??P)===it)return;let r=this._$AH,i=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Wn=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){rr(this,t)}},et={M:Oa,P:ae,A:Da,C:1,L:Bc,R:zn,D:jc,V:rr,I:Tr,H:ir,N:Un,U:Hn,B:Bn,F:Wn},Tu=Qn.litHtmlPolyfillSupport;Tu?.(Pi,Tr),(Qn.litHtmlVersions??=[]).push("3.3.3");var La=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let n=e?.renderBefore??null;r._$litPart$=i=new Tr(t.insertBefore(Ri(),n),n,void 0,e??{})}return i._$AI(o),i};var Va=globalThis,E=class extends se{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=La(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};E._$litElement$=!0,E.finalized=!0,Va.litElementHydrateSupport?.({LitElement:E});var Iu=Va.litElementPolyfillSupport;Iu?.({LitElement:E});(Va.litElementVersions??=[]).push("4.2.2");var Ru={attribute:!0,type:String,converter:_i,reflect:!1,hasChanged:jn},Mu=(o=Ru,t,e)=>{let{kind:r,metadata:i}=e,n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),r==="setter"&&((o=Object.create(o)).wrapped=!0),n.set(e.name,o),r==="accessor"){let{name:s}=e;return{set(a){let l=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,l,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,o,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(o){return(t,e)=>typeof e=="object"?Mu(o,t,e):((r,i,n)=>{let s=i.hasOwnProperty(n);return i.constructor.createProperty(n,r),s?Object.getOwnPropertyDescriptor(i,n):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var Ce=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Ir(o,t){return(e,r,i)=>{let n=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return Ce(e,r,{get(){let l=s.call(this);return l===void 0&&(l=n(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return Ce(e,r,{get(){return n(this)}})}}function Uc(o){return(t,e)=>{let{slot:r,selector:i}=o??{},n="slot"+(r?`[name=${r}]`:":not([name])");return Ce(t,e,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(o)??[];return i===void 0?a:a.filter(l=>l.matches(i))}})}}var le=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var at=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new le(this.context,this.host,this.t,this.subscribe))}};var Xn=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var ja=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},Ut=class extends Xn{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let n=i.contextTarget??i.composedPath()[0];n!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,n,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let n=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)n.has(s)||(n.add(s),a.dispatchEvent(new le(this.context,a,s,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new ja(this.context,this.host))}};var Di=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:r}=e;for(let{elementRef:i,callbackRef:n}of r){let s=i.deref(),a=n.deref();s===void 0||a===void 0||s.dispatchEvent(new le(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],r=t.callback,i=this.pendingContextRequests.get(t.context);i===void 0&&this.pendingContextRequests.set(t.context,i={callbacks:new WeakMap,requests:[]});let n=i.callbacks.get(e);n===void 0&&i.callbacks.set(e,n=new WeakSet),n.has(r)||(n.add(r),i.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(r)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function Q({context:o}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return r.get(this).setValue(i),t.set.call(this,i)},init(i){return r.set(this,new Ut(this,{context:o,initialValue:i})),i}};{t.constructor.addInitializer((s=>{r.set(s,new Ut(s,{context:o}))}));let i=Object.getOwnPropertyDescriptor(t,e),n;if(i===void 0){let s=new WeakMap;n={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;n={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}function I({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new at(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new at(i,{context:o,callback:n=>{i[r]=n},subscribe:t})}))}}var Gn=["this"],Hc=["+","-","!"],Wc=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Fa={"!":0,":":0,",":0,")":0,"]":0,"}":0,"|>":1,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"{":13},Jn=13;var Pu=["==","!=","<=",">=","||","&&","??","|>"],Ou=["===","!=="],O;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(O||(O={}));var Ht=(o,t,e=0)=>({kind:o,value:t,precedence:e}),Du=o=>o===9||o===10||o===13||o===32,Qc=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),$u=o=>Qc(o)||$i(o),Nu=o=>Gn.indexOf(o)!==-1,Lu=o=>o===34||o===39,$i=o=>48<=o&&o<=57,Vu=o=>o===43||o===45||o===42||o===47||o===33||o===38||o===37||o===60||o===61||o===62||o===63||o===94||o===124,ju=o=>o===40||o===41||o===91||o===93||o===123||o===125,Fu=o=>o.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
|
|
5
|
+
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Yn=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;Du(this.#i);)this.#n(!0);if(Lu(this.#i))return this.#a();if(Qc(this.#i))return this.#l();if($i(this.#i))return this.#p();if(this.#i===46)return this.#c();if(this.#i===44)return this.#d();if(this.#i===58)return this.#h();if(Vu(this.#i))return this.#f();if(ju(this.#i))return this.#m();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(t);this.#n()}let r=Ht(O.STRING,Fu(this.#o()));return this.#n(),r}#l(){do this.#n();while($u(this.#i));let t=this.#o(),e=Nu(t)?O.KEYWORD:O.IDENTIFIER;return Ht(e,t)}#p(){do this.#n();while($i(this.#i));return this.#i===46?this.#c():Ht(O.INTEGER,this.#o())}#c(){return this.#n(),$i(this.#i)?this.#u():(this.#s(),Ht(O.DOT,".",Jn))}#d(){return this.#n(!0),Ht(O.COMMA,",")}#h(){return this.#n(!0),Ht(O.COLON,":")}#u(){do this.#n();while($i(this.#i));return Ht(O.DECIMAL,this.#o())}#f(){this.#n();let t=this.#o(2);if(Ou.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Ht(O.ARROW,t);Pu.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Ht(O.OPERATOR,t,Fa[t])}#m(){let t=String.fromCharCode(this.#i),e=Ht(O.GROUPER,t,Fa[t]);return this.#n(!0),e}};var za=(o,t)=>new Ni(o,t).parse(),Ni=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new Yn(t),this.#r=e}parse(){return this.#o(),this.#s()}#o(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let r=this.#e.nextToken();this.#i=r,this.#t=r?.kind,this.#n=r?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#n!==e)}#s(){if(!this.#i)return this.#r.empty();let t=this.#c();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(O.GROUPER,"(")){let r=this.#g();t=this.#r.invoke(t,void 0,r)}else if(this._matches(O.GROUPER,"[")){let r=this.#v();t=this.#r.index(t,r)}else if(this._matches(O.DOT)){this.#o();let r=this.#c();t=this.#l(t,r)}else{if(this._matches(O.KEYWORD))break;if(this._matches(O.OPERATOR)&&this.#i.precedence>=e)t=this.#n==="?"?this.#d(t):this.#p(t,this.#i);else break}return t}#l(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this.#r.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(Wc.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#c();for(;(this.#t===O.OPERATOR||this.#t===O.DOT||this.#t===O.GROUPER)&&this.#i.precedence>e.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(t,e.value,r)}#c(){if(this._matches(O.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(O.INTEGER))return this.#C(t);if(this._matches(O.DECIMAL))return this.#w(t)}if(Hc.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#h(),Jn);return this.#r.unary(t,e)}return this.#h()}#d(t){this.#o(O.OPERATOR,"?");let e=this.#s();this.#o(O.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#h(){switch(this.#t){case O.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#r.id(t);throw Gn.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case O.IDENTIFIER:return this.#m();case O.STRING:return this.#x();case O.INTEGER:return this.#C();case O.DECIMAL:return this.#w();case O.GROUPER:return this.#n==="("?this.#y():this.#n==="{"?this.#f():this.#n==="["?this.#u():void 0;case O.COLON:throw new Error('unexpected token ":"');default:return}}#u(){let t=[];do{if(this.#o(),this._matches(O.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"]"),this.#r.list(t)}#f(){let t={};do{if(this.#o(),this._matches(O.GROUPER,"}"))break;let e=this.#n;(this._matches(O.STRING)||this._matches(O.IDENTIFIER))&&this.#o(),this.#o(O.COLON),t[e]=this.#s()}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"}"),this.#r.map(t)}#m(){let t=this.#n;if(t==="true")return this.#o(),this.#r.literal(!0);if(t==="false")return this.#o(),this.#r.literal(!1);if(t==="null")return this.#o(),this.#r.literal(null);if(t==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#b(),r=this.#g();return r?this.#r.invoke(e,void 0,r):e}#b(){if(!this._matches(O.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let t=this.#n;return this.#o(),this.#r.id(t)}#g(){if(!this._matches(O.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(O.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(O.COMMA));return this.#o(O.GROUPER,")"),t}#v(){this.#o();let t=this.#s();return this.#o(O.GROUPER,"]"),t}#y(){let t=this.#g();if(this._matches(O.ARROW)){this.#o();let e=this.#s(),r=t?.map(i=>i.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#x(){let t=this.#r.literal(this.#n);return this.#o(),t}#C(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#w(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:Xc,fromEntries:zu}=Object,Bu={"+":(o,t)=>o+t,"-":(o,t)=>o-t,"*":(o,t)=>o*t,"/":(o,t)=>o/t,"%":(o,t)=>o%t,"==":(o,t)=>o==t,"!=":(o,t)=>o!=t,"===":(o,t)=>o===t,"!==":(o,t)=>o!==t,">":(o,t)=>o>t,">=":(o,t)=>o>=t,"<":(o,t)=>o<t,"<=":(o,t)=>o<=t,"||":(o,t)=>o||t,"&&":(o,t)=>o&&t,"??":(o,t)=>o??t,"|":(o,t)=>t(o),"|>":(o,t)=>t(o)},Uu={"+":o=>o,"-":o=>-o,"!":o=>!o},Kn=class{empty(){return{type:"Empty",evaluate(t){return t},getIds(t){return t}}}literal(t){return{type:"Literal",value:t,evaluate(e){return this.value},getIds(e){return e}}}id(t){return{type:"ID",value:t,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(t,e){let r=Uu[t];return{type:"Unary",operator:t,child:e,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,r){let i=Bu[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(n){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(n),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),l=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,l=this.left.value),a===void 0?void 0:a[l]=s}return i(this.left.evaluate(n),this.right.evaluate(n))},getIds(n){return this.left.getIds(n),this.right.getIds(n),n}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let n=this.receiver.evaluate(i),s=this.method?n:i?.this??i,a=this.method?n?.[e]:n,c=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,c)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(n=>n?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let n=this.entries[i];n&&(r[i]=n.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,n=this.body;return function(...s){let a=zu(i.map((c,d)=>[c,s[d]])),l=new Proxy(r??{},{set(c,d,h){return Xc(a,d)&&(a[d]=h),c[d]=h},get(c,d){return Xc(a,d)?a[d]:c[d]}});return n.evaluate(l)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var Ba=null,Gc={boundAttributeSuffix:et.M,marker:et.P,markerMatch:et.A,HTML_RESULT:et.C,getTemplateHtml:et.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){Ba??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Ba))return void(e[Ba]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let r=it;return o.j=i=>r=i,o._$AI(t,o,e),r},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:et.V,AttributePart:et.H,PropertyPart:et.B,BooleanAttributePart:et.N,EventPart:et.U,ElementPart:et.F,TemplateInstance:et.R,isIterable:et.D,ChildPart:et.I};var{AttributePart:Hu,PropertyPart:Wu,BooleanAttributePart:Qu,EventPart:Xu}=Gc,Ha=new Kn,Ua=new Map,Jc=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),Zn=(o,t)=>{let e=Ua.get(o);if(e===void 0){if(Ua.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new Ni(r,Ha).parse(),Ua.set(o,e)}}return e?.evaluate(t)},Gu=(o,t,e,r)=>{let i=o.getAttribute("if");if(i!==null&&Zn(i,t))return to(o,t,e,r)},Yc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Kc=o=>/(?:\\{{)|(?:\\}})/g.test(o),Li=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Ju=(o,t,e,r)=>{let i=o.getAttribute("repeat");if(i!==null){let n=Zn(i,t);if(!n[Symbol.iterator])return P;let s=Vi(o),a=-1,l=[];for(let c of n){a++;let d=Object.create(t);d.item=c,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let y=m.update(d,e,r);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};l.push(f)}return l}},td={if:Gu,repeat:Ju},ed=(o,t=td,e={},r)=>{let n=Vi(o).renderers;if(r){let a=Vi(r).renderers,l=n.super;l!==void 0?e={...n,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,y)=>to(r,f,m,y)},l(c,d,h))}:(e={...a,...n,...e},o=r)}else e={...n,...e};return s=>to(o,s,t,e)};var to=(o,t,e=td,r={})=>{let i=Vi(o),n=[];for(let a of i.parts){let l=a.update(t,e,r);a.type===1?n.push(...l):n.push(l)}return{_$litType$:i,values:n}},Zc=new Map,Vi=o=>{let t=Zc.get(o);return t===void 0&&Zc.set(o,t=Yu(o)),t},Yu=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,n=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)i++;else if(r.nodeType===Node.ELEMENT_NODE){i++;let s=r;if(s.tagName==="TEMPLATE"){let l=s.getAttribute("type"),c=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||l!==null||c!==null){s.parentNode.insertBefore(document.createComment(""),s),n.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:Zn(g,y);return(m?Zn(f,y):u[d])?.(b,x,u)}}else l!==null?h=(f,m,y)=>{let x=m[l];return x?.(s,f,m,y)}:(c==="super"?t.renderers.super=(f,m,y)=>{let x=y.super,u=Vi(s);return y={...y,...u.renderers},x(f,m,y)}:t.renderers[c]=(f,m,y)=>to(s,f,m,y),h=(f,m,y)=>{let x=y[c];return x?.(f,m,y)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(Yc);if(d.length===1){Kc(c)&&s.setAttribute(l,Li(c));continue}s.removeAttribute(l);let h=l,f=Hu,m=l[0];m==="."?(h=Jc(l.substring(1)),f=Wu):m==="?"?(h=l.substring(1),f=Qu):m==="@"&&(h=Jc(l.substring(1)),f=Xu);let y=[Li(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(za(g,Ha)),y.push(Li(d[u+1]))}t.parts.push({type:1,index:i,name:h,strings:y,ctor:f,update:(u,g,b)=>x.map(q=>q.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,l=a.split(Yc);l.length>1?s.textContent=Li(l[0]):Kc(a)&&(s.textContent=Li(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=za(d,Ha);t.parts.push({type:2,index:++i,update:(m,y)=>h.evaluate(m)});let f=new Text(l[c+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of n)s.remove();return t};var Wa=Symbol.for("qti-components.context-root"),Ku=()=>{if(typeof document>"u")return;let o=globalThis;o[Wa]||(o[Wa]=new Di,o[Wa].attach(document.documentElement))};Ku();var rd=[];var Xa=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#r():queueMicrotask(()=>this.#r())}#r(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},Qa="custom-state-support-probe";function Zu(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(Qa)||customElements.define(Qa,class extends HTMLElement{});let t=o.call(document.createElement(Qa)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var id=!1;function nd(){if(id)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Zu(o);return t==="modern"||(id=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new Xa(this)}),r}),t}nd();for(let{tag:o,ctor:t}of rd)customElements.get(o)||customElements.define(o,t);var ke=Symbol("computedItemContext");var lt=Symbol("computedContext");var yt=Symbol("configContext");var Rr=Symbol("interactionContext");var j=Symbol("item");var od=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var tm=/^[A-Za-z0-9-]+$/,em=o=>typeof o=="string"&&tm.test(o),Qv=o=>em(o)?o:void 0,qt=Symbol("qtiContext");var Ga={view:"candidate"},eo=Symbol("sessionContext");var Ja={items:[],testOutcomeVariables:[]},nt=Symbol("testContext");var M=w`
|
|
6
6
|
:host {
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
@@ -56,23 +56,23 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
56
56
|
[part~='message'] {
|
|
57
57
|
display: none;
|
|
58
58
|
}
|
|
59
|
-
`;var
|
|
59
|
+
`;var sd={chip:["drag"],drop:["droppable"],lifted:["dragging"],used:["placeholder"],"return-target":["return-anchor"],"drag-over":["hover"],"candidate-partial":["candidate-partially-correct"]};function z(o,t,e,r){if(!o)return;let i=[t,...r??sd[t]??[]];for(let n of i)e?o.add(n):o.delete(n)}function ji(o,t){return o?o.has(t)?!0:(sd[t]??[]).some(e=>o.has(e)):!1}var Mr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},D=class extends E{#t;get _context(){return this.#t.value}#e;#r;#i(t){t?.readonly!==void 0&&t.readonly!==this.#e&&(this.#e=t.readonly,this.readonly=t.readonly),t?.disabled!==void 0&&t.disabled!==this.#r&&(this.#r=t.disabled,this.disabled=t.disabled),this.#a(t)}#n;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),r=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!r)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let i=this.#n===void 0,n=JSON.stringify(r.value??null);n!==this.#n&&(this.#n=n,!(i&&(r.value===null||r.value===void 0))&&n!==this.#o&&(this.#o=n,this.response=r.value))}#l;static{this.formAssociated=!0}get internals(){return this._internals}get registersWithItem(){return!0}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let t=this._context.variables.filter(r=>r.type==="response"),e=this.getAttribute("response-identifier");return t.find(r=>r.identifier===e)}get value(){return JSON.stringify(this.response)}set value(t){this.response=t?JSON.parse(t):null}resetValidityReport(){this._validityReported=!1,this.clearInlineValidationMessage()}reportValidity(t){let e=t?.trigger??"submit";e==="submit"&&this.validate?.();let r=this._internals.validity.valid,i=this.validationDisplayMode;if(e==="submit"&&(this._validityReported=!0),e==="change"&&!this._validityReported&&this._validityKind==="min")return this.clearInlineValidationMessage(),r;if(i==="native"||i==="both"){this._reportingNatively=!0;try{this._internals.reportValidity()}finally{this._reportingNatively=!1}}return i==="inline"||i==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),i==="none"&&this.clearInlineValidationMessage(),r}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(t){let e=t?.defaultWhenUnset??!0,r=this.configContext;return r&&r.allowReorder!==void 0?r.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,r=this.configContext;return r?r.disableAfterMaxReached!==void 0?r.disableAfterMaxReached:r.disableAfterIfMaxChoicesReached!==void 0?(this.#l||(this.#l=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),r.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",r,i){let n=r??this;this._internals.setValidity(t?{}:{customError:!0},e,n),this._validityKind=t?void 0:i?.kind??"other",i?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.resetValidityReport(),this.response=null}formResetCallback(){this.resetValidityReport(),this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}update(t){let e=!this.hasUpdated;if(super.update(t),e){let r=()=>this.isConnected&&this.validate();this.updateComplete.then(r),requestAnimationFrame(()=>requestAnimationFrame(r))}t.has("disabled")&&z(this._internals.states,"disabled",this.disabled),t.has("readonly")&&z(this._internals.states,"readonly",this.readonly)}constructor(){super(),this.#t=new at(this,{context:j,subscribe:!0,callback:t=>this.#i(t)}),this.#s=!1,this.#l=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._validityReported=!1,this._reportingNatively=!1,this._internals=this.attachInternals(),this.addEventListener("invalid",()=>{this._reportingNatively||(this._validityReported=!0,(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage())}),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Mr([I({context:yt,subscribe:!0})],D.prototype,"configContext",void 0);Mr([Q({context:Rr})],D.prototype,"_interactionContext",void 0);Mr([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Mr([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Mr([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Mr([p({type:String})],D.prototype,"name",void 0);var Pr=class extends E{render(){return v`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(i=>i.innerHTML.trim());return r.length>1||t==="multiple"||t==="ordered"?r:r[0]}};var Ka=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ya=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??ad(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??ad(o),value:String(o),cardinality:"single",type:"response"},ad=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",rm=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},S=class extends E{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return r==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.resolveVariable(r)}case"qti-multiple":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let i=e.getResult();return i?.length>0?i:null}case"qti-custom-operator":return Ya(e.calculate?.());case"qti-correct":{let r=e.getAttribute("identifier")||"",i=this.context?.variables?.find(n=>n.identifier===r);return i?{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}:(console.warn(`qti-correct: no response declaration for "${r}"`),Ya(null))}default:{try{let r=e,i=r.getResult();return Ya(i,r.resultBaseType??rm(r,i))}catch(r){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,r)}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null);return this.#t=t,t}}#t;get lastResult(){return this.result}get lastVariables(){return this.#t}static{this.styles=w`
|
|
60
60
|
slot {
|
|
61
61
|
display: none;
|
|
62
62
|
}
|
|
63
|
-
`}render(){return v`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(i=>i.identifier===e[0])?.variables?.find(i=>i.identifier===e[e.length-1])??null}};Ka([I({context:j,subscribe:!0})],S.prototype,"context",void 0);Ka([I({context:qt,subscribe:!0})],S.prototype,"qtiContext",void 0);Ka([I({context:nt,subscribe:!0})],S.prototype,"_testContext",void 0);var Qt=class extends S{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var xy=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Mt=o=>typeof o=="string"?o:o.toString();function Za(o){return o==null}function eo(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Fi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ut=class extends E{constructor(){super(...arguments),this.showHide="show",this.#t=new at(this,{context:j,subscribe:!0,callback:t=>this.#r(t)}),this.#i=!1}#t;get _context(){return this.#t.value}#e;#r(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let r=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),i=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,n=this.#e===void 0?i>0:this.#e!==r||i>0;this.#e=r,n&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!Za(this.identifier)&&!Za(e?.value)&&this.identifier===e.value||!1,this.#n(r)}#i;#n(t){let e=this.#s()&&this.#o(t)?"on":"off";if(e==="on"){if(this.showStatus==="on"||this.#i)return;if(!this.feedbackShowing()){this.#i=!0,this.showStatus="off";return}}else if(this.#i=!1,this.showStatus==="on"&&!this.feedbackHiding())return;this.showStatus=e}#o(t){return t&&this.showHide==="show"||!t&&this.showHide==="hide"}feedbackShowing(){return!0}feedbackHiding(){return!0}#s(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(i=>i.active)?.sections.flatMap(i=>i.items).find(i=>i.active);if(!t||t.sessionControl?.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.sessionControl?.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(i=>i.identifier==="numAttempts")?.value)||0)<e}};Fi([p({type:String,attribute:"show-hide"})],ut.prototype,"showHide",void 0);Fi([p({type:String,attribute:"outcome-identifier"})],ut.prototype,"outcomeIdentifier",void 0);Fi([p({type:String})],ut.prototype,"identifier",void 0);Fi([p({type:String,attribute:!1})],ut.prototype,"showStatus",void 0);Fi([I({context:lt,subscribe:!0}),T()],ut.prototype,"_computedContext",void 0);function zi(o){if(o==null)return null;if(!o.includes(",")){let e=o.trim();return e.length>0?e:null}let t=o.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function nr(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(r=>r.trim()).filter(r=>r.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*Iy(o){if(o!=null){if(Array.isArray(o)){for(let t of o){let e=t.trim();e&&(yield e)}return}if(!o.includes(",")){let t=o.trim();t&&(yield t);return}for(let t of o.split(",")){let e=t.trim();e&&(yield e)}}}function Ry(o){let[t,e,...r]=o.trim().split(/\s+/);if(!t||!e||r.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function My(o,t){return`${o} ${t}`}function Py(o){let[t,e,...r]=o.trim().split(/\s+/),i=Number(t),n=Number(e);if(!Number.isFinite(i)||!Number.isFinite(n)||r.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:i,y:n}}function Oy(o,t){return`${o} ${t}`}function Xt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=zi(r);return i===null?t:i},toAttribute:r=>e(r)?null:nr(r)}}var ce=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Bi=o=>{let t={},e={};for(let r of o){let i=r.getAttribute("field-identifier");if(!i)continue;t[i]=r.textContent?.trim()??"";let n=r.getAttribute("base-type");n&&(e[i]=n)}return{value:t,baseTypes:e}},cd=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,ro=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(cd.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(r=>cd.test(r))?"point":"string"};var dd=class extends E{},Or=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Dr=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var rm=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},tl=o=>t=>{let e=rm(t);return e===null?null:o(e)},im=["depcp","questify","qade"],nm={Trim:tl(o=>o.trim()),ToAscii:tl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:tl(o=>o.replace(",","."))},om=new Map(im.flatMap(o=>Object.entries(nm).map(([t,e])=>[`${o}:${t}`,e]))),el=new Map,Vy=(o,t)=>{el.set(o,t)},jy=o=>{el.delete(o)},hd=o=>el.get(o)??om.get(o)??null;var pd={true:!0,1:!0,false:!1,0:!1},Y=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,n]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-c)**2+(n-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=c&&i<=h&&n>=d&&n<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-c)**2/h**2,y=(n-d)**2/f**2;return m+y<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:i,y:n},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let s=e[i].x,a=e[i].y,l=e[n].x,c=e[n].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"boolean":{let i=pd[t.trim().toLowerCase()];return i!==void 0&&i===pd[e.trim().toLowerCase()]}case"integer":{let i=parseInt(t,10),n=parseInt(e,10);if(!isNaN(i)&&!isNaN(n)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:i===n}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),n=parseFloat(e);if(!isNaN(i)&&!isNaN(n))return i===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" "),n=e.split(" ");if(i.length===2&&n.length===2)return r==="pair"&&(i.sort(),n.sort()),i.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Ee=Symbol("testHost");var md={"qc-item-rendered":{kind:"notification",scope:"item",deprecated:"cito-item-rendered"},"qc-item-response-changed":{kind:"notification",scope:"item",deprecated:"cito-item-response-changed"},"qc-item-set-outcomes":{kind:"request",scope:"item",deprecated:"cito-item-set-outcomes"},"qc-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcome-changed"},"qc-item-outcomes-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcomes-changed"},"qc-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"cito-item-rubric-placement"},"qc-feedback-show":{kind:"notification",scope:"item",deprecated:"cito-feedback-show"},"qc-feedback-hide":{kind:"notification",scope:"item",deprecated:"cito-feedback-hide"}};function rl(o,t,e,r,i=!1){let n={detail:r??{},bubbles:!0,composed:!0,cancelable:i},s=o.dispatchEvent(new CustomEvent(e,n)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,n))&&s:s}var ud=new Set;function il(o,t,e,r){let i;o.addEventListener(e,s=>{i=s.detail,queueMicrotask(()=>i=void 0),r(s)});let{deprecated:n}=t[e];n&&o.addEventListener(n,s=>{i!==void 0&&s.detail===i||(ud.has(n)||(ud.add(n),console.warn(`[qti-components] The event "${n}" is deprecated; dispatch "${e}" instead.`)),r(s))})}function xt(o,t,e,r=!1){return rl(o,md,t,e,r)}function fd(o,t,e){il(o,md,t,e)}var gd={"qc-test-navigate":{kind:"request",scope:"test",deprecated:"cito-test-navigate"},"qc-test-end-attempt":{kind:"request",scope:"test",deprecated:"cito-test-end-attempt"},"qc-test-submit":{kind:"request",scope:"test",deprecated:"cito-test-submit"},"qc-test-update-outcome":{kind:"request",scope:"test",deprecated:"cito-test-update-outcome"},"qc-test-update-plugin-state":{kind:"request",scope:"test",deprecated:"cito-test-update-plugin-state"},"qc-test-switch-view":{kind:"request",scope:"test",deprecated:"cito-test-switch-view"},"qc-test-submitted":{kind:"notification",scope:"test",deprecated:"cito-test-submitted"},"qc-test-navigated":{kind:"notification",scope:"test",deprecated:"cito-test-navigated"},"qc-test-navigation-started":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-started"},"qc-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-failed"},"qc-test-rendered":{kind:"notification",scope:"test",deprecated:"cito-test-rendered"},"qc-test-loaded":{kind:"notification",scope:"test",deprecated:"cito-test-loaded"},"qc-test-state-changed":{kind:"notification",scope:"test",deprecated:"cito-test-state-changed"},"qc-test-items-skipped":{kind:"notification",scope:"test",deprecated:"cito-test-items-skipped"},"qc-test-end-reached":{kind:"notification",scope:"test",deprecated:"cito-test-end-reached"},"qc-item-ref-connected":{kind:"notification",scope:"item",deprecated:"cito-item-ref-connected"}};function F(o,t,e){rl(o,gd,t,e)}function B(o,t,e){il(o,gd,t,e)}var Se=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},wt=class extends E{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let r=e.getAttribute("identifier");if(!r)continue;let i=Number(e.getAttribute("value"));if(Number.isNaN(i)){console.warn(`qti-weight "${r}" has a non-numeric value, ignoring it`);continue}t.set(r,i)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?rd(t):null,this.requestUpdate(),await this.updateComplete,F(this,"qc-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let r=e.items.find(i=>i.identifier===this.identifier);if(r)return r}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};Se([p({type:String})],wt.prototype,"category",void 0);Se([p({type:String})],wt.prototype,"identifier",void 0);Se([p({type:Boolean,converter:bd})],wt.prototype,"required",void 0);Se([p({type:Boolean,converter:bd})],wt.prototype,"fixed",void 0);Se([p({type:String})],wt.prototype,"href",void 0);Se([T(),I({context:lt,subscribe:!0})],wt.prototype,"computedContext",void 0);Se([p({type:Object,attribute:!1})],wt.prototype,"xmlDoc",void 0);Se([I({context:Ee,subscribe:!0})],wt.prototype,"testHost",void 0);var $r=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},nl={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Gt=class extends E{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return v`<slot name="qti-rubric-block"></slot><slot></slot>`}};$r([p({type:String})],Gt.prototype,"identifier",void 0);$r([p({type:String})],Gt.prototype,"required",void 0);$r([p({type:Boolean,converter:nl})],Gt.prototype,"fixed",void 0);$r([p({type:Boolean,converter:nl})],Gt.prototype,"visible",void 0);$r([p({type:Boolean,converter:nl,attribute:"keep-together"})],Gt.prototype,"keepTogether",void 0);$r([I({context:nt,subscribe:!0})],Gt.prototype,"_testContext",void 0);var ol=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},or=class extends E{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,F(this,"qc-test-loaded",this)}render(){return v` <slot></slot>`}};ol([p({type:String})],or.prototype,"identifier",void 0);ol([p({type:String})],or.prototype,"title",null);ol([I({context:nt,subscribe:!0})],or.prototype,"_testContext",void 0);function io(o,t){let e=o.firstElementChild;if(!e||typeof e.calculate!="function")return console.warn(`<${o.localName}> has no evaluable expression child`,o),t;try{let r=e.calculate();return r===!0||r==="true"}catch(r){return console.warn(`<${o.localName}> could not evaluate its expression`,r),t}}var sm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},de=class extends E{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=w`
|
|
63
|
+
`}render(){return v`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(i=>i.identifier===e[0])?.variables?.find(i=>i.identifier===e[e.length-1])??null}};Ka([I({context:j,subscribe:!0})],S.prototype,"context",void 0);Ka([I({context:qt,subscribe:!0})],S.prototype,"qtiContext",void 0);Ka([I({context:nt,subscribe:!0})],S.prototype,"_testContext",void 0);var Qt=class extends S{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var ky=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Mt=o=>typeof o=="string"?o:o.toString();function Za(o){return o==null}function ro(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Fi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ut=class extends E{constructor(){super(...arguments),this.showHide="show",this.#t=new at(this,{context:j,subscribe:!0,callback:t=>this.#r(t)}),this.#i=!1}#t;get _context(){return this.#t.value}#e;#r(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let r=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),i=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,n=this.#e===void 0?i>0:this.#e!==r||i>0;this.#e=r,n&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!Za(this.identifier)&&!Za(e?.value)&&this.identifier===e.value||!1,this.#n(r)}#i;#n(t){let e=this.#s()&&this.#o(t)?"on":"off";if(e==="on"){if(this.showStatus==="on"||this.#i)return;if(!this.feedbackShowing()){this.#i=!0,this.showStatus="off";return}}else if(this.#i=!1,this.showStatus==="on"&&!this.feedbackHiding())return;this.showStatus=e}#o(t){return t&&this.showHide==="show"||!t&&this.showHide==="hide"}feedbackShowing(){return!0}feedbackHiding(){return!0}#s(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(i=>i.active)?.sections.flatMap(i=>i.items).find(i=>i.active);if(!t||t.sessionControl?.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.sessionControl?.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(i=>i.identifier==="numAttempts")?.value)||0)<e}};Fi([p({type:String,attribute:"show-hide"})],ut.prototype,"showHide",void 0);Fi([p({type:String,attribute:"outcome-identifier"})],ut.prototype,"outcomeIdentifier",void 0);Fi([p({type:String})],ut.prototype,"identifier",void 0);Fi([p({type:String,attribute:!1})],ut.prototype,"showStatus",void 0);Fi([I({context:lt,subscribe:!0}),T()],ut.prototype,"_computedContext",void 0);function zi(o){if(o==null)return null;if(!o.includes(",")){let e=o.trim();return e.length>0?e:null}let t=o.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function nr(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(r=>r.trim()).filter(r=>r.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*Py(o){if(o!=null){if(Array.isArray(o)){for(let t of o){let e=t.trim();e&&(yield e)}return}if(!o.includes(",")){let t=o.trim();t&&(yield t);return}for(let t of o.split(",")){let e=t.trim();e&&(yield e)}}}function Oy(o){let[t,e,...r]=o.trim().split(/\s+/);if(!t||!e||r.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function Dy(o,t){return`${o} ${t}`}function $y(o){let[t,e,...r]=o.trim().split(/\s+/),i=Number(t),n=Number(e);if(!Number.isFinite(i)||!Number.isFinite(n)||r.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:i,y:n}}function Ny(o,t){return`${o} ${t}`}function Xt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=zi(r);return i===null?t:i},toAttribute:r=>e(r)?null:nr(r)}}var ce=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),Bi=o=>{let t={},e={};for(let r of o){let i=r.getAttribute("field-identifier");if(!i)continue;t[i]=r.textContent?.trim()??"";let n=r.getAttribute("base-type");n&&(e[i]=n)}return{value:t,baseTypes:e}},ld=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,io=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(ld.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(r=>ld.test(r))?"point":"string"};var cd=class extends E{},Or=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Dr=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var im=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},tl=o=>t=>{let e=im(t);return e===null?null:o(e)},nm=["depcp","questify","qade"],om={Trim:tl(o=>o.trim()),ToAscii:tl(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:tl(o=>o.replace(",","."))},sm=new Map(nm.flatMap(o=>Object.entries(om).map(([t,e])=>[`${o}:${t}`,e]))),el=new Map,zy=(o,t)=>{el.set(o,t)},By=o=>{el.delete(o)},dd=o=>el.get(o)??sm.get(o)??null;var hd={true:!0,1:!0,false:!1,0:!1},Y=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,n]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-c)**2+(n-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=c&&i<=h&&n>=d&&n<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-c)**2/h**2,y=(n-d)**2/f**2;return m+y<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:i,y:n},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let s=e[i].x,a=e[i].y,l=e[n].x,c=e[n].y;a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"boolean":{let i=hd[t.trim().toLowerCase()];return i!==void 0&&i===hd[e.trim().toLowerCase()]}case"integer":{let i=parseInt(t,10),n=parseInt(e,10);if(!isNaN(i)&&!isNaN(n)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:i===n}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),n=parseFloat(e);if(!isNaN(i)&&!isNaN(n))return i===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" "),n=e.split(" ");if(i.length===2&&n.length===2)return r==="pair"&&(i.sort(),n.sort()),i.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Ee=Symbol("testHost");var ud={"qc-item-rendered":{kind:"notification",scope:"item",deprecated:"cito-item-rendered"},"qc-item-response-changed":{kind:"notification",scope:"item",deprecated:"cito-item-response-changed"},"qc-item-set-outcomes":{kind:"request",scope:"item",deprecated:"cito-item-set-outcomes"},"qc-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcome-changed"},"qc-item-outcomes-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcomes-changed"},"qc-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"cito-item-rubric-placement"},"qc-feedback-show":{kind:"notification",scope:"item",deprecated:"cito-feedback-show"},"qc-feedback-hide":{kind:"notification",scope:"item",deprecated:"cito-feedback-hide"}};function rl(o,t,e,r,i=!1){let n={detail:r??{},bubbles:!0,composed:!0,cancelable:i},s=o.dispatchEvent(new CustomEvent(e,n)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,n))&&s:s}var pd=new Set;function il(o,t,e,r){let i;o.addEventListener(e,s=>{i=s.detail,queueMicrotask(()=>i=void 0),r(s)});let{deprecated:n}=t[e];n&&o.addEventListener(n,s=>{i!==void 0&&s.detail===i||(pd.has(n)||(pd.add(n),console.warn(`[qti-components] The event "${n}" is deprecated; dispatch "${e}" instead.`)),r(s))})}function xt(o,t,e,r=!1){return rl(o,ud,t,e,r)}function md(o,t,e){il(o,ud,t,e)}var fd={"qc-test-navigate":{kind:"request",scope:"test",deprecated:"cito-test-navigate"},"qc-test-end-attempt":{kind:"request",scope:"test",deprecated:"cito-test-end-attempt"},"qc-test-submit":{kind:"request",scope:"test",deprecated:"cito-test-submit"},"qc-test-update-outcome":{kind:"request",scope:"test",deprecated:"cito-test-update-outcome"},"qc-test-update-plugin-state":{kind:"request",scope:"test",deprecated:"cito-test-update-plugin-state"},"qc-test-switch-view":{kind:"request",scope:"test",deprecated:"cito-test-switch-view"},"qc-test-submitted":{kind:"notification",scope:"test",deprecated:"cito-test-submitted"},"qc-test-navigated":{kind:"notification",scope:"test",deprecated:"cito-test-navigated"},"qc-test-navigation-started":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-started"},"qc-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-failed"},"qc-test-rendered":{kind:"notification",scope:"test",deprecated:"cito-test-rendered"},"qc-test-loaded":{kind:"notification",scope:"test",deprecated:"cito-test-loaded"},"qc-test-state-changed":{kind:"notification",scope:"test",deprecated:"cito-test-state-changed"},"qc-test-items-skipped":{kind:"notification",scope:"test",deprecated:"cito-test-items-skipped"},"qc-test-end-reached":{kind:"notification",scope:"test",deprecated:"cito-test-end-reached"},"qc-item-ref-connected":{kind:"notification",scope:"item",deprecated:"cito-item-ref-connected"}};function F(o,t,e){rl(o,fd,t,e)}function B(o,t,e){il(o,fd,t,e)}var Se=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gd={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},wt=class extends E{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let r=e.getAttribute("identifier");if(!r)continue;let i=Number(e.getAttribute("value"));if(Number.isNaN(i)){console.warn(`qti-weight "${r}" has a non-numeric value, ignoring it`);continue}t.set(r,i)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?ed(t):null,this.requestUpdate(),await this.updateComplete,F(this,"qc-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let r=e.items.find(i=>i.identifier===this.identifier);if(r)return r}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};Se([p({type:String})],wt.prototype,"category",void 0);Se([p({type:String})],wt.prototype,"identifier",void 0);Se([p({type:Boolean,converter:gd})],wt.prototype,"required",void 0);Se([p({type:Boolean,converter:gd})],wt.prototype,"fixed",void 0);Se([p({type:String})],wt.prototype,"href",void 0);Se([T(),I({context:lt,subscribe:!0})],wt.prototype,"computedContext",void 0);Se([p({type:Object,attribute:!1})],wt.prototype,"xmlDoc",void 0);Se([I({context:Ee,subscribe:!0})],wt.prototype,"testHost",void 0);var $r=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},nl={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Gt=class extends E{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return v`<slot name="qti-rubric-block"></slot><slot></slot>`}};$r([p({type:String})],Gt.prototype,"identifier",void 0);$r([p({type:String})],Gt.prototype,"required",void 0);$r([p({type:Boolean,converter:nl})],Gt.prototype,"fixed",void 0);$r([p({type:Boolean,converter:nl})],Gt.prototype,"visible",void 0);$r([p({type:Boolean,converter:nl,attribute:"keep-together"})],Gt.prototype,"keepTogether",void 0);$r([I({context:nt,subscribe:!0})],Gt.prototype,"_testContext",void 0);var ol=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},or=class extends E{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,F(this,"qc-test-loaded",this)}render(){return v` <slot></slot>`}};ol([p({type:String})],or.prototype,"identifier",void 0);ol([p({type:String})],or.prototype,"title",null);ol([I({context:nt,subscribe:!0})],or.prototype,"_testContext",void 0);function no(o,t){let e=o.firstElementChild;if(!e||typeof e.calculate!="function")return console.warn(`<${o.localName}> has no evaluable expression child`,o),t;try{let r=e.calculate();return r===!0||r==="true"}catch(r){return console.warn(`<${o.localName}> could not evaluate its expression`,r),t}}var am=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},de=class extends E{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=w`
|
|
64
64
|
:host {
|
|
65
65
|
display: none;
|
|
66
66
|
}
|
|
67
|
-
`}evaluate(){return
|
|
67
|
+
`}evaluate(){return no(this,!1)}render(){return v`<slot></slot>`}};am([p({type:String})],de.prototype,"target",void 0);var sr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Nr={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Pt=class extends E{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return v`<slot></slot>`}};sr([p({type:Number,attribute:"max-attempts"})],Pt.prototype,"maxAttempts",void 0);sr([p({type:Boolean,converter:Nr,attribute:"show-feedback"})],Pt.prototype,"showFeedback",void 0);sr([p({type:Boolean,converter:Nr,attribute:"allow-review"})],Pt.prototype,"allowReview",void 0);sr([p({type:Boolean,converter:Nr,attribute:"show-solution"})],Pt.prototype,"showSolution",void 0);sr([p({type:Boolean,converter:Nr,attribute:"allow-comment"})],Pt.prototype,"allowComment",void 0);sr([p({type:Boolean,converter:Nr,attribute:"allow-skipping"})],Pt.prototype,"allowSkipping",void 0);sr([p({type:Boolean,converter:Nr,attribute:"validate-responses"})],Pt.prototype,"validateResponses",void 0);var sl=o=>o?.split(/\s+/).filter(Boolean)??[],Lr=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:sl(o.getAttribute("include-category")),excludeCategories:sl(o.getAttribute("exclude-category"))}),Vr=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:r})=>{let i=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return i.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):i.flatMap(n=>Array.from(n.querySelectorAll("qti-assessment-item-ref"))).filter(n=>{let s=sl(n.category);return!(e.length>0&&!s.some(a=>e.includes(a))||r.length>0&&s.some(a=>r.includes(a)))})};var lm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ui=class extends S{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-number-presented: no enclosing qti-assessment-test, nothing to count"),0;let e=new Set((this._testContext?.items??[]).filter(r=>{let i=r.variables?.find(n=>n.identifier==="completionStatus")?.value;return i!=null&&i!=="not_attempted"}).map(r=>r.identifier));return Vr(t,Lr(this)).filter(r=>e.has(r.identifier)).length}calculate(){return this.getResult()}};lm([I({context:nt,subscribe:!0})],Ui.prototype,"_testContext",void 0);var oo=class extends S{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?Vr(t,Lr(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var so=class extends E{static{this.styles=w`
|
|
68
68
|
:host {
|
|
69
69
|
display: none;
|
|
70
70
|
}
|
|
71
|
-
`}evaluate(){return
|
|
71
|
+
`}evaluate(){return no(this,!0)}render(){return v`<slot></slot>`}};var ao=class extends E{static{this.styles=[w`
|
|
72
72
|
:host {
|
|
73
73
|
display: none;
|
|
74
74
|
}
|
|
75
|
-
`]}render(){return v`<slot></slot>`}process(){let t=new al,e=[...this.children];t.process(e)}},al=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Dr))throw e}}};var ar=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},mt=class extends E{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:sd},this.#r={...this._context,variables:this._context.variables},this.#i=new Map,this.#n=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,r=e.type==="template"?this.#i.get(e.identifier):void 0,i=r!==void 0?{...e,value:r}:e;this._context={...this._context,variables:[...this._context.variables,i]},this.#r=this._context,t.stopPropagation()},this.#l=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.#b(r,!0,e)},this.#c=t=>{t.stopImmediatePropagation();let{outcomes:e=[],responseProcessed:r=!1}=t.detail??{},i=[];r&&this.adaptive==="false"&&(e.find(s=>s.identifier==="completionStatus")?.value??this.getVariable("completionStatus")?.value)==="unknown"&&i.push({identifier:"completionStatus",value:"completed"}),this.#y([...e,...i],this.#x(!1)),r&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),r=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||r)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...r?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(n=>!("identifier"in n))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,r=t.filter(n=>n.value!==null&&n.value!==void 0&&(n.type==="template"||e.some(s=>s.identifier===n.identifier&&s.type==="template")));r.forEach(n=>this.#i.set(n.identifier,n.value));let i=r.some(n=>JSON.stringify(e.find(s=>s.identifier===n.identifier)?.value)!==JSON.stringify(n.value));this._context={...this._context,variables:this._context.variables.map(n=>{let s=t.find(a=>a.identifier===n.identifier);return s?{...n,...s,interpolationTable:n.interpolationTable,matchTable:n.matchTable}:n})},this.#n&&i&&this.#m(),this.updateComplete.then(()=>this.#w()),this.isConnected&&this.#v()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#i;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(n=>n.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#v(),xt(this,"qc-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#f()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#l),this.addEventListener("end-attempt",this.#p),this.addEventListener("qc-item-set-outcomes",this.#c),this.addEventListener("qti-set-template-value",this.#d),this.addEventListener("qti-set-correct-response",this.#h),this.addEventListener("qti-interaction-response",this.#u)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#l),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qc-item-set-outcomes",this.#c),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#h),this.removeEventListener("qti-interaction-response",this.#u)}#a;#l;#p;#c;#d;#h;#u;async#f(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#m()}#m(){this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#b(t,e)}#b(t,e,r){this.#x(e),this.#g(r);let i=+this.getVariable("numAttempts")?.value+(t?1:0),n=this.querySelector("qti-response-processing");if(typeof n?.processResponse=="function"){try{n.processResponse({numAttempts:i})}catch(s){throw this.#y([{identifier:"numAttempts",value:String(i)}]),s}return!0}return xt(this,"qc-item-set-outcomes",{outcomes:[{identifier:"numAttempts",value:String(i)}],responseProcessed:!0}),!1}#g(t){let e=Array.from(this.querySelectorAll("qti-end-attempt-interaction"),r=>r.getAttribute("response-identifier")).filter(r=>r&&r!==t);e.length!==0&&(this._context={...this._context,variables:this._context.variables.map(r=>e.includes(r.identifier)?{...r,value:"false"}:r)})}resetResponses(){this._context=this.#r,this.isConnected&&this.#v()}#v(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),xt(this,"qc-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let r=this._context.variables.find(n=>n.identifier===t&&n.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){this.#y([{identifier:t,value:e}])}#y(t,e){let r=new Map;for(let{identifier:n,value:s}of t){let a=this.getVariable(n);if(!a){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);continue}r.set(n,a.cardinality==="single"||Array.isArray(s)?s:[s])}let i=e!==void 0&&e!==this._context.valid;if(!(r.size===0&&!i)&&(this._context={...this._context,...i?{valid:e}:{},variables:this._context.variables.map(n=>r.has(n.identifier)?{...n,value:r.get(n.identifier)}:n)},r.size>0)){for(let[n,s]of r)xt(this,"qc-item-outcome-changed",{item:this.identifier,outcomeIdentifier:n,value:s});xt(this,"qc-item-outcomes-changed",{item:this.identifier,outcomes:[...r].map(([n,s])=>({identifier:n,value:s}))})}}validate(t=!0){let e=this.#x(t);return this.#C(e),e}#x(t){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}#C(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#w(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}};ar([p({type:String})],mt.prototype,"identifier",void 0);ar([p({type:String})],mt.prototype,"adaptive",void 0);ar([p({type:String,attribute:"time-dependent"})],mt.prototype,"timeDependent",void 0);ar([p({type:String})],mt.prototype,"title",null);ar([p({type:Boolean})],mt.prototype,"disabled",void 0);ar([p({type:Boolean})],mt.prototype,"readonly",void 0);ar([Q({context:j})],mt.prototype,"_context",void 0);var vd=w`
|
|
75
|
+
`]}render(){return v`<slot></slot>`}process(){let t=new al,e=[...this.children];t.process(e)}},al=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Dr))throw e}}};var ar=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},mt=class extends E{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:od},this.#r={...this._context,variables:this._context.variables},this.#i=new Map,this.#n=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,r=e.type==="template"?this.#i.get(e.identifier):void 0,i=r!==void 0?{...e,value:r}:e;this._context={...this._context,variables:[...this._context.variables,i]},this.#r=this._context,t.stopPropagation()},this.#l=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.#b(r,!0,e)},this.#c=t=>{t.stopImmediatePropagation();let{outcomes:e=[],responseProcessed:r=!1}=t.detail??{},i=[];r&&this.adaptive==="false"&&(e.find(s=>s.identifier==="completionStatus")?.value??this.getVariable("completionStatus")?.value)==="unknown"&&i.push({identifier:"completionStatus",value:"completed"}),this.#y([...e,...i],this.#x(!1)),r&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),r=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||r)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...r?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(n=>!("identifier"in n))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,r=t.filter(n=>n.value!==null&&n.value!==void 0&&(n.type==="template"||e.some(s=>s.identifier===n.identifier&&s.type==="template")));r.forEach(n=>this.#i.set(n.identifier,n.value));let i=r.some(n=>JSON.stringify(e.find(s=>s.identifier===n.identifier)?.value)!==JSON.stringify(n.value));this._context={...this._context,variables:this._context.variables.map(n=>{let s=t.find(a=>a.identifier===n.identifier);return s?{...n,...s,interpolationTable:n.interpolationTable,matchTable:n.matchTable}:n})},this.#n&&i&&this.#m(),this.updateComplete.then(()=>this.#w()),this.isConnected&&this.#v()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#i;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(n=>n.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#v(),xt(this,"qc-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#f()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#l),this.addEventListener("end-attempt",this.#p),this.addEventListener("qc-item-set-outcomes",this.#c),this.addEventListener("qti-set-template-value",this.#d),this.addEventListener("qti-set-correct-response",this.#h),this.addEventListener("qti-interaction-response",this.#u)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#l),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qc-item-set-outcomes",this.#c),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#h),this.removeEventListener("qti-interaction-response",this.#u)}#a;#l;#p;#c;#d;#h;#u;async#f(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#m()}#m(){this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#b(t,e)}#b(t,e,r){this.#x(e),this.#g(r);let i=+this.getVariable("numAttempts")?.value+(t?1:0),n=this.querySelector("qti-response-processing");if(typeof n?.processResponse=="function"){try{n.processResponse({numAttempts:i})}catch(s){throw this.#y([{identifier:"numAttempts",value:String(i)}]),s}return!0}return xt(this,"qc-item-set-outcomes",{outcomes:[{identifier:"numAttempts",value:String(i)}],responseProcessed:!0}),!1}#g(t){let e=Array.from(this.querySelectorAll("qti-end-attempt-interaction"),r=>r.getAttribute("response-identifier")).filter(r=>r&&r!==t);e.length!==0&&(this._context={...this._context,variables:this._context.variables.map(r=>e.includes(r.identifier)?{...r,value:"false"}:r)})}resetResponses(){this._context=this.#r,this.isConnected&&this.#v()}#v(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),xt(this,"qc-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let r=this._context.variables.find(n=>n.identifier===t&&n.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){this.#y([{identifier:t,value:e}])}#y(t,e){let r=new Map;for(let{identifier:n,value:s}of t){let a=this.getVariable(n);if(!a){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);continue}r.set(n,a.cardinality==="single"||Array.isArray(s)?s:[s])}let i=e!==void 0&&e!==this._context.valid;if(!(r.size===0&&!i)&&(this._context={...this._context,...i?{valid:e}:{},variables:this._context.variables.map(n=>r.has(n.identifier)?{...n,value:r.get(n.identifier)}:n)},r.size>0)){for(let[n,s]of r)xt(this,"qc-item-outcome-changed",{item:this.identifier,outcomeIdentifier:n,value:s});xt(this,"qc-item-outcomes-changed",{item:this.identifier,outcomes:[...r].map(([n,s])=>({identifier:n,value:s}))})}}validate(t=!0){let e=this.#x(t);return this.#C(e),e}#x(t){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}#C(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#w(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}};ar([p({type:String})],mt.prototype,"identifier",void 0);ar([p({type:String})],mt.prototype,"adaptive",void 0);ar([p({type:String,attribute:"time-dependent"})],mt.prototype,"timeDependent",void 0);ar([p({type:String})],mt.prototype,"title",null);ar([p({type:Boolean})],mt.prototype,"disabled",void 0);ar([p({type:Boolean})],mt.prototype,"readonly",void 0);ar([Q({context:j})],mt.prototype,"_context",void 0);var bd=w`
|
|
76
76
|
:host {
|
|
77
77
|
display: contents;
|
|
78
78
|
}
|
|
@@ -80,11 +80,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
80
80
|
::slotted(qti-catalog-info) {
|
|
81
81
|
display: none;
|
|
82
82
|
}
|
|
83
|
-
`;var ao=class extends E{static{this.styles=vd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function yd(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function qd(o,t,e,r="qti-portable-custom-interaction"){let i=[],n=o.querySelectorAll(r);if(n.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(n)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,c.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of y){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],b=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",b),a&&a.paths&&a.paths[u]){let q=a.paths[u];Array.isArray(q)?x.setAttribute("fallback-path",q[0]):x.setAttribute("fallback-path",q)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let b=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",b),a&&a.paths&&a.paths[x]){let q=a.paths[x];Array.isArray(q)?g.setAttribute("fallback-path",q[0]):g.setAttribute("fallback-path",q)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=x.map((b,q)=>{let _=u.length>q?u[q]:"";return{primaryPath:b,fallbackPath:_}});for(let b of u)g.some(q=>q.fallbackPath===b)||g.push({primaryPath:x.length>0?x[0]:b,fallbackPath:b});for(let b of g){let q=o.createElement("qti-interaction-module");b.fallbackPath&&q.setAttribute("fallback-path",b.fallbackPath),q.setAttribute("id",f),q.setAttribute("primary-path",b.primaryPath),h&&h.appendChild(q)}}}}}function xd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===t||n.localName?.toLowerCase()===t.toLowerCase()).forEach(n=>{let s=`${t}-${e}`,a=Cd(n,s);n.replaceWith(a)})}function wd(o,t){o.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let n=i.slice(`${t}:`.length),s=`${e.nodeName}-${n}`,a=Cd(e,s);e.replaceWith(a)}})})}function Cd(o,t){let e=o.ownerDocument.createElement(t);for(let r of o.attributes)e.setAttribute(r.name,r.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function kd(o,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let i of e)o.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}function Ae(o,...t){let e=o.childNodes,r=[];for(let i=0;i<e.length;i++){let n=e[i];n.nodeType===1&&t.includes(n.localName??"")&&r.push(n)}return r}var he=(o,t)=>Ae(o,t)[0]??null;function Ot(o,t){let e=o.getAttribute(t)?.trim();if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1}function Ed(o,t){let e=o.getAttribute(t)?.trim();return e&&/^[+-]?\d+$/.test(e)?Number(e):void 0}var lm=Object.freeze({maxAttempts:1,showFeedback:!1,allowReview:!0,showSolution:!1,allowComment:!1,allowSkipping:!0,validateResponses:!1});function Sd(o){if(o.localName!=="qti-assessment-test")throw new TypeError(`Expected a qti-assessment-test element, not ${String(o.localName)}.`);return{identifier:o.getAttribute("identifier")??"",title:o.getAttribute("title")??"",testParts:Ae(o,"qti-test-part").map(cm)}}function cm(o){let t=ll(lm,o);return{identifier:o.getAttribute("identifier")??"",navigationMode:o.getAttribute("navigation-mode")==="linear"?"linear":"nonlinear",submissionMode:o.getAttribute("submission-mode")==="simultaneous"?"simultaneous":"individual",sessionControl:t,sections:Ae(o,"qti-assessment-section").map(e=>Ad(e,t))}}function Ad(o,t){let e=ll(t,o);return{kind:"section",identifier:o.getAttribute("identifier")??"",title:o.getAttribute("title")??"",visible:Ot(o,"visible")??!0,sessionControl:e,content:Ae(o,"qti-assessment-section","qti-assessment-item-ref").map(r=>r.localName==="qti-assessment-section"?Ad(r,e):dm(r,e))}}function dm(o,t){let e=o.getAttribute("category")?.trim();return{kind:"itemRef",identifier:o.getAttribute("identifier")??"",href:o.getAttribute("href")??"",categories:e?e.split(/\s+/):[],sessionControl:ll(t,o),declaredSessionControl:_d(o)}}function ll(o,t){return{...o,..._d(t)}}function _d(o){let t=he(o,"qti-item-session-control");if(!t)return{};let e={maxAttempts:Ed(t,"max-attempts"),showFeedback:Ot(t,"show-feedback"),allowReview:Ot(t,"allow-review"),showSolution:Ot(t,"show-solution"),allowComment:Ot(t,"allow-comment"),allowSkipping:Ot(t,"allow-skipping"),validateResponses:Ot(t,"validate-responses")};return Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))}var Td=o=>o.content.filter(t=>t.kind==="itemRef");function lo(o){return o.flatMap(t=>[t,...lo(t.content.filter(e=>e.kind==="section"))])}function co(o){return o.flatMap(t=>t.kind==="itemRef"?[t]:co(t.content))}function Id(o){if(o.localName!=="qti-assessment-item")throw new TypeError(`Expected a qti-assessment-item element, not ${String(o.localName)}.`);let t=Ae(o,"qti-response-declaration"),e=Ae(o,"qti-outcome-declaration").find(r=>r.getAttribute("identifier")==="SCORE");return{identifier:o.getAttribute("identifier")??"",adaptive:Ot(o,"adaptive")??!1,timeDependent:Ot(o,"time-dependent")??!1,hasCorrectResponse:t.some(hm),hasResponseProcessing:he(o,"qti-response-processing")!==null,externalScored:pm(e),label:o.getAttribute("label"),title:o.getAttribute("title")??""}}function hm(o){if(he(o,"qti-correct-response"))return!0;let t=he(o,"qti-mapping");if(t&&he(t,"qti-map-entry"))return!0;let e=he(o,"qti-area-mapping");return e!==null&&he(e,"qti-area-map-entry")!==null}function pm(o){let t=o?.getAttribute("external-scored")?.trim();return t==="human"||t==="externalMachine"?t:null}var cl=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=mm(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=um(`${t}`),e}random(){this.#t|=0,this.#t=this.#t+1831565813|0;let t=Math.imul(this.#t^this.#t>>>15,1|this.#t);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}};function ho(o){return cl.fromSeedKey(o)}function um(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o.charCodeAt(e),3432918353),t=t<<13|t>>>19;return Rd(t)}function mm(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return Rd(t)}function Rd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var fm=o=>typeof o=="function"?o():o.random();function po(o,t){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let n=Math.floor(fm(t)*(i+1));[e[i],e[n]]=[e[n],e[i]]}let r=0;return o.map(i=>i.fixed?i:e[r++])}function gm(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}function dl(o,t){let e=o.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,n=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=gm(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let y=i?ho(`${t}:${n}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(q=>q.parentElement!==null);if(x.filter(q=>q.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(q=>q.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=po(x.map(q=>({element:q,fixed:q.getAttribute("fixed")==="true"})),y);for(let q of x)q.remove();for(let{element:q}of b)u.insertBefore(q,g);h=!0}h&&a.removeAttribute("shuffle")}}function Md(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var bm={"qti-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-choice-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-drawing-interaction":{baseTypes:["file"],cardinalities:["single"]},"qti-end-attempt-interaction":{baseTypes:["boolean"],cardinalities:["single"]},"qti-extended-text-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","multiple","ordered","record"]},"qti-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["multiple"]},"qti-graphic-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-hotspot-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-hottext-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-inline-choice-interaction":{baseTypes:["identifier"],cardinalities:["single"]},"qti-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-media-interaction":{baseTypes:["integer"],cardinalities:["single"]},"qti-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-position-object-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-select-point-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:0}},"qti-slider-interaction":{baseTypes:["integer","float"],cardinalities:["single"]},"qti-text-entry-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","record"]},"qti-upload-interaction":{baseTypes:["file"],cardinalities:["single"]}},Pd=o=>o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o[o.length-1]}`;function Od(o){let t=new Map(Array.from(o.querySelectorAll("qti-response-declaration"),r=>[r.getAttribute("identifier"),r])),e=[];for(let[r,i]of Object.entries(bm))for(let n of Array.from(o.querySelectorAll(r))){let s=n.getAttribute("response-identifier"),a=t.get(s);if(!a)continue;let l=`${r} (response "${s}")`,c=a.getAttribute("cardinality"),d=a.getAttribute("base-type");if(c&&!i.cardinalities.includes(c))e.push(`${l}: ${c} cardinality is not permitted; it must be ${Pd(i.cardinalities)}`);else if(c&&i.max&&c!=="multiple"){let h=n.getAttribute(i.max.attribute),f=h===null?i.max.default:Number(h);(f===0||f>1)&&e.push(`${l}: ${i.max.attribute} ${f} requires multiple cardinality, not ${c}`)}c!=="record"&&d&&!i.baseTypes.includes(d)&&e.push(`${l}: base-type ${d} is not permitted; it must be ${Pd(i.baseTypes)}`)}if(e.length>0)throw new Error(`QTI validation error: ${e.join("; ")}.`)}var Dd=!1;function uo(o,t){Dd||(Dd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function vm(o){return(o.textContent||"").replace(/\s+/g," ").trim().replace(/^This page contains the following errors:\s*/i,"").replace(/\s*Below is a rendering of the page up to the first error\.?\s*$/i,"").trim()||"malformed XML"}function $d(o,t){let r=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),i=r.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??r.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(i)throw new Error(t(vm(i)));return r}function jr(o,t){return fetch(o,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>$d(e,r=>`is not well-formed XML: ${r}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Fr(o){return $d(o,t=>`Failed to parse XML: ${t}`)}function Nd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let r=o,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):i=t.createElementNS(r.namespaceURI,r.tagName);for(let n=0;n<r.attributes.length;n++){let s=r.attributes[n];i.setAttribute(s.localName,s.value)}for(let n=0;n<r.childNodes.length;n++)i.appendChild(Nd(r.childNodes[n],t,e));return i}return o.cloneNode(!1)}function zr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild(Nd(o.childNodes[r],document,t));return e}function Br(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let n=r.getAttribute(i)?.trim();if(n&&!/^(data:|https?:|blob:)/.test(n)){let s=t+encodeURI(n);r.setAttribute(i,s)}}})}var Jt=()=>{let o,t="",e={load(r,i){return t=r,jr(r,i).then(n=>(o=n,e))},parse(r){return o=Fr(r),t="",e},path:r=>(Br(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return kd(o,r),e},async configurePci(r,i,n="qti-portable-custom-interaction"){return await qd(o,r,i,n),e},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-item-seed";return uo("qtiTransformItem",n),dl(o,n),e}return dl(o,i),e},extendElementName:(r,i)=>(xd(o,r,i),e),extendElementsWithClass:(r="extend")=>(wd(o,r),e),customInteraction(r,i){let n=o.querySelector("qti-custom-interaction"),s=n.querySelector("object");return n.setAttribute("data-base-ref",r),n.setAttribute("data-base-item",r+i),n.setAttribute("data",s.getAttribute("data")),n.setAttribute("width",s.getAttribute("width")),n.setAttribute("height",s.getAttribute("height")),n.removeChild(s),e},convertCDATAtoComment(){return yd(o),e},stripStyleSheets(){return Md(o),e},validateBindings(){return Od(o),e},html(){return t!==null&&Br(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(zr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&Br(o,t.substring(0,t.lastIndexOf("/"))),zr(o,r)},xmlDoc(){return o}};return e};var Ld=()=>{let o,t={async load(e,r){return o=await jr(e,r),t},parse(e){o=Fr(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Vd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:i,category:n})}),t}var mo=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),jd=o=>mo(o,"qti-assessment-item-ref","assessmentitemref"),Wi=o=>mo(o,"qti-assessment-section","assessmentsection"),Hi=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),ym=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),hl=o=>mo(o,"qti-ordering","ordering"),qm=o=>mo(o,"qti-selection","selection"),xm=o=>Array.from(o.children).filter(t=>hl(t)&&Hi(t,"shuffle")),wm=(o,t)=>ho(`${o}:${t}`);function Cm(o){let t=[],e=[],r=i=>{for(let n of Array.from(i.children))jd(n)?t.push(n):Wi(n)?r(n):!hl(n)&&!qm(n)&&e.push(n.localName)};return r(o),{itemRefs:t,dropped:e}}function km(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function Fd(o,t){for(let l of Array.from(o.children))Wi(l)&&Fd(l,t);let e=xm(o);if(e.length===0)return;let r=[],i=[];for(let l of Array.from(o.children))if(jd(l))r.push({nodes:[l],fixed:Hi(l,"fixed")}),i.push(l);else if(Wi(l)){let{itemRefs:c,dropped:d}=Cm(l);if(km(l,d),ym(l,"keep-together","keeptogether"))for(let h of c)r.push({nodes:[h],fixed:Hi(h,"fixed")});else c.length>0&&r.push({nodes:c,fixed:Hi(l,"fixed")});i.push(l)}let n=i.length>0?i[i.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=po(r,wm(t,s));for(let l of i)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,n);for(let l of e)l.remove()}function zd(o){return Array.from(o.getElementsByTagName("*")).some(t=>hl(t)&&Hi(t,"shuffle"))}function pl(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Wi(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&Wi(i)||Fd(r,t)}}var Ur=()=>{let o,t="",e={async load(r,i){return o=await jr(r,i),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return o=Fr(r),t="",e},path:r=>(Br(o,r),e),fn(r){return r(o),e},shuffleOrdering(r){if(!zd(o))return e;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-test-seed";return uo("qtiTransformTest",n),pl(o,n),e}return pl(o,i),e},items(){return Vd(o)},html(){return new XMLSerializer().serializeToString(zr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return zr(o,r)},xmlDoc(){return o}};return e};var Bd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ul=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},Hr=class extends E{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new ul(this,t);this.dispatchEvent(e);let r=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(t){let r=(await Jt().load(this.href).then(i=>i.htmlDoc()))?.querySelector("qti-assessment-stimulus");r&&(t.innerHTML="",t.append(r))}};Bd([p({type:String})],Hr.prototype,"identifier",void 0);Bd([p({type:String})],Hr.prototype,"href",void 0);var fo=class extends E{};var Em=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Qi=class extends E{render(){return v`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let n=i;n.mathVariable!==!0||n.value===null||n.value===void 0||t.set(n.identifier,this.#e(n.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let n=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(n);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",n);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",n),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Em([I({context:j,subscribe:!0}),T()],Qi.prototype,"context",void 0);var Ud=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Wr=class extends E{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[w`
|
|
83
|
+
`;var lo=class extends E{static{this.styles=bd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function vd(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function yd(o,t,e,r="qti-portable-custom-interaction"){let i=[],n=o.querySelectorAll(r);if(n.length===0)return;let s=null,a=null,l=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let c of Array.from(n)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,c.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of y){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],b=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",b),a&&a.paths&&a.paths[u]){let q=a.paths[u];Array.isArray(q)?x.setAttribute("fallback-path",q[0]):x.setAttribute("fallback-path",q)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let b=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",b),a&&a.paths&&a.paths[x]){let q=a.paths[x];Array.isArray(q)?g.setAttribute("fallback-path",q[0]):g.setAttribute("fallback-path",q)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await l(),s){c.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=x.map((b,q)=>{let _=u.length>q?u[q]:"";return{primaryPath:b,fallbackPath:_}});for(let b of u)g.some(q=>q.fallbackPath===b)||g.push({primaryPath:x.length>0?x[0]:b,fallbackPath:b});for(let b of g){let q=o.createElement("qti-interaction-module");b.fallbackPath&&q.setAttribute("fallback-path",b.fallbackPath),q.setAttribute("id",f),q.setAttribute("primary-path",b.primaryPath),h&&h.appendChild(q)}}}}}function qd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===t||n.localName?.toLowerCase()===t.toLowerCase()).forEach(n=>{let s=`${t}-${e}`,a=wd(n,s);n.replaceWith(a)})}function xd(o,t){o.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let n=i.slice(`${t}:`.length),s=`${e.nodeName}-${n}`,a=wd(e,s);e.replaceWith(a)}})})}function wd(o,t){let e=o.ownerDocument.createElement(t);for(let r of o.attributes)e.setAttribute(r.name,r.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function Cd(o,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let i of e)o.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}function Ae(o,...t){let e=o.childNodes,r=[];for(let i=0;i<e.length;i++){let n=e[i];n.nodeType===1&&t.includes(n.localName??"")&&r.push(n)}return r}var he=(o,t)=>Ae(o,t)[0]??null;function Ot(o,t){let e=o.getAttribute(t)?.trim();if(e==="true"||e==="1")return!0;if(e==="false"||e==="0")return!1}function kd(o,t){let e=o.getAttribute(t)?.trim();return e&&/^[+-]?\d+$/.test(e)?Number(e):void 0}var cm=Object.freeze({maxAttempts:1,showFeedback:!1,allowReview:!0,showSolution:!1,allowComment:!1,allowSkipping:!0,validateResponses:!1});function Ed(o){if(o.localName!=="qti-assessment-test")throw new TypeError(`Expected a qti-assessment-test element, not ${String(o.localName)}.`);return{identifier:o.getAttribute("identifier")??"",title:o.getAttribute("title")??"",testParts:Ae(o,"qti-test-part").map(dm)}}function dm(o){let t=ll(cm,o);return{identifier:o.getAttribute("identifier")??"",navigationMode:o.getAttribute("navigation-mode")==="linear"?"linear":"nonlinear",submissionMode:o.getAttribute("submission-mode")==="simultaneous"?"simultaneous":"individual",sessionControl:t,sections:Ae(o,"qti-assessment-section").map(e=>Sd(e,t))}}function Sd(o,t){let e=ll(t,o);return{kind:"section",identifier:o.getAttribute("identifier")??"",title:o.getAttribute("title")??"",visible:Ot(o,"visible")??!0,sessionControl:e,content:Ae(o,"qti-assessment-section","qti-assessment-item-ref").map(r=>r.localName==="qti-assessment-section"?Sd(r,e):hm(r,e))}}function hm(o,t){let e=o.getAttribute("category")?.trim();return{kind:"itemRef",identifier:o.getAttribute("identifier")??"",href:o.getAttribute("href")??"",categories:e?e.split(/\s+/):[],sessionControl:ll(t,o),declaredSessionControl:Ad(o)}}function ll(o,t){return{...o,...Ad(t)}}function Ad(o){let t=he(o,"qti-item-session-control");if(!t)return{};let e={maxAttempts:kd(t,"max-attempts"),showFeedback:Ot(t,"show-feedback"),allowReview:Ot(t,"allow-review"),showSolution:Ot(t,"show-solution"),allowComment:Ot(t,"allow-comment"),allowSkipping:Ot(t,"allow-skipping"),validateResponses:Ot(t,"validate-responses")};return Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0))}var _d=o=>o.content.filter(t=>t.kind==="itemRef");function co(o){return o.flatMap(t=>[t,...co(t.content.filter(e=>e.kind==="section"))])}function ho(o){return o.flatMap(t=>t.kind==="itemRef"?[t]:ho(t.content))}function Td(o){if(o.localName!=="qti-assessment-item")throw new TypeError(`Expected a qti-assessment-item element, not ${String(o.localName)}.`);let t=Ae(o,"qti-response-declaration"),e=Ae(o,"qti-outcome-declaration").find(r=>r.getAttribute("identifier")==="SCORE");return{identifier:o.getAttribute("identifier")??"",adaptive:Ot(o,"adaptive")??!1,timeDependent:Ot(o,"time-dependent")??!1,hasCorrectResponse:t.some(pm),hasResponseProcessing:he(o,"qti-response-processing")!==null,externalScored:um(e),label:o.getAttribute("label"),title:o.getAttribute("title")??""}}function pm(o){if(he(o,"qti-correct-response"))return!0;let t=he(o,"qti-mapping");if(t&&he(t,"qti-map-entry"))return!0;let e=he(o,"qti-area-mapping");return e!==null&&he(e,"qti-area-map-entry")!==null}function um(o){let t=o?.getAttribute("external-scored")?.trim();return t==="human"||t==="externalMachine"?t:null}var cl=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=fm(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=mm(`${t}`),e}random(){this.#t|=0,this.#t=this.#t+1831565813|0;let t=Math.imul(this.#t^this.#t>>>15,1|this.#t);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}};function po(o){return cl.fromSeedKey(o)}function mm(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o.charCodeAt(e),3432918353),t=t<<13|t>>>19;return Id(t)}function fm(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return Id(t)}function Id(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var gm=o=>typeof o=="function"?o():o.random();function uo(o,t){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let n=Math.floor(gm(t)*(i+1));[e[i],e[n]]=[e[n],e[i]]}let r=0;return o.map(i=>i.fixed?i:e[r++])}function bm(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}function dl(o,t){let e=o.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,n=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=bm(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let y=i?po(`${t}:${n}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(q=>q.parentElement!==null);if(x.filter(q=>q.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(q=>q.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=uo(x.map(q=>({element:q,fixed:q.getAttribute("fixed")==="true"})),y);for(let q of x)q.remove();for(let{element:q}of b)u.insertBefore(q,g);h=!0}h&&a.removeAttribute("shuffle")}}function Rd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var vm={"qti-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-choice-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-drawing-interaction":{baseTypes:["file"],cardinalities:["single"]},"qti-end-attempt-interaction":{baseTypes:["boolean"],cardinalities:["single"]},"qti-extended-text-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","multiple","ordered","record"]},"qti-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["multiple"]},"qti-graphic-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-hotspot-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-hottext-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-inline-choice-interaction":{baseTypes:["identifier"],cardinalities:["single"]},"qti-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-media-interaction":{baseTypes:["integer"],cardinalities:["single"]},"qti-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-position-object-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-select-point-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:0}},"qti-slider-interaction":{baseTypes:["integer","float"],cardinalities:["single"]},"qti-text-entry-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","record"]},"qti-upload-interaction":{baseTypes:["file"],cardinalities:["single"]}},Md=o=>o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o[o.length-1]}`;function Pd(o){let t=new Map(Array.from(o.querySelectorAll("qti-response-declaration"),r=>[r.getAttribute("identifier"),r])),e=[];for(let[r,i]of Object.entries(vm))for(let n of Array.from(o.querySelectorAll(r))){let s=n.getAttribute("response-identifier"),a=t.get(s);if(!a)continue;let l=`${r} (response "${s}")`,c=a.getAttribute("cardinality"),d=a.getAttribute("base-type");if(c&&!i.cardinalities.includes(c))e.push(`${l}: ${c} cardinality is not permitted; it must be ${Md(i.cardinalities)}`);else if(c&&i.max&&c!=="multiple"){let h=n.getAttribute(i.max.attribute),f=h===null?i.max.default:Number(h);(f===0||f>1)&&e.push(`${l}: ${i.max.attribute} ${f} requires multiple cardinality, not ${c}`)}c!=="record"&&d&&!i.baseTypes.includes(d)&&e.push(`${l}: base-type ${d} is not permitted; it must be ${Md(i.baseTypes)}`)}if(e.length>0)throw new Error(`QTI validation error: ${e.join("; ")}.`)}var Od=!1;function mo(o,t){Od||(Od=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function ym(o){return(o.textContent||"").replace(/\s+/g," ").trim().replace(/^This page contains the following errors:\s*/i,"").replace(/\s*Below is a rendering of the page up to the first error\.?\s*$/i,"").trim()||"malformed XML"}function Dd(o,t){let r=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),i=r.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??r.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(i)throw new Error(t(ym(i)));return r}function jr(o,t){return fetch(o,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>Dd(e,r=>`is not well-formed XML: ${r}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Fr(o){return Dd(o,t=>`Failed to parse XML: ${t}`)}function $d(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let r=o,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):i=t.createElementNS(r.namespaceURI,r.tagName);for(let n=0;n<r.attributes.length;n++){let s=r.attributes[n];i.setAttribute(s.localName,s.value)}for(let n=0;n<r.childNodes.length;n++)i.appendChild($d(r.childNodes[n],t,e));return i}return o.cloneNode(!1)}function zr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild($d(o.childNodes[r],document,t));return e}function Br(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let n=r.getAttribute(i)?.trim();if(n&&!/^(data:|https?:|blob:)/.test(n)){let s=t+encodeURI(n);r.setAttribute(i,s)}}})}var Jt=()=>{let o,t="",e={load(r,i){return t=r,jr(r,i).then(n=>(o=n,e))},parse(r){return o=Fr(r),t="",e},path:r=>(Br(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return Cd(o,r),e},async configurePci(r,i,n="qti-portable-custom-interaction"){return await yd(o,r,i,n),e},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-item-seed";return mo("qtiTransformItem",n),dl(o,n),e}return dl(o,i),e},extendElementName:(r,i)=>(qd(o,r,i),e),extendElementsWithClass:(r="extend")=>(xd(o,r),e),customInteraction(r,i){let n=o.querySelector("qti-custom-interaction"),s=n.querySelector("object");return n.setAttribute("data-base-ref",r),n.setAttribute("data-base-item",r+i),n.setAttribute("data",s.getAttribute("data")),n.setAttribute("width",s.getAttribute("width")),n.setAttribute("height",s.getAttribute("height")),n.removeChild(s),e},convertCDATAtoComment(){return vd(o),e},stripStyleSheets(){return Rd(o),e},validateBindings(){return Pd(o),e},html(){return t!==null&&Br(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(zr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&Br(o,t.substring(0,t.lastIndexOf("/"))),zr(o,r)},xmlDoc(){return o}};return e};var Nd=()=>{let o,t={async load(e,r){return o=await jr(e,r),t},parse(e){o=Fr(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Ld(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:i,category:n})}),t}var fo=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Vd=o=>fo(o,"qti-assessment-item-ref","assessmentitemref"),Wi=o=>fo(o,"qti-assessment-section","assessmentsection"),Hi=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),qm=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),hl=o=>fo(o,"qti-ordering","ordering"),xm=o=>fo(o,"qti-selection","selection"),wm=o=>Array.from(o.children).filter(t=>hl(t)&&Hi(t,"shuffle")),Cm=(o,t)=>po(`${o}:${t}`);function km(o){let t=[],e=[],r=i=>{for(let n of Array.from(i.children))Vd(n)?t.push(n):Wi(n)?r(n):!hl(n)&&!xm(n)&&e.push(n.localName)};return r(o),{itemRefs:t,dropped:e}}function Em(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function jd(o,t){for(let l of Array.from(o.children))Wi(l)&&jd(l,t);let e=wm(o);if(e.length===0)return;let r=[],i=[];for(let l of Array.from(o.children))if(Vd(l))r.push({nodes:[l],fixed:Hi(l,"fixed")}),i.push(l);else if(Wi(l)){let{itemRefs:c,dropped:d}=km(l);if(Em(l,d),qm(l,"keep-together","keeptogether"))for(let h of c)r.push({nodes:[h],fixed:Hi(h,"fixed")});else c.length>0&&r.push({nodes:c,fixed:Hi(l,"fixed")});i.push(l)}let n=i.length>0?i[i.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=uo(r,Cm(t,s));for(let l of i)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,n);for(let l of e)l.remove()}function Fd(o){return Array.from(o.getElementsByTagName("*")).some(t=>hl(t)&&Hi(t,"shuffle"))}function pl(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Wi(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&Wi(i)||jd(r,t)}}var Ur=()=>{let o,t="",e={async load(r,i){return o=await jr(r,i),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return o=Fr(r),t="",e},path:r=>(Br(o,r),e),fn(r){return r(o),e},shuffleOrdering(r){if(!Fd(o))return e;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-test-seed";return mo("qtiTransformTest",n),pl(o,n),e}return pl(o,i),e},items(){return Ld(o)},html(){return new XMLSerializer().serializeToString(zr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return zr(o,r)},xmlDoc(){return o}};return e};var zd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ul=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},Hr=class extends E{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new ul(this,t);this.dispatchEvent(e);let r=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(t){let r=(await Jt().load(this.href).then(i=>i.htmlDoc()))?.querySelector("qti-assessment-stimulus");r&&(t.innerHTML="",t.append(r))}};zd([p({type:String})],Hr.prototype,"identifier",void 0);zd([p({type:String})],Hr.prototype,"href",void 0);var go=class extends E{};var Sm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Qi=class extends E{render(){return v`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let n=i;n.mathVariable!==!0||n.value===null||n.value===void 0||t.set(n.identifier,this.#e(n.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let n=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(n);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",n);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",n),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Sm([I({context:j,subscribe:!0}),T()],Qi.prototype,"context",void 0);var Bd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Wr=class extends E{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[w`
|
|
84
84
|
:host {
|
|
85
85
|
display: none;
|
|
86
86
|
}
|
|
87
|
-
`]}render(){return v`<slot></slot>`}};
|
|
87
|
+
`]}render(){return v`<slot></slot>`}};Bd([p({type:String})],Wr.prototype,"identifier",void 0);Bd([p({type:String})],Wr.prototype,"cardinality",void 0);var Am=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Xi=class extends E{#t;render(){return v`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.#t=new Function("context","fn","item",t?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t=this.getAttribute("definition");if(t)return this.#e(t);let e={variable:i=>this._context?.variables.find(n=>n.identifier===i)?.value??"",correct:i=>this._context?.variables.find(n=>n.identifier===i)?.correctResponse??""},r={getVariable:i=>this._context?.variables.find(n=>n.identifier===i),updateOutcomeVariable:(i,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:n}}))}};return this.#t(this._context,e,r)}#e(t){let e=dd(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let r=Array.from(this.children).map(i=>{let n=i.calculate;return typeof n=="function"?n.call(i):null});return e(r)}};Am([I({context:j,subscribe:!0}),T()],Xi.prototype,"_context",void 0);function pe(o,t,e,r){let i=o.closest("qti-assessment-item")?.getAttribute("identifier")??void 0,n={kind:e,identifier:r,outcomeIdentifier:o.outcomeIdentifier,element:o,...i?{itemIdentifier:i}:{}};return xt(o,t,n,!0)}var bo=class extends ut{static{this.styles=w`
|
|
88
88
|
:host {
|
|
89
89
|
display: block;
|
|
90
90
|
}
|
|
@@ -94,18 +94,18 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
94
94
|
.off {
|
|
95
95
|
display: none;
|
|
96
96
|
}
|
|
97
|
-
`}render(){return v` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}feedbackShowing(){return pe(this,"qc-feedback-show","block",this.identifier)}feedbackHiding(){return pe(this,"qc-feedback-hide","block",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Ct=o=>o??P;var
|
|
97
|
+
`}render(){return v` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}feedbackShowing(){return pe(this,"qc-feedback-show","block",this.identifier)}feedbackHiding(){return pe(this,"qc-feedback-hide","block",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Ct=o=>o??P;var vo=class extends ut{constructor(){super(...arguments),this.render=()=>v` <slot part="feedback" class="${Ct(this.showStatus)}"></slot> `}static{this.styles=w`
|
|
98
98
|
.on {
|
|
99
99
|
display: inline-block;
|
|
100
100
|
}
|
|
101
101
|
.off {
|
|
102
102
|
display: none;
|
|
103
103
|
}
|
|
104
|
-
`}feedbackShowing(){return pe(this,"qc-feedback-show","inline",this.identifier)}feedbackHiding(){return pe(this,"qc-feedback-hide","inline",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var
|
|
104
|
+
`}feedbackShowing(){return pe(this,"qc-feedback-show","inline",this.identifier)}feedbackHiding(){return pe(this,"qc-feedback-hide","inline",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Ud=w`
|
|
105
105
|
:host {
|
|
106
106
|
display: block;
|
|
107
107
|
}
|
|
108
|
-
`;var
|
|
108
|
+
`;var yo=class extends E{static{this.styles=Ud}render(){return v`<slot part="rubrics qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Qr=class extends ut{static{this.styles=w`
|
|
109
109
|
.cito-dialog {
|
|
110
110
|
background: var(--qti-bg);
|
|
111
111
|
border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
|
|
@@ -154,11 +154,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
154
154
|
:host {
|
|
155
155
|
display: none;
|
|
156
156
|
}
|
|
157
|
-
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let r of t.querySelectorAll("qti-interpolation-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=parseFloat(r.getAttribute("target-value"));if(Number.isNaN(i)||Number.isNaN(n)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:i,targetValue:n,includeBoundary:r.getAttribute("include-boundary")!=="false"})}return e}get matchTable(){let t=this.querySelector("qti-match-table");if(!t)return null;let e=new Map;for(let r of t.querySelectorAll("qti-match-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=r.getAttribute("target-value");if(Number.isNaN(i)||n===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(i,n)}return e}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:t,type:"outcome",value:null,interpolationTable:this.interpolationTable,matchTable:this.matchTable,externalScored:this.externalScored};e.value=t,(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};Gi([p({type:String,attribute:"base-type"})],ue.prototype,"baseType",void 0);Gi([p({type:String,attribute:"external-scored"})],ue.prototype,"externalScored",void 0);Gi([p({type:String})],ue.prototype,"identifier",void 0);Gi([p({type:String})],ue.prototype,"cardinality",void 0);Gi([I({context:j,subscribe:!0}),T()],ue.prototype,"itemContext",void 0);var
|
|
157
|
+
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let r of t.querySelectorAll("qti-interpolation-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=parseFloat(r.getAttribute("target-value"));if(Number.isNaN(i)||Number.isNaN(n)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:i,targetValue:n,includeBoundary:r.getAttribute("include-boundary")!=="false"})}return e}get matchTable(){let t=this.querySelector("qti-match-table");if(!t)return null;let e=new Map;for(let r of t.querySelectorAll("qti-match-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=r.getAttribute("target-value");if(Number.isNaN(i)||n===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(i,n)}return e}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:t,type:"outcome",value:null,interpolationTable:this.interpolationTable,matchTable:this.matchTable,externalScored:this.externalScored};e.value=t,(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};Gi([p({type:String,attribute:"base-type"})],ue.prototype,"baseType",void 0);Gi([p({type:String,attribute:"external-scored"})],ue.prototype,"externalScored",void 0);Gi([p({type:String})],ue.prototype,"identifier",void 0);Gi([p({type:String})],ue.prototype,"cardinality",void 0);Gi([I({context:j,subscribe:!0}),T()],ue.prototype,"itemContext",void 0);var qo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},_e=class extends Pr{static{this.styles=[w`
|
|
158
158
|
:host {
|
|
159
159
|
display: none;
|
|
160
160
|
}
|
|
161
|
-
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:r}=this.#t(),i={baseType:this.baseType,identifier:this.identifier,correctResponse:e,...r?{fieldBaseTypes:r}:{},cardinality:this.cardinality||"single",mapping:this.#i,defaultValue:t,areaMapping:this.#n,value:null,type:"response",candidateResponse:null};i.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:i}}))}#t(){if(this.cardinality!=="record")return{correctResponse:this.#r};let t=this.querySelector("qti-correct-response");if(!t)return{correctResponse:void 0};let e=Array.from(t.querySelectorAll("qti-value")),{value:r,baseTypes:i}=Bi(e);return e.forEach(n=>n.remove()),{correctResponse:Object.keys(r).length?r:void 0,fieldBaseTypes:i}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=Bi(t);return Object.keys(e).length?e:null}get#r(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){t=[];for(let i=0;i<r.length;i++)t.push(r[i].textContent.trim()),r[i].remove()}}return t}get#i(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(r)?null:r,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(n=>({mapKey:n.getAttribute("map-key")||"",mappedValue:Number(n.getAttribute("mapped-value"))||0,caseSensitive:n.hasAttribute("case-sensitive")?n.getAttribute("case-sensitive")!=="false":!1}))}}get#n(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,r=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound")),n=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(r)?null:r,upperBound:isNaN(i)?null:i,areaMapEntries:n}}};
|
|
161
|
+
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:r}=this.#t(),i={baseType:this.baseType,identifier:this.identifier,correctResponse:e,...r?{fieldBaseTypes:r}:{},cardinality:this.cardinality||"single",mapping:this.#i,defaultValue:t,areaMapping:this.#n,value:null,type:"response",candidateResponse:null};i.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:i}}))}#t(){if(this.cardinality!=="record")return{correctResponse:this.#r};let t=this.querySelector("qti-correct-response");if(!t)return{correctResponse:void 0};let e=Array.from(t.querySelectorAll("qti-value")),{value:r,baseTypes:i}=Bi(e);return e.forEach(n=>n.remove()),{correctResponse:Object.keys(r).length?r:void 0,fieldBaseTypes:i}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=Bi(t);return Object.keys(e).length?e:null}get#r(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){t=[];for(let i=0;i<r.length;i++)t.push(r[i].textContent.trim()),r[i].remove()}}return t}get#i(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(r)?null:r,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(n=>({mapKey:n.getAttribute("map-key")||"",mappedValue:Number(n.getAttribute("mapped-value"))||0,caseSensitive:n.hasAttribute("case-sensitive")?n.getAttribute("case-sensitive")!=="false":!1}))}}get#n(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,r=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound")),n=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(r)?null:r,upperBound:isNaN(i)?null:i,areaMapEntries:n}}};qo([p({type:String,attribute:"base-type"})],_e.prototype,"baseType",void 0);qo([p({type:String})],_e.prototype,"identifier",void 0);qo([p({type:String})],_e.prototype,"cardinality",void 0);qo([I({context:j,subscribe:!0}),T()],_e.prototype,"itemContext",void 0);var Hd=`<qti-response-condition>
|
|
162
162
|
<qti-response-if>
|
|
163
163
|
<qti-match>
|
|
164
164
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -173,7 +173,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
173
173
|
<qti-base-value base-type="float">0</qti-base-value>
|
|
174
174
|
</qti-set-outcome-value>
|
|
175
175
|
</qti-response-else>
|
|
176
|
-
</qti-response-condition>`,
|
|
176
|
+
</qti-response-condition>`,Wd=`<qti-response-condition>
|
|
177
177
|
<qti-response-if>
|
|
178
178
|
<qti-is-null>
|
|
179
179
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -187,7 +187,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
187
187
|
<qti-map-response identifier="RESPONSE"> </qti-map-response>
|
|
188
188
|
</qti-set-outcome-value>
|
|
189
189
|
</qti-response-else>
|
|
190
|
-
</qti-response-condition>`,
|
|
190
|
+
</qti-response-condition>`,Qd=`<qti-response-condition>
|
|
191
191
|
<qti-response-if>
|
|
192
192
|
<qti-is-null>
|
|
193
193
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -201,27 +201,27 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
201
201
|
<qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
|
|
202
202
|
</qti-set-outcome-value>
|
|
203
203
|
</qti-response-else>
|
|
204
|
-
</qti-response-condition>`;var
|
|
204
|
+
</qti-response-condition>`;var _m={map_response:Wd,map_response_point:Qd,match_correct:Hd},xo=class extends E{static{this.styles=[w`
|
|
205
205
|
:host {
|
|
206
206
|
display: none;
|
|
207
207
|
}
|
|
208
|
-
`]}#t=new Ut(this,{context:j});#e;constructor(){super(),new at(this,{context:j,subscribe:!0,callback:t=>{this.#e={...t,variables:t.variables.map(e=>({...e}))},this.#t.setValue(this.#e)}}),this.addEventListener("qti-set-outcome-value",t=>{t.stopImmediatePropagation();let e=this.#e?.variables.find(i=>i.identifier===t.detail.outcomeIdentifier);if(!e){console.warn(`Can not set qti-outcome-identifier: ${t.detail.outcomeIdentifier}, it is not available`);return}let{value:r}=t.detail;e.value=e.cardinality==="single"||Array.isArray(r)?r:[r]})}render(){return v`<slot></slot>`}processResponse({numAttempts:t}){let e=this.#e;if(!e)return;let r=this.closest("qti-assessment-item")?.getAttribute("adaptive")!=="true";for(let i of e.variables)i.identifier==="numAttempts"&&(i.value=String(t)),i.type==="outcome"&&r&&i.identifier!=="completionStatus"&&(i.value=
|
|
208
|
+
`]}#t=new Ut(this,{context:j});#e;constructor(){super(),new at(this,{context:j,subscribe:!0,callback:t=>{this.#e={...t,variables:t.variables.map(e=>({...e}))},this.#t.setValue(this.#e)}}),this.addEventListener("qti-set-outcome-value",t=>{t.stopImmediatePropagation();let e=this.#e?.variables.find(i=>i.identifier===t.detail.outcomeIdentifier);if(!e){console.warn(`Can not set qti-outcome-identifier: ${t.detail.outcomeIdentifier}, it is not available`);return}let{value:r}=t.detail;e.value=e.cardinality==="single"||Array.isArray(r)?r:[r]})}render(){return v`<slot></slot>`}processResponse({numAttempts:t}){let e=this.#e;if(!e)return;let r=this.closest("qti-assessment-item")?.getAttribute("adaptive")!=="true";for(let i of e.variables)i.identifier==="numAttempts"&&(i.value=String(t)),i.type==="outcome"&&r&&i.identifier!=="completionStatus"&&(i.value=Tm(i));this.#r(),xt(this,"qc-item-set-outcomes",{outcomes:e.variables.filter(i=>i.type==="outcome"||i.identifier==="numAttempts").map(({identifier:i,value:n})=>({identifier:i,value:n})),responseProcessed:!0})}#r(){let t=[...this.children];try{for(let e of t)e.process()}catch(e){if(!(e instanceof Or))throw e}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let r=e.split("/").pop().replace(".xml",""),i=_m[r];i&&(this.innerHTML=i)}};function Tm(o){let t=("defaultValue"in o?o.defaultValue:null)??null;return t===null&&(o.baseType==="integer"||o.baseType==="float")?"0":t}function N(o,t){let e={waitUntilFirstUpdate:!1,...t};return(r,i)=>{let{update:n}=r,s=Array.isArray(o)?o:[o];r.update=function(a){s.forEach(l=>{let c=l;if(a.has(c)){let d=a.get(c),h=this[c];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,h)}}),n.call(this,a)}}}var Xr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Dt=o=>(...t)=>({_$litDirective$:o,values:t}),Te=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:Im}=et,Xd=o=>o,Jd=o=>o===null||typeof o!="object"&&typeof o!="function";var Yd=o=>o.strings===void 0,Gd=()=>document.createComment(""),Gr=(o,t,e)=>{let r=o._$AA.parentNode,i=t===void 0?o._$AB:t._$AA;if(e===void 0){let n=r.insertBefore(Gd(),i),s=r.insertBefore(Gd(),i);e=new Im(n,s,o,o.options)}else{let n=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==s._$AU&&e._$AP(l)}if(n!==i||a){let l=e._$AA;for(;l!==n;){let c=Xd(l).nextSibling;Xd(r).insertBefore(l,i),l=c}}}return e},Ie=(o,t,e=o)=>(o._$AI(t,e),o),Rm={},Kd=(o,t=Rm)=>o._$AH=t,Zd=o=>o._$AH,wo=o=>{o._$AR(),o._$AA.remove()};var Ji=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),Ji(r,t);return!0},Co=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},th=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),Om(t)}};function Mm(o){this._$AN!==void 0?(Co(this),this._$AM=o,th(this)):this._$AM=o}function Pm(o,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let n=e;n<r.length;n++)Ji(r[n],!1),Co(r[n]);else r!=null&&(Ji(r,!1),Co(r));else Ji(this,o)}var Om=o=>{o.type==Xr.CHILD&&(o._$AP??=Pm,o._$AQ??=Mm)},Re=class extends Te{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),th(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Ji(this,t),Co(this))}setValue(t){if(Yd(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ml=class extends Re{constructor(){super(...arguments),this.prevData={}}render(t){return P}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},P}apply(t){let e=this.#t(t),{prevData:r,element:i}=this;for(let n in e){let s=e[n];s!==r[n]&&(s===!0?i.setAttribute(n,""):s===!1?i.removeAttribute(n):s!=null?i.setAttribute(n,String(s)):i.removeAttribute(n))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let i=t?this.#t(t):{};for(let n in e)(!i||!(n in i))&&r.removeAttribute(n)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>typeof r=="function"?!1:e==="max-choices"&&r===0?!0:!(r===""||r===null||r===void 0)))}},W0=Dt(ml);var Yi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},me=class extends E{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!xt(this,"qc-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=w`
|
|
209
209
|
:host {
|
|
210
210
|
display: block;
|
|
211
211
|
}
|
|
212
|
-
`}render(){return v`<slot></slot>`}};Yi([p({type:String})],me.prototype,"id",void 0);Yi([p({type:String})],me.prototype,"use",void 0);Yi([p({type:String})],me.prototype,"view",void 0);Yi([p({type:String,attribute:"class"})],me.prototype,"classNames",void 0);Yi([N("classNames",{waitUntilFirstUpdate:!0})],me.prototype,"handleclassNamesChange",null);var
|
|
212
|
+
`}render(){return v`<slot></slot>`}};Yi([p({type:String})],me.prototype,"id",void 0);Yi([p({type:String})],me.prototype,"use",void 0);Yi([p({type:String})],me.prototype,"view",void 0);Yi([p({type:String,attribute:"class"})],me.prototype,"classNames",void 0);Yi([N("classNames",{waitUntilFirstUpdate:!0})],me.prototype,"handleclassNamesChange",null);var ko=class extends E{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(r=>r.text()).then(r=>{let i=this.#e(r);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}).catch(r=>{console.error("Failed to load stylesheet:",r)}),this.textContent!==null&&this.textContent.trim()!==""){let r=this.#e(this.textContent);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${r}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}}#e(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.#t)try{this.#t.remove()}catch(t){console.error("Could not remove stylesheet:",t)}super.disconnectedCallback()}};var Eo=class extends E{render(){return v`<slot></slot>`}calculate(){let t=[...this.children];if(t.length!==1)return console.error("qti-template-constraint must have exactly one child expression"),!0;try{return!!t[0].calculate()}catch(e){return console.error("Error evaluating template constraint:",e),!0}}getSubRules(){return[]}process(){let t=this.calculate();return t||console.debug("Template constraint not satisfied, restarting template processing"),t}};var Ki=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fe=class extends E{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[w`
|
|
213
213
|
:host {
|
|
214
214
|
display: none;
|
|
215
215
|
}
|
|
216
|
-
`]}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#i()})}#e(){let t=this.querySelector("qti-default-value");if(!t)return;let e=t.textContent?.trim()||"";this.#t=this.#r(e)}#r(t){if(!t)return null;switch(this.baseType){case"integer":return parseInt(t,10);case"float":case"duration":return parseFloat(t);case"boolean":return t.toLowerCase()==="true";default:return t}}#i(){let e={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:this.#t,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:this.#t?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};Ki([p({type:String})],fe.prototype,"identifier",void 0);Ki([p({type:String})],fe.prototype,"cardinality",void 0);Ki([p({type:String,attribute:"base-type"})],fe.prototype,"baseType",void 0);Ki([p({type:Boolean,attribute:"math-variable"})],fe.prototype,"mathVariable",void 0);Ki([p({type:Boolean,attribute:"param-variable"})],fe.prototype,"paramVariable",void 0);var
|
|
216
|
+
`]}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#i()})}#e(){let t=this.querySelector("qti-default-value");if(!t)return;let e=t.textContent?.trim()||"";this.#t=this.#r(e)}#r(t){if(!t)return null;switch(this.baseType){case"integer":return parseInt(t,10);case"float":case"duration":return parseFloat(t);case"boolean":return t.toLowerCase()==="true";default:return t}}#i(){let e={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:this.#t,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:this.#t?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};Ki([p({type:String})],fe.prototype,"identifier",void 0);Ki([p({type:String})],fe.prototype,"cardinality",void 0);Ki([p({type:String,attribute:"base-type"})],fe.prototype,"baseType",void 0);Ki([p({type:Boolean,attribute:"math-variable"})],fe.prototype,"mathVariable",void 0);Ki([p({type:Boolean,attribute:"param-variable"})],fe.prototype,"paramVariable",void 0);var So=class extends E{static{this.styles=[w`
|
|
217
217
|
:host {
|
|
218
218
|
display: none;
|
|
219
219
|
}
|
|
220
|
-
`]}#t=100;render(){return v`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,r=!1;do{if(r=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let i=[...this.children];for(let n of i)if(n.tagName.toLowerCase()==="qti-template-constraint"){if(n.calculate()===!1){r=!0;break}}else n.process()}catch(i){console.error("Error during template processing:",i);break}}while(r);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var
|
|
220
|
+
`]}#t=100;render(){return v`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,r=!1;do{if(r=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let i=[...this.children];for(let n of i)if(n.tagName.toLowerCase()==="qti-template-constraint"){if(n.calculate()===!1){r=!0;break}}else n.process()}catch(i){console.error("Error during template processing:",i);break}}while(r);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var eh=[{tag:"qti-assessment-item",ctor:mt},{tag:"qti-assessment-stimulus",ctor:lo},{tag:"qti-assessment-stimulus-ref",ctor:Hr},{tag:"qti-companion-materials-info",ctor:go},{tag:"qti-content-body",ctor:Qi},{tag:"qti-context-declaration",ctor:Wr},{tag:"qti-custom-operator",ctor:Xi},{tag:"qti-feedback-block",ctor:bo},{tag:"qti-feedback-inline",ctor:vo},{tag:"qti-item-body",ctor:yo},{tag:"qti-modal-feedback",ctor:Qr},{tag:"qti-outcome-declaration",ctor:ue},{tag:"qti-response-declaration",ctor:_e},{tag:"qti-response-processing",ctor:xo},{tag:"qti-rubric-block",ctor:me},{tag:"qti-stylesheet",ctor:ko},{tag:"qti-template-constraint",ctor:Eo},{tag:"qti-template-declaration",ctor:fe},{tag:"qti-template-processing",ctor:So}];var Dm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Zi=class extends Qr{constructor(){super(...arguments),this.access="atEnd"}static{this.styles=w`
|
|
221
221
|
:host {
|
|
222
222
|
color: gray;
|
|
223
223
|
}
|
|
224
|
-
`}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return v``}};Om([p({type:String})],Zi.prototype,"access",void 0);var So=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Me=class extends E{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return v` <slot></slot>`}};So([p({type:String})],Me.prototype,"identifier",void 0);So([p({type:String})],Me.prototype,"class",void 0);So([p({type:String,attribute:"navigation-mode"})],Me.prototype,"navigationMode",void 0);So([p({type:String,attribute:"submission-mode"})],Me.prototype,"submissionMode",void 0);var Dm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},tn=class extends S{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",r=this.getAttribute("variable-identifier"),i=Vr(t,Lr(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new fl(this._testContext,r,i).calculate()}calculate(){return this.getResult()}};Dm([I({context:nt,subscribe:!0})],tn.prototype,"_testContext",void 0);var fl=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let t=this.testContext?.items??[],e=0,r=[...new Set(this.includedItems.map(i=>i.item))];return t.forEach(i=>{if(r.includes(i.identifier)){let n=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;if(n){let a=Number(n.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var Ao=Symbol("itemFacts");var en="qti-assessment-section",_o="qti-test-part",$t=o=>o.identifier||o.getAttribute("identifier")||"";function ih(o,t){let e=o[t],r=t+1,i=$m(e,o,t);if(i){let s=Nm(i,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map($t)};s>t?r=s:console.warn(`qti-branch-rule target "${i.target}" is not ahead of "${$t(e)}", ignored`)}let n=o.slice(t+1,r).map($t);for(let s=r;s<o.length;s++){if(oh(o[s],e))return{id:$t(o[s]),skipped:n};n.push($t(o[s]))}return{id:null,skipped:n}}function nh(o){let t=[];for(let e of o){if(oh(e,null))return{id:$t(e),skipped:t};t.push($t(e))}return{id:null,skipped:t}}function $m(o,t,e){let r=[o];for(let i=o.parentElement;i&&(i.localName===en||i.localName===_o)&&!i.contains(t[e+1]??null);i=i.parentElement)r.push(i);for(let i of r)for(let n of i.querySelectorAll(":scope > qti-branch-rule"))if(n.evaluate?.())return n;return null}function Nm(o,t,e){let r=o.parentElement,i=n=>{if(!n)return null;let s=t.findLastIndex(a=>n.contains(a));return s+1<t.length?s+1:null};switch(o.target){case de.EXIT_TEST:return null;case de.EXIT_TESTPART:return i(r.closest(_o));case de.EXIT_SECTION:{let n=r.localName===en?r:r.closest(en);return i(n??r)}default:{let n=t.findIndex(l=>$t(l)===o.target);if(n>=0)return n;let s=[...r.closest("qti-assessment-test")?.querySelectorAll(`${en}, ${_o}`)??[]].find(l=>l.getAttribute("identifier")===o.target),a=s?t.findIndex(l=>s.contains(l)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function oh(o,t){let e=[o];for(let r=o.parentElement;r&&(r.localName===en||r.localName===_o);r=r.parentElement)(!t||!r.contains(t))&&e.push(r);return e.every(r=>[...r.querySelectorAll(":scope > qti-pre-condition")].every(i=>i.evaluate?.()??!0))}var rn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},sh=o=>{class t extends o{constructor(...r){super(...r),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this.itemFacts=new Map,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(r,i){let n=i||this._getDefaultNavigationId(r);n&&F(this,"qc-test-navigate",{type:r,id:n})}_bindEventHandlers(){B(this,"qc-test-navigate",this._handleNavigationRequest.bind(this)),B(this,"qc-test-loaded",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(r){this._testElement=r.detail,this.itemFacts=new Map,this._initializeNavigation()}_handleItemConnected(r){let i=r.detail;this._loadingState.connectedItems++;let n=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:n}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:n.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,n),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.href)}}_getDefaultNavigationId(r){return r==="section"?this.sessionContext?.navSectionId??this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let r=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(i[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let n=nh(i);if(n.skipped.length&&F(this,"qc-test-items-skipped",{ids:n.skipped}),n.id===null){F(this,"qc-test-end-reached",{});return}r=n.id}}r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,i){let n=this.sessionContext?.navItemRefId;if(!n||r==="item"&&i===n)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!s||s.closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return!1;let a=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),l=a.findIndex(c=>c.identifier===n);if(r==="item"){let c=a.findIndex(d=>d.identifier===i);return c===-1||l===-1?!1:c!==l+1}return!0}_resolveLinearNext(r,i){if(r!=="item"||!this._testElement)return;let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=n.findIndex(l=>$t(l)===this.sessionContext?.navItemRefId);if(s<0||!n[s+1]||$t(n[s+1])!==i||n[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=ih(n,s);if(a.id!==i)return a}async _handleNavigationRequest({detail:r}){if(!r?.id)return;let i=this._resolveLinearNext(r.type,r.id);if(i?.id===null){i.skipped.length&&F(this,"qc-test-items-skipped",{ids:i.skipped}),F(this,"qc-test-end-reached",{});return}let n=i?.id??r.id;if(!i&&this._isLinearNavigationRestricted(r.type,n)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(r.type,n),this._activeController=a,await this._executeNavigation(r.type,n,s,a),i?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&F(this,"qc-test-items-skipped",{ids:i.skipped})}catch(l){this._handleNavigationError(l,r.type,n)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(r.type,n)}}_handleNavigationError(r,i,n){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,n))}async _executeNavigation(r,i,n,s){r==="item"?await this._navigateToItem(i,n,s):await this._navigateToSection(i,n,s)}async _navigateToItem(r,i,n){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"item",r)}async _navigateToSection(r,i,n){let a=this._findSection(r)?.closest("qti-test-part")?.identifier,l=this._getSectionItemIds(r);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:this.navigate==="item"?l[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"section",r)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let r=this._loadingState.connectedItems>=this._loadingState.expectedItems,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,i))return;await new Promise(n=>setTimeout(n,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let n=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,r,i)}_applyStimulusContent(r,i,n){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],l=n.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.identifier}"]`));if(c.length>0)a=c,console.info("Found targets by identifier:",c.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((c,d)=>{c.innerHTML="",c.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,i,n){if(!this._testElement||r.length===0)return;let s=r.map(d=>this._findItemRef(d));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(d=>this._loadSingleItem(d,i,n)))).filter(Boolean);if(this._isStaleNavigation(i,n))return;let c=new Map(this.itemFacts);l.forEach(({itemRef:d,doc:h,facts:f})=>{d&&h&&(d.xmlDoc=h),d&&f&&c.set(d.identifier,f)}),this.itemFacts=c,l.forEach(({itemRef:d})=>{let h=d?.identifier;if(!d||!h)return;let f=this.testContext.items.find(m=>m.identifier===h)?.state;f!==void 0&&d.updateComplete.then(()=>{let m=d.assessmentItem;m&&(m.state=f)})}),this._loadResults=l}async _loadSingleItem(r,i,n){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Jt().load(r.href,n.signal)).shuffleInteractions(s);if(this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,n))return null;let l=a.xmlDoc().documentElement,c=l?.localName==="qti-assessment-item"?Id(l):null;return{itemRef:r,doc:a.htmlDoc(this._customElementRegistry()),facts:c}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${r.identifier} was aborted`),s;return console.warn(`Failed to load item ${r.identifier}:`,s),null}}async _loadStimulus(r){return(await Jt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!i)throw new Error(`Item with identifier "${r}" not found`);return i}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,i){let n=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:s,navItemRefId:i}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,i){return i.signal.aborted||r!==this._navigationId}_createNavigationError(r,i,n){return{message:r.message||`Failed to load ${i}: ${n}`,details:r,itemId:i==="item"?n:void 0,sectionId:i==="section"?n:void 0}}_dispatchLoadingStarted(r,i){F(this,"qc-test-navigation-started",{type:r,id:i})}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchError(r){F(this,"qc-test-navigation-failed",r)}_dispatchTestLoaded(r,i,n){requestAnimationFrame(()=>{F(this,"qc-test-rendered",r.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),F(this,"qc-test-navigated",{type:i,id:n})})}}return rn([p({type:String})],t.prototype,"navigate",void 0),rn([p({type:Number})],t.prototype,"requestTimeout",void 0),rn([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),rn([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),rn([T(),Q({context:Ao})],t.prototype,"itemFacts",void 0),t};var ah=o=>{class t extends o{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},B(this,"qc-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),B(this,"qc-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(r){super.willUpdate(r),r.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let n=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;n&&this.updateAssessmentItemView(n,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return t};var lh=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gl=o=>{class t extends o{constructor(...r){super(...r),this.testContext=Ja,this.sessionContext=Ga,this._updateItemInTestContext=i=>{let n=i.itemContext,s=n.identifier,a=n.variables,l=this.testContext.items.find(c=>c?.identifier===s);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,n.valid);else{let c=[...i.variables];for(let d of l.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}i.variables=c,this.#t(s,c.find(d=>d.identifier==="completionStatus")?.value),l.state&&(i.state=l.state)}},this._initializeEventListeners()}updateItemVariables(r,i,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==r)return a;let l=[...a.variables??[]];for(let{identifier:c,type:d,value:h}of i){let f=l.findIndex(y=>y.identifier===c),m={...f>=0?l[f]:{},identifier:c,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?l[f]=m:l.push(m)}return{...a,variables:l,...n?{state:{...n}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(r)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===r)?.variables??[]],n&&(s.state=n))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=Ja,this.sessionContext=Ga}),B(this,"qc-test-loaded",r=>{this._testElement=r.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(n=>({href:n.href,identifier:n.identifier,category:n.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",r=>{let i=r.detail,n=i.closest("qti-assessment-item-ref")?.identifier;n&&(i.assessmentItemRefId=n),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables,r.detail.itemContext.state,r.detail.itemContext.valid)})}_updateItemVariablesInTestContext(r,i,n,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:i.map(l=>{let c=a.variables.find(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...n!==void 0?{state:n?{...n}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(r,i){typeof i!="string"||i==="not_attempted"||this.testContext.items.find(a=>a.identifier===r)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:a.variables.map(l=>l.identifier==="completionStatus"?{...l,value:i}:l)})})}}return lh([p({attribute:!1,type:Object}),Q({context:nt})],t.prototype,"testContext",void 0),lh([p({attribute:!1,type:Object}),Q({context:to})],t.prototype,"sessionContext",void 0),t},ch=class extends gl(E){};var To=1;var bl=o=>Array.isArray(o)?[...o]:o??null,Lm=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},Vm=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(r=>({identifier:r.identifier,...r.type?{type:r.type}:{},value:bl(r.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:bl(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),dh=o=>{class t extends o{#t=null;#e=!1;#r=null;constructor(...r){super(...r),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#r=null}),B(this,"qc-test-update-plugin-state",({detail:i})=>this.#i(i)),B(this,"qc-test-loaded",()=>{this.#t&&(this.#n(this.#t),this.#t=null),this.#e=!0})}#i({plugin:r,value:i}){if(typeof r!="string"||r==="")return;let{[r]:n,...s}=this.sessionContext.plugins??{},a=s;if(i!=null)try{a={...s,[r]:JSON.parse(JSON.stringify(i))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${r}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return Vm(this.testContext,this.sessionContext)}set state(r){if(!Lm(r)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=r;return}let{navItemRefId:i,navSectionId:n}=this.sessionContext;this.#n(r);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==i?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==n&&this.#s("section",s.navSectionId)}updated(r){if(super.updated(r),!this.#e||!(r.has("testContext")||r.has("sessionContext")))return;let i=this.state,n=JSON.stringify(i);n!==this.#r&&(this.#r=n,F(this,"qc-test-state-changed",i))}#n(r){for(let n of r.test.items)this.updateItemVariables(n.identifier,n.variables,n.state);let i=new Map(r.test.outcomes.map(n=>[n.identifier,n.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>i.has(n.identifier)?{...n,value:bl(i.get(n.identifier))}:n)},this.sessionContext={...this.sessionContext,...this.#o(r.session),plugins:r.session.plugins&&typeof r.session.plugins=="object"?{...r.session.plugins}:{}}}#o(r){let i=(n,s)=>!!s&&!!this._testElement?.querySelector(`${n}[identifier="${CSS.escape(s)}"]`);return{...i("qti-test-part",r.navPartId)?{navPartId:r.navPartId}:{},...i("qti-assessment-section",r.navSectionId)?{navSectionId:r.navSectionId}:{},...this.testContext.items.some(n=>n.identifier===r.navItemRefId)?{navItemRefId:r.navItemRefId}:{}}}#s(r,i){F(this,"qc-test-navigate",{type:r,id:i})}}return t};var hh=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),B(this,"qc-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:n,value:s}=i.detail;this.updateOutcomeVariable(n,s),i.stopPropagation()})}outcomeProcessing(){let r=(this._testElement??this).querySelector("qti-outcome-processing");return r?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>({...i,value:i.defaultValue??null}))},r.process(),!0):!1}submit(){return this.outcomeProcessing()?(F(this,"qc-test-submitted",{}),!0):!1}getTestFeedback(r){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(n=>(!r||n.access===r)&&n.matches(this.getOutcome(n.outcomeIdentifier)?.value))}updateOutcomeVariable(r,i){let n=this.getOutcome(r);if(!n){console.warn(`Can not set qti-outcome-identifier: ${r}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==r?s:{...s,value:n.cardinality==="single"?i:[...s.value,i]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===r)||null}}return t};var ph=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Pe=class extends sh(ah(hh(dh(gl(E))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Ut(this,{context:Ee,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};ph([T(),Q({context:yt})],Pe.prototype,"configContext",void 0);ph([T(),Q({context:qt})],Pe.prototype,"qtiContext",void 0);var Io=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Ro=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var uh=o=>!Yd(o)&&typeof o.then=="function",mh=1073741823,vl=class extends Re{constructor(){super(...arguments),this._$Cwt=mh,this._$Cbt=[],this._$CK=new Io(this),this._$CX=new Ro}render(...t){return t.find(e=>!uh(e))??it}update(t,e){let r=this._$Cbt,i=r.length;this._$Cbt=e;let n=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!uh(l))return this._$Cwt=a,l;a<i&&l===r[a]||(this._$Cwt=mh,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=n.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Mo=Dt(vl);var Po=`
|
|
224
|
+
`}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return v``}};Dm([p({type:String})],Zi.prototype,"access",void 0);var Ao=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Me=class extends E{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return v` <slot></slot>`}};Ao([p({type:String})],Me.prototype,"identifier",void 0);Ao([p({type:String})],Me.prototype,"class",void 0);Ao([p({type:String,attribute:"navigation-mode"})],Me.prototype,"navigationMode",void 0);Ao([p({type:String,attribute:"submission-mode"})],Me.prototype,"submissionMode",void 0);var $m=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},tn=class extends S{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",r=this.getAttribute("variable-identifier"),i=Vr(t,Lr(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new fl(this._testContext,r,i).calculate()}calculate(){return this.getResult()}};$m([I({context:nt,subscribe:!0})],tn.prototype,"_testContext",void 0);var fl=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let t=this.testContext?.items??[],e=0,r=[...new Set(this.includedItems.map(i=>i.item))];return t.forEach(i=>{if(r.includes(i.identifier)){let n=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;if(n){let a=Number(n.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var _o=Symbol("itemFacts");var en="qti-assessment-section",To="qti-test-part",$t=o=>o.identifier||o.getAttribute("identifier")||"";function rh(o,t){let e=o[t],r=t+1,i=Nm(e,o,t);if(i){let s=Lm(i,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map($t)};s>t?r=s:console.warn(`qti-branch-rule target "${i.target}" is not ahead of "${$t(e)}", ignored`)}let n=o.slice(t+1,r).map($t);for(let s=r;s<o.length;s++){if(nh(o[s],e))return{id:$t(o[s]),skipped:n};n.push($t(o[s]))}return{id:null,skipped:n}}function ih(o){let t=[];for(let e of o){if(nh(e,null))return{id:$t(e),skipped:t};t.push($t(e))}return{id:null,skipped:t}}function Nm(o,t,e){let r=[o];for(let i=o.parentElement;i&&(i.localName===en||i.localName===To)&&!i.contains(t[e+1]??null);i=i.parentElement)r.push(i);for(let i of r)for(let n of i.querySelectorAll(":scope > qti-branch-rule"))if(n.evaluate?.())return n;return null}function Lm(o,t,e){let r=o.parentElement,i=n=>{if(!n)return null;let s=t.findLastIndex(a=>n.contains(a));return s+1<t.length?s+1:null};switch(o.target){case de.EXIT_TEST:return null;case de.EXIT_TESTPART:return i(r.closest(To));case de.EXIT_SECTION:{let n=r.localName===en?r:r.closest(en);return i(n??r)}default:{let n=t.findIndex(l=>$t(l)===o.target);if(n>=0)return n;let s=[...r.closest("qti-assessment-test")?.querySelectorAll(`${en}, ${To}`)??[]].find(l=>l.getAttribute("identifier")===o.target),a=s?t.findIndex(l=>s.contains(l)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function nh(o,t){let e=[o];for(let r=o.parentElement;r&&(r.localName===en||r.localName===To);r=r.parentElement)(!t||!r.contains(t))&&e.push(r);return e.every(r=>[...r.querySelectorAll(":scope > qti-pre-condition")].every(i=>i.evaluate?.()??!0))}var rn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},oh=o=>{class t extends o{constructor(...r){super(...r),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this.itemFacts=new Map,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(r,i){let n=i||this._getDefaultNavigationId(r);n&&F(this,"qc-test-navigate",{type:r,id:n})}_bindEventHandlers(){B(this,"qc-test-navigate",this._handleNavigationRequest.bind(this)),B(this,"qc-test-loaded",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(r){this._testElement=r.detail,this.itemFacts=new Map,this._initializeNavigation()}_handleItemConnected(r){let i=r.detail;this._loadingState.connectedItems++;let n=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:n}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:n.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,n),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.href)}}_getDefaultNavigationId(r){return r==="section"?this.sessionContext?.navSectionId??this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let r=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(i[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let n=ih(i);if(n.skipped.length&&F(this,"qc-test-items-skipped",{ids:n.skipped}),n.id===null){F(this,"qc-test-end-reached",{});return}r=n.id}}r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,i){let n=this.sessionContext?.navItemRefId;if(!n||r==="item"&&i===n)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!s||s.closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return!1;let a=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),l=a.findIndex(c=>c.identifier===n);if(r==="item"){let c=a.findIndex(d=>d.identifier===i);return c===-1||l===-1?!1:c!==l+1}return!0}_resolveLinearNext(r,i){if(r!=="item"||!this._testElement)return;let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=n.findIndex(l=>$t(l)===this.sessionContext?.navItemRefId);if(s<0||!n[s+1]||$t(n[s+1])!==i||n[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=rh(n,s);if(a.id!==i)return a}async _handleNavigationRequest({detail:r}){if(!r?.id)return;let i=this._resolveLinearNext(r.type,r.id);if(i?.id===null){i.skipped.length&&F(this,"qc-test-items-skipped",{ids:i.skipped}),F(this,"qc-test-end-reached",{});return}let n=i?.id??r.id;if(!i&&this._isLinearNavigationRestricted(r.type,n)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(r.type,n),this._activeController=a,await this._executeNavigation(r.type,n,s,a),i?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&F(this,"qc-test-items-skipped",{ids:i.skipped})}catch(l){this._handleNavigationError(l,r.type,n)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(r.type,n)}}_handleNavigationError(r,i,n){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,n))}async _executeNavigation(r,i,n,s){r==="item"?await this._navigateToItem(i,n,s):await this._navigateToSection(i,n,s)}async _navigateToItem(r,i,n){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"item",r)}async _navigateToSection(r,i,n){let a=this._findSection(r)?.closest("qti-test-part")?.identifier,l=this._getSectionItemIds(r);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:this.navigate==="item"?l[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"section",r)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let r=this._loadingState.connectedItems>=this._loadingState.expectedItems,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,i))return;await new Promise(n=>setTimeout(n,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let n=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,r,i)}_applyStimulusContent(r,i,n){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],l=n.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.identifier}"]`));if(c.length>0)a=c,console.info("Found targets by identifier:",c.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((c,d)=>{c.innerHTML="",c.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,i,n){if(!this._testElement||r.length===0)return;let s=r.map(d=>this._findItemRef(d));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(d=>this._loadSingleItem(d,i,n)))).filter(Boolean);if(this._isStaleNavigation(i,n))return;let c=new Map(this.itemFacts);l.forEach(({itemRef:d,doc:h,facts:f})=>{d&&h&&(d.xmlDoc=h),d&&f&&c.set(d.identifier,f)}),this.itemFacts=c,l.forEach(({itemRef:d})=>{let h=d?.identifier;if(!d||!h)return;let f=this.testContext.items.find(m=>m.identifier===h)?.state;f!==void 0&&d.updateComplete.then(()=>{let m=d.assessmentItem;m&&(m.state=f)})}),this._loadResults=l}async _loadSingleItem(r,i,n){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Jt().load(r.href,n.signal)).shuffleInteractions(s);if(this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,n))return null;let l=a.xmlDoc().documentElement,c=l?.localName==="qti-assessment-item"?Td(l):null;return{itemRef:r,doc:a.htmlDoc(this._customElementRegistry()),facts:c}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${r.identifier} was aborted`),s;return console.warn(`Failed to load item ${r.identifier}:`,s),null}}async _loadStimulus(r){return(await Jt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!i)throw new Error(`Item with identifier "${r}" not found`);return i}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,i){let n=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:s,navItemRefId:i}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,i){return i.signal.aborted||r!==this._navigationId}_createNavigationError(r,i,n){return{message:r.message||`Failed to load ${i}: ${n}`,details:r,itemId:i==="item"?n:void 0,sectionId:i==="section"?n:void 0}}_dispatchLoadingStarted(r,i){F(this,"qc-test-navigation-started",{type:r,id:i})}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchError(r){F(this,"qc-test-navigation-failed",r)}_dispatchTestLoaded(r,i,n){requestAnimationFrame(()=>{F(this,"qc-test-rendered",r.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),F(this,"qc-test-navigated",{type:i,id:n})})}}return rn([p({type:String})],t.prototype,"navigate",void 0),rn([p({type:Number})],t.prototype,"requestTimeout",void 0),rn([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),rn([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),rn([T(),Q({context:_o})],t.prototype,"itemFacts",void 0),t};var sh=o=>{class t extends o{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},B(this,"qc-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),B(this,"qc-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(r){super.willUpdate(r),r.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let n=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;n&&this.updateAssessmentItemView(n,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return t};var ah=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gl=o=>{class t extends o{constructor(...r){super(...r),this.testContext=Ja,this.sessionContext=Ga,this._updateItemInTestContext=i=>{let n=i.itemContext,s=n.identifier,a=n.variables,l=this.testContext.items.find(c=>c?.identifier===s);if(!l){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(l.variables?.length===1)this._updateItemVariablesInTestContext(s,a,void 0,n.valid);else{let c=[...i.variables];for(let d of l.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}i.variables=c,this.#t(s,c.find(d=>d.identifier==="completionStatus")?.value),l.state&&(i.state=l.state)}},this._initializeEventListeners()}updateItemVariables(r,i,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==r)return a;let l=[...a.variables??[]];for(let{identifier:c,type:d,value:h}of i){let f=l.findIndex(y=>y.identifier===c),m={...f>=0?l[f]:{},identifier:c,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?l[f]=m:l.push(m)}return{...a,variables:l,...n?{state:{...n}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(r)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===r)?.variables??[]],n&&(s.state=n))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=Ja,this.sessionContext=Ga}),B(this,"qc-test-loaded",r=>{this._testElement=r.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(n=>({href:n.href,identifier:n.identifier,category:n.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",r=>{let i=r.detail,n=i.closest("qti-assessment-item-ref")?.identifier;n&&(i.assessmentItemRefId=n),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables,r.detail.itemContext.state,r.detail.itemContext.valid)})}_updateItemVariablesInTestContext(r,i,n,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:i.map(l=>{let c=a.variables.find(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...n!==void 0?{state:n?{...n}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(r,i){typeof i!="string"||i==="not_attempted"||this.testContext.items.find(a=>a.identifier===r)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:a.variables.map(l=>l.identifier==="completionStatus"?{...l,value:i}:l)})})}}return ah([p({attribute:!1,type:Object}),Q({context:nt})],t.prototype,"testContext",void 0),ah([p({attribute:!1,type:Object}),Q({context:eo})],t.prototype,"sessionContext",void 0),t},lh=class extends gl(E){};var nn=1;var Vm=["response","outcome","template","context"],ch=o=>o==null?null:Array.isArray(o)?o.map(String):String(o),jm=({identifier:o,type:t,value:e})=>({identifier:o,...Vm.includes(t)?{type:t}:{},value:ch(e)}),dh=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e?.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(jm),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:ch(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}});var Fm=o=>Array.isArray(o)?[...o]:o??null,zm=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},hh=o=>{class t extends o{#t=null;#e=!1;#r=null;constructor(...r){super(...r),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#r=null}),B(this,"qc-test-update-plugin-state",({detail:i})=>this.#i(i)),B(this,"qc-test-loaded",()=>{this.#t&&(this.#n(this.#t),this.#t=null),this.#e=!0})}#i({plugin:r,value:i}){if(typeof r!="string"||r==="")return;let{[r]:n,...s}=this.sessionContext.plugins??{},a=s;if(i!=null)try{a={...s,[r]:JSON.parse(JSON.stringify(i))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${r}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return dh(this.testContext,this.sessionContext)}set state(r){if(!zm(r)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=r;return}let{navItemRefId:i,navSectionId:n}=this.sessionContext;this.#n(r);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==i?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==n&&this.#s("section",s.navSectionId)}updated(r){if(super.updated(r),!this.#e||!(r.has("testContext")||r.has("sessionContext")))return;let i=this.state,n=JSON.stringify(i);n!==this.#r&&(this.#r=n,F(this,"qc-test-state-changed",i))}#n(r){for(let n of r.test.items)this.updateItemVariables(n.identifier,n.variables,n.state);let i=new Map(r.test.outcomes.map(n=>[n.identifier,n.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>i.has(n.identifier)?{...n,value:Fm(i.get(n.identifier))}:n)},this.sessionContext={...this.sessionContext,...this.#o(r.session),plugins:r.session.plugins&&typeof r.session.plugins=="object"?{...r.session.plugins}:{}}}#o(r){let i=(n,s)=>!!s&&!!this._testElement?.querySelector(`${n}[identifier="${CSS.escape(s)}"]`);return{...i("qti-test-part",r.navPartId)?{navPartId:r.navPartId}:{},...i("qti-assessment-section",r.navSectionId)?{navSectionId:r.navSectionId}:{},...this.testContext.items.some(n=>n.identifier===r.navItemRefId)?{navItemRefId:r.navItemRefId}:{}}}#s(r,i){F(this,"qc-test-navigate",{type:r,id:i})}}return t};var ph=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),B(this,"qc-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:n,value:s}=i.detail;this.updateOutcomeVariable(n,s),i.stopPropagation()})}outcomeProcessing(){let r=(this._testElement??this).querySelector("qti-outcome-processing");return r?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>({...i,value:i.defaultValue??null}))},r.process(),!0):!1}submit(){return this.outcomeProcessing()?(F(this,"qc-test-submitted",{}),!0):!1}getTestFeedback(r){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(n=>(!r||n.access===r)&&n.matches(this.getOutcome(n.outcomeIdentifier)?.value))}updateOutcomeVariable(r,i){let n=this.getOutcome(r);if(!n){console.warn(`Can not set qti-outcome-identifier: ${r}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==r?s:{...s,value:n.cardinality==="single"?i:[...s.value,i]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===r)||null}}return t};var uh=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Pe=class extends oh(sh(ph(hh(gl(E))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Ut(this,{context:Ee,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};uh([T(),Q({context:yt})],Pe.prototype,"configContext",void 0);uh([T(),Q({context:qt})],Pe.prototype,"qtiContext",void 0);var Io=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Ro=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var mh=o=>!Jd(o)&&typeof o.then=="function",fh=1073741823,bl=class extends Re{constructor(){super(...arguments),this._$Cwt=fh,this._$Cbt=[],this._$CK=new Io(this),this._$CX=new Ro}render(...t){return t.find(e=>!mh(e))??it}update(t,e){let r=this._$Cbt,i=r.length;this._$Cbt=e;let n=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!mh(l))return this._$Cwt=a,l;a<i&&l===r[a]||(this._$Cwt=fh,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=n.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Mo=Dt(bl);var Po=`
|
|
225
225
|
@layer qti-base, qti-components, qti-extended;
|
|
226
226
|
|
|
227
227
|
@layer qti-components.reset, qti-components.global, qti-components.interactions.base,
|
|
@@ -6311,12 +6311,12 @@ div.full-correct-response-inline {
|
|
|
6311
6311
|
${this.#t}
|
|
6312
6312
|
<slot></slot>
|
|
6313
6313
|
${Mo(this.testDoc,v`<span>Loading...</span>`)}
|
|
6314
|
-
`}};Oe([p({attribute:!1})],kt.prototype,"customElementRegistry",void 0);Oe([p({type:String,attribute:"test-url"})],kt.prototype,"testURL",void 0);Oe([T()],kt.prototype,"testDoc",void 0);Oe([T()],kt.prototype,"testXML",void 0);Oe([I({context:Ee,subscribe:!0})],kt.prototype,"testHost",void 0);Oe([T(),I({context:qt,subscribe:!0})],kt.prototype,"qtiContext",void 0);Oe([N("testURL",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestURLChange",null);Oe([N("testXML",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestXMLChange",null);var Oo=w`var(--qti-color-base-100, var(--qc-color-base-100, var(--cito-color-base-100, Canvas)))`,
|
|
6314
|
+
`}};Oe([p({attribute:!1})],kt.prototype,"customElementRegistry",void 0);Oe([p({type:String,attribute:"test-url"})],kt.prototype,"testURL",void 0);Oe([T()],kt.prototype,"testDoc",void 0);Oe([T()],kt.prototype,"testXML",void 0);Oe([I({context:Ee,subscribe:!0})],kt.prototype,"testHost",void 0);Oe([T(),I({context:qt,subscribe:!0})],kt.prototype,"qtiContext",void 0);Oe([N("testURL",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestURLChange",null);Oe([N("testXML",{waitUntilFirstUpdate:!0})],kt.prototype,"handleTestXMLChange",null);var Oo=w`var(--qti-color-base-100, var(--qc-color-base-100, var(--cito-color-base-100, Canvas)))`,vl=w`var(--qti-color-base-content, var(--qc-color-base-content, var(--cito-color-base-content, CanvasText)))`,Do=w`var(--qti-color-neutral, var(--qc-color-neutral, var(--cito-color-neutral, CanvasText)))`,yl=w`var(--qti-color-neutral-content, var(--qc-color-neutral-content, var(--cito-color-neutral-content, Canvas)))`,gh=w`var(--button-border-radius, var(--test-button-border-radius, var(--qti-radius-field, var(--qc-radius-field, var(--cito-radius-field, 0.2rem)))))`,bh=w`var(--qti-border-width, var(--qc-border-width, var(--cito-border-width, 1px)))`,Bm=w`
|
|
6315
6315
|
display: inline-flex;
|
|
6316
6316
|
cursor: pointer;
|
|
6317
6317
|
user-select: none;
|
|
6318
|
-
border-radius: ${
|
|
6319
|
-
`,
|
|
6318
|
+
border-radius: ${gh};
|
|
6319
|
+
`,vh=w`
|
|
6320
6320
|
display: flex;
|
|
6321
6321
|
flex: 1 1 auto;
|
|
6322
6322
|
align-items: center;
|
|
@@ -6329,69 +6329,69 @@ div.full-correct-response-inline {
|
|
|
6329
6329
|
line-height: 1.25;
|
|
6330
6330
|
cursor: pointer;
|
|
6331
6331
|
user-select: none;
|
|
6332
|
-
border-radius: ${
|
|
6333
|
-
`,
|
|
6334
|
-
${
|
|
6332
|
+
border-radius: ${gh};
|
|
6333
|
+
`,Um=w`
|
|
6334
|
+
${vh};
|
|
6335
6335
|
background-color: var(--button-background-color, var(--test-button-background-color, ${Oo}));
|
|
6336
6336
|
color: var(--button-color, var(--test-button-color, inherit));
|
|
6337
|
-
border: ${
|
|
6337
|
+
border: ${bh} solid
|
|
6338
6338
|
var(
|
|
6339
6339
|
--button-border-color,
|
|
6340
|
-
var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${
|
|
6340
|
+
var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${vl} 45%, ${Oo})))
|
|
6341
6341
|
);
|
|
6342
|
-
`,
|
|
6342
|
+
`,Hm=w`
|
|
6343
6343
|
background-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${Do}));
|
|
6344
|
-
color: var(--button-primary-color, var(--test-button-primary-color, ${
|
|
6344
|
+
color: var(--button-primary-color, var(--test-button-primary-color, ${yl}));
|
|
6345
6345
|
border-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${Do}));
|
|
6346
|
-
`,
|
|
6346
|
+
`,Wm=w`
|
|
6347
6347
|
background-color: var(
|
|
6348
6348
|
--button-hover-background-color,
|
|
6349
|
-
var(--test-button-hover-background-color, color-mix(in oklab, ${Oo}, ${
|
|
6349
|
+
var(--test-button-hover-background-color, color-mix(in oklab, ${Oo}, ${vl} var(--qti-hover-mix, 8%)))
|
|
6350
6350
|
);
|
|
6351
|
-
`,
|
|
6351
|
+
`,Qm=w`
|
|
6352
6352
|
background-color: var(
|
|
6353
6353
|
--button-primary-hover-background-color,
|
|
6354
6354
|
var(
|
|
6355
6355
|
--test-button-primary-hover-background-color,
|
|
6356
|
-
color-mix(in oklab, ${Do}, ${
|
|
6356
|
+
color-mix(in oklab, ${Do}, ${yl} var(--qti-hover-mix, 8%))
|
|
6357
6357
|
)
|
|
6358
6358
|
);
|
|
6359
|
-
`,
|
|
6359
|
+
`,Xm=w`
|
|
6360
6360
|
background-color: var(
|
|
6361
6361
|
--button-active-background-color,
|
|
6362
|
-
var(--test-button-active-background-color, color-mix(in oklab, ${Oo}, ${
|
|
6362
|
+
var(--test-button-active-background-color, color-mix(in oklab, ${Oo}, ${vl} var(--qti-active-mix, 16%)))
|
|
6363
6363
|
);
|
|
6364
|
-
`,
|
|
6364
|
+
`,Gm=w`
|
|
6365
6365
|
background-color: var(
|
|
6366
6366
|
--button-primary-active-background-color,
|
|
6367
6367
|
var(
|
|
6368
6368
|
--test-button-primary-active-background-color,
|
|
6369
|
-
color-mix(in oklab, ${Do}, ${
|
|
6369
|
+
color-mix(in oklab, ${Do}, ${yl} var(--qti-active-mix, 16%))
|
|
6370
6370
|
)
|
|
6371
6371
|
);
|
|
6372
|
-
`,
|
|
6372
|
+
`,Jm=w`
|
|
6373
6373
|
outline: var(--qti-focus-border-width, 2px) solid var(--qti-focus-color, Highlight);
|
|
6374
6374
|
outline-offset: var(--qti-focus-offset, 2px);
|
|
6375
|
-
`,
|
|
6375
|
+
`,Ym=w`
|
|
6376
6376
|
cursor: not-allowed;
|
|
6377
6377
|
opacity: 0.45;
|
|
6378
|
-
`,
|
|
6379
|
-
${
|
|
6380
|
-
border: ${
|
|
6378
|
+
`,nE=w`
|
|
6379
|
+
${vh};
|
|
6380
|
+
border: ${bh} solid var(--qti-border-color, GrayText);
|
|
6381
6381
|
`,De=v`<span class="control" part="button"><slot></slot></span>`,$e=w`
|
|
6382
6382
|
:host {
|
|
6383
|
-
${
|
|
6383
|
+
${Bm};
|
|
6384
6384
|
}
|
|
6385
6385
|
.control {
|
|
6386
|
-
${
|
|
6386
|
+
${Um};
|
|
6387
6387
|
}
|
|
6388
6388
|
@media (hover: hover) and (pointer: fine) {
|
|
6389
6389
|
:host(:hover:not([disabled])) .control {
|
|
6390
|
-
${
|
|
6390
|
+
${Wm};
|
|
6391
6391
|
}
|
|
6392
6392
|
}
|
|
6393
6393
|
:host(:active:not([disabled])) .control {
|
|
6394
|
-
${
|
|
6394
|
+
${Xm};
|
|
6395
6395
|
}
|
|
6396
6396
|
/* The press the theme gives a choice (qti-motion.css), from the same knob: a touch smaller while
|
|
6397
6397
|
the button is down, springing back on release; 0 motion means no press. */
|
|
@@ -6404,31 +6404,31 @@ div.full-correct-response-inline {
|
|
|
6404
6404
|
scale: calc(1 - 0.03 * var(--qti-motion, 1));
|
|
6405
6405
|
}
|
|
6406
6406
|
:host(:focus-visible) {
|
|
6407
|
-
${
|
|
6407
|
+
${Jm};
|
|
6408
6408
|
}
|
|
6409
6409
|
:host([disabled]) {
|
|
6410
|
-
${
|
|
6410
|
+
${Ym};
|
|
6411
6411
|
}
|
|
6412
6412
|
:host([disabled]) .control {
|
|
6413
6413
|
cursor: not-allowed;
|
|
6414
6414
|
}
|
|
6415
|
-
`,
|
|
6415
|
+
`,yh=w`
|
|
6416
6416
|
.control {
|
|
6417
|
-
${
|
|
6417
|
+
${Hm};
|
|
6418
6418
|
}
|
|
6419
6419
|
@media (hover: hover) and (pointer: fine) {
|
|
6420
6420
|
:host(:hover:not([disabled])) .control {
|
|
6421
|
-
${
|
|
6421
|
+
${Qm};
|
|
6422
6422
|
}
|
|
6423
6423
|
}
|
|
6424
6424
|
:host(:active:not([disabled])) .control {
|
|
6425
|
-
${
|
|
6425
|
+
${Gm};
|
|
6426
6426
|
}
|
|
6427
|
-
`;var nn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},yh=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?yh(e.host):void 0},ge=class extends E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=$e}constructor(){super(),this._internalDisabled=!1,this.requireAnswer=!1,this.addEventListener("click",t=>{if(t.preventDefault(),!this._internalDisabled){let e=this.#t;F(this,"qc-test-end-attempt",e?{itemId:e}:{})}})}get#t(){return this.item||yh(this)}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts,e=this.#t,r=t?.find(a=>a.active);if(!t||!e&&!r)return;let i=e?t.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.identifier===e):r.sections.flatMap(a=>a.items).find(a=>a.active);if(!i){this._internalDisabled=!1;return}let n=i.sessionControl?.maxAttempts??1,s=i.numAttempts||0;if(!i.adaptive&&i.optimal){this._internalDisabled=!0;return}if(i.adaptive&&i.completionStatus==="completed"){this._internalDisabled=!0;return}if(!i.adaptive&&n>0&&s>=n){this._internalDisabled=!0;return}this.requireAnswer||i.sessionControl?.allowSkipping===!1?this._internalDisabled=i.valid===!1||i.isDefaultResponse:this._internalDisabled=!1}render(){return De}};nn([I({context:lt,subscribe:!0}),p({attribute:!1})],ge.prototype,"computedContext",void 0);nn([p({type:Boolean,reflect:!0,attribute:"disabled"})],ge.prototype,"_internalDisabled",void 0);nn([p({reflect:!0})],ge.prototype,"item",void 0);nn([p({type:Boolean,reflect:!0,attribute:"require-answer"})],ge.prototype,"requireAnswer",void 0);nn([N("computedContext")],ge.prototype,"_handleTestElementChange",null);function xl(o){return{nodeType:o.nodeType,localName:o.localName,get childNodes(){return Array.from(o.children,xl)},getAttribute:t=>o.getAttribute(t)??(t==="title"?o.getAttribute("data-title"):null)}}var Ne=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Gm=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),ct=class extends E{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=Gm())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#r(t)}#t;#e;#r(t){let e=this.#n();e?e.qtiContext=t:this.#t=t}#i;#n(){return this.#i.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#i=new at(this,{context:Ee,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#p=t=>this.#l(t)??null,this.#f=new Map,this.#m=[],this.#y=new WeakSet,B(this,"qc-test-loaded",this.#u.bind(this)),fd(this,"qc-item-response-changed",this.#h.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),B(this,"qc-test-end-attempt",this.#c.bind(this)),B(this,"qc-test-update-outcome",this.#d.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=this.#q(e);this.#s.set(e.identifier,r);let i=this.computedItemFor(e.identifier),n=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,this.#w(n,r,i?.sessionControl?.maxAttempts,i?.adaptive,s))}afterAttemptEnded(t,e,r){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#l(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#p;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#c(t){let e=t.detail?.itemId,r=e?this.#l(e):this.activeAssessmentItem;if(!r)return;let i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#d(t){let e=this.#l(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#h(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}}}render(){return v`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#r({QTI_CONTEXT:{...i,testIdentifier:this.#o.identifier,environmentIdentifier:i.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=this.#g(i);Object.keys(n).length>0&&this.#r({QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let r=Sd(xl(this.#o));this.#f=new Map(r.testParts.flatMap(i=>lo(i.sections).map(n=>[n.identifier,co(n.content).map(s=>s.identifier)]))),this.#m=r.testParts.flatMap(i=>co(i.sections)),this.computedContext={itemElement:this.#p,identifier:r.identifier,title:r.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:r.testParts.map(i=>({active:!1,identifier:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,allowSkipping:i.sessionControl.allowSkipping,sections:lo(i.sections).map(n=>({active:!1,identifier:n.identifier,title:n.title,allowSkipping:n.sessionControl.allowSkipping,items:Td(n).map(s=>({...this.initContext?.find(a=>a.identifier===s.identifier),active:!1,identifier:s.identifier,categories:s.categories,href:s.href,variables:[],sessionControl:{...s.sessionControl}}))}))}))}}#f;#m;#b(){let t=1;return new Map(this.#m.map(e=>[e.identifier,e.categories.includes(this.configContext?.infoItemCategory)?null:t++]))}#g(t){let e={},r=t.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let s=n.getAttribute("field-identifier"),a=n.getAttribute("base-type")||"string",l=n.textContent?.trim()||"";if(s){let c=l;switch(a){case"integer":c=parseInt(l,10);break;case"float":case"duration":c=parseFloat(l);break;case"boolean":c=l.toLowerCase()==="true";break;default:c=l;break}e[s]=c}}),e}#v(t){let e=this._itemFacts?.get(t);if(!e)return{};let{identifier:r,...i}=e;return{...i,assessmentItemIdentifier:r}}willUpdate(t){if(!this.computedContext)return;let e=this.#b();this.computedContext={...this.computedContext,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(r=>({...r,active:this._sessionContext?.navPartId===r.identifier||!1,sections:r.sections.map(i=>({...i,active:this._sessionContext?.navSectionId===i.identifier||!1,completed:(this.#f.get(i.identifier)??i.items.map(n=>n.identifier)).every(n=>this._testContext.items.find(s=>s.identifier===n)?.variables.find(s=>s.identifier==="completionStatus")?.value==="completed"),items:i.items.map(n=>{let s=this._testContext?.items.find(C=>C.identifier===n.identifier),a={...n,...this.#v(n.identifier),...s,...this.initContext?.find(C=>C.identifier===n.identifier)},l=a.variables?.find(C=>C.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(C=>C.identifier==="completionStatus")?.value,h=a.variables?.find(C=>C.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(C=>C.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(C=>C.type==="response"&&C.identifier!=="numAttempts")||[]).every(C=>{if(C.value===void 0||C.value===null)return!0;let k;switch(C.baseType){case"integer":case"float":case"duration":k="0";break;case"boolean":k="false";break;default:k="";break}let R=C.defaultValue??k;if(Array.isArray(C.value)){let $=Array.isArray(R)?R:[R];return C.value.length===$.length&&C.value.every((V,L)=>V===$[L])}return C.value===R}),g=e.get(n.identifier)??null,b=n.variables?.find(C=>C.identifier=="MAXSCORE")?.value,q=b==null?null:parseFloat(b?.toString()),_=this.#s.get(a.identifier);_===void 0&&(_=s?this.#q(s):"unscored",f>0&&this.#s.set(a.identifier,_));let A=this.#w(f,_,a.sessionControl?.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:y,isDefaultResponse:u,maxScore:q,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}updated(t){super.updated(t),this.#x()}#y;#x(){if(!this.#o||!this.computedContext)return;let t=new Map(this.computedContext.testParts.flatMap(e=>e.submissionMode==="simultaneous"?[]:e.sections.flatMap(r=>r.items.map(i=>[i.identifier,i]))));for(let e of this.#o.querySelectorAll("qti-assessment-item-ref")){let r=e.assessmentItem;if(!r)continue;let i=this.#C(t.get(e.identifier),r);i&&!r.disabled?(r.disabled=!0,this.#y.add(r)):!i&&this.#y.has(r)&&(this.#y.delete(r),r.disabled=!1)}}#C(t,e){if(!t||this.autoScoreItems||t.adaptive||e.adaptive==="true")return!1;let r=t.sessionControl?.maxAttempts??1;return r>0&&(t.numAttempts??0)>=r}#w(t,e,r,i,n){if(t===0)return!1;if(i)return n==="completed";if(e!=="suboptimal")return!0;let s=r??1;return s>0&&t>=s}#q(t){let e=t.variables??[],r=this.#k(e,"SCORE"),i=this.#k(e,"MAXSCORE");if(r!==null&&i!==null)return r>=i?"optimal":"suboptimal";let n=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return n.length===0?"unscored":n.every(a=>{let l=a.correctResponse,c=a.value;return c==null?!1:Array.isArray(l)&&Array.isArray(c)?l.length===c.length&&l.every(d=>c.includes(d)):Array.isArray(l)||Array.isArray(c)?!1:l===c})?"optimal":"suboptimal"}#k(t,e){let r=t?.find(n=>n.identifier===e)?.value;if(r==null||Array.isArray(r))return null;let i=parseFloat(r.toString());return Number.isNaN(i)?null:i}};Ne([p({type:String})],ct.prototype,"identifier",void 0);Ne([T()],ct.prototype,"initContext",void 0);Ne([T(),I({context:yt,subscribe:!0})],ct.prototype,"configContext",void 0);Ne([T(),I({context:nt,subscribe:!0})],ct.prototype,"_testContext",void 0);Ne([T(),I({context:to,subscribe:!0})],ct.prototype,"_sessionContext",void 0);Ne([T(),I({context:Ao,subscribe:!0})],ct.prototype,"_itemFacts",void 0);Ne([T(),Q({context:lt})],ct.prototype,"computedContext",void 0);Ne([p({type:Boolean,attribute:"auto-score-items"})],ct.prototype,"autoScoreItems",void 0);var wl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lr=class extends E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[$e,vh]}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(i=>i.active);if(!t)return;let e=this.sectionItems[this.itemIndex],r=t.navigationMode==="linear"&&t.submissionMode==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||r&&!e?.done}_requestItem(t){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return De}};wl([p({type:Boolean,reflect:!0,attribute:"disabled"})],lr.prototype,"_internalDisabled",void 0);wl([I({context:lt,subscribe:!0})],lr.prototype,"computedContext",void 0);wl([N("computedContext")],lr.prototype,"_handleTestElementChange",null);var Cl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},cr=class extends E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=$e}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let e=this.computedContext?.testParts.find(r=>r.active)?.navigationMode??"nonlinear";this._internalDisabled=e==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return De}};Cl([p({type:Boolean,reflect:!0,attribute:"disabled"})],cr.prototype,"_internalDisabled",void 0);Cl([I({context:lt,subscribe:!0})],cr.prototype,"computedContext",void 0);Cl([N("computedContext")],cr.prototype,"_handleTestElementChange",null);var No=class extends E{static{this.styles=$e}constructor(){super(),this.addEventListener("click",()=>F(this,"qc-test-submit",{}))}render(){return De}};var qh=[{tag:"test-submit",ctor:No}];var xh=[{tag:"qti-assessment-item-ref",ctor:wt},{tag:"qti-assessment-section",ctor:Gt},{tag:"qti-assessment-test",ctor:or},{tag:"qti-branch-rule",ctor:de},{tag:"qti-item-session-control",ctor:Pt},{tag:"qti-number-presented",ctor:Ui},{tag:"qti-number-selected",ctor:no},{tag:"qti-outcome-processing",ctor:so},{tag:"qti-pre-condition",ctor:oo},{tag:"qti-test",ctor:Pe},{tag:"qti-test-feedback",ctor:Zi},{tag:"qti-test-part",ctor:Me},{tag:"qti-test-variables",ctor:tn},{tag:"test-container",ctor:kt},{tag:"test-end-attempt",ctor:ge},{tag:"test-navigation",ctor:ct},{tag:"test-next",ctor:lr},{tag:"test-prev",ctor:cr},...qh];for(let{tag:o,ctor:t}of xh)customElements.get(o)||customElements.define(o,t);var TS=(o,t)=>o?.plugins?.[t];var dr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Nt=class extends E{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Jt().load(this.itemURL)).shuffleInteractions(t);this.itemDoc=e.htmlDoc(this.#e??void 0)}catch(t){console.error("Error loading or parsing XML:",t)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Jt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#r(){let t=this.querySelector("template");this.#t=t?t.content:v``}#i(){let t=new CSSStyleSheet;t.replaceSync(Po),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
|
|
6427
|
+
`;var on=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qh=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?qh(e.host):void 0},ge=class extends E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=$e}constructor(){super(),this._internalDisabled=!1,this.requireAnswer=!1,this.addEventListener("click",t=>{if(t.preventDefault(),!this._internalDisabled){let e=this.#t;F(this,"qc-test-end-attempt",e?{itemId:e}:{})}})}get#t(){return this.item||qh(this)}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts,e=this.#t,r=t?.find(a=>a.active);if(!t||!e&&!r)return;let i=e?t.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.identifier===e):r.sections.flatMap(a=>a.items).find(a=>a.active);if(!i){this._internalDisabled=!1;return}let n=i.sessionControl?.maxAttempts??1,s=i.numAttempts||0;if(!i.adaptive&&i.optimal){this._internalDisabled=!0;return}if(i.adaptive&&i.completionStatus==="completed"){this._internalDisabled=!0;return}if(!i.adaptive&&n>0&&s>=n){this._internalDisabled=!0;return}this.requireAnswer||i.sessionControl?.allowSkipping===!1?this._internalDisabled=i.valid===!1||i.isDefaultResponse:this._internalDisabled=!1}render(){return De}};on([I({context:lt,subscribe:!0}),p({attribute:!1})],ge.prototype,"computedContext",void 0);on([p({type:Boolean,reflect:!0,attribute:"disabled"})],ge.prototype,"_internalDisabled",void 0);on([p({reflect:!0})],ge.prototype,"item",void 0);on([p({type:Boolean,reflect:!0,attribute:"require-answer"})],ge.prototype,"requireAnswer",void 0);on([N("computedContext")],ge.prototype,"_handleTestElementChange",null);function ql(o){return{nodeType:o.nodeType,localName:o.localName,get childNodes(){return Array.from(o.children,ql)},getAttribute:t=>o.getAttribute(t)??(t==="title"?o.getAttribute("data-title"):null)}}var Ne=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Km=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),ct=class extends E{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=Km())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#r(t)}#t;#e;#r(t){let e=this.#n();e?e.qtiContext=t:this.#t=t}#i;#n(){return this.#i.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#i=new at(this,{context:Ee,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#p=t=>this.#l(t)??null,this.#f=new Map,this.#m=[],this.#y=new WeakSet,B(this,"qc-test-loaded",this.#u.bind(this)),md(this,"qc-item-response-changed",this.#h.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),B(this,"qc-test-end-attempt",this.#c.bind(this)),B(this,"qc-test-update-outcome",this.#d.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=this.#q(e);this.#s.set(e.identifier,r);let i=this.computedItemFor(e.identifier),n=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,this.#w(n,r,i?.sessionControl?.maxAttempts,i?.adaptive,s))}afterAttemptEnded(t,e,r){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#l(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#p;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#c(t){let e=t.detail?.itemId,r=e?this.#l(e):this.activeAssessmentItem;if(!r)return;let i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#d(t){let e=this.#l(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#h(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}}}render(){return v`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#r({QTI_CONTEXT:{...i,testIdentifier:this.#o.identifier,environmentIdentifier:i.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=this.#g(i);Object.keys(n).length>0&&this.#r({QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let r=Ed(ql(this.#o));this.#f=new Map(r.testParts.flatMap(i=>co(i.sections).map(n=>[n.identifier,ho(n.content).map(s=>s.identifier)]))),this.#m=r.testParts.flatMap(i=>ho(i.sections)),this.computedContext={itemElement:this.#p,identifier:r.identifier,title:r.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:r.testParts.map(i=>({active:!1,identifier:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,allowSkipping:i.sessionControl.allowSkipping,sections:co(i.sections).map(n=>({active:!1,identifier:n.identifier,title:n.title,allowSkipping:n.sessionControl.allowSkipping,items:_d(n).map(s=>({...this.initContext?.find(a=>a.identifier===s.identifier),active:!1,identifier:s.identifier,categories:s.categories,href:s.href,variables:[],sessionControl:{...s.sessionControl}}))}))}))}}#f;#m;#b(){let t=1;return new Map(this.#m.map(e=>[e.identifier,e.categories.includes(this.configContext?.infoItemCategory)?null:t++]))}#g(t){let e={},r=t.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let s=n.getAttribute("field-identifier"),a=n.getAttribute("base-type")||"string",l=n.textContent?.trim()||"";if(s){let c=l;switch(a){case"integer":c=parseInt(l,10);break;case"float":case"duration":c=parseFloat(l);break;case"boolean":c=l.toLowerCase()==="true";break;default:c=l;break}e[s]=c}}),e}#v(t){let e=this._itemFacts?.get(t);if(!e)return{};let{identifier:r,...i}=e;return{...i,assessmentItemIdentifier:r}}willUpdate(t){if(!this.computedContext)return;let e=this.#b();this.computedContext={...this.computedContext,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(r=>({...r,active:this._sessionContext?.navPartId===r.identifier||!1,sections:r.sections.map(i=>({...i,active:this._sessionContext?.navSectionId===i.identifier||!1,completed:(this.#f.get(i.identifier)??i.items.map(n=>n.identifier)).every(n=>this._testContext.items.find(s=>s.identifier===n)?.variables.find(s=>s.identifier==="completionStatus")?.value==="completed"),items:i.items.map(n=>{let s=this._testContext?.items.find(C=>C.identifier===n.identifier),a={...n,...this.#v(n.identifier),...s,...this.initContext?.find(C=>C.identifier===n.identifier)},l=a.variables?.find(C=>C.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(C=>C.identifier==="completionStatus")?.value,h=a.variables?.find(C=>C.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(C=>C.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(C=>C.type==="response"&&C.identifier!=="numAttempts")||[]).every(C=>{if(C.value===void 0||C.value===null)return!0;let k;switch(C.baseType){case"integer":case"float":case"duration":k="0";break;case"boolean":k="false";break;default:k="";break}let R=C.defaultValue??k;if(Array.isArray(C.value)){let $=Array.isArray(R)?R:[R];return C.value.length===$.length&&C.value.every((V,L)=>V===$[L])}return C.value===R}),g=e.get(n.identifier)??null,b=n.variables?.find(C=>C.identifier=="MAXSCORE")?.value,q=b==null?null:parseFloat(b?.toString()),_=this.#s.get(a.identifier);_===void 0&&(_=s?this.#q(s):"unscored",f>0&&this.#s.set(a.identifier,_));let A=this.#w(f,_,a.sessionControl?.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:y,isDefaultResponse:u,maxScore:q,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}updated(t){super.updated(t),this.#x()}#y;#x(){if(!this.#o||!this.computedContext)return;let t=new Map(this.computedContext.testParts.flatMap(e=>e.submissionMode==="simultaneous"?[]:e.sections.flatMap(r=>r.items.map(i=>[i.identifier,i]))));for(let e of this.#o.querySelectorAll("qti-assessment-item-ref")){let r=e.assessmentItem;if(!r)continue;let i=this.#C(t.get(e.identifier),r);i&&!r.disabled?(r.disabled=!0,this.#y.add(r)):!i&&this.#y.has(r)&&(this.#y.delete(r),r.disabled=!1)}}#C(t,e){if(!t||this.autoScoreItems||t.adaptive||e.adaptive==="true")return!1;let r=t.sessionControl?.maxAttempts??1;return r>0&&(t.numAttempts??0)>=r}#w(t,e,r,i,n){if(t===0)return!1;if(i)return n==="completed";if(e!=="suboptimal")return!0;let s=r??1;return s>0&&t>=s}#q(t){let e=t.variables??[],r=this.#k(e,"SCORE"),i=this.#k(e,"MAXSCORE");if(r!==null&&i!==null)return r>=i?"optimal":"suboptimal";let n=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return n.length===0?"unscored":n.every(a=>{let l=a.correctResponse,c=a.value;return c==null?!1:Array.isArray(l)&&Array.isArray(c)?l.length===c.length&&l.every(d=>c.includes(d)):Array.isArray(l)||Array.isArray(c)?!1:l===c})?"optimal":"suboptimal"}#k(t,e){let r=t?.find(n=>n.identifier===e)?.value;if(r==null||Array.isArray(r))return null;let i=parseFloat(r.toString());return Number.isNaN(i)?null:i}};Ne([p({type:String})],ct.prototype,"identifier",void 0);Ne([T()],ct.prototype,"initContext",void 0);Ne([T(),I({context:yt,subscribe:!0})],ct.prototype,"configContext",void 0);Ne([T(),I({context:nt,subscribe:!0})],ct.prototype,"_testContext",void 0);Ne([T(),I({context:eo,subscribe:!0})],ct.prototype,"_sessionContext",void 0);Ne([T(),I({context:_o,subscribe:!0})],ct.prototype,"_itemFacts",void 0);Ne([T(),Q({context:lt})],ct.prototype,"computedContext",void 0);Ne([p({type:Boolean,attribute:"auto-score-items"})],ct.prototype,"autoScoreItems",void 0);var xl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lr=class extends E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[$e,yh]}#t;constructor(){super(),this._internalDisabled=!0,this.#t=this.attachInternals(),this.#t.role="button",this.#t.ariaLabel="Next item",this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let t=this.computedContext?.testParts.find(i=>i.active);if(!t)return;let e=this.sectionItems[this.itemIndex],r=t.navigationMode==="linear"&&t.submissionMode==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||r&&!e?.done}_requestItem(t){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return De}};xl([p({type:Boolean,reflect:!0,attribute:"disabled"})],lr.prototype,"_internalDisabled",void 0);xl([I({context:lt,subscribe:!0})],lr.prototype,"computedContext",void 0);xl([N("computedContext")],lr.prototype,"_handleTestElementChange",null);var wl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},cr=class extends E{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=$e}constructor(){super(),this._internalDisabled=!0,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext?.testParts.find(r=>r.active);e&&(this.sectionItems=e.sections.flatMap(r=>r.items),this.itemIndex=this.sectionItems.findIndex(r=>r.active),this.checkDisabled())}checkDisabled(){let e=this.computedContext?.testParts.find(r=>r.active)?.navigationMode??"nonlinear";this._internalDisabled=e==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return De}};wl([p({type:Boolean,reflect:!0,attribute:"disabled"})],cr.prototype,"_internalDisabled",void 0);wl([I({context:lt,subscribe:!0})],cr.prototype,"computedContext",void 0);wl([N("computedContext")],cr.prototype,"_handleTestElementChange",null);var No=class extends E{static{this.styles=$e}constructor(){super(),this.addEventListener("click",()=>F(this,"qc-test-submit",{}))}render(){return De}};var xh=[{tag:"test-submit",ctor:No}];var wh=[{tag:"qti-assessment-item-ref",ctor:wt},{tag:"qti-assessment-section",ctor:Gt},{tag:"qti-assessment-test",ctor:or},{tag:"qti-branch-rule",ctor:de},{tag:"qti-item-session-control",ctor:Pt},{tag:"qti-number-presented",ctor:Ui},{tag:"qti-number-selected",ctor:oo},{tag:"qti-outcome-processing",ctor:ao},{tag:"qti-pre-condition",ctor:so},{tag:"qti-test",ctor:Pe},{tag:"qti-test-feedback",ctor:Zi},{tag:"qti-test-part",ctor:Me},{tag:"qti-test-variables",ctor:tn},{tag:"test-container",ctor:kt},{tag:"test-end-attempt",ctor:ge},{tag:"test-navigation",ctor:ct},{tag:"test-next",ctor:lr},{tag:"test-prev",ctor:cr},...xh];for(let{tag:o,ctor:t}of wh)customElements.get(o)||customElements.define(o,t);var DS=(o,t)=>o?.plugins?.[t];var dr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Nt=class extends E{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Jt().load(this.itemURL)).shuffleInteractions(t);this.itemDoc=e.htmlDoc(this.#e??void 0)}catch(t){console.error("Error loading or parsing XML:",t)}}handleItemXMLChange(){if(this.itemXML)try{this.itemDoc=Jt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#r(){let t=this.querySelector("template");this.#t=t?t.content:v``}#i(){let t=new CSSStyleSheet;t.replaceSync(Po),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
|
|
6428
6428
|
${this.#t}
|
|
6429
6429
|
<slot></slot>
|
|
6430
6430
|
${Mo(this.itemDoc,v`<span>Loading...</span>`)}
|
|
6431
|
-
`}};dr([p({attribute:!1})],Nt.prototype,"customElementRegistry",void 0);dr([p({type:String,attribute:"item-url"})],Nt.prototype,"itemURL",void 0);dr([T()],Nt.prototype,"itemDoc",void 0);dr([T()],Nt.prototype,"itemXML",void 0);dr([T(),I({context:qt,subscribe:!0})],Nt.prototype,"qtiContext",void 0);dr([N("itemURL",{waitUntilFirstUpdate:!0})],Nt.prototype,"handleItemURLChange",null);dr([N("itemXML",{waitUntilFirstUpdate:!0})],Nt.prototype,"handleItemXMLChange",null);var
|
|
6431
|
+
`}};dr([p({attribute:!1})],Nt.prototype,"customElementRegistry",void 0);dr([p({type:String,attribute:"item-url"})],Nt.prototype,"itemURL",void 0);dr([T()],Nt.prototype,"itemDoc",void 0);dr([T()],Nt.prototype,"itemXML",void 0);dr([T(),I({context:qt,subscribe:!0})],Nt.prototype,"qtiContext",void 0);dr([N("itemURL",{waitUntilFirstUpdate:!0})],Nt.prototype,"handleItemURLChange",null);dr([N("itemXML",{waitUntilFirstUpdate:!0})],Nt.prototype,"handleItemXMLChange",null);var Zm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},sn=class extends E{static{this.styles=w`
|
|
6432
6432
|
table {
|
|
6433
6433
|
width: 100%;
|
|
6434
6434
|
border-collapse: collapse;
|
|
@@ -6475,7 +6475,7 @@ div.full-correct-response-inline {
|
|
|
6475
6475
|
</table>
|
|
6476
6476
|
`;return v`
|
|
6477
6477
|
${i(e,"Response Variables")} ${i(r,"Outcome Variables")}
|
|
6478
|
-
`}};
|
|
6478
|
+
`}};Zm([I({context:ke,subscribe:!0})],sn.prototype,"computedContext",void 0);var tf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ch=o=>{class t extends o{#t;constructor(...r){super(...r),this.view="candidate",this.addEventListener("qti-assessment-item-connected",i=>{this.#t=i.detail,this.#e()}),this.addEventListener("item-switch-view",i=>{this.view=i.detail})}willUpdate(r){super.willUpdate(r),r.has("view")&&this.#e()}#e(){let r=this.#t;r&&(r.querySelectorAll("[view]").forEach(i=>{i.classList.toggle("show",i.getAttribute("view")===this.view)}),this.updateAssessmentItemView(r,this.view))}updateAssessmentItemView(r,i){}}return tf([p({type:String})],t.prototype,"view",void 0),t};var Cl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},be=class extends Ch(E){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#r.bind(this),this.#e=this.#i.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#r(t){this.#n(t.detail.itemContext.identifier,t.detail?.itemContext?.variables||[])}#i(t){let e=t.detail._context.variables;this.assessmentItem=t.detail,this.computedContext=this.computedContext?.identifier===this.assessmentItem.identifier?{...this.computedContext,title:this.assessmentItem.title}:{identifier:this.assessmentItem.identifier,title:this.assessmentItem.title,adaptive:this.assessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:e},this.#n(this.assessmentItem.identifier,e||[])}#n(t,e){let r=e?.find(c=>c.identifier=="SCORE")?.value,i=parseFloat(r?.toString()),n=e?.find(c=>c.identifier==="completionStatus")?.value,s=i!==void 0&&!isNaN(i)&&i>0,a=i!==void 0&&!isNaN(i)&&i<=0,l=n==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:l,variables:e}}render(){return v`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};Cl([T(),Q({context:ke})],be.prototype,"computedContext",void 0);Cl([T(),Q({context:yt})],be.prototype,"configContext",void 0);Cl([T(),Q({context:qt})],be.prototype,"qtiContext",void 0);var kh=[{tag:"item-container",ctor:Nt},{tag:"item-print-variables",ctor:sn},{tag:"qti-item",ctor:be}];for(let{tag:o,ctor:t}of kh)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of eh)customElements.get(o)||customElements.define(o,t);var Eh=(o,t,e)=>{let r=new Map;for(let i=t;i<=e;i++)r.set(o[i],i);return r},H=Dt(class extends Te{constructor(o){if(super(o),o.type!==Xr.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let i=[],n=[],s=0;for(let a of o)i[s]=r?r(a,s):s,n[s]=e(a,s),s++;return{values:n,keys:i}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,r]){let i=Zd(o),{values:n,keys:s}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=s,n;let a=this.ut??=[],l=[],c,d,h=0,f=i.length-1,m=0,y=n.length-1;for(;h<=f&&m<=y;)if(i[h]===null)h++;else if(i[f]===null)f--;else if(a[h]===s[m])l[m]=Ie(i[h],n[m]),h++,m++;else if(a[f]===s[y])l[y]=Ie(i[f],n[y]),f--,y--;else if(a[h]===s[y])l[y]=Ie(i[h],n[y]),Gr(o,l[y+1],i[h]),h++,y--;else if(a[f]===s[m])l[m]=Ie(i[f],n[m]),Gr(o,i[h],i[f]),f--,m++;else if(c===void 0&&(c=Eh(s,m,y),d=Eh(a,h,f)),c.has(a[h]))if(c.has(a[f])){let x=d.get(s[m]),u=x!==void 0?i[x]:null;if(u===null){let g=Gr(o,i[h]);Ie(g,n[m]),l[m]=g}else l[m]=Ie(u,n[m]),Gr(o,i[h],u),i[x]=null;m++}else wo(i[f]),f--;else wo(i[h]),h++;for(;m<=y;){let x=Gr(o,l[y+1]);Ie(x,n[m]),l[m++]=x}for(;h<=f;){let x=i[h++];x!==null&&wo(x)}return this.ut=s,Kd(o,l),it}});var Le=Symbol("dragDropContext");var Sh=[M,Wt,w`
|
|
6479
6479
|
/* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
|
|
6480
6480
|
custom properties on its host; the properties themselves live here. */
|
|
6481
6481
|
:host {
|
|
@@ -6499,9 +6499,9 @@ div.full-correct-response-inline {
|
|
|
6499
6499
|
[part~='chip'] {
|
|
6500
6500
|
flex-shrink: 0;
|
|
6501
6501
|
}
|
|
6502
|
-
`];var
|
|
6502
|
+
`];var Ah=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Jr=class extends E{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=Sh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return v`<div part="drop">
|
|
6503
6503
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6504
|
-
</div>`}};
|
|
6504
|
+
</div>`}};Ah([p({type:String,reflect:!0})],Jr.prototype,"identifier",void 0);Ah([I({context:Le,subscribe:!0}),T()],Jr.prototype,"_dragDrop",void 0);var _h=[{tag:"qti-associable-hotspot",ctor:Jr}];var Th=[M,Wt,w`
|
|
6505
6505
|
/*
|
|
6506
6506
|
* A drop target. The interaction measures its chips and publishes the result as custom
|
|
6507
6507
|
* properties on its own host; the actual CSS properties live here, not in a style attribute.
|
|
@@ -6546,9 +6546,9 @@ div.full-correct-response-inline {
|
|
|
6546
6546
|
min-height: var(--qti-dropzone-min-height, 0);
|
|
6547
6547
|
min-width: var(--qti-dropzone-min-width, 0);
|
|
6548
6548
|
}
|
|
6549
|
-
`];var
|
|
6549
|
+
`];var kl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},hr=class extends E{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=Th}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`<div part="drop">
|
|
6550
6550
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6551
|
-
</div>`}};
|
|
6551
|
+
</div>`}};kl([p({type:Number,reflect:!0})],hr.prototype,"tabindex",void 0);kl([p({type:String,reflect:!0})],hr.prototype,"identifier",void 0);kl([I({context:Le,subscribe:!0}),T()],hr.prototype,"_dragDrop",void 0);var Ih=[{tag:"qti-gap",ctor:hr}];var Rh=[M,w`
|
|
6552
6552
|
/* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
|
|
6553
6553
|
graphic-gap-match rules, on the host from the document. */
|
|
6554
6554
|
:host {
|
|
@@ -6561,7 +6561,7 @@ div.full-correct-response-inline {
|
|
|
6561
6561
|
anywhere else it is unset and the chip keeps its size. */
|
|
6562
6562
|
zoom: var(--qti-graphic-scale, 1);
|
|
6563
6563
|
}
|
|
6564
|
-
`];var
|
|
6564
|
+
`];var ef=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},an=class extends E{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=Rh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<slot part="label"></slot>`}};ef([p({type:Number,reflect:!0})],an.prototype,"tabindex",void 0);var Mh=[{tag:"qti-gap-img",ctor:an}];var pr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ph={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function Et(o,t,{activateOn:e="click"}={}){class r extends o{#t;#e;#r(){let s=this._interactionContext?.choiceRole??null;s!==this.#e&&(this.#e&&this.internals.states.delete(this.#e),this.#e=s,this.internals.role=s,s&&this.internals.states.add(s))}handleDisabledChange(n,s){s?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=s?-1:0}handleReadonlyChange(n,s){s?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...n){super(...n),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=!1,this.#e=null,this._onMouseDown=s=>{this.disabled&&s.preventDefault()},this._onPointerDown=s=>{this.#t=!1,!(e!=="press"||s.button!==0||!s.isPrimary)&&(this.hasAttribute("data-draggable")||this.disabled||this.readonly||(this.#t=!0,this.focus(),this._activate()))},this.internals=this.attachInternals()}willUpdate(n){super.willUpdate(n),this.#r()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.addEventListener("pointerdown",this._onPointerDown),this.addEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.removeEventListener("pointerdown",this._onPointerDown),this.removeEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(n){n.altKey||(n.code==="Space"||n.code==="Enter")&&(n.preventDefault(),this._activate())}_onClick(){if(this.#t){this.#t=!1;return}this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return v`<slot></slot>`}}return pr([p({type:String})],r.prototype,"identifier",void 0),pr([p({type:Number,reflect:!0,attribute:"tabindex"})],r.prototype,"tabIndex",void 0),pr([p({type:Boolean,attribute:"aria-disabled",converter:Ph})],r.prototype,"disabled",void 0),pr([p({type:Boolean,attribute:"aria-readonly",converter:Ph})],r.prototype,"readonly",void 0),pr([I({context:Rr,subscribe:!0}),T()],r.prototype,"_interactionContext",void 0),pr([N("disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",null),pr([N("readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",null),r}var Oh=[M,w`
|
|
6565
6565
|
/*
|
|
6566
6566
|
* A chip's own box. Both drag-drop interactions that use this element laid it out from the
|
|
6567
6567
|
* theme — gap-match with 'display: flex !important; align-items: center !important',
|
|
@@ -6604,8 +6604,8 @@ div.full-correct-response-inline {
|
|
|
6604
6604
|
align-items: center;
|
|
6605
6605
|
justify-content: center;
|
|
6606
6606
|
}
|
|
6607
|
-
`];var
|
|
6608
|
-
<slot part="label"></slot>`}};
|
|
6607
|
+
`];var rf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ve=class extends Et(E,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=Oh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<div part="control"></div>
|
|
6608
|
+
<slot part="label"></slot>`}};rf([p({type:Number,reflect:!0})],Ve.prototype,"tabindex",void 0);var Dh=[{tag:"qti-gap-text",ctor:Ve}];var $h=[M,w`
|
|
6609
6609
|
:host {
|
|
6610
6610
|
display: flex;
|
|
6611
6611
|
user-select: none;
|
|
@@ -6625,7 +6625,7 @@ div.full-correct-response-inline {
|
|
|
6625
6625
|
display: grid;
|
|
6626
6626
|
place-content: center;
|
|
6627
6627
|
}
|
|
6628
|
-
`];var
|
|
6628
|
+
`];var nf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ur=class extends Et(E,"qti-hotspot-choice"){static{this.styles=$h}updated(t){super.updated(t),t.has("order")&&(this.order===void 0||this.order===null?this.removeAttribute("data-order"):this.setAttribute("data-order",String(this.order)))}};nf([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],ur.prototype,"order",void 0);var Nh=[{tag:"qti-hotspot-choice",ctor:ur}];var Lh=[M,w`
|
|
6629
6629
|
/* 'position: relative' is the containing block for the answer-key tick the theme draws as an
|
|
6630
6630
|
absolutely positioned ::before. See CONTRACT.md §7. */
|
|
6631
6631
|
:host {
|
|
@@ -6645,8 +6645,8 @@ div.full-correct-response-inline {
|
|
|
6645
6645
|
[part='control'] {
|
|
6646
6646
|
display: none;
|
|
6647
6647
|
}
|
|
6648
|
-
`];var mr=class extends Et(E,"qti-hottext"){static{this.styles=
|
|
6649
|
-
<slot part="label"></slot>`}};var
|
|
6648
|
+
`];var mr=class extends Et(E,"qti-hottext"){static{this.styles=Lh}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
6649
|
+
<slot part="label"></slot>`}};var Vh=[{tag:"qti-hottext",ctor:mr}];var of=w`
|
|
6650
6650
|
/*
|
|
6651
6651
|
* An option row: one line, clipped, with its text centred against the row's min-height. All four
|
|
6652
6652
|
* were in the theme, set on this host from the document — which is also why the 'display: block'
|
|
@@ -6669,13 +6669,13 @@ div.full-correct-response-inline {
|
|
|
6669
6669
|
slot {
|
|
6670
6670
|
display: inline;
|
|
6671
6671
|
}
|
|
6672
|
-
`,
|
|
6672
|
+
`,jh=of;var sf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ln=class extends Et(E,"qti-inline-choice"){static{this.styles=jh}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#t),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#t)}render(){return v` <slot></slot> `}#t(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};sf([p({type:String})],ln.prototype,"identifier",void 0);var Fh=[{tag:"qti-inline-choice",ctor:ln}];var zh=[M,w`
|
|
6673
6673
|
:host {
|
|
6674
6674
|
display: block;
|
|
6675
6675
|
margin: var(--qti-gap) 0;
|
|
6676
6676
|
width: 100%;
|
|
6677
6677
|
}
|
|
6678
|
-
`];var Lo=class extends E{static{this.styles=
|
|
6678
|
+
`];var Lo=class extends E{static{this.styles=zh}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var Bh=[{tag:"qti-prompt",ctor:Lo}];var Uh=[M,Wt,w`
|
|
6679
6679
|
/*
|
|
6680
6680
|
* 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
|
|
6681
6681
|
* way. In tabular match this element is a light-DOM *grandchild* of the slotted
|
|
@@ -6824,13 +6824,13 @@ div.full-correct-response-inline {
|
|
|
6824
6824
|
align-items: center;
|
|
6825
6825
|
justify-content: center;
|
|
6826
6826
|
}
|
|
6827
|
-
`];var Vo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Lt=class extends Et(E,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=
|
|
6827
|
+
`];var Vo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Lt=class extends Et(E,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=Uh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`
|
|
6828
6828
|
<div part="control"></div>
|
|
6829
6829
|
<slot part="label"></slot>
|
|
6830
6830
|
<div part="drop">
|
|
6831
6831
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6832
6832
|
</div>
|
|
6833
|
-
`}};Vo([p({type:Number,attribute:"match-min"})],Lt.prototype,"matchMin",void 0);Vo([p({type:Number,attribute:"match-max"})],Lt.prototype,"matchMax",void 0);Vo([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Lt.prototype,"fixed",void 0);Vo([I({context:Le,subscribe:!0}),T()],Lt.prototype,"_dragDrop",void 0);var
|
|
6833
|
+
`}};Vo([p({type:Number,attribute:"match-min"})],Lt.prototype,"matchMin",void 0);Vo([p({type:Number,attribute:"match-max"})],Lt.prototype,"matchMax",void 0);Vo([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Lt.prototype,"fixed",void 0);Vo([I({context:Le,subscribe:!0}),T()],Lt.prototype,"_dragDrop",void 0);var Hh=[{tag:"qti-simple-associable-choice",ctor:Lt}];var Wh=[M,w`
|
|
6834
6834
|
/*
|
|
6835
6835
|
* 'position: relative' unconditionally, because this element can carry a correction badge and a
|
|
6836
6836
|
* badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
|
|
@@ -6866,9 +6866,9 @@ div.full-correct-response-inline {
|
|
|
6866
6866
|
align-items: center;
|
|
6867
6867
|
justify-content: center;
|
|
6868
6868
|
}
|
|
6869
|
-
`];var jo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Vt=class extends Et(E,"qti-simple-choice",{activateOn:"press"}){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=
|
|
6869
|
+
`];var jo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Vt=class extends Et(E,"qti-simple-choice",{activateOn:"press"}){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=Wh}get checked(){return this.internals.states.has("checked")}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
6870
6870
|
${this.marker?v`<div id="label" part="marker">${this.marker}</div>`:P}
|
|
6871
|
-
<slot part="label"></slot>`}};jo([p({type:String,attribute:"template-identifier"})],Vt.prototype,"templateIdentifier",void 0);jo([p({type:String,attribute:"show-hide"})],Vt.prototype,"showHide",void 0);jo([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Vt.prototype,"fixed",void 0);jo([p({type:String,attribute:!1})],Vt.prototype,"marker",void 0);var Wh=[{tag:"qti-simple-choice",ctor:Vt}];var Qh=[...Ah,...Th,...Rh,...Oh,...$h,...Lh,...jh,...zh,...Uh,...Wh];var nf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n};function of(o,t,e,r,i={}){let n=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,l=0,c=r.length?r:[o],d=c.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));c.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),l=Math.max(l,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:l})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(o.style.setProperty("--qti-dropzone-min-width",`${l}px`),o.style.setProperty("--qti-drag-min-width",`${l}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var Sl=(o,t,e,r='slot[part~="bank"]')=>{class i extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#i=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#i;#n;collectAutoSizeTargets(){let s=(a,l)=>Array.from(l?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&(of(this.dropzonePropertyTarget(),s,a,l,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:c=>{let d=this.#n;return d&&d.height===c.height&&d.width===c.width?!1:(this.#n=c,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#s()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let l of this.#e)a.has(l)||this.#t.unobserve(l);for(let l of a)this.#e.has(l)||this.#t.observe(l);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return nf([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Yt,AbortSignal:Al,WeakMap:sf,WeakRef:af,Window:Xh,reportError:Fo=console.log}=globalThis,je=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||je(o.defaultView.parent.document)),fr=()=>!!Xh&&globalThis instanceof Xh,_l=Symbol("unset"),[Gh,lf]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((b,q)=>(x=b,u=q)),resolve:x,reject:u}};function r(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let i=new sf,n={next(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.next(...x))},return(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.return?b.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>{if(!b.throw)throw b.return(),new TypeError("no throw method");return b.throw(...x)})}};function s(x){let u=Object.create(n);return i.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let b=r(x,g);return s(b)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(x,g)}let l="any"in Al?Al.any.bind(Al):x=>{let u=new Yt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:u,error:g,complete:b}={}){i.set(this,{next:u,error:g,complete:b})}next(u){let{next:g}=i.get(this)||{};g&&g(u)}error(u){let{error:g}=i.get(this)||{};g?g(u):Fo(u)}complete(){let{complete:u}=i.get(this)||{};u&&u()}}function h(x,u){let g=i.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let b of g.teardowns.reverse()){if(fr()&&!je(document))return;try{b()}catch(q){Fo(q)}}}}function f(x,u,g={}){if(fr()&&!je(document))return;let b;typeof u=="function"?b=new d({next:u}):u&&!(u instanceof d)?b=new d(u):b=u||new d;let q=i.get(x),_=q.weakSubscriber?.deref();if(_?.active){let C=_,k=i.get(C);k.observers.add(b),g.signal&&(g.signal.aborted?k.observers.delete(b):g.signal.addEventListener("abort",()=>{let R=i.get(C);R?.active&&(R.observers.delete(b),R.observers.size==0&&h(C,g.signal.reason))}));return}let A=new m(b);if(q.weakSubscriber=new af(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let C=i.get(A);C?.active&&(C.observers.delete(b),C.observers.size==0&&h(A,g.signal.reason))})),q.subscribeCallback)try{q.subscribeCallback(A)}catch(C){A.error(C)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Yt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active||fr()&&!je(document))return;let b=new Set(g.observers);for(let q of b)q.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active){Fo(u);return}if(fr()&&!je(document))return;h(this,u);let b=new Set(g.observers);for(let q of b)q.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=i.get(this);if(!u?.active||fr()&&!je(document))return;h(this);let g=new Set(u.observers);for(let b of g)b.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(fr()&&!je(document))return;let g=i.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!i.has(this)){let u=new Yt;return u.abort(),u.signal}return i.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let _=function(A,C){if(A.signal.aborted)return;let k;try{let R=C.next();k=Promise.resolve(R)}catch(R){k=Promise.reject(R)}k.then(R=>{if(R===null||typeof R!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:q}=R)}catch(V){A.error(V);return}if(q){A.complete();return}let $;try{$=R.value}catch(V){A.error(V);return}A.next($),_(A,C)},R=>{A.error(R)})},q=!1;return new y(A=>{if(A.signal.aborted)return;let C;try{C=a(u,!0)}catch(R){A.error(R);return}let k=C;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||q)return;t(()=>k.return(A.signal.reason)).then($=>{if($===null||typeof $!="object")throw new TypeError("Iterator .return() must return an Object")})}),_(A,k))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(q=>{if(q.signal.aborted)return;let _;try{_=a(u,!1)}catch(k){q.error(k);return}let A=!1,C=_;if(!q.signal.aborted)for(q.signal.addEventListener("abort",()=>{if(typeof C.return!="function"||A)return;let k=C.return();if(k===null||typeof k!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let k=C.next();if({done:A}=k,A){q.complete();return}if(q.next(k.value),q.signal.aborted)break}catch(k){q.error(k);break}});if(u instanceof Promise||typeof u.then=="function")return new y(q=>{u.then(_=>{q.next(_),q.complete()},_=>{q.error(_)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,b=y.from(u);return new y(q=>{let _=new d({next(){q.complete()},error(){q.complete()}}),A={signal:q.signal};if(f(b,_,A),!q.active)return;let C=new d({next(k){q.next(k)},error(k){q.error(k)},complete(){q.complete()}});f(g,C,A)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(C){let k;try{k=u(C,q)}catch(R){b.error(R);return}q+=1,b.next(k)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}inspect(u={}){let g=null,b=null,q=null,_=null,A=null;typeof u=="function"?b=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(b=u.next),"error"in u&&(q=u.error),"complete"in u&&(_=u.complete),"abort"in u&&(A=u.abort));let C=this;return new y(k=>{if(g!==null)try{g()}catch(L){k.error(L);return}let R=()=>{try{A!==null&&A(k.signal.reason)}catch(L){Fo(L)}};k.signal.addEventListener("abort",R,{once:!0});let $=new d({next(L){if(b!==null)try{b(L)}catch(pt){k.signal.removeEventListener("abort",R),k.error(pt);return}k.next(L)},error(L){if(k.signal.removeEventListener("abort",R),q!==null)try{q(L)}catch(pt){k.error(pt);return}k.error(L)},complete(){if(k.signal.removeEventListener("abort",R),_!==null)try{_()}catch(L){k.error(L);return}k.complete()}}),V={signal:k.signal};f(C,$,V)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(C){let k=!1;try{k=u(C,q)}catch(R){b.error(R);return}q+=1,k&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u;if(q==0)return b.complete();let _=new d({next(C){b.next(C),q-=1,q==0&&b.complete()},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u,_=new d({next(C){if(q>0)return q-=1;q==0&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=[];function C(V){let L;try{L=u(V,q)}catch(ie){return b.error(ie)}q+=1;let pt;try{pt=y.from(L)}catch(ie){return b.error(ie)}let Ca=new d({next(ie){b.next(ie)},error(ie){b.error(ie)},complete(){if(A.length){let ie=A.shift();C(ie)}else k=!1,_&&b.complete()}}),zt={signal:b.signal};f(pt,Ca,zt)}let k=!1,R=new d({next(V){k?A.push(V):(k=!0,C(V))},error(V){b.error(V)},complete(){_=!0,!k&&!A.length&&b.complete()}}),$={signal:b.signal};f(g,R,$)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=null;function C($){let V;try{V=u($,q)}catch(zt){return b.error(zt)}q+=1;let L;try{L=y.from(V)}catch(zt){return b.error(zt)}let pt=new d({next(zt){b.next(zt)},error(zt){b.error(zt)},complete(zt){_?b.complete():A=null}}),Ca={signal:c([A.signal,b.signal])};f(L,pt,Ca)}let k=new d({next($){A&&A.abort(),A=new Yt,C($)},error($){b.error($)},complete(){_=!0,A||b.complete()}}),R={signal:b.signal};f(g,k,R)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(q=>{let _=new d({next(C){q.next(C)},error(C){let k;try{k=u(C)}catch(L){q.error(L);return}let R;try{R=y.from(k)}catch(L){q.error(L);return}let $=new d({next(L){q.next(L)},error(L){q.error(L)},complete(){q.complete()}}),V={signal:q.signal};f(R,$,V)},complete(){q.complete()}}),A={signal:q.signal};f(g,_,A)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{b.addTeardown(u);let q=new d({next(A){b.next(A)},error(A){b.error(A)},complete(){b.complete()}}),_={signal:b.signal};f(g,q,_)})}toArray(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=[],A=new d({next(C){_.push(C)},error(C){q(C)},complete(){b(_)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Yt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,R=new d({next($){try{u($,k)}catch(V){_(V),A.abort(V)}k+=1},error($){_($)},complete(){q()}});return f(this,R,C),b}every(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Yt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,R=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V||(q(!1),A.abort())},error($){_($)},complete(){q(!0)}});return f(this,R,C),b}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e(),_=new Yt,A={signal:c([_.signal,u.signal])};if(A.signal.aborted)return q(A.signal.reason),g;A.signal.addEventListener("abort",()=>{q(A.signal.reason)});let C=new d({next(k){b(k),_.abort()},error(k){q(k)},complete(){q(new RangeError("No values in Observable"))}});return f(this,C,A),g}last(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return q(u.signal.reason),g;u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=null,A=!1,C=new d({next(k){A=!0,_=k},error(k){q(k)},complete(){A?b(_):q(new RangeError("No values in Observable"))}});return f(this,C,u),g}find(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Yt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,R=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V&&(q($),A.abort())},error($){_($)},complete(){q()}});return f(this,R,C),b}some(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Yt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,R=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V&&(q(!0),A.abort())},error($){_($)},complete(){q(!1)}});return f(this,R,C),b}reduce(u,g,b={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:q,resolve:_,reject:A}=e(),C=new Yt,k={signal:c([C.signal,b.signal])};if(k.signal.aborted)return A(k.signal.reason),q;k.signal.addEventListener("abort",()=>{A(k.signal.reason)},{once:!0});let R=0,$=arguments.length>1?g:_l,V=new d({next(L){if($===_l){$=L,R++;return}try{let pt=u($,L,R);R++,$=pt}catch(pt){A(pt),C.abort(pt);return}},error(L){A(L)},complete(){$!==_l?_($):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,k),q}}return o(y.prototype,"subscribe"),[y,m]})();function Jh(){return typeof globalThis.Observable=="function"}function Yh(){Object.defineProperties(globalThis,{Observable:{value:Gh,configurable:!0,writable:!0},Subscriber:{value:lf,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(fr()&&!je(document))return;let e=this;return new Gh(r=>{if(!e||r.signal.aborted)return;let i=n=>{r.next(n)};e.addEventListener(o,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function Tl(o,t,e){let r=o.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let n=i.getBoundingClientRect();if(t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom)return i}return null}function Kh(o,t,e,r){if(!r)return null;let i=o.filter(s=>!s.hasAttribute("disabled")),n=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom))return s}return null}function Zh(o,t,e,r){let i=o.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let n,s;if(r){let c=r.getBoundingClientRect();n=c.left+c.width/2,s=c.top+c.height/2}else n=t,s=e;let a=null,l=1/0;for(let c of i){let d=c.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(n-h,2)+Math.pow(s-f,2));m<l&&(l=m,a=c)}return a}function tp(o,t,e,r){let i=o.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let n;if(r){let l=r.getBoundingClientRect();n=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}]}else n=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let l of i){let c=l.getBoundingClientRect(),d=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}],h=0,f=0;for(let y of n)for(let x of d){let u=Math.sqrt(Math.pow(y.x-x.x,2)+Math.pow(y.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function cf(o,t,e){let r=o.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function df(o,t,e,r,i){let n=i&&i.length>0?o.filter(g=>i.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.split(/\s+/).includes("bank")),a=o.filter(g=>!n.includes(g));if(n.length===0&&a.length===0)return null;let l;if(r){let g=r.getBoundingClientRect();l=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else l=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let c=g=>{let b=g.getBoundingClientRect(),q=[{x:b.left,y:b.top},{x:b.right,y:b.top},{x:b.left,y:b.bottom},{x:b.right,y:b.bottom}],_=0,A=0;for(let C of l)for(let k of q){let R=Math.sqrt(Math.pow(C.x-k.x,2)+Math.pow(C.y-k.y,2));_+=R,A++}return _/A},d=null,h=1/0;for(let g of n){let b=c(g);b<h&&(h=b,d=g)}let f=null,m=1/0;for(let g of a){let b=c(g);b<m&&(m=b,f=g)}if(d&&r){let g=r.getBoundingClientRect(),b=d.getBoundingClientRect(),q=g.left+g.width/2,_=g.top+g.height/2;if(q>=b.left&&q<=b.right&&_>=b.top&&_<=b.bottom)return d}if(f&&cf(f,t,e))return f;let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function ep(o){switch(o){case"pointerWithin":return Tl;case"rectangleIntersection":return Kh;case"closestCenter":return Zh;case"closestCorners":return tp;case"closestCornersWithInventoryPriority":return df;default:return Tl}}function Yr(o,t,e,r,i="pointerWithin",n){return ep(i)(o,t,e,r,n)}function Fe(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("data-draggable"))return r;let i=r.closest(t)||r.closest('[data-draggable="true"]');if(i)return i}return null}function ln(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var Il=o=>o?.internals;function ft(o,t,e){z(Il(o)?.states,t,e)}function zo(o,t){return ji(Il(o)?.states,t)}function cn(o){ft(o,"lifted",!1),ft(o,"used",!1),ft(o,"return-target",!1)}function gr(o){return zo(o,"lifted")||zo(o,"used")}var rp={filled:[],full:[],"drag-active":["active","enabled"],"drag-over":["hover"]};function Kt(o,t,e){if(!o)return;let r=[t,...rp[t]];for(let s of r)e?o.setAttribute(s,""):o.removeAttribute(s);let i=Il(o)?.states;if(i){z(i,t,e,rp[t]);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));if(!(!n.has("drop")&&!n.has("bank"))){for(let s of r)e?n.add(s):n.delete(s);o.setAttribute("part",[...n].join(" "))}}function br(o,t){o&&(t?o.setAttribute("disabled",""):o.removeAttribute("disabled"),Kt(o,"full",t))}function Kr(o,t){Kt(o,"filled",t)}function Zr(o,t){let e=[];return o.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function ip(o,t){let e=o.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var Rl={origin:{x:0,y:0},scale:{x:1,y:1}},Bo=100,hf=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},pf=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},uf=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Ml=(o,t)=>{let e=o.ownerDocument??document,r=t??e.body,i=hf(e);return i&&!uf(i,r)?pf(i):r},Pl=(o,t=1)=>{let r=(o.ownerDocument??document).createElement("div");r.style.cssText=`position:fixed;left:0;top:0;width:${Bo}px;height:${Bo}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(r);let i=r.getBoundingClientRect();return r.remove(),{origin:{x:i.left,y:i.top},scale:{x:(i.width/Bo||1)*t,y:(i.height/Bo||1)*t}}},np=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});Jh()||Yh();var op=new WeakSet;function mf(o){!o||op.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),op.add(o))}var sp=o=>!!o.internals?.states,Uo=(o,t,e,r='slot[part~="bank"]',i="pointerWithin")=>{class n extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Rl,this.cursorBeforeDrag=null,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#r=a=>{let l=a;if(l.context!==Rr)return;let c=l.contextTarget;c instanceof HTMLElement&&this.#e.add(c)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#r,{capture:!0}),mf(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,l){l.remove()}#e;#r;registeredMatching(a){for(let l of this.#e)l.isConnected||this.#e.delete(l);return[...this.#e].filter(l=>l.matches(a))}cacheInteractiveElements(){let a=(k,R)=>Array.from(R?.querySelectorAll(k)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[data-draggable="true"]:not([data-drag-clone])',this),h=a('[data-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...f]));let m=a(e,this),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let x=a(r,this),u=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),b=new Set(this.trackedDraggables),q=new Set(this.trackedDroppables),_=g?b:new Set,A=g?q:new Set,C=new Set([...b,...q].filter(sp));for(let k of this.#t)C.has(k)||(z(k.internals.states,"chip",!1),z(k.internals.states,"drop",!1));for(let k of C){let R=_.has(k),$=!R&&A.has(k);z(k.internals.states,"chip",R),z(k.internals.states,"drop",$)}this.#t=C,this.trackedDraggables.forEach(k=>{let R=gr(k);g&&!R?(k.style.cursor="grab",k.style.userSelect="none",k.style.touchAction="none",k.style.webkitUserSelect="none",k.style.webkitTouchCallout="none",k.setAttribute("data-draggable","true"),k.setAttribute("tabindex","0")):(k.style.cursor="",k.style.userSelect="",k.style.touchAction="",k.style.webkitUserSelect="",k.style.webkitTouchCallout="",k.removeAttribute("data-draggable"),k.getAttribute("tabindex")==="0"&&k.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let l=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let y=Fe(m,t),x=this.disabled||this.readonly,u=ln(y)||gr(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=Fe(m,t);if(!y){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let y=Fe(m,t),x=this.disabled||this.readonly,u=ln(y)||gr(y),g=m.button===0,b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Fe(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=Fe(m,t),x=this.disabled||this.readonly,u=ln(y)||gr(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Fe(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!y||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let y=this.trackedDraggables.filter(u=>!gr(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.endKeyboardDrag(),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.endKeyboardDrag(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=Fe(m,t),g=this.disabled||this.readonly,b=ln(u)||gr(u);u&&["Space","Enter"].includes(m.code)&&!g&&!b&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),ft(u,"lifted",!0),this.activateAllDroppables(this.trackedDroppables.some(q=>q.contains(u)||!!q.shadowRoot?.contains(u))),h={dragging:!0,dragElement:u,dragIndex:y.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>Kt(u,"drag-over",!1)),h.dragging&&h.dropElement&&(Kt(h.dropElement,"drag-over",!0),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(l,c,d,f)}initiateDrag(a,l,c,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let y=b=>b.contains(a)||!!b.shadowRoot?.contains(a),x=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||null;a.getAnimations().forEach(b=>b.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:l-g.left,y:c-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:l,y:c},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),br(u,!1),u&&u.setAttribute("data-drag-source","true");let b=a.getAttribute("identifier");if(b){let q=Zr(this.trackedDragContainers,b);q.forEach(_=>ft(_,"return-target",!0)),this.dragState.returnAnchorItems=q}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),ft(a,"lifted",!0);if(this.updateClonePosition(l,c),this.activateAllDroppables(x),this.watchDragCloneHost(),h==="pointer"){let b=this.ownerDocument.documentElement;this.cursorBeforeDrag=b.style.cursor,b.style.cursor="grabbing"}this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.setPointerCapture&&q.setPointerCapture(_)}catch{}let g=q=>{q.cancelable&&(q.preventDefault(),l==="pointer"&&q.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let b=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),l==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.releasePointerCapture&&q.releasePointerCapture(_)}catch{}};this.dragState.touchCleanup=b}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let b=this.dragState.startedFromTrustedEvent;return b===void 0||g.isTrusted===b},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let b=g.touches?.[0]||g.changedTouches?.[0];if(!b)return;this.handleDragMove(b.clientX,b.clientY);return}if(l==="mouse"){let b=g;if(typeof b.buttons=="number"&&(b.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),y=l==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):l==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=Yr(this.allDropzones,a,l,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),d=Date.now(),h=d-(this.dragState.lastTargetChangeTime||0);c!==this.dragState.currentTarget&&(c===null||h>=50)&&(this.allDropzones.forEach(m=>Kt(m,"drag-over",!1)),c&&Kt(c,"drag-over",!0),this.dragState.currentTarget=c,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:l,currentTarget:c,sourceDroppable:d}=this.dragState,h=c;if(l){let y=l.getBoundingClientRect();h=Yr(this.allDropzones,y.left+y.width/2,y.top+y.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),ft(a,"lifted",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{ft(y,"return-target",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,l){return this.trackedDroppables.includes(l)||this.trackedDragContainers.includes(l)}handleInvalidDrop(a){cn(a)}createDragClone(a,l){let c=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];c.style.setProperty(m,d.getPropertyValue(m))}c.style.removeProperty("box-shadow");let h=Ml(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=Pl(h,this.cloneZoom),c.style.position="fixed",c.style.width=`${l.width/this.cloneFrame.scale.x}px`,c.style.height=`${l.height/this.cloneFrame.scale.y}px`,c.style.zIndex="9999",c.style.pointerEvents="none",c.style.touchAction="none",c.style.userSelect="none",c.removeAttribute("data-draggable"),c.removeAttribute("tabindex"),c.setAttribute("data-drag-clone","true"),c.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(c),c}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,l){if(this.dragState.lastCoordinates={x:a,y:l},!this.dragState.dragClone)return;let{startOffset:c}=this.dragState,{x:d,y:h}=np(this.cloneFrame,a-c.x,l-c.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,l=()=>{let{dragClone:c,dragSource:d,lastCoordinates:h}=this.dragState;if(!c)return;let f=d?.isConnected?d:this,m=Ml(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=Pl(m,this.cloneZoom),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",l),a.addEventListener("webkitfullscreenchange",l),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",l),a.removeEventListener("webkitfullscreenchange",l)}})}activateAllDroppables(a=!1){this.setDragActive(!0),this.allDropzones.forEach(l=>{let c=this.trackedDragContainers.includes(l);Kt(l,"drag-active",a||!c)})}deactivateAllDroppables(){this.setDragActive(!1),this.allDropzones.forEach(a=>{Kt(a,"drag-active",!1),Kt(a,"drag-over",!1)})}endKeyboardDrag(){this.trackedDraggables.forEach(a=>{a.hasAttribute("data-keyboard-dragging")&&ft(a,"lifted",!1),a.removeAttribute("data-keyboard-dragging")}),this.deactivateAllDroppables()}setDragActive(a){z(this._internals?.states,"drag-active",a,["dragzone-active","dragzone-enabled"])}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{ft(a,"return-target",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",l)}}),this.dragSubscriptions=[],this.cloneFrame=Rl,this.cloneZoom=1,this.cursorBeforeDrag!==null&&(this.ownerDocument.documentElement.style.cursor=this.cursorBeforeDrag,this.cursorBeforeDrag=null),this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,l){let c=this._internals;c?.states&&(l?c.states.add(a):c.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)sp(a)&&(z(a.internals.states,"chip",!1),z(a.internals.states,"drop",!1));this.#t.clear(),this.resetDragState()}}return n};var ap={duration:250,easing:"ease",fill:"both"};function Ol(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function lp(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function ze(o){let t=new Map;return o.forEach(e=>{t.set(e,Ol(e))}),t}function cp(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function Ho(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function Dl(o){return Ho(o)>0}function Wo(o,t,e={}){let r=Ho(o);if(r<=0)return null;let i=Ol(o),{deltaX:n,deltaY:s,deltaW:a,deltaH:l}=cp(t,i);if(n===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...ap,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${n}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*r,easing:d,fill:h})}function Be(o,t={}){let e=new Map;return o.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let n=Wo(i,r,t);n&&e.set(i,n)}),e}var dn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},jt=(o,t,e,r='slot[part~="bank"]',i="closestCornersWithInventoryPriority")=>{let n=Sl(o,t,e,r),s=Uo(n,t,e,r,i);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this.maxAssociations=0,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}#t;isSwapTarget(c){let d=this.dragState.sourceDroppable,h=parseInt(c.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(c)&&!!d&&d!==c&&this.trackedDroppables.includes(d)}isDeclarativeTarget(c){return c?c.acceptsDeclarativeDrops===!0?!0:c.hasAttribute("data-declarative-drops"):!1}chipsIn(c){return this.isDeclarativeTarget(c)?[...this.#t.get(c)??[]]:Array.from(c.querySelectorAll(t))}droppableHolding(c){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(c)||d.contains(c)||!!d.shadowRoot?.contains(c))??null}placeChip(c,d){this.#t.set(c,[...this.#t.get(c)??[],d])}removeChipFromDroppable(c,d){let h=c??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&Kr(h,!1),this.syncDragDropState();return}d.remove()}clearChips(c){this.isDeclarativeTarget(c)?(this.#t.set(c,[]),this.syncDragDropState()):this.chipsIn(c).forEach(d=>d.remove()),Kr(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),x=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[data-draggable="true"]'));c[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,x.length),h[m]=y}this._dragDrop={dragsByTarget:c,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:c}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(c[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((c,d)=>c+d,0)}droppableAtCapacityFromState(c){let d=parseInt(c.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=c.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Dl(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let c=this.getResponse,d=typeof c=="function"?c.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(c){if(Array.isArray(c)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=c,this._internals.setFormValue(JSON.stringify(c));return}let d=this.getValue,h=typeof d=="function"?d.call(this,c):c,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response)),this.trackedDroppables?.length&&this.validate()}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let c=this._pendingResponse;this._pendingResponse=void 0,this.response=c}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let c=this.dataset.choicesContainerWidth;c&&this.trackedDroppables.forEach(d=>{d.style.width=`${c}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(c){for(let h of c){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=c.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(c,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(c,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,d,h);let f=c.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity({trigger:"change"})}handleInvalidDrop(c){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!c)return;if(d&&f&&m)this.dropDraggableInDroppable(c,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(c,d,this.dragState.dragClone?.getBoundingClientRect());else if(zo(c,"lifted")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),x=this.maxAssociations>0&&y>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity({trigger:"change"})}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{Wo(c,lp(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){cn(c),c.style.display="",c.style.position="",this.animateReturn(c,d)}placeResponse(c){let[d,...h]=c.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=Zr(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(c,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(c,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(c,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let _=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),_&&this.restoreOriginalInInventory(_,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,x=y===0||y>1,u=Array.from(d.querySelectorAll('[data-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?ze(u):null;if(!x){let _=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[data-draggable="true"]'));if(_){let A=_.getAttribute("identifier"),C=_.getBoundingClientRect();this.removeChipFromDroppable(d,_);let k=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&k&&k!==d&&this.isDeclarativeTarget(k)?k:null;R?(this.placeChip(R,_),Kr(R,!0),this.animateReturn(_,C)):A&&this.restoreOriginalInInventory(A,C)}}let b=c.cloneNode(!0);b.removeAttribute("style"),b.removeAttribute("data-keyboard-dragging"),b.setAttribute("data-draggable","true"),b.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(b.setAttribute("part",b.localName==="qti-gap-text"?"chip text drag drag-text":"chip drag"),b.setAttribute("exportparts",["control: chip-control, control: drag-control, label: chip-label, label: drag-label","correction, candidate-correct, candidate-incorrect, candidate-partial","correction-correct, correction-incorrect, correction-partially-correct"].join(", ")),this.placeChip(d,b)):d.tagName==="SLOT"?b.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&b.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(b)),Kr(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Be(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let _=b.getBoundingClientRect(),A=h.left-_.left,C=h.top-_.top;(A!==0||C!==0)&&b.animate([{transform:`translate(${A}px, ${C}px)`},{transform:"translate(0, 0)"}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let q=c.getAttribute("identifier");q&&this.updateInventoryBasedOnMatchMax(q),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&Kr(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=Zr(this.trackedDragContainers,c),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[data-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let y=this.enableFlipAnimations&&m.length>0?ze(m):null;h.forEach(x=>{cn(x),x.style.display="",x.style.visibility="visible"}),y&&this.enableFlipAnimations&&Be(y,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=Zr(this.trackedDragContainers,c),h=ip(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(x=>x.getAttribute("identifier")===c).length:m+y.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{ft(m,"used",h!==0&&f>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source"),y=this.droppableAtCapacityFromState(f);br(f,(y||d&&h)&&!m)})}saveResponse(c){let d=this.getResponse,h=c??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(c=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this.trackedDroppables.forEach(d=>br(d,!1)),this.checkAllMaxAssociations(),this.resetValidityReport(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),c&&this.saveResponse()}validate(){let c=this.totalAssociationsFromState(),d=this.maxAssociations>0&&c>=this.maxAssociations,h=this.maxAssociations>0&&c>this.maxAssociations,f=this.minAssociations>0&&c<this.minAssociations,m="",y=!0,x="other";h?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):f?(x="min",m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let u=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,u,{suppressInline:!0,kind:x}),y}reportValidity(c){return super.reportValidity(c)}}return dn([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),dn([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",void 0),dn([Q({context:Le})],a.prototype,"_dragDrop",void 0),dn([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),dn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Xt({emptyAs:[]})})],a.prototype,"response",null),a};var Qo=class{getInsertPosition(t,e,r,i,n){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),l=(n-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var dp=new Qo;var ff={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function hn(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function Xo(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function Go(o,t,e={}){let r={...ff,...e},i=document.createElement("div");return i.setAttribute("data-drop-preview","true"),i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(o).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(o).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*Ho(o)}ms ease`,i.style.pointerEvents="none",i}function $l(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var Ft=(o,t='[data-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=hn(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#n=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#r;#i;#n;#o;set allowReorder(i){this.#o=i}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(i){return $l(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let n=this.#l(i);return n===0||n>1}#l(i){let n=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(n)?1:n}#p(i){return i.querySelectorAll(t).length}#c(i){let n=this.#l(i);return n===0?!1:this.#p(i)>=n}#d(){this.#i={hoveredSlot:null,originalPositions:new Map}}#h(i){if(!this.#t||i===this.#t){this.#u();return}if(this.#i.hoveredSlot===i)return;this.#u();let n=this.#s(i);if(!n){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#c(i)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#i.hoveredSlot=null;return}this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.isDeclarativeTarget(i)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#i.hoveredSlot=i;return}let a=ze([n]);this.#i.originalPositions.set(n,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(n),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,Be(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),n=i.length>0?ze(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),n&&Be(n,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,n,s,a,...l){this.#t=null,this.#r=hn(),this.#d();let c=this.findContainingDroppable(i);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#r.sortContainer=c;let h=i.getBoundingClientRect();this.#r.placeholder=Go(i,h,this.sortablePlaceholderConfig);let f=i.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",c.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#c(m))return;br(m,!1),this.#n.add(m)}})}let[d]=l;super.initiateDrag(i,n,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[n,s]of this.#i.originalPositions)s.appendChild(n);this.#r.placeholder&&this.#r.placeholder.remove(),Xo(this.#r),this.#n.clear(),this.#t=null,this.#d()}onSortableDragMove(i,n){if(!this.isDraggingFromSlot)return;let s=Yr(this.trackedDroppables,i,n,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#h(s):this.#u()}handleDragMove(i,n){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,n),this.onSortableDragMove(i,n)}allowDrop(i,n){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&n!==this.#e&&this.trackedDroppables.includes(n)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(n)?this.#a(n)?!this.#c(n):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(n)?!0:super.allowDrop(i,n)}handleDrop(i,n){super.handleDrop(i,n),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var hp=[M,U,Wt,w`
|
|
6871
|
+
<slot part="label"></slot>`}};jo([p({type:String,attribute:"template-identifier"})],Vt.prototype,"templateIdentifier",void 0);jo([p({type:String,attribute:"show-hide"})],Vt.prototype,"showHide",void 0);jo([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Vt.prototype,"fixed",void 0);jo([p({type:String,attribute:!1})],Vt.prototype,"marker",void 0);var Qh=[{tag:"qti-simple-choice",ctor:Vt}];var Xh=[..._h,...Ih,...Mh,...Dh,...Nh,...Vh,...Fh,...Bh,...Hh,...Qh];var af=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n};function lf(o,t,e,r,i={}){let n=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,l=0,c=r.length?r:[o],d=c.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));c.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),l=Math.max(l,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:l})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(o.style.setProperty("--qti-dropzone-min-width",`${l}px`),o.style.setProperty("--qti-drag-min-width",`${l}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var El=(o,t,e,r='slot[part~="bank"]')=>{class i extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#i=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#i;#n;collectAutoSizeTargets(){let s=(a,l)=>Array.from(l?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:l}=this.collectAutoSizeTargets();s.length!==0&&(lf(this.dropzonePropertyTarget(),s,a,l,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:c=>{let d=this.#n;return d&&d.height===c.height&&d.width===c.width?!1:(this.#n=c,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#s()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let l of this.#e)a.has(l)||this.#t.unobserve(l);for(let l of a)this.#e.has(l)||this.#t.observe(l);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return af([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Yt,AbortSignal:Sl,WeakMap:cf,WeakRef:df,Window:Gh,reportError:Fo=console.log}=globalThis,je=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||je(o.defaultView.parent.document)),fr=()=>!!Gh&&globalThis instanceof Gh,Al=Symbol("unset"),[Jh,hf]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((b,q)=>(x=b,u=q)),resolve:x,reject:u}};function r(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let i=new cf,n={next(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.next(...x))},return(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.return?b.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>{if(!b.throw)throw b.return(),new TypeError("no throw method");return b.throw(...x)})}};function s(x){let u=Object.create(n);return i.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let b=r(x,g);return s(b)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(x,g)}let l="any"in Sl?Sl.any.bind(Sl):x=>{let u=new Yt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:u,error:g,complete:b}={}){i.set(this,{next:u,error:g,complete:b})}next(u){let{next:g}=i.get(this)||{};g&&g(u)}error(u){let{error:g}=i.get(this)||{};g?g(u):Fo(u)}complete(){let{complete:u}=i.get(this)||{};u&&u()}}function h(x,u){let g=i.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let b of g.teardowns.reverse()){if(fr()&&!je(document))return;try{b()}catch(q){Fo(q)}}}}function f(x,u,g={}){if(fr()&&!je(document))return;let b;typeof u=="function"?b=new d({next:u}):u&&!(u instanceof d)?b=new d(u):b=u||new d;let q=i.get(x),_=q.weakSubscriber?.deref();if(_?.active){let C=_,k=i.get(C);k.observers.add(b),g.signal&&(g.signal.aborted?k.observers.delete(b):g.signal.addEventListener("abort",()=>{let R=i.get(C);R?.active&&(R.observers.delete(b),R.observers.size==0&&h(C,g.signal.reason))}));return}let A=new m(b);if(q.weakSubscriber=new df(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let C=i.get(A);C?.active&&(C.observers.delete(b),C.observers.size==0&&h(A,g.signal.reason))})),q.subscribeCallback)try{q.subscribeCallback(A)}catch(C){A.error(C)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Yt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active||fr()&&!je(document))return;let b=new Set(g.observers);for(let q of b)q.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active){Fo(u);return}if(fr()&&!je(document))return;h(this,u);let b=new Set(g.observers);for(let q of b)q.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=i.get(this);if(!u?.active||fr()&&!je(document))return;h(this);let g=new Set(u.observers);for(let b of g)b.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(fr()&&!je(document))return;let g=i.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!i.has(this)){let u=new Yt;return u.abort(),u.signal}return i.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let _=function(A,C){if(A.signal.aborted)return;let k;try{let R=C.next();k=Promise.resolve(R)}catch(R){k=Promise.reject(R)}k.then(R=>{if(R===null||typeof R!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:q}=R)}catch(V){A.error(V);return}if(q){A.complete();return}let $;try{$=R.value}catch(V){A.error(V);return}A.next($),_(A,C)},R=>{A.error(R)})},q=!1;return new y(A=>{if(A.signal.aborted)return;let C;try{C=a(u,!0)}catch(R){A.error(R);return}let k=C;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||q)return;t(()=>k.return(A.signal.reason)).then($=>{if($===null||typeof $!="object")throw new TypeError("Iterator .return() must return an Object")})}),_(A,k))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(q=>{if(q.signal.aborted)return;let _;try{_=a(u,!1)}catch(k){q.error(k);return}let A=!1,C=_;if(!q.signal.aborted)for(q.signal.addEventListener("abort",()=>{if(typeof C.return!="function"||A)return;let k=C.return();if(k===null||typeof k!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let k=C.next();if({done:A}=k,A){q.complete();return}if(q.next(k.value),q.signal.aborted)break}catch(k){q.error(k);break}});if(u instanceof Promise||typeof u.then=="function")return new y(q=>{u.then(_=>{q.next(_),q.complete()},_=>{q.error(_)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,b=y.from(u);return new y(q=>{let _=new d({next(){q.complete()},error(){q.complete()}}),A={signal:q.signal};if(f(b,_,A),!q.active)return;let C=new d({next(k){q.next(k)},error(k){q.error(k)},complete(){q.complete()}});f(g,C,A)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(C){let k;try{k=u(C,q)}catch(R){b.error(R);return}q+=1,b.next(k)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}inspect(u={}){let g=null,b=null,q=null,_=null,A=null;typeof u=="function"?b=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(b=u.next),"error"in u&&(q=u.error),"complete"in u&&(_=u.complete),"abort"in u&&(A=u.abort));let C=this;return new y(k=>{if(g!==null)try{g()}catch(L){k.error(L);return}let R=()=>{try{A!==null&&A(k.signal.reason)}catch(L){Fo(L)}};k.signal.addEventListener("abort",R,{once:!0});let $=new d({next(L){if(b!==null)try{b(L)}catch(pt){k.signal.removeEventListener("abort",R),k.error(pt);return}k.next(L)},error(L){if(k.signal.removeEventListener("abort",R),q!==null)try{q(L)}catch(pt){k.error(pt);return}k.error(L)},complete(){if(k.signal.removeEventListener("abort",R),_!==null)try{_()}catch(L){k.error(L);return}k.complete()}}),V={signal:k.signal};f(C,$,V)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(C){let k=!1;try{k=u(C,q)}catch(R){b.error(R);return}q+=1,k&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u;if(q==0)return b.complete();let _=new d({next(C){b.next(C),q-=1,q==0&&b.complete()},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u,_=new d({next(C){if(q>0)return q-=1;q==0&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=[];function C(V){let L;try{L=u(V,q)}catch(ie){return b.error(ie)}q+=1;let pt;try{pt=y.from(L)}catch(ie){return b.error(ie)}let Ca=new d({next(ie){b.next(ie)},error(ie){b.error(ie)},complete(){if(A.length){let ie=A.shift();C(ie)}else k=!1,_&&b.complete()}}),zt={signal:b.signal};f(pt,Ca,zt)}let k=!1,R=new d({next(V){k?A.push(V):(k=!0,C(V))},error(V){b.error(V)},complete(){_=!0,!k&&!A.length&&b.complete()}}),$={signal:b.signal};f(g,R,$)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=null;function C($){let V;try{V=u($,q)}catch(zt){return b.error(zt)}q+=1;let L;try{L=y.from(V)}catch(zt){return b.error(zt)}let pt=new d({next(zt){b.next(zt)},error(zt){b.error(zt)},complete(zt){_?b.complete():A=null}}),Ca={signal:c([A.signal,b.signal])};f(L,pt,Ca)}let k=new d({next($){A&&A.abort(),A=new Yt,C($)},error($){b.error($)},complete(){_=!0,A||b.complete()}}),R={signal:b.signal};f(g,k,R)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(q=>{let _=new d({next(C){q.next(C)},error(C){let k;try{k=u(C)}catch(L){q.error(L);return}let R;try{R=y.from(k)}catch(L){q.error(L);return}let $=new d({next(L){q.next(L)},error(L){q.error(L)},complete(){q.complete()}}),V={signal:q.signal};f(R,$,V)},complete(){q.complete()}}),A={signal:q.signal};f(g,_,A)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{b.addTeardown(u);let q=new d({next(A){b.next(A)},error(A){b.error(A)},complete(){b.complete()}}),_={signal:b.signal};f(g,q,_)})}toArray(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=[],A=new d({next(C){_.push(C)},error(C){q(C)},complete(){b(_)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Yt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,R=new d({next($){try{u($,k)}catch(V){_(V),A.abort(V)}k+=1},error($){_($)},complete(){q()}});return f(this,R,C),b}every(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Yt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,R=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V||(q(!1),A.abort())},error($){_($)},complete(){q(!0)}});return f(this,R,C),b}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e(),_=new Yt,A={signal:c([_.signal,u.signal])};if(A.signal.aborted)return q(A.signal.reason),g;A.signal.addEventListener("abort",()=>{q(A.signal.reason)});let C=new d({next(k){b(k),_.abort()},error(k){q(k)},complete(){q(new RangeError("No values in Observable"))}});return f(this,C,A),g}last(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return q(u.signal.reason),g;u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=null,A=!1,C=new d({next(k){A=!0,_=k},error(k){q(k)},complete(){A?b(_):q(new RangeError("No values in Observable"))}});return f(this,C,u),g}find(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Yt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,R=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V&&(q($),A.abort())},error($){_($)},complete(){q()}});return f(this,R,C),b}some(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Yt,C={signal:c([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,R=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V&&(q(!0),A.abort())},error($){_($)},complete(){q(!1)}});return f(this,R,C),b}reduce(u,g,b={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:q,resolve:_,reject:A}=e(),C=new Yt,k={signal:c([C.signal,b.signal])};if(k.signal.aborted)return A(k.signal.reason),q;k.signal.addEventListener("abort",()=>{A(k.signal.reason)},{once:!0});let R=0,$=arguments.length>1?g:Al,V=new d({next(L){if($===Al){$=L,R++;return}try{let pt=u($,L,R);R++,$=pt}catch(pt){A(pt),C.abort(pt);return}},error(L){A(L)},complete(){$!==Al?_($):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,k),q}}return o(y.prototype,"subscribe"),[y,m]})();function Yh(){return typeof globalThis.Observable=="function"}function Kh(){Object.defineProperties(globalThis,{Observable:{value:Jh,configurable:!0,writable:!0},Subscriber:{value:hf,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(fr()&&!je(document))return;let e=this;return new Jh(r=>{if(!e||r.signal.aborted)return;let i=n=>{r.next(n)};e.addEventListener(o,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function _l(o,t,e){let r=o.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let n=i.getBoundingClientRect();if(t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom)return i}return null}function Zh(o,t,e,r){if(!r)return null;let i=o.filter(s=>!s.hasAttribute("disabled")),n=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom))return s}return null}function tp(o,t,e,r){let i=o.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let n,s;if(r){let c=r.getBoundingClientRect();n=c.left+c.width/2,s=c.top+c.height/2}else n=t,s=e;let a=null,l=1/0;for(let c of i){let d=c.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(n-h,2)+Math.pow(s-f,2));m<l&&(l=m,a=c)}return a}function ep(o,t,e,r){let i=o.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let n;if(r){let l=r.getBoundingClientRect();n=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}]}else n=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let l of i){let c=l.getBoundingClientRect(),d=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}],h=0,f=0;for(let y of n)for(let x of d){let u=Math.sqrt(Math.pow(y.x-x.x,2)+Math.pow(y.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function pf(o,t,e){let r=o.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function uf(o,t,e,r,i){let n=i&&i.length>0?o.filter(g=>i.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.split(/\s+/).includes("bank")),a=o.filter(g=>!n.includes(g));if(n.length===0&&a.length===0)return null;let l;if(r){let g=r.getBoundingClientRect();l=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else l=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let c=g=>{let b=g.getBoundingClientRect(),q=[{x:b.left,y:b.top},{x:b.right,y:b.top},{x:b.left,y:b.bottom},{x:b.right,y:b.bottom}],_=0,A=0;for(let C of l)for(let k of q){let R=Math.sqrt(Math.pow(C.x-k.x,2)+Math.pow(C.y-k.y,2));_+=R,A++}return _/A},d=null,h=1/0;for(let g of n){let b=c(g);b<h&&(h=b,d=g)}let f=null,m=1/0;for(let g of a){let b=c(g);b<m&&(m=b,f=g)}if(d&&r){let g=r.getBoundingClientRect(),b=d.getBoundingClientRect(),q=g.left+g.width/2,_=g.top+g.height/2;if(q>=b.left&&q<=b.right&&_>=b.top&&_<=b.bottom)return d}if(f&&pf(f,t,e))return f;let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function rp(o){switch(o){case"pointerWithin":return _l;case"rectangleIntersection":return Zh;case"closestCenter":return tp;case"closestCorners":return ep;case"closestCornersWithInventoryPriority":return uf;default:return _l}}function Yr(o,t,e,r,i="pointerWithin",n){return rp(i)(o,t,e,r,n)}function Fe(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("data-draggable"))return r;let i=r.closest(t)||r.closest('[data-draggable="true"]');if(i)return i}return null}function cn(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var Tl=o=>o?.internals;function ft(o,t,e){z(Tl(o)?.states,t,e)}function zo(o,t){return ji(Tl(o)?.states,t)}function dn(o){ft(o,"lifted",!1),ft(o,"used",!1),ft(o,"return-target",!1)}function gr(o){return zo(o,"lifted")||zo(o,"used")}var ip={filled:[],full:[],"drag-active":["active","enabled"],"drag-over":["hover"]};function Kt(o,t,e){if(!o)return;let r=[t,...ip[t]];for(let s of r)e?o.setAttribute(s,""):o.removeAttribute(s);let i=Tl(o)?.states;if(i){z(i,t,e,ip[t]);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));if(!(!n.has("drop")&&!n.has("bank"))){for(let s of r)e?n.add(s):n.delete(s);o.setAttribute("part",[...n].join(" "))}}function br(o,t){o&&(t?o.setAttribute("disabled",""):o.removeAttribute("disabled"),Kt(o,"full",t))}function Kr(o,t){Kt(o,"filled",t)}function Zr(o,t){let e=[];return o.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function np(o,t){let e=o.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var Il={origin:{x:0,y:0},scale:{x:1,y:1}},Bo=100,mf=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},ff=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},gf=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Rl=(o,t)=>{let e=o.ownerDocument??document,r=t??e.body,i=mf(e);return i&&!gf(i,r)?ff(i):r},Ml=(o,t=1)=>{let r=(o.ownerDocument??document).createElement("div");r.style.cssText=`position:fixed;left:0;top:0;width:${Bo}px;height:${Bo}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(r);let i=r.getBoundingClientRect();return r.remove(),{origin:{x:i.left,y:i.top},scale:{x:(i.width/Bo||1)*t,y:(i.height/Bo||1)*t}}},op=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});Yh()||Kh();var sp=new WeakSet;function bf(o){!o||sp.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),sp.add(o))}var ap=o=>!!o.internals?.states,Uo=(o,t,e,r='slot[part~="bank"]',i="pointerWithin")=>{class n extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Il,this.cursorBeforeDrag=null,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#r=a=>{let l=a;if(l.context!==Rr)return;let c=l.contextTarget;c instanceof HTMLElement&&this.#e.add(c)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#r,{capture:!0}),bf(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,l){l.remove()}#e;#r;registeredMatching(a){for(let l of this.#e)l.isConnected||this.#e.delete(l);return[...this.#e].filter(l=>l.matches(a))}cacheInteractiveElements(){let a=(k,R)=>Array.from(R?.querySelectorAll(k)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[data-draggable="true"]:not([data-drag-clone])',this),h=a('[data-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...l,...c,...d,...h,...f]));let m=a(e,this),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let x=a(r,this),u=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),b=new Set(this.trackedDraggables),q=new Set(this.trackedDroppables),_=g?b:new Set,A=g?q:new Set,C=new Set([...b,...q].filter(ap));for(let k of this.#t)C.has(k)||(z(k.internals.states,"chip",!1),z(k.internals.states,"drop",!1));for(let k of C){let R=_.has(k),$=!R&&A.has(k);z(k.internals.states,"chip",R),z(k.internals.states,"drop",$)}this.#t=C,this.trackedDraggables.forEach(k=>{let R=gr(k);g&&!R?(k.style.cursor="grab",k.style.userSelect="none",k.style.touchAction="none",k.style.webkitUserSelect="none",k.style.webkitTouchCallout="none",k.setAttribute("data-draggable","true"),k.setAttribute("tabindex","0")):(k.style.cursor="",k.style.userSelect="",k.style.touchAction="",k.style.webkitUserSelect="",k.style.webkitTouchCallout="",k.removeAttribute("data-draggable"),k.getAttribute("tabindex")==="0"&&k.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let l=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let y=Fe(m,t),x=this.disabled||this.readonly,u=cn(y)||gr(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=Fe(m,t);if(!y){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let y=Fe(m,t),x=this.disabled||this.readonly,u=cn(y)||gr(y),g=m.button===0,b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Fe(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=Fe(m,t),x=this.disabled||this.readonly,u=cn(y)||gr(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Fe(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!y||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let y=this.trackedDraggables.filter(u=>!gr(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.endKeyboardDrag(),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.endKeyboardDrag(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=Fe(m,t),g=this.disabled||this.readonly,b=cn(u)||gr(u);u&&["Space","Enter"].includes(m.code)&&!g&&!b&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),ft(u,"lifted",!0),this.activateAllDroppables(this.trackedDroppables.some(q=>q.contains(u)||!!q.shadowRoot?.contains(u))),h={dragging:!0,dragElement:u,dragIndex:y.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>Kt(u,"drag-over",!1)),h.dragging&&h.dropElement&&(Kt(h.dropElement,"drag-over",!0),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(l,c,d,f)}initiateDrag(a,l,c,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let y=b=>b.contains(a)||!!b.shadowRoot?.contains(a),x=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||null;a.getAnimations().forEach(b=>b.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:l-g.left,y:c-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:l,y:c},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),br(u,!1),u&&u.setAttribute("data-drag-source","true");let b=a.getAttribute("identifier");if(b){let q=Zr(this.trackedDragContainers,b);q.forEach(_=>ft(_,"return-target",!0)),this.dragState.returnAnchorItems=q}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),ft(a,"lifted",!0);if(this.updateClonePosition(l,c),this.activateAllDroppables(x),this.watchDragCloneHost(),h==="pointer"){let b=this.ownerDocument.documentElement;this.cursorBeforeDrag=b.style.cursor,b.style.cursor="grabbing"}this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.setPointerCapture&&q.setPointerCapture(_)}catch{}let g=q=>{q.cancelable&&(q.preventDefault(),l==="pointer"&&q.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let b=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),l==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.releasePointerCapture&&q.releasePointerCapture(_)}catch{}};this.dragState.touchCleanup=b}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let b=this.dragState.startedFromTrustedEvent;return b===void 0||g.isTrusted===b},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let b=g.touches?.[0]||g.changedTouches?.[0];if(!b)return;this.handleDragMove(b.clientX,b.clientY);return}if(l==="mouse"){let b=g;if(typeof b.buttons=="number"&&(b.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),y=l==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):l==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=Yr(this.allDropzones,a,l,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),d=Date.now(),h=d-(this.dragState.lastTargetChangeTime||0);c!==this.dragState.currentTarget&&(c===null||h>=50)&&(this.allDropzones.forEach(m=>Kt(m,"drag-over",!1)),c&&Kt(c,"drag-over",!0),this.dragState.currentTarget=c,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:l,currentTarget:c,sourceDroppable:d}=this.dragState,h=c;if(l){let y=l.getBoundingClientRect();h=Yr(this.allDropzones,y.left+y.width/2,y.top+y.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),ft(a,"lifted",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{ft(y,"return-target",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,l){return this.trackedDroppables.includes(l)||this.trackedDragContainers.includes(l)}handleInvalidDrop(a){dn(a)}createDragClone(a,l){let c=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];c.style.setProperty(m,d.getPropertyValue(m))}c.style.removeProperty("box-shadow");let h=Rl(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=Ml(h,this.cloneZoom),c.style.position="fixed",c.style.width=`${l.width/this.cloneFrame.scale.x}px`,c.style.height=`${l.height/this.cloneFrame.scale.y}px`,c.style.zIndex="9999",c.style.pointerEvents="none",c.style.touchAction="none",c.style.userSelect="none",c.removeAttribute("data-draggable"),c.removeAttribute("tabindex"),c.setAttribute("data-drag-clone","true"),c.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(c),c}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,l){if(this.dragState.lastCoordinates={x:a,y:l},!this.dragState.dragClone)return;let{startOffset:c}=this.dragState,{x:d,y:h}=op(this.cloneFrame,a-c.x,l-c.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,l=()=>{let{dragClone:c,dragSource:d,lastCoordinates:h}=this.dragState;if(!c)return;let f=d?.isConnected?d:this,m=Rl(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=Ml(m,this.cloneZoom),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",l),a.addEventListener("webkitfullscreenchange",l),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",l),a.removeEventListener("webkitfullscreenchange",l)}})}activateAllDroppables(a=!1){this.setDragActive(!0),this.allDropzones.forEach(l=>{let c=this.trackedDragContainers.includes(l);Kt(l,"drag-active",a||!c)})}deactivateAllDroppables(){this.setDragActive(!1),this.allDropzones.forEach(a=>{Kt(a,"drag-active",!1),Kt(a,"drag-over",!1)})}endKeyboardDrag(){this.trackedDraggables.forEach(a=>{a.hasAttribute("data-keyboard-dragging")&&ft(a,"lifted",!1),a.removeAttribute("data-keyboard-dragging")}),this.deactivateAllDroppables()}setDragActive(a){z(this._internals?.states,"drag-active",a,["dragzone-active","dragzone-enabled"])}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{ft(a,"return-target",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",l)}}),this.dragSubscriptions=[],this.cloneFrame=Il,this.cloneZoom=1,this.cursorBeforeDrag!==null&&(this.ownerDocument.documentElement.style.cursor=this.cursorBeforeDrag,this.cursorBeforeDrag=null),this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,l){let c=this._internals;c?.states&&(l?c.states.add(a):c.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)ap(a)&&(z(a.internals.states,"chip",!1),z(a.internals.states,"drop",!1));this.#t.clear(),this.resetDragState()}}return n};var lp={duration:250,easing:"ease",fill:"both"};function Pl(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function cp(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function ze(o){let t=new Map;return o.forEach(e=>{t.set(e,Pl(e))}),t}function dp(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function Ho(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function Ol(o){return Ho(o)>0}function Wo(o,t,e={}){let r=Ho(o);if(r<=0)return null;let i=Pl(o),{deltaX:n,deltaY:s,deltaW:a,deltaH:l}=dp(t,i);if(n===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...lp,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${n}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*r,easing:d,fill:h})}function Be(o,t={}){let e=new Map;return o.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let n=Wo(i,r,t);n&&e.set(i,n)}),e}var hn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},jt=(o,t,e,r='slot[part~="bank"]',i="closestCornersWithInventoryPriority")=>{let n=El(o,t,e,r),s=Uo(n,t,e,r,i);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this.maxAssociations=0,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}#t;isSwapTarget(c){let d=this.dragState.sourceDroppable,h=parseInt(c.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(c)&&!!d&&d!==c&&this.trackedDroppables.includes(d)}isDeclarativeTarget(c){return c?c.acceptsDeclarativeDrops===!0?!0:c.hasAttribute("data-declarative-drops"):!1}chipsIn(c){return this.isDeclarativeTarget(c)?[...this.#t.get(c)??[]]:Array.from(c.querySelectorAll(t))}droppableHolding(c){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(c)||d.contains(c)||!!d.shadowRoot?.contains(c))??null}placeChip(c,d){this.#t.set(c,[...this.#t.get(c)??[],d])}removeChipFromDroppable(c,d){let h=c??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&Kr(h,!1),this.syncDragDropState();return}d.remove()}clearChips(c){this.isDeclarativeTarget(c)?(this.#t.set(c,[]),this.syncDragDropState()):this.chipsIn(c).forEach(d=>d.remove()),Kr(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),x=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[data-draggable="true"]'));c[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,x.length),h[m]=y}this._dragDrop={dragsByTarget:c,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:c}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(c[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((c,d)=>c+d,0)}droppableAtCapacityFromState(c){let d=parseInt(c.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=c.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(c){this._enableFlipAnimations=!c}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Ol(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let c=this.getResponse,d=typeof c=="function"?c.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(c){if(Array.isArray(c)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=c,this._internals.setFormValue(JSON.stringify(c));return}let d=this.getValue,h=typeof d=="function"?d.call(this,c):c,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response)),this.trackedDroppables?.length&&this.validate()}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let c=this._pendingResponse;this._pendingResponse=void 0,this.response=c}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let c=this.dataset.choicesContainerWidth;c&&this.trackedDroppables.forEach(d=>{d.style.width=`${c}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(c){for(let h of c){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=c.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(c,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(c,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(c,d,h);let f=c.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity({trigger:"change"})}handleInvalidDrop(c){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!c)return;if(d&&f&&m)this.dropDraggableInDroppable(c,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(c,d,this.dragState.dragClone?.getBoundingClientRect());else if(zo(c,"lifted")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),x=this.maxAssociations>0&&y>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity({trigger:"change"})}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{Wo(c,cp(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){dn(c),c.style.display="",c.style.position="",this.animateReturn(c,d)}placeResponse(c){let[d,...h]=c.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=Zr(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(c,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(c,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(c,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let _=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),_&&this.restoreOriginalInInventory(_,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,x=y===0||y>1,u=Array.from(d.querySelectorAll('[data-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?ze(u):null;if(!x){let _=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[data-draggable="true"]'));if(_){let A=_.getAttribute("identifier"),C=_.getBoundingClientRect();this.removeChipFromDroppable(d,_);let k=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&k&&k!==d&&this.isDeclarativeTarget(k)?k:null;R?(this.placeChip(R,_),Kr(R,!0),this.animateReturn(_,C)):A&&this.restoreOriginalInInventory(A,C)}}let b=c.cloneNode(!0);b.removeAttribute("style"),b.removeAttribute("data-keyboard-dragging"),b.setAttribute("data-draggable","true"),b.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(b.setAttribute("part",b.localName==="qti-gap-text"?"chip text drag drag-text":"chip drag"),b.setAttribute("exportparts",["control: chip-control, control: drag-control, label: chip-label, label: drag-label","correction, candidate-correct, candidate-incorrect, candidate-partial","correction-correct, correction-incorrect, correction-partially-correct"].join(", ")),this.placeChip(d,b)):d.tagName==="SLOT"?b.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&b.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(b)),Kr(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Be(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let _=b.getBoundingClientRect(),A=h.left-_.left,C=h.top-_.top;(A!==0||C!==0)&&b.animate([{transform:`translate(${A}px, ${C}px)`},{transform:"translate(0, 0)"}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let q=c.getAttribute("identifier");q&&this.updateInventoryBasedOnMatchMax(q),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&Kr(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=Zr(this.trackedDragContainers,c),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[data-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let y=this.enableFlipAnimations&&m.length>0?ze(m):null;h.forEach(x=>{dn(x),x.style.display="",x.style.visibility="visible"}),y&&this.enableFlipAnimations&&Be(y,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=Zr(this.trackedDragContainers,c),h=np(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(x=>x.getAttribute("identifier")===c).length:m+y.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{ft(m,"used",h!==0&&f>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source"),y=this.droppableAtCapacityFromState(f);br(f,(y||d&&h)&&!m)})}saveResponse(c){let d=this.getResponse,h=c??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(c=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this.trackedDroppables.forEach(d=>br(d,!1)),this.checkAllMaxAssociations(),this.resetValidityReport(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),c&&this.saveResponse()}validate(){let c=this.totalAssociationsFromState(),d=this.maxAssociations>0&&c>=this.maxAssociations,h=this.maxAssociations>0&&c>this.maxAssociations,f=this.minAssociations>0&&c<this.minAssociations,m="",y=!0,x="other";h?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):f?(x="min",m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let u=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,u,{suppressInline:!0,kind:x}),y}reportValidity(c){return super.reportValidity(c)}}return hn([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),hn([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",void 0),hn([Q({context:Le})],a.prototype,"_dragDrop",void 0),hn([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),hn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Xt({emptyAs:[]})})],a.prototype,"response",null),a};var Qo=class{getInsertPosition(t,e,r,i,n){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),l=(n-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var hp=new Qo;var vf={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function pn(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function Xo(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function Go(o,t,e={}){let r={...vf,...e},i=document.createElement("div");return i.setAttribute("data-drop-preview","true"),i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(o).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(o).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*Ho(o)}ms ease`,i.style.pointerEvents="none",i}function Dl(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var Ft=(o,t='[data-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=pn(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#n=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#r;#i;#n;#o;set allowReorder(i){this.#o=i}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(i){return Dl(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let n=this.#l(i);return n===0||n>1}#l(i){let n=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(n)?1:n}#p(i){return i.querySelectorAll(t).length}#c(i){let n=this.#l(i);return n===0?!1:this.#p(i)>=n}#d(){this.#i={hoveredSlot:null,originalPositions:new Map}}#h(i){if(!this.#t||i===this.#t){this.#u();return}if(this.#i.hoveredSlot===i)return;this.#u();let n=this.#s(i);if(!n){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#c(i)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#i.hoveredSlot=null;return}this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.isDeclarativeTarget(i)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#i.hoveredSlot=i;return}let a=ze([n]);this.#i.originalPositions.set(n,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(n),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,Be(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),n=i.length>0?ze(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),n&&Be(n,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,n,s,a,...l){this.#t=null,this.#r=pn(),this.#d();let c=this.findContainingDroppable(i);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#r.sortContainer=c;let h=i.getBoundingClientRect();this.#r.placeholder=Go(i,h,this.sortablePlaceholderConfig);let f=i.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",c.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#c(m))return;br(m,!1),this.#n.add(m)}})}let[d]=l;super.initiateDrag(i,n,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[n,s]of this.#i.originalPositions)s.appendChild(n);this.#r.placeholder&&this.#r.placeholder.remove(),Xo(this.#r),this.#n.clear(),this.#t=null,this.#d()}onSortableDragMove(i,n){if(!this.isDraggingFromSlot)return;let s=Yr(this.trackedDroppables,i,n,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#h(s):this.#u()}handleDragMove(i,n){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,n),this.onSortableDragMove(i,n)}allowDrop(i,n){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&n!==this.#e&&this.trackedDroppables.includes(n)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(n)?this.#a(n)?!this.#c(n):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(n)?!0:super.allowDrop(i,n)}handleDrop(i,n){super.handleDrop(i,n),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var pp=[M,U,Wt,w`
|
|
6872
6872
|
:host {
|
|
6873
6873
|
display: block; /* necessary to calculate scaling position */
|
|
6874
6874
|
}
|
|
@@ -6925,7 +6925,7 @@ div.full-correct-response-inline {
|
|
|
6925
6925
|
:host([answer-key]) ::slotted(qti-simple-associable-choice) {
|
|
6926
6926
|
display: none;
|
|
6927
6927
|
}
|
|
6928
|
-
`];var
|
|
6928
|
+
`];var kf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ef=jt(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),vr=class extends Ft(Ef,'[data-draggable="true"]'){static{this.styles=pp}constructor(){super(),this._childrenMap=[],this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(t){let e=t.composedPath()[0];if(this.shadowRoot?.contains(e))return;let r=e;this._childrenMap.includes(r)||(this._childrenMap=[...this._childrenMap,r])}#t(t,e){let r=this._dragDrop?.nodesByTarget?.[t]??[];return v`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
|
|
6929
6929
|
${H(r,i=>i.getAttribute("identifier"),i=>i)}
|
|
6930
6930
|
</div>`}get#e(){return this.maxAssociations>0?this.maxAssociations:Math.ceil(this._childrenMap.length/2)}getResponse(){let t=[];for(let e=0;e<this.#e;e++){let r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),i=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),n=r&&this.chipsIn(r)[0]?.getAttribute("identifier"),s=i&&this.chipsIn(i)[0]?.getAttribute("identifier");n&&s&&t.push(`${n} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,r)=>{let i=e.split(" ");return i.length!==2?[]:[`${i[0]} droplist${r}_left`,`${i[1]} droplist${r}_right`]})??[]}render(){return v` <slot name="prompt"></slot>
|
|
6931
6931
|
<slot part="bank drags" name="qti-simple-associable-choice"></slot>
|
|
@@ -6936,7 +6936,7 @@ div.full-correct-response-inline {
|
|
|
6936
6936
|
</div>`)}
|
|
6937
6937
|
|
|
6938
6938
|
<div role="alert" part="message" id="validation-message"></div>
|
|
6939
|
-
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};
|
|
6939
|
+
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};kf([T()],vr.prototype,"_childrenMap",void 0);var Jo=[{tag:"qti-associate-interaction",ctor:vr}];var Ue=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},He=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(i,n)=>{this._choiceElements.forEach(s=>s.disabled=n)},this._handleReadonlyChange=(i,n)=>{this._choiceElements.forEach(s=>s.readonly=n)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(i,n){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(i){this.maxChoices>1&&(typeof i=="string"||i===null)?this.response=i?i.toString().split(","):[]:this.response=i||""}firstUpdated(){super.firstUpdated(),this._updateChoiceSelection()}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#t.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t&&(this.#t.disconnect(),this.#t=null)}_syncChoicesFromDOM(){let i=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{i.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let n=new Set(this._choiceElements.map(s=>s.getAttribute("identifier")??s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>n.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!n.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let n=this._choiceElements.filter(d=>this._getChoiceChecked(d)).length,s=!0,a="",l="other";this.maxChoices!==0&&n>this.maxChoices?(s=!1,l="max",a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):n<this.minChoices&&(s=!1,l="min",a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let c=this._choiceElements.find(d=>this.contains(d))||this;return this.setInteractionValidity(s,a,c,{suppressInline:!0,kind:l}),s}reportValidity(i){return super.reportValidity(i)}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let i=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==i&&(this._interactionContext={...this._interactionContext,choiceRole:i})}_choiceElementSelectedHandler(i){this._toggleChoiceChecked(i.target);let n=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==i.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&n&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(i,n){i.internals?.states&&(n?(i.internals.states.add("checked"),i.internals.ariaChecked="true"):(i.internals.states.delete("checked"),i.internals.ariaChecked="false"))}_getChoiceChecked(i){return i.internals.states.has("checked")}_toggleChoiceChecked(i){let n=this._getChoiceChecked(i);this._setChoiceChecked(i,!n)}_handleChoiceSelection(){let n=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?n[0]||"":n,this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(this.response)}_updateChoiceSelection(){let i=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(n=>{let s=i.includes(n.identifier);this._setChoiceChecked(n,s)})}}return Ue([Ir("#validation-message")],e.prototype,"_validationMessageElement",void 0),Ue([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Ue([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Ue([N("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Ue([N("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Ue([N("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Ue([p({attribute:"response",reflect:!1,converter:Xt({emptyAs:""})})],e.prototype,"response",void 0),Ue([N("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var Sf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},up=(o,t)=>{class e extends o{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#r=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#i=null;set class(i){this.#t=this.#n(i),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(i,n,s){super.attributeChangedCallback(i,n,s),i==="class"&&n!==s&&(this.class=s??"")}updated(i){super.updated(i),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(i=>{i.some(n=>n.type==="childList"||n.type==="attributes"&&n.attributeName==="style")&&this.#o()}),this.#i.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){super.disconnectedCallback(),this.#i?.disconnect(),this.#i=null}#n(i){return i?i.split(/\s+/).map(n=>n.trim()).filter(Boolean).filter((n,s,a)=>a.indexOf(n)===s):[]}#o(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),n=this.#s(i),s=this.#a(),a=this.#l();n.forEach((l,c)=>{l.marker=this.#p(c+1,s,a)})}#s(i){return i.map((n,s)=>{let a=Number(n.style.order);return{el:n,order:Number.isFinite(a)?a:s+1,index:s}}).sort((n,s)=>n.order-s.order||n.index-s.index).map(n=>n.el)}#a(){return this.#t.filter(i=>this.#e.includes(i)).pop()??null}#l(){return this.#t.filter(i=>this.#r.includes(i)).pop()??null}#p(i,n,s){let a=n;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let l="";switch(a){case"qti-labels-decimal":l=`${i}`;break;case"qti-labels-lower-alpha":l=this.#c(i,"lower");break;case"qti-labels-upper-alpha":l=this.#c(i,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#c(i,n){let s=i,a="",l=n==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return Sf([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var mp=[M,U,w`
|
|
6940
6940
|
:host {
|
|
6941
6941
|
display: block;
|
|
6942
6942
|
}
|
|
@@ -7005,16 +7005,16 @@ div.full-correct-response-inline {
|
|
|
7005
7005
|
:host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
|
|
7006
7006
|
grid-row: auto;
|
|
7007
7007
|
}
|
|
7008
|
-
`];var
|
|
7008
|
+
`];var Af=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},yr=class extends up(He(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=mp}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return v`
|
|
7009
7009
|
<slot part="prompt" name="prompt"></slot>
|
|
7010
7010
|
<slot part="choices slot" @slotchange=${this.#t}></slot>
|
|
7011
7011
|
<div part="message" role="alert" id="validation-message"></div>
|
|
7012
|
-
`}};
|
|
7012
|
+
`}};Af([p({type:String})],yr.prototype,"orientation",void 0);var Yo=[{tag:"qti-choice-interaction",ctor:yr}];var fp=[M,w`
|
|
7013
7013
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7014
7014
|
:host {
|
|
7015
7015
|
display: block;
|
|
7016
7016
|
}
|
|
7017
|
-
`];var
|
|
7017
|
+
`];var un=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},$l=`
|
|
7018
7018
|
const postToParentWindows = (type, data) => {
|
|
7019
7019
|
window.top.postMessage(data ? { type, data } : { type }, '*');
|
|
7020
7020
|
let w = window.parent;
|
|
@@ -7081,7 +7081,7 @@ window.CES = {
|
|
|
7081
7081
|
},
|
|
7082
7082
|
};
|
|
7083
7083
|
CES.load();
|
|
7084
|
-
`,
|
|
7084
|
+
`,_f=`
|
|
7085
7085
|
(function() {
|
|
7086
7086
|
var blobUrlReceived = null;
|
|
7087
7087
|
|
|
@@ -7125,7 +7125,7 @@ CES.load();
|
|
|
7125
7125
|
requestBlobUrl();
|
|
7126
7126
|
}
|
|
7127
7127
|
})();
|
|
7128
|
-
`,ve=class extends D{#t;#e;#r;static{this.styles=
|
|
7128
|
+
`,ve=class extends D{#t;#e;#r;static{this.styles=fp}constructor(){super(),this.#t="",this.#e=null,this.#r=null,this._errorMessage=null,this.#i=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#i;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let r=this.querySelector("object[data]");if(r){t=r.getAttribute("data");let i=r.getAttribute("width"),n=r.getAttribute("height");i&&this.setAttribute("width",i),n&&this.setAttribute("height",n)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:ro((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}async setupCES(){await this.updateComplete;let t=this.shadowRoot?.querySelector("#pciContainer");if(!t){this._errorMessage="pciContainer iframe not found";return}t.getAttribute("src")||t.setAttribute("src","about:blank");let e=t.contentDocument??t.contentWindow?.document??null;if(e||(await new Promise(d=>t.addEventListener("load",()=>d(),{once:!0})),e=t.contentDocument??t.contentWindow?.document??null),!e){this._errorMessage="pciContainer iframe document not available";return}if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let r=this.manifest.style[0],i=this.#a(),n=await this.#c(r,i),s=n.url;if(n.baseUrl&&!this.#r&&(this.#r=n.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#c(h,i,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#r&&(this.#r=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+$l+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let x=new Blob([m],{type:"text/html"});this.#i=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",y=await this.#c(m,i,{returnText:!0});if(d=y.url,y.baseUrl&&!this.#r&&(this.#r=y.baseUrl),y.text){let x=y.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let b="<script>"+$l+"</script>",q=x.indexOf("<head>");q!==-1?x=x.slice(0,q+6)+b+x.slice(q+6):x=b+x}let g=new Blob([x],{type:"text/html"});this.#i=URL.createObjectURL(g)}}if(d&&!this.#i)try{let h=await fetch(d);if(h.ok){let f=await h.text();if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let x="<script>"+$l+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let y=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(y)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${_f}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
|
|
7129
7129
|
<!DOCTYPE html>
|
|
7130
7130
|
<html>
|
|
7131
7131
|
<head>
|
|
@@ -7145,9 +7145,9 @@ CES.load();
|
|
|
7145
7145
|
${this._errorMessage&&v`<div style="color:red">
|
|
7146
7146
|
<h1>Error</h1>
|
|
7147
7147
|
${this._errorMessage}
|
|
7148
|
-
</div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#l()].filter(Boolean).map(i=>new URL(i,window.location.href).toString()),r=this.#p();return r&&e.push(r),[...new Set(e)]}#l(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#c(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let i of e){let n=new URL(i,window.location.href).toString(),s=new URL(t,n.endsWith("/")?n:`${n}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let l=await a.text();return{url:s,baseUrl:n,text:l}}return{url:s,baseUrl:n}}}catch{}}return{url:"",baseUrl:null}}};
|
|
7148
|
+
</div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#l()].filter(Boolean).map(i=>new URL(i,window.location.href).toString()),r=this.#p();return r&&e.push(r),[...new Set(e)]}#l(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#c(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let i of e){let n=new URL(i,window.location.href).toString(),s=new URL(t,n.endsWith("/")?n:`${n}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let l=await a.text();return{url:s,baseUrl:n,text:l}}return{url:s,baseUrl:n}}}catch{}}return{url:"",baseUrl:null}}};un([p({type:String,attribute:"data"})],ve.prototype,"data",void 0);un([p({type:String,attribute:"data-base-item"})],ve.prototype,"baseItemUrl",void 0);un([p({type:String,attribute:"data-base-ref"})],ve.prototype,"baseRefUrl",void 0);un([p({type:String,attribute:"id"})],ve.prototype,"id",void 0);un([T()],ve.prototype,"_errorMessage",void 0);var Ko=[{tag:"qti-custom-interaction",ctor:ve}];var gp=[M];var mn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ye=class extends E{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=gp}get#t(){let t=this._itemContext;if(!t)return!1;if(t.disabled||t.readonly)return!0;let e=this.closest("qti-assessment-item")?.getAttribute("adaptive")==="true",r=t.variables?.find(i=>i.identifier==="completionStatus")?.value;return e&&r==="completed"}render(){return v`<button ?disabled=${this.disabled||this.#t} part="button" @click=${this.endAttempt}>
|
|
7149
7149
|
${this.title}
|
|
7150
|
-
</button>`}endAttempt(t){this.disabled||this.#t||this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt!=="false"}}))}};
|
|
7150
|
+
</button>`}endAttempt(t){this.disabled||this.#t||this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt!=="false"}}))}};mn([p({type:String,attribute:"response-identifier"})],ye.prototype,"responseIdentifier",void 0);mn([p({reflect:!0,type:Boolean})],ye.prototype,"disabled",void 0);mn([I({context:j,subscribe:!0}),T()],ye.prototype,"_itemContext",void 0);mn([p({type:String,attribute:"count-attempt"})],ye.prototype,"countAttempt",void 0);mn([p({type:String})],ye.prototype,"title",void 0);var Zo=[{tag:"qti-end-attempt-interaction",ctor:ye}];var bp=[M,w`
|
|
7151
7151
|
/* PK: display host as block, else design will be collapsed */
|
|
7152
7152
|
/* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
|
|
7153
7153
|
:host {
|
|
@@ -7160,7 +7160,7 @@ CES.load();
|
|
|
7160
7160
|
height: 100%;
|
|
7161
7161
|
border: 0;
|
|
7162
7162
|
}
|
|
7163
|
-
`];var gt=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},
|
|
7163
|
+
`];var gt=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vp=5,Tf=50,yp="qti-height-lines-",qp=!1,X=class extends D{constructor(){super(...arguments),this._rows=vp,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||qp||(qp=!0,console.warn('<qti-extended-text-interaction format="xhtml"> renders as plain text. The interaction has no rich-text editor; the recorded response will contain no markup.'))},this.minStrings=0,this.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=bp}_handleRowsInputChange(){this._rows=this.#t()}#t(){let t=this.#e();return t!==null?t:this.expectedLines>0?this.expectedLines:this.expectedLength>0?Math.ceil(this.expectedLength/Tf):vp}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(yp))continue;let e=parseInt(t.slice(yp.length),10);if(!Number.isNaN(e)&&e>0)return e}return null}get value(){return this.response||null}set value(t){this.response=t||null}validate(){let t=this.shadowRoot.querySelector("textarea");if(!t)return!1;let e="",r=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let n=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,s=new RegExp(n);r=t.checkValidity()&&s.test(t.value),r||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else r=t.checkValidity();let i="other";return r&&!this.response&&this.minStrings>=1&&(r=!1,i="min"),!r&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(r,e,t,{suppressInline:!0,kind:i}),r}reportValidity(t){return this.validate(),super.reportValidity(t)}renderPrompt(){return v`<slot name="prompt"></slot>`}renderTextarea(){return v`<textarea
|
|
7164
7164
|
part="textarea"
|
|
7165
7165
|
name="${this.responseIdentifier}"
|
|
7166
7166
|
spellcheck="false"
|
|
@@ -7175,7 +7175,7 @@ CES.load();
|
|
|
7175
7175
|
?disabled="${this.disabled}"
|
|
7176
7176
|
?readonly="${this.readonly}"
|
|
7177
7177
|
.value=${this.response}
|
|
7178
|
-
></textarea>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value),this.reportValidity({trigger:"change"}))}};gt([T()],X.prototype,"_rows",void 0);gt([p({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",void 0);gt([p({type:Number,attribute:"expected-lines"})],X.prototype,"expectedLines",void 0);gt([p({type:String,reflect:!0})],X.prototype,"format",void 0);gt([N("format")],X.prototype,"_handleFormatChange",void 0);gt([p({type:Number,attribute:"min-strings"})],X.prototype,"minStrings",void 0);gt([p({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",void 0);gt([p({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",void 0);gt([p({type:String,attribute:"data-patternmask-message"})],X.prototype,"dataPatternmaskMessage",void 0);gt([p({type:String,attribute:"class"})],X.prototype,"classNames",void 0);gt([N(["classNames","expectedLines","expectedLength"])],X.prototype,"_handleRowsInputChange",null);gt([p({type:String,attribute:"response",reflect:!1})],X.prototype,"response",void 0);gt([N("response",{waitUntilFirstUpdate:!0})],X.prototype,"_handleResponseChange",void 0);var ts=[{tag:"qti-extended-text-interaction",ctor:X}];var
|
|
7178
|
+
></textarea>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value),this.reportValidity({trigger:"change"}))}};gt([T()],X.prototype,"_rows",void 0);gt([p({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",void 0);gt([p({type:Number,attribute:"expected-lines"})],X.prototype,"expectedLines",void 0);gt([p({type:String,reflect:!0})],X.prototype,"format",void 0);gt([N("format")],X.prototype,"_handleFormatChange",void 0);gt([p({type:Number,attribute:"min-strings"})],X.prototype,"minStrings",void 0);gt([p({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",void 0);gt([p({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",void 0);gt([p({type:String,attribute:"data-patternmask-message"})],X.prototype,"dataPatternmaskMessage",void 0);gt([p({type:String,attribute:"class"})],X.prototype,"classNames",void 0);gt([N(["classNames","expectedLines","expectedLength"])],X.prototype,"_handleRowsInputChange",null);gt([p({type:String,attribute:"response",reflect:!1})],X.prototype,"response",void 0);gt([N("response",{waitUntilFirstUpdate:!0})],X.prototype,"_handleResponseChange",void 0);var ts=[{tag:"qti-extended-text-interaction",ctor:X}];var xp=[M,U,w`
|
|
7179
7179
|
:host {
|
|
7180
7180
|
display: flex;
|
|
7181
7181
|
align-items: flex-start;
|
|
@@ -7223,10 +7223,10 @@ CES.load();
|
|
|
7223
7223
|
:host([answer-key]) [part~='bank'] {
|
|
7224
7224
|
display: none;
|
|
7225
7225
|
}
|
|
7226
|
-
`];var ti=class extends Ft(jt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1}static{this.styles=
|
|
7226
|
+
`];var ti=class extends Ft(jt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1}static{this.styles=xp}render(){return v`<slot name="prompt"> </slot>
|
|
7227
7227
|
<slot part="bank drags" name="drags"></slot>
|
|
7228
7228
|
<slot part="drops"></slot>
|
|
7229
|
-
<div role="alert" part="message" id="validation-message"></div>`}};var es=[{tag:"qti-gap-match-interaction",ctor:ti}];function
|
|
7229
|
+
<div role="alert" part="message" id="validation-message"></div>`}};var es=[{tag:"qti-gap-match-interaction",ctor:ti}];function Ep(o){return o.querySelector('img, object[type^="image"]')}function wp(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let r=parseFloat(e);return Number.isFinite(r)&&r>0?r:null}var Sp=new WeakMap,Cp=new WeakMap;function If(o){let t=Cp.get(o);return t||(t=new Promise(e=>{let r=o.data;if(!r){e(null);return}let i=new Image;i.onload=()=>{let n={width:i.naturalWidth,height:i.naturalHeight};if(!(n.width>0)||!(n.height>0)){e(null);return}Sp.set(o,n),e(n)},i.onerror=()=>e(null),i.src=r}),Cp.set(o,t)),t}function Rf(o){if(o.localName==="object")return Sp.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function rs(o){let t=wp(o,"width"),e=wp(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let r=Rf(o);return r?{width:t??r.width,height:e??r.height}:null}function Mf(o){let t=rs(o);if(t)return Promise.resolve(t);if(o.localName==="object")return If(o).then(()=>rs(o));let e=o;return e.complete?Promise.resolve(null):new Promise(r=>{let i=()=>{e.removeEventListener("load",i),e.removeEventListener("error",i),r(rs(o))};e.addEventListener("load",i),e.addEventListener("error",i)})}function Zt(o,t,e,r){let i=rs(e);if(i){kp(o,t,i,r);return}Mf(e).then(n=>{if(!n){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}kp(o,t,n,r)})}function kp(o,t,{width:e,height:r},i){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[n,s,a]=t,l=n/e*100,c=s/r*100,d=a/e*100,h=a/r*100;i.style.left=l-d+"%",i.style.top=c-h+"%",i.style.width=2*d+"%",i.style.height=2*h+"%",i.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[n,s,a,l]=t,c=n/e*100,d=s/r*100,h=a/e*100,f=l/r*100;i.style.left=c+"%",i.style.top=d+"%",i.style.width=h-c+"%",i.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[n,s,a,l]=t,c=n/e*100,d=s/r*100,h=a/e*100,f=l/r*100;i.style.left=c-h+"%",i.style.top=d-f+"%",i.style.width=2*h+"%",i.style.height=2*f+"%",i.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let n=[];for(let b=0;b<t.length;b+=2)n.push({x:t[b],y:t[b+1]});let s=Math.min(...n.map(b=>b.x)),a=Math.max(...n.map(b=>b.x)),l=Math.min(...n.map(b=>b.y)),c=Math.max(...n.map(b=>b.y)),d=s/e*100,h=l/r*100,f=a/e*100,m=c/r*100;i.style.left=d+"%",i.style.top=h+"%",i.style.width=f-d+"%",i.style.height=m-h+"%";let y=n.map(b=>({x:(b.x-s)/(a-s)*100,y:(b.y-l)/(c-l)*100})),x=y.map(b=>`${b.x}% ${b.y}%`).join(",");i.style.clipPath=`polygon(${x})`;let u=y.map(b=>`${b.x},${b.y}`).join(" "),g=b=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${u}' fill='none' stroke='black' stroke-width='${b}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;i.style.setProperty("--qti-shape-outline",g(4)),i.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":i.style.left="0%",i.style.top="0%",i.style.width="100%",i.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var Ap=[M,U,w`
|
|
7230
7230
|
/* Containing block for the absolutely positioned hotspots over the image. Was on this host in
|
|
7231
7231
|
the theme, together with a 'display: block' this component now owns. */
|
|
7232
7232
|
:host {
|
|
@@ -7275,7 +7275,7 @@ CES.load();
|
|
|
7275
7275
|
::slotted(qti-associable-hotspot) {
|
|
7276
7276
|
cursor: pointer;
|
|
7277
7277
|
}
|
|
7278
|
-
`];var qr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bt=class extends D{static{this.styles=
|
|
7278
|
+
`];var qr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bt=class extends D{static{this.styles=Ap}#t;#e;constructor(){super(),this.#t=[],this.#e=null,this._response=[],this.minAssociations=0,this.maxAssociations=1,this.addEventListener("qti-register-hotspot",this.#o)}reset(){this.resetValidityReport(),this._response=[],this._internals.setFormValue(null),this.validate(),this.#e=null,this.#h()}validate(){let t=this.#n().length,e=this.maxAssociations>0&&t>this.maxAssociations,r=t<this.minAssociations,i="other",n="";e?(i="max",n=this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):r&&(i="min",n=this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`);let s=!e&&!r;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:i}),s}reportValidity(t){return super.reportValidity(t)}set response(t){this._response=this.#i(t),this.#r(!1),this.#h()}#r(t){let e=this.#n();this._internals.setFormValue(e.length?JSON.stringify(e):null),this.validate(),t&&this.reportValidity({trigger:"change"})}get response(){return this._response}#i(t){return t==null||t===""?[]:Array.isArray(t)?t:[t]}#n(){return this.#i(this._response)}renderSupplementalLines(){return P}render(){return v`<slot name="prompt"></slot>
|
|
7279
7279
|
<line-container
|
|
7280
7280
|
@click=${t=>{this.#e&&!t.composedPath().some(e=>this.#t.includes(e))&&this.#a()}}
|
|
7281
7281
|
>
|
|
@@ -7312,7 +7312,7 @@ CES.load();
|
|
|
7312
7312
|
</svg>
|
|
7313
7313
|
<slot></slot>
|
|
7314
7314
|
</line-container>
|
|
7315
|
-
<div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),n=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));Zt(n,s,e,r)}firstUpdated(){super.firstUpdated(),this.#t=Array.from(this.querySelectorAll("qti-associable-hotspot")),this.addEventListener("mousemove",t=>{let e=this.grImage[0];if(!e)return;let r=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-r.left,y:t.clientY-r.top}}),this.#t.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.tabIndex=0,t.setAttribute("role","button"),t.hasAttribute("aria-label")||t.setAttribute("aria-label",t.getAttribute("hotspot-label")||t.getAttribute("identifier")),t.addEventListener("click",()=>this.#s(t)),t.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.#s(t))})}),this.addEventListener("keydown",t=>{t.key==="Escape"&&this.#e&&this.#a()}),this.#h()}#s(t){if(this.disabled||this.readonly)return;if(!this.#e){if(this.#c(t))return;this.#e=t,this.startCoord=this.#d(t),this.mouseCoord=this.startCoord,this.#h();return}if(t===this.#e){this.#a();return}let e=this.#e.getAttribute("identifier"),r=t.getAttribute("identifier"),i=this.#n(),n=i.some(a=>this.#p(a,e,r)),s=this.maxAssociations===0||i.length<this.maxAssociations;!n&&s&&!this.#c(t)&&(this._response=[...i,`${e} ${r}`],this.saveResponse(this.response),this.#r(!0)),this.#a()}#a(){this.#e=null,this.#h(),this.requestUpdate()}#l(t){this.disabled||this.readonly||(this._response=this.#n().filter((e,r)=>r!==t),this.saveResponse(this.response),this.#r(!0),this.#h())}#p(t,e,r){let[i,n]=t.split(" ");return i===e&&n===r||i===r&&n===e}#c(t){let e=Number(t.getAttribute("match-max")??0);if(!e)return!1;let r=t.getAttribute("identifier");return this.#n().filter(i=>i.split(" ").includes(r)).length>=e}#d(t){let[e,r]=(t.getAttribute("coords")??"0,0").split(",").map(i=>parseInt(i));return{x:e,y:r}}#h(){for(let t of this.#t){let e=t.internals?.states;z(e,"checked",t===this.#e),z(e,"full",this.#c(t))}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};qr([T()],bt.prototype,"startCoord",void 0);qr([T()],bt.prototype,"mouseCoord",void 0);qr([
|
|
7315
|
+
<div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),n=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));Zt(n,s,e,r)}firstUpdated(){super.firstUpdated(),this.#t=Array.from(this.querySelectorAll("qti-associable-hotspot")),this.addEventListener("mousemove",t=>{let e=this.grImage[0];if(!e)return;let r=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-r.left,y:t.clientY-r.top}}),this.#t.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.tabIndex=0,t.setAttribute("role","button"),t.hasAttribute("aria-label")||t.setAttribute("aria-label",t.getAttribute("hotspot-label")||t.getAttribute("identifier")),t.addEventListener("click",()=>this.#s(t)),t.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.#s(t))})}),this.addEventListener("keydown",t=>{t.key==="Escape"&&this.#e&&this.#a()}),this.#h()}#s(t){if(this.disabled||this.readonly)return;if(!this.#e){if(this.#c(t))return;this.#e=t,this.startCoord=this.#d(t),this.mouseCoord=this.startCoord,this.#h();return}if(t===this.#e){this.#a();return}let e=this.#e.getAttribute("identifier"),r=t.getAttribute("identifier"),i=this.#n(),n=i.some(a=>this.#p(a,e,r)),s=this.maxAssociations===0||i.length<this.maxAssociations;!n&&s&&!this.#c(t)&&(this._response=[...i,`${e} ${r}`],this.saveResponse(this.response),this.#r(!0)),this.#a()}#a(){this.#e=null,this.#h(),this.requestUpdate()}#l(t){this.disabled||this.readonly||(this._response=this.#n().filter((e,r)=>r!==t),this.saveResponse(this.response),this.#r(!0),this.#h())}#p(t,e,r){let[i,n]=t.split(" ");return i===e&&n===r||i===r&&n===e}#c(t){let e=Number(t.getAttribute("match-max")??0);if(!e)return!1;let r=t.getAttribute("identifier");return this.#n().filter(i=>i.split(" ").includes(r)).length>=e}#d(t){let[e,r]=(t.getAttribute("coords")??"0,0").split(",").map(i=>parseInt(i));return{x:e,y:r}}#h(){for(let t of this.#t){let e=t.internals?.states;z(e,"checked",t===this.#e),z(e,"full",this.#c(t))}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};qr([T()],bt.prototype,"startCoord",void 0);qr([T()],bt.prototype,"mouseCoord",void 0);qr([Uc({selector:"img"})],bt.prototype,"grImage",void 0);qr([T()],bt.prototype,"_response",void 0);qr([p({type:Number,attribute:"min-associations"})],bt.prototype,"minAssociations",void 0);qr([p({type:Number,attribute:"max-associations"})],bt.prototype,"maxAssociations",void 0);qr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Xt({emptyAs:[]})})],bt.prototype,"response",null);var is=[{tag:"qti-graphic-associate-interaction",ctor:bt}];var _p=[M,U,w`
|
|
7316
7316
|
:host {
|
|
7317
7317
|
display: flex;
|
|
7318
7318
|
align-items: flex-start;
|
|
@@ -7401,10 +7401,10 @@ CES.load();
|
|
|
7401
7401
|
user-select: none;
|
|
7402
7402
|
pointer-events: none;
|
|
7403
7403
|
}
|
|
7404
|
-
`];var
|
|
7404
|
+
`];var Pf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Of=jt(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='bank']"),xr=class extends Ft(Of,'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1,this.autoSizeDropzones=!1,this._graphicScale=1,this.#t=null,this.#e=null,this.#s=t=>{this.#n(t.target)}}static{this.styles=_p}#t;#e;render(){let t=`--qti-graphic-scale: ${this._graphicScale}`;return v` <slot name="prompt"></slot>
|
|
7405
7405
|
<slot part="image" style=${t}></slot>
|
|
7406
7406
|
<slot part="bank drags" name="drags" class="hover-border" style=${t}></slot>
|
|
7407
|
-
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#r(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#i(t){if(t.style.aspectRatio)return;let e=n=>{let s=(t.getAttribute(n)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},r=e("width"),i=e("height");r&&i&&(t.style.aspectRatio=`${r} / ${i}`)}#n(t){let e=this.#r(),r=t.getAttribute("coords"),i=t.getAttribute("shape");!e||!r||!i||(this.#i(e),this.#o(e),Zt(i,r.split(",").map(n=>parseFloat(n)),e,t))}#o(t){this.#e!==t&&(this.#t?.disconnect(),this.#e=t,this.#t=new ResizeObserver(()=>{let e=parseFloat(t.getAttribute("width")??""),r=t.getBoundingClientRect().width,i=e>0&&r>0?Math.min(1,r/e):1,n=Math.round(i*1e3)/1e3;n!==this._graphicScale&&(this._graphicScale=n)}),this.#t.observe(t))}#s;connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#s),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#n(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s),this.#t?.disconnect(),this.#t=null,this.#e=null}};
|
|
7407
|
+
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#r(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#i(t){if(t.style.aspectRatio)return;let e=n=>{let s=(t.getAttribute(n)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},r=e("width"),i=e("height");r&&i&&(t.style.aspectRatio=`${r} / ${i}`)}#n(t){let e=this.#r(),r=t.getAttribute("coords"),i=t.getAttribute("shape");!e||!r||!i||(this.#i(e),this.#o(e),Zt(i,r.split(",").map(n=>parseFloat(n)),e,t))}#o(t){this.#e!==t&&(this.#t?.disconnect(),this.#e=t,this.#t=new ResizeObserver(()=>{let e=parseFloat(t.getAttribute("width")??""),r=t.getBoundingClientRect().width,i=e>0&&r>0?Math.min(1,r/e):1,n=Math.round(i*1e3)/1e3;n!==this._graphicScale&&(this._graphicScale=n)}),this.#t.observe(t))}#s;connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#s),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#n(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s),this.#t?.disconnect(),this.#t=null,this.#e=null}};Pf([T()],xr.prototype,"_graphicScale",void 0);var ns=[{tag:"qti-graphic-gap-match-interaction",ctor:xr}];var Tp=[M,U,w`
|
|
7408
7408
|
/* The order pins are anchored outside their hotspot's box. */
|
|
7409
7409
|
:host {
|
|
7410
7410
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
@@ -7442,11 +7442,11 @@ CES.load();
|
|
|
7442
7442
|
pointer-events: none;
|
|
7443
7443
|
user-select: none;
|
|
7444
7444
|
}
|
|
7445
|
-
`];var
|
|
7445
|
+
`];var Ip=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},We=class o extends He(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#n=t=>{this.#i(t.target),this.refreshLocatorPins()}}static{this.styles=Tp}static#t="cito-graphic-order-marker";render(){return v`
|
|
7446
7446
|
<slot name="prompt"></slot>
|
|
7447
7447
|
<slot></slot>
|
|
7448
7448
|
<div role="alert" part="message" id="validation-message"></div>
|
|
7449
|
-
`}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(n=>n.identifier===e))return;let r=[...this.#e()],i=r.indexOf(e);if(i>=0)r.splice(i,1);else{let n=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(r.length>=n)return;r.push(e)}this.response=r,this.saveResponse(this.response),this.updateComplete.then(()=>{this.validate(),this.reportValidity({trigger:"change"})})}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#r(t){return`--qti-graphic-order-${(t.identifier||t.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(t){return"var(--qti-selected-bg)"}refreshLocatorPins(){let t=this.#e();for(let n of this._choiceElements){let s=t.indexOf(n.identifier);n.order=s>=0?s+1:null}let e=this._choiceElements.filter(n=>n.order!=null).sort((n,s)=>n.order-s.order),r=Array.from(this.querySelectorAll(`.${o.#t}`));r.length===e.length&&e.every((n,s)=>{let a=r[s];return a.textContent===String(n.order)&&a.style.getPropertyValue("position-anchor")===this.#r(n)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(n)})||(r.forEach(n=>n.remove()),this._choiceElements.forEach(n=>{n.style.removeProperty("anchor-name")}),e.forEach(n=>{let s=this.#r(n);n.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(n)),n.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(n.order),this.append(a)}))}#i(t){let e=
|
|
7449
|
+
`}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(n=>n.identifier===e))return;let r=[...this.#e()],i=r.indexOf(e);if(i>=0)r.splice(i,1);else{let n=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(r.length>=n)return;r.push(e)}this.response=r,this.saveResponse(this.response),this.updateComplete.then(()=>{this.validate(),this.reportValidity({trigger:"change"})})}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#r(t){return`--qti-graphic-order-${(t.identifier||t.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(t){return"var(--qti-selected-bg)"}refreshLocatorPins(){let t=this.#e();for(let n of this._choiceElements){let s=t.indexOf(n.identifier);n.order=s>=0?s+1:null}let e=this._choiceElements.filter(n=>n.order!=null).sort((n,s)=>n.order-s.order),r=Array.from(this.querySelectorAll(`.${o.#t}`));r.length===e.length&&e.every((n,s)=>{let a=r[s];return a.textContent===String(n.order)&&a.style.getPropertyValue("position-anchor")===this.#r(n)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(n)})||(r.forEach(n=>n.remove()),this._choiceElements.forEach(n=>{n.style.removeProperty("anchor-name")}),e.forEach(n=>{let s=this.#r(n);n.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(n)),n.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(n.order),this.append(a)}))}#i(t){let e=Ep(this),r=t.getAttribute("coords"),i=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let n=r.split(",").map(s=>parseInt(s));Zt(i,n,e,t)}#n;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#n),this.refreshLocatorPins(),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#i(t))}disconnectedCallback(){this.querySelectorAll(`.${o.#t}`).forEach(t=>t.remove()),super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#n)}};Ip([p({type:Number,attribute:"max-choices"})],We.prototype,"maxChoices",void 0);Ip([N("response")],We.prototype,"handleOrderedResponseChange",null);var os=[{tag:"qti-graphic-order-interaction",ctor:We}];var Rp=[M,U,w`
|
|
7450
7450
|
:host {
|
|
7451
7451
|
display: block;
|
|
7452
7452
|
}
|
|
@@ -7495,17 +7495,17 @@ CES.load();
|
|
|
7495
7495
|
max-width: 100%;
|
|
7496
7496
|
height: auto;
|
|
7497
7497
|
}
|
|
7498
|
-
`];var ei=class extends He(D,"qti-hotspot-choice"){static{this.styles=
|
|
7498
|
+
`];var ei=class extends He(D,"qti-hotspot-choice"){static{this.styles=Rp}render(){return v`
|
|
7499
7499
|
<slot name="prompt"></slot>
|
|
7500
7500
|
<slot></slot>
|
|
7501
7501
|
<div part="message" role="alert" id="validation-message"></div>
|
|
7502
|
-
`}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let r=()=>{t.removeEventListener("load",r),e(t)};t.addEventListener("load",r)})),this.#t}async#r(t){let e=this.querySelector("img");if(!e)return;let r=t.getAttribute("coords"),i=t.getAttribute("shape"),n=r.split(",").map(a=>parseInt(a)),s=await this.#e(e);Zt(i,n,s,t)}#i=t=>{this.#r(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#i),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var ss=[{tag:"qti-hotspot-interaction",ctor:ei}];var
|
|
7502
|
+
`}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let r=()=>{t.removeEventListener("load",r),e(t)};t.addEventListener("load",r)})),this.#t}async#r(t){let e=this.querySelector("img");if(!e)return;let r=t.getAttribute("coords"),i=t.getAttribute("shape"),n=r.split(",").map(a=>parseInt(a)),s=await this.#e(e);Zt(i,n,s,t)}#i=t=>{this.#r(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#i),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var ss=[{tag:"qti-hotspot-interaction",ctor:ei}];var Mp=[M,U,w`
|
|
7503
7503
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7504
7504
|
:host {
|
|
7505
7505
|
display: block;
|
|
7506
7506
|
}
|
|
7507
7507
|
`];var ri=class extends He(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>v`<slot></slot>
|
|
7508
|
-
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=
|
|
7508
|
+
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=Mp}};var as=[{tag:"qti-hottext-interaction",ctor:ri}];var Nl=(o,t="[part='menu']",e="[part='trigger']",r="--qti-inline-choice-width")=>{class i extends o{#t=null;#e=null;#r=null;#i=0;#n=null;shouldAutoSizeMenu(){return!1}menuAutoSizeExtraWidth(){return 0}menuAutoSizePropertyTarget(){return this.renderRoot?.querySelector(e)??null}menuAutoSizeRows(){let s=this.renderRoot?.querySelector(t);return s?Array.from(s.children).flatMap(a=>a instanceof HTMLSlotElement?a.assignedElements().filter(l=>l instanceof HTMLElement):a instanceof HTMLElement?[a]:[]):[]}withMenuMeasurable(s){let a=this.renderRoot?.querySelector(t);if(!a)return s();let l=a.matches(":popover-open"),c=a.style.visibility,d=a.style.display;l||(a.style.visibility="hidden",a.style.display="block",a.showPopover?.());try{return s()}finally{l||(a.hidePopover?.(),a.style.visibility=c,a.style.display=d)}}updateMenuWidth(){if(!this.isConnected||!this.shouldAutoSizeMenu())return;let s=this.menuAutoSizePropertyTarget();if(!s)return;let a=this.renderRoot?.querySelector(t);a&&this.#l(a),this.#s();let l=this.#o()+this.menuAutoSizeExtraWidth();l<=0||l===this.#n||(this.#n=l,s.style.setProperty(r,`${l}px`))}#o(){return this.withMenuMeasurable(()=>{let s=0;for(let c of this.menuAutoSizeRows()){let d=c.style.width;c.style.width="max-content",s=Math.max(s,c.getBoundingClientRect().width),c.style.width=d}if(s<=0)return 0;let a=this.renderRoot?.querySelector(t);if(!a)return s;let l=getComputedStyle(a);return s+parseFloat(l.paddingLeft)+parseFloat(l.paddingRight)})}#s(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#a()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#a(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMenuWidth()}))}#l(s){typeof ResizeObserver>"u"||this.#e===s||(this.#t??=new ResizeObserver(()=>{this.#e?.matches(":popover-open")&&this.#a()}),this.#e&&this.#t.unobserve(this.#e),this.#t.observe(s),this.#e=s)}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e=null,this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return i};var Df=w`
|
|
7509
7509
|
/* ── Host ──────────────────────────────────────────────────────────────────
|
|
7510
7510
|
Inline-block so the element flows with surrounding text.
|
|
7511
7511
|
--qti-inline-choice-width is the single width control surface:
|
|
@@ -7723,7 +7723,7 @@ CES.load();
|
|
|
7723
7723
|
z-index: var(--qti-overlay-z-index);
|
|
7724
7724
|
white-space: nowrap;
|
|
7725
7725
|
}
|
|
7726
|
-
|
|
7726
|
+
`,$f=Df,Pp=$f;var te=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Nf=0,rt=class extends Nl(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${Nf++}`,this._handleDataPromptChange=()=>{this.#r()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity({trigger:"change"})},this._pendingResponse=void 0,this.#o=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#s=t=>{this.disabled||this.readonly||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#n(!0))},this.#a=t=>{let r=t.newState==="open";this._dropdownOpen!==r&&(this._dropdownOpen=r),r?this._internals.states.add("open"):this._internals.states.delete("open")},this.#l=t=>{if(!this._dropdownOpen)return;if(t.key==="Escape"){t.preventDefault(),this.#n(!1),this.#p();return}let e=this.#v(),r=this.renderRoot.activeElement,i=this.#c(),n=r||(i instanceof HTMLElement&&this.#d(i)?i:null),s=e.findIndex(a=>a===n);if(t.key==="ArrowDown"&&(t.preventDefault(),e[Math.min(e.length-1,Math.max(0,s+1))]?.focus()),t.key==="ArrowUp"&&(t.preventDefault(),e[Math.max(0,s-1)]?.focus()),t.key==="Enter"||t.key===" "){if(!n)return;if(t.preventDefault(),n instanceof HTMLButtonElement)n.click();else{let a=n.getAttribute("identifier")??"";this.#i(a)}}},this.#f=()=>{this.#r()},this.#m=t=>{if(this.disabled||this.readonly)return;let r=t.currentTarget.getAttribute("identifier")??"";this.#i(r)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[Pp]}renderTrigger(){let t=this.#e();return v`
|
|
7727
7727
|
<button
|
|
7728
7728
|
part="trigger"
|
|
7729
7729
|
type="button"
|
|
@@ -7767,7 +7767,7 @@ CES.load();
|
|
|
7767
7767
|
</button>
|
|
7768
7768
|
<slot @slotchange=${this.#f}></slot>
|
|
7769
7769
|
</div>
|
|
7770
|
-
`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#r(),this.#u(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#r()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#g(),this.#v()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#g()}#t(){let t=this.options[0]?.content;return typeof t=="string"&&t.trim()===""}menuAutoSizeRows(){let t=super.menuAutoSizeRows();return this.#t()?t.filter(e=>!e.matches('button[part~="option-prompt"]')):t}#e(){return this.options.find(t=>t.selected)??this.options[0]}#r(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt??this.configContext?.inlineChoicePrompt??"select",r=this._pendingResponse,i=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",n=[{content:e,value:"",selected:i===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===i}})],s=n.some(a=>a.selected);this.options=s?n:n.map((a,l)=>({...a,selected:l===0})),this._pendingResponse=void 0,this.#g(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize===!1?!1:!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-"))}menuAutoSizeExtraWidth(){let t=this.renderRoot.querySelector('span[part~="icon"]');if(!t)return 0;let e=this.renderRoot.querySelector('button[part="trigger"]'),r=e&&parseFloat(getComputedStyle(e).columnGap)||0;return t.offsetWidth+r}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,r=this.required||this.minChoices>=1,i=e||!r,n=this.dataset.minSelectionsMessage||this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(i,i?"":n,this,{suppressInline:!0,kind:"min"}),i}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this.#n(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#g()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(r=>({...r,selected:r.value===e})),this.#g()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#i(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#g(),this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(t),this.#n(!1)}#n(t){let e=this.#h();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#o;#s;#a;#l;#p(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#c(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#d(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#h(){return this.renderRoot.querySelector(`#${this._menuId}`)}#u(){this._slotObserver=new MutationObserver(()=>this.#r()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#f;#m;#b(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#m),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#g(){this._internals.setFormValue(this.response),await this.updateComplete;let t=this.options.find(r=>r.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let r of e){let n=(r.getAttribute("identifier")??"")===t;r.removeEventListener("click",this.#m),r.addEventListener("click",this.#m),r.disabled=this.disabled,r.readonly=this.readonly,r.internals.role="option",r.internals.ariaSelected=n?"true":"false",r.internals.ariaChecked=n?"true":"false",r.internals.ariaDisabled=this.disabled?"true":"false",r.internals.ariaReadOnly=this.readonly?"true":"false",n?r.internals.states.add("checked"):r.internals.states.delete("checked"),r.tabIndex=-1}}#v(){let t=this.renderRoot.querySelector('button[part~="option"]:not([hidden])'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};te([T()],rt.prototype,"options",void 0);te([T()],rt.prototype,"_dropdownOpen",void 0);te([I({context:yt,subscribe:!0}),p({attribute:!1})],rt.prototype,"configContext",void 0);te([p({type:String,attribute:"data-prompt"})],rt.prototype,"dataPrompt",void 0);te([p({type:String,attribute:"data-clear-label"})],rt.prototype,"dataClearLabel",void 0);te([N("dataPrompt",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleDataPromptChange",void 0);te([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],rt.prototype,"required",void 0);te([p({type:Number,attribute:"min-choices"})],rt.prototype,"minChoices",void 0);te([N(["required","minChoices"],{waitUntilFirstUpdate:!0})],rt.prototype,"_handleRequiredChange",void 0);te([p({attribute:"response",reflect:!1,noAccessor:!0})],rt.prototype,"response",null);var ls=[{tag:"qti-inline-choice-interaction",ctor:rt}];var
|
|
7770
|
+
`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#r(),this.#u(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#r()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#g(),this.#v()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#g()}#t(){let t=this.options[0]?.content;return typeof t=="string"&&t.trim()===""}menuAutoSizeRows(){let t=super.menuAutoSizeRows();return this.#t()?t.filter(e=>!e.matches('button[part~="option-prompt"]')):t}#e(){return this.options.find(t=>t.selected)??this.options[0]}#r(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt??this.configContext?.inlineChoicePrompt??"select",r=this._pendingResponse,i=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",n=[{content:e,value:"",selected:i===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===i}})],s=n.some(a=>a.selected);this.options=s?n:n.map((a,l)=>({...a,selected:l===0})),this._pendingResponse=void 0,this.#g(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize===!1?!1:!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-"))}menuAutoSizeExtraWidth(){let t=this.renderRoot.querySelector('span[part~="icon"]');if(!t)return 0;let e=this.renderRoot.querySelector('button[part="trigger"]'),r=e&&parseFloat(getComputedStyle(e).columnGap)||0;return t.offsetWidth+r}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,r=this.required||this.minChoices>=1,i=e||!r,n=this.dataset.minSelectionsMessage||this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(i,i?"":n,this,{suppressInline:!0,kind:"min"}),i}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this.#n(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#g()}set response(t){let e=t??"";if(this.options.length===0){this._pendingResponse=t;return}this.options=this.options.map(r=>({...r,selected:r.value===e})),this.#g()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#i(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#g(),this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(t),this.#n(!1)}#n(t){let e=this.#h();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#o;#s;#a;#l;#p(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#c(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#d(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#h(){return this.renderRoot.querySelector(`#${this._menuId}`)}#u(){this._slotObserver=new MutationObserver(()=>this.#r()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#f;#m;#b(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#m),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#g(){this._internals.setFormValue(this.response),await this.updateComplete;let t=this.options.find(r=>r.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let r of e){let n=(r.getAttribute("identifier")??"")===t;r.removeEventListener("click",this.#m),r.addEventListener("click",this.#m),r.disabled=this.disabled,r.readonly=this.readonly,r.internals.role="option",r.internals.ariaSelected=n?"true":"false",r.internals.ariaChecked=n?"true":"false",r.internals.ariaDisabled=this.disabled?"true":"false",r.internals.ariaReadOnly=this.readonly?"true":"false",n?r.internals.states.add("checked"):r.internals.states.delete("checked"),r.tabIndex=-1}}#v(){let t=this.renderRoot.querySelector('button[part~="option"]:not([hidden])'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};te([T()],rt.prototype,"options",void 0);te([T()],rt.prototype,"_dropdownOpen",void 0);te([I({context:yt,subscribe:!0}),p({attribute:!1})],rt.prototype,"configContext",void 0);te([p({type:String,attribute:"data-prompt"})],rt.prototype,"dataPrompt",void 0);te([p({type:String,attribute:"data-clear-label"})],rt.prototype,"dataClearLabel",void 0);te([N("dataPrompt",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleDataPromptChange",void 0);te([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],rt.prototype,"required",void 0);te([p({type:Number,attribute:"min-choices"})],rt.prototype,"minChoices",void 0);te([N(["required","minChoices"],{waitUntilFirstUpdate:!0})],rt.prototype,"_handleRequiredChange",void 0);te([p({attribute:"response",reflect:!1,noAccessor:!0})],rt.prototype,"response",null);var ls=[{tag:"qti-inline-choice-interaction",ctor:rt}];var Op=[M,U,w`
|
|
7771
7771
|
/*
|
|
7772
7772
|
* A custom element is inline unless it says otherwise, and this one never did. Its shadow content
|
|
7773
7773
|
* is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
|
|
@@ -7873,7 +7873,7 @@ CES.load();
|
|
|
7873
7873
|
:host(:disabled:not(.qti-match-tabular)) ::slotted(qti-simple-match-set:first-of-type) {
|
|
7874
7874
|
display: none;
|
|
7875
7875
|
}
|
|
7876
|
-
`];var
|
|
7876
|
+
`];var Dp=[M,w`
|
|
7877
7877
|
:host(.qti-match-tabular) slot:not([hidden]) {
|
|
7878
7878
|
display: contents;
|
|
7879
7879
|
}
|
|
@@ -7962,7 +7962,7 @@ CES.load();
|
|
|
7962
7962
|
justify-content: center;
|
|
7963
7963
|
flex-shrink: 0;
|
|
7964
7964
|
}
|
|
7965
|
-
`];var cs=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ee=class extends Ft(jt(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[data-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.maxAssociations=1,this.minAssociations=0,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,r=e.value,i=e.name,n=e.type;e.checked?(this.response?this.response.indexOf(r)===-1&&(n==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(i)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==r),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}static{this.styles=[
|
|
7965
|
+
`];var cs=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ee=class extends Ft(jt(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[data-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.maxAssociations=1,this.minAssociations=0,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,r=e.value,i=e.name,n=e.type;e.checked?(this.response?this.response.indexOf(r)===-1&&(n==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(i)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==r),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}static{this.styles=[Op,Dp]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(t){this.classList.contains("qti-match-tabular")?this._response=t:super.response=t}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...t){this.classList.contains("qti-match-tabular")||super.initiateDrag(...t)}afterCache(){this.classList.contains("qti-match-tabular")||super.afterCache()}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.syncTabularSlotting()}willUpdate(t){super.willUpdate?.(t),t.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let t=this.classList.contains("qti-match-tabular"),e=this.querySelectorAll(":scope > qti-simple-match-set"),r=e[0],i=e[1],n=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(r?.setAttribute("slot","match-rows"),i?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{n(s),s.setAttribute("role","rowheader"),s.tabIndex=-1}),this.targetChoices?.forEach(s=>{n(s),s.setAttribute("role","columnheader"),s.tabIndex=-1})):(r?.removeAttribute("slot"),i?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}),this.targetChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return v`
|
|
7966
7966
|
<slot name="prompt"></slot>
|
|
7967
7967
|
<slot ?hidden=${t}></slot>
|
|
7968
7968
|
|
|
@@ -8007,13 +8007,13 @@ CES.load();
|
|
|
8007
8007
|
`:P}
|
|
8008
8008
|
|
|
8009
8009
|
<div role="alert" part="message" id="validation-message"></div>
|
|
8010
|
-
`}};cs([p({type:String})],ee.prototype,"class",void 0);cs([p({type:String,attribute:"data-first-column-header"})],ee.prototype,"dataFirstColumnHeader",void 0);cs([T()],ee.prototype,"_response",void 0);cs([p({type:String,attribute:"response-identifier"})],ee.prototype,"responseIdentifier",void 0);var ds=[{tag:"qti-match-interaction",ctor:ee}];var
|
|
8010
|
+
`}};cs([p({type:String})],ee.prototype,"class",void 0);cs([p({type:String,attribute:"data-first-column-header"})],ee.prototype,"dataFirstColumnHeader",void 0);cs([T()],ee.prototype,"_response",void 0);cs([p({type:String,attribute:"response-identifier"})],ee.prototype,"responseIdentifier",void 0);var ds=[{tag:"qti-match-interaction",ctor:ee}];var $p=[M,w`
|
|
8011
8011
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
8012
8012
|
:host {
|
|
8013
8013
|
display: block;
|
|
8014
8014
|
}
|
|
8015
|
-
`];var hs=class extends D{static{this.styles
|
|
8016
|
-
<slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var ps=[{tag:"qti-media-interaction",ctor:hs}];var
|
|
8015
|
+
`];var hs=class extends D{static{this.styles=$p}#t=null;reset(){this.#t=null}validate(){return!0}get response(){return this.#t?this.#t.toString():null}set response(t){if(t)if(!isNaN(parseInt(t?.toString())))this.#t=parseInt(t.toString());else throw new Error(`Value must be a number ${t}`)}static get properties(){return{...D.properties,step:{type:Number,attribute:"step",default:10}}}render(){return v` <slot name="prompt"></slot>
|
|
8016
|
+
<slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var ps=[{tag:"qti-media-interaction",ctor:hs}];var Np=[M,U,Wt,w`
|
|
8017
8017
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
8018
8018
|
:host {
|
|
8019
8019
|
display: block;
|
|
@@ -8231,7 +8231,7 @@ CES.load();
|
|
|
8231
8231
|
:host([answer-key]) [part~='drags'] {
|
|
8232
8232
|
display: none;
|
|
8233
8233
|
}
|
|
8234
|
-
`];var
|
|
8234
|
+
`];var Lp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Lf=jt(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Qe=class extends Ft(Lf,'[data-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=Np}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),v` <slot name="prompt"> </slot>
|
|
8235
8235
|
<div part="container">
|
|
8236
8236
|
<slot part="bank drags"> </slot>
|
|
8237
8237
|
<div part="drops">
|
|
@@ -8240,7 +8240,7 @@ CES.load();
|
|
|
8240
8240
|
</div>`})}
|
|
8241
8241
|
</div>
|
|
8242
8242
|
<div id="validation-message" part="message" role="alert" style="display:none;"></div>
|
|
8243
|
-
</div>`}getValue(t){return t?.map((e,r)=>`${e} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};
|
|
8243
|
+
</div>`}getValue(t){return t?.map((e,r)=>`${e} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};Lp([T()],Qe.prototype,"nrChoices",void 0);Lp([p({type:String})],Qe.prototype,"orientation",void 0);var us=[{tag:"qti-order-interaction",ctor:Qe}];var Vp=`@layer qti-base {
|
|
8244
8244
|
/* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */
|
|
8245
8245
|
/* ============================
|
|
8246
8246
|
QTI 3 shared css
|
|
@@ -9796,7 +9796,7 @@ CES.load();
|
|
|
9796
9796
|
}
|
|
9797
9797
|
}
|
|
9798
9798
|
}
|
|
9799
|
-
`;var
|
|
9799
|
+
`;var jp=[M,w`
|
|
9800
9800
|
:host {
|
|
9801
9801
|
display: block;
|
|
9802
9802
|
width: 100%;
|
|
@@ -9806,18 +9806,18 @@ CES.load();
|
|
|
9806
9806
|
::slotted(qti-interaction-markup) {
|
|
9807
9807
|
display: none;
|
|
9808
9808
|
}
|
|
9809
|
-
`];var
|
|
9809
|
+
`];var fn=o=>o==="file",ms=o=>typeof o=="object"&&o!==null&&typeof o.data=="string",gn=o=>o==null||o===""?null:typeof o=="string"?o:!ms(o)||o.data===""?null:o.data.startsWith("data:")?o.data:`data:${o.mime||"application/octet-stream"};base64,${o.data}`,bn=o=>{if(o==null||o==="")return null;if(typeof o=="object")return ms(o)?o:null;let t=String(o),e=/^data:([^;,]*)((?:;[^;,]*)*),([\s\S]*)$/.exec(t);if(!e)return{data:t,mime:"application/octet-stream"};let[,r,i,n]=e;if(i.split(";").includes("base64"))return{data:n,mime:r||"text/plain"};let s="";return new TextEncoder().encode(decodeURIComponent(n)).forEach(a=>s+=String.fromCharCode(a)),{data:btoa(s),mime:r||"text/plain"}};var Vf=new Set(["point","pair","directedPair"]),ii=(o,t)=>{if(o==null)return o;if(fn(t))return bn(o);switch(t){case"integer":{if(typeof o=="number")return o;let e=parseInt(String(o),10);return Number.isNaN(e)?o:e}case"float":case"duration":{if(typeof o=="number")return o;let e=parseFloat(String(o));return Number.isNaN(e)?o:e}case"boolean":{if(typeof o=="boolean")return o;if(typeof o=="string"){let e=o.toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return o}case"point":{let r=(Array.isArray(o)?o:String(o).trim().split(/[\s,]+/)).map(i=>typeof i=="number"?i:parseFloat(String(i)));return r.length===2&&r.every(Number.isFinite)?r:o}case"pair":case"directedPair":{let e=Array.isArray(o)?o:String(o).trim().split(/\s+/);return e.length===2?e.map(String):o}default:return String(o)}},jf=(o,t,e)=>{if(e)return Array.isArray(t)&&!Vf.has(e)?{name:o,list:{[e]:t.map(r=>ii(r,e))}}:t==null?{name:o,base:null}:{name:o,base:{[e]:ii(t,e)}};if(Array.isArray(t)){let r=t.filter(i=>i!=null);if(r.length&&r.every(i=>typeof i=="boolean"))return{name:o,list:{boolean:r}};if(r.length&&r.every(i=>typeof i=="number")){let i=r,n=i.every(s=>Number.isInteger(s));return{name:o,list:{[n?"integer":"float"]:i}}}return{name:o,list:{string:t.map(i=>i==null?"":String(i))}}}if(typeof t=="boolean")return{name:o,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:o,base:{integer:t}}:{name:o,base:{float:t}};if(t==null)return{name:o,base:{string:""}};if(typeof t=="object")try{return{name:o,base:{string:JSON.stringify(t)}}}catch{return{name:o,base:{string:String(t)}}}return{name:o,base:{string:String(t)}}},fs=(o,t={})=>{if(!ce(o))return{record:[]};let e=[];for(let[r,i]of Object.entries(o))e.push(jf(r,i,t[r]));return{record:e}},Ff=(o,t={})=>{if(!ce(o))return{...t};let e={};for(let[r,i]of Object.entries(o))e[r]=t[r]??io(Array.isArray(i)?i[0]:i);return e},Bp=(o,t={})=>fs(o,Ff(o,t)),Fp=o=>{if(o==null)return null;if(Array.isArray(o))return o.map(String).join(" ");if(ms(o))return gn(o);if(typeof o=="object")try{return JSON.stringify(o)}catch{return String(o)}return String(o)},zp=o=>{if(o)for(let t of Object.keys(o)){let e=o[t];if(e!=null)return e}},Up=o=>{let t={};for(let e of o)if(!(!e||typeof e.name!="string"||!e.name))if(e.list){let r=zp(e.list);t[e.name]=Array.isArray(r)?r.map(Fp).filter(i=>i!==null):[]}else t[e.name]=Fp(zp(e.base));return t};var Hp=`/** vim: et:ts=4:sw=4:sts=4
|
|
9810
9810
|
* @license RequireJS 2.3.8 Copyright jQuery Foundation and other contributors.
|
|
9811
9811
|
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
|
|
9812
9812
|
*/var requirejs,require,define;(function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.8",commentRegExp=/\\/\\*[\\s\\S]*?\\*\\/|([^:"'=]|^)\\/\\/.*$/mg,cjsRequireRegExp=/[^.]\\s*require\\s*\\(\\s*["']([^'"\\s]+)["']\\s*\\)/g,jsSuffixRegExp=/\\.js$/,currDirRegExp=/^\\.\\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!!(typeof window<"u"&&typeof navigator<"u"&&window.document),isWebWorker=!isBrowser&&typeof importScripts<"u",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera<"u"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(r,a){return a||""}function isFunction(r){return ostring.call(r)==="[object Function]"}function isArray(r){return ostring.call(r)==="[object Array]"}function each(r,a){if(r){var c;for(c=0;c<r.length&&!(r[c]&&a(r[c],c,r));c+=1);}}function eachReverse(r,a){if(r){var c;for(c=r.length-1;c>-1&&!(r[c]&&a(r[c],c,r));c-=1);}}function hasProp(r,a){return hasOwn.call(r,a)}function getOwn(r,a){return hasProp(r,a)&&r[a]}function eachProp(r,a){var c;for(c in r)if(hasProp(r,c)&&c!=="__proto__"&&c!=="constructor"&&a(r[c],c))break}function mixin(r,a,c,u){return a&&eachProp(a,function(h,q){(c||!hasProp(r,q))&&(u&&typeof h=="object"&&h&&!isArray(h)&&!isFunction(h)&&!(h instanceof RegExp)?(r[q]||(r[q]={}),mixin(r[q],h,c,u)):r[q]=h)}),r}function bind(r,a){return function(){return a.apply(r,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(r){throw r}function getGlobal(r){if(!r)return r;var a=global;return each(r.split("."),function(c){a=a[c]}),a}function makeError(r,a,c,u){var h=new Error(a+\`
|
|
9813
|
-
https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var St=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Vf=o=>o.replace(/<\/(script)/gi,"<\\/$1"),jf=o=>o.replace(/<\/(style)/gi,"<\\/$1"),Ff=["solution","review"];function zf(o){return o==null?!1:Array.isArray(o)?o.length>0:ce(o)?Object.keys(o).length>0:o!==""}var G=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#i=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#w(),this.#v(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let r=e?.params?.value,i=r&&typeof r=="object"?this.#d(r):null,n=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;n!==null&&(this.#o=n,n&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,l;if(a===void 0)l=void 0;else if(a===null)l=null;else if(typeof a=="string")l=a;else try{l=`__qti_json__::${JSON.stringify(a)}`}catch{l=null}if(i===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,l);break}let c=i;this.response=c,this.validate(),this.saveResponse(c,l);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#q=null}#t;static{this.styles=[Vp,w`
|
|
9813
|
+
https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var St=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},zf=o=>o.replace(/<\/(script)/gi,"<\\/$1"),Bf=o=>o.replace(/<\/(style)/gi,"<\\/$1"),Uf=["solution","review"];function Hf(o){return o==null?!1:Array.isArray(o)?o.length>0:ce(o)?Object.keys(o).length>0:o!==""}var G=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#i=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#w(),this.#v(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let r=e?.params?.value,i=r&&typeof r=="object"?this.#d(r):null,n=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;n!==null&&(this.#o=n,n&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,l;if(a===void 0)l=void 0;else if(a===null)l=null;else if(typeof a=="string")l=a;else try{l=`__qti_json__::${JSON.stringify(a)}`}catch{l=null}if(i===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,l);break}let c=i;this.response=c,this.validate(),this.saveResponse(c,l);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#q=null}#t;static{this.styles=[jp,w`
|
|
9814
9814
|
:host {
|
|
9815
9815
|
display: block;
|
|
9816
9816
|
width: 100%;
|
|
9817
9817
|
min-height: 50px;
|
|
9818
9818
|
}
|
|
9819
|
-
`]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},r=t.correctResponse;return
|
|
9820
|
-
`);this.sendMessageToIframe("setStylesheets",i)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#w(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#p()),r=JSON.stringify(this.#c()),i=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",n=i?i.endsWith("/")?i:`${i}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=this.dataset.componentsCdnUrl,l=this.dataset.componentsCssUrl,c=this.requireJsUrl?`<script src="${this.requireJsUrl}"></script>`:`<script>${
|
|
9819
|
+
`]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},r=t.correctResponse;return Hf(r)&&(e.correctResponse={value:r}),e}#r(){let t=this.responseDeclaration;if(!t?.correctResponse||Uf.includes(this.status))return t;let{correctResponse:e,...r}=t;return r}#i;#n;#o;#s;#a(){if(this.#i===null&&this.requirePathsJson)try{let t=JSON.parse(this.requirePathsJson);if(Array.isArray(t)||!t||typeof t!="object")throw new Error("Require paths must be a JSON object.");this.#i=t}catch(t){console.error("Error parsing require paths JSON:",t),this._errorMessage=`Error parsing require paths JSON: ${t.message}`,this.#i={}}return this.#i||{}}#l(){if(this.#n===null&&this.requireShimJson)try{this.#n=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#n={}}return this.#n||{}}#p(){return this.#a()}#c(){return this.#l()}#d(t){if(t&&Array.isArray(t.record)){let e=Up(t.record);return Object.keys(e).length?e:null}for(let e in t)if(t.hasOwnProperty(e)){let r=t[e];if(r){for(let i in r)if(r.hasOwnProperty(i)){let n=r[i];if(i==="file"){if(Array.isArray(n))return n.map(gn).filter(a=>a!==null);let s=gn(n);if(s!==null)return s;continue}if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(r=>r.tagName.toLowerCase()===e)}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,r){if(e==="record"||r==="record")return fs(t);if(e!=="single"){let i=this.normalizeListValue(t).map(n=>ii(n,r));return{list:{[r]:i}}}return{base:{[r]:ii(t,r)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=i.querySelector("qti-default-value");if(!n)return;let{value:s,baseTypes:a}=Bi(n.querySelectorAll("qti-value"));for(let[l,c]of Object.entries(s))e[l]=ii(c,a[l]??"string")}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},r={...t,...e};if(!Object.keys(r).length)return null;let i={candidateIdentifier:r.candidateIdentifier??"",testIdentifier:r.testIdentifier??"",environmentIdentifier:r.environmentIdentifier??"",...r};return fs(i)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("template-identifier")||r.getAttribute("identifier")||"";if(!i)return;let n=this.context?.variables?.find(l=>l.identifier===i);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[i]=this.variableToQtiVariableJSON(n.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("identifier")||"";if(!i)return;if(i==="QTI_CONTEXT"){let l=this.getQtiContextRecord();l&&(t[i]=l);return}let n=this.context?.variables?.find(l=>l.identifier===i);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[i]=this.variableToQtiVariableJSON(n.value,s,a)}),t}#h(t){let e={...t};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);e[i]=t[r]}return e}#u(t){let e={...t},r=(i,n,s)=>{let a=i;for(let l=0;l<n.length;l+=1){let c=n[l];if(l===n.length-1){a[c]=s;return}(!a[c]||typeof a[c]!="object"||Array.isArray(a[c]))&&(a[c]={}),a=a[c]}};for(let[i,n]of Object.entries(t)){if(!i.includes("__"))continue;let s=i.split("__").filter(Boolean);s.length<2||r(e,s,n)}return e}responseVariablesToQtiVariableJSON(t,e,r,i){if(e==="record")return Bp(t,i);if(e!=="single"){let n={list:{}};return n.list[r]=fn(r)?this.normalizeListValue(t).map(bn).filter(Boolean):t,n}else{let n={base:{}};return n.base[r]=fn(r)?bn(t):t,n}}#f(){return this.response===null||this.response===void 0?!1:ce(this.response)?Object.values(this.response).some(t=>t!==""&&t!==null&&t!==void 0):Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#m(t,e){let r=this.dataset.invalidresponsemessage||"Invalid response.",i=t?"":e&&e.trim().length>0?e:r;this._internals.setValidity(t?{}:{customError:!0},i)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#f();return this.#m(t,this.#s),t}set value(t){t===null?this.#t=[]:this.#t=Array.isArray(t)?t:t.split(",")}get value(){return this.#t===null||this.#t===void 0?null:ce(this.#t)?JSON.stringify(this.#t):Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#d(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={},e=this.context?.variables?.find(r=>r.identifier===this.responseIdentifier);if(e){let r=e.cardinality||"single",i=e.baseType||"string",n=e.value||null,s=e.fieldBaseTypes,a=this.responseVariablesToQtiVariableJSON(n,r,i,s);t[this.responseIdentifier]=a}return t}#b(t){return t&&t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,"/").replace(/`/g,"`").replace(/=/g,"=")}#g(t){let e={};for(let[r,i]of Object.entries(t))typeof i=="string"?e[r]=this.#b(i):e[r]=i;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let r=this.iframe?.contentWindow;if(!this._iframeLoaded||!r){this._pendingMessages.push({method:t,params:e});return}r.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#v(){this._pendingMessages.length&&(this._pendingMessages.forEach(t=>{this.sendMessageToIframe(t.method,t.params)}),this._pendingMessages=[])}createIframe(){this._interactionReady=!1,this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this.#C(),this.#y()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let{sandbox:e,allow:r}=this.configContext?.pciIframe??{};e!==void 0&&this.iframe.setAttribute("sandbox",e),r&&this.iframe.setAttribute("allow",r);let i=this.generateIframeContent();this.iframe.srcdoc=i,this.appendChild(this.iframe)}#y(){let t=this.#h(this.#u(this.#g({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],r=typeof e=="string"&&e.length>0?e:null,i={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:ro(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#x(),boundTo:r?null:this.boundTo,responseDeclaration:this.#r(),status:this.status,state:r};this.sendMessageToIframe("initialize",i)}#x(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let r=e.querySelectorAll("qti-interaction-module");for(let i of r)t.push({id:i.getAttribute("id"),primaryPath:i.getAttribute("primary-path"),fallbackPath:i.getAttribute("fallback-path")})}return t}#C(){let t=this.querySelector("qti-interaction-markup");t&&this.sendMessageToIframe("setMarkup",t.innerHTML);let e=Array.from(this.querySelectorAll("qti-stylesheet"));if(e.length){let i=e.map(n=>n.outerHTML).join(`
|
|
9820
|
+
`);this.sendMessageToIframe("setStylesheets",i)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#w(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#p()),r=JSON.stringify(this.#c()),i=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",n=i?i.endsWith("/")?i:`${i}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=this.dataset.componentsCdnUrl,l=this.dataset.componentsCssUrl,c=this.requireJsUrl?`<script src="${this.requireJsUrl}"></script>`:`<script>${zf(Hp)}</script>`,d=`
|
|
9821
9821
|
font-family: ${t.getPropertyValue("font-family")};
|
|
9822
9822
|
font-size: ${t.getPropertyValue("font-size")};
|
|
9823
9823
|
line-height: ${t.getPropertyValue("line-height")};
|
|
@@ -9830,7 +9830,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
9830
9830
|
<title>QTI PCI Container</title>
|
|
9831
9831
|
<base href="${n}" />
|
|
9832
9832
|
${a?`<script type="module">import '${a}';</script>`:""}
|
|
9833
|
-
<style>${
|
|
9833
|
+
<style>${Bf(Vp)}</style>
|
|
9834
9834
|
<style>
|
|
9835
9835
|
body, html {
|
|
9836
9836
|
margin: 0;
|
|
@@ -10909,7 +10909,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
10909
10909
|
}
|
|
10910
10910
|
},
|
|
10911
10911
|
true
|
|
10912
|
-
);`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var bs=[{tag:"qti-portable-custom-interaction",ctor:G},{tag:"qti-portable-custom-interaction-test",ctor:gs}];var
|
|
10912
|
+
);`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var bs=[{tag:"qti-portable-custom-interaction",ctor:G},{tag:"qti-portable-custom-interaction-test",ctor:gs}];var Wp="important",Wf=" !"+Wp,wr=Dt(class extends Te{constructor(o){if(super(o),o.type!==Xr.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let r=o[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let i=t[r];if(i!=null){this.ft.add(r);let n=typeof i=="string"&&i.endsWith(Wf);r.includes("-")||n?e.setProperty(r,n?i.slice(0,-11):i,n?Wp:""):e[r]=i}}return it}});var Qp=[M,U,w`
|
|
10913
10913
|
/* Not positioned on purpose: the placed copies are absolutely positioned against the stage
|
|
10914
10914
|
(qti-position-object-stage), so they land on its image wherever this tray sits. */
|
|
10915
10915
|
:host {
|
|
@@ -10944,7 +10944,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
10944
10944
|
[part~='point'][data-ghost] {
|
|
10945
10945
|
pointer-events: none;
|
|
10946
10946
|
}
|
|
10947
|
-
`];var Xe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},
|
|
10947
|
+
`];var Xe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Qf=4,At=class extends D{constructor(){super(...arguments),this.maxChoices=1,this.minChoices=0,this.centerPoint=null,this.response=null,this._layout=0,this._drag=null,this._armed=!1,this.#t=null,this.#e=new ResizeObserver(()=>this._layout++),this._handleResponseChange=()=>{this._internals.setFormValue(nr(this.response)||null),this.validate(),z(this._internals.states,"used",this.#n())},this.#f=t=>{if(!this._drag)return;let e={x:t.clientX,y:t.clientY},r=this._drag.moved||Math.hypot(e.x-this._drag.start.x,e.y-this._drag.start.y)>Qf;this._drag={...this._drag,client:e,moved:r}},this.#m=t=>{window.removeEventListener("pointermove",this.#f);let e=this._drag;if(this._drag=null,!e)return;if(!e.moved){e.index===-1&&(this._armed=!this._armed);return}let r=this.#p({x:t.clientX,y:t.clientY}),i=this.#r();e.index===-1?r&&this.#h(r):r?(i[e.index]=r,this.#i(i)):this.#i(i.filter((n,s)=>s!==e.index))},this.#b=t=>{if(!this._armed||this.#d)return;let e=this.#p({x:t.clientX,y:t.clientY});e&&(this._armed=!1,this.#h(e))}}static{this.styles=Qp}#t;#e;#r(){return(this.response??[]).map(t=>{let[e,r]=t.split(" ").map(Number);return{x:e,y:r}})}#i(t){this.response=t.map(e=>`${Math.round(e.x)} ${Math.round(e.y)}`),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})}#n(){return this.maxChoices>0&&(this.response?.length??0)>=this.maxChoices}validate(){let t=this.response?.length??0,e=this.maxChoices>0&&t>this.maxChoices,r=t<this.minChoices,i="other",n="";e?(i="max",n=this.dataset.maxSelectionsMessage||`Please place no more than ${this.maxChoices} ${this.maxChoices===1?"position":"positions"}.`):r&&(i="min",n=this.dataset.minSelectionsMessage||`Please place at least ${this.minChoices} ${this.minChoices===1?"position":"positions"}.`);let s=!e&&!r;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:i}),s}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this._armed=!1,this.response=[],this._internals.setFormValue(null)}get#o(){return this.closest("qti-position-object-stage")}#s(){let t=this.#t;return t?{width:parseFloat(t.getAttribute("width")??"")||t.naturalWidth||t.clientWidth||1,height:parseFloat(t.getAttribute("height")??"")||t.naturalHeight||t.clientHeight||1}:{width:1,height:1}}#a(){let t=this.#t?.getBoundingClientRect();return!t||t.width===0?1:this.#s().width/t.width}#l(){let t=this.querySelector("img"),e=parseFloat(t?.getAttribute("width")??"")||t?.naturalWidth||30,r=parseFloat(t?.getAttribute("height")??"")||t?.naturalHeight||30,[i,n]=(this.centerPoint??"").split(/[\s,]+/).map(Number);return{width:e,height:r,centre:Number.isFinite(i)&&Number.isFinite(n)?{x:i,y:n}:{x:e/2,y:r/2}}}#p(t){let e=this.#t?.getBoundingClientRect();if(!e||t.x<e.left||t.x>e.right||t.y<e.top||t.y>e.bottom)return null;let r=this.#a();return{x:(t.x-e.left)*r,y:(t.y-e.top)*r}}#c(t){let e=this.#o?.getBoundingClientRect(),r=this.#t?.getBoundingClientRect();if(!e||!r)return{display:"none"};let i=this.#a(),n=this.#l();return{left:`${r.left-e.left+t.x/i-n.centre.x/i}px`,top:`${r.top-e.top+t.y/i-n.centre.y/i}px`,width:`${n.width/i}px`,height:`${n.height/i}px`}}get#d(){return this.disabled||this.readonly}#h(t){this.#n()||this.#i([...this.#r(),t])}#u(t,e){if(this.#d||t.button!==0||e===-1&&this.#n())return;t.preventDefault();let r={x:t.clientX,y:t.clientY};this._drag={index:e,client:r,start:r,moved:!1},window.addEventListener("pointermove",this.#f),window.addEventListener("pointerup",this.#m,{once:!0})}#f;#m;#b;#g(t){if(!this.#d)if(t.key==="Enter"||t.key===" "){if(t.preventDefault(),this.#n())return;let{width:e,height:r}=this.#s();this.#h({x:e/2,y:r/2}),this.updateComplete.then(()=>{let i=this.shadowRoot?.querySelectorAll('[part~="point"]');i?.[i.length-1]?.focus()})}else t.key==="Escape"&&(this._armed=!1)}#v(t,e){if(this.#d)return;let r=t.shiftKey?10:1,i={ArrowLeft:{x:-r,y:0},ArrowRight:{x:r,y:0},ArrowUp:{x:0,y:-r},ArrowDown:{x:0,y:r}},n=this.#r();if(i[t.key]){t.preventDefault();let{width:s,height:a}=this.#s(),l=n[e];n[e]={x:Math.min(s,Math.max(0,l.x+i[t.key].x)),y:Math.min(a,Math.max(0,l.y+i[t.key].y))},this.#i(n),this.updateComplete.then(()=>this.shadowRoot?.querySelectorAll('[part~="point"]')[e]?.focus())}else(t.key==="Delete"||t.key==="Backspace")&&(t.preventDefault(),this.#i(n.filter((s,a)=>a!==e)),this.updateComplete.then(()=>this.shadowRoot?.querySelector('[part~="object"]')?.focus()))}connectedCallback(){super.connectedCallback(),this.#t=this.#o?.querySelector(":scope > img, :scope > picture img")??null,this.#t&&(this.#e.observe(this.#t),this.#t.addEventListener("load",()=>this._layout++),this.#t.addEventListener("click",this.#b))}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect(),this.#t?.removeEventListener("click",this.#b),window.removeEventListener("pointermove",this.#f)}render(){this._layout;let t=this.querySelector("img")?.currentSrc||this.querySelector("img")?.src||"",e=this.querySelector("img")?.getAttribute("alt")||"object",r=this.#n(),i=["object",this._armed?"selected":"",r?"used":""].filter(Boolean).join(" "),n=this.#r(),s=this._drag,a=s&&s.moved&&this.#t?(()=>{let l=this.#t.getBoundingClientRect(),c=this.#a();return{x:(s.client.x-l.left)*c,y:(s.client.y-l.top)*c}})():null;return v`
|
|
10948
10948
|
<div
|
|
10949
10949
|
part=${i}
|
|
10950
10950
|
role="button"
|
|
@@ -10970,7 +10970,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
10970
10970
|
/>`})}
|
|
10971
10971
|
${s&&s.index===-1&&a?v`<img part="point" data-ghost src=${t} alt="" style=${wr(this.#c(a))} />`:P}
|
|
10972
10972
|
<div part="message" role="alert" id="validation-message" style="display:none;"></div>
|
|
10973
|
-
`}};Xe([p({type:Number,attribute:"max-choices"})],At.prototype,"maxChoices",void 0);Xe([p({type:Number,attribute:"min-choices"})],At.prototype,"minChoices",void 0);Xe([p({type:String,attribute:"center-point"})],At.prototype,"centerPoint",void 0);Xe([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=zi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>nr(o)}})],At.prototype,"response",void 0);Xe([T()],At.prototype,"_layout",void 0);Xe([T()],At.prototype,"_drag",void 0);Xe([T()],At.prototype,"_armed",void 0);Xe([N("response")],At.prototype,"_handleResponseChange",void 0);var
|
|
10973
|
+
`}};Xe([p({type:Number,attribute:"max-choices"})],At.prototype,"maxChoices",void 0);Xe([p({type:Number,attribute:"min-choices"})],At.prototype,"minChoices",void 0);Xe([p({type:String,attribute:"center-point"})],At.prototype,"centerPoint",void 0);Xe([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=zi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>nr(o)}})],At.prototype,"response",void 0);Xe([T()],At.prototype,"_layout",void 0);Xe([T()],At.prototype,"_drag",void 0);Xe([T()],At.prototype,"_armed",void 0);Xe([N("response")],At.prototype,"_handleResponseChange",void 0);var Xp=[M,w`
|
|
10974
10974
|
/* The containing block of every placed copy. */
|
|
10975
10975
|
:host {
|
|
10976
10976
|
display: inline-block;
|
|
@@ -10983,7 +10983,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
10983
10983
|
height: auto;
|
|
10984
10984
|
user-select: none;
|
|
10985
10985
|
}
|
|
10986
|
-
`];var vs=class extends E{static{this.styles=
|
|
10986
|
+
`];var vs=class extends E{static{this.styles=Xp}render(){return v`<slot></slot>`}};var ys=[{tag:"qti-position-object-interaction",ctor:At},{tag:"qti-position-object-stage",ctor:vs}];var Gp=[M,w`
|
|
10987
10987
|
:host {
|
|
10988
10988
|
display: block;
|
|
10989
10989
|
--qti-select-point-marker-size: 1.5rem;
|
|
@@ -11047,7 +11047,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11047
11047
|
-webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
11048
11048
|
mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
11049
11049
|
}
|
|
11050
|
-
`];var Cr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},dt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleResponseChange=()=>{this._internals.setFormValue(nr(this.response)||null),this.validate()},this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#r=1,this.#i=1,this.#n=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#l();let e=this.#e.getBoundingClientRect(),r=(t.clientX-e.left)*this.#r,i=(t.clientY-e.top)*this.#i,n=`${r.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[n]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],n]),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})},this.#a=()=>{this.#l()}}static{this.styles=
|
|
11050
|
+
`];var Cr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},dt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleResponseChange=()=>{this._internals.setFormValue(nr(this.response)||null),this.validate()},this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#r=1,this.#i=1,this.#n=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#l();let e=this.#e.getBoundingClientRect(),r=(t.clientX-e.left)*this.#r,i=(t.clientY-e.top)*this.#i,n=`${r.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[n]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],n]),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})},this.#a=()=>{this.#l()}}static{this.styles=Gp}#t(){try{let t=JSON.parse(this.areaMappings||"[]");if(!Array.isArray(t)){this._areaEntries=[];return}this._areaEntries=t.filter(e=>e&&(e.shape==="circle"||e.shape==="rect")&&typeof e.coords=="string").map(e=>({shape:e.shape,coords:String(e.coords),mappedValue:Number(e.mappedValue??1),defaultValue:Number(e.defaultValue??0)}))}catch{this._areaEntries=[]}}get _effectiveAreaEntries(){let t=this.responseVariable?.areaMapping?.areaMapEntries;return t?.length?t:this._areaEntries}#e;#r;#i;#n;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let t=this.response;return(Array.isArray(t)?t:t?[t]:[]).filter(r=>r).map(r=>{let[i,n]=r.split(" ").map(Number);return{x:i,y:n}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#l();for(let r of t){let i=r.dataset.coord,n=r.dataset.shape;!i||!n||Zt(n,i.split(",").map(s=>+s),e,r)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return v` <slot name="prompt"></slot>
|
|
11051
11051
|
<point-container>
|
|
11052
11052
|
${H(e.filter(r=>r),r=>r,(r,i)=>{let[n,s]=r.split(" ").map(Number),a=n/(this.#n||1)*100,l=s/(this.#o||1)*100;return v`
|
|
11053
11053
|
<button
|
|
@@ -11061,7 +11061,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11061
11061
|
${this.renderSupplementalLayer()}
|
|
11062
11062
|
<slot></slot>
|
|
11063
11063
|
</point-container>
|
|
11064
|
-
<div part="message" role="alert" id="validation-message" style="display:none;"></div>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,i=!0,n="",s="other";return e?(i=!1,s="max",n=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(i=!1,s="min",n=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(i,n,this.#e??this,{suppressInline:!0,kind:s}),i}reportValidity(t){return super.reportValidity(t)}#l(){this.#n=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#r=t.width===0?1:this.#n/t.width,this.#i=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#l(),this.requestUpdate(),this.#e.addEventListener("click",this.#s)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#a),this.#e&&this.#e.removeEventListener("click",this.#s)}};Cr([p({type:Number,attribute:"max-choices"})],dt.prototype,"maxChoices",void 0);Cr([p({type:Number,attribute:"min-choices"})],dt.prototype,"minChoices",void 0);Cr([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=zi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>nr(o)}})],dt.prototype,"response",void 0);Cr([p({attribute:"area-mappings"})],dt.prototype,"areaMappings",void 0);Cr([T()],dt.prototype,"_areaEntries",void 0);Cr([N("response")],dt.prototype,"_handleResponseChange",void 0);Cr([N("areaMappings")],dt.prototype,"_handleAreaMappingsChange",void 0);var qs=[{tag:"qti-select-point-interaction",ctor:dt}];var
|
|
11064
|
+
<div part="message" role="alert" id="validation-message" style="display:none;"></div>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,i=!0,n="",s="other";return e?(i=!1,s="max",n=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(i=!1,s="min",n=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(i,n,this.#e??this,{suppressInline:!0,kind:s}),i}reportValidity(t){return super.reportValidity(t)}#l(){this.#n=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#r=t.width===0?1:this.#n/t.width,this.#i=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#l(),this.requestUpdate(),this.#e.addEventListener("click",this.#s)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#a),this.#e&&this.#e.removeEventListener("click",this.#s)}};Cr([p({type:Number,attribute:"max-choices"})],dt.prototype,"maxChoices",void 0);Cr([p({type:Number,attribute:"min-choices"})],dt.prototype,"minChoices",void 0);Cr([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=zi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>nr(o)}})],dt.prototype,"response",void 0);Cr([p({attribute:"area-mappings"})],dt.prototype,"areaMappings",void 0);Cr([T()],dt.prototype,"_areaEntries",void 0);Cr([N("response")],dt.prototype,"_handleResponseChange",void 0);Cr([N("areaMappings")],dt.prototype,"_handleAreaMappingsChange",void 0);var qs=[{tag:"qti-select-point-interaction",ctor:dt}];var Jp=[M,w`
|
|
11065
11065
|
:host {
|
|
11066
11066
|
display: block;
|
|
11067
11067
|
--show-bounds: true;
|
|
@@ -11129,7 +11129,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11129
11129
|
text-align: center;
|
|
11130
11130
|
color: #6b7280; /* text-gray-500 */
|
|
11131
11131
|
}
|
|
11132
|
-
`];var
|
|
11132
|
+
`];var vn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},_t=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=Jp}#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}willUpdate(t){super.willUpdate(t),this._internals.ariaValueMin=String(this.min),this._internals.ariaValueMax=String(this.max)}get response(){return this.#t===null?null:this.#t.toString()}set response(t){if(t==null||t===""){this.#e(null);return}let e=parseFloat(t);isNaN(e)||this.#e(e)}renderRailSupplement(){return P}#e(t){let e=this.#t;if(this.#t=t===null?null:Math.min(this.max,Math.max(this.min,t)),this.#t===e)return!1;if(this.#t===null)this.style.removeProperty("--value-percentage"),this._internals.setFormValue(null),this._internals.ariaValueNow=null;else{let r=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${r}%`),this._internals.setFormValue(this.value),this._internals.ariaValueNow=String(this.#t)}return this.requestUpdate(),!0}#r(t){this.#e(t)&&this.saveResponse(this.response)}render(){return v`
|
|
11133
11133
|
<slot name="prompt"></slot>
|
|
11134
11134
|
<div id="slider" part="slider">
|
|
11135
11135
|
<div id="bounds" part="bounds">
|
|
@@ -11147,7 +11147,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11147
11147
|
${this.renderRailSupplement()}
|
|
11148
11148
|
</div>
|
|
11149
11149
|
</div>
|
|
11150
|
-
`}#i(t){this.#o(t.pageX);let e=i=>this.#s(i.pageX),r=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",r)}#n(t){this.#o(t.touches[0].pageX);let e=i=>this.#s(i.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),r=t-e.left,i=Math.min(1,Math.max(0,r/e.width)),n=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#r(n)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};
|
|
11150
|
+
`}#i(t){this.#o(t.pageX);let e=i=>this.#s(i.pageX),r=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",r)}#n(t){this.#o(t.touches[0].pageX);let e=i=>this.#s(i.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),r=t-e.left,i=Math.min(1,Math.max(0,r/e.width)),n=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#r(n)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};vn([Ir("#rail")],_t.prototype,"_rail",void 0);vn([p({type:Number,attribute:"lower-bound"})],_t.prototype,"min",void 0);vn([p({type:Number,attribute:"upper-bound"})],_t.prototype,"max",void 0);vn([p({type:Number,attribute:"step"})],_t.prototype,"step",void 0);vn([p({attribute:"response",reflect:!1,noAccessor:!0})],_t.prototype,"response",null);var xs=[{tag:"qti-slider-interaction",ctor:_t}];var Yp=()=>new Vl,Vl=class{},Ll=new WeakMap,iD=Dt(class extends Re{render(o){return P}update(o,[t]){let e=t!==this.G;return e&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),P}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Ll.get(t);e===void 0&&(e=new WeakMap,Ll.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?Ll.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var Kp=[M,w`
|
|
11151
11151
|
:host {
|
|
11152
11152
|
display: inline-flex;
|
|
11153
11153
|
align-items: center;
|
|
@@ -11236,7 +11236,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11236
11236
|
:host(.qti-input-width-72) {
|
|
11237
11237
|
--qti-input-width: 72;
|
|
11238
11238
|
}
|
|
11239
|
-
`];var kr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ht=class extends D{constructor(){super(...arguments),this.inputRef=
|
|
11239
|
+
`];var kr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ht=class extends D{constructor(){super(...arguments),this.inputRef=Yp(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Kp}get value(){return this.response||null}set value(t){this.response=t||null}get isInline(){return!0}validate(){if(!this._input)return!1;let t="",e=!1;this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),e=this._input.checkValidity(),e||(t=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):e=this._input.checkValidity();let r="other";return e&&this.response===""&&(e=!1,r="min"),!e&&!t&&(t=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(e,t,this._input,{suppressInline:!0,kind:r}),e}renderAnswer(){return v`<div part="answer-key answer" aria-hidden="true"></div>`}renderInput(){return v`<input
|
|
11240
11240
|
part="input"
|
|
11241
11241
|
name="${this.responseIdentifier}"
|
|
11242
11242
|
spellcheck="false"
|
|
@@ -11252,7 +11252,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11252
11252
|
maxlength=${1e3}
|
|
11253
11253
|
?disabled="${this.disabled}"
|
|
11254
11254
|
?readonly="${this.readonly}"
|
|
11255
|
-
/>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(t){return this.validate(),super.reportValidity(t)}reset(){this.response=""}};kr([p({type:Number,attribute:"expected-length"})],ht.prototype,"expectedLength",void 0);kr([p({type:String,attribute:"pattern-mask"})],ht.prototype,"patternMask",void 0);kr([p({type:String,attribute:"placeholder-text"})],ht.prototype,"placeholderText",void 0);kr([p({type:String,attribute:"data-patternmask-message"})],ht.prototype,"dataPatternmaskMessage",void 0);kr([p({type:String,attribute:"response",reflect:!1})],ht.prototype,"response",void 0);kr([Ir("input")],ht.prototype,"_input",void 0);kr([N("response",{waitUntilFirstUpdate:!0})],ht.prototype,"_handleValueChange",void 0);var ws=[{tag:"qti-text-entry-interaction",ctor:ht}];var
|
|
11255
|
+
/>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(t){return this.validate(),super.reportValidity(t)}reset(){this.response=""}};kr([p({type:Number,attribute:"expected-length"})],ht.prototype,"expectedLength",void 0);kr([p({type:String,attribute:"pattern-mask"})],ht.prototype,"patternMask",void 0);kr([p({type:String,attribute:"placeholder-text"})],ht.prototype,"placeholderText",void 0);kr([p({type:String,attribute:"data-patternmask-message"})],ht.prototype,"dataPatternmaskMessage",void 0);kr([p({type:String,attribute:"response",reflect:!1})],ht.prototype,"response",void 0);kr([Ir("input")],ht.prototype,"_input",void 0);kr([N("response",{waitUntilFirstUpdate:!0})],ht.prototype,"_handleValueChange",void 0);var ws=[{tag:"qti-text-entry-interaction",ctor:ht}];var Zp=[M,w`
|
|
11256
11256
|
:host {
|
|
11257
11257
|
display: block;
|
|
11258
11258
|
margin: 1em 0;
|
|
@@ -11261,7 +11261,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11261
11261
|
display: block;
|
|
11262
11262
|
margin-top: 0.5em;
|
|
11263
11263
|
}
|
|
11264
|
-
`];var Cs=class extends D{static{this.styles=
|
|
11264
|
+
`];var Cs=class extends D{static{this.styles=Zp}#t=null;#e=null;reset(){this.resetValidityReport(),this.#t=null,this.#e=null,this._internals.setFormValue(null),this.saveResponse(null)}validate(){return this.#e!==null}get response(){return this.#e}set response(t){if(typeof t=="string")this.#e=t,this._internals.setFormValue(t),this.saveResponse(t);else if(t===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...D.properties}}render(){return v`
|
|
11265
11265
|
<div>
|
|
11266
11266
|
<slot name="prompt"></slot>
|
|
11267
11267
|
<input
|
|
@@ -11272,7 +11272,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11272
11272
|
?readonly="${this.readonly}"
|
|
11273
11273
|
/>
|
|
11274
11274
|
</div>
|
|
11275
|
-
`}async#r(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#i(this.#t),this._internals.setFormValue(this.#e),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#i(t){return new Promise((e,r)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(t)})}};var ks=[{tag:"qti-upload-interaction",ctor:Cs}];var Zp=[...Jo,...Yo,...Ko,...Zo,...ts,...es,...is,...ns,...os,...ss,...as,...ls,...ds,...ps,...us,...bs,...ys,...qs,...xs,...ws,...ks,...Qh];for(let{tag:o,ctor:t}of Zp)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Jo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Yo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ko)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Zo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ts)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of is)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ns)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of os)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ss)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of as)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ls)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ps)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of us)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of bs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ys)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of qs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of xs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ws)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ks)customElements.get(o)||customElements.define(o,t);var SN=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await Ld().load(`${o}`).then(a=>a.assessmentTest()),r=await Ur().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Ur().load(`${t}/${e.href}`).then(a=>a.items()),n=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:n,items:i,testIdentifier:e.identifier}},AN=async o=>Jt().load(o).then(t=>t.htmlDoc().firstElementChild);var Es=class extends Hf(Qt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Hf(o){return class extends o{calculateChildren(e){return e.map(i=>{let n=i;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=n.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var tu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ni=class extends S{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let r of t){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(r.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(r.value===null||r.value===void 0)return null;r.value==="true"&&e++}return e>=this.min&&e<=this.max}};tu([p({type:Number})],ni.prototype,"min",void 0);tu([p({type:Number})],ni.prototype,"max",void 0);var Wf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vn=class extends S{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Wf([p({type:String,attribute:"base-type"})],vn.prototype,"baseType",void 0);var Ss=class extends S{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var As=class extends S{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let i=this.#t(t.value),n=this.#t(e.value);return n.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(i,n,r):this.#r(i,n,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return Y.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let i=[...t];return e.every(n=>{let s=i.findIndex(a=>this.#e(a,n,r));return s===-1?!1:(i.splice(s,1),!0)})}#i(t,e,r){for(let i=0;i+e.length<=t.length;i++)if(e.every((n,s)=>this.#e(t[i+s],n,r)))return!0;return!1}};var _s=class extends S{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var Fl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Er=class extends S{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let n=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!n)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(n=>n.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Fl([p({type:String})],Er.prototype,"identifier",void 0);Fl([I({context:j,subscribe:!0}),T()],Er.prototype,"context",void 0);Fl([T(),I({context:nt,subscribe:!0})],Er.prototype,"_testContext",void 0);var Ts=class extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(n=>!e.value.includes(n))}return null}};var Is=class extends S{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Rs=class extends S{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Ms=class extends S{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Qf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},yn=class extends S{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let i=parseFloat(e.value),n=parseFloat(r.value);if(!isNaN(i)&&!isNaN(n))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};Qf([p({type:String,attribute:"rounding-mode"})],yn.prototype,"roundingMode",void 0);var eu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},oi=class extends S{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?Y.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(l=>parseFloat(l));if(r.length===0||r.some(l=>Number.isNaN(l)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[i,n=i]=r,[s,a]=this.toleranceMode==="absolute"?[e-i,e+n]:[e*(1-i/100),e*(1+n/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};eu([p({type:String,attribute:"tolerance-mode"})],oi.prototype,"toleranceMode",void 0);eu([p({type:String})],oi.prototype,"tolerance",void 0);var J=class extends E{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var Ps=class extends J{process(){throw new Or}};var Os=class extends J{process(){throw new Dr}};var Ds=class extends S{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],r=e?.cardinality==="record"||e?.baseType==="record";if(r&&(e.value===null||e.value===void 0))return null;if(!e||!r||!ce(e.value))return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i==null?null:(this.#t=e.fieldBaseTypes?.[t]??ro(Array.isArray(i)?i[0]:i),i)}};var $s=class extends S{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(r.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(r.cardinality==="multiple"||r.cardinality==="ordered"){if(!Array.isArray(r.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of r.value){if(i==null)return null;let n=parseInt(i,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let r=1;r<t.length&&(e=this.#e(e,Math.abs(t[r])),e!==1);r++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let r=e;e=t%e,t=r}return t}};var Tt=o=>o==null||o==="";var Ns=class extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Tt(e?.value)||Tt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Ls=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Tt(e?.value)||Tt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var Xf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qn=class extends S{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let r=this.#t(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(r)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let r=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>r.length?null:r[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(r=>r.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Xf([p({type:String})],qn.prototype,"n",void 0);var ru=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},si=class extends S{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),i=this.#e(this.coords);if(!r||i.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,i);case"rect":return this.#i(r,i);case"ellipse":return this.#n(r,i);case"poly":case"polygon":return this.#o(r,i);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(n=>n.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,n]=e;return(t.x-r)**2+(t.y-i)**2<=n**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,n,s]=e,a=Math.min(r,n),l=Math.max(r,n),c=Math.min(i,s),d=Math.max(i,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#n(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,i,n,s]=e;return n===0||s===0?!1:(t.x-r)**2/n**2+(t.y-i)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,n=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],l=e[n],c=e[n+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(r=!r),n=i}return r}};ru([p({type:String})],si.prototype,"shape",void 0);ru([p({type:String})],si.prototype,"coords",void 0);var Vs=class extends S{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};var js=class extends S{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};var Fs=class extends S{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var zs=class extends S{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var Bs=class extends S{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);continue}if(r.cardinality!=="multiple"&&r.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(r.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let i of r.value){let n=Number.parseInt(i,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n)}}return e}#e(t,e){let r=Math.abs(t),i=Math.abs(e);for(;i!==0;){let n=r%i;r=i,i=n}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var iu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ai=class extends J{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(n=>n.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let r=parseFloat(this.childExpression.calculate()),i;return e.matchTable?.size?i=e.matchTable.get(r):e.interpolationTable&&(i=this.#t(r,e.interpolationTable)),i==null?(console.warn(`lookupOutcomeValue: no table entry matches ${r} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Mt(i)}})),i)}#t(t,e){if(!Number.isNaN(t))return e.find(r=>r.includeBoundary?t>=r.sourceValue:t>r.sourceValue)?.targetValue}};iu([p({type:String})],ai.prototype,"identifier",void 0);iu([I({context:j,subscribe:!0}),T()],ai.prototype,"context",void 0);var Us=class extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Tt(e?.value)||Tt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var Hs=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Tt(e?.value)||Tt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var Gf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},xn=class extends S{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=(Array.isArray(t.value)?t.value:[t.value]).filter(s=>typeof s=="string"&&s.length>0);if(r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,n=new Set;for(let s of r)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;if(Y.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){i+=a.mappedValue??0,n.add(a.coords);break}}return n.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Gf([p({type:String})],xn.prototype,"identifier",void 0);var Jf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},wn=class extends S{getResult(){let t=this.context.variables.find(n=>n.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let n of r){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?Y.compareSingleValues(l.mapKey.toLowerCase(),n.toLowerCase(),t.baseType):Y.compareSingleValues(l.mapKey,n,t.baseType)),a=s.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};Jf([p({type:String})],wn.prototype,"identifier",void 0);var Ws=class o extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):Y.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!Y.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let n=null,s=[...t.value];for(let a of s)if(Y.compareSingleValues(i,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Yf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Cn=class extends S{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};Yf([p({type:String})],Cn.prototype,"name",void 0);var Kf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},kn=class extends S{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let i=parseFloat(r.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],i=e[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(e.length!==2)return null;let r=e[0],i=e[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};Kf([p({type:String})],kn.prototype,"name",void 0);var Qs=class extends S{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Xs=class extends S{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};var Gs=class extends S{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Js=class extends S{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var Ys=class extends S{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var Ks=class extends S{getResult(){return null}};var Zs=class extends Qt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),n=!1;if(typeof i=="string")if(i==="true")n=!0;else if(i==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(n=i);return n}).some(e=>typeof e=="boolean"&&e)}};var ta=class extends S{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var ea=class extends E{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},li=class extends ea{shouldProcess(){return!0}getSubRules(){return[...this.children]}},ci=class extends ea{shouldProcess(){let e=this.firstElementChild.calculate();return e===!0||e==="true"}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},di=class extends J{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var ra=class extends di{};var hi=class extends ci{};var ia=class extends hi{};var na=class extends li{};var Zf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},En=class extends S{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=this.#t();return r?r.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};Zf([p({type:String})],En.prototype,"pattern",void 0);var oa=class extends S{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),n=parseFloat(r.value);if(isNaN(i)||isNaN(n))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&n<=0||i<0&&!Number.isInteger(n))return null;let s;try{s=Math.pow(i,n)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),l=Math.max(0,14-a),c=Math.pow(10,l);s=Math.round(s*c)/c}return s}};var tg=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function eg(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function Sn(o,t){return eg(t===void 0?o.toExponential():o.toExponential(t))}function nu(o){let[t,e]=o.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,i=e===void 0?"":`e${e}`;return`${r}${i}`}function ou(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?nu(Sn(o,e-1)):nu(o.toFixed(Math.max(0,e-1-r)))}function rg(o,t,e,r){if(o==="s"||o==="c"){let c=o==="c"?r.slice(0,1):r;return e===void 0?c:c.slice(0,e)}let i=Number(r);if(r.trim()===""||!Number.isFinite(i))return r;let n=Math.abs(i),s,a=i<0;switch(o){case"d":case"i":s=String(Math.trunc(n));break;case"u":s=String(Math.trunc(n)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(n).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(n).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(n).toString(16).toUpperCase()}`;break;case"f":case"F":s=n.toFixed(e??6);break;case"e":s=Sn(n,e??6);break;case"E":s=Sn(n,e??6).toUpperCase();break;case"g":s=ou(n,e??6);break;case"G":s=ou(n,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function ig(o,t,e){if(o.length>=e)return o;let r=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(r)}`;if(t.includes("0")){let[,i,n]=/^([-+ ]?)(.*)$/.exec(o);return`${i}${"0".repeat(r)}${n}`}return`${" ".repeat(r)}${o}`}function su(o,t){return o.replace(tg,(e,r,i,n,s,a)=>r?"%":ig(rg(a,i??"",s===void 0?void 0:Number(s),t),i??"",n===void 0?0:Number(n)))}var qe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vt=class extends E{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:v`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let r=e[this.index-1];return r==null?null:this.#e(r,t.baseType)}return e.map(r=>this.#e(r,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let r=e;if(this.field!==void 0){let n=r[this.field];return n==null?null:this.#e(n,t.baseType)}let i=Object.entries(r).filter(([,n])=>n!=null);return i.length===0?null:i.map(([n,s])=>`${n}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let r=Array.isArray(t)?t.join(" "):String(t);if(this.format)return su(this.format,r);if(e==="integer"&&this.base!==10){let i=Number.parseInt(r,10);if(Number.isFinite(i))return i.toString(this.base)}if(this.powerForm){let i=Number(r);if(r.trim()!==""&&Number.isFinite(i))return Sn(i)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};qe([p({type:String})],vt.prototype,"identifier",void 0);qe([p({type:String})],vt.prototype,"format",void 0);qe([p({type:Number})],vt.prototype,"base",void 0);qe([p({type:Number})],vt.prototype,"index",void 0);qe([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);qe([p({type:String})],vt.prototype,"field",void 0);qe([p({type:String})],vt.prototype,"delimiter",void 0);qe([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);qe([I({context:j,subscribe:!0}),T()],vt.prototype,"context",void 0);var sa=class extends S{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};var zl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Sr=class extends S{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),e++}if(t.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let r=Math.floor(Math.random()*t.length);return t[r]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};zl([p({type:Number})],Sr.prototype,"min",void 0);zl([p({type:Number})],Sr.prototype,"max",void 0);zl([p({type:Number})],Sr.prototype,"step",void 0);var aa=class extends S{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let r=Math.floor(Math.random()*e.length);return e[r]}return e}return console.error("unexpected number of children in match"),null}};var ng=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Bl=1e3,An=class extends S{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let i=0;i<t;i++){let n=e.calculate(),s=this.#r(n);s&&r.push(s)}return r}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,n=parseInt(i?.toString()??"",10);return Number.isNaN(n)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(n)}#e(t){return t>Bl?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${Bl} limit, truncating`),Bl):t}#r(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};ng([p({type:String,attribute:"number-repeats"})],An.prototype,"numberRepeats",void 0);var la=class extends di{};var pi=class extends ci{};var ca=class extends pi{};var da=class extends li{};var ha=class extends J{process(){for(let t of[...this.children])t.process()}};var au=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ui=class extends S{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),i=Math.pow(10,e-r-1);return Math.round(t*i)/i}};au([p({type:String,attribute:"rounding-mode"})],ui.prototype,"roundingMode",void 0);au([p({type:Number})],ui.prototype,"figures",void 0);var pa=class extends S{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var ua=class extends J{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new Ul(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Ul=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var ma=class extends J{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new Hl(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(Mt):t!==null?Mt(t):null}},Hl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>e.value?e.value:e):t}};var fa=class extends J{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new Wl(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Wl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var og=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},_n=class extends S{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#i(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#r(t,t.length);case"popsd":return Math.sqrt(this.#r(t,t.length));case"samplevariance":return t.length<2?null:this.#r(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#r(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,r)=>e+r,0)/t.length}#e(t){let e=[...t].sort((i,n)=>i-n),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}#r(t,e){let r=this.#t(t);return t.reduce((i,n)=>i+Math.pow(n-r,2),0)/e}#i(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};og([p({type:String})],_n.prototype,"name",void 0);var sg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Tn=class extends S{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return Y.compareSingleValues(i,n,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};sg([p({type:String,attribute:"case-sensitive"})],Tn.prototype,"caseSensitive",void 0);var ag=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},In=class extends S{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let i=e.value.toString(),n=r.value.toString();return this.caseSensitive!=="true"?n.toLowerCase().includes(i.toLowerCase()):n.includes(i)}};ag([p({type:String,attribute:"case-sensitive"})],In.prototype,"caseSensitive",void 0);var ga=class extends lg(S){getResult(){return this.calculateChildren(Array.from(this.children))}};function lg(o){return class extends o{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=i.calculate();return Number.isNaN(n)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(n)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var ba=class extends S{getResult(){return new Ql(Array.from(this.children)).calculate()}},Ql=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(r=>r.calculate!==void 0).some(r=>r.calculate()===null)?null:this.expressions.map(r=>{let i=r.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((r,i)=>r+i,0)}};var va=class extends S{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var ya=class extends S{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var lu=[{tag:"qti-and",ctor:Es},{tag:"qti-any-n",ctor:ni},{tag:"qti-base-value",ctor:vn},{tag:"qti-container-size",ctor:Ss},{tag:"qti-contains",ctor:As},{tag:"qti-correct",ctor:_s},{tag:"qti-default",ctor:Er},{tag:"qti-delete",ctor:Ts},{tag:"qti-divide",ctor:Is},{tag:"qti-duration-gte",ctor:Rs},{tag:"qti-duration-lt",ctor:Ms},{tag:"qti-equal",ctor:oi},{tag:"qti-equal-rounded",ctor:yn},{tag:"qti-exit-response",ctor:Ps},{tag:"qti-exit-test",ctor:Os},{tag:"qti-field-value",ctor:Ds},{tag:"qti-gcd",ctor:$s},{tag:"qti-gt",ctor:Ns},{tag:"qti-gte",ctor:Ls},{tag:"qti-index",ctor:qn},{tag:"qti-inside",ctor:si},{tag:"qti-integer-divide",ctor:Vs},{tag:"qti-integer-modulus",ctor:js},{tag:"qti-integer-to-float",ctor:Fs},{tag:"qti-is-null",ctor:zs},{tag:"qti-lcm",ctor:Bs},{tag:"qti-lookup-outcome-value",ctor:ai},{tag:"qti-lt",ctor:Us},{tag:"qti-lte",ctor:Hs},{tag:"qti-map-response",ctor:wn},{tag:"qti-map-response-point",ctor:xn},{tag:"qti-match",ctor:Ws},{tag:"qti-math-constant",ctor:Cn},{tag:"qti-math-operator",ctor:kn},{tag:"qti-max",ctor:Qs},{tag:"qti-member",ctor:Xs},{tag:"qti-min",ctor:Gs},{tag:"qti-multiple",ctor:Js},{tag:"qti-not",ctor:Ys},{tag:"qti-null",ctor:Ks},{tag:"qti-or",ctor:Zs},{tag:"qti-ordered",ctor:ta},{tag:"qti-outcome-condition",ctor:ra},{tag:"qti-outcome-else",ctor:na},{tag:"qti-outcome-else-if",ctor:ia},{tag:"qti-outcome-if",ctor:hi},{tag:"qti-pattern-match",ctor:En},{tag:"qti-power",ctor:oa},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:sa},{tag:"qti-random",ctor:aa},{tag:"qti-random-integer",ctor:Sr},{tag:"qti-repeat",ctor:An},{tag:"qti-response-condition",ctor:la},{tag:"qti-response-else",ctor:da},{tag:"qti-response-else-if",ctor:ca},{tag:"qti-response-if",ctor:pi},{tag:"qti-response-processing-fragment",ctor:ha},{tag:"qti-round",ctor:pa},{tag:"qti-round-to",ctor:ui},{tag:"qti-rule",ctor:J},{tag:"qti-set-correct-response",ctor:ua},{tag:"qti-set-outcome-value",ctor:ma},{tag:"qti-set-template-value",ctor:fa},{tag:"qti-stats-operator",ctor:_n},{tag:"qti-string-match",ctor:Tn},{tag:"qti-substring",ctor:In},{tag:"qti-subtract",ctor:ga},{tag:"qti-sum",ctor:ba},{tag:"qti-truncate",ctor:va},{tag:"qti-variable",ctor:ya}];for(let{tag:o,ctor:t}of lu)customElements.get(o)||customElements.define(o,t);var xe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Z;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(Z||(Z={}));var Xl=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,i)=>{this.toggleCandidateCorrection(i)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""),z(this._internals.states,"answer-key",!0,[]))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let i=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",i)}get correctness(){let r=this.correctResponse;if(!r)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let n=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>n.includes(d)).length,c=a.filter(d=>!n.includes(d)).length;return l===n.length&&c===0&&a.length===n.length?Z.Correct:l>0&&(l<n.length||c>0)?Z.PartiallyCorrect:Z.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let i=this.nextSibling,n=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==Z.Correct))){if(!n)return;this.parentElement?.removeChild(i);return}if(n)return;let l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){z(this._internals.states,"answer-key-shown",!!(r&&this.correctResponse),["show-correct-response"])}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return xe([p({attribute:"correct-response",reflect:!0,converter:Xt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),xe([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),xe([N("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),xe([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),xe([N("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),xe([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),xe([N("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),xe([T()],t.prototype,"_isFullCorrectResponse",void 0),xe([T()],t.prototype,"_correctResponse",void 0),t};var st=w`
|
|
11275
|
+
`}async#r(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#i(this.#t),this._internals.setFormValue(this.#e),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#i(t){return new Promise((e,r)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(t)})}};var ks=[{tag:"qti-upload-interaction",ctor:Cs}];var tu=[...Jo,...Yo,...Ko,...Zo,...ts,...es,...is,...ns,...os,...ss,...as,...ls,...ds,...ps,...us,...bs,...ys,...qs,...xs,...ws,...ks,...Xh];for(let{tag:o,ctor:t}of tu)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Jo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Yo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ko)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Zo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ts)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of is)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ns)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of os)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ss)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of as)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ls)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ps)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of us)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of bs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ys)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of qs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of xs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ws)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ks)customElements.get(o)||customElements.define(o,t);var PN=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await Nd().load(`${o}`).then(a=>a.assessmentTest()),r=await Ur().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Ur().load(`${t}/${e.href}`).then(a=>a.items()),n=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:n,items:i,testIdentifier:e.identifier}},ON=async o=>Jt().load(o).then(t=>t.htmlDoc().firstElementChild);var Es=class extends Xf(Qt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Xf(o){return class extends o{calculateChildren(e){return e.map(i=>{let n=i;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=n.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var eu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ni=class extends S{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let r of t){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(r.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(r.value===null||r.value===void 0)return null;r.value==="true"&&e++}return e>=this.min&&e<=this.max}};eu([p({type:Number})],ni.prototype,"min",void 0);eu([p({type:Number})],ni.prototype,"max",void 0);var Gf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},yn=class extends S{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Gf([p({type:String,attribute:"base-type"})],yn.prototype,"baseType",void 0);var Ss=class extends S{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var As=class extends S{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let i=this.#t(t.value),n=this.#t(e.value);return n.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(i,n,r):this.#r(i,n,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return Y.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let i=[...t];return e.every(n=>{let s=i.findIndex(a=>this.#e(a,n,r));return s===-1?!1:(i.splice(s,1),!0)})}#i(t,e,r){for(let i=0;i+e.length<=t.length;i++)if(e.every((n,s)=>this.#e(t[i+s],n,r)))return!0;return!1}};var _s=class extends S{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var jl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Er=class extends S{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let n=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!n)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(n=>n.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};jl([p({type:String})],Er.prototype,"identifier",void 0);jl([I({context:j,subscribe:!0}),T()],Er.prototype,"context",void 0);jl([T(),I({context:nt,subscribe:!0})],Er.prototype,"_testContext",void 0);var Ts=class extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(n=>!e.value.includes(n))}return null}};var Is=class extends S{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Rs=class extends S{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Ms=class extends S{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Jf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qn=class extends S{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let i=parseFloat(e.value),n=parseFloat(r.value);if(!isNaN(i)&&!isNaN(n))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};Jf([p({type:String,attribute:"rounding-mode"})],qn.prototype,"roundingMode",void 0);var ru=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},oi=class extends S{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?Y.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(l=>parseFloat(l));if(r.length===0||r.some(l=>Number.isNaN(l)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[i,n=i]=r,[s,a]=this.toleranceMode==="absolute"?[e-i,e+n]:[e*(1-i/100),e*(1+n/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};ru([p({type:String,attribute:"tolerance-mode"})],oi.prototype,"toleranceMode",void 0);ru([p({type:String})],oi.prototype,"tolerance",void 0);var J=class extends E{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var Ps=class extends J{process(){throw new Or}};var Os=class extends J{process(){throw new Dr}};var Ds=class extends S{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],r=e?.cardinality==="record"||e?.baseType==="record";if(r&&(e.value===null||e.value===void 0))return null;if(!e||!r||!ce(e.value))return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i==null?null:(this.#t=e.fieldBaseTypes?.[t]??io(Array.isArray(i)?i[0]:i),i)}};var $s=class extends S{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(r.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(r.cardinality==="multiple"||r.cardinality==="ordered"){if(!Array.isArray(r.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of r.value){if(i==null)return null;let n=parseInt(i,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let r=1;r<t.length&&(e=this.#e(e,Math.abs(t[r])),e!==1);r++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let r=e;e=t%e,t=r}return t}};var Tt=o=>o==null||o==="";var Ns=class extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Tt(e?.value)||Tt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Ls=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Tt(e?.value)||Tt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var Yf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},xn=class extends S{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let r=this.#t(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(r)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let r=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>r.length?null:r[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(r=>r.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Yf([p({type:String})],xn.prototype,"n",void 0);var iu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},si=class extends S{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),i=this.#e(this.coords);if(!r||i.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,i);case"rect":return this.#i(r,i);case"ellipse":return this.#n(r,i);case"poly":case"polygon":return this.#o(r,i);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(n=>n.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,n]=e;return(t.x-r)**2+(t.y-i)**2<=n**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,n,s]=e,a=Math.min(r,n),l=Math.max(r,n),c=Math.min(i,s),d=Math.max(i,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#n(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,i,n,s]=e;return n===0||s===0?!1:(t.x-r)**2/n**2+(t.y-i)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,n=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],l=e[n],c=e[n+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(r=!r),n=i}return r}};iu([p({type:String})],si.prototype,"shape",void 0);iu([p({type:String})],si.prototype,"coords",void 0);var Vs=class extends S{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};var js=class extends S{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};var Fs=class extends S{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var zs=class extends S{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var Bs=class extends S{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);continue}if(r.cardinality!=="multiple"&&r.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(r.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let i of r.value){let n=Number.parseInt(i,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n)}}return e}#e(t,e){let r=Math.abs(t),i=Math.abs(e);for(;i!==0;){let n=r%i;r=i,i=n}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var nu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ai=class extends J{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(n=>n.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let r=parseFloat(this.childExpression.calculate()),i;return e.matchTable?.size?i=e.matchTable.get(r):e.interpolationTable&&(i=this.#t(r,e.interpolationTable)),i==null?(console.warn(`lookupOutcomeValue: no table entry matches ${r} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Mt(i)}})),i)}#t(t,e){if(!Number.isNaN(t))return e.find(r=>r.includeBoundary?t>=r.sourceValue:t>r.sourceValue)?.targetValue}};nu([p({type:String})],ai.prototype,"identifier",void 0);nu([I({context:j,subscribe:!0}),T()],ai.prototype,"context",void 0);var Us=class extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Tt(e?.value)||Tt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var Hs=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Tt(e?.value)||Tt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var Kf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},wn=class extends S{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=(Array.isArray(t.value)?t.value:[t.value]).filter(s=>typeof s=="string"&&s.length>0);if(r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,n=new Set;for(let s of r)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;if(Y.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){i+=a.mappedValue??0,n.add(a.coords);break}}return n.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Kf([p({type:String})],wn.prototype,"identifier",void 0);var Zf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Cn=class extends S{getResult(){let t=this.context.variables.find(n=>n.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let n of r){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?Y.compareSingleValues(l.mapKey.toLowerCase(),n.toLowerCase(),t.baseType):Y.compareSingleValues(l.mapKey,n,t.baseType)),a=s.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};Zf([p({type:String})],Cn.prototype,"identifier",void 0);var Ws=class o extends S{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):Y.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!Y.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let n=null,s=[...t.value];for(let a of s)if(Y.compareSingleValues(i,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var tg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},kn=class extends S{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};tg([p({type:String})],kn.prototype,"name",void 0);var eg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},En=class extends S{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let i=parseFloat(r.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],i=e[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(e.length!==2)return null;let r=e[0],i=e[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};eg([p({type:String})],En.prototype,"name",void 0);var Qs=class extends S{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Xs=class extends S{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};var Gs=class extends S{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Js=class extends S{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var Ys=class extends S{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var Ks=class extends S{getResult(){return null}};var Zs=class extends Qt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),n=!1;if(typeof i=="string")if(i==="true")n=!0;else if(i==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(n=i);return n}).some(e=>typeof e=="boolean"&&e)}};var ta=class extends S{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var ea=class extends E{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},li=class extends ea{shouldProcess(){return!0}getSubRules(){return[...this.children]}},ci=class extends ea{shouldProcess(){let e=this.firstElementChild.calculate();return e===!0||e==="true"}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},di=class extends J{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var ra=class extends di{};var hi=class extends ci{};var ia=class extends hi{};var na=class extends li{};var rg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Sn=class extends S{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=this.#t();return r?r.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};rg([p({type:String})],Sn.prototype,"pattern",void 0);var oa=class extends S{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),n=parseFloat(r.value);if(isNaN(i)||isNaN(n))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&n<=0||i<0&&!Number.isInteger(n))return null;let s;try{s=Math.pow(i,n)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),l=Math.max(0,14-a),c=Math.pow(10,l);s=Math.round(s*c)/c}return s}};var ig=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function ng(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function An(o,t){return ng(t===void 0?o.toExponential():o.toExponential(t))}function ou(o){let[t,e]=o.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,i=e===void 0?"":`e${e}`;return`${r}${i}`}function su(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?ou(An(o,e-1)):ou(o.toFixed(Math.max(0,e-1-r)))}function og(o,t,e,r){if(o==="s"||o==="c"){let c=o==="c"?r.slice(0,1):r;return e===void 0?c:c.slice(0,e)}let i=Number(r);if(r.trim()===""||!Number.isFinite(i))return r;let n=Math.abs(i),s,a=i<0;switch(o){case"d":case"i":s=String(Math.trunc(n));break;case"u":s=String(Math.trunc(n)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(n).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(n).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(n).toString(16).toUpperCase()}`;break;case"f":case"F":s=n.toFixed(e??6);break;case"e":s=An(n,e??6);break;case"E":s=An(n,e??6).toUpperCase();break;case"g":s=su(n,e??6);break;case"G":s=su(n,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function sg(o,t,e){if(o.length>=e)return o;let r=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(r)}`;if(t.includes("0")){let[,i,n]=/^([-+ ]?)(.*)$/.exec(o);return`${i}${"0".repeat(r)}${n}`}return`${" ".repeat(r)}${o}`}function au(o,t){return o.replace(ig,(e,r,i,n,s,a)=>r?"%":sg(og(a,i??"",s===void 0?void 0:Number(s),t),i??"",n===void 0?0:Number(n)))}var qe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vt=class extends E{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:v`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let r=e[this.index-1];return r==null?null:this.#e(r,t.baseType)}return e.map(r=>this.#e(r,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let r=e;if(this.field!==void 0){let n=r[this.field];return n==null?null:this.#e(n,t.baseType)}let i=Object.entries(r).filter(([,n])=>n!=null);return i.length===0?null:i.map(([n,s])=>`${n}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let r=Array.isArray(t)?t.join(" "):String(t);if(this.format)return au(this.format,r);if(e==="integer"&&this.base!==10){let i=Number.parseInt(r,10);if(Number.isFinite(i))return i.toString(this.base)}if(this.powerForm){let i=Number(r);if(r.trim()!==""&&Number.isFinite(i))return An(i)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};qe([p({type:String})],vt.prototype,"identifier",void 0);qe([p({type:String})],vt.prototype,"format",void 0);qe([p({type:Number})],vt.prototype,"base",void 0);qe([p({type:Number})],vt.prototype,"index",void 0);qe([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);qe([p({type:String})],vt.prototype,"field",void 0);qe([p({type:String})],vt.prototype,"delimiter",void 0);qe([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);qe([I({context:j,subscribe:!0}),T()],vt.prototype,"context",void 0);var sa=class extends S{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};var Fl=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Sr=class extends S{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),e++}if(t.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let r=Math.floor(Math.random()*t.length);return t[r]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};Fl([p({type:Number})],Sr.prototype,"min",void 0);Fl([p({type:Number})],Sr.prototype,"max",void 0);Fl([p({type:Number})],Sr.prototype,"step",void 0);var aa=class extends S{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let r=Math.floor(Math.random()*e.length);return e[r]}return e}return console.error("unexpected number of children in match"),null}};var ag=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},zl=1e3,_n=class extends S{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let i=0;i<t;i++){let n=e.calculate(),s=this.#r(n);s&&r.push(s)}return r}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,n=parseInt(i?.toString()??"",10);return Number.isNaN(n)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(n)}#e(t){return t>zl?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${zl} limit, truncating`),zl):t}#r(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};ag([p({type:String,attribute:"number-repeats"})],_n.prototype,"numberRepeats",void 0);var la=class extends di{};var pi=class extends ci{};var ca=class extends pi{};var da=class extends li{};var ha=class extends J{process(){for(let t of[...this.children])t.process()}};var lu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ui=class extends S{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),i=Math.pow(10,e-r-1);return Math.round(t*i)/i}};lu([p({type:String,attribute:"rounding-mode"})],ui.prototype,"roundingMode",void 0);lu([p({type:Number})],ui.prototype,"figures",void 0);var pa=class extends S{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var ua=class extends J{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new Bl(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Bl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetCorrectResponseRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var ma=class extends J{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new Ul(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(Mt):t!==null?Mt(t):null}},Ul=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>e.value?e.value:e):t}};var fa=class extends J{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new Hl(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Hl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetTemplateValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>this.#t(e)):this.#t(t)}#t(t){return t&&typeof t=="object"&&"value"in t?t.value:t}};var lg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Tn=class extends S{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#i(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#r(t,t.length);case"popsd":return Math.sqrt(this.#r(t,t.length));case"samplevariance":return t.length<2?null:this.#r(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#r(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,r)=>e+r,0)/t.length}#e(t){let e=[...t].sort((i,n)=>i-n),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}#r(t,e){let r=this.#t(t);return t.reduce((i,n)=>i+Math.pow(n-r,2),0)/e}#i(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};lg([p({type:String})],Tn.prototype,"name",void 0);var cg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},In=class extends S{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return Y.compareSingleValues(i,n,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};cg([p({type:String,attribute:"case-sensitive"})],In.prototype,"caseSensitive",void 0);var dg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Rn=class extends S{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let i=e.value.toString(),n=r.value.toString();return this.caseSensitive!=="true"?n.toLowerCase().includes(i.toLowerCase()):n.includes(i)}};dg([p({type:String,attribute:"case-sensitive"})],Rn.prototype,"caseSensitive",void 0);var ga=class extends hg(S){getResult(){return this.calculateChildren(Array.from(this.children))}};function hg(o){return class extends o{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=i.calculate();return Number.isNaN(n)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(n)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var ba=class extends S{getResult(){return new Wl(Array.from(this.children)).calculate()}},Wl=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(r=>r.calculate!==void 0).some(r=>r.calculate()===null)?null:this.expressions.map(r=>{let i=r.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((r,i)=>r+i,0)}};var va=class extends S{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var ya=class extends S{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var cu=[{tag:"qti-and",ctor:Es},{tag:"qti-any-n",ctor:ni},{tag:"qti-base-value",ctor:yn},{tag:"qti-container-size",ctor:Ss},{tag:"qti-contains",ctor:As},{tag:"qti-correct",ctor:_s},{tag:"qti-default",ctor:Er},{tag:"qti-delete",ctor:Ts},{tag:"qti-divide",ctor:Is},{tag:"qti-duration-gte",ctor:Rs},{tag:"qti-duration-lt",ctor:Ms},{tag:"qti-equal",ctor:oi},{tag:"qti-equal-rounded",ctor:qn},{tag:"qti-exit-response",ctor:Ps},{tag:"qti-exit-test",ctor:Os},{tag:"qti-field-value",ctor:Ds},{tag:"qti-gcd",ctor:$s},{tag:"qti-gt",ctor:Ns},{tag:"qti-gte",ctor:Ls},{tag:"qti-index",ctor:xn},{tag:"qti-inside",ctor:si},{tag:"qti-integer-divide",ctor:Vs},{tag:"qti-integer-modulus",ctor:js},{tag:"qti-integer-to-float",ctor:Fs},{tag:"qti-is-null",ctor:zs},{tag:"qti-lcm",ctor:Bs},{tag:"qti-lookup-outcome-value",ctor:ai},{tag:"qti-lt",ctor:Us},{tag:"qti-lte",ctor:Hs},{tag:"qti-map-response",ctor:Cn},{tag:"qti-map-response-point",ctor:wn},{tag:"qti-match",ctor:Ws},{tag:"qti-math-constant",ctor:kn},{tag:"qti-math-operator",ctor:En},{tag:"qti-max",ctor:Qs},{tag:"qti-member",ctor:Xs},{tag:"qti-min",ctor:Gs},{tag:"qti-multiple",ctor:Js},{tag:"qti-not",ctor:Ys},{tag:"qti-null",ctor:Ks},{tag:"qti-or",ctor:Zs},{tag:"qti-ordered",ctor:ta},{tag:"qti-outcome-condition",ctor:ra},{tag:"qti-outcome-else",ctor:na},{tag:"qti-outcome-else-if",ctor:ia},{tag:"qti-outcome-if",ctor:hi},{tag:"qti-pattern-match",ctor:Sn},{tag:"qti-power",ctor:oa},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:sa},{tag:"qti-random",ctor:aa},{tag:"qti-random-integer",ctor:Sr},{tag:"qti-repeat",ctor:_n},{tag:"qti-response-condition",ctor:la},{tag:"qti-response-else",ctor:da},{tag:"qti-response-else-if",ctor:ca},{tag:"qti-response-if",ctor:pi},{tag:"qti-response-processing-fragment",ctor:ha},{tag:"qti-round",ctor:pa},{tag:"qti-round-to",ctor:ui},{tag:"qti-rule",ctor:J},{tag:"qti-set-correct-response",ctor:ua},{tag:"qti-set-outcome-value",ctor:ma},{tag:"qti-set-template-value",ctor:fa},{tag:"qti-stats-operator",ctor:Tn},{tag:"qti-string-match",ctor:In},{tag:"qti-substring",ctor:Rn},{tag:"qti-subtract",ctor:ga},{tag:"qti-sum",ctor:ba},{tag:"qti-truncate",ctor:va},{tag:"qti-variable",ctor:ya}];for(let{tag:o,ctor:t}of cu)customElements.get(o)||customElements.define(o,t);var xe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Z;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(Z||(Z={}));var Ql=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,i)=>{this.toggleCandidateCorrection(i)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""),z(this._internals.states,"answer-key",!0,[]))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let i=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",i)}get correctness(){let r=this.correctResponse;if(!r)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let n=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>n.includes(d)).length,c=a.filter(d=>!n.includes(d)).length;return l===n.length&&c===0&&a.length===n.length?Z.Correct:l>0&&(l<n.length||c>0)?Z.PartiallyCorrect:Z.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let i=this.nextSibling,n=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==Z.Correct))){if(!n)return;this.parentElement?.removeChild(i);return}if(n)return;let l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){z(this._internals.states,"answer-key-shown",!!(r&&this.correctResponse),["show-correct-response"])}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return xe([p({attribute:"correct-response",reflect:!0,converter:Xt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),xe([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),xe([N("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),xe([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),xe([N("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),xe([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),xe([N("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),xe([T()],t.prototype,"_isFullCorrectResponse",void 0),xe([T()],t.prototype,"_correctResponse",void 0),t};var st=w`
|
|
11276
11276
|
/* Nothing at all until the item judges this element. */
|
|
11277
11277
|
[part~='correction'] {
|
|
11278
11278
|
display: none;
|
|
@@ -11305,21 +11305,21 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11305
11305
|
|
|
11306
11306
|
pointer-events: none;
|
|
11307
11307
|
}
|
|
11308
|
-
`;var
|
|
11308
|
+
`;var du=o=>o==="partially-correct"?"candidate-partial":`candidate-${o}`,pg=["candidate-correct","candidate-incorrect","candidate-partial"],Xl=o=>o?`correction ${du(o)} correction-${o}`:"correction",Gl=(o,t)=>{for(let e of pg)z(o,e,!1);t&&z(o,du(t),!0)},It=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(r){if(this.#t===r)return;let i=this.#t;this.#t=r,Gl(this.internals.states,r),this.requestUpdate("candidateCorrection",i)}get correctionPart(){return Xl(this.#t)}}return t};var ug=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},K=o=>{class t extends Ql(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return Xl(this._candidateCorrection)}toggleCandidateCorrection(r){this.showCandidateCorrection!==r&&(this.showCandidateCorrection=r),super.toggleCandidateCorrection(r);let i=this._internals,n=null;r&&(this.correctness===Z.Correct&&(n="correct"),this.correctness===Z.PartiallyCorrect&&(n="partially-correct"),this.correctness===Z.Incorrect&&(n="incorrect")),Gl(i.states,n),this._candidateCorrection!==n&&(this._candidateCorrection=n)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return ug([T()],t.prototype,"_candidateCorrection",void 0),t};var Ar=o=>{class t extends K(o){toggleInternalCorrectResponse(r){super.toggleInternalCorrectResponse(r);let i=this.correctResponse,n=i?Array.isArray(i)?i:[i]:[];for(let s of this._choiceElements){let a=r&&n.includes(s.identifier);z(s.internals.states,"answer-key",a,["correct-response"])}}toggleCandidateCorrection(r){super.toggleCandidateCorrection(r);for(let s of this._choiceElements)s.candidateCorrection=null;if(!r||!this.correctResponse)return;let i=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],n=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)n.includes(s.identifier)&&(s.candidateCorrection=i.includes(s.identifier)?"correct":"incorrect")}}return t};var Jl=class extends It(Ve){static{this.styles=[Ve.styles,st]}render(){return v`<div part="control"></div>
|
|
11309
11309
|
<slot part="label"></slot>
|
|
11310
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
11310
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var mg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qa=class extends It(ur){constructor(){super(...arguments),this.orderCorrect=null}updated(t){super.updated(t),t.has("orderCorrect")&&(this.orderCorrect==null?this.removeAttribute("data-order-correct"):this.setAttribute("data-order-correct",String(this.orderCorrect)))}};mg([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],qa.prototype,"orderCorrect",void 0);var Yl=class extends It(mr){static{this.styles=[mr.styles,st]}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
11311
11311
|
<slot part="label"></slot>
|
|
11312
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
11312
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Kl=class extends It(Lt){static{this.styles=[Lt.styles,st]}render(){return v`
|
|
11313
11313
|
<div part="control"></div>
|
|
11314
11314
|
<slot part="label"></slot>
|
|
11315
11315
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
11316
11316
|
<div part="drop">
|
|
11317
11317
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
11318
11318
|
</div>
|
|
11319
|
-
`}};var
|
|
11319
|
+
`}};var Zl=class extends It(Vt){static{this.styles=[Vt.styles,st]}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
11320
11320
|
${this.marker?v`<div id="label" part="marker">${this.marker}</div>`:P}
|
|
11321
11321
|
<slot part="label"></slot>
|
|
11322
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
11322
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var hu=class extends mt{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let r=this.getRootNode();for(;;){if(r.querySelectorAll(t).forEach(i=>i.shown=e),!(r instanceof ShadowRoot))return;r=r.host.getRootNode()}}};var pu=class extends be{#t=t=>{let e=t.detail;this.assessmentItem?.showCorrectResponse?.(e),this.updateControlState("item-show-correct-response",e)};#e=t=>{let e=t.detail;this.assessmentItem?.showCandidateCorrection?.(e),this.updateControlState("item-show-candidate-correction",e)};#r=t=>{this.assessmentItem?.showCorrectResponse?.(!1),this.configContext={...this.configContext,correctResponseMode:t.detail}};updateAssessmentItemView(t,e){t?.showCorrectResponse?.(e==="scorer"),this.updateControlState("item-show-correct-response",e==="scorer")}constructor(){super(),this.addEventListener("item-show-correct-response",this.#t),this.addEventListener("item-show-candidate-correction",this.#e),this.addEventListener("item-switch-correct-response-mode",this.#r)}updateControlState(t,e){this.querySelectorAll(t).forEach(r=>r.shown=e)}disconnectedCallback(){this.removeEventListener("item-show-correct-response",this.#t),this.removeEventListener("item-show-candidate-correction",this.#e),this.removeEventListener("item-switch-correct-response-mode",this.#r),super.disconnectedCallback()}};var uu=class extends ct{#t=t=>{this.activeAssessmentItem?.showCorrectResponse?.(t.detail)};#e=t=>{this.activeAssessmentItem?.showCandidateCorrection?.(t.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#t),this.addEventListener("test-show-candidate-correction",this.#e)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#t),this.removeEventListener("test-show-candidate-correction",this.#e),super.disconnectedCallback()}afterAttemptEnded(t,e,r){if(!t||!e?.sessionControl?.showSolution)return;let i=t;i.showCandidateCorrection?.(!0),i.showCorrectResponse?.(r)}},mu=class extends Pe{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}};var tc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Mn=class extends E{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return v`
|
|
11323
11323
|
<label part="label" for="modeSelect">${this.label}</label>
|
|
11324
11324
|
<select
|
|
11325
11325
|
part="select"
|
|
@@ -11330,12 +11330,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11330
11330
|
${this._options[t]}
|
|
11331
11331
|
</option>`)}
|
|
11332
11332
|
</select>
|
|
11333
|
-
`}};
|
|
11333
|
+
`}};tc([I({context:yt,subscribe:!0})],Mn.prototype,"itemContext",void 0);tc([p({type:String})],Mn.prototype,"label",void 0);tc([T()],Mn.prototype,"_options",void 0);var mi=w`
|
|
11334
11334
|
display: inline-flex;
|
|
11335
11335
|
cursor: pointer;
|
|
11336
11336
|
border-radius: 0.25rem;
|
|
11337
11337
|
user-select: none;
|
|
11338
|
-
`,
|
|
11338
|
+
`,fu=w`
|
|
11339
11339
|
display: flex;
|
|
11340
11340
|
flex: 1 1 auto;
|
|
11341
11341
|
align-items: center;
|
|
@@ -11345,12 +11345,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11345
11345
|
user-select: none;
|
|
11346
11346
|
`,fi=w`
|
|
11347
11347
|
background-color: lightgray;
|
|
11348
|
-
${
|
|
11348
|
+
${fu};
|
|
11349
11349
|
`,gi=w`
|
|
11350
11350
|
cursor: not-allowed;
|
|
11351
11351
|
opacity: 0.8;
|
|
11352
|
-
`,
|
|
11353
|
-
${
|
|
11352
|
+
`,sB=w`
|
|
11353
|
+
${fu};
|
|
11354
11354
|
border: 1px solid gray;
|
|
11355
11355
|
`;var bi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ge=class extends E{static{this.styles=w`
|
|
11356
11356
|
:host {
|
|
@@ -11386,7 +11386,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11386
11386
|
:host([disabled]) {
|
|
11387
11387
|
${gi};
|
|
11388
11388
|
}
|
|
11389
|
-
`}#t;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=this.attachInternals(),this.#t.role="button",this.addEventListener("click",()=>this.#r()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#r())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=0)}#e;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(i=>i.items)).find(r=>r.active);if(this.#e!==e?.identifier&&(this.shown=!1,this.#e=e?.identifier),e){let r=!!e?.variables?.some(n=>n.correctResponse),i=!!e?.variables?.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!i}else this.disabled=!0;this.#t.ariaDisabled=String(this.disabled),this.#t.ariaPressed=String(this.shown)}#r(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v`<div part="button">${this.#i()}</div>`}};yi([I({context:lt,subscribe:!0})],Ye.prototype,"computedContext",void 0);yi([p({type:Boolean,reflect:!0})],Ye.prototype,"shown",void 0);yi([p({type:Boolean,reflect:!0})],Ye.prototype,"disabled",void 0);yi([p({type:String})],Ye.prototype,"showCorrectText",void 0);yi([p({type:String})],Ye.prototype,"hideCorrectText",void 0);yi([p({type:String})],Ye.prototype,"noCorrectResponseText",void 0);var re=o=>{class t extends K(o){toggleInternalCorrectResponse(r){this.showFullCorrectResponse||this.toggleFullCorrectResponse(r)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var
|
|
11389
|
+
`}#t;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=this.attachInternals(),this.#t.role="button",this.addEventListener("click",()=>this.#r()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#r())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=0)}#e;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(i=>i.items)).find(r=>r.active);if(this.#e!==e?.identifier&&(this.shown=!1,this.#e=e?.identifier),e){let r=!!e?.variables?.some(n=>n.correctResponse),i=!!e?.variables?.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!i}else this.disabled=!0;this.#t.ariaDisabled=String(this.disabled),this.#t.ariaPressed=String(this.shown)}#r(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v`<div part="button">${this.#i()}</div>`}};yi([I({context:lt,subscribe:!0})],Ye.prototype,"computedContext",void 0);yi([p({type:Boolean,reflect:!0})],Ye.prototype,"shown",void 0);yi([p({type:Boolean,reflect:!0})],Ye.prototype,"disabled",void 0);yi([p({type:String})],Ye.prototype,"showCorrectText",void 0);yi([p({type:String})],Ye.prototype,"hideCorrectText",void 0);yi([p({type:String})],Ye.prototype,"noCorrectResponseText",void 0);var re=o=>{class t extends K(o){toggleInternalCorrectResponse(r){this.showFullCorrectResponse||this.toggleFullCorrectResponse(r)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var rc=class extends re(vr){};var ic=class extends Ar(yr){};var fg=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},xa=class extends It(X){static{this.styles=[X.styles,st,w`
|
|
11390
11390
|
/*
|
|
11391
11391
|
* Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
|
|
11392
11392
|
* is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
|
|
@@ -11450,7 +11450,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11450
11450
|
}
|
|
11451
11451
|
`]}render(){return v`${this.renderPrompt()}${this.renderTextarea()}
|
|
11452
11452
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
11453
|
-
${this.renderValidationMessage()}`}};
|
|
11453
|
+
${this.renderValidationMessage()}`}};fg([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],xa.prototype,"candidateCorrection",void 0);var wa=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[r,i]=e.split(" ");return{source:r,target:i}}):[];var nc=class extends re(ti){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=wa(this.correctResponse);for(let r of this.querySelectorAll("qti-gap")){let i=r.getAttribute("identifier"),n=r.drags;for(let s of n)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===i)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var oc=class extends K(bt){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",r)}renderSupplementalLines(){return H(this.#t,t=>t,t=>Oi`
|
|
11454
11454
|
<line
|
|
11455
11455
|
part="line answer-key correct-line"
|
|
11456
11456
|
x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
|
|
@@ -11461,7 +11461,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11461
11461
|
stroke-width="3"
|
|
11462
11462
|
stroke-dasharray="5,5"
|
|
11463
11463
|
/>
|
|
11464
|
-
`)}};var
|
|
11464
|
+
`)}};var sc=class extends re(xr){};var ac=class extends K(We){resolvePinColor(t){let{internals:e}=t;return ji(e.states,"candidate-incorrect")?"var(--qti-incorrect)":ji(e.states,"candidate-correct")?"var(--qti-correct)":super.resolvePinColor(t)}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements){let n=r.indexOf(i.identifier);i.orderCorrect=t&&n>=0?n+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements)i.candidateCorrection=null,t&&i.order!=null&&(i.candidateCorrection=r[i.order-1]===i.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var lc=class extends Ar(ei){};var cc=class extends Ar(ri){};var dc=class extends K(rt){static get styles(){return[rt.styles,st,w`
|
|
11465
11465
|
/*
|
|
11466
11466
|
* Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
|
|
11467
11467
|
* badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
|
|
@@ -11480,7 +11480,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11480
11480
|
`]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return v`
|
|
11481
11481
|
${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
|
|
11482
11482
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
11483
|
-
`}};var
|
|
11483
|
+
`}};var hc=class extends re(ee){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=wa(this.correctResponse);this.#t=t?new Set(e.map(r=>`${r.source} ${r.target}`)):new Set;for(let r of this.targetChoices){let i=r.getAttribute("identifier"),n=r.drags;for(let s of n)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${i}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"candidate-correct correct":"candidate-incorrect incorrect"}};function gg(o){if(o.length===0)return new Set;let t=new Array(o.length).fill(1),e=new Array(o.length).fill(-1);for(let n=0;n<o.length;n++)for(let s=0;s<n;s++)o[s]<o[n]&&t[s]+1>t[n]&&(t[n]=t[s]+1,e[n]=s);let r=0;for(let n=1;n<o.length;n++)t[n]>t[r]&&(r=n);let i=new Set;for(let n=r;n!==-1;n=e[n])i.add(n);return i}function gu(o,t){let e=new Map(t.map((a,l)=>[a,l])),r=o.filter(a=>e.has(a)),i=r.map(a=>e.get(a)),n=gg(i),s=new Set;return n.forEach(a=>s.add(r[a])),s}var pc=class extends re(Qe){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let r=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(c=>this.chipsIn(c));for(let c of r)c.candidateCorrection=null;if(!t)return;let i=this.correctResponse,s=(i?Array.isArray(i)?i:[i]:[]).map((c,d)=>{let[h,f]=c.split(" "),m=f?.startsWith("droplist")?parseInt(f.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(m)?d:m}}).filter(c=>c.identifier).sort((c,d)=>c.dropIndex-d.dropIndex).map(c=>c.identifier);if(s.length===0)return;let a=r.map(c=>({choice:c,identifier:c.getAttribute("identifier")})).filter(c=>!!c.identifier),l=gu(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var uc=class extends K(G){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,r=e?.correctResponse??this.correctResponse;this.correctResponse=t?r:e?.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${i}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let n=document.createElement("div");n.id=i,n.className="pci-correct-response-container",Object.assign(n.style,{position:"relative",marginTop:"20px",border:"2px solid green",padding:"16px",borderRadius:"4px",backgroundColor:"rgba(0, 128, 0, 0.05)"});let s=document.createElement("div");s.textContent="Correct Response:",Object.assign(s.style,{fontWeight:"bold",marginBottom:"10px",color:"green"}),n.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let l=this.responseIdentifier;a.responseIdentifier=`${l}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let c=this.correctResponse,d=e?.cardinality??(Array.isArray(c)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:c}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(c,d,h);a.sendMessageToIframe("setBoundTo",{[l]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",n.append(a),this.after(n)}};var mc=class extends K(dt){#t=[];#e=[];static{this.styles=[dt.styles,w`
|
|
11484
11484
|
[part~='candidate-correct'] {
|
|
11485
11485
|
--qti-select-point-marker-color: var(--qti-correct);
|
|
11486
11486
|
}
|
|
@@ -11493,7 +11493,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11493
11493
|
data-coord=${t.coords}
|
|
11494
11494
|
data-shape=${t.shape}
|
|
11495
11495
|
alt=${`correct-response-${e+1}`}
|
|
11496
|
-
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var
|
|
11496
|
+
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var fc=class extends K(_t){#t=null;static{this.styles=[_t.styles,w`
|
|
11497
11497
|
[part~='knob'][part~='answer-key'] {
|
|
11498
11498
|
background-color: var(--qti-correct-light);
|
|
11499
11499
|
border: 2px solid var(--qti-correct);
|
|
@@ -11508,7 +11508,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11508
11508
|
}
|
|
11509
11509
|
`]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=Array.isArray(e)?e[0]:e,i=t&&r?parseFloat(r):NaN,n=this.#t;if(this.#t=Number.isFinite(i)?i:null,this.#t!==null){let s=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}else this.style.removeProperty("--value-percentage-correct");this.requestUpdate("correctResponseNumber",n)}renderRailSupplement(){return this.#t===null?P:v`<div id="knob-correct" part="knob answer-key knob-correct">
|
|
11510
11510
|
<div id="value" part="value">${this.#t}</div>
|
|
11511
|
-
</div>`}};var
|
|
11511
|
+
</div>`}};var gc=class extends K(ht){static{this.styles=[ht.styles,st,w`
|
|
11512
11512
|
/*
|
|
11513
11513
|
* The trailing inset only — size and leading gap come from the shared sheet.
|
|
11514
11514
|
*
|
|
@@ -11532,7 +11532,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11532
11532
|
${this.renderAnswer()} ${this.renderInput()}
|
|
11533
11533
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
11534
11534
|
${this.renderValidationMessage()}
|
|
11535
|
-
`}};export{K as CandidateCorrectionMixin,Ar as ChoiceCorrectionMixin,
|
|
11535
|
+
`}};export{K as CandidateCorrectionMixin,Ar as ChoiceCorrectionMixin,Ql as CorrectResponseMixin,Z as Correctness,Xa as CustomStateSetShim,Ga as INITIAL_SESSION_CONTEXT,Ja as INITIAL_TEST_CONTEXT,D as Interaction,Za as IsNullOrUndefined,Nt as ItemContainer,Mn as ItemCorrectResponseMode,sn as ItemPrintVariables,Ge as ItemShowCandidateCorrection,Je as ItemShowCorrectResponse,Ch as ItemViewMixin,ud as PUBLIC_ITEM_EVENTS,nn as QTI_TEST_STATE_VERSION,Es as QtiAnd,ni as QtiAnyN,mt as QtiAssessmentItem,hu as QtiAssessmentItemCorrection,wt as QtiAssessmentItemRef,Gt as QtiAssessmentSection,lo as QtiAssessmentStimulus,Hr as QtiAssessmentStimulusRef,ul as QtiAssessmentStimulusRefConnectedEvent,or as QtiAssessmentTest,Jr as QtiAssociableHotspot,vr as QtiAssociateInteraction,rc as QtiAssociateInteractionCorrection,yn as QtiBaseValue,de as QtiBranchRule,yr as QtiChoiceInteraction,ic as QtiChoiceInteractionCorrection,go as QtiCompanionMaterialsInfo,Qt as QtiConditionExpression,Ss as QtiContainerSize,As as QtiContains,Qi as QtiContentBody,Wr as QtiContextDeclaration,_s as QtiCorrect,ve as QtiCustomInteraction,Xi as QtiCustomOperator,Er as QtiDefault,Ts as QtiDelete,Is as QtiDivide,Rs as QtiDurationGte,Ms as QtiDurationLt,ye as QtiEndAttemptInteraction,oi as QtiEqual,qn as QtiEqualRounded,Ps as QtiExitResponse,Or as QtiExitResponseSignal,Os as QtiExitTest,Dr as QtiExitTestSignal,S as QtiExpression,X as QtiExtendedTextInteraction,xa as QtiExtendedTextInteractionCorrection,ut as QtiFeedback,bo as QtiFeedbackBlock,vo as QtiFeedbackInline,Ds as QtiFieldValue,hr as QtiGap,an as QtiGapImg,ti as QtiGapMatchInteraction,nc as QtiGapMatchInteractionCorrection,Ve as QtiGapText,Jl as QtiGapTextCorrection,$s as QtiGcd,bt as QtiGraphicAssociateInteraction,oc as QtiGraphicAssociateInteractionCorrection,xr as QtiGraphicGapMatchInteraction,sc as QtiGraphicGapMatchInteractionCorrection,We as QtiGraphicOrderInteraction,ac as QtiGraphicOrderInteractionCorrection,Ns as QtiGt,Ls as QtiGte,ur as QtiHotspotChoice,qa as QtiHotspotChoiceCorrection,ei as QtiHotspotInteraction,lc as QtiHotspotInteractionCorrection,mr as QtiHottext,Yl as QtiHottextCorrection,ri as QtiHottextInteraction,cc as QtiHottextInteractionCorrection,xn as QtiIndex,ln as QtiInlineChoice,rt as QtiInlineChoiceInteraction,dc as QtiInlineChoiceInteractionCorrection,si as QtiInside,Vs as QtiIntegerDivide,js as QtiIntegerModulus,Fs as QtiIntegerToFloat,zs as QtiIsNull,be as QtiItem,yo as QtiItemBody,pu as QtiItemCorrection,Pt as QtiItemSessionControl,Bs as QtiLcm,ai as QtiLookupOutcomeValue,Us as QtiLt,Hs as QtiLte,Cn as QtiMapResponse,wn as QtiMapResponsePoint,Ws as QtiMatch,ee as QtiMatchInteraction,hc as QtiMatchInteractionCorrection,kn as QtiMathConstant,En as QtiMathOperator,Qs as QtiMax,hs as QtiMediaInteraction,Xs as QtiMember,Gs as QtiMin,Qr as QtiModalFeedback,Js as QtiMultiple,Ys as QtiNot,Ks as QtiNull,Ui as QtiNumberPresented,oo as QtiNumberSelected,Zs as QtiOr,Qe as QtiOrderInteraction,pc as QtiOrderInteractionCorrection,ta as QtiOrdered,ra as QtiOutcomeCondition,ue as QtiOutcomeDeclaration,na as QtiOutcomeElse,ia as QtiOutcomeElseIf,hi as QtiOutcomeIf,ao as QtiOutcomeProcessing,al as QtiOutcomeProcessingProcessor,Sn as QtiPatternMatch,G as QtiPortableCustomInteraction,uc as QtiPortableCustomInteractionCorrection,At as QtiPositionObjectInteraction,vs as QtiPositionObjectStage,oa as QtiPower,so as QtiPreCondition,vt as QtiPrintedVariable,sa as QtiProduct,Lo as QtiPrompt,aa as QtiRandom,Sr as QtiRandomInteger,_n as QtiRepeat,la as QtiResponseCondition,_e as QtiResponseDeclaration,da as QtiResponseElse,ca as QtiResponseElseIf,pi as QtiResponseIf,xo as QtiResponseProcessing,ha as QtiResponseProcessingFragment,pa as QtiRound,ui as QtiRoundTo,me as QtiRubricBlock,cd as QtiRuleElement,dt as QtiSelectPointInteraction,mc as QtiSelectPointInteractionCorrection,ua as QtiSetCorrectResponse,Bl as QtiSetCorrectResponseRule,ma as QtiSetOutcomeValue,Ul as QtiSetOutcomeValueRule,fa as QtiSetTemplateValue,Hl as QtiSetTemplateValueRule,Lt as QtiSimpleAssociableChoice,Kl as QtiSimpleAssociableChoiceCorrection,Vt as QtiSimpleChoice,Zl as QtiSimpleChoiceCorrection,_t as QtiSliderInteraction,fc as QtiSliderInteractionCorrection,Tn as QtiStatsOperator,In as QtiStringMatch,ko as QtiStylesheet,Rn as QtiSubstring,ga as QtiSubtract,ba as QtiSum,Wl as QtiSumExpression,Eo as QtiTemplateConstraint,fe as QtiTemplateDeclaration,So as QtiTemplateProcessing,Pe as QtiTest,mu as QtiTestCorrection,Zi as QtiTestFeedback,Me as QtiTestPart,tn as QtiTestVariables,fl as QtiTestVariablesExpression,ht as QtiTextEntryInteraction,gc as QtiTextEntryInteractionCorrection,va as QtiTruncate,Cs as QtiUploadInteraction,ya as QtiVariable,Pr as QtiVariableDeclaration,sd as STATE_ALIASES,Y as ScoringHelper,kt as TestContainer,ge as TestEndAttempt,ct as TestNavigation,uu as TestNavigationCorrection,lr as TestNext,cr as TestPrev,Ye as TestShowCorrectResponse,No as TestSubmit,Qv as asSeed,M as boxSizing,Zu as classifyCustomStateSupport,lt as computedContext,ke as computedItemContext,yt as configContext,Mt as convertNumberToUniversalFormat,st as correctionPart,ky as decimalSeparator,rl as dispatchDeclared,xt as dispatchPublic,Wt as dropRegion,dd as getCustomOperator,ON as getItemByUri,PN as getManifestInfo,ji as hasState,io as inferRecordFieldBaseType,zf as inlineScriptText,Bf as inlineStyleText,nd as installCustomStateSetFallback,Rr as interactionContext,ce as isRecordValue,em as isSeed,j as itemContext,od as itemContextVariables,Py as iterResponseValues,il as listenDeclared,md as listenPublic,Oy as parsePair,$y as parsePoint,zi as parseResponseAttribute,xh as pluginElements,DS as pluginState,Xf as qtiAndMixin,qt as qtiContext,tu as qtiInteractionElements,hg as qtiSubtractMixin,Jt as qtiTransformItem,Nd as qtiTransformManifest,Ur as qtiTransformTest,Bi as readRecordFieldValues,zy as registerCustomOperator,ro as removeDoubleSlashes,Xt as responseAttributeConverter,Dy as serializePair,Ny as serializePoint,nr as serializeResponseAttribute,eo as sessionContext,z as setState,dh as stateFromContexts,nt as testContext,By as unregisterCustomOperator,U as validationMessage};
|
|
11536
11536
|
/*! Bundled license information:
|
|
11537
11537
|
|
|
11538
11538
|
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|