@citolab/qti-components 9.3.0 → 9.4.0
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 +217 -204
- package/dist/base.d.ts +10 -10
- package/dist/base.js +1 -1
- package/dist/{chunk-G5RQ5GKG.js → chunk-3BAQWO5C.js} +2 -2
- package/dist/{chunk-ZG7FBQFP.js → chunk-ACRN7YJM.js} +2 -2
- package/dist/{chunk-JLZCZVRX.js → chunk-B5XHZI2P.js} +2 -2
- package/dist/{chunk-RAJQKCQ3.js → chunk-B74SYQB2.js} +2 -2
- package/dist/{chunk-YIYHCHHM.js → chunk-BMXG7D2N.js} +2 -2
- package/dist/{chunk-FG5JAWSN.js → chunk-C3JPUV36.js} +2 -2
- package/dist/{chunk-TDWLV5OD.js → chunk-GNTO3IFM.js} +559 -251
- package/dist/chunk-GNTO3IFM.js.map +1 -0
- package/dist/{chunk-7VDR765S.js → chunk-JHPQJDAV.js} +2 -2
- package/dist/{chunk-CQHGVPOT.js → chunk-LKHRHFXO.js} +6 -6
- package/dist/{chunk-JGPWBIVD.js → chunk-MSGYZE6L.js} +2 -2
- package/dist/{chunk-YVZWNLF4.js → chunk-R7MMMDP7.js} +139 -18
- package/dist/chunk-R7MMMDP7.js.map +1 -0
- package/dist/{chunk-REKCRWJV.js → chunk-XEWGFAS4.js} +166 -104
- package/dist/chunk-XEWGFAS4.js.map +1 -0
- package/dist/{computed.types.d-DB5gfOh9.d.ts → computed.types.d-gJrBeUMG.d.ts} +1 -1
- package/dist/corrections.d.ts +9 -9
- package/dist/corrections.js +7 -7
- package/dist/elements.d.ts +46 -6
- package/dist/elements.js +5 -3
- package/dist/index.d.ts +12 -12
- package/dist/index.js +16 -12
- package/dist/{interaction.d-DegNJ5ZA.d.ts → interaction.d-g6XG0T0Z.d.ts} +2 -2
- package/dist/interactions.d.ts +4 -4
- package/dist/interactions.js +3 -3
- package/dist/item.d.ts +4 -4
- package/dist/item.js +3 -3
- package/dist/{item.types.d-BDFrq19E.d.ts → item.types.d-B55QkJ92.d.ts} +10 -0
- package/dist/loader.d.ts +2 -2
- package/dist/processing.d.ts +3 -3
- package/dist/processing.js +3 -3
- package/dist/qti-components-jsx.d.ts +353 -266
- package/dist/{qti-condition-expression.d-DLboq8bR.d.ts → qti-condition-expression.d-L7yb3Rzy.d.ts} +1 -1
- package/dist/{qti-expression.d-BksT9iLB.d.ts → qti-expression.d-CuaLjZ6g.d.ts} +1 -1
- package/dist/{qti-feedback.d-D-w6-mJv.d.ts → qti-feedback.d-wMYNVkkj.d.ts} +2 -3
- package/dist/{qti-item.d-D_-9_0e6.d.ts → qti-item.d-DgC1AQbY.d.ts} +1 -1
- package/dist/{qti-test.d-D-ELy0Mr.d.ts → qti-test.d-Cud5Gvy0.d.ts} +204 -42
- package/dist/{qti-text-entry-interaction.d-CATtcPyX.d.ts → qti-text-entry-interaction.d-DKvz9ncv.d.ts} +2 -2
- package/dist/{session.context.d-Cjs0BkJB.d.ts → session.context.d-D5080LVx.d.ts} +3 -1
- package/dist/test.d.ts +58 -11
- package/dist/test.js +6 -4
- package/package.json +4 -4
- package/dist/chunk-REKCRWJV.js.map +0 -1
- package/dist/chunk-TDWLV5OD.js.map +0 -1
- package/dist/chunk-YVZWNLF4.js.map +0 -1
- /package/dist/{chunk-G5RQ5GKG.js.map → chunk-3BAQWO5C.js.map} +0 -0
- /package/dist/{chunk-ZG7FBQFP.js.map → chunk-ACRN7YJM.js.map} +0 -0
- /package/dist/{chunk-JLZCZVRX.js.map → chunk-B5XHZI2P.js.map} +0 -0
- /package/dist/{chunk-RAJQKCQ3.js.map → chunk-B74SYQB2.js.map} +0 -0
- /package/dist/{chunk-YIYHCHHM.js.map → chunk-BMXG7D2N.js.map} +0 -0
- /package/dist/{chunk-FG5JAWSN.js.map → chunk-C3JPUV36.js.map} +0 -0
- /package/dist/{chunk-7VDR765S.js.map → chunk-JHPQJDAV.js.map} +0 -0
- /package/dist/{chunk-CQHGVPOT.js.map → chunk-LKHRHFXO.js.map} +0 -0
- /package/dist/{chunk-JGPWBIVD.js.map → chunk-MSGYZE6L.js.map} +0 -0
package/cdn/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var rc=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 zt=function(o,t,e,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!n:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(o,e):n?n.value=e:t.set(o,e),e},Z=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)},vr,wi,xi,un,pa,mn,qi,je,fn,ue,Ci,nc;var F={__proto__:null};F.enumerable=!0;Object.freeze(F);var ua=(ue=class{constructor(t,e={}){if(vr.set(this,!1),wi.set(this,!1),xi.set(this,!1),un.set(this,!1),pa.set(this,Date.now()),mn.set(this,!1),qi.set(this,void 0),je.set(this,void 0),fn.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:n,composed:i}=e;zt(this,vr,!!n,"f"),zt(this,wi,!!r,"f"),zt(this,xi,!!i,"f"),zt(this,qi,`${t}`,"f"),zt(this,je,null,"f"),zt(this,fn,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){zt(this,un,!0,"f")}get target(){return Z(this,je,"f")}get currentTarget(){return Z(this,je,"f")}get srcElement(){return Z(this,je,"f")}get type(){return Z(this,qi,"f")}get cancelable(){return Z(this,vr,"f")}get defaultPrevented(){return Z(this,vr,"f")&&Z(this,un,"f")}get timeStamp(){return Z(this,pa,"f")}composedPath(){return Z(this,fn,"f")?[Z(this,je,"f")]:[]}get returnValue(){return!Z(this,vr,"f")||!Z(this,un,"f")}get bubbles(){return Z(this,wi,"f")}get composed(){return Z(this,xi,"f")}get eventPhase(){return Z(this,fn,"f")?ue.AT_TARGET:ue.NONE}get cancelBubble(){return Z(this,mn,"f")}set cancelBubble(t){t&&zt(this,mn,!0,"f")}stopPropagation(){zt(this,mn,!0,"f")}get isTrusted(){return!1}},vr=new WeakMap,wi=new WeakMap,xi=new WeakMap,un=new WeakMap,pa=new WeakMap,mn=new WeakMap,qi=new WeakMap,je=new WeakMap,fn=new WeakMap,ue.NONE=0,ue.CAPTURING_PHASE=1,ue.AT_TARGET=2,ue.BUBBLING_PHASE=3,ue);Object.defineProperties(ua.prototype,{initEvent:F,stopImmediatePropagation:F,preventDefault:F,target:F,currentTarget:F,srcElement:F,type:F,cancelable:F,defaultPrevented:F,timeStamp:F,composedPath:F,returnValue:F,bubbles:F,composed:F,eventPhase:F,cancelBubble:F,stopPropagation:F,isTrusted:F});var ic=(nc=class extends ua{constructor(t,e={}){super(t,e),Ci.set(this,void 0),zt(this,Ci,e?.detail??null,"f")}initCustomEvent(t,e,r,n){throw new Error("Method not implemented.")}get detail(){return Z(this,Ci,"f")}},Ci=new WeakMap,nc);Object.defineProperties(ic.prototype,{detail:F});var Jt=ua,ma=ic;var nt;var ef=(nt=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}},nt.STYLE_RULE=1,nt.CHARSET_RULE=2,nt.IMPORT_RULE=3,nt.MEDIA_RULE=4,nt.FONT_FACE_RULE=5,nt.PAGE_RULE=6,nt.NAMESPACE_RULE=10,nt.KEYFRAMES_RULE=7,nt.KEYFRAME_RULE=8,nt.SUPPORTS_RULE=12,nt.COUNTER_STYLE_RULE=11,nt.FONT_FEATURE_VALUES_RULE=14,nt.MARGIN_RULE=9,nt);globalThis.Event??=Jt;globalThis.CustomEvent??=ma;var ga=Symbol(),oc=o=>typeof o=="boolean"?o:o?.capture??!1,Zt={__proto__:null};Zt.enumerable=!0;Object.freeze(Zt);var ki=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let n=oc(r)?this.__captureEventListeners:this.__eventListeners,i=n.get(t);if(i===void 0)i=new Map,n.set(t,i);else if(i.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),i.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let n=oc(r)?this.__captureEventListeners:this.__eventListeners,i=n.get(t);i!==void 0&&(i.delete(e),i.size||n.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,n=!1,i=Jt.NONE,s=null,a=null,c=null,l=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...Zt},srcElement:{get(){return t.target},...Zt},currentTarget:{get(){return c},...Zt},eventPhase:{get(){return i},...Zt},composedPath:{value:()=>e,...Zt},stopPropagation:{value:()=>{r=!0,l.call(t)},...Zt},stopImmediatePropagation:{value:()=>{n=!0,d.call(t)},...Zt}});let h=(u,g,y)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&y.delete(u)},f=()=>(c=null,i=Jt.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let v=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&v(m.slice(m.indexOf(u))),c=u,i=u===t.target?Jt.AT_TARGET:Jt.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),n)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&v(x.slice(0,x.indexOf(u)+1)),c=u,i=u===t.target?Jt.AT_TARGET:Jt.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),n)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,lc,kp]}};var sc=new WeakMap,gn=o=>{let t=sc.get(o);return t===void 0&&sc.set(o,t=new Map),t},bn=class extends ki{getRootNode(t){return t?.composed?fa:this.__host?.__shadowRoot??fa}};var ac=class extends bn{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var lc=new ac,fa=lc;var cc=class extends bn{constructor(t){if(super(),t!==ga)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Si,customElements:ya,document:fa,Document:ac,Element:dc,EventTarget:ki,HTMLElement:hc,Node:bn,ShadowRoot:pc,window:this,Window:cc})}};var dc=class extends bn{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(gn(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){gn(this).set(t,String(e))}removeAttribute(t){gn(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 gn(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new pc(ga,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 rc(this);return this.__internals=t,t}getAttribute(t){return gn(this).get(t)??null}};var hc=class extends dc{},ba=hc;var pc=class extends bn{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 ba,"localName",{get(){return"lit-server-root"}});function qp(){let o,t;return{promise:new Promise((r,n)=>{o=r,t=n}),resolve:o,reject:t}}var Si=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]`,
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),qc=/'/g,Cc=/"/g,Ec=/^(?:script|style|textarea|title)$/i,Sa=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),b=Sa(1),An=Sa(2),Df=Sa(3),et=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),kc=new WeakMap,Be=Ue.createTreeWalker(Ue,129);function Ac(o,t){if(!ka(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return vc!==void 0?vc.createHTML(t):t}var Ic=(o,t)=>{let e=o.length-1,r=[],n,i=t===2?"<svg>":t===3?"<math>":"",s=Cn;for(let a=0;a<e;a++){let c=o[a],l,d,h=-1,f=0;for(;f<c.length&&(s.lastIndex=f,d=s.exec(c),d!==null);)f=s.lastIndex,s===Cn?d[1]==="!--"?s=wc:d[1]!==void 0?s=xc:d[2]!==void 0?(Ec.test(d[2])&&(n=RegExp("</"+d[2],"g")),s=Fe):d[3]!==void 0&&(s=Fe):s===Fe?d[0]===">"?(s=n??Cn,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,l=d[1],s=d[3]===void 0?Fe:d[3]==='"'?Cc:qc):s===Cc||s===qc?s=Fe:s===wc||s===xc?s=Cn:(s=Fe,n=void 0);let m=s===Fe&&o[a+1].startsWith("/>")?" ":"";i+=s===Cn?c+Pp:h>=0?(r.push(l),c.slice(0,h)+qa+c.slice(h)+ee+m):c+ee+(h===-2?a:m)}return[Ac(o,i+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},En=class o{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,s=0,a=t.length-1,c=this.parts,[l,d]=Ic(t,e);if(this.el=o.createElement(l,r),Be.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(n=Be.nextNode())!==null&&c.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let h of n.getAttributeNames())if(h.endsWith(qa)){let f=d[s++],m=n.getAttribute(h).split(ee),v=/([.?@])?(.*)/.exec(f);c.push({type:1,index:i,name:v[2],strings:m,ctor:v[1]==="."?Ti:v[1]==="?"?Ri:v[1]==="@"?Oi:We}),n.removeAttribute(h)}else h.startsWith(ee)&&(c.push({type:6,index:i}),n.removeAttribute(h));if(Ec.test(n.tagName)){let h=n.textContent.split(ee),f=h.length-1;if(f>0){n.textContent=Ii?Ii.emptyScript:"";for(let m=0;m<f;m++)n.append(h[m],kn()),Be.nextNode(),c.push({type:2,index:++i});n.append(h[f],kn())}}}else if(n.nodeType===8)if(n.data===Ca)c.push({type:2,index:i});else{let h=-1;for(;(h=n.data.indexOf(ee,h+1))!==-1;)c.push({type:7,index:i}),h+=ee.length-1}i++}}static createElement(t,e){let r=Ue.createElement("template");return r.innerHTML=t,r}};function He(o,t,e=o,r){if(t===et)return t;let n=r!==void 0?e._$Co?.[r]:e._$Cl,i=Sn(t)?void 0:t._$litDirective$;return n?.constructor!==i&&(n?._$AO?.(!1),i===void 0?n=void 0:(n=new i(o),n._$AT(o,e,r)),r!==void 0?(e._$Co??=[])[r]=n:e._$Cl=n),n!==void 0&&(t=He(o,n._$AS(o,t.values),n,r)),t}var _i=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,n=(t?.creationScope??Ue).importNode(e,!0);Be.currentNode=n;let i=Be.nextNode(),s=0,a=0,c=r[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new wr(i,i.nextSibling,this,t):c.type===1?l=new c.ctor(i,c.name,c.strings,this,t):c.type===6&&(l=new Pi(i,this,t)),this._$AV.push(l),c=r[++a]}s!==c?.index&&(i=Be.nextNode(),s++)}return Be.currentNode=Ue,n}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++}},wr=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,n){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cv=n?.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=He(this,t,e),Sn(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==et&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Sc(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&&Sn(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ue.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,n=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=En.createElement(Ac(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{let i=new _i(n,this),s=i.u(this.options);i.p(e),this.T(s),this._$AH=i}}_$AC(t){let e=kc.get(t.strings);return e===void 0&&kc.set(t.strings,e=new En(t)),e}k(t){ka(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,n=0;for(let i of t)n===e.length?e.push(r=new o(this.O(kn()),this.O(kn()),this,this.options)):r=e[n],r._$AI(i),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=yc(t).nextSibling;yc(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},We=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,i){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,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,n){let i=this.strings,s=!1;if(i===void 0)t=He(this,t,e,0),s=!Sn(t)||t!==this._$AH&&t!==et,s&&(this._$AH=t);else{let a=t,c,l;for(t=i[0],c=0;c<i.length-1;c++)l=He(this,a[r+c],e,c),l===et&&(l=this._$AH[c]),s||=!Sn(l)||l!==this._$AH[c],l===P?t=P:t!==P&&(t+=(l??"")+i[c+1]),this._$AH[c]=l}s&&!n&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Ti=class extends We{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Ri=class extends We{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Oi=class extends We{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){if((t=He(this,t,e,0)??P)===et)return;let r=this._$AH,n=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==P&&(r===P||n);n&&this.element.removeEventListener(this.name,this,r),i&&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)}},Pi=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){He(this,t)}},tt={M:qa,P:ee,A:Ca,C:1,L:Ic,R:_i,D:Sc,V:He,I:wr,H:We,N:Ri,U:Oi,B:Ti,F:Pi},Mp=Mi.litHtmlPolyfillSupport;Mp?.(En,wr),(Mi.litHtmlVersions??=[]).push("3.3.3");var Ea=(o,t,e)=>{let r=e?.renderBefore??t,n=r._$litPart$;if(n===void 0){let i=e?.renderBefore??null;r._$litPart$=n=new wr(t.insertBefore(kn(),i),i,void 0,e??{})}return n._$AI(o),n};var Aa=globalThis,C=class extends te{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=Ea(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return et}};C._$litElement$=!0,C.finalized=!0,Aa.litElementHydrateSupport?.({LitElement:C});var Dp=Aa.litElementPolyfillSupport;Dp?.({LitElement:C});(Aa.litElementVersions??=[]).push("4.2.2");var Np={attribute:!0,type:String,converter:xn,reflect:!1,hasChanged:Ai},$p=(o=Np,t,e)=>{let{kind:r,metadata:n}=e,i=globalThis.litPropertyMetadata.get(n);if(i===void 0&&globalThis.litPropertyMetadata.set(n,i=new Map),r==="setter"&&((o=Object.create(o)).wrapped=!0),i.set(e.name,o),r==="accessor"){let{name:s}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,c,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let c=this[s];t.call(this,a),this.requestUpdate(s,c,o,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(o){return(t,e)=>typeof e=="object"?$p(o,t,e):((r,n,i)=>{let s=n.hasOwnProperty(i);return n.constructor.createProperty(i,r),s?Object.getOwnPropertyDescriptor(n,i):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var me=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function xr(o,t){return(e,r,n)=>{let i=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:n??(()=>{let c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return me(e,r,{get(){let c=s.call(this);return c===void 0&&(c=i(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return me(e,r,{get(){return i(this)}})}}function _c(o){return(t,e)=>{let{slot:r,selector:n}=o??{},i="slot"+(r?`[name=${r}]`:":not([name])");return me(t,e,{get(){let s=this.renderRoot?.querySelector(i),a=s?.assignedElements(o)??[];return n===void 0?a:a.filter(c=>c.matches(n))}})}}var fe=class extends Event{constructor(t,e,r,n){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=n??!1}};var qr=class{constructor(t,e,r,n){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(i,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=i,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(i,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let i=e;this.context=i.context,this.callback=i.callback,this.subscribe=i.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=n??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new fe(this.context,this.host,this.t,this.subscribe))}};var Di=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:n}=this.subscriptions.get(t);t(this.value,n)}clearCallbacks(){this.subscriptions.clear()}};var Ia=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},Cr=class extends Di{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=n=>{if(n.context!==this.context)return;let i=n.contextTarget??n.composedPath()[0];i!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,i,n.subscribe))},this.onProviderRequest=n=>{if(n.context!==this.context||(n.contextTarget??n.composedPath()[0])===this.host)return;let i=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)i.has(s)||(i.add(s),a.dispatchEvent(new fe(this.context,a,s,!0)));n.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 Ia(this.context,this.host))}};function B({context:o}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(n){return r.get(this).setValue(n),t.set.call(this,n)},init(n){return r.set(this,new Cr(this,{context:o,initialValue:n})),n}};{t.constructor.addInitializer((s=>{r.set(s,new Cr(s,{context:o}))}));let n=Object.getOwnPropertyDescriptor(t,e),i;if(n===void 0){let s=new WeakMap;i={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=n.set;i={...n,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,i)}}}function _({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new qr(this,{context:o,callback:n=>{e.set.call(this,n)},subscribe:t})})):e.constructor.addInitializer((n=>{new qr(n,{context:o,callback:i=>{n[r]=i},subscribe:t})}))}}var Ni=["this"],Tc=["+","-","!"],Rc=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],_a={"!":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},$i=13;var Lp=["==","!=","<=",">=","||","&&","??","|>"],Vp=["===","!=="],M;(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"})(M||(M={}));var Ft=(o,t,e=0)=>({kind:o,value:t,precedence:e}),zp=o=>o===9||o===10||o===13||o===32,Oc=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),jp=o=>Oc(o)||In(o),Fp=o=>Ni.indexOf(o)!==-1,Bp=o=>o===34||o===39,In=o=>48<=o&&o<=57,Up=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,Hp=o=>o===40||o===41||o===91||o===93||o===123||o===125,Wp=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}}),Li=class{#t;#e=-1;#r=0;#n;constructor(t){this.#t=t,this.#i()}nextToken(){for(;zp(this.#n);)this.#i(!0);if(Bp(this.#n))return this.#a();if(Oc(this.#n))return this.#l();if(In(this.#n))return this.#h();if(this.#n===46)return this.#c();if(this.#n===44)return this.#d();if(this.#n===58)return this.#p();if(Up(this.#n))return this.#m();if(Hp(this.#n))return this.#g();if(this.#i(),this.#n!==void 0)throw new Error(`Expected end of input, got ${this.#n}`)}#i(t){this.#e++,this.#e<this.#t.length?(this.#n=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#n=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.#n;for(this.#i(!0);this.#n!==e;){if(this.#n===void 0)throw new Error(t);if(this.#n===92&&(this.#i(),this.#n===void 0))throw new Error(t);this.#i()}let r=Ft(M.STRING,Wp(this.#o()));return this.#i(),r}#l(){do this.#i();while(jp(this.#n));let t=this.#o(),e=Fp(t)?M.KEYWORD:M.IDENTIFIER;return Ft(e,t)}#h(){do this.#i();while(In(this.#n));return this.#n===46?this.#c():Ft(M.INTEGER,this.#o())}#c(){return this.#i(),In(this.#n)?this.#u():(this.#s(),Ft(M.DOT,".",$i))}#d(){return this.#i(!0),Ft(M.COMMA,",")}#p(){return this.#i(!0),Ft(M.COLON,":")}#u(){do this.#i();while(In(this.#n));return Ft(M.DECIMAL,this.#o())}#m(){this.#i();let t=this.#o(2);if(Vp.indexOf(t)!==-1)this.#i(),this.#i();else{if(t=this.#o(1),t==="=>")return this.#i(),Ft(M.ARROW,t);Lp.indexOf(t)!==-1&&this.#i()}return t=this.#o(),Ft(M.OPERATOR,t,_a[t])}#g(){let t=String.fromCharCode(this.#n),e=Ft(M.GROUPER,t,_a[t]);return this.#i(!0),e}};var Ta=(o,t)=>new _n(o,t).parse(),_n=class{#t;#e;#r;#n;#i;constructor(t,e){this.#e=new Li(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.#n?.kind} (${this.#n?.value})`);let r=this.#e.nextToken();this.#n=r,this.#t=r?.kind,this.#i=r?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#i!==e)}#s(){if(!this.#n)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.#n;)if(this._matches(M.GROUPER,"(")){let r=this.#y();t=this.#r.invoke(t,void 0,r)}else if(this._matches(M.GROUPER,"[")){let r=this.#C();t=this.#r.index(t,r)}else if(this._matches(M.DOT)){this.#o();let r=this.#c();t=this.#l(t,r)}else{if(this._matches(M.KEYWORD))break;if(this._matches(M.OPERATOR)&&this.#n.precedence>=e)t=this.#i==="?"?this.#d(t):this.#h(t,this.#n);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}`)}#h(t,e){if(Rc.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#c();for(;(this.#t===M.OPERATOR||this.#t===M.DOT||this.#t===M.GROUPER)&&this.#n.precedence>e.precedence;)r=this.#a(r,this.#n.precedence);return this.#r.binary(t,e.value,r)}#c(){if(this._matches(M.OPERATOR)){let t=this.#i;if(this.#o(),t==="+"||t==="-"){if(this._matches(M.INTEGER))return this.#v(t);if(this._matches(M.DECIMAL))return this.#x(t)}if(Tc.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#p(),$i);return this.#r.unary(t,e)}return this.#p()}#d(t){this.#o(M.OPERATOR,"?");let e=this.#s();this.#o(M.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#p(){switch(this.#t){case M.KEYWORD:let t=this.#i;if(t==="this")return this.#o(),this.#r.id(t);throw Ni.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case M.IDENTIFIER:return this.#g();case M.STRING:return this.#b();case M.INTEGER:return this.#v();case M.DECIMAL:return this.#x();case M.GROUPER:return this.#i==="("?this.#k():this.#i==="{"?this.#m():this.#i==="["?this.#u():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#u(){let t=[];do{if(this.#o(),this._matches(M.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"]"),this.#r.list(t)}#m(){let t={};do{if(this.#o(),this._matches(M.GROUPER,"}"))break;let e=this.#i;(this._matches(M.STRING)||this._matches(M.IDENTIFIER))&&this.#o(),this.#o(M.COLON),t[e]=this.#s()}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"}"),this.#r.map(t)}#g(){let t=this.#i;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.#f(),r=this.#y();return r?this.#r.invoke(e,void 0,r):e}#f(){if(!this._matches(M.IDENTIFIER))throw new Error(`expected identifier: ${this.#i}`);let t=this.#i;return this.#o(),this.#r.id(t)}#y(){if(!this._matches(M.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(M.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(M.COMMA));return this.#o(M.GROUPER,")"),t}#C(){this.#o();let t=this.#s();return this.#o(M.GROUPER,"]"),t}#k(){let t=this.#y();if(this._matches(M.ARROW)){this.#o();let e=this.#s(),r=t?.map(n=>n.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#b(){let t=this.#r.literal(this.#i);return this.#o(),t}#v(t=""){let e=this.#r.literal(parseInt(`${t}${this.#i}`,10));return this.#o(),e}#x(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#i}`));return this.#o(),e}};var{hasOwn:Pc,fromEntries:Qp}=Object,Gp={"+":(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)},Xp={"+":o=>o,"-":o=>-o,"!":o=>!o},Vi=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=Xp[t];return{type:"Unary",operator:t,child:e,evaluate(n){return r(this.child.evaluate(n))},getIds(n){return this.child.getIds(n)}}}binary(t,e,r){let n=Gp[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(i){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(i),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(i),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(i),c=this.left.argument.evaluate(i)):this.left.type==="ID"&&(a=i,c=this.left.value),a===void 0?void 0:a[c]=s}return n(this.left.evaluate(i),this.right.evaluate(i))},getIds(i){return this.left.getIds(i),this.right.getIds(i),i}}}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(n){let i=this.receiver.evaluate(n),s=this.method?i:n?.this??n,a=this.method?i?.[e]:i,l=(this.arguments??[]).map(d=>d?.evaluate(n));return a?.apply?.(s,l)},getIds(n){return this.receiver.getIds(n),this.arguments?.forEach(i=>i?.getIds(n)),n}}}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(n){return this.condition.evaluate(n)?this.trueExpr.evaluate(n):this.falseExpr.evaluate(n)},getIds(n){return this.condition.getIds(n),this.trueExpr.getIds(n),this.falseExpr.getIds(n),n}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let n in t){let i=this.entries[n];i&&(r[n]=i.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let n=this.entries[r];n&&n.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 n=this.params,i=this.body;return function(...s){let a=Qp(n.map((l,d)=>[l,s[d]])),c=new Proxy(r??{},{set(l,d,h){return Pc(a,d)&&(a[d]=h),l[d]=h},get(l,d){return Pc(a,d)?a[d]:l[d]}});return i.evaluate(c)}},getIds(r){return this.body.getIds(r).filter(n=>!this.params.includes(n))}}}};var Ra=null,Mc={boundAttributeSuffix:tt.M,marker:tt.P,markerMatch:tt.A,HTML_RESULT:tt.C,getTemplateHtml:tt.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){Ra??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Ra))return void(e[Ra]=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=et;return o.j=n=>r=n,o._$AI(t,o,e),r},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:tt.V,AttributePart:tt.H,PropertyPart:tt.B,BooleanAttributePart:tt.N,EventPart:tt.U,ElementPart:tt.F,TemplateInstance:tt.R,isIterable:tt.D,ChildPart:tt.I};var{AttributePart:Yp,PropertyPart:Kp,BooleanAttributePart:Jp,EventPart:Zp}=Mc,Pa=new Vi,Oa=new Map,Dc=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),zi=(o,t)=>{let e=Oa.get(o);if(e===void 0){if(Oa.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new _n(r,Pa).parse(),Oa.set(o,e)}}return e?.evaluate(t)},tu=(o,t,e,r)=>{let n=o.getAttribute("if");if(n!==null&&zi(n,t))return ji(o,t,e,r)},Nc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,$c=o=>/(?:\\{{)|(?:\\}})/g.test(o),Tn=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),eu=(o,t,e,r)=>{let n=o.getAttribute("repeat");if(n!==null){let i=zi(n,t);if(!i[Symbol.iterator])return P;let s=Rn(o),a=-1,c=[];for(let l of i){a++;let d=Object.create(t);d.item=l,d.index=a,d.this=t.this??t;let h=[];for(let m of s.parts){let v=m.update(d,e,r);m.type===1?h.push(...v):h.push(v)}let f={_$litType$:s,values:h};c.push(f)}return c}},Vc={if:tu,repeat:eu},bt=(o,t=Vc,e={},r)=>{let i=Rn(o).renderers;if(r){let a=Rn(r).renderers,c=i.super;c!==void 0?e={...i,...e,super:(l,d,h)=>(h={...a,...h,super:(f,m,v)=>ji(r,f,m,v)},c(l,d,h))}:(e={...a,...i,...e},o=r)}else e={...i,...e};return s=>ji(o,s,t,e)};var ji=(o,t,e=Vc,r={})=>{let n=Rn(o),i=[];for(let a of n.parts){let c=a.update(t,e,r);a.type===1?i.push(...c):i.push(c)}return{_$litType$:n,values:i}},Lc=new Map,Rn=o=>{let t=Lc.get(o);return t===void 0&&Lc.set(o,t=ru(o)),t},ru=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,n=-1,i=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)n++;else if(r.nodeType===Node.ELEMENT_NODE){n++;let s=r;if(s.tagName==="TEMPLATE"){let c=s.getAttribute("type"),l=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||c!==null||l!==null){s.parentNode.insertBefore(document.createComment(""),s),i.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(v,x,u)=>{let g=s.getAttribute("data"),y=g===null?void 0:zi(g,v);return(m?zi(f,v):u[d])?.(y,x,u)}}else c!==null?h=(f,m,v)=>{let x=m[c];return x?.(s,f,m,v)}:(l==="super"?t.renderers.super=(f,m,v)=>{let x=v.super,u=Rn(s);return v={...v,...u.renderers},x(f,m,v)}:t.renderers[l]=(f,m,v)=>ji(s,f,m,v),h=(f,m,v)=>{let x=v[l];return x?.(f,m,v)});t.parts.push({type:2,index:n,update:h});continue}}let a=s.getAttributeNames();for(let c of a){let l=s.getAttribute(c),d=l.split(Nc);if(d.length===1){$c(l)&&s.setAttribute(c,Tn(l));continue}s.removeAttribute(c);let h=c,f=Yp,m=c[0];m==="."?(h=Dc(c.substring(1)),f=Kp):m==="?"?(h=c.substring(1),f=Jp):m==="@"&&(h=Dc(c.substring(1)),f=Zp);let v=[Tn(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(Ta(g,Pa)),v.push(Tn(d[u+1]))}t.parts.push({type:1,index:n,name:h,strings:v,ctor:f,update:(u,g,y)=>x.map(w=>w.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,c=a.split(Nc);c.length>1?s.textContent=Tn(c[0]):$c(a)&&(s.textContent=Tn(a));for(let l=1;l<c.length;l+=2){let d=c[l],h=Ta(d,Pa);t.parts.push({type:2,index:++n,update:(m,v)=>h.evaluate(m)});let f=new Text(c[l+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of i)s.remove();return t};var zc=[];var Da=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(" "))}},Ma="custom-state-support-probe";function nu(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(Ma)||customElements.define(Ma,class extends HTMLElement{});let t=o.call(document.createElement(Ma)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var jc=!1;function Fc(){if(jc)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=nu(o);return t==="modern"||(jc=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new Da(this)}),r}),t}Fc();for(let{tag:o,ctor:t}of zc)customElements.get(o)||customElements.define(o,t);var ge=Symbol("computedItemContext");var z=Symbol("computedContext");var yt=Symbol("configContext");var kr=Symbol("interactionContext");var j=Symbol("item");var Bc=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var iu=/^[A-Za-z0-9-]+$/,ou=o=>typeof o=="string"&&iu.test(o),Eb=o=>ou(o)?o:void 0,vt=Symbol("qtiContext");var Na={view:"candidate"},Bt=Symbol("testContext");var $a={items:[],testOutcomeVariables:[]},st=Symbol("testContext");var O=q`
|
|
1
|
+
var lc=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,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!n:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(o,e):n?n.value=e:t.set(o,e),e},Z=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)},qr,qn,Cn,pi,ga,ui,Sn,He,mi,fe,kn,cc;var F={__proto__:null};F.enumerable=!0;Object.freeze(F);var ba=(fe=class{constructor(t,e={}){if(qr.set(this,!1),qn.set(this,!1),Cn.set(this,!1),pi.set(this,!1),ga.set(this,Date.now()),ui.set(this,!1),Sn.set(this,void 0),He.set(this,void 0),mi.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:n,composed:i}=e;Bt(this,qr,!!n,"f"),Bt(this,qn,!!r,"f"),Bt(this,Cn,!!i,"f"),Bt(this,Sn,`${t}`,"f"),Bt(this,He,null,"f"),Bt(this,mi,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Bt(this,pi,!0,"f")}get target(){return Z(this,He,"f")}get currentTarget(){return Z(this,He,"f")}get srcElement(){return Z(this,He,"f")}get type(){return Z(this,Sn,"f")}get cancelable(){return Z(this,qr,"f")}get defaultPrevented(){return Z(this,qr,"f")&&Z(this,pi,"f")}get timeStamp(){return Z(this,ga,"f")}composedPath(){return Z(this,mi,"f")?[Z(this,He,"f")]:[]}get returnValue(){return!Z(this,qr,"f")||!Z(this,pi,"f")}get bubbles(){return Z(this,qn,"f")}get composed(){return Z(this,Cn,"f")}get eventPhase(){return Z(this,mi,"f")?fe.AT_TARGET:fe.NONE}get cancelBubble(){return Z(this,ui,"f")}set cancelBubble(t){t&&Bt(this,ui,!0,"f")}stopPropagation(){Bt(this,ui,!0,"f")}get isTrusted(){return!1}},qr=new WeakMap,qn=new WeakMap,Cn=new WeakMap,pi=new WeakMap,ga=new WeakMap,ui=new WeakMap,Sn=new WeakMap,He=new WeakMap,mi=new WeakMap,fe.NONE=0,fe.CAPTURING_PHASE=1,fe.AT_TARGET=2,fe.BUBBLING_PHASE=3,fe);Object.defineProperties(ba.prototype,{initEvent:F,stopImmediatePropagation:F,preventDefault:F,target:F,currentTarget:F,srcElement:F,type:F,cancelable:F,defaultPrevented:F,timeStamp:F,composedPath:F,returnValue:F,bubbles:F,composed:F,eventPhase:F,cancelBubble:F,stopPropagation:F,isTrusted:F});var dc=(cc=class extends ba{constructor(t,e={}){super(t,e),kn.set(this,void 0),Bt(this,kn,e?.detail??null,"f")}initCustomEvent(t,e,r,n){throw new Error("Method not implemented.")}get detail(){return Z(this,kn,"f")}},kn=new WeakMap,cc);Object.defineProperties(dc.prototype,{detail:F});var te=ba,ya=dc;var it;var ff=(it=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}},it.STYLE_RULE=1,it.CHARSET_RULE=2,it.IMPORT_RULE=3,it.MEDIA_RULE=4,it.FONT_FACE_RULE=5,it.PAGE_RULE=6,it.NAMESPACE_RULE=10,it.KEYFRAMES_RULE=7,it.KEYFRAME_RULE=8,it.SUPPORTS_RULE=12,it.COUNTER_STYLE_RULE=11,it.FONT_FEATURE_VALUES_RULE=14,it.MARGIN_RULE=9,it);globalThis.Event??=te;globalThis.CustomEvent??=ya;var wa=Symbol(),hc=o=>typeof o=="boolean"?o:o?.capture??!1,ee={__proto__:null};ee.enumerable=!0;Object.freeze(ee);var En=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let n=hc(r)?this.__captureEventListeners:this.__eventListeners,i=n.get(t);if(i===void 0)i=new Map,n.set(t,i);else if(i.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),i.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let n=hc(r)?this.__captureEventListeners:this.__eventListeners,i=n.get(t);i!==void 0&&(i.delete(e),i.size||n.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,n=!1,i=te.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...ee},srcElement:{get(){return t.target},...ee},currentTarget:{get(){return l},...ee},eventPhase:{get(){return i},...ee},composedPath:{value:()=>e,...ee},stopPropagation:{value:()=>{r=!0,c.call(t)},...ee},stopImmediatePropagation:{value:()=>{n=!0,d.call(t)},...ee}});let h=(u,g,y)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&y.delete(u)},f=()=>(l=null,i=te.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let v=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&v(m.slice(m.indexOf(u))),l=u,i=u===t.target?te.AT_TARGET:te.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),n)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&v(x.slice(0,x.indexOf(u)+1)),l=u,i=u===t.target?te.AT_TARGET:te.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[y,w]of g)if(h(y,w,g),n)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,mc,Pp]}};var pc=new WeakMap,fi=o=>{let t=pc.get(o);return t===void 0&&pc.set(o,t=new Map),t},gi=class extends En{getRootNode(t){return t?.composed?va:this.__host?.__shadowRoot??va}};var uc=class extends gi{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var mc=new uc,va=mc;var fc=class extends gi{constructor(t){if(super(),t!==wa)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:An,customElements:qa,document:va,Document:uc,Element:gc,EventTarget:En,HTMLElement:bc,Node:gi,ShadowRoot:yc,window:this,Window:fc})}};var gc=class extends gi{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(fi(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){fi(this).set(t,String(e))}removeAttribute(t){fi(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 fi(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new yc(wa,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 lc(this);return this.__internals=t,t}getAttribute(t){return fi(this).get(t)??null}};var bc=class extends gc{},xa=bc;var yc=class extends gi{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 xa,"localName",{get(){return"lit-server-root"}});function Rp(){let o,t;return{promise:new Promise((r,n)=>{o=r,t=n}),resolve:o,reject:t}}var An=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=Rp(),this.__pendingWhenDefineds.set(t,r)),r.promise}},Op=An;var qa=new Op,Pp=new fc(wa);var bi=globalThis,In=bi.ShadowRoot&&(bi.ShadyCSS===void 0||bi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ca=Symbol(),vc=new WeakMap,yi=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Ca)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(In&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=vc.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&vc.set(e,t))}return t}toString(){return this.cssText}},wc=o=>new yi(typeof o=="string"?o:o+"",void 0,Ca),q=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,n,i)=>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.")})(n)+o[i+1],o[0]);return new yi(e,o,Ca)},xc=(o,t)=>{if(In)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),n=bi.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=e.cssText,o.appendChild(r)}},Sa=In||bi.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return wc(e)})(o):o;var{is:Mp,defineProperty:Dp,getOwnPropertyDescriptor:Np,getOwnPropertyNames:$p,getOwnPropertySymbols:Lp,getPrototypeOf:Vp}=Object,xi=globalThis;xi.customElements??=qa;var qc=xi.trustedTypes,zp=qc?qc.emptyScript:"",jp=xi.reactiveElementPolyfillSupport,vi=(o,t)=>o,wi={toAttribute(o,t){switch(t){case Boolean:o=o?zp: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}},_n=(o,t)=>!Mp(o,t),Cc={attribute:!0,type:String,converter:wi,reflect:!1,useDefault:!1,hasChanged:_n};Symbol.metadata??=Symbol("metadata"),xi.litPropertyMetadata??=new WeakMap;var re=class extends(globalThis.HTMLElement??xa){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Cc){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(),n=this.getPropertyDescriptor(t,r,e);n!==void 0&&Dp(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){let{get:n,set:i}=Np(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:n,set(s){let a=n?.call(this);i?.call(this,s),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Cc}static _$Ei(){if(this.hasOwnProperty(vi("elementProperties")))return;let t=Vp(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(vi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(vi("properties"))){let e=this.properties,r=[...$p(e),...Lp(e)];for(let n of r)this.createProperty(n,e[n])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,n]of e)this.elementProperties.set(r,n)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let n=this._$Eu(e,r);n!==void 0&&this._$Eh.set(n,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 n of r)e.unshift(Sa(n))}else t!==void 0&&e.push(Sa(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 xc(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),n=this.constructor._$Eu(t,r);if(n!==void 0&&r.reflect===!0){let i=(r.converter?.toAttribute!==void 0?r.converter:wi).toAttribute(e,r.type);this._$Em=t,i==null?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(t,e){let r=this.constructor,n=r._$Eh.get(t);if(n!==void 0&&this._$Em!==n){let i=r.getPropertyOptions(n),s=typeof i.converter=="function"?{fromAttribute:i.converter}:i.converter?.fromAttribute!==void 0?i.converter:wi;this._$Em=n;let a=s.fromAttribute(e,i.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(t,e,r,n=!1,i){if(t!==void 0){let s=this.constructor;if(n===!1&&(i=this[t]),r??=s.getPropertyOptions(t),!((r.hasChanged??_n)(i,e)||r.useDefault&&r.reflect&&i===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:n,wrapped:i},s){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),i!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),n===!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[n,i]of this._$Ep)this[n]=i;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[n,i]of r){let{wrapped:s}=i,a=this[n];s!==!0||this._$AL.has(n)||a===void 0||this.C(n,void 0,i,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){}};re.elementStyles=[],re.shadowRootOptions={mode:"open"},re[vi("elementProperties")]=new Map,re[vi("finalized")]=new Map,jp?.({ReactiveElement:re}),(xi.reactiveElementVersions??=[]).push("2.1.2");var Nn=globalThis,Sc=o=>o,Tn=Nn.trustedTypes,kc=Tn?Tn.createPolicy("lit-html",{createHTML:o=>o}):void 0,Ea="$lit$",ie=`lit$${Math.random().toFixed(9).slice(2)}$`,Aa="?"+ie,Fp=`<${Aa}>`,Ge=Nn.document===void 0?{createTreeWalker:()=>({})}:document,Ci=()=>Ge.createComment(""),Si=o=>o===null||typeof o!="object"&&typeof o!="function",Ia=Array.isArray,Rc=o=>Ia(o)||typeof o?.[Symbol.iterator]=="function",ka=`[
|
|
3
|
+
\f\r]`,qi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ec=/-->/g,Ac=/>/g,We=RegExp(`>|${ka}(?:([^\\s"'>=/]+)(${ka}*=${ka}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ic=/'/g,_c=/"/g,Oc=/^(?:script|style|textarea|title)$/i,_a=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),b=_a(1),Ei=_a(2),Gf=_a(3),et=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Tc=new WeakMap,Qe=Ge.createTreeWalker(Ge,129);function Pc(o,t){if(!Ia(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return kc!==void 0?kc.createHTML(t):t}var Mc=(o,t)=>{let e=o.length-1,r=[],n,i=t===2?"<svg>":t===3?"<math>":"",s=qi;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===qi?d[1]==="!--"?s=Ec:d[1]!==void 0?s=Ac:d[2]!==void 0?(Oc.test(d[2])&&(n=RegExp("</"+d[2],"g")),s=We):d[3]!==void 0&&(s=We):s===We?d[0]===">"?(s=n??qi,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?We:d[3]==='"'?_c:Ic):s===_c||s===Ic?s=We:s===Ec||s===Ac?s=qi:(s=We,n=void 0);let m=s===We&&o[a+1].startsWith("/>")?" ":"";i+=s===qi?l+Fp:h>=0?(r.push(c),l.slice(0,h)+Ea+l.slice(h)+ie+m):l+ie+(h===-2?a:m)}return[Pc(o,i+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},ki=class o{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,s=0,a=t.length-1,l=this.parts,[c,d]=Mc(t,e);if(this.el=o.createElement(c,r),Qe.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(n=Qe.nextNode())!==null&&l.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let h of n.getAttributeNames())if(h.endsWith(Ea)){let f=d[s++],m=n.getAttribute(h).split(ie),v=/([.?@])?(.*)/.exec(f);l.push({type:1,index:i,name:v[2],strings:m,ctor:v[1]==="."?On:v[1]==="?"?Pn:v[1]==="@"?Mn:Ye}),n.removeAttribute(h)}else h.startsWith(ie)&&(l.push({type:6,index:i}),n.removeAttribute(h));if(Oc.test(n.tagName)){let h=n.textContent.split(ie),f=h.length-1;if(f>0){n.textContent=Tn?Tn.emptyScript:"";for(let m=0;m<f;m++)n.append(h[m],Ci()),Qe.nextNode(),l.push({type:2,index:++i});n.append(h[f],Ci())}}}else if(n.nodeType===8)if(n.data===Aa)l.push({type:2,index:i});else{let h=-1;for(;(h=n.data.indexOf(ie,h+1))!==-1;)l.push({type:7,index:i}),h+=ie.length-1}i++}}static createElement(t,e){let r=Ge.createElement("template");return r.innerHTML=t,r}};function Xe(o,t,e=o,r){if(t===et)return t;let n=r!==void 0?e._$Co?.[r]:e._$Cl,i=Si(t)?void 0:t._$litDirective$;return n?.constructor!==i&&(n?._$AO?.(!1),i===void 0?n=void 0:(n=new i(o),n._$AT(o,e,r)),r!==void 0?(e._$Co??=[])[r]=n:e._$Cl=n),n!==void 0&&(t=Xe(o,n._$AS(o,t.values),n,r)),t}var Rn=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,n=(t?.creationScope??Ge).importNode(e,!0);Qe.currentNode=n;let i=Qe.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new Cr(i,i.nextSibling,this,t):l.type===1?c=new l.ctor(i,l.name,l.strings,this,t):l.type===6&&(c=new Dn(i,this,t)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(i=Qe.nextNode(),s++)}return Qe.currentNode=Ge,n}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++}},Cr=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,n){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this._$Cv=n?.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=Xe(this,t,e),Si(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==et&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Rc(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&&Si(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ge.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,n=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=ki.createElement(Pc(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{let i=new Rn(n,this),s=i.u(this.options);i.p(e),this.T(s),this._$AH=i}}_$AC(t){let e=Tc.get(t.strings);return e===void 0&&Tc.set(t.strings,e=new ki(t)),e}k(t){Ia(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,n=0;for(let i of t)n===e.length?e.push(r=new o(this.O(Ci()),this.O(Ci()),this,this.options)):r=e[n],r._$AI(i),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=Sc(t).nextSibling;Sc(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Ye=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,i){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,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,n){let i=this.strings,s=!1;if(i===void 0)t=Xe(this,t,e,0),s=!Si(t)||t!==this._$AH&&t!==et,s&&(this._$AH=t);else{let a=t,l,c;for(t=i[0],l=0;l<i.length-1;l++)c=Xe(this,a[r+l],e,l),c===et&&(c=this._$AH[l]),s||=!Si(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+i[l+1]),this._$AH[l]=c}s&&!n&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},On=class extends Ye{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Pn=class extends Ye{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Mn=class extends Ye{constructor(t,e,r,n,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){if((t=Xe(this,t,e,0)??P)===et)return;let r=this._$AH,n=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==P&&(r===P||n);n&&this.element.removeEventListener(this.name,this,r),i&&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)}},Dn=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){Xe(this,t)}},tt={M:Ea,P:ie,A:Aa,C:1,L:Mc,R:Rn,D:Rc,V:Xe,I:Cr,H:Ye,N:Pn,U:Mn,B:On,F:Dn},Bp=Nn.litHtmlPolyfillSupport;Bp?.(ki,Cr),(Nn.litHtmlVersions??=[]).push("3.3.3");var Ta=(o,t,e)=>{let r=e?.renderBefore??t,n=r._$litPart$;if(n===void 0){let i=e?.renderBefore??null;r._$litPart$=n=new Cr(t.insertBefore(Ci(),i),i,void 0,e??{})}return n._$AI(o),n};var Ra=globalThis,C=class extends re{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=Ta(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return et}};C._$litElement$=!0,C.finalized=!0,Ra.litElementHydrateSupport?.({LitElement:C});var Up=Ra.litElementPolyfillSupport;Up?.({LitElement:C});(Ra.litElementVersions??=[]).push("4.2.2");var Hp={attribute:!0,type:String,converter:wi,reflect:!1,hasChanged:_n},Wp=(o=Hp,t,e)=>{let{kind:r,metadata:n}=e,i=globalThis.litPropertyMetadata.get(n);if(i===void 0&&globalThis.litPropertyMetadata.set(n,i=new Map),r==="setter"&&((o=Object.create(o)).wrapped=!0),i.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"?Wp(o,t,e):((r,n,i)=>{let s=n.hasOwnProperty(i);return n.constructor.createProperty(i,r),s?Object.getOwnPropertyDescriptor(n,i):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var ge=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function Sr(o,t){return(e,r,n)=>{let i=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:n??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return ge(e,r,{get(){let l=s.call(this);return l===void 0&&(l=i(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return ge(e,r,{get(){return i(this)}})}}function Dc(o){return(t,e)=>{let{slot:r,selector:n}=o??{},i="slot"+(r?`[name=${r}]`:":not([name])");return ge(t,e,{get(){let s=this.renderRoot?.querySelector(i),a=s?.assignedElements(o)??[];return n===void 0?a:a.filter(l=>l.matches(n))}})}}var ne=class extends Event{constructor(t,e,r,n){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=n??!1}};var bt=class{constructor(t,e,r,n){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(i,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=i,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(i,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let i=e;this.context=i.context,this.callback=i.callback,this.subscribe=i.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=n??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ne(this.context,this.host,this.t,this.subscribe))}};var $n=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:n}=this.subscriptions.get(t);t(this.value,n)}clearCallbacks(){this.subscriptions.clear()}};var Oa=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},be=class extends $n{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=n=>{if(n.context!==this.context)return;let i=n.contextTarget??n.composedPath()[0];i!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,i,n.subscribe))},this.onProviderRequest=n=>{if(n.context!==this.context||(n.contextTarget??n.composedPath()[0])===this.host)return;let i=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)i.has(s)||(i.add(s),a.dispatchEvent(new ne(this.context,a,s,!0)));n.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 Oa(this.context,this.host))}};var Ai=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:n,callbackRef:i}of r){let s=n.deref(),a=i.deref();s===void 0||a===void 0||s.dispatchEvent(new ne(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],r=t.callback,n=this.pendingContextRequests.get(t.context);n===void 0&&this.pendingContextRequests.set(t.context,n={callbacks:new WeakMap,requests:[]});let i=n.callbacks.get(e);i===void 0&&n.callbacks.set(e,i=new WeakSet),i.has(r)||(i.add(r),n.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 B({context:o}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(n){return r.get(this).setValue(n),t.set.call(this,n)},init(n){return r.set(this,new be(this,{context:o,initialValue:n})),n}};{t.constructor.addInitializer((s=>{r.set(s,new be(s,{context:o}))}));let n=Object.getOwnPropertyDescriptor(t,e),i;if(n===void 0){let s=new WeakMap;i={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=n.set;i={...n,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,i)}}}function _({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new bt(this,{context:o,callback:n=>{e.set.call(this,n)},subscribe:t})})):e.constructor.addInitializer((n=>{new bt(n,{context:o,callback:i=>{n[r]=i},subscribe:t})}))}}var Ln=["this"],Nc=["+","-","!"],$c=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Pa={"!":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},Vn=13;var Qp=["==","!=","<=",">=","||","&&","??","|>"],Gp=["===","!=="],M;(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"})(M||(M={}));var Ut=(o,t,e=0)=>({kind:o,value:t,precedence:e}),Xp=o=>o===9||o===10||o===13||o===32,Lc=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),Yp=o=>Lc(o)||Ii(o),Kp=o=>Ln.indexOf(o)!==-1,Jp=o=>o===34||o===39,Ii=o=>48<=o&&o<=57,Zp=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,tu=o=>o===40||o===41||o===91||o===93||o===123||o===125,eu=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}}),zn=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;Xp(this.#i);)this.#n(!0);if(Jp(this.#i))return this.#a();if(Lc(this.#i))return this.#c();if(Ii(this.#i))return this.#p();if(this.#i===46)return this.#l();if(this.#i===44)return this.#d();if(this.#i===58)return this.#m();if(Zp(this.#i))return this.#f();if(tu(this.#i))return this.#g();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=Ut(M.STRING,eu(this.#o()));return this.#n(),r}#c(){do this.#n();while(Yp(this.#i));let t=this.#o(),e=Kp(t)?M.KEYWORD:M.IDENTIFIER;return Ut(e,t)}#p(){do this.#n();while(Ii(this.#i));return this.#i===46?this.#l():Ut(M.INTEGER,this.#o())}#l(){return this.#n(),Ii(this.#i)?this.#h():(this.#s(),Ut(M.DOT,".",Vn))}#d(){return this.#n(!0),Ut(M.COMMA,",")}#m(){return this.#n(!0),Ut(M.COLON,":")}#h(){do this.#n();while(Ii(this.#i));return Ut(M.DECIMAL,this.#o())}#f(){this.#n();let t=this.#o(2);if(Gp.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Ut(M.ARROW,t);Qp.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Ut(M.OPERATOR,t,Pa[t])}#g(){let t=String.fromCharCode(this.#i),e=Ut(M.GROUPER,t,Pa[t]);return this.#n(!0),e}};var Ma=(o,t)=>new _i(o,t).parse(),_i=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new zn(t),this.#r=e}parse(){return this.#o(),this.#s()}#o(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this.#i?.kind} (${this.#i?.value})`);let r=this.#e.nextToken();this.#i=r,this.#t=r?.kind,this.#n=r?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#n!==e)}#s(){if(!this.#i)return this.#r.empty();let t=this.#l();return t===void 0?void 0:this.#a(t,0)}#a(t,e){if(t===void 0)throw new Error("Expected left to be defined.");for(;this.#i;)if(this._matches(M.GROUPER,"(")){let r=this.#u();t=this.#r.invoke(t,void 0,r)}else if(this._matches(M.GROUPER,"[")){let r=this.#y();t=this.#r.index(t,r)}else if(this._matches(M.DOT)){this.#o();let r=this.#l();t=this.#c(t,r)}else{if(this._matches(M.KEYWORD))break;if(this._matches(M.OPERATOR)&&this.#i.precedence>=e)t=this.#n==="?"?this.#d(t):this.#p(t,this.#i);else break}return t}#c(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this.#r.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if($c.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#l();for(;(this.#t===M.OPERATOR||this.#t===M.DOT||this.#t===M.GROUPER)&&this.#i.precedence>e.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(t,e.value,r)}#l(){if(this._matches(M.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(M.INTEGER))return this.#k(t);if(this._matches(M.DECIMAL))return this.#E(t)}if(Nc.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#m(),Vn);return this.#r.unary(t,e)}return this.#m()}#d(t){this.#o(M.OPERATOR,"?");let e=this.#s();this.#o(M.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#m(){switch(this.#t){case M.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#r.id(t);throw Ln.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case M.IDENTIFIER:return this.#g();case M.STRING:return this.#S();case M.INTEGER:return this.#k();case M.DECIMAL:return this.#E();case M.GROUPER:return this.#n==="("?this.#v():this.#n==="{"?this.#f():this.#n==="["?this.#h():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#h(){let t=[];do{if(this.#o(),this._matches(M.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"]"),this.#r.list(t)}#f(){let t={};do{if(this.#o(),this._matches(M.GROUPER,"}"))break;let e=this.#n;(this._matches(M.STRING)||this._matches(M.IDENTIFIER))&&this.#o(),this.#o(M.COLON),t[e]=this.#s()}while(this._matches(M.COMMA));return this.#o(M.GROUPER,"}"),this.#r.map(t)}#g(){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.#u();return r?this.#r.invoke(e,void 0,r):e}#b(){if(!this._matches(M.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let t=this.#n;return this.#o(),this.#r.id(t)}#u(){if(!this._matches(M.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(M.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(M.COMMA));return this.#o(M.GROUPER,")"),t}#y(){this.#o();let t=this.#s();return this.#o(M.GROUPER,"]"),t}#v(){let t=this.#u();if(this._matches(M.ARROW)){this.#o();let e=this.#s(),r=t?.map(n=>n.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#S(){let t=this.#r.literal(this.#n);return this.#o(),t}#k(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#E(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:Vc,fromEntries:ru}=Object,iu={"+":(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)},nu={"+":o=>o,"-":o=>-o,"!":o=>!o},jn=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=nu[t];return{type:"Unary",operator:t,child:e,evaluate(n){return r(this.child.evaluate(n))},getIds(n){return this.child.getIds(n)}}}binary(t,e,r){let n=iu[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(i){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(i),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(i),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(i),l=this.left.argument.evaluate(i)):this.left.type==="ID"&&(a=i,l=this.left.value),a===void 0?void 0:a[l]=s}return n(this.left.evaluate(i),this.right.evaluate(i))},getIds(i){return this.left.getIds(i),this.right.getIds(i),i}}}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(n){let i=this.receiver.evaluate(n),s=this.method?i:n?.this??n,a=this.method?i?.[e]:i,c=(this.arguments??[]).map(d=>d?.evaluate(n));return a?.apply?.(s,c)},getIds(n){return this.receiver.getIds(n),this.arguments?.forEach(i=>i?.getIds(n)),n}}}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(n){return this.condition.evaluate(n)?this.trueExpr.evaluate(n):this.falseExpr.evaluate(n)},getIds(n){return this.condition.getIds(n),this.trueExpr.getIds(n),this.falseExpr.getIds(n),n}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let n in t){let i=this.entries[n];i&&(r[n]=i.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let n=this.entries[r];n&&n.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 n=this.params,i=this.body;return function(...s){let a=ru(n.map((c,d)=>[c,s[d]])),l=new Proxy(r??{},{set(c,d,h){return Vc(a,d)&&(a[d]=h),c[d]=h},get(c,d){return Vc(a,d)?a[d]:c[d]}});return i.evaluate(l)}},getIds(r){return this.body.getIds(r).filter(n=>!this.params.includes(n))}}}};var Da=null,zc={boundAttributeSuffix:tt.M,marker:tt.P,markerMatch:tt.A,HTML_RESULT:tt.C,getTemplateHtml:tt.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){Da??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Da))return void(e[Da]=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=et;return o.j=n=>r=n,o._$AI(t,o,e),r},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:tt.V,AttributePart:tt.H,PropertyPart:tt.B,BooleanAttributePart:tt.N,EventPart:tt.U,ElementPart:tt.F,TemplateInstance:tt.R,isIterable:tt.D,ChildPart:tt.I};var{AttributePart:ou,PropertyPart:su,BooleanAttributePart:au,EventPart:lu}=zc,$a=new jn,Na=new Map,jc=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),Fn=(o,t)=>{let e=Na.get(o);if(e===void 0){if(Na.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new _i(r,$a).parse(),Na.set(o,e)}}return e?.evaluate(t)},cu=(o,t,e,r)=>{let n=o.getAttribute("if");if(n!==null&&Fn(n,t))return Bn(o,t,e,r)},Fc=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Bc=o=>/(?:\\{{)|(?:\\}})/g.test(o),Ti=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),du=(o,t,e,r)=>{let n=o.getAttribute("repeat");if(n!==null){let i=Fn(n,t);if(!i[Symbol.iterator])return P;let s=Ri(o),a=-1,l=[];for(let c of i){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 v=m.update(d,e,r);m.type===1?h.push(...v):h.push(v)}let f={_$litType$:s,values:h};l.push(f)}return l}},Hc={if:cu,repeat:du},yt=(o,t=Hc,e={},r)=>{let i=Ri(o).renderers;if(r){let a=Ri(r).renderers,l=i.super;l!==void 0?e={...i,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,v)=>Bn(r,f,m,v)},l(c,d,h))}:(e={...a,...i,...e},o=r)}else e={...i,...e};return s=>Bn(o,s,t,e)};var Bn=(o,t,e=Hc,r={})=>{let n=Ri(o),i=[];for(let a of n.parts){let l=a.update(t,e,r);a.type===1?i.push(...l):i.push(l)}return{_$litType$:n,values:i}},Uc=new Map,Ri=o=>{let t=Uc.get(o);return t===void 0&&Uc.set(o,t=hu(o)),t},hu=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,n=-1,i=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)n++;else if(r.nodeType===Node.ELEMENT_NODE){n++;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),i.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(v,x,u)=>{let g=s.getAttribute("data"),y=g===null?void 0:Fn(g,v);return(m?Fn(f,v):u[d])?.(y,x,u)}}else l!==null?h=(f,m,v)=>{let x=m[l];return x?.(s,f,m,v)}:(c==="super"?t.renderers.super=(f,m,v)=>{let x=v.super,u=Ri(s);return v={...v,...u.renderers},x(f,m,v)}:t.renderers[c]=(f,m,v)=>Bn(s,f,m,v),h=(f,m,v)=>{let x=v[c];return x?.(f,m,v)});t.parts.push({type:2,index:n,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(Fc);if(d.length===1){Bc(c)&&s.setAttribute(l,Ti(c));continue}s.removeAttribute(l);let h=l,f=ou,m=l[0];m==="."?(h=jc(l.substring(1)),f=su):m==="?"?(h=l.substring(1),f=au):m==="@"&&(h=jc(l.substring(1)),f=lu);let v=[Ti(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(Ma(g,$a)),v.push(Ti(d[u+1]))}t.parts.push({type:1,index:n,name:h,strings:v,ctor:f,update:(u,g,y)=>x.map(w=>w.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,l=a.split(Fc);l.length>1?s.textContent=Ti(l[0]):Bc(a)&&(s.textContent=Ti(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=Ma(d,$a);t.parts.push({type:2,index:++n,update:(m,v)=>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 i)s.remove();return t};var La=Symbol.for("qti-components.context-root"),pu=()=>{if(typeof document>"u")return;let o=globalThis;o[La]||(o[La]=new Ai,o[La].attach(document.documentElement))};pu();var Wc=[];var za=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(" "))}},Va="custom-state-support-probe";function uu(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(Va)||customElements.define(Va,class extends HTMLElement{});let t=o.call(document.createElement(Va)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var Qc=!1;function Gc(){if(Qc)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=uu(o);return t==="modern"||(Qc=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new za(this)}),r}),t}Gc();for(let{tag:o,ctor:t}of Wc)customElements.get(o)||customElements.define(o,t);var ye=Symbol("computedItemContext");var z=Symbol("computedContext");var vt=Symbol("configContext");var kr=Symbol("interactionContext");var j=Symbol("item");var Xc=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var mu=/^[A-Za-z0-9-]+$/,fu=o=>typeof o=="string"&&mu.test(o),zb=o=>fu(o)?o:void 0,wt=Symbol("qtiContext");var ja={view:"candidate"},Ht=Symbol("sessionContext");var Fa={items:[],testOutcomeVariables:[]},ot=Symbol("testContext");var O=q`
|
|
6
6
|
:host {
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
@@ -12,7 +12,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
12
12
|
*::after {
|
|
13
13
|
box-sizing: inherit;
|
|
14
14
|
}
|
|
15
|
-
`;var
|
|
15
|
+
`;var Wt=q`
|
|
16
16
|
[part~='drop'] {
|
|
17
17
|
/*
|
|
18
18
|
* The one deliberate opt-out from the border-box reset.
|
|
@@ -56,19 +56,27 @@ 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 Er=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},D=class extends C{#t;get _context(){return this.#t.value}#e;#r;#i(t){t?.readonly!==void 0&&t.readonly!==this.#e&&(this.#e=t.readonly,this.readonly=t.readonly),t?.disabled!==void 0&&t.disabled!==this.#r&&(this.#r=t.disabled,this.disabled=t.disabled),this.#a(t)}#n;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),r=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!r)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let n=this.#n===void 0,i=JSON.stringify(r.value??null);i!==this.#n&&(this.#n=i,!(n&&(r.value===null||r.value===void 0))&&i!==this.#o&&(this.#o=i,this.response=r.value))}#c;static{this.formAssociated=!0}get internals(){return this._internals}get registersWithItem(){return!0}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let t=this._context.variables.filter(r=>r.type==="response"),e=this.getAttribute("response-identifier");return t.find(r=>r.identifier===e)}get value(){return JSON.stringify(this.response)}set value(t){this.response=t?JSON.parse(t):null}reportValidity(){let t=this._internals.validity.valid,e=this.validationDisplayMode;return(e==="native"||e==="both")&&this._internals.reportValidity(),e==="inline"||e==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),e==="none"&&this.clearInlineValidationMessage(),t}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(t){let e=t?.defaultWhenUnset??!0,r=this.configContext;return r&&r.allowReorder!==void 0?r.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,r=this.configContext;return r?r.disableAfterMaxReached!==void 0?r.disableAfterMaxReached:r.disableAfterIfMaxChoicesReached!==void 0?(this.#c||(this.#c=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),r.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",r,n){let i=r??this;this._internals.setValidity(t?{}:{customError:!0},e,i),n?.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.response=null}formResetCallback(){this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(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}:{}}}))}constructor(){super(),this.#t=new bt(this,{context:j,subscribe:!0,callback:t=>this.#i(t)}),this.#s=!1,this.#c=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._internals=this.attachInternals(),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Er([_({context:vt,subscribe:!0})],D.prototype,"configContext",void 0);Er([B({context:kr})],D.prototype,"_interactionContext",void 0);Er([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Er([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Er([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Er([p({type:String})],D.prototype,"name",void 0);var Ar=class extends C{render(){return b`<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(n=>n.innerHTML.trim());return r.length>1||t==="multiple"||t==="ordered"?r:r[0]}};var Ua=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ba=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??Yc(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??Yc(o),value:String(o),cardinality:"single",type:"response"},Yc=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",gu=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},E=class extends C{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return r==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.resolveVariable(r)}case"qti-multiple":{let n=e.getResult();return n?.length>0?{identifier:"",baseType:n[0].baseType,value:n.map(i=>i.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let n=e.getResult();return n?.length>0?{identifier:"",baseType:n[0].baseType,value:n.map(i=>i.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let n=e.getResult();return n?.length>0?n:null}case"qti-custom-operator":return Ba(e.calculate?.());case"qti-correct":{let r=e.getAttribute("identifier")||"",n=this.context?.variables?.find(i=>i.identifier===r);return n?{baseType:n.baseType,value:n.correctResponse,cardinality:n.cardinality}:(console.warn(`qti-correct: no response declaration for "${r}"`),Ba(null))}default:{try{let r=e,n=r.getResult();return Ba(n,r.resultBaseType??gu(r,n))}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=q`
|
|
60
60
|
slot {
|
|
61
61
|
display: none;
|
|
62
62
|
}
|
|
63
|
-
`}render(){return b`<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)??null}};Va([_({context:j,subscribe:!0})],E.prototype,"context",void 0);Va([_({context:vt,subscribe:!0})],E.prototype,"qtiContext",void 0);Va([_({context:st,subscribe:!0})],E.prototype,"_testContext",void 0);var Ht=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var ey=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Et=o=>typeof o=="string"?o:o.toString();function za(o){return o==null}function Fi(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Er=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},at=class extends C{constructor(){super(...arguments),this.showHide="show"}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(t){let e=this._context.variables.find(n=>n.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.#t(r)}#t(t){if(!this.#e()){this.showStatus="off";return}this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}#e(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(n=>n.active)?.sections.flatMap(n=>n.items).find(n=>n.active);if(!t||t.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(n=>n.identifier==="numAttempts")?.value)||0)<e}};Er([p({type:String,attribute:"show-hide"})],at.prototype,"showHide",void 0);Er([p({type:String,attribute:"outcome-identifier"})],at.prototype,"outcomeIdentifier",void 0);Er([p({type:String})],at.prototype,"identifier",void 0);Er([p({type:String,attribute:!1})],at.prototype,"showStatus",void 0);Er([_({context:j,subscribe:!0}),T()],at.prototype,"_context",void 0);Er([_({context:z,subscribe:!0}),T()],at.prototype,"_computedContext",void 0);function ja(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 Fa(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*dy(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 hy(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 py(o,t){return`${o} ${t}`}function uy(o){let[t,e,...r]=o.trim().split(/\s+/),n=Number(t),i=Number(e);if(!Number.isFinite(n)||!Number.isFinite(i)||r.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:n,y:i}}function my(o,t){return`${o} ${t}`}function Wt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let n=ja(r);return n===null?t:n},toAttribute:r=>e(r)?null:Fa(r)}}var Hc=class extends C{},Ar=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Ir=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var au=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},Ba=o=>t=>{let e=au(t);return e===null?null:o(e)},lu=["depcp","questify","qade"],cu={Trim:Ba(o=>o.trim()),ToAscii:Ba(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:Ba(o=>o.replace(",","."))},du=new Map(lu.flatMap(o=>Object.entries(cu).map(([t,e])=>[`${o}:${t}`,e]))),Ua=new Map,yy=(o,t)=>{Ua.set(o,t)},vy=o=>{Ua.delete(o)},Wc=o=>Ua.get(o)??du.get(o)??null;var G=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[n,i]=t.split(" ").map(Number),[s,...a]=e.split(","),c=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[l,d,h]=c;return c.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((n-l)**2+(i-d)**2)<=h}case"rect":{let[l,d,h,f]=c;return c.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):n>=l&&n<=h&&i>=d&&i<=f}case"ellipse":{let[l,d,h,f]=c;if(c.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(n-l)**2/h**2,v=(i-d)**2/f**2;return m+v<=1}case"poly":{if(c.length<6||c.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let l=[];for(let d=0;d<c.length;d+=2)l.push({x:c[d],y:c[d+1]});return this.isPointInPolygon({x:n,y:i},l)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let n=0,i=e.length-1;n<e.length;i=n++){let s=e[n].x,a=e[n].y,c=e[i].x,l=e[i].y;a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let n=parseInt(t,10),i=parseInt(e,10);if(!isNaN(n)&&!isNaN(i)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:n===i}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let n=parseFloat(t),i=parseFloat(e);if(!isNaN(n)&&!isNaN(i))return n===i;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let n=t.split(" "),i=e.split(" ");if(n.length===2&&i.length===2)return r==="pair"&&(n.sort(),i.sort()),n.join(" ")===i.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Ge=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Qc={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},At=class extends C{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#r=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 n=Number(e.getAttribute("value"));if(Number.isNaN(n)){console.warn(`qti-weight "${r}" has a non-numeric value, ignoring it`);continue}t.set(r,n)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}#t(){let t=this.closest("qti-test");if(t)return t;let e=this.getRootNode();for(;e instanceof ShadowRoot;){let r=e.host.closest("qti-test");if(r)return r;e=e.host.getRootNode()}return null}async connectedCallback(){super.connectedCallback();let t=this.#t()?.querySelector("template[item-ref]");this.myTemplate=t?bt(t):null,this.requestUpdate(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}#e(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let r=e.items.find(n=>n.identifier===this.identifier);if(r)return r}}#r;render(){if(!this.xmlDoc)return this.#r=null,P;(this.#r?.source!==this.xmlDoc||this.#r.template!==this.myTemplate)&&(this.#r={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#r.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#e(),itemRef:this};return this.myTemplate(e)}};Ge([p({type:String})],At.prototype,"category",void 0);Ge([p({type:String})],At.prototype,"identifier",void 0);Ge([p({type:Boolean,converter:Qc})],At.prototype,"required",void 0);Ge([p({type:Boolean,converter:Qc})],At.prototype,"fixed",void 0);Ge([p({type:String})],At.prototype,"href",void 0);Ge([T(),_({context:z,subscribe:!0})],At.prototype,"computedContext",void 0);Ge([p({type:Object,attribute:!1})],At.prototype,"xmlDoc",void 0);var be=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ha={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},wt=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return b`<slot name="qti-rubric-block"></slot><slot></slot>`}};be([p({type:String})],wt.prototype,"identifier",void 0);be([p({type:String})],wt.prototype,"required",void 0);be([p({type:Boolean,converter:Ha})],wt.prototype,"fixed",void 0);be([p({type:Boolean,converter:Ha})],wt.prototype,"visible",void 0);be([p({type:Boolean,converter:Ha,attribute:"keep-together"})],wt.prototype,"keepTogether",void 0);be([p({type:String,attribute:"navigation-mode"})],wt.prototype,"navigationMode",void 0);be([p({type:String,attribute:"submission-mode"})],wt.prototype,"submissionMode",void 0);be([_({context:st,subscribe:!0})],wt.prototype,"_testContext",void 0);var Wa=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Xe=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};Wa([p({type:String})],Xe.prototype,"identifier",void 0);Wa([p({type:String})],Xe.prototype,"title",null);Wa([_({context:st,subscribe:!0})],Xe.prototype,"_testContext",void 0);var Ye=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},_r={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},It=class extends C{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b`<slot></slot>`}};Ye([p({type:Number,attribute:"max-attempts"})],It.prototype,"maxAttempts",void 0);Ye([p({type:Boolean,converter:_r,attribute:"show-feedback"})],It.prototype,"showFeedback",void 0);Ye([p({type:Boolean,converter:_r,attribute:"allow-review"})],It.prototype,"allowReview",void 0);Ye([p({type:Boolean,converter:_r,attribute:"show-solution"})],It.prototype,"showSolution",void 0);Ye([p({type:Boolean,converter:_r,attribute:"allow-comment"})],It.prototype,"allowComment",void 0);Ye([p({type:Boolean,converter:_r,attribute:"allow-skipping"})],It.prototype,"allowSkipping",void 0);Ye([p({type:Boolean,converter:_r,attribute:"validate-responses"})],It.prototype,"validateResponses",void 0);var Qa=o=>o?.split(/\s+/).filter(Boolean)??[],Bi=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:Qa(o.getAttribute("include-category")),excludeCategories:Qa(o.getAttribute("exclude-category"))}),Ui=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:r})=>{let n=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return n.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):n.flatMap(i=>Array.from(i.querySelectorAll("qti-assessment-item-ref"))).filter(i=>{let s=Qa(i.category);return!(e.length>0&&!s.some(a=>e.includes(a))||r.length>0&&s.some(a=>r.includes(a)))})};var Hi=class extends E{#t=null;constructor(){super(),this.addEventListener("qti-assessment-test-connected",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?Ui(t,Bi(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var Wi=class extends C{static{this.styles=[q`
|
|
63
|
+
`}render(){return b`<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)??null}};Ua([_({context:j,subscribe:!0})],E.prototype,"context",void 0);Ua([_({context:wt,subscribe:!0})],E.prototype,"qtiContext",void 0);Ua([_({context:ot,subscribe:!0})],E.prototype,"_testContext",void 0);var Qt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var fy=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Rt=o=>typeof o=="string"?o:o.toString();function Ha(o){return o==null}function Un(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Oi=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},pt=class extends C{constructor(){super(...arguments),this.showHide="show",this.#t=new bt(this,{context:j,subscribe:!0,callback:t=>this.#r(t)})}#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),n=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,i=this.#e===void 0?n>0:this.#e!==r||n>0;this.#e=r,i&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(n=>n.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!Ha(this.identifier)&&!Ha(e?.value)&&this.identifier===e.value||!1,this.#i(r)}#i(t){if(!this.#n()){this.showStatus="off";return}this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}#n(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(n=>n.active)?.sections.flatMap(n=>n.items).find(n=>n.active);if(!t||t.showFeedback)return!0;if(t.adaptive)return t.completionStatus!=="completed";let e=t.maxAttempts??1;return e<=0?!0:(Number(this._context?.variables?.find(n=>n.identifier==="numAttempts")?.value)||0)<e}};Oi([p({type:String,attribute:"show-hide"})],pt.prototype,"showHide",void 0);Oi([p({type:String,attribute:"outcome-identifier"})],pt.prototype,"outcomeIdentifier",void 0);Oi([p({type:String})],pt.prototype,"identifier",void 0);Oi([p({type:String,attribute:!1})],pt.prototype,"showStatus",void 0);Oi([_({context:z,subscribe:!0}),T()],pt.prototype,"_computedContext",void 0);function Wa(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 Qa(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*Sy(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 ky(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 Ey(o,t){return`${o} ${t}`}function Ay(o){let[t,e,...r]=o.trim().split(/\s+/),n=Number(t),i=Number(e);if(!Number.isFinite(n)||!Number.isFinite(i)||r.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:n,y:i}}function Iy(o,t){return`${o} ${t}`}function Gt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let n=Wa(r);return n===null?t:n},toAttribute:r=>e(r)?null:Qa(r)}}var Kc=class extends C{},Ir=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},_r=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var bu=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},Ga=o=>t=>{let e=bu(t);return e===null?null:o(e)},yu=["depcp","questify","qade"],vu={Trim:Ga(o=>o.trim()),ToAscii:Ga(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:Ga(o=>o.replace(",","."))},wu=new Map(yu.flatMap(o=>Object.entries(vu).map(([t,e])=>[`${o}:${t}`,e]))),Xa=new Map,Oy=(o,t)=>{Xa.set(o,t)},Py=o=>{Xa.delete(o)},Jc=o=>Xa.get(o)??wu.get(o)??null;var G=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[n,i]=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((n-c)**2+(i-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):n>=c&&n<=h&&i>=d&&i<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(n-c)**2/h**2,v=(i-d)**2/f**2;return m+v<=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:n,y:i},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let n=0,i=e.length-1;n<e.length;i=n++){let s=e[n].x,a=e[n].y,l=e[i].x,c=e[i].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"integer":{let n=parseInt(t,10),i=parseInt(e,10);if(!isNaN(n)&&!isNaN(i)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:n===i}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let n=parseFloat(t),i=parseFloat(e);if(!isNaN(n)&&!isNaN(i))return n===i;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let n=t.split(" "),i=e.split(" ");if(n.length===2&&i.length===2)return r==="pair"&&(n.sort(),i.sort()),n.join(" ")===i.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var xt=Symbol("testHost");var ve=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Zc={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},qt=class extends C{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let r=e.getAttribute("identifier");if(!r)continue;let n=Number(e.getAttribute("value"));if(Number.isNaN(n)){console.warn(`qti-weight "${r}" has a non-numeric value, ignoring it`);continue}t.set(r,n)}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?yt(t):null,this.requestUpdate(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let r=e.items.find(n=>n.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)}};ve([p({type:String})],qt.prototype,"category",void 0);ve([p({type:String})],qt.prototype,"identifier",void 0);ve([p({type:Boolean,converter:Zc})],qt.prototype,"required",void 0);ve([p({type:Boolean,converter:Zc})],qt.prototype,"fixed",void 0);ve([p({type:String})],qt.prototype,"href",void 0);ve([T(),_({context:z,subscribe:!0})],qt.prototype,"computedContext",void 0);ve([p({type:Object,attribute:!1})],qt.prototype,"xmlDoc",void 0);ve([_({context:xt,subscribe:!0})],qt.prototype,"testHost",void 0);var we=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ya={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ct=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return b`<slot name="qti-rubric-block"></slot><slot></slot>`}};we([p({type:String})],Ct.prototype,"identifier",void 0);we([p({type:String})],Ct.prototype,"required",void 0);we([p({type:Boolean,converter:Ya})],Ct.prototype,"fixed",void 0);we([p({type:Boolean,converter:Ya})],Ct.prototype,"visible",void 0);we([p({type:Boolean,converter:Ya,attribute:"keep-together"})],Ct.prototype,"keepTogether",void 0);we([p({type:String,attribute:"navigation-mode"})],Ct.prototype,"navigationMode",void 0);we([p({type:String,attribute:"submission-mode"})],Ct.prototype,"submissionMode",void 0);we([_({context:ot,subscribe:!0})],Ct.prototype,"_testContext",void 0);var Ka=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ke=class extends C{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};Ka([p({type:String})],Ke.prototype,"identifier",void 0);Ka([p({type:String})],Ke.prototype,"title",null);Ka([_({context:ot,subscribe:!0})],Ke.prototype,"_testContext",void 0);var Je=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Tr={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ot=class extends C{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return b`<slot></slot>`}};Je([p({type:Number,attribute:"max-attempts"})],Ot.prototype,"maxAttempts",void 0);Je([p({type:Boolean,converter:Tr,attribute:"show-feedback"})],Ot.prototype,"showFeedback",void 0);Je([p({type:Boolean,converter:Tr,attribute:"allow-review"})],Ot.prototype,"allowReview",void 0);Je([p({type:Boolean,converter:Tr,attribute:"show-solution"})],Ot.prototype,"showSolution",void 0);Je([p({type:Boolean,converter:Tr,attribute:"allow-comment"})],Ot.prototype,"allowComment",void 0);Je([p({type:Boolean,converter:Tr,attribute:"allow-skipping"})],Ot.prototype,"allowSkipping",void 0);Je([p({type:Boolean,converter:Tr,attribute:"validate-responses"})],Ot.prototype,"validateResponses",void 0);var Ja=o=>o?.split(/\s+/).filter(Boolean)??[],Hn=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:Ja(o.getAttribute("include-category")),excludeCategories:Ja(o.getAttribute("exclude-category"))}),Wn=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:r})=>{let n=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return n.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):n.flatMap(i=>Array.from(i.querySelectorAll("qti-assessment-item-ref"))).filter(i=>{let s=Ja(i.category);return!(e.length>0&&!s.some(a=>e.includes(a))||r.length>0&&s.some(a=>r.includes(a)))})};var Qn=class extends E{#t=null;constructor(){super(),this.addEventListener("qti-assessment-test-connected",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?Wn(t,Hn(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var Gn=class extends C{static{this.styles=[q`
|
|
64
64
|
:host {
|
|
65
65
|
display: none;
|
|
66
66
|
}
|
|
67
|
-
`]}render(){return b`<slot></slot>`}process(){let t=new Ga,e=[...this.children];t.process(e)}},Ga=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Ir))throw e}}};function $(o,t){let e={waitUntilFirstUpdate:!1,...t};return(r,n)=>{let{update:i}=r,s=Array.isArray(o)?o:[o];r.update=function(a){s.forEach(c=>{let l=c;if(a.has(l)){let d=a.get(l),h=this[l];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[n](d,h)}}),i.call(this,a)}}}var Tr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},_t=o=>(...t)=>({_$litDirective$:o,values:t}),ye=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:hu}=tt,Gc=o=>o,Yc=o=>o===null||typeof o!="object"&&typeof o!="function";var Kc=o=>o.strings===void 0,Xc=()=>document.createComment(""),Rr=(o,t,e)=>{let r=o._$AA.parentNode,n=t===void 0?o._$AB:t._$AA;if(e===void 0){let i=r.insertBefore(Xc(),n),s=r.insertBefore(Xc(),n);e=new hu(i,s,o,o.options)}else{let i=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let c;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(c=o._$AU)!==s._$AU&&e._$AP(c)}if(i!==n||a){let c=e._$AA;for(;c!==i;){let l=Gc(c).nextSibling;Gc(r).insertBefore(c,n),c=l}}}return e},ve=(o,t,e=o)=>(o._$AI(t,e),o),pu={},Jc=(o,t=pu)=>o._$AH=t,Zc=o=>o._$AH,Qi=o=>{o._$AR(),o._$AA.remove()};var On=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),On(r,t);return!0},Gi=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},td=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),fu(t)}};function uu(o){this._$AN!==void 0?(Gi(this),this._$AM=o,td(this)):this._$AM=o}function mu(o,t=!1,e=0){let r=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(r))for(let i=e;i<r.length;i++)On(r[i],!1),Gi(r[i]);else r!=null&&(On(r,!1),Gi(r));else On(this,o)}var fu=o=>{o.type==Tr.CHILD&&(o._$AP??=mu,o._$AQ??=uu)},we=class extends ye{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),td(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(On(this,t),Gi(this))}setValue(t){if(Kc(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 Xa=class extends we{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:n}=this;for(let i in e){let s=e[i];s!==r[i]&&(s===!0?n.setAttribute(i,""):s===!1?n.removeAttribute(i):s!=null?n.setAttribute(i,String(s)):n.removeAttribute(i))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let n=t?this.#t(t):{};for(let i in e)(!n||!(i in n))&&r.removeAttribute(i)}#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)))}},Hv=_t(Xa);var re=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},it=class extends C{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._handleDisabledChange=(t,e)=>{this.interactionElements.forEach(r=>r.disabled=e)},this._handleReadonlyChange=(t,e)=>this.interactionElements.forEach(r=>r.readonly=e),this._context={variables:Bc},this.#r={...this._context,variables:this._context.variables},this.#n=[],this.interactionElements=[],this.#s=t=>{t.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,t.detail.variable]},this.#r=this._context,t.stopPropagation()},this.#a=t=>{t.stopImmediatePropagation();let e=t.detail;this.#n.push(e),(Number(this._context.variables.find(n=>n.identifier==="numAttempts")?.value)||0)>0&&e.checkShowFeedback(e.outcomeIdentifier)},this.#l=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.processResponse(r)},this.#c=t=>{t.stopImmediatePropagation();let{outcomeIdentifier:e,value:r}=t.detail;this.updateOutcomeVariable(e,r),t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#p=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:n}=t.detail;this.updateResponseVariable(e,r),n!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:n}}),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)}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}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(e=>!("identifier"in e))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(e=>{let r=t.find(n=>n.identifier===e.identifier);return r?{...e,...r,interpolationTable:e.interpolationTable,matchTable:e.matchTable}:e})},this._context.variables.forEach(e=>{if(e.type==="response"){let r=this.interactionElements.find(n=>n.responseIdentifier===e.identifier);r&&(r.response=e.value)}}),this.variables.forEach(e=>{e.type==="outcome"&&this.#n.forEach(r=>r.checkShowFeedback(e.identifier))})}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let n=this.interactionElements.find(i=>i.getAttribute("response-identifier")===e.responseIdentifier);n&&(n.response=e.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#i(),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#m()})}disconnectedCallback(){this.#o(),super.disconnectedCallback()}#i(){this.addEventListener("qti-register-variable",this.#s),this.addEventListener("qti-register-feedback",this.#a),this.addEventListener("qti-register-interaction",this.#l),this.addEventListener("end-attempt",this.#h),this.addEventListener("qti-set-outcome-value",this.#c),this.addEventListener("qti-set-template-value",this.#d),this.addEventListener("qti-set-correct-response",this.#p),this.addEventListener("qti-interaction-response",this.#u)}#o(){this.removeEventListener("qti-register-variable",this.#s),this.removeEventListener("qti-register-feedback",this.#a),this.removeEventListener("qti-register-interaction",this.#l),this.removeEventListener("end-attempt",this.#h),this.removeEventListener("qti-set-outcome-value",this.#c),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#p),this.removeEventListener("qti-interaction-response",this.#u)}#s;#a;#l;#h;#c;#d;#p;#u;async#m(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){this.validate(e),t&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(i=>i.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#f();let r=this.querySelector("qti-response-processing"),n=!!(r&&typeof r.process=="function");return n&&r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#g()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}})),n}resetResponses(){this._context=this.#r}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(),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#g())}updateTemplateVariable(t,e){let r=this._context.variables.find(i=>i.identifier===t&&i.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let n=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(i=>i.identifier!==t?i:{...i,value:n})},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 n=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(i=>i.identifier!==t?i:{...i,correctResponse:n})},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){let r=this.getOutcome(t);if(!r){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:r.cardinality==="single"||Array.isArray(e)?e:[e]})},this.#n.forEach(n=>n.checkShowFeedback(t)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(n=>n.identifier===t)?.value}}))}validate(t=!0){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}#g(){let t=this.validate(!1);return t===!0?"completed":t===!1?"incomplete":"not_attempted"}#f(){this._context={...this._context,variables:this._context.variables.map(t=>{if(t.type!=="outcome")return t;let n=("defaultValue"in t?t.defaultValue:null)??null;return n==null&&(t.baseType==="integer"||t.baseType==="float")&&(n="0"),{...t,value:n}})}}};re([p({type:String})],it.prototype,"identifier",void 0);re([p({type:String})],it.prototype,"adaptive",void 0);re([p({type:String,attribute:"time-dependent"})],it.prototype,"timeDependent",void 0);re([p({type:String})],it.prototype,"title",null);re([p({type:Boolean})],it.prototype,"disabled",void 0);re([$("disabled",{waitUntilFirstUpdate:!0})],it.prototype,"_handleDisabledChange",void 0);re([p({type:Boolean})],it.prototype,"readonly",void 0);re([$("readonly",{waitUntilFirstUpdate:!0})],it.prototype,"_handleReadonlyChange",void 0);re([B({context:j})],it.prototype,"_context",void 0);function ed(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function rd(o,t,e,r="qti-portable-custom-interaction"){let n=[],i=o.querySelectorAll(r);if(i.length===0)return;let s=null,a=null,c=async()=>{if(s===null)try{s=await e(t,"/modules/module_resolution.js")}catch{s=null}if(a===null)try{a=await e(t,"/modules/fallback_module_resolution.js")}catch{a=null}};for(let l of Array.from(i)){l.setAttribute("data-base-url",t);let d=l.getAttribute("custom-interaction-type-identifier");d&&n.includes(d)&&(d=d+n.length,l.setAttribute("custom-interaction-type-identifier",d),n.push(d)),d&&n.push(d);let h=l.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await c();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),v=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of v){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],y=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",y),a&&a.paths&&a.paths[u]){let w=a.paths[u];Array.isArray(w)?x.setAttribute("fallback-path",w[0]):x.setAttribute("fallback-path",w)}}}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 y=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",y),a&&a.paths&&a.paths[x]){let w=a.paths[x];Array.isArray(w)?g.setAttribute("fallback-path",w[0]):g.setAttribute("fallback-path",w)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await c(),s){l.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),l.appendChild(h)):h=l.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],v="";a&&a.paths&&a.paths[f]&&(v=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(v)?v:[v],g=x.map((y,w)=>{let I=u.length>w?u[w]:"";return{primaryPath:y,fallbackPath:I}});for(let y of u)g.some(w=>w.fallbackPath===y)||g.push({primaryPath:x.length>0?x[0]:y,fallbackPath:y});for(let y of g){let w=o.createElement("qti-interaction-module");y.fallbackPath&&w.setAttribute("fallback-path",y.fallbackPath),w.setAttribute("id",f),w.setAttribute("primary-path",y.primaryPath),h&&h.appendChild(w)}}}}}function nd(o,t,e){Array.from(o.getElementsByTagName("*")).filter(i=>i.localName===t||i.localName?.toLowerCase()===t.toLowerCase()).forEach(i=>{let s=`${t}-${e}`,a=od(i,s);i.replaceWith(a)})}function id(o,t){o.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(n=>{if(n.startsWith(`${t}:`)){let i=n.slice(`${t}:`.length),s=`${e.nodeName}-${i}`,a=od(e,s);e.replaceWith(a)}})})}function od(o,t){let e=o.ownerDocument.createElement(t);for(let r of o.attributes)e.setAttribute(r.name,r.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function sd(o,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let n of e)o.querySelectorAll("["+n+"]").forEach(s=>{let a=s.getAttribute(n);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var Ya=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=bu(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=gu(`${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 Xi(o){return Ya.fromSeedKey(o)}function gu(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 ad(t)}function bu(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 ad(t)}function ad(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var yu=o=>typeof o=="function"?o():o.random();function Yi(o,t){let e=o.filter(n=>!n.fixed);for(let n=e.length-1;n>0;n--){let i=Math.floor(yu(t)*(n+1));[e[n],e[i]]=[e[i],e[n]]}let r=0;return o.map(n=>n.fixed?n:e[r++])}function vu(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 Ka(o,t){let e=o.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),n=t!=null&&`${t}`.length>0,i=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let c=a.getAttribute("response-identifier")??`${s}`;s++;let l=vu(a.tagName.toLowerCase()),d=Array.isArray(l)?l:[l],h=!1,f=0;for(let m of d){if(!m)continue;let v=n?Xi(`${t}:${i}:${c}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(w=>w.parentElement!==null);if(x.filter(w=>w.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(w=>w.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,y=Yi(x.map(w=>({element:w,fixed:w.getAttribute("fixed")==="true"})),v);for(let w of x)w.remove();for(let{element:w}of y)u.insertBefore(w,g);h=!0}h&&a.removeAttribute("shuffle")}}function ld(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var cd=!1;function Ki(o,t){cd||(cd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function wu(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"),n=r.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??r.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(n)throw new Error(t(wu(n)));return r}function Or(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 Pr(o){return dd(o,t=>`Failed to parse XML: ${t}`)}function hd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let r=o,n;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?n=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):n=t.createElementNS(r.namespaceURI,r.tagName);for(let i=0;i<r.attributes.length;i++){let s=r.attributes[i];n.setAttribute(s.localName,s.value)}for(let i=0;i<r.childNodes.length;i++)n.appendChild(hd(r.childNodes[i],t,e));return n}return o.cloneNode(!1)}function Mr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild(hd(o.childNodes[r],document,t));return e}function Dr(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(r=>{for(let n of["src","href","srcset","poster"]){let i=r.getAttribute(n)?.trim();if(i&&!/^(data:|https?:|blob:)/.test(i)){let s=t+encodeURI(i);r.setAttribute(n,s)}}})}var Qt=()=>{let o,t="",e={load(r,n){return t=r,Or(r,n).then(i=>(o=i,e))},parse(r){return o=Pr(r),t="",e},path:r=>(Dr(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return sd(o,r),e},async configurePci(r,n,i="qti-portable-custom-interaction"){return await rd(o,r,n,i),e},shuffleInteractions(r){let n=typeof r=="string"?r.trim():r;if(n==null||n===""){let i=t||"default-item-seed";return Ki("qtiTransformItem",i),Ka(o,i),e}return Ka(o,n),e},extendElementName:(r,n)=>(nd(o,r,n),e),extendElementsWithClass:(r="extend")=>(id(o,r),e),customInteraction(r,n){let i=o.querySelector("qti-custom-interaction"),s=i.querySelector("object");return i.setAttribute("data-base-ref",r),i.setAttribute("data-base-item",r+n),i.setAttribute("data",s.getAttribute("data")),i.setAttribute("width",s.getAttribute("width")),i.setAttribute("height",s.getAttribute("height")),i.removeChild(s),e},convertCDATAtoComment(){return ed(o),e},stripStyleSheets(){return ld(o),e},html(){return t!==null&&Dr(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Mr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&Dr(o,t.substring(0,t.lastIndexOf("/"))),Mr(o,r)},xmlDoc(){return o}};return e};var pd=()=>{let o,t={async load(e,r){return o=await Or(e,r),t},parse(e){o=Pr(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function ud(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),n=e.getAttribute("href"),i=e.getAttribute("category");t.push({identifier:r,href:n,category:i})}),t}var Ji=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),md=o=>Ji(o,"qti-assessment-item-ref","assessmentitemref"),Mn=o=>Ji(o,"qti-assessment-section","assessmentsection"),Pn=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),xu=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),Ja=o=>Ji(o,"qti-ordering","ordering"),qu=o=>Ji(o,"qti-selection","selection"),Cu=o=>Array.from(o.children).filter(t=>Ja(t)&&Pn(t,"shuffle")),ku=(o,t)=>Xi(`${o}:${t}`);function Su(o){let t=[],e=[],r=n=>{for(let i of Array.from(n.children))md(i)?t.push(i):Mn(i)?r(i):!Ja(i)&&!qu(i)&&e.push(i.localName)};return r(o),{itemRefs:t,dropped:e}}function Eu(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 c of Array.from(o.children))Mn(c)&&fd(c,t);let e=Cu(o);if(e.length===0)return;let r=[],n=[];for(let c of Array.from(o.children))if(md(c))r.push({nodes:[c],fixed:Pn(c,"fixed")}),n.push(c);else if(Mn(c)){let{itemRefs:l,dropped:d}=Su(c);if(Eu(c,d),xu(c,"keep-together","keeptogether"))for(let h of l)r.push({nodes:[h],fixed:Pn(h,"fixed")});else l.length>0&&r.push({nodes:l,fixed:Pn(c,"fixed")});n.push(c)}let i=n.length>0?n[n.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=Yi(r,ku(t,s));for(let c of n)c.remove();for(let c of a)for(let l of c.nodes)o.insertBefore(l,i);for(let c of e)c.remove()}function gd(o){return Array.from(o.getElementsByTagName("*")).some(t=>Ja(t)&&Pn(t,"shuffle"))}function Za(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Mn(r));for(let r of e){if(!r.parentNode)continue;let n=r.parentElement;n&&Mn(n)||fd(r,t)}}var Nr=()=>{let o,t="",e={async load(r,n){return o=await Or(r,n),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return o=Pr(r),t="",e},path:r=>(Dr(o,r),e),fn(r){return r(o),e},shuffleOrdering(r){if(!gd(o))return e;let n=typeof r=="string"?r.trim():r;if(n==null||n===""){let i=t||"default-test-seed";return Ki("qtiTransformTest",i),Za(o,i),e}return Za(o,n),e},items(){return ud(o)},html(){return new XMLSerializer().serializeToString(Mr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return Mr(o,r)},xmlDoc(){return o}};return e};var bd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},tl=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}},$r=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new tl(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 e=await Qt().load(this.href).then(r=>r.htmlDoc());if(e){let r=e.querySelectorAll("qti-stimulus-body, qti-stylesheet");t.innerHTML="",t.append(...r)}}};bd([p({type:String})],$r.prototype,"identifier",void 0);bd([p({type:String})],$r.prototype,"href",void 0);var Zi=class extends C{};var Au=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Dn=class extends C{render(){return b`<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(n=>n.type==="template");for(let n of e){let i=n;i.mathVariable!==!0||i.value===null||i.value===void 0||t.set(i.identifier,this.#e(i.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(n=>n.localName.toLowerCase()==="mi"||n.localName.toLowerCase()==="mn");for(let n of r){let i=n.getAttribute("data-qti-math-variable-source")??n.textContent?.trim()??"",s=t.get(i);if(!s)continue;if(n.localName.toLowerCase()==="mn"){n.textContent=s,n.setAttribute("data-qti-math-variable-source",i);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",i),n.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Au([_({context:j,subscribe:!0}),T()],Dn.prototype,"context",void 0);var yd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Lr=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
|
|
67
|
+
`]}render(){return b`<slot></slot>`}process(){let t=new Za,e=[...this.children];t.process(e)}},Za=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof _r))throw e}}};var Ze=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ut=class extends C{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:Xc},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,n=r!==void 0?{...e,value:r}:e;this._context={...this._context,variables:[...this._context.variables,n]},this.#r=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.processResponse(r)},this.#l=t=>{t.stopImmediatePropagation();let{outcomeIdentifier:e,value:r}=t.detail;this.updateOutcomeVariable(e,r),t.stopPropagation()},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.#m=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:n}=t.detail;this.updateResponseVariable(e,r),n!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:n}}),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(i=>!("identifier"in i))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,r=t.filter(i=>i.value!==null&&i.value!==void 0&&(i.type==="template"||e.some(s=>s.identifier===i.identifier&&s.type==="template")));r.forEach(i=>this.#i.set(i.identifier,i.value));let n=r.some(i=>JSON.stringify(e.find(s=>s.identifier===i.identifier)?.value)!==JSON.stringify(i.value));this._context={...this._context,variables:this._context.variables.map(i=>{let s=t.find(a=>a.identifier===i.identifier);return s?{...i,...s,interpolationTable:i.interpolationTable,matchTable:i.matchTable}:i})},this.#n&&n&&this.#g(),this.updateComplete.then(()=>this.#u())}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 n=this.interactionElements.find(i=>i.getAttribute("response-identifier")===e.responseIdentifier);n&&(n.response=e.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),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.#c),this.addEventListener("end-attempt",this.#p),this.addEventListener("qti-set-outcome-value",this.#l),this.addEventListener("qti-set-template-value",this.#d),this.addEventListener("qti-set-correct-response",this.#m),this.addEventListener("qti-interaction-response",this.#h)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qti-set-outcome-value",this.#l),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#m),this.removeEventListener("qti-interaction-response",this.#h)}#a;#c;#p;#l;#d;#m;#h;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.#g()}#g(){this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){this.validate(e),t&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(i=>i.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#v();let r=this.querySelector("qti-response-processing"),n=!!(r&&typeof r.process=="function");return n&&r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#y()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}})),n}resetResponses(){this._context=this.#r}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(),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#y())}updateTemplateVariable(t,e){let r=this._context.variables.find(i=>i.identifier===t&&i.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let n=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(i=>i.identifier!==t?i:{...i,value:n})},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 n=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(i=>i.identifier!==t?i:{...i,correctResponse:n})},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){let r=this.getOutcome(t);if(!r){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:r.cardinality==="single"||Array.isArray(e)?e:[e]})},this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(n=>n.identifier===t)?.value}}))}validate(t=!0){let e=this.interactionElements.every(r=>r.validate());return this.#b(e),t&&this.reportValidity(),e}#b(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#u(){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()}#y(){let t=this.validate(!1);return t===!0?"completed":t===!1?"incomplete":"not_attempted"}#v(){this._context={...this._context,variables:this._context.variables.map(t=>{if(t.type!=="outcome")return t;let n=("defaultValue"in t?t.defaultValue:null)??null;return n==null&&(t.baseType==="integer"||t.baseType==="float")&&(n="0"),{...t,value:n}})}}};Ze([p({type:String})],ut.prototype,"identifier",void 0);Ze([p({type:String})],ut.prototype,"adaptive",void 0);Ze([p({type:String,attribute:"time-dependent"})],ut.prototype,"timeDependent",void 0);Ze([p({type:String})],ut.prototype,"title",null);Ze([p({type:Boolean})],ut.prototype,"disabled",void 0);Ze([p({type:Boolean})],ut.prototype,"readonly",void 0);Ze([B({context:j})],ut.prototype,"_context",void 0);var td=q`
|
|
68
|
+
:host {
|
|
69
|
+
display: contents;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
::slotted(qti-catalog-info) {
|
|
73
|
+
display: none;
|
|
74
|
+
}
|
|
75
|
+
`;var Xn=class extends C{static{this.styles=td}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return b`<slot></slot>`}};function ed(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function rd(o,t,e,r="qti-portable-custom-interaction"){let n=[],i=o.querySelectorAll(r);if(i.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(i)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&n.includes(d)&&(d=d+n.length,c.setAttribute("custom-interaction-type-identifier",d),n.push(d)),d&&n.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}`),v=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of v){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],y=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",y),a&&a.paths&&a.paths[u]){let w=a.paths[u];Array.isArray(w)?x.setAttribute("fallback-path",w[0]):x.setAttribute("fallback-path",w)}}}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 y=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",y),a&&a.paths&&a.paths[x]){let w=a.paths[x];Array.isArray(w)?g.setAttribute("fallback-path",w[0]):g.setAttribute("fallback-path",w)}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],v="";a&&a.paths&&a.paths[f]&&(v=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(v)?v:[v],g=x.map((y,w)=>{let I=u.length>w?u[w]:"";return{primaryPath:y,fallbackPath:I}});for(let y of u)g.some(w=>w.fallbackPath===y)||g.push({primaryPath:x.length>0?x[0]:y,fallbackPath:y});for(let y of g){let w=o.createElement("qti-interaction-module");y.fallbackPath&&w.setAttribute("fallback-path",y.fallbackPath),w.setAttribute("id",f),w.setAttribute("primary-path",y.primaryPath),h&&h.appendChild(w)}}}}}function id(o,t,e){Array.from(o.getElementsByTagName("*")).filter(i=>i.localName===t||i.localName?.toLowerCase()===t.toLowerCase()).forEach(i=>{let s=`${t}-${e}`,a=od(i,s);i.replaceWith(a)})}function nd(o,t){o.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(n=>{if(n.startsWith(`${t}:`)){let i=n.slice(`${t}:`.length),s=`${e.nodeName}-${i}`,a=od(e,s);e.replaceWith(a)}})})}function od(o,t){let e=o.ownerDocument.createElement(t);for(let r of o.attributes)e.setAttribute(r.name,r.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function sd(o,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let n of e)o.querySelectorAll("["+n+"]").forEach(s=>{let a=s.getAttribute(n);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var tl=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=qu(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=xu(`${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 Yn(o){return tl.fromSeedKey(o)}function xu(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 ad(t)}function qu(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 ad(t)}function ad(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var Cu=o=>typeof o=="function"?o():o.random();function Kn(o,t){let e=o.filter(n=>!n.fixed);for(let n=e.length-1;n>0;n--){let i=Math.floor(Cu(t)*(n+1));[e[n],e[i]]=[e[i],e[n]]}let r=0;return o.map(n=>n.fixed?n:e[r++])}function Su(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 el(o,t){let e=o.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),n=t!=null&&`${t}`.length>0,i=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=Su(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let v=n?Yn(`${t}:${i}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(w=>w.parentElement!==null);if(x.filter(w=>w.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(w=>w.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,y=Kn(x.map(w=>({element:w,fixed:w.getAttribute("fixed")==="true"})),v);for(let w of x)w.remove();for(let{element:w}of y)u.insertBefore(w,g);h=!0}h&&a.removeAttribute("shuffle")}}function ld(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var cd=!1;function Jn(o,t){cd||(cd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function ku(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"),n=r.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??r.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(n)throw new Error(t(ku(n)));return r}function Rr(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 Or(o){return dd(o,t=>`Failed to parse XML: ${t}`)}function hd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let r=o,n;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?n=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):n=t.createElementNS(r.namespaceURI,r.tagName);for(let i=0;i<r.attributes.length;i++){let s=r.attributes[i];n.setAttribute(s.localName,s.value)}for(let i=0;i<r.childNodes.length;i++)n.appendChild(hd(r.childNodes[i],t,e));return n}return o.cloneNode(!1)}function Pr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild(hd(o.childNodes[r],document,t));return e}function Mr(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(r=>{for(let n of["src","href","srcset","poster"]){let i=r.getAttribute(n)?.trim();if(i&&!/^(data:|https?:|blob:)/.test(i)){let s=t+encodeURI(i);r.setAttribute(n,s)}}})}var Xt=()=>{let o,t="",e={load(r,n){return t=r,Rr(r,n).then(i=>(o=i,e))},parse(r){return o=Or(r),t="",e},path:r=>(Mr(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return sd(o,r),e},async configurePci(r,n,i="qti-portable-custom-interaction"){return await rd(o,r,n,i),e},shuffleInteractions(r){let n=typeof r=="string"?r.trim():r;if(n==null||n===""){let i=t||"default-item-seed";return Jn("qtiTransformItem",i),el(o,i),e}return el(o,n),e},extendElementName:(r,n)=>(id(o,r,n),e),extendElementsWithClass:(r="extend")=>(nd(o,r),e),customInteraction(r,n){let i=o.querySelector("qti-custom-interaction"),s=i.querySelector("object");return i.setAttribute("data-base-ref",r),i.setAttribute("data-base-item",r+n),i.setAttribute("data",s.getAttribute("data")),i.setAttribute("width",s.getAttribute("width")),i.setAttribute("height",s.getAttribute("height")),i.removeChild(s),e},convertCDATAtoComment(){return ed(o),e},stripStyleSheets(){return ld(o),e},html(){return t!==null&&Mr(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Pr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&Mr(o,t.substring(0,t.lastIndexOf("/"))),Pr(o,r)},xmlDoc(){return o}};return e};var pd=()=>{let o,t={async load(e,r){return o=await Rr(e,r),t},parse(e){o=Or(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function ud(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),n=e.getAttribute("href"),i=e.getAttribute("category");t.push({identifier:r,href:n,category:i})}),t}var Zn=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),md=o=>Zn(o,"qti-assessment-item-ref","assessmentitemref"),Mi=o=>Zn(o,"qti-assessment-section","assessmentsection"),Pi=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),Eu=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),rl=o=>Zn(o,"qti-ordering","ordering"),Au=o=>Zn(o,"qti-selection","selection"),Iu=o=>Array.from(o.children).filter(t=>rl(t)&&Pi(t,"shuffle")),_u=(o,t)=>Yn(`${o}:${t}`);function Tu(o){let t=[],e=[],r=n=>{for(let i of Array.from(n.children))md(i)?t.push(i):Mi(i)?r(i):!rl(i)&&!Au(i)&&e.push(i.localName)};return r(o),{itemRefs:t,dropped:e}}function Ru(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))Mi(l)&&fd(l,t);let e=Iu(o);if(e.length===0)return;let r=[],n=[];for(let l of Array.from(o.children))if(md(l))r.push({nodes:[l],fixed:Pi(l,"fixed")}),n.push(l);else if(Mi(l)){let{itemRefs:c,dropped:d}=Tu(l);if(Ru(l,d),Eu(l,"keep-together","keeptogether"))for(let h of c)r.push({nodes:[h],fixed:Pi(h,"fixed")});else c.length>0&&r.push({nodes:c,fixed:Pi(l,"fixed")});n.push(l)}let i=n.length>0?n[n.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=Kn(r,_u(t,s));for(let l of n)l.remove();for(let l of a)for(let c of l.nodes)o.insertBefore(c,i);for(let l of e)l.remove()}function gd(o){return Array.from(o.getElementsByTagName("*")).some(t=>rl(t)&&Pi(t,"shuffle"))}function il(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Mi(r));for(let r of e){if(!r.parentNode)continue;let n=r.parentElement;n&&Mi(n)||fd(r,t)}}var Dr=()=>{let o,t="",e={async load(r,n){return o=await Rr(r,n),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return o=Or(r),t="",e},path:r=>(Mr(o,r),e),fn(r){return r(o),e},shuffleOrdering(r){if(!gd(o))return e;let n=typeof r=="string"?r.trim():r;if(n==null||n===""){let i=t||"default-test-seed";return Jn("qtiTransformTest",i),il(o,i),e}return il(o,n),e},items(){return ud(o)},html(){return new XMLSerializer().serializeToString(Pr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return Pr(o,r)},xmlDoc(){return o}};return e};var bd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},nl=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}},Nr=class extends C{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new nl(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 Xt().load(this.href).then(n=>n.htmlDoc()))?.querySelector("qti-assessment-stimulus");r&&(t.innerHTML="",t.append(r))}};bd([p({type:String})],Nr.prototype,"identifier",void 0);bd([p({type:String})],Nr.prototype,"href",void 0);var to=class extends C{};var Ou=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Di=class extends C{render(){return b`<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(n=>n.type==="template");for(let n of e){let i=n;i.mathVariable!==!0||i.value===null||i.value===void 0||t.set(i.identifier,this.#e(i.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(n=>n.localName.toLowerCase()==="mi"||n.localName.toLowerCase()==="mn");for(let n of r){let i=n.getAttribute("data-qti-math-variable-source")??n.textContent?.trim()??"",s=t.get(i);if(!s)continue;if(n.localName.toLowerCase()==="mn"){n.textContent=s,n.setAttribute("data-qti-math-variable-source",i);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",i),n.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Ou([_({context:j,subscribe:!0}),T()],Di.prototype,"context",void 0);var yd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},$r=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
|
|
68
76
|
:host {
|
|
69
77
|
display: none;
|
|
70
78
|
}
|
|
71
|
-
`]}render(){return b`<slot></slot>`}};yd([p({type:String})]
|
|
79
|
+
`]}render(){return b`<slot></slot>`}};yd([p({type:String})],$r.prototype,"identifier",void 0);yd([p({type:String})],$r.prototype,"cardinality",void 0);var Pu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ni=class extends C{#t;render(){return b`<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:n=>this._context?.variables.find(i=>i.identifier===n)?.value??"",correct:n=>this._context?.variables.find(i=>i.identifier===n)?.correctResponse??""},r={getVariable:n=>this._context?.variables.find(i=>i.identifier===n),updateOutcomeVariable:(n,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:n,value:i}}))},updateResponseVariable:(n,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:n,response:i}}))}};return this.#t(this._context,e,r)}#e(t){let e=Jc(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let r=Array.from(this.children).map(n=>{let i=n.calculate;return typeof i=="function"?i.call(n):null});return e(r)}};Pu([_({context:j,subscribe:!0}),T()],Ni.prototype,"_context",void 0);var eo=class extends pt{static{this.styles=q`
|
|
72
80
|
:host {
|
|
73
81
|
display: block;
|
|
74
82
|
}
|
|
@@ -78,7 +86,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
78
86
|
.off {
|
|
79
87
|
display: none;
|
|
80
88
|
}
|
|
81
|
-
`}render(){return b` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var K=o=>o??P;var
|
|
89
|
+
`}render(){return b` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var K=o=>o??P;var ro=class extends pt{constructor(){super(...arguments),this.render=()=>b` <slot part="feedback" class="${K(this.showStatus)}"></slot> `}static{this.styles=q`
|
|
82
90
|
.on {
|
|
83
91
|
display: inline-block;
|
|
84
92
|
}
|
|
@@ -89,7 +97,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
89
97
|
:host {
|
|
90
98
|
display: block;
|
|
91
99
|
}
|
|
92
|
-
`;var
|
|
100
|
+
`;var io=class extends C{static{this.styles=vd}render(){return b`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Lr=class extends pt{static{this.styles=q`
|
|
93
101
|
.cito-dialog {
|
|
94
102
|
background: var(--qti-bg);
|
|
95
103
|
border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
|
|
@@ -134,11 +142,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
134
142
|
<button class="button close-button" @click="${this.closeFeedback}">Close</button>
|
|
135
143
|
</div>
|
|
136
144
|
</dialog>
|
|
137
|
-
`}openFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}closeFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&t.open&&(t.close(),this.showStatus="off")}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(t){t.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var $
|
|
145
|
+
`}openFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&!t.open&&t.showModal()}closeFeedback(){let t=this.shadowRoot?.querySelector("dialog");t&&t.open&&(t.close(),this.showStatus="off")}connectedCallback(){super.connectedCallback(),this.showStatus==="on"&&this.openFeedback()}updated(t){t.has("showStatus")&&(this.showStatus==="on"?this.openFeedback():this.closeFeedback())}};var $i=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},oe=class extends Ar{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[q`
|
|
138
146
|
:host {
|
|
139
147
|
display: none;
|
|
140
148
|
}
|
|
141
|
-
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return b`${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 n=parseFloat(r.getAttribute("source-value")),i=parseFloat(r.getAttribute("target-value"));if(Number.isNaN(n)||Number.isNaN(i)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:n,targetValue:i,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 n=parseFloat(r.getAttribute("source-value")),i=r.getAttribute("target-value");if(Number.isNaN(n)||i===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(n,i)}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}}))}};$
|
|
149
|
+
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return b`${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 n=parseFloat(r.getAttribute("source-value")),i=parseFloat(r.getAttribute("target-value"));if(Number.isNaN(n)||Number.isNaN(i)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:n,targetValue:i,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 n=parseFloat(r.getAttribute("source-value")),i=r.getAttribute("target-value");if(Number.isNaN(n)||i===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(n,i)}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}}))}};$i([p({type:String,attribute:"base-type"})],oe.prototype,"baseType",void 0);$i([p({type:String,attribute:"external-scored"})],oe.prototype,"externalScored",void 0);$i([p({type:String})],oe.prototype,"identifier",void 0);$i([p({type:String})],oe.prototype,"cardinality",void 0);$i([_({context:j,subscribe:!0}),T()],oe.prototype,"itemContext",void 0);var no=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},xe=class extends Ar{static{this.styles=[q`
|
|
142
150
|
:host {
|
|
143
151
|
display: none;
|
|
144
152
|
}
|
|
@@ -185,27 +193,27 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
185
193
|
<qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
|
|
186
194
|
</qti-set-outcome-value>
|
|
187
195
|
</qti-response-else>
|
|
188
|
-
</qti-response-condition>`;var
|
|
196
|
+
</qti-response-condition>`;var Mu={map_response:xd,map_response_point:qd,match_correct:wd},oo=class extends C{static{this.styles=[q`
|
|
189
197
|
:host {
|
|
190
198
|
display: none;
|
|
191
199
|
}
|
|
192
|
-
`]}render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];try{for(let r of e)r.process()}catch(r){if(!(r instanceof
|
|
200
|
+
`]}render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];try{for(let r of e)r.process()}catch(r){if(!(r instanceof Ir))throw r}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let r=e.split("/").pop().replace(".xml",""),n=Mu[r];n&&(this.innerHTML=n)}};function L(o,t){let e={waitUntilFirstUpdate:!1,...t};return(r,n)=>{let{update:i}=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[n](d,h)}}),i.call(this,a)}}}var Vr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Pt=o=>(...t)=>({_$litDirective$:o,values:t}),qe=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:Du}=tt,Cd=o=>o,kd=o=>o===null||typeof o!="object"&&typeof o!="function";var Ed=o=>o.strings===void 0,Sd=()=>document.createComment(""),zr=(o,t,e)=>{let r=o._$AA.parentNode,n=t===void 0?o._$AB:t._$AA;if(e===void 0){let i=r.insertBefore(Sd(),n),s=r.insertBefore(Sd(),n);e=new Du(i,s,o,o.options)}else{let i=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(i!==n||a){let l=e._$AA;for(;l!==i;){let c=Cd(l).nextSibling;Cd(r).insertBefore(l,n),l=c}}}return e},Ce=(o,t,e=o)=>(o._$AI(t,e),o),Nu={},Ad=(o,t=Nu)=>o._$AH=t,Id=o=>o._$AH,so=o=>{o._$AR(),o._$AA.remove()};var Li=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),Li(r,t);return!0},ao=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},_d=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),Vu(t)}};function $u(o){this._$AN!==void 0?(ao(this),this._$AM=o,_d(this)):this._$AM=o}function Lu(o,t=!1,e=0){let r=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(r))for(let i=e;i<r.length;i++)Li(r[i],!1),ao(r[i]);else r!=null&&(Li(r,!1),ao(r));else Li(this,o)}var Vu=o=>{o.type==Vr.CHILD&&(o._$AP??=Lu,o._$AQ??=$u)},Se=class extends qe{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),_d(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Li(this,t),ao(this))}setValue(t){if(Ed(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 ol=class extends Se{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:n}=this;for(let i in e){let s=e[i];s!==r[i]&&(s===!0?n.setAttribute(i,""):s===!1?n.removeAttribute(i):s!=null?n.setAttribute(i,String(s)):n.removeAttribute(i))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let n=t?this.#t(t):{};for(let i in e)(!n||!(i in n))&&r.removeAttribute(i)}#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)))}},rq=Pt(ol);var Vi=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},se=class extends C{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{let r=new CustomEvent("qti-rubric:discretionary-placement",{detail:{className:e,element:this},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(r))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=q`
|
|
193
201
|
:host {
|
|
194
202
|
display: block;
|
|
195
203
|
}
|
|
196
|
-
`}render(){return b`<slot></slot>`}};
|
|
204
|
+
`}render(){return b`<slot></slot>`}};Vi([p({type:String})],se.prototype,"id",void 0);Vi([p({type:String})],se.prototype,"use",void 0);Vi([p({type:String})],se.prototype,"view",void 0);Vi([p({type:String,attribute:"class"})],se.prototype,"classNames",void 0);Vi([L("classNames",{waitUntilFirstUpdate:!0})],se.prototype,"handleclassNamesChange",null);var lo=class extends C{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(r=>r.text()).then(r=>{let n=this.#e(r);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${n}}`,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 co=class extends C{render(){return b`<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 zi=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ae=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[q`
|
|
197
205
|
:host {
|
|
198
206
|
display: none;
|
|
199
207
|
}
|
|
200
|
-
`]}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#
|
|
208
|
+
`]}render(){return b`<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}}};zi([p({type:String})],ae.prototype,"identifier",void 0);zi([p({type:String})],ae.prototype,"cardinality",void 0);zi([p({type:String,attribute:"base-type"})],ae.prototype,"baseType",void 0);zi([p({type:Boolean,attribute:"math-variable"})],ae.prototype,"mathVariable",void 0);zi([p({type:Boolean,attribute:"param-variable"})],ae.prototype,"paramVariable",void 0);var ho=class extends C{static{this.styles=[q`
|
|
201
209
|
:host {
|
|
202
210
|
display: none;
|
|
203
211
|
}
|
|
204
|
-
`]}#t=100;render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let 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 n=[...this.children];for(let i of n)if(i.tagName.toLowerCase()==="qti-template-constraint"){if(i.calculate()===!1){r=!0;break}}else i.process()}catch(n){console.error("Error during template processing:",n);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
|
|
212
|
+
`]}#t=100;render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let 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 n=[...this.children];for(let i of n)if(i.tagName.toLowerCase()==="qti-template-constraint"){if(i.calculate()===!1){r=!0;break}}else i.process()}catch(n){console.error("Error during template processing:",n);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 Td=[{tag:"qti-assessment-item",ctor:ut},{tag:"qti-assessment-stimulus",ctor:Xn},{tag:"qti-assessment-stimulus-ref",ctor:Nr},{tag:"qti-companion-materials-info",ctor:to},{tag:"qti-content-body",ctor:Di},{tag:"qti-context-declaration",ctor:$r},{tag:"qti-custom-operator",ctor:Ni},{tag:"qti-feedback-block",ctor:eo},{tag:"qti-feedback-inline",ctor:ro},{tag:"qti-item-body",ctor:io},{tag:"qti-modal-feedback",ctor:Lr},{tag:"qti-outcome-declaration",ctor:oe},{tag:"qti-response-declaration",ctor:xe},{tag:"qti-response-processing",ctor:oo},{tag:"qti-rubric-block",ctor:se},{tag:"qti-stylesheet",ctor:lo},{tag:"qti-template-constraint",ctor:co},{tag:"qti-template-declaration",ctor:ae},{tag:"qti-template-processing",ctor:ho}];var po=class extends Lr{static{this.styles=q`
|
|
205
213
|
:host {
|
|
206
214
|
color: gray;
|
|
207
215
|
}
|
|
208
|
-
`}render(){return b``}};var co=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},qe=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};co([p({type:String})],qe.prototype,"identifier",void 0);co([p({type:String})],qe.prototype,"class",void 0);co([p({type:String,attribute:"navigation-mode"})],qe.prototype,"navigationMode",void 0);co([p({type:String,attribute:"submission-mode"})],qe.prototype,"submissionMode",void 0);var Tu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},zn=class extends E{#t=null;constructor(){super(),this.addEventListener("qti-assessment-test-connected",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"),n=Ui(t,Bi(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new el(this._testContext,r,n).calculate()}calculate(){return this.getResult()}};Tu([_({context:st,subscribe:!0})],zn.prototype,"_testContext",void 0);var el=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(n=>n.item))];return t.forEach(n=>{if(r.includes(n.identifier)){let i=n.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===n.identifier)?.weight??1;if(i){let a=Number(i.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var ho=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},kd=o=>{class t extends o{constructor(...r){super(...r),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(r,n){let i=n||this._getDefaultNavigationId(r);i&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_bindEventHandlers(){this.addEventListener("qti-request-navigation",this._handleNavigationRequest.bind(this)),this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(r){this._testElement=r.detail,this._initializeNavigation()}_handleItemConnected(r){let n=r.detail;this._loadingState.connectedItems++;let i=n.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=i.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:n,item:i}=r;if(console.info("Stimulus ref connected:",{identifier:n.identifier,href:n.href,item:i.identifier}),this._loadedStimulusHrefs.has(n.href)){console.info("Stimulus already loaded, skipping:",n.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(n.href)){console.info("Stimulus already loading, skipping duplicate:",n.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(n.href),console.info("Starting stimulus load:",n.href);try{await this._loadStimulusRef(n,i),this._loadedStimulusHrefs.add(n.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",n.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${n.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(n.href)}}_getDefaultNavigationId(r){return r==="section"?this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let r=this._getDefaultNavigationId(this.navigate);r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,n){let i=this.sessionContext?.navItemRefId;if(!i||r==="item"&&n===i)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),c=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||c?.navigationMode||c?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===i);if(r==="item"){let f=d.findIndex(m=>m.identifier===n);return f===-1||h===-1?!1:f!==h+1}return!0}async _handleNavigationRequest({detail:r}){if(!r?.id)return;if(this._isLinearNavigationRestricted(r.type,r.id)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let n=++this._navigationId,i=new AbortController;try{this._dispatchLoadingStarted(r.type,r.id),this._activeController=i,await this._executeNavigation(r.type,r.id,n,i)}catch(s){this._handleNavigationError(s,r.type,r.id)}finally{this._activeController===i&&(this._activeController=null),this._dispatchLoadingEnded(r.type,r.id)}}_handleNavigationError(r,n,i){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,n,i))}async _executeNavigation(r,n,i,s){r==="item"?await this._navigateToItem(n,i,s):await this._navigateToSection(n,i,s)}async _navigateToItem(r,n,i){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],n,i),await this._waitForLoadingComplete(n,i),!this._isStaleNavigation(n,i)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(r,n,i){let a=this._findSection(r)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:null};let c=this._getSectionItemIds(r);this._resetLoadingState(),this._loadingState.expectedItems=c.length,await this._loadItems(c,n,i),await this._waitForLoadingComplete(n,i),!this._isStaleNavigation(n,i)&&this._dispatchTestLoaded(this._loadResults)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let r=this._loadingState.connectedItems>=this._loadingState.expectedItems,n=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&n&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,n){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,n))return;await new Promise(i=>setTimeout(i,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,n){console.info("Loading stimulus:",r.href);let i=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",i?"has content":"no content"),this._applyStimulusContent(i,r,n)}_applyStimulusContent(r,n,i){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelectorAll("qti-stimulus-body, qti-stylesheet");if(console.info(`Found ${s.length} stimulus elements to apply for ${n.identifier}`),s.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let a=[],c=i.querySelector(`[data-stimulus-idref="${n.identifier}"]`);if(c)a.push(c),console.info("Found specific target:",c);else{let l=Array.from(this.querySelectorAll(`[data-stimulus-idref="${n.identifier}"]`));if(l.length>0)a=l,console.info("Found targets by identifier:",l.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((l,d)=>{l.innerHTML="";let h=Array.from(s).map(f=>f.cloneNode(!0));l.append(...h),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,n,i){if(!this._testElement||r.length===0)return;let s=r.map(l=>this._findItemRef(l));this._clearLoadedItems(),this._clearStimulusRef();let c=(await Promise.all(s.map(l=>this._loadSingleItem(l,n,i)))).filter(Boolean);this._isStaleNavigation(n,i)||(c.forEach(({itemRef:l,doc:d})=>{l&&d&&(l.xmlDoc=d)}),c.forEach(({itemRef:l})=>{let d=l?.identifier;if(!l||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&l.updateComplete.then(()=>{let f=l.assessmentItem;f&&(f.state=h)})}),this._loadResults=c)}async _loadSingleItem(r,n,i){try{let s=this.querySelector("test-navigation")?.qtiContext?.QTI_CONTEXT?.seed,a=(await Qt().load(r.href,i.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(n,i)?null:{itemRef:r,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${r.identifier} was aborted`),s;return console.warn(`Failed to load item ${r.identifier}:`,s),null}}async _loadStimulus(r){return(await Qt().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 n=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!n)throw new Error(`Item with identifier "${r}" not found`);return n}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,n){let i=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:i,navSectionId:s,navItemRefId:n}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(n=>n.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(n=>{n.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,n){return n.signal.aborted||r!==this._navigationId}_createNavigationError(r,n,i){return{message:r.message||`Failed to load ${n}: ${i}`,details:r,itemId:n==="item"?i:void 0,sectionId:n==="section"?i:void 0}}_dispatchLoadingStarted(r,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:r,id:n},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(r,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:n},bubbles:!0,composed:!0}))}_dispatchError(r){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:r,bubbles:!0,composed:!0}))}_dispatchTestLoaded(r){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:r.map(({itemRef:n})=>({identifier:n?.identifier,element:n})),bubbles:!0,composed:!0}))})}}return ho([p({type:String})],t.prototype,"navigate",void 0),ho([p({type:Number})],t.prototype,"requestTimeout",void 0),ho([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),ho([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var Sd=o=>{class t extends o{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",n=>{this.sessionContext={...this.sessionContext,view:n.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",n=>{this._updateElementView(),this._setCorrectResponseVisibility(n.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 i=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;i&&this.updateAssessmentItemView(i,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,n){}}return t};var Ed=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},rl=o=>{class t extends o{constructor(...r){super(...r),this.testContext=$a,this.sessionContext=Na,this._updateItemInTestContext=n=>{let i=n._context,s=i.identifier,a=i.variables,c=this.testContext.items.find(l=>l?.identifier===s);if(!c){console.warn(`Item IDs between assessment.xml and item.xml should match: ${s} is not found!`);return}if(c.variables?.length===1)this._updateItemVariablesInTestContext(s,a);else{let l=[...n.variables];for(let d of c.variables){let h=l.find(f=>f.identifier===d.identifier);h?h.value=d.value:l.push(d)}n.variables=l}},this._initializeEventListeners()}updateItemVariables(r,n){let i=this.testContext.items.find(a=>a.identifier===r);i&&(i.variables=i.variables.map(a=>{let c=n.find(l=>l.identifier===a.identifier);return c?{...a,...c}:a}));let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);s&&s.assessmentItem&&(s.assessmentItem.variables=n)}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=$a,this.sessionContext=Na}),this.addEventListener("qti-assessment-test-connected",r=>{this._testElement=r.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(i=>({href:i.href,identifier:i.identifier,category:i.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:n}}),this.addEventListener("qti-assessment-item-connected",r=>{let n=r.detail,i=n.closest("qti-assessment-item-ref")?.identifier;i&&(n.assessmentItemRefId=i),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables,r.detail.itemContext.state)})}_updateItemVariablesInTestContext(r,n,i){this.testContext={...this.testContext,items:this.testContext.items.map(s=>s.identifier!==r?s:{...s,variables:n.map(a=>{let c=s.variables.find(l=>l.identifier===a.identifier);return c?{...c,...a}:a}),...i!==void 0?{state:i?{...i}:void 0}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return Ed([p({attribute:!1,type:Object}),B({context:st})],t.prototype,"testContext",void 0),Ed([p({attribute:!1,type:Object}),B({context:Bt})],t.prototype,"sessionContext",void 0),t},Ad=class extends rl(C){};var Id=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",n=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],n.detail.variable]},n.stopPropagation()}),this.addEventListener("qti-set-outcome-value",n=>{let{outcomeIdentifier:i,value:s}=n.detail;this.updateOutcomeVariable(i,s),n.stopPropagation()})}outcomeProcessing(){let r=this.querySelector("qti-outcome-processing");return r?(r?.process(),!0):!1}updateOutcomeVariable(r,n){let i=this.getOutcome(r);if(!i){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:i.cardinality==="single"?n:[...s.value,n]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(n=>n.identifier===r)||null}}return t};var Ru=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ke=class extends kd(Sd(Id(rl(C)))){constructor(){super(...arguments),this.configContext={}}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return b`<slot></slot>`}};Ru([T(),B({context:yt})],Ke.prototype,"configContext",void 0);var _d=q`
|
|
216
|
+
`}render(){return b``}};var uo=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ke=class extends C{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return b` <slot></slot>`}};uo([p({type:String})],ke.prototype,"identifier",void 0);uo([p({type:String})],ke.prototype,"class",void 0);uo([p({type:String,attribute:"navigation-mode"})],ke.prototype,"navigationMode",void 0);uo([p({type:String,attribute:"submission-mode"})],ke.prototype,"submissionMode",void 0);var zu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ji=class extends E{#t=null;constructor(){super(),this.addEventListener("qti-assessment-test-connected",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"),n=Wn(t,Hn(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new sl(this._testContext,r,n).calculate()}calculate(){return this.getResult()}};zu([_({context:ot,subscribe:!0})],ji.prototype,"_testContext",void 0);var sl=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(n=>n.item))];return t.forEach(n=>{if(r.includes(n.identifier)){let i=n.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===n.identifier)?.weight??1;if(i){let a=Number(i.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var mo=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Rd=o=>{class t extends o{constructor(...r){super(...r),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(r,n){let i=n||this._getDefaultNavigationId(r);i&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_bindEventHandlers(){this.addEventListener("qti-request-navigation",this._handleNavigationRequest.bind(this)),this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(r){this._testElement=r.detail,this._initializeNavigation()}_handleItemConnected(r){let n=r.detail;this._loadingState.connectedItems++;let i=n.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=i.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:n,item:i}=r;if(console.info("Stimulus ref connected:",{identifier:n.identifier,href:n.href,item:i.identifier}),this._loadedStimulusHrefs.has(n.href)){console.info("Stimulus already loaded, skipping:",n.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(n.href)){console.info("Stimulus already loading, skipping duplicate:",n.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(n.href),console.info("Starting stimulus load:",n.href);try{await this._loadStimulusRef(n,i),this._loadedStimulusHrefs.add(n.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",n.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${n.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(n.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);r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,n){let i=this.sessionContext?.navItemRefId;if(!i||r==="item"&&n===i)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),l=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||l?.navigationMode||l?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===i);if(r==="item"){let f=d.findIndex(m=>m.identifier===n);return f===-1||h===-1?!1:f!==h+1}return!0}async _handleNavigationRequest({detail:r}){if(!r?.id)return;if(this._isLinearNavigationRestricted(r.type,r.id)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let n=++this._navigationId,i=new AbortController;try{this._dispatchLoadingStarted(r.type,r.id),this._activeController=i,await this._executeNavigation(r.type,r.id,n,i)}catch(s){this._handleNavigationError(s,r.type,r.id)}finally{this._activeController===i&&(this._activeController=null),this._dispatchLoadingEnded(r.type,r.id)}}_handleNavigationError(r,n,i){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,n,i))}async _executeNavigation(r,n,i,s){r==="item"?await this._navigateToItem(n,i,s):await this._navigateToSection(n,i,s)}async _navigateToItem(r,n,i){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],n,i),await this._waitForLoadingComplete(n,i),!this._isStaleNavigation(n,i)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(r,n,i){let a=this._findSection(r)?.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:null};let l=this._getSectionItemIds(r);this._resetLoadingState(),this._loadingState.expectedItems=l.length,await this._loadItems(l,n,i),await this._waitForLoadingComplete(n,i),!this._isStaleNavigation(n,i)&&this._dispatchTestLoaded(this._loadResults)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let r=this._loadingState.connectedItems>=this._loadingState.expectedItems,n=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&n&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,n){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,n))return;await new Promise(i=>setTimeout(i,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,n){console.info("Loading stimulus:",r.href);let i=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",i?"has content":"no content"),this._applyStimulusContent(i,r,n)}_applyStimulusContent(r,n,i){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=i.querySelector(`[data-stimulus-idref="${n.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${n.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,n,i){if(!this._testElement||r.length===0)return;let s=r.map(c=>this._findItemRef(c));this._clearLoadedItems(),this._clearStimulusRef();let l=(await Promise.all(s.map(c=>this._loadSingleItem(c,n,i)))).filter(Boolean);this._isStaleNavigation(n,i)||(l.forEach(({itemRef:c,doc:d})=>{c&&d&&(c.xmlDoc=d)}),l.forEach(({itemRef:c})=>{let d=c?.identifier;if(!c||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&c.updateComplete.then(()=>{let f=c.assessmentItem;f&&(f.state=h)})}),this._loadResults=l)}async _loadSingleItem(r,n,i){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Xt().load(r.href,i.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(n,i)?null:{itemRef:r,doc:a.htmlDoc(this._customElementRegistry())}}catch(s){if(s.name==="AbortError")throw console.info(`Item load for ${r.identifier} was aborted`),s;return console.warn(`Failed to load item ${r.identifier}:`,s),null}}async _loadStimulus(r){return(await Xt().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 n=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!n)throw new Error(`Item with identifier "${r}" not found`);return n}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,n){let i=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:i,navSectionId:s,navItemRefId:n}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(n=>n.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(n=>{n.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,n){return n.signal.aborted||r!==this._navigationId}_createNavigationError(r,n,i){return{message:r.message||`Failed to load ${n}: ${i}`,details:r,itemId:n==="item"?i:void 0,sectionId:n==="section"?i:void 0}}_dispatchLoadingStarted(r,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:r,id:n},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(r,n){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:n},bubbles:!0,composed:!0}))}_dispatchError(r){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:r,bubbles:!0,composed:!0}))}_dispatchTestLoaded(r){requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:r.map(({itemRef:n})=>({identifier:n?.identifier,element:n})),bubbles:!0,composed:!0}))})}}return mo([p({type:String})],t.prototype,"navigate",void 0),mo([p({type:Number})],t.prototype,"requestTimeout",void 0),mo([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),mo([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var Od=o=>{class t extends o{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",n=>{this.sessionContext={...this.sessionContext,view:n.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",n=>{this._updateElementView(),this._setCorrectResponseVisibility(n.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 i=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;i&&this.updateAssessmentItemView(i,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,n){}}return t};var Pd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},al=o=>{class t extends o{constructor(...r){super(...r),this.testContext=Fa,this.sessionContext=ja,this._updateItemInTestContext=n=>{let i=n.itemContext,s=i.identifier,a=i.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,i.valid);else{let c=[...n.variables];for(let d of l.variables){let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}n.variables=c,l.state&&(n.state=l.state)}},this._initializeEventListeners()}updateItemVariables(r,n,i){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 n){let f=l.findIndex(v=>v.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,...i?{state:{...i}}:{}}})};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??[]],i&&(s.state=i))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=Fa,this.sessionContext=ja}),this.addEventListener("qti-assessment-test-connected",r=>{this._testElement=r.detail;let n=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(i=>({href:i.href,identifier:i.identifier,category:i.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:n}}),this.addEventListener("qti-assessment-item-connected",r=>{let n=r.detail,i=n.closest("qti-assessment-item-ref")?.identifier;i&&(n.assessmentItemRefId=i),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,n,i,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:n.map(l=>{let c=a.variables.find(d=>d.identifier===l.identifier);return c?{...c,...l}:l}),...i!==void 0?{state:i?{...i}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return Pd([p({attribute:!1,type:Object}),B({context:ot})],t.prototype,"testContext",void 0),Pd([p({attribute:!1,type:Object}),B({context:Ht})],t.prototype,"sessionContext",void 0),t},Md=class extends al(C){};var fo=1;var ll=o=>Array.isArray(o)?[...o]:o??null,ju=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},Fu=(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:ll(r.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:ll(e.value)}))},session:{...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),Dd=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}),this.addEventListener("qti-assessment-test-connected",()=>{this.#t&&(this.#i(this.#t),this.#t=null),this.#e=!0})}get state(){return Fu(this.testContext,this.sessionContext)}set state(r){if(!ju(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:n,navSectionId:i}=this.sessionContext;this.#i(r);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==n?this.#o("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==i&&this.#o("section",s.navSectionId)}updated(r){if(super.updated(r),!this.#e||!(r.has("testContext")||r.has("sessionContext")))return;let n=this.state,i=JSON.stringify(n);i!==this.#r&&(this.#r=i,this.dispatchEvent(new CustomEvent("qti-state-changed",{detail:n,bubbles:!0,composed:!0})))}#i(r){for(let i of r.test.items)this.updateItemVariables(i.identifier,i.variables,i.state);let n=new Map(r.test.outcomes.map(i=>[i.identifier,i.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>n.has(i.identifier)?{...i,value:ll(n.get(i.identifier))}:i)},this.sessionContext={...this.sessionContext,...this.#n(r.session)}}#n(r){let n=(i,s)=>!!s&&!!this._testElement?.querySelector(`${i}[identifier="${CSS.escape(s)}"]`);return{...n("qti-test-part",r.navPartId)?{navPartId:r.navPartId}:{},...n("qti-assessment-section",r.navSectionId)?{navSectionId:r.navSectionId}:{},...this.testContext.items.some(i=>i.identifier===r.navItemRefId)?{navItemRefId:r.navItemRefId}:{}}}#o(r,n){this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:r,id:n},bubbles:!0,composed:!0}))}}return t};var Nd=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",n=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],n.detail.variable]},n.stopPropagation()}),this.addEventListener("qti-set-outcome-value",n=>{let{outcomeIdentifier:i,value:s}=n.detail;this.updateOutcomeVariable(i,s),n.stopPropagation()})}outcomeProcessing(){let r=(this._testElement??this).querySelector("qti-outcome-processing");return r?(r?.process(),!0):!1}updateOutcomeVariable(r,n){let i=this.getOutcome(r);if(!i){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:i.cardinality==="single"?n:[...s.value,n]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(n=>n.identifier===r)||null}}return t};var $d=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ee=class extends Rd(Od(Nd(Dd(al(C))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new be(this,{context:xt,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return b`<slot></slot>`}};$d([T(),B({context:vt})],Ee.prototype,"configContext",void 0);$d([T(),B({context:wt})],Ee.prototype,"qtiContext",void 0);var Ld=q`
|
|
209
217
|
display: inline-flex;
|
|
210
218
|
align-items: center;
|
|
211
219
|
justify-content: center;
|
|
@@ -218,37 +226,37 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
218
226
|
cursor: pointer;
|
|
219
227
|
user-select: none;
|
|
220
228
|
border-radius: var(--test-button-border-radius, var(--qti-component-border-radius, 0.2rem));
|
|
221
|
-
`,
|
|
222
|
-
${
|
|
229
|
+
`,st=q`
|
|
230
|
+
${Ld};
|
|
223
231
|
background-color: var(--test-button-background-color, var(--qti-component-background-color, #fff));
|
|
224
232
|
color: var(--test-button-color, var(--qti-component-color, inherit));
|
|
225
233
|
border: var(--qti-component-border-width, 1px) var(--qti-component-border-style, solid)
|
|
226
234
|
var(--test-button-border-color, var(--qti-component-border-color, #0175aa));
|
|
227
|
-
`,
|
|
235
|
+
`,at=q`
|
|
228
236
|
background-color: var(--test-button-hover-background-color, var(--qti-bg-active, #f2f8fb));
|
|
229
|
-
`,
|
|
237
|
+
`,lt=q`
|
|
230
238
|
outline: var(--qti-focus-border-width, 2px) solid var(--qti-focus-color, #007ac3);
|
|
231
239
|
outline-offset: 2px;
|
|
232
|
-
`,
|
|
240
|
+
`,ct=q`
|
|
233
241
|
cursor: not-allowed;
|
|
234
242
|
opacity: 0.45;
|
|
235
|
-
`,
|
|
236
|
-
${
|
|
243
|
+
`,_0=q`
|
|
244
|
+
${Ld};
|
|
237
245
|
border: 1px solid gray;
|
|
238
|
-
`;var
|
|
246
|
+
`;var Bu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},er=class extends C{static{this.styles=q`
|
|
239
247
|
:host {
|
|
240
|
-
${
|
|
248
|
+
${st};
|
|
241
249
|
}
|
|
242
250
|
:host(:hover:not([disabled])) {
|
|
243
|
-
${
|
|
251
|
+
${at};
|
|
244
252
|
}
|
|
245
253
|
:host(:focus-visible) {
|
|
246
|
-
${
|
|
254
|
+
${lt};
|
|
247
255
|
}
|
|
248
256
|
:host([disabled]) {
|
|
249
|
-
${
|
|
257
|
+
${ct};
|
|
250
258
|
}
|
|
251
|
-
`}constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}));let
|
|
259
|
+
`}constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}));let t=this.testHost?.querySelector("test-container");if(!t)return;Array.from(t.shadowRoot.querySelectorAll("[view]")).forEach(r=>{r.classList.toggle("show",!0)})})}render(){return b` <slot></slot> `}};Bu([_({context:xt,subscribe:!0})],er.prototype,"testHost",void 0);var go=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},bo=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 Vd=o=>!kd(o)&&typeof o.then=="function",zd=1073741823,cl=class extends Se{constructor(){super(...arguments),this._$Cwt=zd,this._$Cbt=[],this._$CK=new go(this),this._$CX=new bo}render(...t){return t.find(e=>!Vd(e))??et}update(t,e){let r=this._$Cbt,n=r.length;this._$Cbt=e;let i=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(!Vd(l))return this._$Cwt=a,l;a<n&&l===r[a]||(this._$Cwt=zd,n=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=i.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return et}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},yo=Pt(cl);var vo=`
|
|
252
260
|
@layer qti-base, qti-components, qti-extended;
|
|
253
261
|
|
|
254
262
|
@layer qti-components.reset, qti-components.global, qti-components.interactions.base,
|
|
@@ -6321,57 +6329,62 @@ div.full-correct-response-inline {
|
|
|
6321
6329
|
display: inline-block;
|
|
6322
6330
|
}
|
|
6323
6331
|
}
|
|
6324
|
-
`;var
|
|
6332
|
+
`;var Ae=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},St=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.testURL=null,this.testDoc=null,this.testXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleTestURLChange(){if(this.testURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Dr().load(this.testURL)).shuffleOrdering(t),r=this.testHost;if(r?.postLoadTestTransformCallback){let i=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");i&&(e=await r.postLoadTestTransformCallback(e,i))}this.#r(e.htmlDoc(this.#e??void 0))}catch(t){console.error("Error loading or parsing XML:",t)}}#r(t){this.testDoc=t,this.dispatchEvent(new CustomEvent("qti-testdoc-loaded",{bubbles:!0,composed:!0}))}handleTestXMLChange(){if(this.testXML)try{let t=this.qtiContext?.QTI_CONTEXT?.seed;this.#r(Dr().parse(this.testXML).shuffleOrdering(t).htmlDoc(this.#e??void 0))}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#i(),this.#n(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:b``}#n(){let t=new CSSStyleSheet;t.replaceSync(vo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
|
|
6325
6333
|
${this.#t}
|
|
6326
6334
|
<slot></slot>
|
|
6327
|
-
${
|
|
6328
|
-
`}};
|
|
6335
|
+
${yo(this.testDoc,b`<span>Loading...</span>`)}
|
|
6336
|
+
`}};Ae([p({attribute:!1})],St.prototype,"customElementRegistry",void 0);Ae([p({type:String,attribute:"test-url"})],St.prototype,"testURL",void 0);Ae([T()],St.prototype,"testDoc",void 0);Ae([T()],St.prototype,"testXML",void 0);Ae([_({context:xt,subscribe:!0})],St.prototype,"testHost",void 0);Ae([T(),_({context:wt,subscribe:!0})],St.prototype,"qtiContext",void 0);Ae([L("testURL",{waitUntilFirstUpdate:!0})],St.prototype,"handleTestURLChange",null);Ae([L("testXML",{waitUntilFirstUpdate:!0})],St.prototype,"handleTestXMLChange",null);var dl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},rr=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
|
|
6329
6337
|
:host {
|
|
6330
|
-
${
|
|
6338
|
+
${st};
|
|
6331
6339
|
}
|
|
6332
6340
|
:host(:hover:not([disabled])) {
|
|
6333
|
-
${
|
|
6341
|
+
${at};
|
|
6334
6342
|
}
|
|
6335
6343
|
:host(:focus-visible) {
|
|
6336
|
-
${
|
|
6344
|
+
${lt};
|
|
6337
6345
|
}
|
|
6338
6346
|
:host([disabled]) {
|
|
6339
|
-
${
|
|
6347
|
+
${ct};
|
|
6340
6348
|
}
|
|
6341
|
-
`}constructor(){super(),this._internalDisabled=!1,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}))})}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.flatMap(a=>a.items),r=e.findIndex(a=>a.active),n=e[r];if(!n){this._internalDisabled=!1;return}let i=n.maxAttempts??1,s=n.numAttempts||0;if(!n.adaptive&&n.optimal){this._internalDisabled=!0;return}if(!n.adaptive&&i>0&&s>=i){this._internalDisabled=!0;return}n.allowSkipping===!1?this._internalDisabled=n.valid===!1||n.isDefaultResponse:this._internalDisabled=!1}render(){return b` <slot></slot> `}};
|
|
6349
|
+
`}constructor(){super(),this._internalDisabled=!1,this.addEventListener("click",t=>{t.preventDefault(),this._internalDisabled||this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}))})}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts.find(a=>a.active);if(!t)return;let e=t.sections.flatMap(a=>a.items),r=e.findIndex(a=>a.active),n=e[r];if(!n){this._internalDisabled=!1;return}let i=n.maxAttempts??1,s=n.numAttempts||0;if(!n.adaptive&&n.optimal){this._internalDisabled=!0;return}if(!n.adaptive&&i>0&&s>=i){this._internalDisabled=!0;return}n.allowSkipping===!1?this._internalDisabled=n.valid===!1||n.isDefaultResponse:this._internalDisabled=!1}render(){return b` <slot></slot> `}};dl([_({context:z,subscribe:!0}),p({attribute:!1})],rr.prototype,"computedContext",void 0);dl([p({type:Boolean,reflect:!0,attribute:"disabled"})],rr.prototype,"_internalDisabled",void 0);dl([L("computedContext")],rr.prototype,"_handleTestElementChange",null);var Uu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Fi=class extends C{static{this.styles=q`
|
|
6342
6350
|
:host {
|
|
6343
|
-
${
|
|
6351
|
+
${st};
|
|
6344
6352
|
}
|
|
6345
6353
|
:host(:hover:not([disabled])) {
|
|
6346
|
-
${
|
|
6354
|
+
${at};
|
|
6347
6355
|
}
|
|
6348
6356
|
:host(:focus-visible) {
|
|
6349
|
-
${
|
|
6357
|
+
${lt};
|
|
6350
6358
|
}
|
|
6351
6359
|
:host([disabled]) {
|
|
6352
|
-
${
|
|
6360
|
+
${ct};
|
|
6353
6361
|
}
|
|
6354
|
-
`}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return b` <slot></slot> `}};
|
|
6355
|
-
::highlight(${
|
|
6356
|
-
::highlight(${
|
|
6357
|
-
`)),
|
|
6358
|
-
|
|
6362
|
+
`}constructor(){super(),this.itemId=null,this.addEventListener("click",()=>this._requestItem(this.itemId))}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return b` <slot></slot> `}};Uu([p({type:String,attribute:"item-id"})],Fi.prototype,"itemId",void 0);var ir=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},xo="tts-element",qo="tts-word",wo=null;function Hu(){return wo||(wo=new CSSStyleSheet,wo.replaceSync(`
|
|
6363
|
+
::highlight(${xo}) { background-color: #dbeafe; color: inherit; }
|
|
6364
|
+
::highlight(${qo}) { background-color: #ffe066; color: inherit; }
|
|
6365
|
+
`)),wo}var jd=Symbol("tts-context"),Wu={play:"M8 5v14l11-7z",pause:"M6 5h4v14H6zM14 5h4v14h-4z",stop:"M6 6h12v12H6z",prev:"M6 5h2v14H6zM20 5v14L9 12z",next:"M16 5h2v14h-2zM4 5v14l11-7z",pick:"M5 3l13 7-5.5 1.6 3.4 6.6-2.4 1.3-3.4-6.7L6 17z"},Ie=(o,t)=>{let e=b`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
6366
|
+
<path d="${Wu[o]}"></path>
|
|
6367
|
+
</svg>`;return b`${e}<span class="label">${t}</span>`},Mt=class extends C{static{this.styles=q`
|
|
6359
6368
|
:host {
|
|
6360
6369
|
display: inline-flex;
|
|
6361
6370
|
}
|
|
6362
6371
|
button {
|
|
6363
|
-
${
|
|
6372
|
+
${st};
|
|
6364
6373
|
min-inline-size: var(--test-button-size, 2.25rem);
|
|
6365
6374
|
padding-inline: 0.5rem;
|
|
6375
|
+
/* Containing block for the visually hidden .label. Without it the label is placed against
|
|
6376
|
+
the nearest positioned ancestor, which can sit outside a scroll container and make the
|
|
6377
|
+
page as tall as the scrolled content. */
|
|
6378
|
+
position: relative;
|
|
6366
6379
|
}
|
|
6367
6380
|
button:hover:not(:disabled) {
|
|
6368
|
-
${
|
|
6381
|
+
${at};
|
|
6369
6382
|
}
|
|
6370
6383
|
button:focus-visible {
|
|
6371
|
-
${
|
|
6384
|
+
${lt};
|
|
6372
6385
|
}
|
|
6373
6386
|
button:disabled {
|
|
6374
|
-
${
|
|
6387
|
+
${ct};
|
|
6375
6388
|
}
|
|
6376
6389
|
button[aria-pressed='true'],
|
|
6377
6390
|
button[aria-pressed='true']:hover {
|
|
@@ -6396,93 +6409,93 @@ div.full-correct-response-inline {
|
|
|
6396
6409
|
clip-path: inset(50%);
|
|
6397
6410
|
white-space: nowrap;
|
|
6398
6411
|
}
|
|
6399
|
-
`}#t=this.attachInternals();#e;#r=!1;updated(t){let e=this._tts?.state,r=this._tts?.picking??!1;e===this.#e&&r===this.#r||(this.#e=e,this.#r=r,this.#t.states.clear(),e&&this.#t.states.add(e),r&&this.#t.states.add("picking"))}};
|
|
6412
|
+
`}#t=this.attachInternals();#e;#r=!1;updated(t){let e=this._tts?.state,r=this._tts?.picking??!1;e===this.#e&&r===this.#r||(this.#e=e,this.#r=r,this.#t.states.clear(),e&&this.#t.states.add(e),r&&this.#t.states.add("picking"))}};ir([p({type:String})],Mt.prototype,"label",void 0);ir([_({context:jd,subscribe:!0})],Mt.prototype,"_tts",void 0);var _e=class extends C{static{this.styles=q`
|
|
6400
6413
|
:host {
|
|
6401
6414
|
display: inline-flex;
|
|
6402
6415
|
flex-wrap: wrap;
|
|
6403
6416
|
align-items: center;
|
|
6404
6417
|
gap: var(--test-tts-gap, 0.25rem);
|
|
6405
6418
|
}
|
|
6406
|
-
`}#t;#e;#r;#n;#
|
|
6419
|
+
`}#t;#e;#r;#i;#n;#o;#s;#a;#c;#p;#l;#d;#m;#h;#f;#g;#b;#u;#y;#v;constructor(){super(),this.language="nl-NL",this.#t=this.attachInternals(),this.#e=!1,this.#r=null,this.#i=!1,this.#n=null,this.#o=null,this.#s=this.#k.bind(this),this.#a=()=>this.#R(),this.#c=void 0,this.#p=void 0,this.#l=null,this.#d=0,this.#m=[],this.#h=null,this.#f=!1,this.#g=null,this.#b=this.#W.bind(this),this.#u=!1,this.#y=new Highlight,this.#v=new Highlight,this._ttsContext={state:"idle",currentElementIndex:0,elementCount:0,play:()=>this.#j(),pause:()=>this.#F(),resume:()=>this.#B(),stop:()=>{this.#C(),this.#R()},prevElement:()=>this.#Q(),nextElement:()=>this.#G(),togglePick:()=>this.#U(),picking:!1}}willUpdate(t){if(super.willUpdate(t),this.#e||this.#i||this.#n)return;let e=this._sessionContext?.navItemRefId??null,r=this._sessionContext?.navSectionId??null,n=this.#c!==void 0&&this.#c!==e,i=this.#p!==void 0&&this.#p!==r;(n||i)&&this.#S(),this.#c=e,this.#p=r}#S(){this.#C(),this.#R(),this.#l=null,this.#d=0,this.#u=!1,this.#A()}connectedCallback(){if(super.connectedCallback(),this.#x("idle"),this.#e=this.#w()!==null,this.#e){this.#r=new MutationObserver(t=>{t.some(e=>!this.contains(e.target))&&this.#E()}),this.#r.observe(this.parentElement,{childList:!0,subtree:!0});return}this.#i=this.#P()!==null,!this.#i&&(this.#n=this.closest("qti-assessment-item-ref"),this.#o=this.#n??this.closest("test-navigation")??this.testHost??this.getRootNode(),this.#o.addEventListener("qti-assessment-item-connected",this.#s),this.#n||this.#o.addEventListener("qti-request-navigation",this.#a))}disconnectedCallback(){super.disconnectedCallback(),this.#h&&(this.#h=null,speechSynthesis.cancel()),this.#C(),this.#_(),this.#o?.removeEventListener("qti-assessment-item-connected",this.#s),this.#o?.removeEventListener("qti-request-navigation",this.#a),this.#o=null,this.#n=null,this.#r?.disconnect(),this.#r=null,this.#e=!1,this.#i=!1}render(){return b`<slot></slot>`}#k(t){if(this.#l===null)return;let e=t.detail?.identifier;(this.#n||e===this._sessionContext?.navItemRefId)&&this.#S()}#E(){this.#h&&(this.#h=null,speechSynthesis.cancel()),this.#C(),this.#_(),this.#x("idle"),this.#l=null,this.#d=0,this.#u=!1,this.#A()}#w(){return this.parentElement?.querySelector(":scope > [data-stimulus-idref]")??null}#P(){return this.parentElement?.querySelector(":scope > [data-tts-content]")??null}#N(){return this.#e?this.#w()?.querySelector("qti-stimulus-body")??null:this.#i?this.#P():this.#$()?.querySelector("qti-item-body")??null}#$(){if(this.#n)return this.#n.assessmentItem;let t=this._sessionContext?.navItemRefId;return t?this.#L(t):null}#L(t){let e=`qti-assessment-item-ref[identifier="${CSS.escape(t)}"] qti-assessment-item`,r=a=>{let l=a.querySelector(e);if(l)return l;for(let c of Array.from(a.querySelectorAll("test-container"))){let d=c.shadowRoot?.querySelector(e);if(d)return d}return null},n=this.closest("qti-test"),i=n&&r(n);if(i)return i;let s=this.getRootNode();for(;;){let a=r(s);if(a)return a;let l=s.host;if(!l)return null;s=l.getRootNode()}}#x(t){this._ttsContext={...this._ttsContext,state:t},this.#t.states.delete("idle"),this.#t.states.delete("playing"),this.#t.states.delete("paused"),this.#t.states.add(t)}#A(){this._ttsContext={...this._ttsContext,currentElementIndex:this.#d,elementCount:this.#q().length}}#q(){if(this.#i&&this.#l?.some(t=>!t.isConnected)&&(this.#l=null,this.#d=0,this.#u=!1),this.#l===null){let t=this.#N();if(!t)return[];let e="p, h1, h2, h3, h4, h5, h6, li, dt, dd, th, td, caption, blockquote, figcaption, qti-prompt, qti-simple-choice";this.#l=Array.from(t.querySelectorAll(e)).filter(r=>(r.textContent??"").trim().length>0&&!r.querySelector(e)&&!r.closest('[aria-hidden="true"]'))}return this.#l.filter(t=>this.#V(t))}#V(t){return typeof t.checkVisibility=="function"?t.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0}):t.getClientRects().length>0}#z(t){let e=t;for(;e;){let n=e.getAttribute("lang")||e.getAttribute("xml:lang");if(n?.trim())return n.trim();e=e.parentElement??e.getRootNode().host??null}let r=document.documentElement.getAttribute("lang");return r?.trim()?r.trim():this.language}#j(){if(!this.#q().length){console.warn("test-item-to-speech: no readable elements found");return}this.#C(),speechSynthesis.cancel(),this.#u&&(this.#u=!1,this.#d=0),this.#i&&this.#d===0&&(this.#l=null),this.#T(this.#d)}#T(t){let e=this.#q();if(t>=e.length){this.#I(),this.#d=e.length-1,e.length>0&&this.#O(e[this.#d]),this.#u=!0,this.#x("idle"),this.#A();return}this.#d=t,this.#u=!1,this.#A();let r=e[t];r.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(r),this.#m=this.#X(r);let n=this.#m.map(s=>s.textContent??"").join("");if(!n.trim()){this.#T(t+1);return}let i=new SpeechSynthesisUtterance(n);i.lang=this.#z(r),i.rate=1,i.onboundary=s=>{s.name==="word"&&this.#Y(s.charIndex,s.charLength??0)},i.onend=()=>{this.#h===i&&(this.#h=null,this.#I(),this.#T(this.#d+1))},i.onerror=()=>{this.#h===i&&(this.#h=null,this.#_(),this.#x("idle"))},this.#h=i,speechSynthesis.speak(i),this.#x("playing")}#F(){speechSynthesis.pause(),this.#x("paused")}#B(){speechSynthesis.resume(),this.#x("playing")}#R(){this.#h=null,speechSynthesis.cancel(),this.#_(),this.#x("idle")}#U(){this.#f?this.#C():this.#H()}#H(){this.#i&&(this.#l=null);let t=this.#q();if(!t.length){console.warn("test-item-to-speech: no readable elements found");return}this.#R(),this.#f=!0,this.#t.states.add("picking"),this.#M(t),this.#g=t[0].getRootNode(),this.#g.addEventListener("click",this.#b,!0),this._ttsContext={...this._ttsContext,picking:!0}}#C(){this.#f&&(this.#f=!1,this.#t.states.delete("picking"),this.#g?.removeEventListener("click",this.#b,!0),this.#g=null,this.#_(),this._ttsContext={...this._ttsContext,picking:!1})}#W(t){let e=this.#q(),r=t.composedPath(),n=e.findIndex(i=>r.includes(i));if(n<0){let i=r.find(s=>s instanceof Element&&s.matches("qti-simple-choice, li, qti-prompt"));i&&(n=e.findIndex(s=>i.contains(s)))}n<0||(t.preventDefault(),t.stopPropagation(),this.#C(),speechSynthesis.cancel(),this.#T(n))}#Q(){let t=this.#q();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#I(),this.#d=Math.max(0,this.#d-1),this.#u=!1,this.#A();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(e),this.#x("idle")}#G(){let t=this.#q();if(!t.length)return;this.#h=null,speechSynthesis.cancel(),this.#I(),this.#d=Math.min(t.length-1,this.#d+1),this.#u=!1,this.#A();let e=t[this.#d];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#O(e),this.#x("idle")}#X(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),n;for(;n=r.nextNode();)(n.textContent??"").length>0&&!n.parentElement?.closest('[aria-hidden="true"]')&&e.push(n);return e}#O(t){this.#M([t])}#M(t){if("highlights"in CSS){this.#D(),this.#y.clear();for(let e of t){let r=new Range;r.selectNodeContents(e),this.#y.add(r)}CSS.highlights.set(xo,this.#y)}}#Y(t,e){if(!("highlights"in CSS))return;this.#D(),this.#v.clear();let r=this.#m.map(d=>d.textContent??"").join(""),n=t+(e>0?e:this.#K(t,r)),i=0,s=null,a=0,l=null,c=0;for(let d of this.#m){let h=d.textContent?.length??0;if(!s&&i+h>t&&(s=d,a=t-i),s&&i+h>=n){l=d,c=n-i;break}i+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#v.add(d),CSS.highlights.set(qo,this.#v)}}#I(){"highlights"in CSS&&(this.#v.clear(),CSS.highlights.get(qo)===this.#v&&CSS.highlights.delete(qo))}#_(){"highlights"in CSS&&(this.#I(),this.#y.clear(),CSS.highlights.get(xo)===this.#y&&CSS.highlights.delete(xo))}#K(t,e){let r=e.slice(t).search(/\s/);return r<0?e.length-t:r}#D(){if(!("highlights"in CSS))return;let t=Hu();document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]);let e=new Set,r=this.closest("test-navigation")?.querySelector("test-container")??this.testHost?.querySelector("test-container");r?.shadowRoot&&e.add(r.shadowRoot);let n=this.getRootNode();n instanceof ShadowRoot&&e.add(n);let i=this.#l?.[0]?.getRootNode();i instanceof ShadowRoot&&e.add(i);for(let s of e)s.adoptedStyleSheets.includes(t)||(s.adoptedStyleSheets=[...s.adoptedStyleSheets,t])}};ir([p({type:String})],_e.prototype,"language",void 0);ir([_({context:Ht,subscribe:!0})],_e.prototype,"_sessionContext",void 0);ir([_({context:xt,subscribe:!0})],_e.prototype,"testHost",void 0);ir([T(),B({context:jd})],_e.prototype,"_ttsContext",void 0);var Bi=class extends Mt{#t(){this._tts&&(this._tts.state==="idle"?this._tts.play():this._tts.state==="playing"?this._tts.pause():this._tts.resume())}render(){let t=this._tts?.state==="playing";return b`
|
|
6407
6420
|
<button part="button" aria-label=${K(t?this.pauseLabel:this.label)} @click=${this.#t}>
|
|
6408
|
-
${t?b`<slot name="pause">${
|
|
6421
|
+
${t?b`<slot name="pause">${Ie("pause",this.pauseLabel??"Pause")}</slot>`:b`<slot name="play">${Ie("play",this.label??"Play")}</slot>`}
|
|
6409
6422
|
</button>
|
|
6410
|
-
`}};
|
|
6423
|
+
`}};ir([p({type:String,attribute:"pause-label"})],Bi.prototype,"pauseLabel",void 0);var Co=class extends Mt{render(){return b`
|
|
6411
6424
|
<button
|
|
6412
6425
|
part="button"
|
|
6413
6426
|
aria-label=${K(this.label)}
|
|
6414
6427
|
?disabled=${this._tts?.state!=="playing"}
|
|
6415
6428
|
@click=${()=>this._tts?.pause()}
|
|
6416
6429
|
>
|
|
6417
|
-
<slot>${
|
|
6430
|
+
<slot>${Ie("pause",this.label??"Pause")}</slot>
|
|
6418
6431
|
</button>
|
|
6419
|
-
`}},
|
|
6432
|
+
`}},So=class extends Mt{render(){return b`
|
|
6420
6433
|
<button
|
|
6421
6434
|
part="button"
|
|
6422
6435
|
aria-label=${K(this.label)}
|
|
6423
6436
|
?disabled=${this._tts?.state!=="paused"}
|
|
6424
6437
|
@click=${()=>this._tts?.resume()}
|
|
6425
6438
|
>
|
|
6426
|
-
<slot>${
|
|
6439
|
+
<slot>${Ie("play",this.label??"Resume")}</slot>
|
|
6427
6440
|
</button>
|
|
6428
|
-
`}},
|
|
6441
|
+
`}},ko=class extends Mt{render(){let t=this._tts?.state==="idle"&&!this._tts?.picking;return b`
|
|
6429
6442
|
<button part="button" aria-label=${K(this.label)} ?disabled=${t} @click=${()=>this._tts?.stop()}>
|
|
6430
|
-
<slot>${
|
|
6443
|
+
<slot>${Ie("stop",this.label??"Stop")}</slot>
|
|
6431
6444
|
</button>
|
|
6432
|
-
`}},
|
|
6445
|
+
`}},Eo=class extends Mt{render(){let t=(this._tts?.elementCount??0)>0,e=(this._tts?.currentElementIndex??0)===0;return b`
|
|
6433
6446
|
<button
|
|
6434
6447
|
part="button"
|
|
6435
6448
|
aria-label=${K(this.label)}
|
|
6436
6449
|
?disabled=${t&&e}
|
|
6437
6450
|
@click=${()=>this._tts?.prevElement()}
|
|
6438
6451
|
>
|
|
6439
|
-
<slot>${
|
|
6452
|
+
<slot>${Ie("prev",this.label??"Previous sentence")}</slot>
|
|
6440
6453
|
</button>
|
|
6441
|
-
`}},
|
|
6454
|
+
`}},Ao=class extends Mt{render(){let t=this._tts?.elementCount??0,e=t>0&&(this._tts?.currentElementIndex??0)>=t-1;return b`
|
|
6442
6455
|
<button
|
|
6443
6456
|
part="button"
|
|
6444
6457
|
aria-label=${K(this.label)}
|
|
6445
6458
|
?disabled=${e}
|
|
6446
6459
|
@click=${()=>this._tts?.nextElement()}
|
|
6447
6460
|
>
|
|
6448
|
-
<slot>${
|
|
6461
|
+
<slot>${Ie("next",this.label??"Next sentence")}</slot>
|
|
6449
6462
|
</button>
|
|
6450
|
-
`}},
|
|
6463
|
+
`}},Io=class extends Mt{render(){return b`
|
|
6451
6464
|
<button
|
|
6452
6465
|
part="button"
|
|
6453
6466
|
aria-label=${K(this.label)}
|
|
6454
6467
|
aria-pressed=${this._tts?.picking?"true":"false"}
|
|
6455
6468
|
@click=${()=>this._tts?.togglePick()}
|
|
6456
6469
|
>
|
|
6457
|
-
<slot>${
|
|
6470
|
+
<slot>${Ie("pick",this.label??"Read from here")}</slot>
|
|
6458
6471
|
</button>
|
|
6459
|
-
`}};var
|
|
6472
|
+
`}};var nr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Qu=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),mt=class extends C{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=Qu())}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 bt(this,{context:xt,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.addEventListener("qti-assessment-test-connected",this.#m.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#f.bind(this)),this.addEventListener("qti-interaction-changed",this.#d.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),this.addEventListener("test-end-attempt",this.#p.bind(this)),this.addEventListener("test-update-outcome-variable",this.#l.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=this.#b(e);this.#s.set(e.identifier,r);let n=this.computedItemFor(e.identifier),i=Number(e.variables?.find(s=>s.identifier==="numAttempts")?.value)||0;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),n,this.#g(i,r,n?.maxAttempts))}afterAttemptEnded(t,e,r){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#c(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${t}"]`)?.assessmentItem??void 0:void 0}get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#p(t){let e=this.activeAssessmentItem;if(!e)return;let r=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,r)}#l(t){let e=this.#c(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#d(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(n=>n.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let n=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,n)}}}render(){return b`<slot></slot>`}#m(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let n=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#r({QTI_CONTEXT:{...n,testIdentifier:this.#o.identifier,environmentIdentifier:n.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let i=this.#h(n);Object.keys(i).length>0&&this.#r({QTI_CONTEXT:{...i,...this.qtiContext.QTI_CONTEXT}})});let r=Array.from(this.#o?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:this.#o.identifier,title:this.#o.title,view:this._sessionContext?.view,testParts:r.map(n=>{let i=[...n.querySelectorAll("qti-assessment-section")],s=n.querySelector(":scope > qti-item-session-control"),a=s?s.allowSkipping:!0,l=s?s.maxAttempts:1,c=s?s.showFeedback:!1,d=s?s.showSolution:!1;return{active:!1,identifier:n.identifier,navigationMode:n.navigationMode,submissionMode:n.submissionMode,allowSkipping:a,sections:i.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),v=m?m.allowSkipping:a,x=m?m.maxAttempts:l,u=m?m.showFeedback:c,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:v,items:f.map(y=>{let w=y.querySelector(":scope > qti-item-session-control"),I=w?w.allowSkipping:v,A=w?w.maxAttempts:x,k=w?w.showFeedback:u,S=w?w.showSolution:g;return{...this.initContext?.find(R=>R.identifier===y.identifier),active:!1,identifier:y.identifier,categories:y.category?y.category?.split(" "):[],href:y.href,variables:[],allowSkipping:I,maxAttempts:A,showFeedback:k,showSolution:S}})}})}})}}#h(t){let e={},r=t.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(i=>{let s=i.getAttribute("field-identifier"),a=i.getAttribute("base-type")||"string",l=i.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}#f(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(r=>({...r,sections:r.sections.map(n=>({...n,items:n.items.map(i=>{if(i.identifier!==e.parentElement.getAttribute("identifier"))return i;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),l=e.querySelectorAll("qti-response-declaration"),c=Array.from(l).some(m=>m.querySelector("qti-correct-response")),d=Array.from(l).some(m=>{let v=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return v?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=c||d,f=!!e.querySelector("qti-response-processing");return{...i,assessmentItemIdentifier:e.getAttribute("identifier"),label:e.getAttribute("label"),title:e.title,externalScored:a,adaptive:e.adaptive=="true"||!1,timeDependent:e.timeDependent=="true"||!1,variables:e.variables,hasCorrectResponse:h,hasResponseProcessing:f}})}))}))}}willUpdate(t){if(!this.computedContext)return;let e=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,testParts:this.computedContext.testParts.map(r=>({...r,active:this._sessionContext?.navPartId===r.identifier||!1,sections:r.sections.map(n=>({...n,active:this._sessionContext?.navSectionId===n.identifier||!1,completed:n.items.every(i=>this._testContext.items.find(s=>s.identifier===i.identifier)?.variables.find(s=>s.identifier==="completionStatus").value==="completed"),items:n.items.map(i=>{let s=this._testContext?.items.find(k=>k.identifier===i.identifier),a={...i,...s,...this.initContext?.find(k=>k.identifier===i.identifier)},l=a.variables?.find(k=>k.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(k=>k.identifier==="completionStatus")?.value,h=a.variables?.find(k=>k.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(k=>k.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,v=s?.valid??!0,u=(s?.variables?.filter(k=>k.type==="response")||[]).every(k=>{if(k.value===void 0||k.value===null)return!0;let S;switch(k.baseType){case"integer":case"float":case"duration":S="0";break;case"boolean":S="false";break;default:S="";break}let R=k.defaultValue??S;if(Array.isArray(k.value)){let N=Array.isArray(R)?R:[R];return k.value.length===N.length&&k.value.every((V,$)=>V===N[$])}return k.value===R}),g=i.categories.includes(this.configContext?.infoItemCategory)?null:e++,y=i.variables?.find(k=>k.identifier=="MAXSCORE")?.value,w=y==null?null:parseFloat(y?.toString()),I=this.#s.get(a.identifier);I===void 0&&(I=s?this.#b(s):"unscored",f>0&&this.#s.set(a.identifier,I));let A=this.#g(f,I,a.maxAttempts);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:v,isDefaultResponse:u,maxScore:w,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}#g(t,e,r){if(t===0)return!1;if(e!=="suboptimal")return!0;let n=r??1;return n>0&&t>=n}#b(t){let e=t.variables??[],r=this.#u(e,"SCORE"),n=this.#u(e,"MAXSCORE");if(r!==null&&n!==null)return r>=n?"optimal":"suboptimal";let i=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return i.length===0?"unscored":i.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"}#u(t,e){let r=t?.find(i=>i.identifier===e)?.value;if(r==null||Array.isArray(r))return null;let n=parseFloat(r.toString());return Number.isNaN(n)?null:n}};nr([p({type:String})],mt.prototype,"identifier",void 0);nr([T()],mt.prototype,"initContext",void 0);nr([T(),_({context:vt,subscribe:!0})],mt.prototype,"configContext",void 0);nr([T(),_({context:ot,subscribe:!0})],mt.prototype,"_testContext",void 0);nr([T(),_({context:Ht,subscribe:!0})],mt.prototype,"_sessionContext",void 0);nr([T(),B({context:z})],mt.prototype,"computedContext",void 0);nr([p({type:Boolean,attribute:"auto-score-items"})],mt.prototype,"autoScoreItems",void 0);var hl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},or=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
|
|
6460
6473
|
:host {
|
|
6461
|
-
${
|
|
6474
|
+
${st};
|
|
6462
6475
|
}
|
|
6463
6476
|
:host(:hover:not([disabled])) {
|
|
6464
|
-
${
|
|
6477
|
+
${at};
|
|
6465
6478
|
}
|
|
6466
6479
|
:host(:focus-visible) {
|
|
6467
|
-
${
|
|
6480
|
+
${lt};
|
|
6468
6481
|
}
|
|
6469
6482
|
:host([disabled]) {
|
|
6470
|
-
${
|
|
6483
|
+
${ct};
|
|
6471
6484
|
}
|
|
6472
|
-
`}#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(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),r=e?.navigationMode||t.navigationMode,n=e?.submissionMode||t.submissionMode,i=this.sectionItems[this.itemIndex],s=r==="linear"&&n==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!i?.done}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return b`<slot></slot>`}};
|
|
6485
|
+
`}#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(a=>a.active);if(!t)return;let e=t.sections.find(a=>a.active),r=e?.navigationMode||t.navigationMode,n=e?.submissionMode||t.submissionMode,i=this.sectionItems[this.itemIndex],s=r==="linear"&&n==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!i?.done}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return b`<slot></slot>`}};hl([p({type:Boolean,reflect:!0,attribute:"disabled"})],or.prototype,"_internalDisabled",void 0);hl([_({context:z,subscribe:!0})],or.prototype,"computedContext",void 0);hl([L("computedContext")],or.prototype,"_handleTestElementChange",null);var Gu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ui=class extends C{#t;createRenderRoot(){return this}constructor(){super(),this.#t=this.attachInternals(),this.#t.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");this.myTemplate=yt(t)}render(){if(!this.computedContext)return b``;let t=this.computedContext.testParts.flatMap(e=>e.sections.flatMap(r=>r.items));return b` ${t.map(e=>this.myTemplate({item:e,view:this.computedContext.view}))} `}};Gu([_({context:z,subscribe:!0})],Ui.prototype,"computedContext",void 0);var pl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},sr=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
|
|
6473
6486
|
:host {
|
|
6474
|
-
${
|
|
6487
|
+
${st};
|
|
6475
6488
|
}
|
|
6476
6489
|
:host(:hover:not([disabled])) {
|
|
6477
|
-
${
|
|
6490
|
+
${at};
|
|
6478
6491
|
}
|
|
6479
6492
|
:host(:focus-visible) {
|
|
6480
|
-
${
|
|
6493
|
+
${lt};
|
|
6481
6494
|
}
|
|
6482
6495
|
:host([disabled]) {
|
|
6483
|
-
${
|
|
6496
|
+
${ct};
|
|
6484
6497
|
}
|
|
6485
|
-
`}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 t=this.computedContext?.testParts.find(n=>n.active),r=t?.sections.find(n=>n.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=r==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return b`<slot></slot>`}};
|
|
6498
|
+
`}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 t=this.computedContext?.testParts.find(n=>n.active),r=t?.sections.find(n=>n.active)?.navigationMode||t?.navigationMode||"nonlinear";this._internalDisabled=r==="linear"||!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return b`<slot></slot>`}};pl([p({type:Boolean,reflect:!0,attribute:"disabled"})],sr.prototype,"_internalDisabled",void 0);pl([_({context:z,subscribe:!0})],sr.prototype,"computedContext",void 0);pl([L("computedContext")],sr.prototype,"_handleTestElementChange",null);var Xu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Hi=class extends C{render(){return b` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};Xu([T(),_({context:z,subscribe:!0})],Hi.prototype,"computedContext",void 0);var Yu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Wi=class extends C{static{this.styles=q`
|
|
6486
6499
|
table {
|
|
6487
6500
|
width: 100%;
|
|
6488
6501
|
border-collapse: collapse;
|
|
@@ -6516,34 +6529,34 @@ div.full-correct-response-inline {
|
|
|
6516
6529
|
</tr>
|
|
6517
6530
|
</thead>
|
|
6518
6531
|
<tbody>
|
|
6519
|
-
${i.map(a=>{let
|
|
6532
|
+
${i.map(a=>{let l=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",c=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return b`
|
|
6520
6533
|
<tr>
|
|
6521
6534
|
<td>${a.identifier}</td>
|
|
6522
6535
|
<td>${Array.isArray(a.value)?a.value.join(", "):a.value}</td>
|
|
6523
6536
|
<td>${a.cardinality}</td>
|
|
6524
6537
|
<td>${a.baseType}</td>
|
|
6525
|
-
<td>${c||
|
|
6538
|
+
<td>${l||c||d}</td>
|
|
6526
6539
|
</tr>
|
|
6527
6540
|
`})}
|
|
6528
6541
|
</tbody>
|
|
6529
6542
|
</table>
|
|
6530
6543
|
`;return b`
|
|
6531
6544
|
${n(e,"Response Variables")} ${n(r,"Outcome Variables")}
|
|
6532
|
-
`}}
|
|
6545
|
+
`}};Yu([_({context:z,subscribe:!0})],Wi.prototype,"computedContext",void 0);var ul=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ar=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=yt(t)}#t(t){let n=(this.computedContext?.testParts.find(i=>i.active)).sections.flatMap(i=>i.items).find(i=>i.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:n,outcomeVariableId:"SCORE",value:t},bubbles:!0}))}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!t||!t.variables)return b``;let e=t.variables.find(a=>a.identifier=="MAXSCORE")?.value,r=t.variables.find(a=>a.identifier=="SCORE"),n=r?.value,i=r?.externalScored!=="human";if(!e||!r)return P;let s=[...Array(Number(e)+1).keys()];return b`${this.myTemplate?this.myTemplate({scores:s,score:n,disabled:i}):P}`}constructor(){super(),this.view="",this.disabled=!1,this.myTemplate=null,this.addEventListener("click",t=>{let e=t.target,r=parseFloat(e.value);e.tagName==="INPUT"&&this.#t(r)})}};ul([p({type:String,attribute:"view"})],ar.prototype,"view",void 0);ul([p({type:Boolean})],ar.prototype,"disabled",void 0);ul([_({context:z,subscribe:!0})],ar.prototype,"computedContext",void 0);var Fd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},jr=class extends C{constructor(){super(...arguments),this.view=null}render(){let t=this.computedContext?.testParts.flatMap(a=>a.sections.flatMap(l=>l.items)).find(a=>a.active);if(!t||!t.variables)return b``;if(t.category==="dep-informational")return b`<div>${this.dataset.informational}</div>`;let e=t?.variables.find(a=>a.identifier==="completionStatus")?.value,r=t?.variables.find(a=>a.identifier=="SCORE"),n=parseFloat(r?.value),i=t.externalScored;return b`<div>${e!=="completed"?this.dataset.textNoResponse:!i&&n!==void 0&&!Number.isNaN(n)?n>0?this.dataset.textCorrect:this.dataset.textIncorrect:i==="externalMachine"?Number.isNaN(n)||n===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${n===0?"geen punten":n==1?"\xE9\xE9n punt":`${n} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:i==="human"?Number.isNaN(n)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};Fd([_({context:z,subscribe:!0})],jr.prototype,"computedContext",void 0);Fd([p({type:String,attribute:"view"})],jr.prototype,"view",void 0);var Ku=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Qi=class extends C{#t;createRenderRoot(){return this}constructor(){super(),this.#t=this.attachInternals(),this.#t.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");this.myTemplate=yt(t)}render(){if(!this.computedContext)return b``;let t=this.computedContext.testParts.flatMap(e=>e.sections);return b` ${t.map(e=>this.myTemplate({item:e}))} `}};Ku([_({context:z,subscribe:!0})],Qi.prototype,"computedContext",void 0);var Ju=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Gi=class extends C{static{this.styles=q`
|
|
6533
6546
|
:host {
|
|
6534
|
-
${
|
|
6547
|
+
${st};
|
|
6535
6548
|
}
|
|
6536
6549
|
:host(:hover:not([disabled])) {
|
|
6537
|
-
${
|
|
6550
|
+
${at};
|
|
6538
6551
|
}
|
|
6539
6552
|
:host(:focus-visible) {
|
|
6540
|
-
${
|
|
6553
|
+
${lt};
|
|
6541
6554
|
}
|
|
6542
6555
|
:host([disabled]) {
|
|
6543
|
-
${
|
|
6556
|
+
${ct};
|
|
6544
6557
|
}
|
|
6545
|
-
`}#t(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"section",id:t}}))}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#t(this.sectionId))}render(){return b` <slot></slot> `}};
|
|
6546
|
-
${this.myTemplate?this.myTemplate(this.stampContext):P}`}};
|
|
6558
|
+
`}#t(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"section",id:t}}))}constructor(){super(),this.sectionId=null,this.addEventListener("click",()=>this.#t(this.sectionId))}render(){return b` <slot></slot> `}};Ju([p({type:String,attribute:"section-id"})],Gi.prototype,"sectionId",void 0);var ml=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},lr=class extends C{constructor(){super(...arguments),this.debug=!1,this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=yt(t)}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext.testParts.find(h=>h.active),r=e?.sections.find(h=>h.active),n=r?.items.find(h=>h.active),{variables:i,...s}=n||{};if(!e||!r||!n)return;let a={...e,items:e.sections.flatMap(h=>h.items.map(({variables:f,...m})=>m)),sections:e.sections.map(h=>({...h,items:h.items.map(({variables:f,...m})=>m)}))},l={...r,items:r.items.map(({variables:h,...f})=>f)},{testParts:c,...d}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:s,activeSection:l,activeTestpart:a,test:d},this.dispatchEvent(new CustomEvent("qti-stamp-context-updated",{detail:this.stampContext,bubbles:!0}))}render(){return b` ${this.debug?b`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:P}
|
|
6559
|
+
${this.myTemplate?this.myTemplate(this.stampContext):P}`}};ml([p({type:Boolean,reflect:!0})],lr.prototype,"debug",void 0);ml([T(),_({context:z,subscribe:!0})],lr.prototype,"computedContext",void 0);ml([T()],lr.prototype,"stampContext",void 0);var Xi=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},_o,Yt=class extends C{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#t()},this._viewOptions=_o.DEFAULT_VIEW_OPTIONS}static{this.DEFAULT_VIEW_OPTIONS=["author","candidate","proctor","scorer","testConstructor","tutor"]}connectedCallback(){super.connectedCallback(),this.#t()}#t(){if(this.viewOptions){let t=this.viewOptions.split(",").map(e=>e.trim());this._viewOptions=t.filter(e=>_o.DEFAULT_VIEW_OPTIONS.includes(e))}else this._viewOptions=_o.DEFAULT_VIEW_OPTIONS}_switchView(t){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:t}))}render(){return b`
|
|
6547
6560
|
<label part="label" for="viewSelect">${this.label}</label>
|
|
6548
6561
|
<select
|
|
6549
6562
|
part="select"
|
|
@@ -6552,11 +6565,11 @@ div.full-correct-response-inline {
|
|
|
6552
6565
|
>
|
|
6553
6566
|
${this._viewOptions.map(t=>b`<option value="${t}" ?selected=${t===this.sessionContext.view}>${t}</option>`)}
|
|
6554
6567
|
</select>
|
|
6555
|
-
`}};
|
|
6568
|
+
`}};_o=Yt;Xi([_({context:Ht,subscribe:!0})],Yt.prototype,"sessionContext",void 0);Xi([p({type:String})],Yt.prototype,"label",void 0);Xi([p({type:String,attribute:"view-options"})],Yt.prototype,"viewOptions",void 0);Xi([L("viewOptions",{waitUntilFirstUpdate:!0})],Yt.prototype,"_handleViewOptionsChange",void 0);Xi([T()],Yt.prototype,"_viewOptions",void 0);var Zu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Yi=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=yt(t)}_switchView(t){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:t}))}firstUpdated(t){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return b`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):P}`}};Zu([_({context:Ht,subscribe:!0})],Yi.prototype,"sessionContext",void 0);var Bd=[{tag:"qti-assessment-item-ref",ctor:qt},{tag:"qti-assessment-section",ctor:Ct},{tag:"qti-assessment-test",ctor:Ke},{tag:"qti-item-session-control",ctor:Ot},{tag:"qti-number-selected",ctor:Qn},{tag:"qti-outcome-processing",ctor:Gn},{tag:"qti-test",ctor:Ee},{tag:"qti-test-feedback",ctor:po},{tag:"qti-test-part",ctor:ke},{tag:"qti-test-variables",ctor:ji},{tag:"test-check-item",ctor:er},{tag:"test-container",ctor:St},{tag:"test-end-attempt",ctor:rr},{tag:"test-item-link",ctor:Fi},{tag:"test-item-to-speech",ctor:_e},{tag:"test-navigation",ctor:mt},{tag:"test-next",ctor:or},{tag:"test-paging-buttons-stamp",ctor:Ui},{tag:"test-prev",ctor:sr},{tag:"test-print-context",ctor:Hi},{tag:"test-print-item-variables",ctor:Wi},{tag:"test-scoring-buttons",ctor:ar},{tag:"test-scoring-feedback",ctor:jr},{tag:"test-section-buttons-stamp",ctor:Qi},{tag:"test-section-link",ctor:Gi},{tag:"test-stamp",ctor:lr},{tag:"test-tts-next",ctor:Ao},{tag:"test-tts-pause",ctor:Co},{tag:"test-tts-pick",ctor:Io},{tag:"test-tts-play",ctor:Bi},{tag:"test-tts-prev",ctor:Eo},{tag:"test-tts-resume",ctor:So},{tag:"test-tts-stop",ctor:ko},{tag:"test-view",ctor:Yt},{tag:"test-view-toggle",ctor:Yi}];for(let{tag:o,ctor:t}of Bd)customElements.get(o)||customElements.define(o,t);var cr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Dt=class extends C{constructor(){super(...arguments),this.customElementRegistry=null,this.itemURL=null,this.itemDoc=null,this.itemXML=null,this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=null,this.#e=null}#t;#e;createRenderRoot(){let t=this.customElementRegistry;return this.#e=t,this.shadowRoot??this.attachShadow({...this.constructor.shadowRootOptions,...t?{customElementRegistry:t}:{}})}async handleItemURLChange(){if(this.itemURL)try{let t=this.qtiContext?.QTI_CONTEXT?.seed,e=(await Xt().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=Xt().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:b``}#i(){let t=new CSSStyleSheet;t.replaceSync(vo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
|
|
6556
6569
|
${this.#t}
|
|
6557
6570
|
<slot></slot>
|
|
6558
|
-
${
|
|
6559
|
-
`}};
|
|
6571
|
+
${yo(this.itemDoc,b`<span>Loading...</span>`)}
|
|
6572
|
+
`}};cr([p({attribute:!1})],Dt.prototype,"customElementRegistry",void 0);cr([p({type:String,attribute:"item-url"})],Dt.prototype,"itemURL",void 0);cr([T()],Dt.prototype,"itemDoc",void 0);cr([T()],Dt.prototype,"itemXML",void 0);cr([T(),_({context:wt,subscribe:!0})],Dt.prototype,"qtiContext",void 0);cr([L("itemURL",{waitUntilFirstUpdate:!0})],Dt.prototype,"handleItemURLChange",null);cr([L("itemXML",{waitUntilFirstUpdate:!0})],Dt.prototype,"handleItemXMLChange",null);var tm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ki=class extends C{static{this.styles=q`
|
|
6560
6573
|
table {
|
|
6561
6574
|
width: 100%;
|
|
6562
6575
|
border-collapse: collapse;
|
|
@@ -6590,20 +6603,20 @@ div.full-correct-response-inline {
|
|
|
6590
6603
|
</tr>
|
|
6591
6604
|
</thead>
|
|
6592
6605
|
<tbody>
|
|
6593
|
-
${i.map(a=>{let
|
|
6606
|
+
${i.map(a=>{let l=a.correctResponse?Array.isArray(a.correctResponse)?a.correctResponse.join(", "):a.correctResponse:"",c=a.mapping?.mapEntries?.map(h=>`${h.mapKey}=${h.mappedValue}pt`).join(", ")||"",d=a.areaMapping?.areaMapEntries?.map(h=>`${h.shape}(${h.coords})=${h.mappedValue}pt`).join(", ")||"";return b`
|
|
6594
6607
|
<tr>
|
|
6595
6608
|
<td>${a.identifier}</td>
|
|
6596
6609
|
<td>${Array.isArray(a.value)?a.value.join(", "):a.value}</td>
|
|
6597
6610
|
<td>${a.cardinality}</td>
|
|
6598
6611
|
<td>${a.baseType}</td>
|
|
6599
|
-
<td>${c||
|
|
6612
|
+
<td>${l||c||d}</td>
|
|
6600
6613
|
</tr>
|
|
6601
6614
|
`})}
|
|
6602
6615
|
</tbody>
|
|
6603
6616
|
</table>
|
|
6604
6617
|
`;return b`
|
|
6605
6618
|
${n(e,"Response Variables")} ${n(r,"Outcome Variables")}
|
|
6606
|
-
`}};
|
|
6619
|
+
`}};tm([_({context:ye,subscribe:!0})],Ki.prototype,"computedContext",void 0);var em=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ud=o=>{class t extends o{#t;constructor(...r){super(...r),this.view="candidate",this.addEventListener("qti-assessment-item-connected",n=>{this.#t=n.detail,this.#e()}),this.addEventListener("item-switch-view",n=>{this.view=n.detail})}willUpdate(r){super.willUpdate(r),r.has("view")&&this.#e()}#e(){let r=this.#t;r&&(r.querySelectorAll("[view]").forEach(n=>{n.classList.toggle("show",n.getAttribute("view")===this.view)}),this.updateAssessmentItemView(r,this.view))}updateAssessmentItemView(r,n){}}return em([p({type:String})],t.prototype,"view",void 0),t};var fl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},le=class extends Ud(C){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#r.bind(this),this.#e=this.#i.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#r(t){this.#n(t.detail.itemContext.identifier,t.detail?.itemContext?.variables||[])}#i(t){let e=t.detail._context.variables;this.assessmentItem=t.detail,this.computedContext=this.computedContext?.identifier===this.assessmentItem.identifier?{...this.computedContext,title:this.assessmentItem.title}:{identifier:this.assessmentItem.identifier,title:this.assessmentItem.title,adaptive:this.assessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:e},this.#n(this.assessmentItem.identifier,e||[])}#n(t,e){let r=e?.find(c=>c.identifier=="SCORE")?.value,n=parseFloat(r?.toString()),i=e?.find(c=>c.identifier==="completionStatus")?.value,s=n!==void 0&&!isNaN(n)&&n>0,a=n!==void 0&&!isNaN(n)&&n<=0,l=i==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:l,variables:e}}render(){return b`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};fl([T(),B({context:ye})],le.prototype,"computedContext",void 0);fl([T(),B({context:vt})],le.prototype,"configContext",void 0);fl([T(),B({context:wt})],le.prototype,"qtiContext",void 0);var Hd=[{tag:"item-container",ctor:Dt},{tag:"item-print-variables",ctor:Ki},{tag:"qti-item",ctor:le}];for(let{tag:o,ctor:t}of Hd)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Td)customElements.get(o)||customElements.define(o,t);var Wd=(o,t,e)=>{let r=new Map;for(let n=t;n<=e;n++)r.set(o[n],n);return r},H=Pt(class extends qe{constructor(o){if(super(o),o.type!==Vr.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 n=[],i=[],s=0;for(let a of o)n[s]=r?r(a,s):s,i[s]=e(a,s),s++;return{values:i,keys:n}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,r]){let n=Id(o),{values:i,keys:s}=this.dt(t,e,r);if(!Array.isArray(n))return this.ut=s,i;let a=this.ut??=[],l=[],c,d,h=0,f=n.length-1,m=0,v=i.length-1;for(;h<=f&&m<=v;)if(n[h]===null)h++;else if(n[f]===null)f--;else if(a[h]===s[m])l[m]=Ce(n[h],i[m]),h++,m++;else if(a[f]===s[v])l[v]=Ce(n[f],i[v]),f--,v--;else if(a[h]===s[v])l[v]=Ce(n[h],i[v]),zr(o,l[v+1],n[h]),h++,v--;else if(a[f]===s[m])l[m]=Ce(n[f],i[m]),zr(o,n[h],n[f]),f--,m++;else if(c===void 0&&(c=Wd(s,m,v),d=Wd(a,h,f)),c.has(a[h]))if(c.has(a[f])){let x=d.get(s[m]),u=x!==void 0?n[x]:null;if(u===null){let g=zr(o,n[h]);Ce(g,i[m]),l[m]=g}else l[m]=Ce(u,i[m]),zr(o,n[h],u),n[x]=null;m++}else so(n[f]),f--;else so(n[h]),h++;for(;m<=v;){let x=zr(o,l[v+1]);Ce(x,i[m]),l[m++]=x}for(;h<=f;){let x=n[h++];x!==null&&so(x)}return this.ut=s,Ad(o,l),et}});var Te=Symbol("dragDropContext");var Qd=[O,Wt,q`
|
|
6607
6620
|
/* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
|
|
6608
6621
|
custom properties on its host; the properties themselves live here. */
|
|
6609
6622
|
:host {
|
|
@@ -6621,9 +6634,9 @@ div.full-correct-response-inline {
|
|
|
6621
6634
|
width: 100%;
|
|
6622
6635
|
height: 100%;
|
|
6623
6636
|
}
|
|
6624
|
-
`];var
|
|
6637
|
+
`];var Gd=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Fr=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=Qd}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return b`<div part="drop">
|
|
6625
6638
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6626
|
-
</div>`}};
|
|
6639
|
+
</div>`}};Gd([p({type:String,reflect:!0})],Fr.prototype,"identifier",void 0);Gd([_({context:Te,subscribe:!0}),T()],Fr.prototype,"_dragDrop",void 0);var Xd=[{tag:"qti-associable-hotspot",ctor:Fr}];var Yd=[O,Wt,q`
|
|
6627
6640
|
/*
|
|
6628
6641
|
* A drop target. The interaction measures its chips and publishes the result as custom
|
|
6629
6642
|
* properties on its own host; the actual CSS properties live here, not in a style attribute.
|
|
@@ -6668,9 +6681,9 @@ div.full-correct-response-inline {
|
|
|
6668
6681
|
min-height: var(--qti-dropzone-min-height, 0);
|
|
6669
6682
|
min-width: var(--qti-dropzone-min-width, 0);
|
|
6670
6683
|
}
|
|
6671
|
-
`];var
|
|
6684
|
+
`];var gl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},dr=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=Yd}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`<div part="drop">
|
|
6672
6685
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6673
|
-
</div>`}};
|
|
6686
|
+
</div>`}};gl([p({type:Number,reflect:!0})],dr.prototype,"tabindex",void 0);gl([p({type:String,reflect:!0})],dr.prototype,"identifier",void 0);gl([_({context:Te,subscribe:!0}),T()],dr.prototype,"_dragDrop",void 0);var Kd=[{tag:"qti-gap",ctor:dr}];var Jd=[O,q`
|
|
6674
6687
|
/* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
|
|
6675
6688
|
graphic-gap-match rules, on the host from the document. */
|
|
6676
6689
|
:host {
|
|
@@ -6679,7 +6692,7 @@ div.full-correct-response-inline {
|
|
|
6679
6692
|
justify-content: center;
|
|
6680
6693
|
user-select: none;
|
|
6681
6694
|
}
|
|
6682
|
-
`];var
|
|
6695
|
+
`];var rm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ji=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=Jd}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<slot part="label"></slot>`}};rm([p({type:Number,reflect:!0})],Ji.prototype,"tabindex",void 0);var Zd=[{tag:"qti-gap-img",ctor:Ji}];var hr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},th={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function kt(o,t){class e extends o{#t;#e(){let i=this._interactionContext?.choiceRole??null;i!==this.#t&&(this.#t&&this.internals.states.delete(this.#t),this.#t=i,this.internals.role=i,i&&this.internals.states.add(i))}handleDisabledChange(n,i){i?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=i?-1:0}handleReadonlyChange(n,i){i?(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=null,this.internals=this.attachInternals()}willUpdate(n){super.willUpdate(n),this.#e()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),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(){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 b`<slot></slot>`}}return hr([p({type:String})],e.prototype,"identifier",void 0),hr([p({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",void 0),hr([p({type:Boolean,attribute:"aria-disabled",converter:th})],e.prototype,"disabled",void 0),hr([p({type:Boolean,attribute:"aria-readonly",converter:th})],e.prototype,"readonly",void 0),hr([_({context:kr,subscribe:!0}),T()],e.prototype,"_interactionContext",void 0),hr([L("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",null),hr([L("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"handleReadonlyChange",null),e}var eh=[O,q`
|
|
6683
6696
|
/*
|
|
6684
6697
|
* A chip's own box. Both drag-drop interactions that use this element laid it out from the
|
|
6685
6698
|
* theme — gap-match with 'display: flex !important; align-items: center !important',
|
|
@@ -6722,8 +6735,8 @@ div.full-correct-response-inline {
|
|
|
6722
6735
|
align-items: center;
|
|
6723
6736
|
justify-content: center;
|
|
6724
6737
|
}
|
|
6725
|
-
`];var
|
|
6726
|
-
<slot part="label"></slot>`}};
|
|
6738
|
+
`];var im=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Re=class extends kt(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=eh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<div part="control"></div>
|
|
6739
|
+
<slot part="label"></slot>`}};im([p({type:Number,reflect:!0})],Re.prototype,"tabindex",void 0);var rh=[{tag:"qti-gap-text",ctor:Re}];var ih=[O,q`
|
|
6727
6740
|
:host {
|
|
6728
6741
|
display: flex;
|
|
6729
6742
|
user-select: none;
|
|
@@ -6743,7 +6756,7 @@ div.full-correct-response-inline {
|
|
|
6743
6756
|
display: grid;
|
|
6744
6757
|
place-content: center;
|
|
6745
6758
|
}
|
|
6746
|
-
`];var
|
|
6759
|
+
`];var nm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},pr=class extends kt(C,"qti-hotspot-choice"){static{this.styles=ih}};nm([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],pr.prototype,"order",void 0);var nh=[{tag:"qti-hotspot-choice",ctor:pr}];var oh=[O,q`
|
|
6747
6760
|
/* 'position: relative' is the containing block for the answer-key tick the theme draws as an
|
|
6748
6761
|
absolutely positioned ::before. See CONTRACT.md §7. */
|
|
6749
6762
|
:host {
|
|
@@ -6763,8 +6776,8 @@ div.full-correct-response-inline {
|
|
|
6763
6776
|
[part='control'] {
|
|
6764
6777
|
display: none;
|
|
6765
6778
|
}
|
|
6766
|
-
`];var
|
|
6767
|
-
<slot part="label"></slot>`}};var
|
|
6779
|
+
`];var ur=class extends kt(C,"qti-hottext"){static{this.styles=oh}render(){return b`<div part="control"><div part="control-mark"></div></div>
|
|
6780
|
+
<slot part="label"></slot>`}};var sh=[{tag:"qti-hottext",ctor:ur}];var om=q`
|
|
6768
6781
|
/*
|
|
6769
6782
|
* An option row: one line, clipped, with its text centred against the row's min-height. All four
|
|
6770
6783
|
* were in the theme, set on this host from the document — which is also why the 'display: block'
|
|
@@ -6781,13 +6794,13 @@ div.full-correct-response-inline {
|
|
|
6781
6794
|
slot {
|
|
6782
6795
|
display: inline;
|
|
6783
6796
|
}
|
|
6784
|
-
`,
|
|
6797
|
+
`,ah=om;var sm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Zi=class extends kt(C,"qti-inline-choice"){static{this.styles=ah}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 b` <slot></slot> `}#t(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};sm([p({type:String})],Zi.prototype,"identifier",void 0);var lh=[{tag:"qti-inline-choice",ctor:Zi}];var ch=[O,q`
|
|
6785
6798
|
:host {
|
|
6786
6799
|
display: block;
|
|
6787
6800
|
margin: var(--qti-gap) 0;
|
|
6788
6801
|
width: 100%;
|
|
6789
6802
|
}
|
|
6790
|
-
`];var
|
|
6803
|
+
`];var To=class extends C{static{this.styles=ch}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var dh=[{tag:"qti-prompt",ctor:To}];var hh=[O,Wt,q`
|
|
6791
6804
|
/*
|
|
6792
6805
|
* 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
|
|
6793
6806
|
* way. In tabular match this element is a light-DOM *grandchild* of the slotted
|
|
@@ -6936,13 +6949,13 @@ div.full-correct-response-inline {
|
|
|
6936
6949
|
align-items: center;
|
|
6937
6950
|
justify-content: center;
|
|
6938
6951
|
}
|
|
6939
|
-
`];var
|
|
6952
|
+
`];var Ro=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Nt=class extends kt(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=hh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`
|
|
6940
6953
|
<div part="control"></div>
|
|
6941
6954
|
<slot part="label"></slot>
|
|
6942
6955
|
<div part="drop">
|
|
6943
6956
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6944
6957
|
</div>
|
|
6945
|
-
`}};
|
|
6958
|
+
`}};Ro([p({type:Number,attribute:"match-min"})],Nt.prototype,"matchMin",void 0);Ro([p({type:Number,attribute:"match-max"})],Nt.prototype,"matchMax",void 0);Ro([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Nt.prototype,"fixed",void 0);Ro([_({context:Te,subscribe:!0}),T()],Nt.prototype,"_dragDrop",void 0);var ph=[{tag:"qti-simple-associable-choice",ctor:Nt}];var uh=[O,q`
|
|
6946
6959
|
/*
|
|
6947
6960
|
* 'position: relative' unconditionally, because this element can carry a correction badge and a
|
|
6948
6961
|
* badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
|
|
@@ -6978,9 +6991,9 @@ div.full-correct-response-inline {
|
|
|
6978
6991
|
align-items: center;
|
|
6979
6992
|
justify-content: center;
|
|
6980
6993
|
}
|
|
6981
|
-
`];var
|
|
6994
|
+
`];var Oo=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},$t=class extends kt(C,"qti-simple-choice"){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=uh}static{this.shadowRootOptions={...C.shadowRootOptions,delegatesFocus:!0}}get checked(){return this.internals.states.has("checked")}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
|
|
6982
6995
|
${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:P}
|
|
6983
|
-
<slot part="label"></slot>`}};Io([p({type:String,attribute:"template-identifier"})],Mt.prototype,"templateIdentifier",void 0);Io([p({type:String,attribute:"show-hide"})],Mt.prototype,"showHide",void 0);Io([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Mt.prototype,"fixed",void 0);Io([p({type:String,attribute:!1})],Mt.prototype,"marker",void 0);var oh=[{tag:"qti-simple-choice",ctor:Mt}];var sh=[...zd,...Fd,...Ud,...Qd,...Xd,...Kd,...Zd,...eh,...nh,...oh];var Gu=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i};function Xu(o,t,e,r,n={}){let i=n.publishWidth??!0,s=n.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,c=0,l=r.length?r:[o],d=l.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));l.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),c=Math.max(c,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),n.hasChanged?.({height:a,width:c})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),i&&(o.style.setProperty("--qti-dropzone-min-width",`${c}px`),o.style.setProperty("--qti-drag-min-width",`${c}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),i&&(h.style.setProperty("--qti-dropzone-min-width",`${c}px`),h.style.setProperty("--qti-drag-min-width",`${c}px`))}))}var hl=(o,t,e,r='slot[part="drags"]')=>{class n extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#n=0,this.#i=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#n;#i;collectAutoSizeTargets(){let s=(a,c)=>Array.from(c?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:c}=this.collectAutoSizeTargets();s.length!==0&&(Xu(this.dropzonePropertyTarget(),s,a,c,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:l=>{let d=this.#i;return d&&d.height===l.height&&d.width===l.width?!1:(this.#i=l,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#s()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#n||(this.#n=requestAnimationFrame(()=>{this.#n=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let c of this.#e)a.has(c)||this.#t.unobserve(c);for(let c of a)this.#e.has(c)||this.#t.observe(c);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#r?.disconnect(),this.#r=null,this.#n&&cancelAnimationFrame(this.#n),this.#n=0,super.disconnectedCallback()}}return Gu([p({type:Boolean,attribute:"auto-size-dropzones"})],n.prototype,"autoSizeDropzones",void 0),n};var{AbortController:Xt,AbortSignal:pl,WeakMap:Yu,WeakRef:Ku,Window:ah,reportError:_o=console.log}=globalThis,Ie=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||Ie(o.defaultView.parent.document)),hr=()=>!!ah&&globalThis instanceof ah,ul=Symbol("unset"),[lh,Ju]=(()=>{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((y,w)=>(x=y,u=w)),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 n=new Yu,i={next(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.next(...x))},return(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.return?y.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>{if(!y.throw)throw y.return(),new TypeError("no throw method");return y.throw(...x)})}};function s(x){let u=Object.create(i);return n.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 y=r(x,g);return s(y)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(x,g)}let c="any"in pl?pl.any.bind(pl):x=>{let u=new Xt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},l=x=>c(x.filter(Boolean));class d{constructor({next:u,error:g,complete:y}={}){n.set(this,{next:u,error:g,complete:y})}next(u){let{next:g}=n.get(this)||{};g&&g(u)}error(u){let{error:g}=n.get(this)||{};g?g(u):_o(u)}complete(){let{complete:u}=n.get(this)||{};u&&u()}}function h(x,u){let g=n.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let y of g.teardowns.reverse()){if(hr()&&!Ie(document))return;try{y()}catch(w){_o(w)}}}}function f(x,u,g={}){if(hr()&&!Ie(document))return;let y;typeof u=="function"?y=new d({next:u}):u&&!(u instanceof d)?y=new d(u):y=u||new d;let w=n.get(x),I=w.weakSubscriber?.deref();if(I?.active){let S=I,k=n.get(S);k.observers.add(y),g.signal&&(g.signal.aborted?k.observers.delete(y):g.signal.addEventListener("abort",()=>{let R=n.get(S);R?.active&&(R.observers.delete(y),R.observers.size==0&&h(S,g.signal.reason))}));return}let A=new m(y);if(w.weakSubscriber=new Ku(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let S=n.get(A);S?.active&&(S.observers.delete(y),S.observers.size==0&&h(A,g.signal.reason))})),w.subscribeCallback)try{w.subscribeCallback(A)}catch(S){A.error(S)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");n.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Xt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=n.get(this);if(!g?.active||hr()&&!Ie(document))return;let y=new Set(g.observers);for(let w of y)w.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=n.get(this);if(!g?.active){_o(u);return}if(hr()&&!Ie(document))return;h(this,u);let y=new Set(g.observers);for(let w of y)w.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=n.get(this);if(!u?.active||hr()&&!Ie(document))return;h(this);let g=new Set(u.observers);for(let y of g)y.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(hr()&&!Ie(document))return;let g=n.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!n.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!n.has(this)){let u=new Xt;return u.abort(),u.signal}return n.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 v{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");n.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 v)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let I=function(A,S){if(A.signal.aborted)return;let k;try{let R=S.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:w}=R)}catch(V){A.error(V);return}if(w){A.complete();return}let N;try{N=R.value}catch(V){A.error(V);return}A.next(N),I(A,S)},R=>{A.error(R)})},w=!1;return new v(A=>{if(A.signal.aborted)return;let S;try{S=a(u,!0)}catch(R){A.error(R);return}let k=S;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||w)return;t(()=>k.return(A.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),I(A,k))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new v(w=>{if(w.signal.aborted)return;let I;try{I=a(u,!1)}catch(k){w.error(k);return}let A=!1,S=I;if(!w.signal.aborted)for(w.signal.addEventListener("abort",()=>{if(typeof S.return!="function"||A)return;let k=S.return();if(k===null||typeof k!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let k=S.next();if({done:A}=k,A){w.complete();return}if(w.next(k.value),w.signal.aborted)break}catch(k){w.error(k);break}});if(u instanceof Promise||typeof u.then=="function")return new v(w=>{u.then(I=>{w.next(I),w.complete()},I=>{w.error(I)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this,y=v.from(u);return new v(w=>{let I=new d({next(){w.complete()},error(){w.complete()}}),A={signal:w.signal};if(f(y,I,A),!w.active)return;let S=new d({next(k){w.next(k)},error(k){w.error(k)},complete(){w.complete()}});f(g,S,A)})}map(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=new d({next(S){let k;try{k=u(S,w)}catch(R){y.error(R);return}w+=1,y.next(k)},error(S){y.error(S)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}inspect(u={}){let g=null,y=null,w=null,I=null,A=null;typeof u=="function"?y=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(y=u.next),"error"in u&&(w=u.error),"complete"in u&&(I=u.complete),"abort"in u&&(A=u.abort));let S=this;return new v(k=>{if(g!==null)try{g()}catch(L){k.error(L);return}let R=()=>{try{A!==null&&A(k.signal.reason)}catch(L){_o(L)}};k.signal.addEventListener("abort",R,{once:!0});let N=new d({next(L){if(y!==null)try{y(L)}catch(mt){k.signal.removeEventListener("abort",R),k.error(mt);return}k.next(L)},error(L){if(k.signal.removeEventListener("abort",R),w!==null)try{w(L)}catch(mt){k.error(mt);return}k.error(L)},complete(){if(k.signal.removeEventListener("abort",R),I!==null)try{I()}catch(L){k.error(L);return}k.complete()}}),V={signal:k.signal};f(S,N,V)})}filter(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=new d({next(S){let k=!1;try{k=u(S,w)}catch(R){y.error(R);return}w+=1,k&&y.next(S)},error(S){y.error(S)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}take(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u;if(w==0)return y.complete();let I=new d({next(S){y.next(S),w-=1,w==0&&y.complete()},error(S){y.error(S)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}drop(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u,I=new d({next(S){if(w>0)return w-=1;w==0&&y.next(S)},error(S){y.error(S)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}flatMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=!1,A=[];function S(V){let L;try{L=u(V,w)}catch(Kt){return y.error(Kt)}w+=1;let mt;try{mt=v.from(L)}catch(Kt){return y.error(Kt)}let ha=new d({next(Kt){y.next(Kt)},error(Kt){y.error(Kt)},complete(){if(A.length){let Kt=A.shift();S(Kt)}else k=!1,I&&y.complete()}}),Vt={signal:y.signal};f(mt,ha,Vt)}let k=!1,R=new d({next(V){k?A.push(V):(k=!0,S(V))},error(V){y.error(V)},complete(){I=!0,!k&&!A.length&&y.complete()}}),N={signal:y.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=!1,A=null;function S(N){let V;try{V=u(N,w)}catch(Vt){return y.error(Vt)}w+=1;let L;try{L=v.from(V)}catch(Vt){return y.error(Vt)}let mt=new d({next(Vt){y.next(Vt)},error(Vt){y.error(Vt)},complete(Vt){I?y.complete():A=null}}),ha={signal:l([A.signal,y.signal])};f(L,mt,ha)}let k=new d({next(N){A&&A.abort(),A=new Xt,S(N)},error(N){y.error(N)},complete(){I=!0,A||y.complete()}}),R={signal:y.signal};f(g,k,R)})}catch(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(w=>{let I=new d({next(S){w.next(S)},error(S){let k;try{k=u(S)}catch(L){w.error(L);return}let R;try{R=v.from(k)}catch(L){w.error(L);return}let N=new d({next(L){w.next(L)},error(L){w.error(L)},complete(){w.complete()}}),V={signal:w.signal};f(R,N,V)},complete(){w.complete()}}),A={signal:w.signal};f(g,I,A)})}finally(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{y.addTeardown(u);let w=new d({next(A){y.next(A)},error(A){y.error(A)},complete(){y.complete()}}),I={signal:y.signal};f(g,w,I)})}toArray(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=[],A=new d({next(S){I.push(S)},error(S){w(S)},complete(){y(I)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Xt,S={signal:l([A.signal,g.signal])};if(S.signal.aborted)return I(S.signal.reason),y;S.signal.addEventListener("abort",()=>{I(S.signal.reason)});let k=0,R=new d({next(N){try{u(N,k)}catch(V){I(V),A.abort(V)}k+=1},error(N){I(N)},complete(){w()}});return f(this,R,S),y}every(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Xt,S={signal:l([A.signal,g.signal])};if(S.signal.aborted)return I(S.signal.reason),y;S.signal.addEventListener("abort",()=>{I(S.signal.reason)});let k=0,R=new d({next(N){let V=!1;try{V=u(N,k)}catch(L){I(L),A.abort(L)}k+=1,V||(w(!1),A.abort())},error(N){I(N)},complete(){w(!0)}});return f(this,R,S),y}first(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e(),I=new Xt,A={signal:l([I.signal,u.signal])};if(A.signal.aborted)return w(A.signal.reason),g;A.signal.addEventListener("abort",()=>{w(A.signal.reason)});let S=new d({next(k){y(k),I.abort()},error(k){w(k)},complete(){w(new RangeError("No values in Observable"))}});return f(this,S,A),g}last(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return w(u.signal.reason),g;u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=null,A=!1,S=new d({next(k){A=!0,I=k},error(k){w(k)},complete(){A?y(I):w(new RangeError("No values in Observable"))}});return f(this,S,u),g}find(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Xt,S={signal:l([A.signal,g.signal])};if(S.signal.aborted)return I(S.signal.reason),y;S.signal.addEventListener("abort",()=>{I(S.signal.reason)});let k=0,R=new d({next(N){let V=!1;try{V=u(N,k)}catch(L){I(L),A.abort(L)}k+=1,V&&(w(N),A.abort())},error(N){I(N)},complete(){w()}});return f(this,R,S),y}some(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Xt,S={signal:l([A.signal,g.signal])};if(S.signal.aborted)return I(S.signal.reason),y;S.signal.addEventListener("abort",()=>{I(S.signal.reason)});let k=0,R=new d({next(N){let V=!1;try{V=u(N,k)}catch(L){I(L),A.abort(L)}k+=1,V&&(w(!0),A.abort())},error(N){I(N)},complete(){w(!1)}});return f(this,R,S),y}reduce(u,g,y={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:w,resolve:I,reject:A}=e(),S=new Xt,k={signal:l([S.signal,y.signal])};if(k.signal.aborted)return A(k.signal.reason),w;k.signal.addEventListener("abort",()=>{A(k.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:ul,V=new d({next(L){if(N===ul){N=L,R++;return}try{let mt=u(N,L,R);R++,N=mt}catch(mt){A(mt),S.abort(mt);return}},error(L){A(L)},complete(){N!==ul?I(N):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,k),w}}return o(v.prototype,"subscribe"),[v,m]})();function ch(){return typeof globalThis.Observable=="function"}function dh(){Object.defineProperties(globalThis,{Observable:{value:lh,configurable:!0,writable:!0},Subscriber:{value:Ju,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(hr()&&!Ie(document))return;let e=this;return new lh(r=>{if(!e||r.signal.aborted)return;let n=i=>{r.next(i)};e.addEventListener(o,n,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function ml(o,t,e){let r=o.filter(n=>!n.hasAttribute("disabled"));for(let n of r){let i=n.getBoundingClientRect();if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)return n}return null}function hh(o,t,e,r){if(!r)return null;let n=o.filter(s=>!s.hasAttribute("disabled")),i=r.getBoundingClientRect();for(let s of n){let a=s.getBoundingClientRect();if(!(i.right<a.left||i.left>a.right||i.bottom<a.top||i.top>a.bottom))return s}return null}function ph(o,t,e,r){let n=o.filter(l=>!l.hasAttribute("disabled"));if(n.length===0)return null;let i,s;if(r){let l=r.getBoundingClientRect();i=l.left+l.width/2,s=l.top+l.height/2}else i=t,s=e;let a=null,c=1/0;for(let l of n){let d=l.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(i-h,2)+Math.pow(s-f,2));m<c&&(c=m,a=l)}return a}function uh(o,t,e,r){let n=o.filter(c=>!c.hasAttribute("disabled"));if(n.length===0)return null;let i;if(r){let c=r.getBoundingClientRect();i=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}]}else i=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let c of n){let l=c.getBoundingClientRect(),d=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}],h=0,f=0;for(let v of i)for(let x of d){let u=Math.sqrt(Math.pow(v.x-x.x,2)+Math.pow(v.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=c)}return s}function Zu(o,t,e){let r=o.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function tm(o,t,e,r,n){let i=n&&n.length>0?o.filter(g=>n.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.includes("drags")),a=o.filter(g=>!i.includes(g));if(i.length===0&&a.length===0)return null;let c;if(r){let g=r.getBoundingClientRect();c=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else c=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let l=g=>{let y=g.getBoundingClientRect(),w=[{x:y.left,y:y.top},{x:y.right,y:y.top},{x:y.left,y:y.bottom},{x:y.right,y:y.bottom}],I=0,A=0;for(let S of c)for(let k of w){let R=Math.sqrt(Math.pow(S.x-k.x,2)+Math.pow(S.y-k.y,2));I+=R,A++}return I/A},d=null,h=1/0;for(let g of i){let y=l(g);y<h&&(h=y,d=g)}let f=null,m=1/0;for(let g of a){let y=l(g);y<m&&(m=y,f=g)}if(d&&r){let g=r.getBoundingClientRect(),y=d.getBoundingClientRect(),w=g.left+g.width/2,I=g.top+g.height/2;if(w>=y.left&&w<=y.right&&I>=y.top&&I<=y.bottom)return d}if(f&&Zu(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 mh(o){switch(o){case"pointerWithin":return ml;case"rectangleIntersection":return hh;case"closestCenter":return ph;case"closestCorners":return uh;case"closestCornersWithInventoryPriority":return tm;default:return ml}}function Br(o,t,e,r,n="pointerWithin",i){return mh(n)(o,t,e,r,i)}function _e(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("qti-draggable"))return r;let n=r.closest(t)||r.closest('[qti-draggable="true"]');if(n)return n}return null}function Zn(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var fl=o=>o?.internals;function Dt(o,t,e){let r=fl(o)?.states;r&&(e?r.add(t):r.delete(t))}function To(o,t){return fl(o)?.states?.has(t)??!1}function ti(o){Dt(o,"dragging",!1),Dt(o,"placeholder",!1),Dt(o,"return-anchor",!1)}function pr(o){return To(o,"dragging")||To(o,"placeholder")}function ae(o,t,e){if(!o)return;e?o.setAttribute(t,""):o.removeAttribute(t);let r=fl(o)?.states;if(r){e?r.add(t):r.delete(t);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));n.has("drop")&&(e?n.add(t):n.delete(t),o.setAttribute("part",[...n].join(" ")))}function Ur(o,t){ae(o,"filled",t)}function Hr(o,t){let e=[];return o.forEach(r=>{let n=[];r.tagName.toLowerCase()==="slot"?n=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):n=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...n)}),e}function fh(o,t){let e=o.find(n=>n.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var gl={origin:{x:0,y:0},scale:{x:1,y:1}},Ro=100,em=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},rm=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},nm=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},bl=(o,t)=>{let e=o.ownerDocument??document,r=t??e.body,n=em(e);return n&&!nm(n,r)?rm(n):r},yl=o=>{let e=(o.ownerDocument??document).createElement("div");e.style.cssText=`position:fixed;left:0;top:0;width:${Ro}px;height:${Ro}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(e);let r=e.getBoundingClientRect();return e.remove(),{origin:{x:r.left,y:r.top},scale:{x:r.width/Ro||1,y:r.height/Ro||1}}},gh=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});ch()||dh();var bh=new WeakSet;function im(o){!o||bh.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),bh.add(o))}var yh=o=>!!o.internals?.states,Oo=(o,t,e,r='slot[part="drags"]',n="pointerWithin")=>{class i extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=n,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=gl,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#r=a=>{let c=a;if(c.context!==kr)return;let l=c.contextTarget;l instanceof HTMLElement&&this.#e.add(l)}}#t;isDragDropEnabled(){return!0}publishDraggablesSelector(){let a=this.isDragDropEnabled()?t:null;this._interactionContext.draggablesSelector!==a&&(this._interactionContext={...this._interactionContext,draggablesSelector:a})}connectedCallback(){super.connectedCallback(),this.addEventListener("context-request",this.#r,{capture:!0}),im(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,c){c.remove()}#e;#r;registeredMatching(a){for(let c of this.#e)c.isConnected||this.#e.delete(c);return[...this.#e].filter(c=>c.matches(a))}cacheInteractiveElements(){let a=(k,R)=>Array.from(R?.querySelectorAll(k)??[]),c=a(t,this),l=a(t,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...c,...l,...d,...h,...f]));let m=a(e,this),v=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...v]));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(),y=new Set(this.trackedDraggables),w=new Set(this.trackedDroppables),I=g?y:new Set,A=g?w:new Set,S=new Set([...y,...w].filter(yh));for(let k of this.#t)S.has(k)||(k.internals.states.delete("drag"),k.internals.states.delete("droppable"));for(let k of S){let R=I.has(k),N=!R&&A.has(k);R?k.internals.states.add("drag"):k.internals.states.delete("drag"),N?k.internals.states.add("droppable"):k.internals.states.delete("droppable")}this.#t=S,this.trackedDraggables.forEach(k=>{let R=pr(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("qti-draggable","true"),k.setAttribute("tabindex","0")):(k.style.cursor="",k.style.userSelect="",k.style.touchAction="",k.style.webkitUserSelect="",k.style.webkitTouchCallout="",k.removeAttribute("qti-draggable"),k.getAttribute("tabindex")==="0"&&k.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let c=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let v=_e(m,t),x=this.disabled||this.readonly,u=Zn(v)||pr(v),g=Date.now()-this.lastTouchStartAt<50;return v&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let v=_e(m,t);if(!v){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(v,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(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),l=a.when("mousedown").filter(m=>{let v=_e(m,t),x=this.disabled||this.readonly,u=Zn(v)||pr(v),g=m.button===0,y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=_e(m,t);!v||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(v,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let v=_e(m,t),x=this.disabled||this.readonly,u=Zn(v)||pr(v),g=!!(m.touches?.[0]||m.changedTouches?.[0]),y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=_e(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!v||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(v,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 v=this.trackedDraggables.filter(u=>!pr(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.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=_e(m,t),g=this.disabled||this.readonly,y=Zn(u)||pr(u);u&&["Space","Enter"].includes(m.code)&&!g&&!y&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:v.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>u.removeAttribute("hover")),h.dragging&&h.dropElement&&(h.dropElement.setAttribute("hover",""),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(c,l,d,f)}initiateDrag(a,c,l,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let v=y=>y.contains(a)||!!y.shadowRoot?.contains(a),x=this.trackedDroppables.some(v),u=this.trackedDroppables.find(v)||null;a.getAnimations().forEach(y=>y.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:c-g.left,y:l-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:c,y:l},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),u&&u.setAttribute("data-drag-source","true");let y=a.getAttribute("identifier");if(y){let w=Hr(this.trackedDragContainers,y);w.forEach(I=>Dt(I,"return-anchor",!0)),this.dragState.returnAnchorItems=w}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),Dt(a,"dragging",!0);this.updateClonePosition(c,l),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,c="pointer"){if(a==="touch"){if(c==="pointer")try{let w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.setPointerCapture&&w.setPointerCapture(I)}catch{}let g=w=>{w.cancelable&&(w.preventDefault(),c==="pointer"&&w.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 y=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),c==="pointer")try{let w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.releasePointerCapture&&w.releasePointerCapture(I)}catch{}};this.dragState.touchCleanup=y}let l=c==="mouse"?"mousemove":c==="touch"?"touchmove":"pointermove",d=c==="mouse"?"mouseup":c==="touch"?"touchend":"pointerup",h=g=>{let y=this.dragState.startedFromTrustedEvent;return y===void 0||g.isTrusted===y},f=document.when(l).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),c==="touch"){let y=g.touches?.[0]||g.changedTouches?.[0];if(!y)return;this.handleDragMove(y.clientX,y.clientY);return}if(c==="mouse"){let y=g;if(typeof y.buttons=="number"&&(y.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())}}),v=c==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):c==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];v&&u.push(v),this.dragSubscriptions.push(...u)}handleDragMove(a,c){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,c);let l=Br(this.allDropzones,a,c,this.dragState.dragClone,this.collisionDetectionAlgorithm,this.trackedDragContainers),d=Date.now(),h=d-(this.dragState.lastTargetChangeTime||0);l!==this.dragState.currentTarget&&(l===null||h>=50)&&(this.allDropzones.forEach(m=>ae(m,"hover",!1)),l&&ae(l,"hover",!0),this.dragState.currentTarget=l,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:c,currentTarget:l,sourceDroppable:d}=this.dragState,h=l;if(c){let v=c.getBoundingClientRect();h=Br(this.allDropzones,v.left+v.width/2,v.top+v.height/2,c,this.collisionDetectionAlgorithm,this.trackedDragContainers)??l}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),Dt(a,"dragging",!1)):this.handleInvalidDrop(a),c&&c.remove(),(this.dragState.returnAnchorItems||[]).forEach(v=>{Dt(v,"return-anchor",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,c){return this.trackedDroppables.includes(c)||this.trackedDragContainers.includes(c)}handleInvalidDrop(a){ti(a)}createDragClone(a,c){let l=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];l.style.setProperty(m,d.getPropertyValue(m))}let h=bl(a.isConnected?a:this,this.dragCloneRoot());return this.cloneFrame=yl(h),l.style.position="fixed",l.style.width=`${c.width/this.cloneFrame.scale.x}px`,l.style.height=`${c.height/this.cloneFrame.scale.y}px`,l.style.zIndex="9999",l.style.pointerEvents="none",l.style.touchAction="none",l.style.userSelect="none",l.style.opacity="0.8",l.removeAttribute("qti-draggable"),l.removeAttribute("tabindex"),l.setAttribute("data-drag-clone","true"),l.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(l),l}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,c){if(this.dragState.lastCoordinates={x:a,y:c},!this.dragState.dragClone)return;let{startOffset:l}=this.dragState,{x:d,y:h}=gh(this.cloneFrame,a-l.x,c-l.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,c=()=>{let{dragClone:l,dragSource:d,lastCoordinates:h}=this.dragState;if(!l)return;let f=d?.isConnected?d:this,m=bl(f,this.dragCloneRoot());m!==l.parentNode&&(m.appendChild(l),this.cloneFrame=yl(m),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",c),a.addEventListener("webkitfullscreenchange",c),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",c),a.removeEventListener("webkitfullscreenchange",c)}})}activateAllDroppables(){this.setInternalsState("dragzone-enabled",!0),this.setInternalsState("dragzone-active",!0),this.allDropzones.forEach(a=>{ae(a,"enabled",!0),ae(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{ae(a,"enabled",!1),ae(a,"active",!1),ae(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{Dt(a,"return-anchor",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(c){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",c)}}),this.dragSubscriptions=[],this.cloneFrame=gl,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,c){let l=this._internals;l?.states&&(c?l.states.add(a):l.states.delete(a))}cleanup(){this.subscriptions.forEach(a=>{try{a.unsubscribe()}catch{}}),this.subscriptions=[],this.dragState.dragClone&&this.dragState.dragClone.remove();for(let a of this.#t)yh(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return i};var vh={duration:250,easing:"ease",fill:"both"};function vl(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function wh(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Te(o){let t=new Map;return o.forEach(e=>{t.set(e,vl(e))}),t}function xh(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function Po(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 wl(o){return Po(o)>0}function Mo(o,t,e={}){let r=Po(o);if(r<=0)return null;let n=vl(o),{deltaX:i,deltaY:s,deltaW:a,deltaH:c}=xh(t,n);if(i===0&&s===0&&a===1&&c===1)return null;let{duration:l,easing:d,fill:h}={...vh,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${i}px, ${s}px) scale(${a}, ${c})`},{transformOrigin:"top left",transform:"none"}],{duration:l*r,easing:d,fill:h})}function Re(o,t={}){let e=new Map;return o.forEach((r,n)=>{if(!(n instanceof HTMLElement))return;let i=Mo(n,r,t);i&&e.set(n,i)}),e}var ei=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Nt=(o,t,e,r='slot[part="drags"]',n="closestCornersWithInventoryPriority")=>{let i=hl(o,t,e,r),s=Oo(i,t,e,r,n);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this._maxAssociations=0,this._maxAssociationsDefaultApplied=!1,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}get maxAssociations(){if(!this._maxAssociationsDefaultApplied){this._maxAssociationsDefaultApplied=!0;let l=this.tagName?.toLowerCase()||"";(l==="qti-graphic-gap-match-interaction"||l==="qti-gap-match-interaction")&&!this.hasAttribute("max-associations")&&this._maxAssociations===0&&(this._maxAssociations=1)}return this._maxAssociations}set maxAssociations(l){let d=this._maxAssociations;this._maxAssociations=l,this.requestUpdate("maxAssociations",d)}#t;isSwapTarget(l){let d=this.dragState.sourceDroppable,h=parseInt(l.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(l)&&!!d&&d!==l&&this.trackedDroppables.includes(d)}isDeclarativeTarget(l){return l?l.acceptsDeclarativeDrops===!0?!0:l.hasAttribute("data-declarative-drops"):!1}chipsIn(l){return this.isDeclarativeTarget(l)?[...this.#t.get(l)??[]]:Array.from(l.querySelectorAll(t))}droppableHolding(l){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(l)||d.contains(l)||!!d.shadowRoot?.contains(l))??null}placeChip(l,d){this.#t.set(l,[...this.#t.get(l)??[],d])}removeChipFromDroppable(l,d){let h=l??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&Ur(h,!1),this.syncDragDropState();return}d.remove()}clearChips(l){this.isDeclarativeTarget(l)?(this.#t.set(l,[]),this.syncDragDropState()):this.chipsIn(l).forEach(d=>d.remove()),Ur(l,!1)}syncDragDropState(){let l={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let v=this.chipsIn(f),x=this.isDeclarativeTarget(f)?v:Array.from(f.querySelectorAll('[qti-draggable="true"]'));l[m]=v.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(v.length,x.length),h[m]=v}this._dragDrop={dragsByTarget:l,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:l}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(l[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((l,d)=>l+d,0)}droppableAtCapacityFromState(l){let d=parseInt(l.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=l.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(l){this._enableFlipAnimations=!l}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&wl(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let l=this.getResponse,d=typeof l=="function"?l.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(l){if(Array.isArray(l)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=l,this._internals.setFormValue(JSON.stringify(l));return}let d=this.getValue,h=typeof d=="function"?d.call(this,l):l,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,v=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(v)?v:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof l=="string"&&l.length>0?[l]:[];this._internals.setFormValue(JSON.stringify(this._response))}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let l=this._pendingResponse;this._pendingResponse=void 0,this.response=l}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let l=this.dataset.choicesContainerWidth;l&&this.trackedDroppables.forEach(d=>{d.style.width=`${l}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(l){for(let h of l){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=l.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(l,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(l,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(l,d,h);let f=l.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity()}handleInvalidDrop(l){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!l)return;if(d&&f&&m)this.dropDraggableInDroppable(l,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(l,d,this.dragState.dragClone?.getBoundingClientRect());else if(To(l,"dragging")){this.restoreInventoryItem(l,this.dragState.dragClone?.getBoundingClientRect());let g=l.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let v=this.totalAssociationsFromState(),x=this.maxAssociations>0&&v>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity()}animateReturn(l,d){!l||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{Mo(l,wh(d),this.flipAnimationConfig)})}restoreInventoryItem(l,d){ti(l),l.style.display="",l.style.position="",this.animateReturn(l,d)}placeResponse(l){let[d,...h]=l.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=Hr(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(l,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(l,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(l,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let I=l.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(l),l),I&&this.restoreOriginalInInventory(I,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),v=Number.isNaN(m)?1:m,x=v===0||v>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Te(u):null;if(!x){let I=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(I){let A=I.getAttribute("identifier"),S=I.getBoundingClientRect();this.removeChipFromDroppable(d,I);let k=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&k&&k!==d&&this.isDeclarativeTarget(k)?k:null;R?(this.placeChip(R,I),Ur(R,!0),this.animateReturn(I,S)):A&&this.restoreOriginalInInventory(A,S)}}let y=l.cloneNode(!0);y.removeAttribute("style"),y.removeAttribute("data-keyboard-dragging"),y.setAttribute("qti-draggable","true"),y.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(y.setAttribute("part","drag"),y.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,y)):d.tagName==="SLOT"?y.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&y.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(y)),Ur(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Re(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let I=y.getBoundingClientRect(),A=h.left-I.left,S=h.top-I.top;(A!==0||S!==0)&&y.animate([{transform:`translate(${A}px, ${S}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let w=l.getAttribute("identifier");w&&this.updateInventoryBasedOnMatchMax(w),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(l,d){let h=l.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(v=>v.getAttribute("identifier")===h);m.forEach(v=>this.removeChipFromDroppable(f,v)),m.length>0&&this.chipsIn(f).length===0&&Ur(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(l,d){let h=Hr(this.trackedDragContainers,l),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[qti-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let v=this.enableFlipAnimations&&m.length>0?Te(m):null;h.forEach(x=>{ti(x),x.style.display="",x.style.visibility="visible"}),v&&this.enableFlipAnimations&&Re(v,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(l){let d=Hr(this.trackedDragContainers,l),h=fh(this.trackedDraggables,l),f=this.trackedDroppables.reduce((m,v)=>this.isDeclarativeTarget(v)?m+this.chipsIn(v).filter(x=>x.getAttribute("identifier")===l).length:m+v.querySelectorAll(`[identifier="${l}"]`).length,0);d.forEach(m=>{Dt(m,"placeholder",h!==0&&f>=h)})}checkAllMaxAssociations(){let l=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&l>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(f)||d&&h)&&!m?f.setAttribute("disabled",""):f.removeAttribute("disabled")})}saveResponse(l){let d=this.getResponse,h=l??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(l=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),l&&this.saveResponse()}validate(){let l=this.totalAssociationsFromState(),d=this.maxAssociations>0&&l>=this.maxAssociations,h=this.maxAssociations>0&&l>this.maxAssociations,f=this.minAssociations>0&&l<this.minAssociations,m="",v=!0;h?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,v=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,v=!1):f?(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"}.`,v=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(v,m,x,{suppressInline:!0}),v}reportValidity(){return super.reportValidity()}}return ei([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),ei([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),ei([B({context:Ee})],a.prototype,"_dragDrop",void 0),ei([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),ei([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Wt({emptyAs:[]})})],a.prototype,"response",null),a};var Do=class{getInsertPosition(t,e,r,n,i){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),c=(i-a.top)/a.height,d=Math.min(1,Math.max(0,c))>.5;return{index:s,placeAfter:d}}};var qh=new Do;var om={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function ri(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function No(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function $o(o,t,e={}){let r={...om,...e},n=document.createElement("div");return n.setAttribute("data-drop-placeholder","true"),n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.style.margin=window.getComputedStyle(o).margin,n.style.boxSizing="border-box",n.style.border=`${r.borderStyle} ${r.borderColor}`,n.style.borderRadius=getComputedStyle(o).borderRadius,n.style.background=r.background,n.style.transition=`transform ${r.transitionDuration*Po(o)}ms ease`,n.style.pointerEvents="none",n}function xl(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var $t=(o,t='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=ri(),this.#n={hoveredSlot:null,originalPositions:new Map},this.#i=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#r;#n;#i;#o;set allowReorder(n){this.#o=n}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(n){return xl(n,this.trackedDroppables)}#s(n){return n.querySelector(t)}#a(n){let i=this.#l(n);return i===0||i>1}#l(n){let i=parseInt(n.getAttribute("match-max")||"1",10);return Number.isNaN(i)?1:i}#h(n){return n.querySelectorAll(t).length}#c(n){let i=this.#l(n);return i===0?!1:this.#h(n)>=i}#d(){this.#n={hoveredSlot:null,originalPositions:new Map}}#p(n){if(!this.#t||n===this.#t){this.#u();return}if(this.#n.hoveredSlot===n)return;this.#u();let i=this.#s(n);if(!i){this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#n.hoveredSlot=n;return}if(this.#a(n)){if(this.#c(n)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#n.hoveredSlot=null;return}this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#n.hoveredSlot=n;return}if(this.isDeclarativeTarget(n)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#n.hoveredSlot=n;return}let a=Te([i]);this.#n.originalPositions.set(i,n),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(i),this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#n.hoveredSlot=n,Re(a,this.sortableAnimationConfig)}#u(){if(this.#n.originalPositions.size===0&&this.#n.hoveredSlot===null)return;let n=Array.from(this.#n.originalPositions.keys()),i=n.length>0?Te(n):null;for(let[s,a]of this.#n.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),i&&Re(i,this.sortableAnimationConfig),this.#n.originalPositions.clear(),this.#n.hoveredSlot=null}initiateDrag(n,i,s,a,...c){this.#t=null,this.#r=ri(),this.#d();let l=this.findContainingDroppable(n);if(this.#e=l,l&&this.allowReorder){this.#t=l,this.#r.sortContainer=l;let h=n.getBoundingClientRect();this.#r.placeholder=$o(n,h,this.sortablePlaceholderConfig);let f=n.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",l.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==l&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#c(m))return;m.removeAttribute("disabled"),this.#i.add(m)}})}let[d]=c;super.initiateDrag(n,i,s,a,d)}cleanupSortableState(n=!0){if(n)for(let[i,s]of this.#n.originalPositions)s.appendChild(i);this.#r.placeholder&&this.#r.placeholder.remove(),No(this.#r),this.#i.clear(),this.#t=null,this.#d()}onSortableDragMove(n,i){if(!this.isDraggingFromSlot)return;let s=Br(this.trackedDroppables,n,i,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#p(s):this.#u()}handleDragMove(n,i){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,n,i),this.onSortableDragMove(n,i)}allowDrop(n,i){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&i!==this.#e&&this.trackedDroppables.includes(i)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(i)?this.#a(i)?!this.#c(i):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(i)?!0:super.allowDrop(n,i)}handleDrop(n,i){super.handleDrop(n,i),this.cleanupSortableState(!1)}handleInvalidDrop(n){this.cleanupSortableState(),super.handleInvalidDrop(n)}}return e};var Ch=[O,U,Ut,q`
|
|
6996
|
+
<slot part="label"></slot>`}};Oo([p({type:String,attribute:"template-identifier"})],$t.prototype,"templateIdentifier",void 0);Oo([p({type:String,attribute:"show-hide"})],$t.prototype,"showHide",void 0);Oo([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],$t.prototype,"fixed",void 0);Oo([p({type:String,attribute:!1})],$t.prototype,"marker",void 0);var mh=[{tag:"qti-simple-choice",ctor:$t}];var fh=[...Xd,...Kd,...Zd,...rh,...nh,...sh,...lh,...dh,...ph,...mh];var am=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i};function lm(o,t,e,r,n={}){let i=n.publishWidth??!0,s=n.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")}),n.hasChanged?.({height:a,width:l})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),i&&(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`),i&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var bl=(o,t,e,r='slot[part="drags"]')=>{class n 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&&(lm(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 am([p({type:Boolean,attribute:"auto-size-dropzones"})],n.prototype,"autoSizeDropzones",void 0),n};var{AbortController:Kt,AbortSignal:yl,WeakMap:cm,WeakRef:dm,Window:gh,reportError:Po=console.log}=globalThis,Oe=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||Oe(o.defaultView.parent.document)),mr=()=>!!gh&&globalThis instanceof gh,vl=Symbol("unset"),[bh,hm]=(()=>{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((y,w)=>(x=y,u=w)),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 n=new cm,i={next(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.next(...x))},return(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>y.return?y.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=n.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:y}=g;return t(()=>{if(!y.throw)throw y.return(),new TypeError("no throw method");return y.throw(...x)})}};function s(x){let u=Object.create(i);return n.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 y=r(x,g);return s(y)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(x,g)}let l="any"in yl?yl.any.bind(yl):x=>{let u=new Kt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},c=x=>l(x.filter(Boolean));class d{constructor({next:u,error:g,complete:y}={}){n.set(this,{next:u,error:g,complete:y})}next(u){let{next:g}=n.get(this)||{};g&&g(u)}error(u){let{error:g}=n.get(this)||{};g?g(u):Po(u)}complete(){let{complete:u}=n.get(this)||{};u&&u()}}function h(x,u){let g=n.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let y of g.teardowns.reverse()){if(mr()&&!Oe(document))return;try{y()}catch(w){Po(w)}}}}function f(x,u,g={}){if(mr()&&!Oe(document))return;let y;typeof u=="function"?y=new d({next:u}):u&&!(u instanceof d)?y=new d(u):y=u||new d;let w=n.get(x),I=w.weakSubscriber?.deref();if(I?.active){let k=I,S=n.get(k);S.observers.add(y),g.signal&&(g.signal.aborted?S.observers.delete(y):g.signal.addEventListener("abort",()=>{let R=n.get(k);R?.active&&(R.observers.delete(y),R.observers.size==0&&h(k,g.signal.reason))}));return}let A=new m(y);if(w.weakSubscriber=new dm(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let k=n.get(A);k?.active&&(k.observers.delete(y),k.observers.size==0&&h(A,g.signal.reason))})),w.subscribeCallback)try{w.subscribeCallback(A)}catch(k){A.error(k)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");n.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Kt})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=n.get(this);if(!g?.active||mr()&&!Oe(document))return;let y=new Set(g.observers);for(let w of y)w.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=n.get(this);if(!g?.active){Po(u);return}if(mr()&&!Oe(document))return;h(this,u);let y=new Set(g.observers);for(let w of y)w.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=n.get(this);if(!u?.active||mr()&&!Oe(document))return;h(this);let g=new Set(u.observers);for(let y of g)y.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(mr()&&!Oe(document))return;let g=n.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!n.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!n.has(this)){let u=new Kt;return u.abort(),u.signal}return n.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 v{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");n.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 v)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let I=function(A,k){if(A.signal.aborted)return;let S;try{let R=k.next();S=Promise.resolve(R)}catch(R){S=Promise.reject(R)}S.then(R=>{if(R===null||typeof R!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:w}=R)}catch(V){A.error(V);return}if(w){A.complete();return}let N;try{N=R.value}catch(V){A.error(V);return}A.next(N),I(A,k)},R=>{A.error(R)})},w=!1;return new v(A=>{if(A.signal.aborted)return;let k;try{k=a(u,!0)}catch(R){A.error(R);return}let S=k;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof S.return!="function"||w)return;t(()=>S.return(A.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),I(A,S))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new v(w=>{if(w.signal.aborted)return;let I;try{I=a(u,!1)}catch(S){w.error(S);return}let A=!1,k=I;if(!w.signal.aborted)for(w.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||A)return;let S=k.return();if(S===null||typeof S!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let S=k.next();if({done:A}=S,A){w.complete();return}if(w.next(S.value),w.signal.aborted)break}catch(S){w.error(S);break}});if(u instanceof Promise||typeof u.then=="function")return new v(w=>{u.then(I=>{w.next(I),w.complete()},I=>{w.error(I)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this,y=v.from(u);return new v(w=>{let I=new d({next(){w.complete()},error(){w.complete()}}),A={signal:w.signal};if(f(y,I,A),!w.active)return;let k=new d({next(S){w.next(S)},error(S){w.error(S)},complete(){w.complete()}});f(g,k,A)})}map(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=new d({next(k){let S;try{S=u(k,w)}catch(R){y.error(R);return}w+=1,y.next(S)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}inspect(u={}){let g=null,y=null,w=null,I=null,A=null;typeof u=="function"?y=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(y=u.next),"error"in u&&(w=u.error),"complete"in u&&(I=u.complete),"abort"in u&&(A=u.abort));let k=this;return new v(S=>{if(g!==null)try{g()}catch($){S.error($);return}let R=()=>{try{A!==null&&A(S.signal.reason)}catch($){Po($)}};S.signal.addEventListener("abort",R,{once:!0});let N=new d({next($){if(y!==null)try{y($)}catch(ht){S.signal.removeEventListener("abort",R),S.error(ht);return}S.next($)},error($){if(S.signal.removeEventListener("abort",R),w!==null)try{w($)}catch(ht){S.error(ht);return}S.error($)},complete(){if(S.signal.removeEventListener("abort",R),I!==null)try{I()}catch($){S.error($);return}S.complete()}}),V={signal:S.signal};f(k,N,V)})}filter(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=new d({next(k){let S=!1;try{S=u(k,w)}catch(R){y.error(R);return}w+=1,S&&y.next(k)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}take(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u;if(w==0)return y.complete();let I=new d({next(k){y.next(k),w-=1,w==0&&y.complete()},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}drop(u){if(!(this instanceof v))throw new TypeError("illegal invocation");let g=this;return new v(y=>{let w=u,I=new d({next(k){if(w>0)return w-=1;w==0&&y.next(k)},error(k){y.error(k)},complete(){y.complete()}}),A={signal:y.signal};f(g,I,A)})}flatMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=!1,A=[];function k(V){let $;try{$=u(V,w)}catch(Zt){return y.error(Zt)}w+=1;let ht;try{ht=v.from($)}catch(Zt){return y.error(Zt)}let fa=new d({next(Zt){y.next(Zt)},error(Zt){y.error(Zt)},complete(){if(A.length){let Zt=A.shift();k(Zt)}else S=!1,I&&y.complete()}}),Ft={signal:y.signal};f(ht,fa,Ft)}let S=!1,R=new d({next(V){S?A.push(V):(S=!0,k(V))},error(V){y.error(V)},complete(){I=!0,!S&&!A.length&&y.complete()}}),N={signal:y.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{let w=0,I=!1,A=null;function k(N){let V;try{V=u(N,w)}catch(Ft){return y.error(Ft)}w+=1;let $;try{$=v.from(V)}catch(Ft){return y.error(Ft)}let ht=new d({next(Ft){y.next(Ft)},error(Ft){y.error(Ft)},complete(Ft){I?y.complete():A=null}}),fa={signal:c([A.signal,y.signal])};f($,ht,fa)}let S=new d({next(N){A&&A.abort(),A=new Kt,k(N)},error(N){y.error(N)},complete(){I=!0,A||y.complete()}}),R={signal:y.signal};f(g,S,R)})}catch(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(w=>{let I=new d({next(k){w.next(k)},error(k){let S;try{S=u(k)}catch($){w.error($);return}let R;try{R=v.from(S)}catch($){w.error($);return}let N=new d({next($){w.next($)},error($){w.error($)},complete(){w.complete()}}),V={signal:w.signal};f(R,N,V)},complete(){w.complete()}}),A={signal:w.signal};f(g,I,A)})}finally(u){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new v(y=>{y.addTeardown(u);let w=new d({next(A){y.next(A)},error(A){y.error(A)},complete(){y.complete()}}),I={signal:y.signal};f(g,w,I)})}toArray(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=[],A=new d({next(k){I.push(k)},error(k){w(k)},complete(){y(I)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Kt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){try{u(N,S)}catch(V){I(V),A.abort(V)}S+=1},error(N){I(N)},complete(){w()}});return f(this,R,k),y}every(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Kt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch($){I($),A.abort($)}S+=1,V||(w(!1),A.abort())},error(N){I(N)},complete(){w(!0)}});return f(this,R,k),y}first(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e(),I=new Kt,A={signal:c([I.signal,u.signal])};if(A.signal.aborted)return w(A.signal.reason),g;A.signal.addEventListener("abort",()=>{w(A.signal.reason)});let k=new d({next(S){y(S),I.abort()},error(S){w(S)},complete(){w(new RangeError("No values in Observable"))}});return f(this,k,A),g}last(u={}){if(!(this instanceof v))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:w}=e();if(u.signal){if(u.signal.aborted)return w(u.signal.reason),g;u.signal.addEventListener("abort",()=>{w(u.signal.reason)})}let I=null,A=!1,k=new d({next(S){A=!0,I=S},error(S){w(S)},complete(){A?y(I):w(new RangeError("No values in Observable"))}});return f(this,k,u),g}find(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Kt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch($){I($),A.abort($)}S+=1,V&&(w(N),A.abort())},error(N){I(N)},complete(){w()}});return f(this,R,k),y}some(u,g={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:w,reject:I}=e(),A=new Kt,k={signal:c([A.signal,g.signal])};if(k.signal.aborted)return I(k.signal.reason),y;k.signal.addEventListener("abort",()=>{I(k.signal.reason)});let S=0,R=new d({next(N){let V=!1;try{V=u(N,S)}catch($){I($),A.abort($)}S+=1,V&&(w(!0),A.abort())},error(N){I(N)},complete(){w(!1)}});return f(this,R,k),y}reduce(u,g,y={}){if(!(this instanceof v))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:w,resolve:I,reject:A}=e(),k=new Kt,S={signal:c([k.signal,y.signal])};if(S.signal.aborted)return A(S.signal.reason),w;S.signal.addEventListener("abort",()=>{A(S.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:vl,V=new d({next($){if(N===vl){N=$,R++;return}try{let ht=u(N,$,R);R++,N=ht}catch(ht){A(ht),k.abort(ht);return}},error($){A($)},complete(){N!==vl?I(N):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,S),w}}return o(v.prototype,"subscribe"),[v,m]})();function yh(){return typeof globalThis.Observable=="function"}function vh(){Object.defineProperties(globalThis,{Observable:{value:bh,configurable:!0,writable:!0},Subscriber:{value:hm,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(mr()&&!Oe(document))return;let e=this;return new bh(r=>{if(!e||r.signal.aborted)return;let n=i=>{r.next(i)};e.addEventListener(o,n,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function wl(o,t,e){let r=o.filter(n=>!n.hasAttribute("disabled"));for(let n of r){let i=n.getBoundingClientRect();if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)return n}return null}function wh(o,t,e,r){if(!r)return null;let n=o.filter(s=>!s.hasAttribute("disabled")),i=r.getBoundingClientRect();for(let s of n){let a=s.getBoundingClientRect();if(!(i.right<a.left||i.left>a.right||i.bottom<a.top||i.top>a.bottom))return s}return null}function xh(o,t,e,r){let n=o.filter(c=>!c.hasAttribute("disabled"));if(n.length===0)return null;let i,s;if(r){let c=r.getBoundingClientRect();i=c.left+c.width/2,s=c.top+c.height/2}else i=t,s=e;let a=null,l=1/0;for(let c of n){let d=c.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(i-h,2)+Math.pow(s-f,2));m<l&&(l=m,a=c)}return a}function qh(o,t,e,r){let n=o.filter(l=>!l.hasAttribute("disabled"));if(n.length===0)return null;let i;if(r){let l=r.getBoundingClientRect();i=[{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 i=[{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 n){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 v of i)for(let x of d){let u=Math.sqrt(Math.pow(v.x-x.x,2)+Math.pow(v.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function pm(o,t,e){let r=o.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function um(o,t,e,r,n){let i=n&&n.length>0?o.filter(g=>n.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.includes("drags")),a=o.filter(g=>!i.includes(g));if(i.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 y=g.getBoundingClientRect(),w=[{x:y.left,y:y.top},{x:y.right,y:y.top},{x:y.left,y:y.bottom},{x:y.right,y:y.bottom}],I=0,A=0;for(let k of l)for(let S of w){let R=Math.sqrt(Math.pow(k.x-S.x,2)+Math.pow(k.y-S.y,2));I+=R,A++}return I/A},d=null,h=1/0;for(let g of i){let y=c(g);y<h&&(h=y,d=g)}let f=null,m=1/0;for(let g of a){let y=c(g);y<m&&(m=y,f=g)}if(d&&r){let g=r.getBoundingClientRect(),y=d.getBoundingClientRect(),w=g.left+g.width/2,I=g.top+g.height/2;if(w>=y.left&&w<=y.right&&I>=y.top&&I<=y.bottom)return d}if(f&&pm(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 Ch(o){switch(o){case"pointerWithin":return wl;case"rectangleIntersection":return wh;case"closestCenter":return xh;case"closestCorners":return qh;case"closestCornersWithInventoryPriority":return um;default:return wl}}function Br(o,t,e,r,n="pointerWithin",i){return Ch(n)(o,t,e,r,i)}function Pe(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("qti-draggable"))return r;let n=r.closest(t)||r.closest('[qti-draggable="true"]');if(n)return n}return null}function tn(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var xl=o=>o?.internals;function Lt(o,t,e){let r=xl(o)?.states;r&&(e?r.add(t):r.delete(t))}function Mo(o,t){return xl(o)?.states?.has(t)??!1}function en(o){Lt(o,"dragging",!1),Lt(o,"placeholder",!1),Lt(o,"return-anchor",!1)}function fr(o){return Mo(o,"dragging")||Mo(o,"placeholder")}function ce(o,t,e){if(!o)return;e?o.setAttribute(t,""):o.removeAttribute(t);let r=xl(o)?.states;if(r){e?r.add(t):r.delete(t);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));n.has("drop")&&(e?n.add(t):n.delete(t),o.setAttribute("part",[...n].join(" ")))}function Ur(o,t){ce(o,"filled",t)}function Hr(o,t){let e=[];return o.forEach(r=>{let n=[];r.tagName.toLowerCase()==="slot"?n=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):n=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...n)}),e}function Sh(o,t){let e=o.find(n=>n.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var ql={origin:{x:0,y:0},scale:{x:1,y:1}},Do=100,mm=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},fm=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},gm=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},Cl=(o,t)=>{let e=o.ownerDocument??document,r=t??e.body,n=mm(e);return n&&!gm(n,r)?fm(n):r},Sl=o=>{let e=(o.ownerDocument??document).createElement("div");e.style.cssText=`position:fixed;left:0;top:0;width:${Do}px;height:${Do}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(e);let r=e.getBoundingClientRect();return e.remove(),{origin:{x:r.left,y:r.top},scale:{x:r.width/Do||1,y:r.height/Do||1}}},kh=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});yh()||vh();var Eh=new WeakSet;function bm(o){!o||Eh.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Eh.add(o))}var Ah=o=>!!o.internals?.states,No=(o,t,e,r='slot[part="drags"]',n="pointerWithin")=>{class i extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=n,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=ql,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!==kr)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}),bm(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=(S,R)=>Array.from(R?.querySelectorAll(S)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[qti-draggable="true"]:not([data-drag-clone])',this),h=a('[qti-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),v=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...v]));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(),y=new Set(this.trackedDraggables),w=new Set(this.trackedDroppables),I=g?y:new Set,A=g?w:new Set,k=new Set([...y,...w].filter(Ah));for(let S of this.#t)k.has(S)||(S.internals.states.delete("drag"),S.internals.states.delete("droppable"));for(let S of k){let R=I.has(S),N=!R&&A.has(S);R?S.internals.states.add("drag"):S.internals.states.delete("drag"),N?S.internals.states.add("droppable"):S.internals.states.delete("droppable")}this.#t=k,this.trackedDraggables.forEach(S=>{let R=fr(S);g&&!R?(S.style.cursor="grab",S.style.userSelect="none",S.style.touchAction="none",S.style.webkitUserSelect="none",S.style.webkitTouchCallout="none",S.setAttribute("qti-draggable","true"),S.setAttribute("tabindex","0")):(S.style.cursor="",S.style.userSelect="",S.style.touchAction="",S.style.webkitUserSelect="",S.style.webkitTouchCallout="",S.removeAttribute("qti-draggable"),S.getAttribute("tabindex")==="0"&&S.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 v=Pe(m,t),x=this.disabled||this.readonly,u=tn(v)||fr(v),g=Date.now()-this.lastTouchStartAt<50;return v&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let v=Pe(m,t);if(!v){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(v,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(v,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let v=Pe(m,t),x=this.disabled||this.readonly,u=tn(v)||fr(v),g=m.button===0,y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=Pe(m,t);!v||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(v,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let v=Pe(m,t),x=this.disabled||this.readonly,u=tn(v)||fr(v),g=!!(m.touches?.[0]||m.changedTouches?.[0]),y=Date.now()-this.lastPointerDownAt<50;return v&&g&&!x&&!u&&!y}).subscribe(m=>{let v=Pe(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!v||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(v,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 v=this.trackedDraggables.filter(u=>!fr(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.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.trackedDraggables.forEach(u=>u.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=Pe(m,t),g=this.disabled||this.readonly,y=tn(u)||fr(u);u&&["Space","Enter"].includes(m.code)&&!g&&!y&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:v.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>u.removeAttribute("hover")),h.dragging&&h.dropElement&&(h.dropElement.setAttribute("hover",""),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(l,c,d,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 v=y=>y.contains(a)||!!y.shadowRoot?.contains(a),x=this.trackedDroppables.some(v),u=this.trackedDroppables.find(v)||null;a.getAnimations().forEach(y=>y.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(),u&&u.setAttribute("data-drag-source","true");let y=a.getAttribute("identifier");if(y){let w=Hr(this.trackedDragContainers,y);w.forEach(I=>Lt(I,"return-anchor",!0)),this.dragState.returnAnchorItems=w}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),Lt(a,"dragging",!0);this.updateClonePosition(l,c),this.activateAllDroppables(),this.watchDragCloneHost(),this.setupMoveObservables(d,h)}setupMoveObservables(a,l="pointer"){if(a==="touch"){if(l==="pointer")try{let w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.setPointerCapture&&w.setPointerCapture(I)}catch{}let g=w=>{w.cancelable&&(w.preventDefault(),l==="pointer"&&w.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 y=()=>{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 w=this.dragState.dragSource,I=this.dragState.pointerId;w&&I!==void 0&&w.releasePointerCapture&&w.releasePointerCapture(I)}catch{}};this.dragState.touchCleanup=y}let c=l==="mouse"?"mousemove":l==="touch"?"touchmove":"pointermove",d=l==="mouse"?"mouseup":l==="touch"?"touchend":"pointerup",h=g=>{let y=this.dragState.startedFromTrustedEvent;return y===void 0||g.isTrusted===y},f=document.when(c).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),l==="touch"){let y=g.touches?.[0]||g.changedTouches?.[0];if(!y)return;this.handleDragMove(y.clientX,y.clientY);return}if(l==="mouse"){let y=g;if(typeof y.buttons=="number"&&(y.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())}}),v=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];v&&u.push(v),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=Br(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=>ce(m,"hover",!1)),c&&ce(c,"hover",!0),this.dragState.currentTarget=c,this.dragState.lastTargetChangeTime=d)}handleDragEnd(){if(!this.dragState.dragging)return;let{dragSource:a,dragClone:l,currentTarget:c,sourceDroppable:d}=this.dragState,h=c;if(l){let v=l.getBoundingClientRect();h=Br(this.allDropzones,v.left+v.width/2,v.top+v.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),Lt(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(v=>{Lt(v,"return-anchor",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,l){return this.trackedDroppables.includes(l)||this.trackedDragContainers.includes(l)}handleInvalidDrop(a){en(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))}let h=Cl(a.isConnected?a:this,this.dragCloneRoot());return this.cloneFrame=Sl(h),c.style.position="fixed",c.style.width=`${l.width/this.cloneFrame.scale.x}px`,c.style.height=`${l.height/this.cloneFrame.scale.y}px`,c.style.zIndex="9999",c.style.pointerEvents="none",c.style.touchAction="none",c.style.userSelect="none",c.style.opacity="0.8",c.removeAttribute("qti-draggable"),c.removeAttribute("tabindex"),c.setAttribute("data-drag-clone","true"),c.setAttribute("data-drag-interaction",this.tagName.toLowerCase()),h.appendChild(c),c}dragCloneRoot(){let a=this.getRootNode();return a instanceof ShadowRoot?a:null}updateClonePosition(a,l){if(this.dragState.lastCoordinates={x:a,y:l},!this.dragState.dragClone)return;let{startOffset:c}=this.dragState,{x:d,y:h}=kh(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=Cl(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=Sl(m),h&&this.updateClonePosition(h.x,h.y))};a.addEventListener("fullscreenchange",l),a.addEventListener("webkitfullscreenchange",l),this.dragSubscriptions.push({unsubscribe:()=>{a.removeEventListener("fullscreenchange",l),a.removeEventListener("webkitfullscreenchange",l)}})}activateAllDroppables(){this.setInternalsState("dragzone-enabled",!0),this.setInternalsState("dragzone-active",!0),this.allDropzones.forEach(a=>{ce(a,"enabled",!0),ce(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{ce(a,"enabled",!1),ce(a,"active",!1),ce(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{Lt(a,"return-anchor",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(l){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",l)}}),this.dragSubscriptions=[],this.cloneFrame=ql,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)Ah(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return i};var Ih={duration:250,easing:"ease",fill:"both"};function kl(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function _h(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Me(o){let t=new Map;return o.forEach(e=>{t.set(e,kl(e))}),t}function Th(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function $o(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 El(o){return $o(o)>0}function Lo(o,t,e={}){let r=$o(o);if(r<=0)return null;let n=kl(o),{deltaX:i,deltaY:s,deltaW:a,deltaH:l}=Th(t,n);if(i===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...Ih,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${i}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*r,easing:d,fill:h})}function De(o,t={}){let e=new Map;return o.forEach((r,n)=>{if(!(n instanceof HTMLElement))return;let i=Lo(n,r,t);i&&e.set(n,i)}),e}var rn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Vt=(o,t,e,r='slot[part="drags"]',n="closestCornersWithInventoryPriority")=>{let i=bl(o,t,e,r),s=No(i,t,e,r,n);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this._maxAssociations=0,this._maxAssociationsDefaultApplied=!1,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}get maxAssociations(){if(!this._maxAssociationsDefaultApplied){this._maxAssociationsDefaultApplied=!0;let c=this.tagName?.toLowerCase()||"";(c==="qti-graphic-gap-match-interaction"||c==="qti-gap-match-interaction")&&!this.hasAttribute("max-associations")&&this._maxAssociations===0&&(this._maxAssociations=1)}return this._maxAssociations}set maxAssociations(c){let d=this._maxAssociations;this._maxAssociations=c,this.requestUpdate("maxAssociations",d)}#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&&Ur(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()),Ur(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let v=this.chipsIn(f),x=this.isDeclarativeTarget(f)?v:Array.from(f.querySelectorAll('[qti-draggable="true"]'));c[m]=v.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(v.length,x.length),h[m]=v}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&&El(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,v=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(v)?v:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof c=="string"&&c.length>0?[c]:[];this._internals.setFormValue(JSON.stringify(this._response))}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let c=this._pendingResponse;this._pendingResponse=void 0,this.response=c}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let c=this.dataset.choicesContainerWidth;c&&this.trackedDroppables.forEach(d=>{d.style.width=`${c}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(c){for(let h of c){let 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()}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(Mo(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let v=this.totalAssociationsFromState(),x=this.maxAssociations>0&&v>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity()}animateReturn(c,d){!c||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{Lo(c,_h(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){en(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=Hr(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 I=c.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(c),c),I&&this.restoreOriginalInInventory(I,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),v=Number.isNaN(m)?1:m,x=v===0||v>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Me(u):null;if(!x){let I=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(I){let A=I.getAttribute("identifier"),k=I.getBoundingClientRect();this.removeChipFromDroppable(d,I);let S=this.dragState.sourceDroppable,R=this.isDeclarativeTarget(d)&&S&&S!==d&&this.isDeclarativeTarget(S)?S:null;R?(this.placeChip(R,I),Ur(R,!0),this.animateReturn(I,k)):A&&this.restoreOriginalInInventory(A,k)}}let y=c.cloneNode(!0);y.removeAttribute("style"),y.removeAttribute("data-keyboard-dragging"),y.setAttribute("qti-draggable","true"),y.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(y.setAttribute("part","drag"),y.setAttribute("exportparts","control: drag-control, label: drag-label, correction, correction-correct, correction-incorrect"),this.placeChip(d,y)):d.tagName==="SLOT"?y.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&y.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(y)),Ur(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&De(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let I=y.getBoundingClientRect(),A=h.left-I.left,k=h.top-I.top;(A!==0||k!==0)&&y.animate([{transform:`translate(${A}px, ${k}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let w=c.getAttribute("identifier");w&&this.updateInventoryBasedOnMatchMax(w),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(v=>v.getAttribute("identifier")===h);m.forEach(v=>this.removeChipFromDroppable(f,v)),m.length>0&&this.chipsIn(f).length===0&&Ur(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=Hr(this.trackedDragContainers,c),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[qti-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let v=this.enableFlipAnimations&&m.length>0?Me(m):null;h.forEach(x=>{en(x),x.style.display="",x.style.visibility="visible"}),v&&this.enableFlipAnimations&&De(v,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=Hr(this.trackedDragContainers,c),h=Sh(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,v)=>this.isDeclarativeTarget(v)?m+this.chipsIn(v).filter(x=>x.getAttribute("identifier")===c).length:m+v.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{Lt(m,"placeholder",h!==0&&f>=h)})}checkAllMaxAssociations(){let c=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&c>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(f)||d&&h)&&!m?f.setAttribute("disabled",""):f.removeAttribute("disabled")})}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._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="",v=!0;h?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,v=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,v=!1):f?(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"}.`,v=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(v,m,x,{suppressInline:!0}),v}reportValidity(){return super.reportValidity()}}return rn([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),rn([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),rn([B({context:Te})],a.prototype,"_dragDrop",void 0),rn([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),rn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Gt({emptyAs:[]})})],a.prototype,"response",null),a};var Vo=class{getInsertPosition(t,e,r,n,i){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),l=(i-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var Rh=new Vo;var ym={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function nn(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function zo(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function jo(o,t,e={}){let r={...ym,...e},n=document.createElement("div");return n.setAttribute("data-drop-placeholder","true"),n.style.width=`${t.width}px`,n.style.height=`${t.height}px`,n.style.margin=window.getComputedStyle(o).margin,n.style.boxSizing="border-box",n.style.border=`${r.borderStyle} ${r.borderColor}`,n.style.borderRadius=getComputedStyle(o).borderRadius,n.style.background=r.background,n.style.transition=`transform ${r.transitionDuration*$o(o)}ms ease`,n.style.pointerEvents="none",n}function Al(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var zt=(o,t='[qti-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=nn(),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(n){this.#o=n}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(n){return Al(n,this.trackedDroppables)}#s(n){return n.querySelector(t)}#a(n){let i=this.#c(n);return i===0||i>1}#c(n){let i=parseInt(n.getAttribute("match-max")||"1",10);return Number.isNaN(i)?1:i}#p(n){return n.querySelectorAll(t).length}#l(n){let i=this.#c(n);return i===0?!1:this.#p(n)>=i}#d(){this.#i={hoveredSlot:null,originalPositions:new Map}}#m(n){if(!this.#t||n===this.#t){this.#h();return}if(this.#i.hoveredSlot===n)return;this.#h();let i=this.#s(n);if(!i){this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#i.hoveredSlot=n;return}if(this.#a(n)){if(this.#l(n)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#i.hoveredSlot=null;return}this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#i.hoveredSlot=n;return}if(this.isDeclarativeTarget(n)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#i.hoveredSlot=n;return}let a=Me([i]);this.#i.originalPositions.set(i,n),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(i),this.#r.placeholder&&n.appendChild(this.#r.placeholder),this.#i.hoveredSlot=n,De(a,this.sortableAnimationConfig)}#h(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let n=Array.from(this.#i.originalPositions.keys()),i=n.length>0?Me(n):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),i&&De(i,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(n,i,s,a,...l){this.#t=null,this.#r=nn(),this.#d();let c=this.findContainingDroppable(n);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#r.sortContainer=c;let h=n.getBoundingClientRect();this.#r.placeholder=jo(n,h,this.sortablePlaceholderConfig);let f=n.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.#l(m))return;m.removeAttribute("disabled"),this.#n.add(m)}})}let[d]=l;super.initiateDrag(n,i,s,a,d)}cleanupSortableState(n=!0){if(n)for(let[i,s]of this.#i.originalPositions)s.appendChild(i);this.#r.placeholder&&this.#r.placeholder.remove(),zo(this.#r),this.#n.clear(),this.#t=null,this.#d()}onSortableDragMove(n,i){if(!this.isDraggingFromSlot)return;let s=Br(this.trackedDroppables,n,i,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#m(s):this.#h()}handleDragMove(n,i){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,n,i),this.onSortableDragMove(n,i)}allowDrop(n,i){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&i!==this.#e&&this.trackedDroppables.includes(i)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(i)?this.#a(i)?!this.#l(i):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(i)?!0:super.allowDrop(n,i)}handleDrop(n,i){super.handleDrop(n,i),this.cleanupSortableState(!1)}handleInvalidDrop(n){this.cleanupSortableState(),super.handleInvalidDrop(n)}}return e};var Oh=[O,U,Wt,q`
|
|
6984
6997
|
:host {
|
|
6985
6998
|
display: block; /* necessary to calculate scaling position */
|
|
6986
6999
|
}
|
|
@@ -7033,7 +7046,7 @@ div.full-correct-response-inline {
|
|
|
7033
7046
|
:host([answer-key]) ::slotted(qti-simple-associable-choice) {
|
|
7034
7047
|
display: none;
|
|
7035
7048
|
}
|
|
7036
|
-
`];var
|
|
7049
|
+
`];var Sm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},km=Vt(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),gr=class extends zt(km,'[qti-draggable="true"]'){static{this.styles=Oh}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 b`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
|
|
7037
7050
|
${H(r,n=>n.getAttribute("identifier"),n=>n)}
|
|
7038
7051
|
</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"]`),n=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),i=r&&this.chipsIn(r)[0]?.getAttribute("identifier"),s=n&&this.chipsIn(n)[0]?.getAttribute("identifier");i&&s&&t.push(`${i} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,r)=>{let n=e.split(" ");return n.length!==2?[]:[`${n[0]} droplist${r}_left`,`${n[1]} droplist${r}_right`]})??[]}render(){return b` <slot name="prompt"></slot>
|
|
7039
7052
|
<slot part="drags" name="qti-simple-associable-choice"></slot>
|
|
@@ -7044,7 +7057,7 @@ div.full-correct-response-inline {
|
|
|
7044
7057
|
</div>`)}
|
|
7045
7058
|
|
|
7046
7059
|
<div role="alert" part="message" id="validation-message"></div>
|
|
7047
|
-
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};
|
|
7060
|
+
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};Sm([T()],gr.prototype,"_childrenMap",void 0);var Fo=[{tag:"qti-associate-interaction",ctor:gr}];var Ne=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},$e=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(n,i)=>{this._choiceElements.forEach(s=>s.disabled=i)},this._handleReadonlyChange=(n,i)=>{this._choiceElements.forEach(s=>s.readonly=i)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(n,i){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(n){this.maxChoices>1&&(typeof n=="string"||n===null)?this.response=n?n.toString().split(","):[]:this.response=n||""}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 n=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{n.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let i=new Set(this._choiceElements.map(s=>s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>i.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!i.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let i=this._choiceElements.filter(c=>this._getChoiceChecked(c)).length,s=!0,a="";this.maxChoices!==0&&i>this.maxChoices?(s=!1,a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):i<this.minChoices&&(s=!1,a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(c=>this.contains(c))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0}),s}reportValidity(){return super.reportValidity()}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let n=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==n&&(this._interactionContext={...this._interactionContext,choiceRole:n})}_choiceElementSelectedHandler(n){this._toggleChoiceChecked(n.target);let i=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==n.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&i&&(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(n,i){n.internals?.states&&(i?(n.internals.states.add("checked"),n.internals.ariaChecked="true"):(n.internals.states.delete("checked"),n.internals.ariaChecked="false"))}_getChoiceChecked(n){return n.internals.states.has("checked")}_toggleChoiceChecked(n){let i=this._getChoiceChecked(n);this._setChoiceChecked(n,!i)}_handleChoiceSelection(){let i=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?i[0]||"":i,this.validate(),this.reportValidity(),this.saveResponse(this.response)}_updateChoiceSelection(){let n=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(i=>{let s=n.includes(i.identifier);this._setChoiceChecked(i,s)})}}return Ne([Sr("#validation-message")],e.prototype,"_validationMessageElement",void 0),Ne([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Ne([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Ne([L("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Ne([L("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Ne([L("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Ne([p({attribute:"response",reflect:!1,converter:Gt({emptyAs:""})})],e.prototype,"response",void 0),Ne([L("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var Em=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ph=(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(n){this.#t=this.#n(n),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(n,i,s){super.attributeChangedCallback(n,i,s),n==="class"&&i!==s&&(this.class=s??"")}updated(n){super.updated(n),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(n=>{n.some(i=>i.type==="childList"||i.type==="attributes"&&i.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(n){return n?n.split(/\s+/).map(i=>i.trim()).filter(Boolean).filter((i,s,a)=>a.indexOf(i)===s):[]}#o(){let n=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),i=this.#s(n),s=this.#a(),a=this.#c();i.forEach((l,c)=>{l.marker=this.#p(c+1,s,a)})}#s(n){return n.map((i,s)=>{let a=Number(i.style.order);return{el:i,order:Number.isFinite(a)?a:s+1,index:s}}).sort((i,s)=>i.order-s.order||i.index-s.index).map(i=>i.el)}#a(){return this.#t.filter(n=>this.#e.includes(n)).pop()??null}#c(){return this.#t.filter(n=>this.#r.includes(n)).pop()??null}#p(n,i,s){let a=i;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=`${n}`;break;case"qti-labels-lower-alpha":l=this.#l(n,"lower");break;case"qti-labels-upper-alpha":l=this.#l(n,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(n,i){let s=n,a="",l=i==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return Em([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var Mh=[O,U,q`
|
|
7048
7061
|
:host {
|
|
7049
7062
|
display: block;
|
|
7050
7063
|
}
|
|
@@ -7111,16 +7124,16 @@ div.full-correct-response-inline {
|
|
|
7111
7124
|
:host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
|
|
7112
7125
|
grid-row: auto;
|
|
7113
7126
|
}
|
|
7114
|
-
`];var
|
|
7127
|
+
`];var Am=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},br=class extends Ph($e(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=Mh}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return b`
|
|
7115
7128
|
<slot part="prompt" name="prompt"></slot>
|
|
7116
7129
|
<slot part="slot" @slotchange=${this.#t}></slot>
|
|
7117
7130
|
<div part="message" role="alert" id="validation-message"></div>
|
|
7118
|
-
`}};
|
|
7131
|
+
`}};Am([p({type:String})],br.prototype,"orientation",void 0);var Bo=[{tag:"qti-choice-interaction",ctor:br}];var Dh=[O,q`
|
|
7119
7132
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7120
7133
|
:host {
|
|
7121
7134
|
display: block;
|
|
7122
7135
|
}
|
|
7123
|
-
`];var
|
|
7136
|
+
`];var on=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Il=`
|
|
7124
7137
|
const postToParentWindows = (type, data) => {
|
|
7125
7138
|
window.top.postMessage(data ? { type, data } : { type }, '*');
|
|
7126
7139
|
let w = window.parent;
|
|
@@ -7187,7 +7200,7 @@ window.CES = {
|
|
|
7187
7200
|
},
|
|
7188
7201
|
};
|
|
7189
7202
|
CES.load();
|
|
7190
|
-
`,
|
|
7203
|
+
`,Im=`
|
|
7191
7204
|
(function() {
|
|
7192
7205
|
var blobUrlReceived = null;
|
|
7193
7206
|
|
|
@@ -7231,16 +7244,16 @@ CES.load();
|
|
|
7231
7244
|
requestBlobUrl();
|
|
7232
7245
|
}
|
|
7233
7246
|
})();
|
|
7234
|
-
`,
|
|
7247
|
+
`,de=class extends D{#t;#e;#r;static{this.styles=Dh}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 n=r.getAttribute("width"),i=r.getAttribute("height");n&&this.setAttribute("width",n),i&&this.setAttribute("height",i)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:Un((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],n=this.#a(),i=await this.#l(r,n),s=i.url;if(i.baseUrl&&!this.#r&&(this.#r=i.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#l(h,n,{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>"+Il+"</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",v=await this.#l(m,n,{returnText:!0});if(d=v.url,v.baseUrl&&!this.#r&&(this.#r=v.baseUrl),v.text){let x=v.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let y="<script>"+Il+"</script>",w=x.indexOf("<head>");w!==-1?x=x.slice(0,w+6)+y+x.slice(w+6):x=y+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>"+Il+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let v=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(v)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${Im}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
|
|
7235
7248
|
<!DOCTYPE html>
|
|
7236
7249
|
<html>
|
|
7237
7250
|
<head>
|
|
7238
7251
|
${s?`<link href='${s}' rel="stylesheet" />`:""}
|
|
7239
|
-
${
|
|
7252
|
+
${l}
|
|
7240
7253
|
</head>
|
|
7241
7254
|
<body></body>
|
|
7242
7255
|
</html>
|
|
7243
|
-
`;t.srcdoc=
|
|
7256
|
+
`;t.srcdoc=c}#n(){let t=this.shadowRoot.querySelectorAll("iframe"),e=this.querySelectorAll("iframe"),r=[...t,...e];for(let n of r){let i=n.src;if(new URL(i,window.location.href).origin===window.location.origin)try{let a=n.contentDocument||n.contentWindow.document;a&&this.#o(a,r)}catch(a){console.error("Error accessing nested iframe:",a)}}return r.forEach((n,i)=>{r.indexOf(n)!==i&&r.splice(i,1)}),r}#o(t,e=[]){return t.querySelectorAll("iframe").forEach(n=>{e.push(n);let i=n.src;if(new URL(i,window.location.href).origin===window.location.origin)try{let a=n.contentDocument||n.contentWindow.document;this.#o(a,e)}catch(a){console.error("Error accessing nested iframe:",a)}else console.warn("Skipped cross-origin iframe:",i)}),e}#s(t,e){window.postMessage({type:t,data:e},"*");let r=this.#n();for(let n of r)n.contentWindow&&n.contentWindow.postMessage({type:t,data:e},"*")}handlePostMessage(t){let{type:e,data:r}=t.data;switch(e){case"setResponse":(r===null||!(Array.isArray(r)&&r.length===1&&r[0]===""))&&(this.#t=r,this.saveResponse(r));break;case"getResponse":{this.#s("responseData",this.#t);break}case"getBlobUrl":{this.#i&&(this.#s("blobUrl",this.#i),t.source&&t.source!==window&&t.source.postMessage({type:"blobUrl",data:this.#i},"*"));break}case"getMedia":{let n=this.#a(),i=this.manifest.media.map(s=>{if(s.startsWith("http")||s.startsWith("blob"))return s;let a=this.#r||n[0];return a?new URL(s,a.endsWith("/")?a:`${a}/`).toString():s});this.#s("mediaData",i);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){if(!this.#t)return!1;if(Array.isArray(this.#t)){if(this.#t.length===0)return!1;for(let t of this.#t)if(t!==""&&t!==null)return!0}return!0}get response(){return this.#t||null}set response(t){if(typeof t=="string")this.#t=t,this.saveResponse(t);else if(Array.isArray(t))this.#t=t;else if(t)throw new Error("Value must be a string or an array of strings")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return b`<iframe
|
|
7244
7257
|
width=${this.getAttribute("width")}
|
|
7245
7258
|
height=${this.getAttribute("height")}
|
|
7246
7259
|
frameborder="0"
|
|
@@ -7251,7 +7264,7 @@ CES.load();
|
|
|
7251
7264
|
${this._errorMessage&&b`<div style="color:red">
|
|
7252
7265
|
<h1>Error</h1>
|
|
7253
7266
|
${this._errorMessage}
|
|
7254
|
-
</div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#
|
|
7267
|
+
</div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(n=>new URL(n,window.location.href).toString()),r=this.#p();return r&&e.push(r),[...new Set(e)]}#c(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let n of e){let i=new URL(n,window.location.href).toString(),s=new URL(t,i.endsWith("/")?i:`${i}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let l=await a.text();return{url:s,baseUrl:i,text:l}}return{url:s,baseUrl:i}}}catch{}}return{url:"",baseUrl:null}}};on([p({type:String,attribute:"data"})],de.prototype,"data",void 0);on([p({type:String,attribute:"data-base-item"})],de.prototype,"baseItemUrl",void 0);on([p({type:String,attribute:"data-base-ref"})],de.prototype,"baseRefUrl",void 0);on([p({type:String,attribute:"id"})],de.prototype,"id",void 0);on([T()],de.prototype,"_errorMessage",void 0);var Uo=[{tag:"qti-custom-interaction",ctor:de}];var Nh=[O];var Ho=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Le=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=Nh}render(){return b`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(t){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};Ho([p({type:String,attribute:"response-identifier"})],Le.prototype,"responseIdentifier",void 0);Ho([p({reflect:!0,type:Boolean})],Le.prototype,"disabled",void 0);Ho([p({type:String,attribute:"count-attempt"})],Le.prototype,"countAttempt",void 0);Ho([p({type:String})],Le.prototype,"title",void 0);var Wo=[{tag:"qti-end-attempt-interaction",ctor:Le}];var $h=[O,q`
|
|
7255
7268
|
/* PK: display host as block, else design will be collapsed */
|
|
7256
7269
|
/* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
|
|
7257
7270
|
:host {
|
|
@@ -7264,7 +7277,7 @@ CES.load();
|
|
|
7264
7277
|
height: 100%;
|
|
7265
7278
|
border: 0;
|
|
7266
7279
|
}
|
|
7267
|
-
`];var
|
|
7280
|
+
`];var Et=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Lh=5,_m=50,Vh="qti-height-lines-",zh=!1,X=class extends D{constructor(){super(...arguments),this._rows=Lh,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||zh||(zh=!0,console.warn('<qti-extended-text-interaction format="xhtml"> renders as plain text. The interaction has no rich-text editor; the recorded response will contain no markup.'))},this.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=$h}_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/_m):Lh}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(Vh))continue;let e=parseInt(t.slice(Vh.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}$`,i=new RegExp(n);r=t.checkValidity()&&i.test(t.value),r||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else r=t.checkValidity();return r&&!this.response&&(r=!1),!r&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(r,e,t,{suppressInline:!0}),r}reportValidity(){return this.validate(),super.reportValidity()}renderPrompt(){return b`<slot name="prompt"></slot>`}renderTextarea(){return b`<textarea
|
|
7268
7281
|
part="textarea"
|
|
7269
7282
|
name="${this.responseIdentifier}"
|
|
7270
7283
|
spellcheck="false"
|
|
@@ -7279,7 +7292,7 @@ CES.load();
|
|
|
7279
7292
|
?disabled="${this.disabled}"
|
|
7280
7293
|
?readonly="${this.readonly}"
|
|
7281
7294
|
.value=${this.response}
|
|
7282
|
-
></textarea>`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}};
|
|
7295
|
+
></textarea>`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}};Et([T()],X.prototype,"_rows",void 0);Et([p({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",void 0);Et([p({type:Number,attribute:"expected-lines"})],X.prototype,"expectedLines",void 0);Et([p({type:String,reflect:!0})],X.prototype,"format",void 0);Et([L("format")],X.prototype,"_handleFormatChange",void 0);Et([p({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",void 0);Et([p({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",void 0);Et([p({type:String,attribute:"data-patternmask-message"})],X.prototype,"dataPatternmaskMessage",void 0);Et([p({type:String,attribute:"class"})],X.prototype,"classNames",void 0);Et([L(["classNames","expectedLines","expectedLength"])],X.prototype,"_handleRowsInputChange",null);Et([p({type:String,attribute:"response",reflect:!1})],X.prototype,"response",void 0);Et([L("response",{waitUntilFirstUpdate:!0})],X.prototype,"_handleResponseChange",void 0);var Qo=[{tag:"qti-extended-text-interaction",ctor:X}];var jh=[O,U,q`
|
|
7283
7296
|
:host {
|
|
7284
7297
|
display: flex;
|
|
7285
7298
|
align-items: flex-start;
|
|
@@ -7323,10 +7336,10 @@ CES.load();
|
|
|
7323
7336
|
:host([answer-key]) [part~='drags'] {
|
|
7324
7337
|
display: none;
|
|
7325
7338
|
}
|
|
7326
|
-
`];var Wr=class extends
|
|
7339
|
+
`];var Wr=class extends zt(Vt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){static{this.styles=jh}render(){return b`<slot name="prompt"> </slot>
|
|
7327
7340
|
<slot part="drags" name="drags"></slot>
|
|
7328
7341
|
<slot part="drops"></slot>
|
|
7329
|
-
<div role="alert" part="message" id="validation-message"></div>`}};var
|
|
7342
|
+
<div role="alert" part="message" id="validation-message"></div>`}};var Go=[{tag:"qti-gap-match-interaction",ctor:Wr}];function Hh(o){return o.querySelector('img, object[type^="image"]')}function Fh(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 Wh=new WeakMap,Bh=new WeakMap;function Tm(o){let t=Bh.get(o);return t||(t=new Promise(e=>{let r=o.data;if(!r){e(null);return}let n=new Image;n.onload=()=>{let i={width:n.naturalWidth,height:n.naturalHeight};if(!(i.width>0)||!(i.height>0)){e(null);return}Wh.set(o,i),e(i)},n.onerror=()=>e(null),n.src=r}),Bh.set(o,t)),t}function Rm(o){if(o.localName==="object")return Wh.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function Xo(o){let t=Fh(o,"width"),e=Fh(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let r=Rm(o);return r?{width:t??r.width,height:e??r.height}:null}function Om(o){let t=Xo(o);if(t)return Promise.resolve(t);if(o.localName==="object")return Tm(o).then(()=>Xo(o));let e=o;return e.complete?Promise.resolve(null):new Promise(r=>{let n=()=>{e.removeEventListener("load",n),e.removeEventListener("error",n),r(Xo(o))};e.addEventListener("load",n),e.addEventListener("error",n)})}function Ve(o,t,e,r){let n=Xo(e);if(n){Uh(o,t,n,r);return}Om(e).then(i=>{if(!i){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}Uh(o,t,i,r)})}function Uh(o,t,{width:e,height:r},n){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[i,s,a]=t,l=i/e*100,c=s/r*100,d=a/e*100,h=a/r*100;n.style.left=l-d+"%",n.style.top=c-h+"%",n.style.width=2*d+"%",n.style.height=2*h+"%",n.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[i,s,a,l]=t,c=i/e*100,d=s/r*100,h=a/e*100,f=l/r*100;n.style.left=c+"%",n.style.top=d+"%",n.style.width=h-c+"%",n.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[i,s,a,l]=t,c=i/e*100,d=s/r*100,h=a/e*100,f=l/r*100;n.style.left=c-h+"%",n.style.top=d-f+"%",n.style.width=2*h+"%",n.style.height=2*f+"%",n.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let i=[];for(let y=0;y<t.length;y+=2)i.push({x:t[y],y:t[y+1]});let s=Math.min(...i.map(y=>y.x)),a=Math.max(...i.map(y=>y.x)),l=Math.min(...i.map(y=>y.y)),c=Math.max(...i.map(y=>y.y)),d=s/e*100,h=l/r*100,f=a/e*100,m=c/r*100;n.style.left=d+"%",n.style.top=h+"%",n.style.width=f-d+"%",n.style.height=m-h+"%";let v=i.map(y=>({x:(y.x-s)/(a-s)*100,y:(y.y-l)/(c-l)*100})),x=v.map(y=>`${y.x}% ${y.y}%`).join(",");n.style.clipPath=`polygon(${x})`;let u=v.map(y=>`${y.x},${y.y}`).join(" "),g=y=>`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='${y}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;n.style.setProperty("--qti-shape-outline",g(4)),n.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":n.style.left="0%",n.style.top="0%",n.style.width="100%",n.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var Qh=[O,U,q`
|
|
7330
7343
|
/* Containing block for the absolutely positioned hotspots over the image. Was on this host in
|
|
7331
7344
|
the theme, together with a 'display: block' this component now owns. */
|
|
7332
7345
|
:host {
|
|
@@ -7356,14 +7369,14 @@ CES.load();
|
|
|
7356
7369
|
top: 0px;
|
|
7357
7370
|
left: 0px;
|
|
7358
7371
|
}
|
|
7359
|
-
`];var
|
|
7372
|
+
`];var sn=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},jt=class extends D{static{this.styles=Qh}#t;#e;#r;constructor(){super(),this.#t=[],this.#e=null,this.#r=null,this._response=[],this.addEventListener("qti-register-hotspot",this.#o)}reset(){this._response=[]}validate(){return this.#n().length>0}set response(t){this._response=this.#i(t)}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 b`<slot name="prompt"></slot>
|
|
7360
7373
|
<line-container>
|
|
7361
7374
|
<svg
|
|
7362
7375
|
width=${K(this.grImage[0]?.width)}
|
|
7363
7376
|
height=${K(this.grImage[0]?.height)}
|
|
7364
7377
|
viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
|
|
7365
7378
|
>
|
|
7366
|
-
${H(this.#
|
|
7379
|
+
${H(this.#n(),t=>t,(t,e)=>Ei`
|
|
7367
7380
|
<line
|
|
7368
7381
|
part="line"
|
|
7369
7382
|
x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
|
|
@@ -7376,7 +7389,7 @@ CES.load();
|
|
|
7376
7389
|
/>
|
|
7377
7390
|
`)}
|
|
7378
7391
|
${this.renderSupplementalLines()}
|
|
7379
|
-
${this.#e&&
|
|
7392
|
+
${this.#e&&Ei`<line
|
|
7380
7393
|
part="point"
|
|
7381
7394
|
x1=${this.startCoord.x}
|
|
7382
7395
|
y1=${this.startCoord.y}
|
|
@@ -7388,7 +7401,7 @@ CES.load();
|
|
|
7388
7401
|
</svg>
|
|
7389
7402
|
<slot></slot>
|
|
7390
7403
|
</line-container>
|
|
7391
|
-
<div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),r=t.target,n=r.getAttribute("coords"),i=r.getAttribute("shape"),s=n.split(",").map(a=>parseInt(a));
|
|
7404
|
+
<div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),r=t.target,n=r.getAttribute("coords"),i=r.getAttribute("shape"),s=n.split(",").map(a=>parseInt(a));Ve(i,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.addEventListener("click",e=>{this.#e?this.#r||(this.#r=e.target,this._response=this.#n(),this._response=[...this._response,`${this.#e.getAttribute("identifier")} ${this.#r.getAttribute("identifier")}`],this.saveResponse(this.response),this.#e=null,this.#r=null):(this.#e=e.target,this.startCoord={x:parseInt(this.#e.getAttribute("coords").split(",")[0]),y:parseInt(this.#e.getAttribute("coords").split(",")[1])})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};sn([T()],jt.prototype,"startCoord",void 0);sn([T()],jt.prototype,"mouseCoord",void 0);sn([Dc({selector:"img"})],jt.prototype,"grImage",void 0);sn([T()],jt.prototype,"_response",void 0);sn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Gt({emptyAs:[]})})],jt.prototype,"response",null);var Yo=[{tag:"qti-graphic-associate-interaction",ctor:jt}];var Gh=[O,U,q`
|
|
7392
7405
|
:host {
|
|
7393
7406
|
display: flex;
|
|
7394
7407
|
align-items: flex-start;
|
|
@@ -7445,10 +7458,10 @@ CES.load();
|
|
|
7445
7458
|
user-select: none;
|
|
7446
7459
|
pointer-events: none;
|
|
7447
7460
|
}
|
|
7448
|
-
`];var
|
|
7461
|
+
`];var Pm=Vt(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),Qr=class extends zt(Pm,'[qti-draggable="true"]'){static{this.styles=Gh}render(){return b` <slot name="prompt"></slot>
|
|
7449
7462
|
<slot part="image"></slot>
|
|
7450
7463
|
<slot part="drags" name="drags" class="hover-border"></slot>
|
|
7451
|
-
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#t(t){let e=t.target,r=e.getAttribute("coords"),n=e.getAttribute("shape"),i=r.split(",").map(s=>parseInt(s));switch(n){case"circle":{let[s,a,
|
|
7464
|
+
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#t(t){let e=t.target,r=e.getAttribute("coords"),n=e.getAttribute("shape"),i=r.split(",").map(s=>parseInt(s));switch(n){case"circle":{let[s,a,l]=i;e.style.left=s-l+"px",e.style.top=a-l+"px",e.style.width=e.style.height=2*l+"px"}break;case"rect":{let[s,a,l,c]=i;e.style.left=s+"px",e.style.top=a+"px",e.style.width=l-s+"px",e.style.height=c-a+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#t)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#t)}};var Ko=[{tag:"qti-graphic-gap-match-interaction",ctor:Qr}];var Xh=[O,U,q`
|
|
7452
7465
|
/* The order pins are anchored outside their hotspot's box. */
|
|
7453
7466
|
:host {
|
|
7454
7467
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
@@ -7486,11 +7499,11 @@ CES.load();
|
|
|
7486
7499
|
pointer-events: none;
|
|
7487
7500
|
user-select: none;
|
|
7488
7501
|
}
|
|
7489
|
-
`];var
|
|
7502
|
+
`];var Yh=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ze=class o extends $e(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#n=t=>{this.#i(t.target),this.refreshLocatorPins()}}static{this.styles=Xh}static#t="cito-graphic-order-marker";render(){return b`
|
|
7490
7503
|
<slot name="prompt"></slot>
|
|
7491
7504
|
<slot></slot>
|
|
7492
7505
|
<div role="alert" part="message" id="validation-message"></div>
|
|
7493
|
-
`}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(i=>i.identifier===e))return;let r=[...this.#e()],n=r.indexOf(e);if(n>=0)r.splice(n,1);else{let i=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(r.length>=i)return;r.push(e)}this.response=r,this.validate(),this.reportValidity(),this.saveResponse(this.response)}#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 i of this._choiceElements){let s=t.indexOf(i.identifier);i.order=s>=0?s+1:null}let e=this._choiceElements.filter(i=>i.order!=null).sort((i,s)=>i.order-s.order),r=Array.from(this.querySelectorAll(`.${o.#t}`));r.length===e.length&&e.every((i,s)=>{let a=r[s];return a.textContent===String(i.order)&&a.style.getPropertyValue("position-anchor")===this.#r(i)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(i)})||(r.forEach(i=>i.remove()),this._choiceElements.forEach(i=>{i.style.removeProperty("anchor-name")}),e.forEach(i=>{let s=this.#r(i);i.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(i)),i.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(i.order),this.append(a)}))}#
|
|
7506
|
+
`}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(i=>i.identifier===e))return;let r=[...this.#e()],n=r.indexOf(e);if(n>=0)r.splice(n,1);else{let i=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(r.length>=i)return;r.push(e)}this.response=r,this.validate(),this.reportValidity(),this.saveResponse(this.response)}#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 i of this._choiceElements){let s=t.indexOf(i.identifier);i.order=s>=0?s+1:null}let e=this._choiceElements.filter(i=>i.order!=null).sort((i,s)=>i.order-s.order),r=Array.from(this.querySelectorAll(`.${o.#t}`));r.length===e.length&&e.every((i,s)=>{let a=r[s];return a.textContent===String(i.order)&&a.style.getPropertyValue("position-anchor")===this.#r(i)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(i)})||(r.forEach(i=>i.remove()),this._choiceElements.forEach(i=>{i.style.removeProperty("anchor-name")}),e.forEach(i=>{let s=this.#r(i);i.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(i)),i.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(i.order),this.append(a)}))}#i(t){let e=Hh(this),r=t.getAttribute("coords"),n=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let i=r.split(",").map(s=>parseInt(s));Ve(n,i,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)}};Yh([p({type:Number,attribute:"max-choices"})],ze.prototype,"maxChoices",void 0);Yh([L("response")],ze.prototype,"handleOrderedResponseChange",null);var Jo=[{tag:"qti-graphic-order-interaction",ctor:ze}];var Kh=[O,U,q`
|
|
7494
7507
|
:host {
|
|
7495
7508
|
display: block;
|
|
7496
7509
|
}
|
|
@@ -7539,17 +7552,17 @@ CES.load();
|
|
|
7539
7552
|
max-width: 100%;
|
|
7540
7553
|
height: auto;
|
|
7541
7554
|
}
|
|
7542
|
-
`];var Gr=class extends
|
|
7555
|
+
`];var Gr=class extends $e(D,"qti-hotspot-choice"){static{this.styles=Kh}render(){return b`
|
|
7543
7556
|
<slot name="prompt"></slot>
|
|
7544
7557
|
<slot></slot>
|
|
7545
7558
|
<div part="message" role="alert" id="validation-message"></div>
|
|
7546
|
-
`}#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"),r=t.getAttribute("coords"),n=t.getAttribute("shape"),i=r.split(",").map(a=>parseInt(a)),s=await this.#e(e);
|
|
7559
|
+
`}#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"),r=t.getAttribute("coords"),n=t.getAttribute("shape"),i=r.split(",").map(a=>parseInt(a)),s=await this.#e(e);Ve(n,i,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 Zo=[{tag:"qti-hotspot-interaction",ctor:Gr}];var Jh=[O,U,q`
|
|
7547
7560
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7548
7561
|
:host {
|
|
7549
7562
|
display: block;
|
|
7550
7563
|
}
|
|
7551
|
-
`];var Xr=class extends
|
|
7552
|
-
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=
|
|
7564
|
+
`];var Xr=class extends $e(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>b`<slot></slot>
|
|
7565
|
+
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=Jh}};var ts=[{tag:"qti-hottext-interaction",ctor:Xr}];var _l=(o,t="[part='menu']",e="[part='trigger']",r="--qti-inline-choice-width")=>{class n 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.#c(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)+parseFloat(l.borderLeftWidth)+parseFloat(l.borderRightWidth)})}#s(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#a()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#a(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMenuWidth()}))}#c(s){typeof ResizeObserver>"u"||this.#e===s||(this.#t??=new ResizeObserver(()=>{this.#e?.matches(":popover-open")&&this.#a()}),this.#e&&this.#t.unobserve(this.#e),this.#t.observe(s),this.#e=s)}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e=null,this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return n};var Mm=q`
|
|
7553
7566
|
/* ── Host ──────────────────────────────────────────────────────────────────
|
|
7554
7567
|
Inline-block so the element flows with surrounding text.
|
|
7555
7568
|
--qti-inline-choice-width is the single width control surface:
|
|
@@ -7730,11 +7743,11 @@ CES.load();
|
|
|
7730
7743
|
z-index: var(--qti-overlay-z-index);
|
|
7731
7744
|
white-space: nowrap;
|
|
7732
7745
|
}
|
|
7733
|
-
`,
|
|
7746
|
+
`,Dm=Mm,Zh=Dm;var he=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Nm=0,rt=class extends _l(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${Nm++}`,this._handleDataPromptChange=()=>{this.#e()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity()},this._pendingResponse=void 0,this.#n=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#o=t=>{this.disabled||this.readonly||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#i(!0))},this.#s=t=>{let r=t.newState==="open";this._dropdownOpen!==r&&(this._dropdownOpen=r),r?this._internals.states.add("open"):this._internals.states.delete("open")},this.#a=t=>{if(!this._dropdownOpen)return;if(t.key==="Escape"){t.preventDefault(),this.#i(!1),this.#c();return}let e=this.#u(),r=this.renderRoot.activeElement,n=this.#p(),i=r||(n instanceof HTMLElement&&this.#l(n)?n:null),s=e.findIndex(a=>a===i);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(!i)return;if(t.preventDefault(),i instanceof HTMLButtonElement)i.click();else{let a=i.getAttribute("identifier")??"";this.#r(a)}}},this.#h=()=>{this.#e()},this.#f=t=>{if(this.disabled||this.readonly)return;let r=t.currentTarget.getAttribute("identifier")??"";this.#r(r)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[Zh]}renderTrigger(){let t=this.#t();return b`
|
|
7734
7747
|
<button
|
|
7735
7748
|
part="trigger"
|
|
7736
7749
|
type="button"
|
|
7737
|
-
@click=${this.#
|
|
7750
|
+
@click=${this.#n}
|
|
7738
7751
|
@keydown=${this.#o}
|
|
7739
7752
|
aria-haspopup="listbox"
|
|
7740
7753
|
aria-expanded="${this._dropdownOpen?"true":"false"}"
|
|
@@ -7768,9 +7781,9 @@ CES.load();
|
|
|
7768
7781
|
>
|
|
7769
7782
|
<span part="option-content">${this.options[0]?.content}</span>
|
|
7770
7783
|
</button>
|
|
7771
|
-
<slot @slotchange=${this.#
|
|
7784
|
+
<slot @slotchange=${this.#h}></slot>
|
|
7772
7785
|
</div>
|
|
7773
|
-
`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#e(),this.#
|
|
7786
|
+
`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#e(),this.#m(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#g(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#e()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#b(),this.#u()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#b()}#t(){return this.options.find(t=>t.selected)??this.options[0]}#e(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt||this.configContext?.inlineChoicePrompt||"select",r=this._pendingResponse,n=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",i=[{content:e,value:"",selected:n===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===n}})],s=i.some(a=>a.selected);this.options=s?i:i.map((a,l)=>({...a,selected:l===0})),this._pendingResponse=void 0,this.#b(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize?!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-")):!1}menuAutoSizeExtraWidth(){return this.renderRoot.querySelector('span[part~="dropdown-icon"]')?.offsetWidth??0}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,r=this.required||this.minChoices>=1,n=e||!r,i=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(n,n?"":i,this,{suppressInline:!0}),n}reportValidity(){return super.reportValidity()}reset(){this.#i(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#b()}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.#b()}get response(){let t=this.options.find(e=>e.selected)?.value??"";return t===""?null:t}#r(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#b(),this.validate(),this.reportValidity(),this.saveResponse(t),this.#i(!1)}#i(t){let e=this.#d();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#n;#o;#s;#a;#c(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#p(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#l(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#d(){return this.renderRoot.querySelector(`#${this._menuId}`)}#m(){this._slotObserver=new MutationObserver(()=>this.#e()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#h;#f;#g(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#f),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#b(){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 i=(r.getAttribute("identifier")??"")===t;r.removeEventListener("click",this.#f),r.addEventListener("click",this.#f),r.disabled=this.disabled,r.readonly=this.readonly,r.internals.role="option",r.internals.ariaSelected=i?"true":"false",r.internals.ariaChecked=i?"true":"false",r.internals.ariaDisabled=this.disabled?"true":"false",r.internals.ariaReadOnly=this.readonly?"true":"false",i?r.internals.states.add("checked"):r.internals.states.delete("checked"),r.tabIndex=-1}}#u(){let t=this.renderRoot.querySelector('button[part~="option"]'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};he([T()],rt.prototype,"options",void 0);he([T()],rt.prototype,"_dropdownOpen",void 0);he([_({context:vt,subscribe:!0}),p({attribute:!1})],rt.prototype,"configContext",void 0);he([p({type:String,attribute:"data-prompt"})],rt.prototype,"dataPrompt",void 0);he([L("dataPrompt",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleDataPromptChange",void 0);he([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],rt.prototype,"required",void 0);he([p({type:Number,attribute:"min-choices"})],rt.prototype,"minChoices",void 0);he([L(["required","minChoices"],{waitUntilFirstUpdate:!0})],rt.prototype,"_handleRequiredChange",void 0);he([p({attribute:"response",reflect:!1,noAccessor:!0})],rt.prototype,"response",null);var es=[{tag:"qti-inline-choice-interaction",ctor:rt}];var tp=[O,U,q`
|
|
7774
7787
|
/*
|
|
7775
7788
|
* A custom element is inline unless it says otherwise, and this one never did. Its shadow content
|
|
7776
7789
|
* is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
|
|
@@ -7876,7 +7889,7 @@ CES.load();
|
|
|
7876
7889
|
:host(:disabled:not(.qti-match-tabular)) ::slotted(qti-simple-match-set:first-of-type) {
|
|
7877
7890
|
display: none;
|
|
7878
7891
|
}
|
|
7879
|
-
`];var
|
|
7892
|
+
`];var ep=[O,q`
|
|
7880
7893
|
:host(.qti-match-tabular) slot:not([hidden]) {
|
|
7881
7894
|
display: contents;
|
|
7882
7895
|
}
|
|
@@ -7932,7 +7945,7 @@ CES.load();
|
|
|
7932
7945
|
justify-content: center;
|
|
7933
7946
|
flex-shrink: 0;
|
|
7934
7947
|
}
|
|
7935
|
-
`];var
|
|
7948
|
+
`];var Tl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},pe=class extends zt(Vt(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[qti-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=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,n=e.name,i=e.type;e.checked?(this.response?this.response.indexOf(r)===-1&&(i==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(n)===-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=[tp,ep]}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],n=e[1],i=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(r?.setAttribute("slot","match-rows"),n?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{i(s),s.setAttribute("role","rowheader")}),this.targetChoices?.forEach(s=>{i(s),s.setAttribute("role","columnheader")})):(r?.removeAttribute("slot"),n?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>s.removeAttribute("role")),this.targetChoices?.forEach(s=>s.removeAttribute("role")))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return b`
|
|
7936
7949
|
<slot name="prompt"></slot>
|
|
7937
7950
|
<slot ?hidden=${t}></slot>
|
|
7938
7951
|
|
|
@@ -7948,7 +7961,7 @@ CES.load();
|
|
|
7948
7961
|
<div part="checkbox-grid">
|
|
7949
7962
|
${this.sourceChoices.map((e,r)=>b`
|
|
7950
7963
|
<div role="row" style="display: contents;">
|
|
7951
|
-
${this.targetChoices.map((n,i)=>{let s=e.getAttribute("identifier"),a=n.getAttribute("identifier"),
|
|
7964
|
+
${this.targetChoices.map((n,i)=>{let s=e.getAttribute("identifier"),a=n.getAttribute("identifier"),l=`${s} ${a}`,c=(this.response||[]).filter(g=>g.split(" ")[0]===s).length||0,d=this.response?.includes(l)||!1,h=e.matchMax===1?"radio":"checkbox",f=this.getCellStateVariant(l,d),m=d?"checked":"",v=`control ${h} ${m} ${f}`.trim(),x=`control-mark ${h} ${m} ${f}`.trim(),u=e.matchMax===1?!1:e.matchMax!==0&&c>=e.matchMax&&!d;return b`
|
|
7952
7965
|
<label
|
|
7953
7966
|
part="input-cell"
|
|
7954
7967
|
role="gridcell"
|
|
@@ -7958,7 +7971,7 @@ CES.load();
|
|
|
7958
7971
|
type=${h}
|
|
7959
7972
|
hidden
|
|
7960
7973
|
name=${s}
|
|
7961
|
-
value=${
|
|
7974
|
+
value=${l}
|
|
7962
7975
|
.checked=${d}
|
|
7963
7976
|
.disabled=${u}
|
|
7964
7977
|
@change=${g=>this.handleRadioChange(g)}
|
|
@@ -7976,13 +7989,13 @@ CES.load();
|
|
|
7976
7989
|
`:P}
|
|
7977
7990
|
|
|
7978
7991
|
<div role="alert" part="message" id="validation-message"></div>
|
|
7979
|
-
`}};
|
|
7992
|
+
`}};Tl([p({type:String})],pe.prototype,"class",void 0);Tl([T()],pe.prototype,"_response",void 0);Tl([p({type:String,attribute:"response-identifier"})],pe.prototype,"responseIdentifier",void 0);var rs=[{tag:"qti-match-interaction",ctor:pe}];var rp=[O,q`
|
|
7980
7993
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7981
7994
|
:host {
|
|
7982
7995
|
display: block;
|
|
7983
7996
|
}
|
|
7984
|
-
`];var
|
|
7985
|
-
<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
|
|
7997
|
+
`];var is=class extends D{static{this.styles=rp}#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 b` <slot name="prompt"></slot>
|
|
7998
|
+
<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 ns=[{tag:"qti-media-interaction",ctor:is}];var ip=[O,U,Wt,q`
|
|
7986
7999
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7987
8000
|
:host {
|
|
7988
8001
|
display: block;
|
|
@@ -8192,7 +8205,7 @@ CES.load();
|
|
|
8192
8205
|
:host([answer-key]) [part~='drags'] {
|
|
8193
8206
|
display: none;
|
|
8194
8207
|
}
|
|
8195
|
-
`];var
|
|
8208
|
+
`];var np=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},$m=Vt(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),je=class extends zt($m,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=ip}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),b` <slot name="prompt"> </slot>
|
|
8196
8209
|
<div part="container">
|
|
8197
8210
|
<slot part="drags"> </slot>
|
|
8198
8211
|
<div part="drops">
|
|
@@ -8201,7 +8214,7 @@ CES.load();
|
|
|
8201
8214
|
</div>`})}
|
|
8202
8215
|
</div>
|
|
8203
8216
|
<div id="validation-message" part="message" role="alert" style="display:none;"></div>
|
|
8204
|
-
</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"))}};
|
|
8217
|
+
</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"))}};np([T()],je.prototype,"nrChoices",void 0);np([p({type:String})],je.prototype,"orientation",void 0);var os=[{tag:"qti-order-interaction",ctor:je}];var op=[O,q`
|
|
8205
8218
|
:host {
|
|
8206
8219
|
display: block;
|
|
8207
8220
|
width: 100%;
|
|
@@ -8211,14 +8224,14 @@ CES.load();
|
|
|
8211
8224
|
::slotted(qti-interaction-markup) {
|
|
8212
8225
|
display: none;
|
|
8213
8226
|
}
|
|
8214
|
-
`];var
|
|
8227
|
+
`];var At=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Lm=["solution","review"];function Vm(o){return o==null?!1:Array.isArray(o)?o.length>0:o!==""}var W=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#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.#E(),this.#y(),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`,this.iframe.style.width=`${e.width}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,n=r&&typeof r=="object"?this.#d(r):null,i=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;i!==null&&(this.#o=i,i&&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(n===null){let c=this.responseVariable?.cardinality==="single"?"":[];this.response=c,this.validate(),this.saveResponse(c,l);break}this.response=n,this.validate(),this.saveResponse(n,l);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#w=null}#t;static{this.styles=[op,q`
|
|
8215
8228
|
:host {
|
|
8216
8229
|
display: block;
|
|
8217
8230
|
width: 100%;
|
|
8218
8231
|
min-height: 50px;
|
|
8219
8232
|
}
|
|
8220
|
-
`]}#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
|
|
8221
|
-
`);this.sendMessageToIframe("setStylesheets",n)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#
|
|
8233
|
+
`]}#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 Vm(r)&&(e.correctResponse={value:r}),e}#r(){let t=this.responseDeclaration;if(!t?.correctResponse||Lm.includes(this.status))return t;let{correctResponse:e,...r}=t;return r}#i;#n;#o;#s;#a(){if(this.#i===null&&this.requirePathsJson)try{let t=JSON.parse(this.requirePathsJson);if(Array.isArray(t)||!t||typeof t!="object")throw new Error("Require paths must be a JSON object.");this.#i=t}catch(t){console.error("Error parsing require paths JSON:",t),this._errorMessage=`Error parsing require paths JSON: ${t.message}`,this.#i={}}return this.#i||{}}#c(){if(this.#n===null&&this.requireShimJson)try{this.#n=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#n={}}return this.#n||{}}#p(){return this.#a()}#l(){return this.#c()}#d(t){for(let e in t)if(t.hasOwnProperty(e)){let r=t[e];if(r){for(let n in r)if(r.hasOwnProperty(n)){let i=r[n];if(Array.isArray(i))return i.map(String);if(i!=null)return String(i)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(r=>r.tagName.toLowerCase()===e)}coerceBaseValue(t,e){if(t==null)return t;switch(e){case"integer":{if(typeof t=="number")return t;let r=parseInt(String(t),10);return Number.isNaN(r)?t:r}case"float":case"duration":{if(typeof t=="number")return t;let r=parseFloat(String(t));return Number.isNaN(r)?t:r}case"boolean":{if(typeof t=="boolean")return t;if(typeof t=="string"){let r=t.toLowerCase();if(r==="true")return!0;if(r==="false")return!1}return t}default:return String(t)}}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,r){if(e==="record"||r==="record")return this.recordToQtiVariableJSON(t);if(e!=="single"){let n=this.normalizeListValue(t).map(i=>this.coerceBaseValue(i,r));return{list:{[r]:n}}}return{base:{[r]:this.coerceBaseValue(t,r)}}}recordToQtiVariableJSON(t){if(!t||typeof t!="object")return{record:[]};let e=[];for(let[r,n]of Object.entries(t))e.push(this.recordEntryFromValue(r,n));return{record:e}}recordEntryFromValue(t,e){if(Array.isArray(e)){let r=e.filter(n=>n!=null);if(r.length&&r.every(n=>typeof n=="boolean"))return{name:t,list:{boolean:r}};if(r.length&&r.every(n=>typeof n=="number")){let n=r,i=n.every(s=>Number.isInteger(s));return{name:t,list:{[i?"integer":"float"]:n}}}return{name:t,list:{string:e.map(n=>n==null?"":String(n))}}}if(typeof e=="boolean")return{name:t,base:{boolean:e}};if(typeof e=="number")return Number.isInteger(e)?{name:t,base:{integer:e}}:{name:t,base:{float:e}};if(e==null)return{name:t,base:{string:""}};if(typeof e=="object")try{return{name:t,base:{string:JSON.stringify(e)}}}catch{return{name:t,base:{string:String(e)}}}return{name:t,base:{string:String(e)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(n=>{let i=n.querySelector("qti-default-value");if(!i)return;i.querySelectorAll("qti-value[field-identifier]").forEach(a=>{let l=a.getAttribute("field-identifier");if(!l)return;let c=a.getAttribute("base-type")||"string",d=a.textContent?.trim()||"";e[l]=this.coerceBaseValue(d,c)})}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},r={...t,...e};if(!Object.keys(r).length)return null;let n={candidateIdentifier:r.candidateIdentifier??"",testIdentifier:r.testIdentifier??"",environmentIdentifier:r.environmentIdentifier??"",...r};return this.recordToQtiVariableJSON(n)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(r=>{let n=r.getAttribute("template-identifier")||r.getAttribute("identifier")||"";if(!n)return;let i=this.context?.variables?.find(l=>l.identifier===n);if(!i)return;let s=i.cardinality||"single",a=i.baseType||"string";t[n]=this.variableToQtiVariableJSON(i.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(r=>{let n=r.getAttribute("identifier")||"";if(!n)return;if(n==="QTI_CONTEXT"){let l=this.getQtiContextRecord();l&&(t[n]=l);return}let i=this.context?.variables?.find(l=>l.identifier===n);if(!i)return;let s=i.cardinality||"single",a=i.baseType||"string";t[n]=this.variableToQtiVariableJSON(i.value,s,a)}),t}#m(t){let e={...t};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=r.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`);e[n]=t[r]}return e}#h(t){let e={...t},r=(n,i,s)=>{let a=n;for(let l=0;l<i.length;l+=1){let c=i[l];if(l===i.length-1){a[c]=s;return}(!a[c]||typeof a[c]!="object"||Array.isArray(a[c]))&&(a[c]={}),a=a[c]}};for(let[n,i]of Object.entries(t)){if(!n.includes("__"))continue;let s=n.split("__").filter(Boolean);s.length<2||r(e,s,i)}return e}responseVariablesToQtiVariableJSON(t,e,r){if(e!=="single"){let n={list:{}};return n.list[r]=t,n}else{let n={base:{}};return n.base[r]=t,n}}#f(){return this.response===null||this.response===void 0?!1:Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#g(t,e){let r=this.dataset.invalidresponsemessage||"Invalid response.",n=t?"":e&&e.trim().length>0?e:r;this._internals.setValidity(t?{}:{customError:!0},n)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#f();return this.#g(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: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={};if(this.context?.variables?.find(r=>r.identifier===this.responseIdentifier)){let r=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.cardinality||"single",n=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.baseType||"string",i=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.value||null,s=this.responseVariablesToQtiVariableJSON(i,r,n);t[this.responseIdentifier]=s}return t}#b(t){return t&&t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,"/").replace(/`/g,"`").replace(/=/g,"=")}#u(t){let e={};for(let[r,n]of Object.entries(t))typeof n=="string"?e[r]=this.#b(n):e[r]=n;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},"*")}#y(){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.#k(),this.#v()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let e=this.generateIframeContent();this.iframe.srcdoc=e,this.appendChild(this.iframe)}#v(){let t=this.#m(this.#h(this.#u({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],r=typeof e=="string"&&e.length>0?e:null,n={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:Un(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#S(),boundTo:r?null:this.boundTo,responseDeclaration:this.#r(),status:this.status,state:r};this.sendMessageToIframe("initialize",n)}#S(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let r=e.querySelectorAll("qti-interaction-module");for(let n of r)t.push({id:n.getAttribute("id"),primaryPath:n.getAttribute("primary-path"),fallbackPath:n.getAttribute("fallback-path")})}return t}#k(){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 n=e.map(i=>i.outerHTML).join(`
|
|
8234
|
+
`);this.sendMessageToIframe("setStylesheets",n)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#E(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#p()),r=JSON.stringify(this.#l()),n=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",i=n?n.endsWith("/")?n:`${n}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1",l=a?`${window.location.origin}/cdn/index.js`:"https://unpkg.com/@citolab/qti-components/cdn",c=a?`${window.location.origin}/dist/item.css`:"https://unpkg.com/@citolab/qti-components@latest/dist/item.css",d=this.dataset.componentsCdnUrl||l,h=this.dataset.componentsCssUrl||c,f=`
|
|
8222
8235
|
font-family: ${t.getPropertyValue("font-family")};
|
|
8223
8236
|
font-size: ${t.getPropertyValue("font-size")};
|
|
8224
8237
|
line-height: ${t.getPropertyValue("line-height")};
|
|
@@ -9115,7 +9128,7 @@ CES.load();
|
|
|
9115
9128
|
<h1>Error</h1>
|
|
9116
9129
|
${this._errorMessage}
|
|
9117
9130
|
</div>`:""}
|
|
9118
|
-
`}};
|
|
9131
|
+
`}};At([p({type:String,attribute:"module"})],W.prototype,"module",void 0);At([p({type:String,attribute:"custom-interaction-type-identifier"})],W.prototype,"customInteractionTypeIdentifier",void 0);At([p({type:String,attribute:"data-require-paths"})],W.prototype,"requirePathsJson",void 0);At([p({type:String,attribute:"data-require-shim"})],W.prototype,"requireShimJson",void 0);At([p({type:String,attribute:"data-require-js-url"})],W.prototype,"requireJsUrl",void 0);At([p({type:String,attribute:"data-base-url"})],W.prototype,"baseUrl",void 0);At([p({type:Boolean,attribute:"data-use-default-paths"})],W.prototype,"useDefaultPaths",void 0);At([p({type:String,attribute:"data-status"})],W.prototype,"status",void 0);At([T()],W.prototype,"_errorMessage",void 0);At([_({context:j,subscribe:!0}),T()],W.prototype,"context",void 0);At([_({context:wt,subscribe:!0}),T()],W.prototype,"qtiContext",void 0);At([p({attribute:"response",reflect:!1,converter:Gt({emptyAs:null})})],W.prototype,"response",void 0);var ss=class extends W{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,r)=>{let n=()=>{window.clearTimeout(i),e()},i=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",n),r(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",n,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,r=n=>{let{data:i}=n;i?.source==="qti-pci-iframe"&&(!i?.responseIdentifier||i?.responseIdentifier===this.responseIdentifier)&&i?.method==="getContentResponse"&&i?.messageId===e&&(window.removeEventListener("message",r),t(i.content))};window.addEventListener("message",r),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",r),t("")},5e3)})}setTestContext(t){this.context=t,this.updateComplete.then(()=>{this.value=t?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#t=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#t=!1}}disconnectedCallback(){this.#t||super.disconnectedCallback()}async iFrameMouseClick(t,e){return new Promise(r=>{let n=`click-${Date.now()}`,i=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===n&&(window.removeEventListener("message",i),r())};window.addEventListener("message",i),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),r()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let r=`click-selector-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let r=`click-text-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(r=>{let n=`set-value-${Date.now()}`,i=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===n&&(window.removeEventListener("message",i),r(a.success))};window.addEventListener("message",i),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),r(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let r=`get-bounding-rect-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.rect??null))};window.addEventListener("message",n),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(r=>{let n=`set-value-text-${Date.now()}`,i=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===n&&(window.removeEventListener("message",i),r(a.success))};window.addEventListener("message",i),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:n}),setTimeout(()=>{window.removeEventListener("message",i),r(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let r=`mousedown-selector-${Date.now()}`,n=i=>{let{data:s}=i;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",n),e(s.success))};window.addEventListener("message",n),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",n),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
|
|
9119
9132
|
// Test helper functions for QtiPortableCustomInteractionTest
|
|
9120
9133
|
// Base iframe implementation already provides PCIManager.getContent
|
|
9121
9134
|
|
|
@@ -9308,7 +9321,7 @@ CES.load();
|
|
|
9308
9321
|
}
|
|
9309
9322
|
},
|
|
9310
9323
|
true
|
|
9311
|
-
);`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var
|
|
9324
|
+
);`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var as=[{tag:"qti-portable-custom-interaction",ctor:W},{tag:"qti-portable-custom-interaction-test",ctor:ss}];var sp=[O,q`
|
|
9312
9325
|
:host {
|
|
9313
9326
|
display: block;
|
|
9314
9327
|
}
|
|
@@ -9319,12 +9332,12 @@ CES.load();
|
|
|
9319
9332
|
left: 50%;
|
|
9320
9333
|
transform: translateX(-50%);
|
|
9321
9334
|
}
|
|
9322
|
-
`];var
|
|
9335
|
+
`];var ls=class extends C{static{this.styles=sp}render(){return b`<slot></slot>`}};var ap=[O,q`
|
|
9323
9336
|
:host {
|
|
9324
9337
|
display: inline-block;
|
|
9325
9338
|
position: relative;
|
|
9326
9339
|
}
|
|
9327
|
-
`];var
|
|
9340
|
+
`];var cs=class extends C{static{this.styles=ap}render(){return b`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(t){t.preventDefault();let e=t.clientX-this.startX,r=t.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=t.clientX,this.startY=t.clientY}firstUpdated(t){super.firstUpdated(t),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};var ds=[{tag:"qti-position-object-interaction",ctor:ls},{tag:"qti-position-object-stage",ctor:cs}];var lp="important",zm=" !"+lp,hs=Pt(class extends qe{constructor(o){if(super(o),o.type!==Vr.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 n=t[r];if(n!=null){this.ft.add(r);let i=typeof n=="string"&&n.endsWith(zm);r.includes("-")||i?e.setProperty(r,i?n.slice(0,-11):n,i?lp:""):e[r]=n}}return et}});var cp=[O,q`
|
|
9328
9341
|
:host {
|
|
9329
9342
|
display: block;
|
|
9330
9343
|
--qti-select-point-marker-size: 1.5rem;
|
|
@@ -9359,20 +9372,20 @@ CES.load();
|
|
|
9359
9372
|
-webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
9360
9373
|
mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
9361
9374
|
}
|
|
9362
|
-
`];var Yr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ft=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#r=1,this.#
|
|
9375
|
+
`];var Yr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ft=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#r=1,this.#i=1,this.#n=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#c();let e=this.#e.getBoundingClientRect(),r=(t.clientX-e.left)*this.#r,n=(t.clientY-e.top)*this.#i,i=`${r.toFixed()} ${n.toFixed()}`;this.maxChoices===1?this.response=[i]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],i]),this.saveResponse(this.response)},this.#a=()=>{this.#c()}}static{this.styles=cp}#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[n,i]=r.split(" ").map(Number);return{x:n,y:i}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let r of t){let n=r.dataset.coord,i=r.dataset.shape;!n||!i||Ve(i,n.split(",").map(s=>+s),e,r)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return b` <slot name="prompt"></slot>
|
|
9363
9376
|
<point-container>
|
|
9364
|
-
${H(e.filter(r=>r),r=>r,(r,n)=>{let[i,s]=r.split(" ").map(Number),a=i/(this.#
|
|
9377
|
+
${H(e.filter(r=>r),r=>r,(r,n)=>{let[i,s]=r.split(" ").map(Number),a=i/(this.#n||1)*100,l=s/(this.#o||1)*100;return b`
|
|
9365
9378
|
<button
|
|
9366
9379
|
part=${this.pointPart(r,n)}
|
|
9367
|
-
style=${
|
|
9380
|
+
style=${hs({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${l}%`})}
|
|
9368
9381
|
aria-label="Remove point at ${r}"
|
|
9369
9382
|
?disabled=${this.disabled}
|
|
9370
|
-
@click=${
|
|
9383
|
+
@click=${c=>{c.stopPropagation(),this.response=(this.response||[]).filter((d,h)=>h!==n),this.saveResponse(this.response)}}
|
|
9371
9384
|
></button>
|
|
9372
9385
|
`})}
|
|
9373
9386
|
${this.renderSupplementalLayer()}
|
|
9374
9387
|
<slot></slot>
|
|
9375
|
-
</point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,n=!0,i="";return e?(n=!1,i=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(n=!1,i=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(n,i,this.#e??this,{suppressInline:!0}),n}reportValidity(){return super.reportValidity()}#
|
|
9388
|
+
</point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,n=!0,i="";return e?(n=!1,i=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(n=!1,i=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(n,i,this.#e??this,{suppressInline:!0}),n}reportValidity(){return super.reportValidity()}#c(){this.#n=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#r=t.width===0?1:this.#n/t.width,this.#i=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#c(),this.#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)}};Yr([p({type:Number,attribute:"max-choices"})],ft.prototype,"maxChoices",void 0);Yr([p({type:Number,attribute:"min-choices"})],ft.prototype,"minChoices",void 0);Yr([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Wa(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>Qa(o)}})],ft.prototype,"response",void 0);Yr([p({attribute:"area-mappings"})],ft.prototype,"areaMappings",void 0);Yr([T()],ft.prototype,"_areaEntries",void 0);Yr([L("areaMappings")],ft.prototype,"_handleAreaMappingsChange",void 0);var ps=[{tag:"qti-select-point-interaction",ctor:ft}];var dp=[O,q`
|
|
9376
9389
|
:host {
|
|
9377
9390
|
display: block;
|
|
9378
9391
|
--show-bounds: true;
|
|
@@ -9440,7 +9453,7 @@ CES.load();
|
|
|
9440
9453
|
text-align: center;
|
|
9441
9454
|
color: #6b7280; /* text-gray-500 */
|
|
9442
9455
|
}
|
|
9443
|
-
`];var
|
|
9456
|
+
`];var an=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},It=class extends D{constructor(){super(...arguments),this.#t=0,this.min=0,this.max=100,this.step=1}static{this.styles=dp}#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.hasAttribute("response")||this.#e(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get response(){return this.#t.toString()}set response(t){if(t===null||t==="")return;let e=parseFloat(t);isNaN(e)||this.#e(e)}renderRailSupplement(){return P}#e(t){let e=this.#t;if(this.#t=Math.min(this.max,Math.max(this.min,t)),this.#t===e)return;let r=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${r}%`),this._internals.setFormValue(this.value),this.saveResponse(this.response),this.requestUpdate()}render(){return b`
|
|
9444
9457
|
<slot name="prompt"></slot>
|
|
9445
9458
|
<div id="slider" part="slider">
|
|
9446
9459
|
<div id="bounds" part="bounds">
|
|
@@ -9450,7 +9463,7 @@ CES.load();
|
|
|
9450
9463
|
|
|
9451
9464
|
<div id="ticks" part="ticks"></div>
|
|
9452
9465
|
|
|
9453
|
-
<div id="rail" part="rail" @mousedown=${this.#r} @touchstart=${this.#
|
|
9466
|
+
<div id="rail" part="rail" @mousedown=${this.#r} @touchstart=${this.#i}>
|
|
9454
9467
|
<div id="knob" part="knob">
|
|
9455
9468
|
<div id="value" part="value">${this.response}</div>
|
|
9456
9469
|
</div>
|
|
@@ -9458,7 +9471,7 @@ CES.load();
|
|
|
9458
9471
|
${this.renderRailSupplement()}
|
|
9459
9472
|
</div>
|
|
9460
9473
|
</div>
|
|
9461
|
-
`}#r(t){this.#
|
|
9474
|
+
`}#r(t){this.#n(t.pageX);let e=n=>this.#o(n.pageX),r=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),this.#s()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",r)}#i(t){this.#n(t.touches[0].pageX);let e=n=>this.#o(n.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),this.#s()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r)}#n(t){this.#o(t)}#o(t){let e=this._rail.getBoundingClientRect(),r=t-e.left,n=Math.min(1,Math.max(0,r/e.width)),i=this.min+Math.round(n*(this.max-this.min)/this.step)*this.step;this.#e(i)}#s(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};an([Sr("#rail")],It.prototype,"_rail",void 0);an([p({type:Number,attribute:"lower-bound"})],It.prototype,"min",void 0);an([p({type:Number,attribute:"upper-bound"})],It.prototype,"max",void 0);an([p({type:Number,attribute:"step"})],It.prototype,"step",void 0);an([p({attribute:"response",reflect:!1,noAccessor:!0})],It.prototype,"response",null);var us=[{tag:"qti-slider-interaction",ctor:It}];var hp=()=>new Ol,Ol=class{},Rl=new WeakMap,OP=Pt(class extends Se{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=Rl.get(t);e===void 0&&(e=new WeakMap,Rl.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"?Rl.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 pp=[O,q`
|
|
9462
9475
|
:host {
|
|
9463
9476
|
display: inline-flex;
|
|
9464
9477
|
align-items: center;
|
|
@@ -9547,7 +9560,7 @@ CES.load();
|
|
|
9547
9560
|
:host(.qti-input-width-72) {
|
|
9548
9561
|
--qti-input-width: 72;
|
|
9549
9562
|
}
|
|
9550
|
-
`];var
|
|
9563
|
+
`];var yr=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},dt=class extends D{constructor(){super(...arguments),this.inputRef=hp(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=pp}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;return this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),e=this._input.checkValidity(),e||(t=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):e=this._input.checkValidity(),e&&this.response===""&&(e=!1),!e&&!t&&(t=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(e,t,this._input,{suppressInline:!0}),e}renderAnswer(){return b`<div part="answer" aria-hidden="true"></div>`}renderInput(){return b`<input
|
|
9551
9564
|
part="input"
|
|
9552
9565
|
name="${this.responseIdentifier}"
|
|
9553
9566
|
spellcheck="false"
|
|
@@ -9563,7 +9576,7 @@ CES.load();
|
|
|
9563
9576
|
maxlength=${1e3}
|
|
9564
9577
|
?disabled="${this.disabled}"
|
|
9565
9578
|
?readonly="${this.readonly}"
|
|
9566
|
-
/>`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(){return this.validate(),super.reportValidity()}reset(){this.response=""}};
|
|
9579
|
+
/>`}renderValidationMessage(){return b`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return b` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(){return this.validate(),super.reportValidity()}reset(){this.response=""}};yr([p({type:Number,attribute:"expected-length"})],dt.prototype,"expectedLength",void 0);yr([p({type:String,attribute:"pattern-mask"})],dt.prototype,"patternMask",void 0);yr([p({type:String,attribute:"placeholder-text"})],dt.prototype,"placeholderText",void 0);yr([p({type:String,attribute:"data-patternmask-message"})],dt.prototype,"dataPatternmaskMessage",void 0);yr([p({type:String,attribute:"response",reflect:!1})],dt.prototype,"response",void 0);yr([Sr("input")],dt.prototype,"_input",void 0);yr([L("response",{waitUntilFirstUpdate:!0})],dt.prototype,"_handleValueChange",void 0);var ms=[{tag:"qti-text-entry-interaction",ctor:dt}];var up=[O,q`
|
|
9567
9580
|
:host {
|
|
9568
9581
|
display: block;
|
|
9569
9582
|
margin: 1em 0;
|
|
@@ -9572,12 +9585,12 @@ CES.load();
|
|
|
9572
9585
|
display: block;
|
|
9573
9586
|
margin-top: 0.5em;
|
|
9574
9587
|
}
|
|
9575
|
-
`];var
|
|
9588
|
+
`];var fs=class extends D{static{this.styles=up}#t=null;#e=null;reset(){this.#t=null,this.#e=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.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 b`
|
|
9576
9589
|
<div>
|
|
9577
9590
|
<slot name="prompt"></slot>
|
|
9578
9591
|
<input type="file" @change="${this.#r}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
|
|
9579
9592
|
</div>
|
|
9580
|
-
`}async#r(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#n(this.#t),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#n(t){return new Promise((e,r)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>r(n.error),n.readAsDataURL(t)})}};var ps=[{tag:"qti-upload-interaction",ctor:hs}];var op=[...Lo,...Vo,...zo,...Fo,...Bo,...Uo,...Wo,...Qo,...Go,...Xo,...Yo,...Ko,...Jo,...ts,...es,...ns,...ss,...ls,...cs,...ds,...ps,...sh];for(let{tag:o,ctor:t}of op)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Lo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Vo)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 Fo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Bo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Uo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Wo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Qo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Go)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Xo)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 Jo)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 ns)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 ls)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of cs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ps)customElements.get(o)||customElements.define(o,t);var AN=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await pd().load(`${o}`).then(a=>a.assessmentTest()),r=await Nr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),n=await Nr().load(`${t}/${e.href}`).then(a=>a.items()),i=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:i,items:n,testIdentifier:e.identifier}},IN=async o=>Qt().load(o).then(t=>t.htmlDoc().firstElementChild);var us=class extends Im(Ht){calculate(){return this.calculateChildren(Array.from(this.children))}};function Im(o){return class extends o{calculateChildren(e){return e.map(n=>{let i=n;if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=i.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(n=>typeof n=="boolean"&&n)}}}var sp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Kr=class extends E{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let r of t){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(r.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(r.value===null||r.value===void 0)return null;r.value==="true"&&e++}return e>=this.min&&e<=this.max}};sp([p({type:Number})],Kr.prototype,"min",void 0);sp([p({type:Number})],Kr.prototype,"max",void 0);var _m=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},si=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};_m([p({type:String,attribute:"base-type"})],si.prototype,"baseType",void 0);var ms=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var fs=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let n=this.#t(t.value),i=this.#t(e.value);return i.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#n(n,i,r):this.#r(n,i,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return G.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let n=[...t];return e.every(i=>{let s=n.findIndex(a=>this.#e(a,i,r));return s===-1?!1:(n.splice(s,1),!0)})}#n(t,e,r){for(let n=0;n+e.length<=t.length;n++)if(e.every((i,s)=>this.#e(t[n+s],i,r)))return!0;return!1}};var gs=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var Al=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},gr=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let i=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!i)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 n=this.context.variables.find(i=>i.identifier===r);return n?n.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Al([p({type:String})],gr.prototype,"identifier",void 0);Al([_({context:j,subscribe:!0}),T()],gr.prototype,"context",void 0);Al([T(),_({context:st,subscribe:!0})],gr.prototype,"_testContext",void 0);var bs=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(i=>!e.value.includes(i))}return null}};var ys=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.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(i=>n(i));continue}n(r.value)}return e}};var vs=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var ws=class extends E{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Tm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ai=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let n=parseFloat(e.value),i=parseFloat(r.value);if(!isNaN(n)&&!isNaN(i))return this.roundingMode==="significantFigures"?n.toPrecision(this.figures)===i.toPrecision(this.figures):Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${n}, ${i}`);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}};Tm([p({type:String,attribute:"rounding-mode"})],ai.prototype,"roundingMode",void 0);var ap=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Jr=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?G.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(c=>parseFloat(c));if(r.length===0||r.some(c=>Number.isNaN(c)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[n,i=n]=r,[s,a]=this.toleranceMode==="absolute"?[e-n,e+i]:[e*(1-n/100),e*(1+i/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};ap([p({type:String,attribute:"tolerance-mode"})],Jr.prototype,"toleranceMode",void 0);ap([p({type:String})],Jr.prototype,"tolerance",void 0);var Q=class extends C{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var xs=class extends Q{process(){throw new Ar}};var qs=class extends Q{process(){throw new Ir}};var Cs=class extends E{getResult(){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];if(!e||e.baseType!=="record"||e.value===null||e.value===void 0)return console.warn("qti-field-value child expression must return a record"),null;let r=e.value[t];return r===void 0?null:r}};var ks=class extends E{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let n=parseInt(r.value,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}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 n of r.value){if(n==null)return null;let i=parseInt(n,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}}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 Ss=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];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 Es=class extends Ht{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(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 Rm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},li=class extends E{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let r=this.#t(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(r)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let r=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>r.length?null:r[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(r=>r.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Rm([p({type:String})],li.prototype,"n",void 0);var lp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Zr=class extends E{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),n=this.#e(this.coords);if(!r||n.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,n);case"rect":return this.#n(r,n);case"ellipse":return this.#i(r,n);case"poly":case"polygon":return this.#o(r,n);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(i=>i.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]),n=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(n)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:n}}#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,n,i]=e;return(t.x-r)**2+(t.y-n)**2<=i**2}#n(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,n,i,s]=e,a=Math.min(r,i),c=Math.max(r,i),l=Math.min(n,s),d=Math.max(n,s);return t.x>=a&&t.x<=c&&t.y>=l&&t.y<=d}#i(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,n,i,s]=e;return i===0||s===0?!1:(t.x-r)**2/i**2+(t.y-n)**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 n=0,i=e.length-2;n<e.length;n+=2){let s=e[n],a=e[n+1],c=e[i],l=e[i+1];a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a||Number.EPSILON)+s&&(r=!r),i=n}return r}};lp([p({type:String})],Zr.prototype,"shape",void 0);lp([p({type:String})],Zr.prototype,"coords",void 0);var As=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-integer-divide requires integer values"),[];e.push(n)}return e}};var Is=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-integer-modulus requires integer values"),[];e.push(n)}return e}};var _s=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var Ts=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var Rs=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n);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 n of r.value){let i=Number.parseInt(n,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i)}}return e}#e(t,e){let r=Math.abs(t),n=Math.abs(e);for(;n!==0;){let i=r%n;r=n,n=i}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var cp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},tn=class extends Q{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(i=>i.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let r=parseFloat(this.childExpression.calculate()),n;return e.matchTable?.size?n=e.matchTable.get(r):e.interpolationTable&&(n=this.#t(r,e.interpolationTable)),n==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:Et(n)}})),n)}#t(t,e){if(!Number.isNaN(t))return e.find(r=>r.includeBoundary?t>=r.sourceValue:t>r.sourceValue)?.targetValue}};cp([p({type:String})],tn.prototype,"identifier",void 0);cp([_({context:j,subscribe:!0}),T()],tn.prototype,"context",void 0);var Os=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];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 Ps=class extends Ht{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(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 Om=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ci=class extends E{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=Array.isArray(t.value)?t.value:[t.value];if(!r||r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let n=0,i=new Set;for(let s of r)for(let a of e.areaMapEntries){if(i.has(a.coords))continue;if(G.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){n+=a.mappedValue??0,i.add(a.coords);break}}return i.size<r.length&&(n+=e.defaultValue),e.lowerBound!=null&&(n=Math.max(e.lowerBound,n)),e.upperBound!=null&&(n=Math.min(e.upperBound,n)),n}};Om([p({type:String})],ci.prototype,"identifier",void 0);var Pm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},di=class extends E{getResult(){let t=this.context.variables.find(i=>i.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],n=0;for(let i of r){let s=e.mapEntries.filter(c=>t.baseType==="string"&&!c.caseSensitive?G.compareSingleValues(c.mapKey.toLowerCase(),i.toLowerCase(),t.baseType):G.compareSingleValues(c.mapKey,i,t.baseType)),a=s.reduce((c,l)=>c.mappedValue>l.mappedValue?c:l,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?n+=e.defaultValue:n+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(n=Math.max(e.lowerBound,n)),e?.upperBound!==null&&e?.upperBound!==void 0&&(n=Math.min(e.upperBound,n)),n}};Pm([p({type:String})],di.prototype,"identifier",void 0);var Ms=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):G.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(!G.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 n of e.value){let i=null,s=[...t.value];for(let a of s)if(G.compareSingleValues(n,a,e.baseType)){i=a;break}if(i!==null)s.splice(s.indexOf(i),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Mm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},hi=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};Mm([p({type:String})],hi.prototype,"name",void 0);var Dm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},pi=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let n=parseFloat(r.value);if(isNaN(n))return console.error("qti-math-operator non-numerical value"),null;e.push(n)}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],n=e[1];return r===0&&n<=0||r<0&&!Number.isInteger(n)?null:Math.pow(r,n)}case"log_base":{if(e.length!==2)return null;let r=e[0],n=e[1];return r<=0||n<=0||n===1?null:Math.log(r)/Math.log(n)}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}}};Dm([p({type:String})],pi.prototype,"name",void 0);var Ds=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.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(i=>n(i));continue}n(r.value)}return e}};var Ns=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let n=e.value;return r.value.includes(n)}};var $s=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.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(i=>n(i));continue}n(r.value)}return e}};var Ls=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var Vs=class extends E{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var zs=class extends E{getResult(){return null}};var js=class extends Ht{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=r.calculate(),i=!1;if(typeof n=="string")if(n==="true")i=!0;else if(n==="false")i=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(i=n);return i}).some(e=>typeof e=="boolean"&&e)}};var Fs=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var Bs=class extends C{render(){return b`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},en=class extends Bs{shouldProcess(){return!0}getSubRules(){return[...this.children]}},rn=class extends Bs{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},nn=class extends Q{render(){return b`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var Us=class extends nn{};var on=class extends rn{};var Hs=class extends on{};var Ws=class extends en{};var Nm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ui=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=this.#t();return r?r.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};Nm([p({type:String})],ui.prototype,"pattern",void 0);var Qs=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let n=parseFloat(e.value),i=parseFloat(r.value);if(isNaN(n)||isNaN(i))return console.error("qti-power: non-numerical values encountered"),null;if(n===0&&i<=0||n<0&&!Number.isInteger(i))return null;let s;try{s=Math.pow(n,i)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),c=Math.max(0,14-a),l=Math.pow(10,c);s=Math.round(s*l)/l}return s}};var $m=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function Lm(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function mi(o,t){return Lm(t===void 0?o.toExponential():o.toExponential(t))}function dp(o){let[t,e]=o.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,n=e===void 0?"":`e${e}`;return`${r}${n}`}function hp(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?dp(mi(o,e-1)):dp(o.toFixed(Math.max(0,e-1-r)))}function Vm(o,t,e,r){if(o==="s"||o==="c"){let l=o==="c"?r.slice(0,1):r;return e===void 0?l:l.slice(0,e)}let n=Number(r);if(r.trim()===""||!Number.isFinite(n))return r;let i=Math.abs(n),s,a=n<0;switch(o){case"d":case"i":s=String(Math.trunc(i));break;case"u":s=String(Math.trunc(i)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(i).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(i).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(i).toString(16).toUpperCase()}`;break;case"f":case"F":s=i.toFixed(e??6);break;case"e":s=mi(i,e??6);break;case"E":s=mi(i,e??6).toUpperCase();break;case"g":s=hp(i,e??6);break;case"G":s=hp(i,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function zm(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[,n,i]=/^([-+ ]?)(.*)$/.exec(o);return`${n}${"0".repeat(r)}${i}`}return`${" ".repeat(r)}${o}`}function pp(o,t){return o.replace($m,(e,r,n,i,s,a)=>r?"%":zm(Vm(a,n??"",s===void 0?void 0:Number(s),t),n??"",i===void 0?0:Number(i)))}var he=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},gt=class extends C{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:b`${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 i=r[this.field];return i==null?null:this.#e(i,t.baseType)}let n=Object.entries(r).filter(([,i])=>i!=null);return n.length===0?null:n.map(([i,s])=>`${i}${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 pp(this.format,r);if(e==="integer"&&this.base!==10){let n=Number.parseInt(r,10);if(Number.isFinite(n))return n.toString(this.base)}if(this.powerForm){let n=Number(r);if(r.trim()!==""&&Number.isFinite(n))return mi(n)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};he([p({type:String})],gt.prototype,"identifier",void 0);he([p({type:String})],gt.prototype,"format",void 0);he([p({type:Number})],gt.prototype,"base",void 0);he([p({type:Number})],gt.prototype,"index",void 0);he([p({type:Boolean,attribute:"power-form"})],gt.prototype,"powerForm",void 0);he([p({type:String})],gt.prototype,"field",void 0);he([p({type:String})],gt.prototype,"delimiter",void 0);he([p({type:String,attribute:"mapping-indicator"})],gt.prototype,"mappingIndicator",void 0);he([_({context:j,subscribe:!0}),T()],gt.prototype,"context",void 0);var Gs=class extends E{getResult(){return this.getVariables().reduce((r,n)=>{if(n.baseType=="float"||n.baseType=="integer")try{return r*parseFloat(n.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${n.baseType}`);return r},1)}};var Il=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},br=class extends E{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let n=this.min+this.step*e;if(n>this.max)break;Number.isInteger(n)&&t.push(n),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)]}};Il([p({type:Number})],br.prototype,"min",void 0);Il([p({type:Number})],br.prototype,"max",void 0);Il([p({type:Number})],br.prototype,"step",void 0);var Xs=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let r=Math.floor(Math.random()*e.length);return e[r]}return e}return console.error("unexpected number of children in match"),null}};var jm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},_l=1e3,fi=class extends E{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let n=0;n<t;n++){let i=e.calculate(),s=this.#r(i);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 n=Array.isArray(r.value)?r.value[0]:r.value,i=parseInt(n?.toString()??"",10);return Number.isNaN(i)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(i)}#e(t){return t>_l?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${_l} limit, truncating`),_l):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"}}};jm([p({type:String,attribute:"number-repeats"})],fi.prototype,"numberRepeats",void 0);var Ys=class extends nn{};var sn=class extends rn{};var Ks=class extends sn{};var Js=class extends en{};var Zs=class extends Q{process(){for(let t of[...this.children])t.process()}};var up=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},an=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),n=Math.pow(10,e-r-1);return Math.round(t*n)/n}};up([p({type:String,attribute:"rounding-mode"})],an.prototype,"roundingMode",void 0);up([p({type:Number})],an.prototype,"figures",void 0);var ta=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var ea=class extends Q{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 n=new Tl(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(n)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Et(this.#e(e))):Et(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()??""}},Tl=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 ra=class extends Q{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 n=new Rl(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(n)}}))}#t(t){return Array.isArray(t)?t.map(Et):t!==null?Et(t):null}},Rl=class{constructor(t){this.expression=t}process(){let t=this.expression.calculate()??null;return t===null&&console.warn("QtiSetOutcomeValueRule: Evaluated value is null."),Array.isArray(t)?t.map(e=>e.value?e.value:e):t}};var na=class extends Q{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 n=new Ol(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(n)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Et(this.#e(e))):Et(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()??""}},Ol=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 Fm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},gi=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#n(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((n,i)=>n-i),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((n,i)=>n+Math.pow(i-r,2),0)/e}#n(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.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(i=>n(i));continue}n(r.value)}return e}};Fm([p({type:String})],gi.prototype,"name",void 0);var Bm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},bi=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let n=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),i=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return G.compareSingleValues(n,i,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Bm([p({type:String,attribute:"case-sensitive"})],bi.prototype,"caseSensitive",void 0);var Um=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},yi=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let n=e.value.toString(),i=r.value.toString();return this.caseSensitive!=="true"?i.toLowerCase().includes(n.toLowerCase()):i.includes(n)}};Um([p({type:String,attribute:"case-sensitive"})],yi.prototype,"caseSensitive",void 0);var ia=class extends Hm(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function Hm(o){return class extends o{calculateChildren(e){let r=e.map(n=>{if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=n.calculate();return Number.isNaN(i)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(i)});return r.some(n=>n===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var oa=class extends E{getResult(){return new Pl(Array.from(this.children)).calculate()}},Pl=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 n=r.calculate();return Number.isNaN(n)?(console.error("unexpected value in qti-sum, expected number"),null):Number(n)}).reduce((r,n)=>r+n,0)}};var sa=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var aa=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var mp=[{tag:"qti-and",ctor:us},{tag:"qti-any-n",ctor:Kr},{tag:"qti-base-value",ctor:si},{tag:"qti-container-size",ctor:ms},{tag:"qti-contains",ctor:fs},{tag:"qti-correct",ctor:gs},{tag:"qti-default",ctor:gr},{tag:"qti-delete",ctor:bs},{tag:"qti-divide",ctor:ys},{tag:"qti-duration-gte",ctor:vs},{tag:"qti-duration-lt",ctor:ws},{tag:"qti-equal",ctor:Jr},{tag:"qti-equal-rounded",ctor:ai},{tag:"qti-exit-response",ctor:xs},{tag:"qti-exit-test",ctor:qs},{tag:"qti-field-value",ctor:Cs},{tag:"qti-gcd",ctor:ks},{tag:"qti-gt",ctor:Ss},{tag:"qti-gte",ctor:Es},{tag:"qti-index",ctor:li},{tag:"qti-inside",ctor:Zr},{tag:"qti-integer-divide",ctor:As},{tag:"qti-integer-modulus",ctor:Is},{tag:"qti-integer-to-float",ctor:_s},{tag:"qti-is-null",ctor:Ts},{tag:"qti-lcm",ctor:Rs},{tag:"qti-lookup-outcome-value",ctor:tn},{tag:"qti-lt",ctor:Os},{tag:"qti-lte",ctor:Ps},{tag:"qti-map-response",ctor:di},{tag:"qti-map-response-point",ctor:ci},{tag:"qti-match",ctor:Ms},{tag:"qti-math-constant",ctor:hi},{tag:"qti-math-operator",ctor:pi},{tag:"qti-max",ctor:Ds},{tag:"qti-member",ctor:Ns},{tag:"qti-min",ctor:$s},{tag:"qti-multiple",ctor:Ls},{tag:"qti-not",ctor:Vs},{tag:"qti-null",ctor:zs},{tag:"qti-or",ctor:js},{tag:"qti-ordered",ctor:Fs},{tag:"qti-outcome-condition",ctor:Us},{tag:"qti-outcome-else",ctor:Ws},{tag:"qti-outcome-else-if",ctor:Hs},{tag:"qti-outcome-if",ctor:on},{tag:"qti-pattern-match",ctor:ui},{tag:"qti-power",ctor:Qs},{tag:"qti-printed-variable",ctor:gt},{tag:"qti-product",ctor:Gs},{tag:"qti-random",ctor:Xs},{tag:"qti-random-integer",ctor:br},{tag:"qti-repeat",ctor:fi},{tag:"qti-response-condition",ctor:Ys},{tag:"qti-response-else",ctor:Js},{tag:"qti-response-else-if",ctor:Ks},{tag:"qti-response-if",ctor:sn},{tag:"qti-response-processing-fragment",ctor:Zs},{tag:"qti-round",ctor:ta},{tag:"qti-round-to",ctor:an},{tag:"qti-rule",ctor:Q},{tag:"qti-set-correct-response",ctor:ea},{tag:"qti-set-outcome-value",ctor:ra},{tag:"qti-set-template-value",ctor:na},{tag:"qti-stats-operator",ctor:gi},{tag:"qti-string-match",ctor:bi},{tag:"qti-substring",ctor:yi},{tag:"qti-subtract",ctor:ia},{tag:"qti-sum",ctor:oa},{tag:"qti-truncate",ctor:sa},{tag:"qti-variable",ctor:aa}];for(let{tag:o,ctor:t}of mp)customElements.get(o)||customElements.define(o,t);var pe=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},J;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(J||(J={}));var Ml=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,n)=>{this.toggleInternalCorrectResponse(n)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,n)=>{this.toggleFullCorrectResponse(n)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,n)=>{this.toggleCandidateCorrection(n)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let n=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",n)}get correctness(){let r=this.correctResponse;if(!r)return null;let n=this.response;if(n==null||n===""||Array.isArray(n)&&n.length===0)return null;let i=Array.isArray(r)?r:[r],a=(Array.isArray(n)?n:[n]).filter(d=>d!=="");if(a.length===0)return null;let c=a.filter(d=>i.includes(d)).length,l=a.filter(d=>!i.includes(d)).length;return c===i.length&&l===0&&a.length===i.length?J.Correct:c>0&&(c<i.length||l>0)?J.PartiallyCorrect:J.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 n=this.nextSibling,i=n instanceof HTMLDivElement&&n?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==J.Correct))){if(!i)return;this.parentElement?.removeChild(n);return}if(i)return;let c=this.cloneNode(!0);c.removeAttribute("show-full-correct-response"),c.removeAttribute("show-correct-response"),c.removeAttribute("show-candidate-correction");let l=document.createElement("div");l.classList.add("full-correct-response"),this.isInline?l.classList.add("full-correct-response-inline"):l.classList.add("full-correct-response-block"),l.role="full-correct-response",l.appendChild(c),c.isFullCorrectResponse=!0,this.parentElement?.insertBefore(l,this.nextSibling),await c.updateComplete,c.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){this._internals.states.delete("show-correct-response"),r&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return pe([p({attribute:"correct-response",reflect:!0,converter:Wt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),pe([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),pe([$("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),pe([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),pe([$("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),pe([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),pe([$("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),pe([T()],t.prototype,"_isFullCorrectResponse",void 0),pe([T()],t.prototype,"_correctResponse",void 0),t};var ot=q`
|
|
9593
|
+
`}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.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#i(t){return new Promise((e,r)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>r(n.error),n.readAsDataURL(t)})}};var gs=[{tag:"qti-upload-interaction",ctor:fs}];var mp=[...Fo,...Bo,...Uo,...Wo,...Qo,...Go,...Yo,...Ko,...Jo,...Zo,...ts,...es,...rs,...ns,...os,...as,...ds,...ps,...us,...ms,...gs,...fh];for(let{tag:o,ctor:t}of mp)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Fo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Bo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Uo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Wo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Qo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Go)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 Jo)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 rs)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 as)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 ms)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of gs)customElements.get(o)||customElements.define(o,t);var l$=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await pd().load(`${o}`).then(a=>a.assessmentTest()),r=await Dr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),n=await Dr().load(`${t}/${e.href}`).then(a=>a.items()),i=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:i,items:n,testIdentifier:e.identifier}},c$=async o=>Xt().load(o).then(t=>t.htmlDoc().firstElementChild);var bs=class extends jm(Qt){calculate(){return this.calculateChildren(Array.from(this.children))}};function jm(o){return class extends o{calculateChildren(e){return e.map(n=>{let i=n;if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=i.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(n=>typeof n=="boolean"&&n)}}}var fp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Kr=class extends E{constructor(){super(...arguments),this.min=0,this.max=1/0}getResult(){let t=this.getVariables();if(!t||t.length===0)return console.error("qti-any-n requires at least one child expression"),null;if(this.min<0||this.max<this.min)return console.error("qti-any-n requires 0 <= min <= max"),null;let e=0;for(let r of t){if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-any-n requires single cardinality boolean expressions"),null;if(r.baseType!=="boolean")return console.error("qti-any-n requires boolean base-type"),null;if(r.value===null||r.value===void 0)return null;r.value==="true"&&e++}return e>=this.min&&e<=this.max}};fp([p({type:Number})],Kr.prototype,"min",void 0);fp([p({type:Number})],Kr.prototype,"max",void 0);var Fm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ln=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Fm([p({type:String,attribute:"base-type"})],ln.prototype,"baseType",void 0);var ys=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var vs=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let n=this.#t(t.value),i=this.#t(e.value);return i.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(n,i,r):this.#r(n,i,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return G.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let n=[...t];return e.every(i=>{let s=n.findIndex(a=>this.#e(a,i,r));return s===-1?!1:(n.splice(s,1),!0)})}#i(t,e,r){for(let n=0;n+e.length<=t.length;n++)if(e.every((i,s)=>this.#e(t[n+s],i,r)))return!0;return!1}};var ws=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var Pl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},vr=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let i=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!i)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 n=this.context.variables.find(i=>i.identifier===r);return n?n.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Pl([p({type:String})],vr.prototype,"identifier",void 0);Pl([_({context:j,subscribe:!0}),T()],vr.prototype,"context",void 0);Pl([T(),_({context:ot,subscribe:!0})],vr.prototype,"_testContext",void 0);var xs=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.cardinality!=="single"||!Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),null):t[0].baseType!==t[1].baseType?(console.error("The baseType of the two variables is different"),null):r.value.filter(i=>!e.value.includes(i))}return null}};var qs=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.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(i=>n(i));continue}n(r.value)}return e}};var Cs=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Ss=class extends E{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var Bm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},cn=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let n=parseFloat(e.value),i=parseFloat(r.value);if(!isNaN(n)&&!isNaN(i))return this.roundingMode==="significantFigures"?n.toPrecision(this.figures)===i.toPrecision(this.figures):Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${n}, ${i}`);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}};Bm([p({type:String,attribute:"rounding-mode"})],cn.prototype,"roundingMode",void 0);var gp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Jr=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?G.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[n,i=n]=r,[s,a]=this.toleranceMode==="absolute"?[e-n,e+i]:[e*(1-n/100),e*(1+i/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};gp([p({type:String,attribute:"tolerance-mode"})],Jr.prototype,"toleranceMode",void 0);gp([p({type:String})],Jr.prototype,"tolerance",void 0);var Q=class extends C{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var ks=class extends Q{process(){throw new Ir}};var Es=class extends Q{process(){throw new _r}};var As=class extends E{getResult(){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];if(!e||e.baseType!=="record"||e.value===null||e.value===void 0)return console.warn("qti-field-value child expression must return a record"),null;let r=e.value[t];return r===void 0?null:r}};var Is=class extends E{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let n=parseInt(r.value,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}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 n of r.value){if(n==null)return null;let i=parseInt(n,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}}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 _s=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];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 Ts=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(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 Um=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},dn=class extends E{getResult(){if(!this.n)return console.error('qti-index: missing required attribute "n"'),null;if(this.children.length!==1)return console.error("qti-index: must have exactly one child container element"),null;let t=this.getVariables()[0];if(!t)return console.error("qti-index: missing container"),null;let e;if(!isNaN(Number(this.n)))e=Number(this.n);else{let r=this.#t(this.n);if(r===null)return console.error(`qti-index: variable "${this.n}" is not a valid number`),null;e=Number(r)}if(e<=0||!Number.isInteger(e))return console.error("qti-index: index must be a positive integer"),null;if(t.cardinality==="ordered"){let r=Array.isArray(t.value)?t.value:[t.value];return t.value===null||e>r.length?null:r[e-1]}else return console.error("qti-index: child must have ordered cardinality"),null}#t(t){let e=this.context.variables.find(r=>r.identifier===t)?.value;return e===null||isNaN(Number(e))?null:Number(e)}};Um([p({type:String})],dn.prototype,"n",void 0);var bp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Zr=class extends E{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),n=this.#e(this.coords);if(!r||n.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,n);case"rect":return this.#i(r,n);case"ellipse":return this.#n(r,n);case"poly":case"polygon":return this.#o(r,n);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(i=>i.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]),n=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(n)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:n}}#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,n,i]=e;return(t.x-r)**2+(t.y-n)**2<=i**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,n,i,s]=e,a=Math.min(r,i),l=Math.max(r,i),c=Math.min(n,s),d=Math.max(n,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,n,i,s]=e;return i===0||s===0?!1:(t.x-r)**2/i**2+(t.y-n)**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 n=0,i=e.length-2;n<e.length;n+=2){let s=e[n],a=e[n+1],l=e[i],c=e[i+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(r=!r),i=n}return r}};bp([p({type:String})],Zr.prototype,"shape",void 0);bp([p({type:String})],Zr.prototype,"coords",void 0);var Rs=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-integer-divide requires integer values"),[];e.push(n)}return e}};var Os=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-integer-modulus requires integer values"),[];e.push(n)}return e}};var Ps=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var Ms=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var Ds=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let n=Number.parseInt(r.value,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n);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 n of r.value){let i=Number.parseInt(n,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i)}}return e}#e(t,e){let r=Math.abs(t),n=Math.abs(e);for(;n!==0;){let i=r%n;r=n,n=i}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var yp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ti=class extends Q{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(i=>i.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let r=parseFloat(this.childExpression.calculate()),n;return e.matchTable?.size?n=e.matchTable.get(r):e.interpolationTable&&(n=this.#t(r,e.interpolationTable)),n==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:Rt(n)}})),n)}#t(t,e){if(!Number.isNaN(t))return e.find(r=>r.includeBoundary?t>=r.sourceValue:t>r.sourceValue)?.targetValue}};yp([p({type:String})],ti.prototype,"identifier",void 0);yp([_({context:j,subscribe:!0}),T()],ti.prototype,"context",void 0);var Ns=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];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 $s=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return(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 Hm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},hn=class extends E{getResult(){let t=this.context.variables.find(s=>s.identifier===this.identifier);if(!t)return console.warn(`Response ${this.identifier} cannot be found`),null;let e=t.areaMapping;if(!e)return console.warn(`Area mapping not found for response ${this.identifier}`),null;let r=Array.isArray(t.value)?t.value:[t.value];if(!r||r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let n=0,i=new Set;for(let s of r)for(let a of e.areaMapEntries){if(i.has(a.coords))continue;if(G.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){n+=a.mappedValue??0,i.add(a.coords);break}}return i.size<r.length&&(n+=e.defaultValue),e.lowerBound!=null&&(n=Math.max(e.lowerBound,n)),e.upperBound!=null&&(n=Math.min(e.upperBound,n)),n}};Hm([p({type:String})],hn.prototype,"identifier",void 0);var Wm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},pn=class extends E{getResult(){let t=this.context.variables.find(i=>i.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],n=0;for(let i of r){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?G.compareSingleValues(l.mapKey.toLowerCase(),i.toLowerCase(),t.baseType):G.compareSingleValues(l.mapKey,i,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?n+=e.defaultValue:n+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(n=Math.max(e.lowerBound,n)),e?.upperBound!==null&&e?.upperBound!==void 0&&(n=Math.min(e.upperBound,n)),n}};Wm([p({type:String})],pn.prototype,"identifier",void 0);var Ls=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):G.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(!G.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 n of e.value){let i=null,s=[...t.value];for(let a of s)if(G.compareSingleValues(n,a,e.baseType)){i=a;break}if(i!==null)s.splice(s.indexOf(i),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Qm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},un=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};Qm([p({type:String})],un.prototype,"name",void 0);var Gm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},mn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let n=parseFloat(r.value);if(isNaN(n))return console.error("qti-math-operator non-numerical value"),null;e.push(n)}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],n=e[1];return r===0&&n<=0||r<0&&!Number.isInteger(n)?null:Math.pow(r,n)}case"log_base":{if(e.length!==2)return null;let r=e[0],n=e[1];return r<=0||n<=0||n===1?null:Math.log(r)/Math.log(n)}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}}};Gm([p({type:String})],mn.prototype,"name",void 0);var Vs=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.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(i=>n(i));continue}n(r.value)}return e}};var zs=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let n=e.value;return r.value.includes(n)}};var js=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.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(i=>n(i));continue}n(r.value)}return e}};var Fs=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var Bs=class extends E{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var Us=class extends E{getResult(){return null}};var Hs=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 n=r.calculate(),i=!1;if(typeof n=="string")if(n==="true")i=!0;else if(n==="false")i=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(i=n);return i}).some(e=>typeof e=="boolean"&&e)}};var Ws=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};var Qs=class extends C{render(){return b`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},ei=class extends Qs{shouldProcess(){return!0}getSubRules(){return[...this.children]}},ri=class extends Qs{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},ii=class extends Q{render(){return b`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var Gs=class extends ii{};var ni=class extends ri{};var Xs=class extends ni{};var Ys=class extends ei{};var Xm=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},fn=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=this.#t();return r?r.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};Xm([p({type:String})],fn.prototype,"pattern",void 0);var Ks=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let n=parseFloat(e.value),i=parseFloat(r.value);if(isNaN(n)||isNaN(i))return console.error("qti-power: non-numerical values encountered"),null;if(n===0&&i<=0||n<0&&!Number.isInteger(i))return null;let s;try{s=Math.pow(n,i)}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 Ym=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function Km(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function gn(o,t){return Km(t===void 0?o.toExponential():o.toExponential(t))}function vp(o){let[t,e]=o.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,n=e===void 0?"":`e${e}`;return`${r}${n}`}function wp(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?vp(gn(o,e-1)):vp(o.toFixed(Math.max(0,e-1-r)))}function Jm(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 n=Number(r);if(r.trim()===""||!Number.isFinite(n))return r;let i=Math.abs(n),s,a=n<0;switch(o){case"d":case"i":s=String(Math.trunc(i));break;case"u":s=String(Math.trunc(i)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(i).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(i).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(i).toString(16).toUpperCase()}`;break;case"f":case"F":s=i.toFixed(e??6);break;case"e":s=gn(i,e??6);break;case"E":s=gn(i,e??6).toUpperCase();break;case"g":s=wp(i,e??6);break;case"G":s=wp(i,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function Zm(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[,n,i]=/^([-+ ]?)(.*)$/.exec(o);return`${n}${"0".repeat(r)}${i}`}return`${" ".repeat(r)}${o}`}function xp(o,t){return o.replace(Ym,(e,r,n,i,s,a)=>r?"%":Zm(Jm(a,n??"",s===void 0?void 0:Number(s),t),n??"",i===void 0?0:Number(i)))}var ue=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},gt=class extends C{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:b`${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 i=r[this.field];return i==null?null:this.#e(i,t.baseType)}let n=Object.entries(r).filter(([,i])=>i!=null);return n.length===0?null:n.map(([i,s])=>`${i}${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 xp(this.format,r);if(e==="integer"&&this.base!==10){let n=Number.parseInt(r,10);if(Number.isFinite(n))return n.toString(this.base)}if(this.powerForm){let n=Number(r);if(r.trim()!==""&&Number.isFinite(n))return gn(n)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};ue([p({type:String})],gt.prototype,"identifier",void 0);ue([p({type:String})],gt.prototype,"format",void 0);ue([p({type:Number})],gt.prototype,"base",void 0);ue([p({type:Number})],gt.prototype,"index",void 0);ue([p({type:Boolean,attribute:"power-form"})],gt.prototype,"powerForm",void 0);ue([p({type:String})],gt.prototype,"field",void 0);ue([p({type:String})],gt.prototype,"delimiter",void 0);ue([p({type:String,attribute:"mapping-indicator"})],gt.prototype,"mappingIndicator",void 0);ue([_({context:j,subscribe:!0}),T()],gt.prototype,"context",void 0);var Js=class extends E{getResult(){return this.getVariables().reduce((r,n)=>{if(n.baseType=="float"||n.baseType=="integer")try{return r*parseFloat(n.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${n.baseType}`);return r},1)}};var Ml=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},wr=class extends E{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let n=this.min+this.step*e;if(n>this.max)break;Number.isInteger(n)&&t.push(n),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)]}};Ml([p({type:Number})],wr.prototype,"min",void 0);Ml([p({type:Number})],wr.prototype,"max",void 0);Ml([p({type:Number})],wr.prototype,"step",void 0);var Zs=class extends E{getResult(){let t=this.getVariables();if(t.length===1){let e=t[0].value;if(Array.isArray(e)){let r=Math.floor(Math.random()*e.length);return e[r]}return e}return console.error("unexpected number of children in match"),null}};var tf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Dl=1e3,bn=class extends E{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let n=0;n<t;n++){let i=e.calculate(),s=this.#r(i);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 n=Array.isArray(r.value)?r.value[0]:r.value,i=parseInt(n?.toString()??"",10);return Number.isNaN(i)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(i)}#e(t){return t>Dl?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${Dl} limit, truncating`),Dl):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"}}};tf([p({type:String,attribute:"number-repeats"})],bn.prototype,"numberRepeats",void 0);var ta=class extends ii{};var oi=class extends ri{};var ea=class extends oi{};var ra=class extends ei{};var ia=class extends Q{process(){for(let t of[...this.children])t.process()}};var qp=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},si=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),n=Math.pow(10,e-r-1);return Math.round(t*n)/n}};qp([p({type:String,attribute:"rounding-mode"})],si.prototype,"roundingMode",void 0);qp([p({type:Number})],si.prototype,"figures",void 0);var na=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var oa=class extends Q{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 n=new Nl(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(n)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Rt(this.#e(e))):Rt(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()??""}},Nl=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 sa=class extends Q{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 n=new $l(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(n)}}))}#t(t){return Array.isArray(t)?t.map(Rt):t!==null?Rt(t):null}},$l=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 aa=class extends Q{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 n=new Ll(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(n)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Rt(this.#e(e))):Rt(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()??""}},Ll=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 ef=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},yn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#i(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#r(t,t.length);case"popsd":return Math.sqrt(this.#r(t,t.length));case"samplevariance":return t.length<2?null:this.#r(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#r(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,r)=>e+r,0)/t.length}#e(t){let e=[...t].sort((n,i)=>n-i),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((n,i)=>n+Math.pow(i-r,2),0)/e}#i(t){let e=[];for(let r of t){if(!r)continue;let n=i=>{if(i==null)return;let s=parseFloat(i.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(i=>n(i));continue}n(r.value)}return e}};ef([p({type:String})],yn.prototype,"name",void 0);var rf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},vn=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let n=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),i=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return G.compareSingleValues(n,i,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};rf([p({type:String,attribute:"case-sensitive"})],vn.prototype,"caseSensitive",void 0);var nf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},wn=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let n=e.value.toString(),i=r.value.toString();return this.caseSensitive!=="true"?i.toLowerCase().includes(n.toLowerCase()):i.includes(n)}};nf([p({type:String,attribute:"case-sensitive"})],wn.prototype,"caseSensitive",void 0);var la=class extends of(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function of(o){return class extends o{calculateChildren(e){let r=e.map(n=>{if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=n.calculate();return Number.isNaN(i)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(i)});return r.some(n=>n===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var ca=class extends E{getResult(){return new Vl(Array.from(this.children)).calculate()}},Vl=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 n=r.calculate();return Number.isNaN(n)?(console.error("unexpected value in qti-sum, expected number"),null):Number(n)}).reduce((r,n)=>r+n,0)}};var da=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var ha=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var Cp=[{tag:"qti-and",ctor:bs},{tag:"qti-any-n",ctor:Kr},{tag:"qti-base-value",ctor:ln},{tag:"qti-container-size",ctor:ys},{tag:"qti-contains",ctor:vs},{tag:"qti-correct",ctor:ws},{tag:"qti-default",ctor:vr},{tag:"qti-delete",ctor:xs},{tag:"qti-divide",ctor:qs},{tag:"qti-duration-gte",ctor:Cs},{tag:"qti-duration-lt",ctor:Ss},{tag:"qti-equal",ctor:Jr},{tag:"qti-equal-rounded",ctor:cn},{tag:"qti-exit-response",ctor:ks},{tag:"qti-exit-test",ctor:Es},{tag:"qti-field-value",ctor:As},{tag:"qti-gcd",ctor:Is},{tag:"qti-gt",ctor:_s},{tag:"qti-gte",ctor:Ts},{tag:"qti-index",ctor:dn},{tag:"qti-inside",ctor:Zr},{tag:"qti-integer-divide",ctor:Rs},{tag:"qti-integer-modulus",ctor:Os},{tag:"qti-integer-to-float",ctor:Ps},{tag:"qti-is-null",ctor:Ms},{tag:"qti-lcm",ctor:Ds},{tag:"qti-lookup-outcome-value",ctor:ti},{tag:"qti-lt",ctor:Ns},{tag:"qti-lte",ctor:$s},{tag:"qti-map-response",ctor:pn},{tag:"qti-map-response-point",ctor:hn},{tag:"qti-match",ctor:Ls},{tag:"qti-math-constant",ctor:un},{tag:"qti-math-operator",ctor:mn},{tag:"qti-max",ctor:Vs},{tag:"qti-member",ctor:zs},{tag:"qti-min",ctor:js},{tag:"qti-multiple",ctor:Fs},{tag:"qti-not",ctor:Bs},{tag:"qti-null",ctor:Us},{tag:"qti-or",ctor:Hs},{tag:"qti-ordered",ctor:Ws},{tag:"qti-outcome-condition",ctor:Gs},{tag:"qti-outcome-else",ctor:Ys},{tag:"qti-outcome-else-if",ctor:Xs},{tag:"qti-outcome-if",ctor:ni},{tag:"qti-pattern-match",ctor:fn},{tag:"qti-power",ctor:Ks},{tag:"qti-printed-variable",ctor:gt},{tag:"qti-product",ctor:Js},{tag:"qti-random",ctor:Zs},{tag:"qti-random-integer",ctor:wr},{tag:"qti-repeat",ctor:bn},{tag:"qti-response-condition",ctor:ta},{tag:"qti-response-else",ctor:ra},{tag:"qti-response-else-if",ctor:ea},{tag:"qti-response-if",ctor:oi},{tag:"qti-response-processing-fragment",ctor:ia},{tag:"qti-round",ctor:na},{tag:"qti-round-to",ctor:si},{tag:"qti-rule",ctor:Q},{tag:"qti-set-correct-response",ctor:oa},{tag:"qti-set-outcome-value",ctor:sa},{tag:"qti-set-template-value",ctor:aa},{tag:"qti-stats-operator",ctor:yn},{tag:"qti-string-match",ctor:vn},{tag:"qti-substring",ctor:wn},{tag:"qti-subtract",ctor:la},{tag:"qti-sum",ctor:ca},{tag:"qti-truncate",ctor:da},{tag:"qti-variable",ctor:ha}];for(let{tag:o,ctor:t}of Cp)customElements.get(o)||customElements.define(o,t);var me=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},J;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(J||(J={}));var zl=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,n)=>{this.toggleInternalCorrectResponse(n)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,n)=>{this.toggleFullCorrectResponse(n)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,n)=>{this.toggleCandidateCorrection(n)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let n=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",n)}get correctness(){let r=this.correctResponse;if(!r)return null;let n=this.response;if(n==null||n===""||Array.isArray(n)&&n.length===0)return null;let i=Array.isArray(r)?r:[r],a=(Array.isArray(n)?n:[n]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>i.includes(d)).length,c=a.filter(d=>!i.includes(d)).length;return l===i.length&&c===0&&a.length===i.length?J.Correct:l>0&&(l<i.length||c>0)?J.PartiallyCorrect:J.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 n=this.nextSibling,i=n instanceof HTMLDivElement&&n?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==J.Correct))){if(!i)return;this.parentElement?.removeChild(n);return}if(i)return;let l=this.cloneNode(!0);l.removeAttribute("show-full-correct-response"),l.removeAttribute("show-correct-response"),l.removeAttribute("show-candidate-correction");let c=document.createElement("div");c.classList.add("full-correct-response"),this.isInline?c.classList.add("full-correct-response-inline"):c.classList.add("full-correct-response-block"),c.role="full-correct-response",c.appendChild(l),l.isFullCorrectResponse=!0,this.parentElement?.insertBefore(c,this.nextSibling),await l.updateComplete,l.response=Array.isArray(s)?[...s]:s}toggleInternalCorrectResponse(r){this._internals.states.delete("show-correct-response"),r&&this.correctResponse&&this._internals.states.add("show-correct-response")}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return me([p({attribute:"correct-response",reflect:!0,converter:Gt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),me([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),me([L("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),me([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),me([L("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),me([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),me([L("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),me([T()],t.prototype,"_isFullCorrectResponse",void 0),me([T()],t.prototype,"_correctResponse",void 0),t};var nt=q`
|
|
9581
9594
|
/* Nothing at all until the item judges this element. */
|
|
9582
9595
|
[part~='correction'] {
|
|
9583
9596
|
display: none;
|
|
@@ -9610,21 +9623,21 @@ CES.load();
|
|
|
9610
9623
|
|
|
9611
9624
|
pointer-events: none;
|
|
9612
9625
|
}
|
|
9613
|
-
`;var
|
|
9626
|
+
`;var sf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Y=o=>{class t extends zl(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return this._candidateCorrection?`correction correction-${this._candidateCorrection}`:"correction"}toggleCandidateCorrection(r){this.showCandidateCorrection!==r&&(this.showCandidateCorrection=r),super.toggleCandidateCorrection(r);let n=this._internals;n.states.delete("candidate-correct"),n.states.delete("candidate-partially-correct"),n.states.delete("candidate-incorrect");let i=null;r&&(this.correctness===J.Correct&&(n.states.add("candidate-correct"),i="correct"),this.correctness===J.PartiallyCorrect&&(n.states.add("candidate-partially-correct"),i="partially-correct"),this.correctness===J.Incorrect&&(n.states.add("candidate-incorrect"),i="incorrect")),this._candidateCorrection!==i&&(this._candidateCorrection=i)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return sf([T()],t.prototype,"_candidateCorrection",void 0),t};var xr=o=>{class t extends Y(o){toggleInternalCorrectResponse(r){super.toggleInternalCorrectResponse(r);let n=this.correctResponse,i=n?Array.isArray(n)?n:[n]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),r&&i.length>0&&s.internals.states.add(i.includes(s.identifier)?"correct-response":"incorrect-response")}toggleCandidateCorrection(r){super.toggleCandidateCorrection(r);for(let s of this._choiceElements)s.candidateCorrection=null;if(!r||!this.correctResponse)return;let n=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],i=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)i.includes(s.identifier)&&(s.candidateCorrection=n.includes(s.identifier)?"correct":"incorrect")}}return t};var _t=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(r){if(this.#t===r)return;let n=this.#t;this.#t=r;let i=this.internals.states;i.delete("candidate-correct"),i.delete("candidate-incorrect"),i.delete("candidate-partially-correct"),r&&i.add(`candidate-${r}`),this.requestUpdate("candidateCorrection",n)}get correctionPart(){return this.#t?`correction correction-${this.#t}`:"correction"}}return t};var jl=class extends _t(Re){static{this.styles=[Re.styles,nt]}render(){return b`<div part="control"></div>
|
|
9614
9627
|
<slot part="label"></slot>
|
|
9615
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
9628
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var af=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},pa=class extends _t(pr){constructor(){super(...arguments),this.orderCorrect=null}};af([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],pa.prototype,"orderCorrect",void 0);var Fl=class extends _t(ur){static{this.styles=[ur.styles,nt]}render(){return b`<div part="control"><div part="control-mark"></div></div>
|
|
9616
9629
|
<slot part="label"></slot>
|
|
9617
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
9630
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Bl=class extends _t(Nt){static{this.styles=[Nt.styles,nt]}render(){return b`
|
|
9618
9631
|
<div part="control"></div>
|
|
9619
9632
|
<slot part="label"></slot>
|
|
9620
9633
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9621
9634
|
<div part="drop">
|
|
9622
9635
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
9623
9636
|
</div>
|
|
9624
|
-
`}};var
|
|
9637
|
+
`}};var Ul=class extends _t($t){static{this.styles=[$t.styles,nt]}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
|
|
9625
9638
|
${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:P}
|
|
9626
9639
|
<slot part="label"></slot>
|
|
9627
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
9640
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Sp=class extends ut{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(n=>n.shown=e),!(r instanceof ShadowRoot))return;r=r.host.getRootNode()}}};var kp=class extends le{#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 Ep=class extends mt{#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?.showSolution)return;let n=t;n.showCandidateCorrection?.(!0),n.showCorrectResponse?.(r)}},Ap=class extends Ee{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}},Ip=class extends er{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var Hl=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},xn=class extends C{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return b`
|
|
9628
9641
|
<label part="label" for="modeSelect">${this.label}</label>
|
|
9629
9642
|
<select
|
|
9630
9643
|
part="select"
|
|
@@ -9635,44 +9648,44 @@ CES.load();
|
|
|
9635
9648
|
${this._options[t]}
|
|
9636
9649
|
</option>`)}
|
|
9637
9650
|
</select>
|
|
9638
|
-
`}};
|
|
9651
|
+
`}};Hl([_({context:vt,subscribe:!0})],xn.prototype,"itemContext",void 0);Hl([p({type:String})],xn.prototype,"label",void 0);Hl([T()],xn.prototype,"_options",void 0);var _p=q`
|
|
9639
9652
|
display: inline-flex;
|
|
9640
9653
|
align-items: center;
|
|
9641
9654
|
cursor: pointer;
|
|
9642
9655
|
padding: 0.5rem 1rem;
|
|
9643
9656
|
border-radius: 0.25rem;
|
|
9644
9657
|
user-select: none;
|
|
9645
|
-
`,
|
|
9658
|
+
`,ai=q`
|
|
9646
9659
|
background-color: lightgray;
|
|
9647
|
-
${
|
|
9648
|
-
`,
|
|
9660
|
+
${_p};
|
|
9661
|
+
`,li=q`
|
|
9649
9662
|
cursor: not-allowed;
|
|
9650
9663
|
opacity: 0.8;
|
|
9651
|
-
`,
|
|
9652
|
-
${
|
|
9664
|
+
`,Aj=q`
|
|
9665
|
+
${_p};
|
|
9653
9666
|
border: 1px solid gray;
|
|
9654
|
-
`;var
|
|
9667
|
+
`;var ci=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Fe=class extends C{static{this.styles=q`
|
|
9655
9668
|
:host {
|
|
9656
|
-
${
|
|
9669
|
+
${ai};
|
|
9657
9670
|
}
|
|
9658
9671
|
:host([disabled]) {
|
|
9659
|
-
${
|
|
9672
|
+
${li};
|
|
9660
9673
|
}
|
|
9661
|
-
`}#t;#e;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCandidateCorrectionText="Show candidate correction",this.hideCandidateCorrectionText="Hide candidate correction",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))}#
|
|
9674
|
+
`}#t;#e;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCandidateCorrectionText="Show candidate correction",this.hideCandidateCorrectionText="Hide candidate correction",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-candidate-correction",{detail:!this.shown,bubbles:!0}))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCandidateCorrectionText:this.showCandidateCorrectionText}render(){return b` <div @click="${this.#r}">${this.#i()}</div> `}};ci([_({context:ye,subscribe:!0})],Fe.prototype,"computedContext",void 0);ci([p({type:Boolean,reflect:!0})],Fe.prototype,"shown",void 0);ci([p({type:Boolean,reflect:!0})],Fe.prototype,"disabled",void 0);ci([p({type:String})],Fe.prototype,"showCandidateCorrectionText",void 0);ci([p({type:String})],Fe.prototype,"hideCandidateCorrectionText",void 0);ci([p({type:String})],Fe.prototype,"noCorrectResponseText",void 0);var di=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Be=class extends C{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=!1,this.#e=""}static{this.styles=q`
|
|
9662
9675
|
:host {
|
|
9663
|
-
${
|
|
9676
|
+
${ai};
|
|
9664
9677
|
}
|
|
9665
9678
|
:host([disabled]) {
|
|
9666
|
-
${
|
|
9679
|
+
${li};
|
|
9667
9680
|
}
|
|
9668
|
-
`}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))}#
|
|
9681
|
+
`}#t;#e;updated(){if(!this.#t||this.#e!==this.computedContext?.identifier){this.#e=this.computedContext?.identifier;let t=!!this.computedContext?.variables.some(r=>r.correctResponse),e=!!this.computedContext?.variables.some(r=>r.mapping?.mapEntries?.length>0||r.areaMapping?.areaMapEntries?.length>0);this.#t=t||e}this.disabled=!this.#t}#r(){this.disabled||this.dispatchEvent(new CustomEvent("item-show-correct-response",{detail:!this.shown,bubbles:!0}))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return b` <div @click="${this.#r}">${this.#i()}</div> `}};di([_({context:ye,subscribe:!0})],Be.prototype,"computedContext",void 0);di([p({type:Boolean,reflect:!0})],Be.prototype,"shown",void 0);di([p({type:Boolean,reflect:!0})],Be.prototype,"disabled",void 0);di([p({type:String})],Be.prototype,"showCorrectText",void 0);di([p({type:String})],Be.prototype,"hideCorrectText",void 0);di([p({type:String})],Be.prototype,"noCorrectResponseText",void 0);var hi=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},Ue=class extends C{constructor(){super(...arguments),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified"}static{this.styles=q`
|
|
9669
9682
|
:host {
|
|
9670
|
-
${
|
|
9683
|
+
${ai};
|
|
9671
9684
|
}
|
|
9672
9685
|
:host([disabled]) {
|
|
9673
|
-
${
|
|
9686
|
+
${li};
|
|
9674
9687
|
}
|
|
9675
|
-
`}#t;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(n=>n.items)).find(r=>r.active);if(this.#t!==e&&(this.shown=!1,this.#t=e),e){let r=!!e?.variables?.some(i=>i.correctResponse),n=!!e?.variables?.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!n}else this.disabled=!0}#e(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#r(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return b` <div @click="${this.#e}">${this.#r()}</div> `}};
|
|
9688
|
+
`}#t;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(n=>n.items)).find(r=>r.active);if(this.#t!==e&&(this.shown=!1,this.#t=e),e){let r=!!e?.variables?.some(i=>i.correctResponse),n=!!e?.variables?.some(i=>i.mapping?.mapEntries?.length>0||i.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!n}else this.disabled=!0}#e(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#r(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return b` <div @click="${this.#e}">${this.#r()}</div> `}};hi([_({context:z,subscribe:!0})],Ue.prototype,"computedContext",void 0);hi([p({type:Boolean,reflect:!0})],Ue.prototype,"shown",void 0);hi([p({type:Boolean,reflect:!0})],Ue.prototype,"disabled",void 0);hi([p({type:String})],Ue.prototype,"showCorrectText",void 0);hi([p({type:String})],Ue.prototype,"hideCorrectText",void 0);hi([p({type:String})],Ue.prototype,"noCorrectResponseText",void 0);var Jt=o=>{class t extends Y(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 Ql=class extends Jt(gr){};var Gl=class extends xr(br){};var lf=function(o,t,e,r){var n=arguments.length,i=n<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(i=(n<3?s(i):n>3?s(t,e,i):s(t,e))||i);return n>3&&i&&Object.defineProperty(t,e,i),i},ua=class extends _t(X){static{this.styles=[X.styles,nt,q`
|
|
9676
9689
|
/*
|
|
9677
9690
|
* Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
|
|
9678
9691
|
* is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
|
|
@@ -9735,7 +9748,7 @@ CES.load();
|
|
|
9735
9748
|
}
|
|
9736
9749
|
`]}render(){return b`${this.renderPrompt()}${this.renderTextarea()}
|
|
9737
9750
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9738
|
-
${this.renderValidationMessage()}`}};
|
|
9751
|
+
${this.renderValidationMessage()}`}};lf([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],ua.prototype,"candidateCorrection",void 0);var ma=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[r,n]=e.split(" ");return{source:r,target:n}}):[];var Xl=class extends Jt(Wr){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=ma(this.correctResponse);for(let r of this.querySelectorAll("qti-gap")){let n=r.getAttribute("identifier"),i=r.drags;for(let s of i)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===n)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var Yl=class extends Y(jt){#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=>Ei`
|
|
9739
9752
|
<line
|
|
9740
9753
|
part="correct-line"
|
|
9741
9754
|
x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
|
|
@@ -9746,7 +9759,7 @@ CES.load();
|
|
|
9746
9759
|
stroke-width="3"
|
|
9747
9760
|
stroke-dasharray="5,5"
|
|
9748
9761
|
/>
|
|
9749
|
-
`)}};var
|
|
9762
|
+
`)}};var Kl=class extends Jt(Qr){};var Jl=class extends Y(ze){resolvePinColor(t){let e=t;return e.matches(":state(candidate-incorrect)")?"var(--qti-incorrect)":e.matches(":state(candidate-correct)")?"var(--qti-correct)":e.matches(":state(correct-response)")?"var(--qti-answer-border)":super.resolvePinColor(t)}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let n of this._choiceElements){let i=r.indexOf(n.identifier);n.orderCorrect=t&&i>=0?i+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let n of this._choiceElements)n.candidateCorrection=null,t&&n.order!=null&&(n.candidateCorrection=r[n.order-1]===n.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var Zl=class extends xr(Gr){};var tc=class extends xr(Xr){};var ec=class extends Y(rt){static get styles(){return[rt.styles,nt,q`
|
|
9750
9763
|
/*
|
|
9751
9764
|
* Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
|
|
9752
9765
|
* badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
|
|
@@ -9765,20 +9778,20 @@ CES.load();
|
|
|
9765
9778
|
`]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return b`
|
|
9766
9779
|
${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
|
|
9767
9780
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9768
|
-
`}};var
|
|
9781
|
+
`}};var rc=class extends Jt(pe){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=ma(this.correctResponse);this.#t=t?new Set(e.map(r=>`${r.source} ${r.target}`)):new Set;for(let r of this.targetChoices){let n=r.getAttribute("identifier"),i=r.drags;for(let s of i)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${n}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"correct":"incorrect"}};function cf(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 i=0;i<o.length;i++)for(let s=0;s<i;s++)o[s]<o[i]&&t[s]+1>t[i]&&(t[i]=t[s]+1,e[i]=s);let r=0;for(let i=1;i<o.length;i++)t[i]>t[r]&&(r=i);let n=new Set;for(let i=r;i!==-1;i=e[i])n.add(i);return n}function Tp(o,t){let e=new Map(t.map((a,l)=>[a,l])),r=o.filter(a=>e.has(a)),n=r.map(a=>e.get(a)),i=cf(n),s=new Set;return i.forEach(a=>s.add(r[a])),s}var ic=class extends Jt(je){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 n=this.correctResponse,s=(n?Array.isArray(n)?n:[n]:[]).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=Tp(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var nc=class extends Y(W){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,r=e?.correctResponse??this.correctResponse;this.correctResponse=t?r:e?.cardinality==="single"?"":[];let n=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${n}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let i=document.createElement("div");i.id=n,i.className="pci-correct-response-container",Object.assign(i.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"}),i.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",i.append(a),this.after(i)}};var oc=class extends Y(ft){#t=[];#e=[];static{this.styles=[ft.styles,q`
|
|
9769
9782
|
[part~='correct'] {
|
|
9770
9783
|
--qti-select-point-marker-color: var(--qti-correct);
|
|
9771
9784
|
}
|
|
9772
9785
|
[part~='incorrect'] {
|
|
9773
9786
|
--qti-select-point-marker-color: var(--qti-incorrect);
|
|
9774
9787
|
}
|
|
9775
|
-
`]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let r=this._effectiveAreaEntries,n=this.responseVariable?.baseType,i=this.correctResponse;for(let s of this.responsePoints){let a=r.some(
|
|
9776
|
-
style=${
|
|
9788
|
+
`]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let r=this._effectiveAreaEntries,n=this.responseVariable?.baseType,i=this.correctResponse;for(let s of this.responsePoints){let a=r.some(l=>G.isPointInArea(`${s.x} ${s.y}`,`${l.shape},${l.coords}`,n));!r.length&&i&&(a=(Array.isArray(i)?i:[i]).some(c=>{let[d,h]=c.split(" ").map(Number);return Number.isFinite(d)&&Number.isFinite(h)&&Math.hypot(s.x-d,s.y-h)<=10})),this.#e.push(a)}this.requestUpdate("responseCorrection",e)}toggleInternalCorrectResponse(t){if(super.toggleInternalCorrectResponse(t),!t){let n=this.#t;this.#t=[],this.requestUpdate("correctAreas",n);return}let e=this._effectiveAreaEntries;if(!e.length){let n=this.correctResponse,i=n?Array.isArray(n)?n:[n]:[];if(i.some(s=>s.split(" ").length<2)){console.error("No valid correct responses found.");return}e=i.map(s=>({shape:"circle",coords:`${s.split(" ").join(",")},10`,defaultValue:1,mappedValue:1}))}let r=this.#t;this.#t=e.map(n=>({shape:n.shape,coords:n.coords})),this.requestUpdate("correctAreas",r)}pointPart(t,e){let r=this.#e[e];return r===void 0?"point":`point ${r?"correct":"incorrect"}`}renderSupplementalLayer(){return H(this.#t,t=>`${t.shape}:${t.coords}`,(t,e)=>b`<div
|
|
9789
|
+
style=${hs({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
|
|
9777
9790
|
data-correction-area
|
|
9778
9791
|
data-coord=${t.coords}
|
|
9779
9792
|
data-shape=${t.shape}
|
|
9780
9793
|
alt=${`correct-response-${e+1}`}
|
|
9781
|
-
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var
|
|
9794
|
+
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var sc=class extends Y(It){#t=null;static{this.styles=[It.styles,q`
|
|
9782
9795
|
[part='knob-correct'] {
|
|
9783
9796
|
background-color: var(--qti-correct-light);
|
|
9784
9797
|
border: 2px solid var(--qti-correct);
|
|
@@ -9793,7 +9806,7 @@ CES.load();
|
|
|
9793
9806
|
}
|
|
9794
9807
|
`]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=Array.isArray(e)?e[0]:e,n=t&&r?parseFloat(r):NaN,i=this.#t;if(this.#t=Number.isFinite(n)?n: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",i)}renderRailSupplement(){return this.#t===null?P:b`<div id="knob-correct" part="knob-correct">
|
|
9795
9808
|
<div id="value" part="value">${this.#t}</div>
|
|
9796
|
-
</div>`}};var
|
|
9809
|
+
</div>`}};var ac=class extends Y(dt){static{this.styles=[dt.styles,nt,q`
|
|
9797
9810
|
/*
|
|
9798
9811
|
* The trailing inset only — size and leading gap come from the shared sheet.
|
|
9799
9812
|
*
|
|
@@ -9826,7 +9839,7 @@ CES.load();
|
|
|
9826
9839
|
${this.renderAnswer()} ${this.renderInput()}
|
|
9827
9840
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9828
9841
|
${this.renderValidationMessage()}
|
|
9829
|
-
`}};export{Y as CandidateCorrectionMixin,
|
|
9842
|
+
`}};export{Y as CandidateCorrectionMixin,xr as ChoiceCorrectionMixin,zl as CorrectResponseMixin,J as Correctness,za as CustomStateSetShim,ja as INITIAL_SESSION_CONTEXT,Fa as INITIAL_TEST_CONTEXT,D as Interaction,Ha as IsNullOrUndefined,Dt as ItemContainer,xn as ItemCorrectResponseMode,Ki as ItemPrintVariables,Fe as ItemShowCandidateCorrection,Be as ItemShowCorrectResponse,Ud as ItemViewMixin,fo as QTI_TEST_STATE_VERSION,bs as QtiAnd,Kr as QtiAnyN,ut as QtiAssessmentItem,Sp as QtiAssessmentItemCorrection,qt as QtiAssessmentItemRef,Ct as QtiAssessmentSection,Xn as QtiAssessmentStimulus,Nr as QtiAssessmentStimulusRef,nl as QtiAssessmentStimulusRefConnectedEvent,Ke as QtiAssessmentTest,Fr as QtiAssociableHotspot,gr as QtiAssociateInteraction,Ql as QtiAssociateInteractionCorrection,ln as QtiBaseValue,br as QtiChoiceInteraction,Gl as QtiChoiceInteractionCorrection,to as QtiCompanionMaterialsInfo,Qt as QtiConditionExpression,ys as QtiContainerSize,vs as QtiContains,Di as QtiContentBody,$r as QtiContextDeclaration,ws as QtiCorrect,de as QtiCustomInteraction,Ni as QtiCustomOperator,vr as QtiDefault,xs as QtiDelete,qs as QtiDivide,Cs as QtiDurationGte,Ss as QtiDurationLt,Le as QtiEndAttemptInteraction,Jr as QtiEqual,cn as QtiEqualRounded,ks as QtiExitResponse,Ir as QtiExitResponseSignal,Es as QtiExitTest,_r as QtiExitTestSignal,E as QtiExpression,X as QtiExtendedTextInteraction,ua as QtiExtendedTextInteractionCorrection,pt as QtiFeedback,eo as QtiFeedbackBlock,ro as QtiFeedbackInline,As as QtiFieldValue,dr as QtiGap,Ji as QtiGapImg,Wr as QtiGapMatchInteraction,Xl as QtiGapMatchInteractionCorrection,Re as QtiGapText,jl as QtiGapTextCorrection,Is as QtiGcd,jt as QtiGraphicAssociateInteraction,Yl as QtiGraphicAssociateInteractionCorrection,Qr as QtiGraphicGapMatchInteraction,Kl as QtiGraphicGapMatchInteractionCorrection,ze as QtiGraphicOrderInteraction,Jl as QtiGraphicOrderInteractionCorrection,_s as QtiGt,Ts as QtiGte,pr as QtiHotspotChoice,pa as QtiHotspotChoiceCorrection,Gr as QtiHotspotInteraction,Zl as QtiHotspotInteractionCorrection,ur as QtiHottext,Fl as QtiHottextCorrection,Xr as QtiHottextInteraction,tc as QtiHottextInteractionCorrection,dn as QtiIndex,Zi as QtiInlineChoice,rt as QtiInlineChoiceInteraction,ec as QtiInlineChoiceInteractionCorrection,Zr as QtiInside,Rs as QtiIntegerDivide,Os as QtiIntegerModulus,Ps as QtiIntegerToFloat,Ms as QtiIsNull,le as QtiItem,io as QtiItemBody,kp as QtiItemCorrection,Ot as QtiItemSessionControl,Ds as QtiLcm,ti as QtiLookupOutcomeValue,Ns as QtiLt,$s as QtiLte,pn as QtiMapResponse,hn as QtiMapResponsePoint,Ls as QtiMatch,pe as QtiMatchInteraction,rc as QtiMatchInteractionCorrection,un as QtiMathConstant,mn as QtiMathOperator,Vs as QtiMax,is as QtiMediaInteraction,zs as QtiMember,js as QtiMin,Lr as QtiModalFeedback,Fs as QtiMultiple,Bs as QtiNot,Us as QtiNull,Qn as QtiNumberSelected,Hs as QtiOr,je as QtiOrderInteraction,ic as QtiOrderInteractionCorrection,Ws as QtiOrdered,Gs as QtiOutcomeCondition,oe as QtiOutcomeDeclaration,Ys as QtiOutcomeElse,Xs as QtiOutcomeElseIf,ni as QtiOutcomeIf,Gn as QtiOutcomeProcessing,Za as QtiOutcomeProcessingProcessor,fn as QtiPatternMatch,W as QtiPortableCustomInteraction,nc as QtiPortableCustomInteractionCorrection,ls as QtiPositionObjectInteraction,cs as QtiPositionObjectStage,Ks as QtiPower,gt as QtiPrintedVariable,Js as QtiProduct,To as QtiPrompt,Zs as QtiRandom,wr as QtiRandomInteger,bn as QtiRepeat,ta as QtiResponseCondition,xe as QtiResponseDeclaration,ra as QtiResponseElse,ea as QtiResponseElseIf,oi as QtiResponseIf,oo as QtiResponseProcessing,ia as QtiResponseProcessingFragment,na as QtiRound,si as QtiRoundTo,se as QtiRubricBlock,Kc as QtiRuleElement,ft as QtiSelectPointInteraction,oc as QtiSelectPointInteractionCorrection,oa as QtiSetCorrectResponse,Nl as QtiSetCorrectResponseRule,sa as QtiSetOutcomeValue,$l as QtiSetOutcomeValueRule,aa as QtiSetTemplateValue,Ll as QtiSetTemplateValueRule,Nt as QtiSimpleAssociableChoice,Bl as QtiSimpleAssociableChoiceCorrection,$t as QtiSimpleChoice,Ul as QtiSimpleChoiceCorrection,It as QtiSliderInteraction,sc as QtiSliderInteractionCorrection,yn as QtiStatsOperator,vn as QtiStringMatch,lo as QtiStylesheet,wn as QtiSubstring,la as QtiSubtract,ca as QtiSum,Vl as QtiSumExpression,co as QtiTemplateConstraint,ae as QtiTemplateDeclaration,ho as QtiTemplateProcessing,Ee as QtiTest,Ap as QtiTestCorrection,po as QtiTestFeedback,ke as QtiTestPart,ji as QtiTestVariables,sl as QtiTestVariablesExpression,dt as QtiTextEntryInteraction,ac as QtiTextEntryInteractionCorrection,da as QtiTruncate,fs as QtiUploadInteraction,ha as QtiVariable,Ar as QtiVariableDeclaration,G as ScoringHelper,er as TestCheckItem,Ip as TestCheckItemCorrection,St as TestContainer,rr as TestEndAttempt,Fi as TestItemLink,_e as TestItemToSpeech,mt as TestNavigation,Ep as TestNavigationCorrection,or as TestNext,Ui as TestPagingButtonsStamp,sr as TestPrev,Hi as TestPrintContext,Wi as TestPrintVariables,ar as TestScoringButtons,jr as TestScoringFeedback,Qi as TestSectionButtonsStamp,Gi as TestSectionLink,Ue as TestShowCorrectResponse,lr as TestStamp,Ao as TestTtsNext,Co as TestTtsPause,Io as TestTtsPick,Bi as TestTtsPlay,Eo as TestTtsPrev,So as TestTtsResume,ko as TestTtsStop,Yt as TestView,Yi as TestViewToggle,zb as asSeed,O as boxSizing,uu as classifyCustomStateSupport,z as computedContext,ye as computedItemContext,vt as configContext,Rt as convertNumberToUniversalFormat,nt as correctionPart,fy as decimalSeparator,Wt as dropRegion,Jc as getCustomOperator,c$ as getItemByUri,l$ as getManifestInfo,Gc as installCustomStateSetFallback,kr as interactionContext,fu as isSeed,j as itemContext,Xc as itemContextVariables,Sy as iterResponseValues,ky as parsePair,Ay as parsePoint,Wa as parseResponseAttribute,jm as qtiAndMixin,wt as qtiContext,mp as qtiInteractionElements,of as qtiSubtractMixin,Xt as qtiTransformItem,pd as qtiTransformManifest,Dr as qtiTransformTest,Oy as registerCustomOperator,Un as removeDoubleSlashes,Gt as responseAttributeConverter,Ey as serializePair,Iy as serializePoint,Qa as serializeResponseAttribute,Ht as sessionContext,ot as testContext,jd as ttsContext,Py as unregisterCustomOperator,U as validationMessage};
|
|
9830
9843
|
/*! Bundled license information:
|
|
9831
9844
|
|
|
9832
9845
|
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|
|
@@ -9908,19 +9921,19 @@ lit-html/node/directives/private-async-helpers.js:
|
|
|
9908
9921
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
9909
9922
|
*)
|
|
9910
9923
|
|
|
9911
|
-
lit-html/node/
|
|
9912
|
-
lit-html/node/directives/
|
|
9924
|
+
lit-html/node/directives/if-defined.js:
|
|
9925
|
+
lit-html/node/directives/style-map.js:
|
|
9913
9926
|
(**
|
|
9914
9927
|
* @license
|
|
9915
|
-
* Copyright
|
|
9928
|
+
* Copyright 2018 Google LLC
|
|
9916
9929
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9917
9930
|
*)
|
|
9918
9931
|
|
|
9919
|
-
lit-html/node/
|
|
9920
|
-
lit-html/node/directives/
|
|
9932
|
+
lit-html/node/directive-helpers.js:
|
|
9933
|
+
lit-html/node/directives/ref.js:
|
|
9921
9934
|
(**
|
|
9922
9935
|
* @license
|
|
9923
|
-
* Copyright
|
|
9936
|
+
* Copyright 2020 Google LLC
|
|
9924
9937
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
9925
9938
|
*)
|
|
9926
9939
|
*/
|