@citolab/qti-components 8.1.0 → 8.2.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 +274 -168
- package/dist/base.d.ts +5 -5
- package/dist/base.js +1 -1
- package/dist/{chunk-IXPDMYKH.js → chunk-43XBJ47H.js} +3 -3
- package/dist/{chunk-EKXZI26R.js → chunk-7D3NKAGZ.js} +54 -3
- package/dist/chunk-7D3NKAGZ.js.map +1 -0
- package/dist/{chunk-Q52IJELT.js → chunk-CRLXQZFA.js} +594 -259
- package/dist/chunk-CRLXQZFA.js.map +1 -0
- package/dist/{chunk-TXIB3SKC.js → chunk-LMGJOBJA.js} +3 -3
- package/dist/{chunk-6V3A7NQP.js → chunk-M7K5C522.js} +2 -2
- package/dist/{chunk-CF3DXJWM.js → chunk-OIUK5BFU.js} +22 -6
- package/dist/{chunk-CF3DXJWM.js.map → chunk-OIUK5BFU.js.map} +1 -1
- package/dist/{chunk-MK2I3MQB.js → chunk-OVBG223G.js} +4 -5
- package/dist/{chunk-MK2I3MQB.js.map → chunk-OVBG223G.js.map} +1 -1
- package/dist/{chunk-4XR2JHCP.js → chunk-Q6ZK4LRH.js} +26 -2
- package/dist/chunk-Q6ZK4LRH.js.map +1 -0
- package/dist/chunk-TLTYXWW7.js +7 -0
- package/dist/chunk-TLTYXWW7.js.map +1 -0
- package/dist/{chunk-3IACYIU2.js → chunk-U7YCXDYC.js} +2 -2
- package/dist/{chunk-NZLW6EX7.js → chunk-UC3T3NI3.js} +2 -2
- package/dist/{chunk-6XJUP55A.js → chunk-YLRMOX6C.js} +3 -3
- package/dist/chunk-YLRMOX6C.js.map +1 -0
- package/dist/{computed.types.d-DpKIYO6e.d.ts → computed.types.d-CJarqC6s.d.ts} +12 -0
- package/dist/corrections.d.ts +14 -4
- package/dist/corrections.js +7 -7
- package/dist/elements.d.ts +1 -1
- package/dist/elements.js +3 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +14 -12
- package/dist/interactions.js +3 -3
- package/dist/item.css +81 -0
- package/dist/item.d.ts +1 -1
- package/dist/item.js +4 -4
- package/dist/loader.d.ts +1 -1
- package/dist/processing.d.ts +3 -3
- package/dist/processing.js +2 -2
- package/dist/qti-components-jsx.d.ts +7704 -7127
- package/dist/{qti-condition-expression.d-aMvBvpc6.d.ts → qti-condition-expression.d-CYwXOUb1.d.ts} +1 -1
- package/dist/{qti-expression.d-BietT_8b.d.ts → qti-expression.d-B_-m9emA.d.ts} +11 -1
- package/dist/{qti-feedback.d-DZbad0RN.d.ts → qti-feedback.d-B1EIF-fU.d.ts} +1 -0
- package/dist/{qti-test.d-_YAlhDbt.d.ts → qti-test.d-C6lCEMRB.d.ts} +38 -3
- package/dist/test.d.ts +5 -5
- package/dist/test.js +7 -5
- package/package.json +9 -9
- package/dist/chunk-4XR2JHCP.js.map +0 -1
- package/dist/chunk-6XJUP55A.js.map +0 -1
- package/dist/chunk-EKXZI26R.js.map +0 -1
- package/dist/chunk-IYC7LZV6.js +0 -7
- package/dist/chunk-IYC7LZV6.js.map +0 -1
- package/dist/chunk-Q52IJELT.js.map +0 -1
- /package/dist/{chunk-IXPDMYKH.js.map → chunk-43XBJ47H.js.map} +0 -0
- /package/dist/{chunk-TXIB3SKC.js.map → chunk-LMGJOBJA.js.map} +0 -0
- /package/dist/{chunk-6V3A7NQP.js.map → chunk-M7K5C522.js.map} +0 -0
- /package/dist/{chunk-3IACYIU2.js.map → chunk-U7YCXDYC.js.map} +0 -0
- /package/dist/{chunk-NZLW6EX7.js.map → chunk-UC3T3NI3.js.map} +0 -0
package/cdn/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var Ac=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 Pt=function(n,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},Y=function(n,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!r:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(n):r?r.value:t.get(n)},nr,ro,io,Kr,js,Jr,oo,Re,Zr,se,no,Ic,_c=n=>typeof n=="boolean"?n:n?.capture??!1;var Fs=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let i=_c(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(t);if(o===void 0)o=new Map,i.set(t,o);else if(o.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),o.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let i=_c(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(t);o!==void 0&&(o.delete(e),o.size||i.delete(t))}dispatchEvent(t){let e=[this],r=this.__eventTargetParent;if(t.composed)for(;r;)e.push(r),r=r.__eventTargetParent;else for(;r&&r!==this.__host;)e.push(r),r=r.__eventTargetParent;let i=!1,o=!1,s=0,a=null,c=null,l=null,d=t.stopPropagation,h=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return a??c},...z},srcElement:{get(){return t.target},...z},currentTarget:{get(){return l},...z},eventPhase:{get(){return s},...z},composedPath:{value:()=>e,...z},stopPropagation:{value:()=>{i=!0,d.call(t)},...z},stopImmediatePropagation:{value:()=>{o=!0,h.call(t)},...z}});let g=(u,y,v)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),y.once&&v.delete(u)},m=()=>(l=null,s=0,!t.defaultPrevented),w=e.slice().reverse();a=!this.__host||!t.composed?this:null;let x=u=>{for(c=this;c.__host&&u.includes(c.__host);)c=c.__host};for(let u of w){!a&&(!c||c===u.__host)&&x(w.slice(w.indexOf(u))),l=u,s=u===t.target?2:1;let y=u.__captureEventListeners.get(t.type);if(y){for(let[v,A]of y)if(g(v,A,y),o)return m()}if(i)return m()}let f=t.bubbles?e:[this];c=null;for(let u of f){!a&&(!c||u===c.__host)&&x(f.slice(0,f.indexOf(u)+1)),l=u,s=u===t.target?2:3;let y=u.__eventListeners.get(t.type);if(y){for(let[v,A]of y)if(g(v,A,y),o)return m()}if(i)return m()}return m()}},Bs=Fs;var z={__proto__:null};z.enumerable=!0;Object.freeze(z);var Us=(se=class{constructor(t,e={}){if(nr.set(this,!1),ro.set(this,!1),io.set(this,!1),Kr.set(this,!1),js.set(this,Date.now()),Jr.set(this,!1),oo.set(this,void 0),Re.set(this,void 0),Zr.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:o}=e;Pt(this,nr,!!i,"f"),Pt(this,ro,!!r,"f"),Pt(this,io,!!o,"f"),Pt(this,oo,`${t}`,"f"),Pt(this,Re,null,"f"),Pt(this,Zr,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Pt(this,Kr,!0,"f")}get target(){return Y(this,Re,"f")}get currentTarget(){return Y(this,Re,"f")}get srcElement(){return Y(this,Re,"f")}get type(){return Y(this,oo,"f")}get cancelable(){return Y(this,nr,"f")}get defaultPrevented(){return Y(this,nr,"f")&&Y(this,Kr,"f")}get timeStamp(){return Y(this,js,"f")}composedPath(){return Y(this,Zr,"f")?[Y(this,Re,"f")]:[]}get returnValue(){return!Y(this,nr,"f")||!Y(this,Kr,"f")}get bubbles(){return Y(this,ro,"f")}get composed(){return Y(this,io,"f")}get eventPhase(){return Y(this,Zr,"f")?se.AT_TARGET:se.NONE}get cancelBubble(){return Y(this,Jr,"f")}set cancelBubble(t){t&&Pt(this,Jr,!0,"f")}stopPropagation(){Pt(this,Jr,!0,"f")}get isTrusted(){return!1}},nr=new WeakMap,ro=new WeakMap,io=new WeakMap,Kr=new WeakMap,js=new WeakMap,Jr=new WeakMap,oo=new WeakMap,Re=new WeakMap,Zr=new WeakMap,se.NONE=0,se.CAPTURING_PHASE=1,se.AT_TARGET=2,se.BUBBLING_PHASE=3,se);Object.defineProperties(Us.prototype,{initEvent:z,stopImmediatePropagation:z,preventDefault:z,target:z,currentTarget:z,srcElement:z,type:z,cancelable:z,defaultPrevented:z,timeStamp:z,composedPath:z,returnValue:z,bubbles:z,composed:z,eventPhase:z,cancelBubble:z,stopPropagation:z,isTrusted:z});var Tc=(Ic=class extends Us{constructor(t,e={}){super(t,e),no.set(this,void 0),Pt(this,no,e?.detail??null,"f")}initCustomEvent(t,e,r,i){throw new Error("Method not implemented.")}get detail(){return Y(this,no,"f")}},no=new WeakMap,Ic);Object.defineProperties(Tc.prototype,{detail:z});var Hs=Us,Ws=Tc;var it;var Xu=(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.__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);globalThis.Event??=Hs;globalThis.CustomEvent??=Ws;var Rc=new WeakMap,ti=n=>{let t=Rc.get(n);return t===void 0&&Rc.set(n,t=new Map),t},_h=class extends Bs{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(ti(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(t,e){ti(this).set(t,String(e))}removeAttribute(t){ti(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return ti(this).has(t)}attachShadow(t){let e={host:this};return this.__shadowRootMode=t.mode,t&&t.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new Ac(this);return this.__internals=t,t}getAttribute(t){return ti(this).get(t)??null}};var Th=class extends _h{},Gs=Th;globalThis.litServerRoot??=Object.defineProperty(new Gs,"localName",{get(){return"lit-server-root"}});function Rh(){let n,t;return{promise:new Promise((r,i)=>{n=r,t=i}),resolve:n,reject:t}}var Qs=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}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"),Fc=/'/g,Bc=/"/g,Wc=/^(?:script|style|textarea|title)$/i,ea=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),b=ea(1),di=ea(2),vm=ea(3),Z=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Uc=new WeakMap,Pe=Me.createTreeWalker(Me,129);function Qc(n,t){if(!ta(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Vc!==void 0?Vc.createHTML(t):t}var Gc=(n,t)=>{let e=n.length-1,r=[],i,o=t===2?"<svg>":t===3?"<math>":"",s=si;for(let a=0;a<e;a++){let c=n[a],l,d,h=-1,g=0;for(;g<c.length&&(s.lastIndex=g,d=s.exec(c),d!==null);)g=s.lastIndex,s===si?d[1]==="!--"?s=zc:d[1]!==void 0?s=jc:d[2]!==void 0?(Wc.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=Oe):d[3]!==void 0&&(s=Oe):s===Oe?d[0]===">"?(s=i??si,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,l=d[1],s=d[3]===void 0?Oe:d[3]==='"'?Bc:Fc):s===Bc||s===Fc?s=Oe:s===zc||s===jc?s=si:(s=Oe,i=void 0);let m=s===Oe&&n[a+1].startsWith("/>")?" ":"";o+=s===si?c+jh:h>=0?(r.push(l),c.slice(0,h)+Js+c.slice(h)+Gt+m):c+Gt+(h===-2?a:m)}return[Qc(n,o+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},li=class n{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let o=0,s=0,a=t.length-1,c=this.parts,[l,d]=Gc(t,e);if(this.el=n.createElement(l,r),Pe.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=Pe.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(Js)){let g=d[s++],m=i.getAttribute(h).split(Gt),w=/([.?@])?(.*)/.exec(g);c.push({type:1,index:o,name:w[2],strings:m,ctor:w[1]==="."?ho:w[1]==="?"?po:w[1]==="@"?uo:Ne}),i.removeAttribute(h)}else h.startsWith(Gt)&&(c.push({type:6,index:o}),i.removeAttribute(h));if(Wc.test(i.tagName)){let h=i.textContent.split(Gt),g=h.length-1;if(g>0){i.textContent=co?co.emptyScript:"";for(let m=0;m<g;m++)i.append(h[m],ai()),Pe.nextNode(),c.push({type:2,index:++o});i.append(h[g],ai())}}}else if(i.nodeType===8)if(i.data===Zs)c.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(Gt,h+1))!==-1;)c.push({type:7,index:o}),h+=Gt.length-1}o++}}static createElement(t,e){let r=Me.createElement("template");return r.innerHTML=t,r}};function De(n,t,e=n,r){if(t===Z)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,o=ci(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,e,r)),r!==void 0?(e._$Co??=[])[r]=i:e._$Cl=i),i!==void 0&&(t=De(n,i._$AS(n,t.values),i,r)),t}var lo=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??Me).importNode(e,!0);Pe.currentNode=i;let o=Pe.nextNode(),s=0,a=0,c=r[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new sr(o,o.nextSibling,this,t):c.type===1?l=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(l=new mo(o,this,t)),this._$AV.push(l),c=r[++a]}s!==c?.index&&(o=Pe.nextNode(),s++)}return Pe.currentNode=Me,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},sr=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=De(this,t,e),ci(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==Z&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Hc(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&&ci(this._$AH)?this._$AA.nextSibling.data=t:this.T(Me.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=li.createElement(Qc(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let o=new lo(i,this),s=o.u(this.options);o.p(e),this.T(s),this._$AH=o}}_$AC(t){let e=Uc.get(t.strings);return e===void 0&&Uc.set(t.strings,e=new li(t)),e}k(t){ta(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let o of t)i===e.length?e.push(r=new n(this.O(ai()),this.O(ai()),this,this.options)):r=e[i],r._$AI(o),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=Lc(t).nextSibling;Lc(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Ne=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,o){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(t,e=this,r,i){let o=this.strings,s=!1;if(o===void 0)t=De(this,t,e,0),s=!ci(t)||t!==this._$AH&&t!==Z,s&&(this._$AH=t);else{let a=t,c,l;for(t=o[0],c=0;c<o.length-1;c++)l=De(this,a[r+c],e,c),l===Z&&(l=this._$AH[c]),s||=!ci(l)||l!==this._$AH[c],l===P?t=P:t!==P&&(t+=(l??"")+o[c+1]),this._$AH[c]=l}s&&!i&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},ho=class extends Ne{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},po=class extends Ne{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},uo=class extends Ne{constructor(t,e,r,i,o){super(t,e,r,i,o),this.type=5}_$AI(t,e=this){if((t=De(this,t,e,0)??P)===Z)return;let r=this._$AH,i=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),o&&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)}},mo=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){De(this,t)}},K={M:Js,P:Gt,A:Zs,C:1,L:Gc,R:lo,D:Hc,V:De,I:sr,H:Ne,N:po,U:uo,B:ho,F:mo},Fh=fo.litHtmlPolyfillSupport;Fh?.(li,sr),(fo.litHtmlVersions??=[]).push("3.3.2");var ra=(n,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let o=e?.renderBefore??null;r._$litPart$=i=new sr(t.insertBefore(ai(),o),o,void 0,e??{})}return i._$AI(n),i};var ia=globalThis,C=class extends Qt{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=ra(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Z}};C._$litElement$=!0,C.finalized=!0,ia.litElementHydrateSupport?.({LitElement:C});var Bh=ia.litElementPolyfillSupport;Bh?.({LitElement:C});(ia.litElementVersions??=[]).push("4.2.2");var Uh={attribute:!0,type:String,converter:oi,reflect:!1,hasChanged:ao},Hh=(n=Uh,t,e)=>{let{kind:r,metadata:i}=e,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),r==="setter"&&((n=Object.create(n)).wrapped=!0),o.set(e.name,n),r==="accessor"){let{name:s}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,c,n,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,n,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let c=this[s];t.call(this,a),this.requestUpdate(s,c,n,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(n){return(t,e)=>typeof e=="object"?Hh(n,t,e):((r,i,o)=>{let s=i.hasOwnProperty(o);return i.constructor.createProperty(o,r),s?Object.getOwnPropertyDescriptor(i,o):void 0})(n,t,e)}function _(n){return p({...n,state:!0,attribute:!1})}var ae=(n,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(n,t,e),e);function ar(n,t){return(e,r,i)=>{let o=s=>s.renderRoot?.querySelector(n)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:i??(()=>{let c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return ae(e,r,{get(){let c=s.call(this);return c===void 0&&(c=o(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return ae(e,r,{get(){return o(this)}})}}function Xc(n){return(t,e)=>{let{slot:r,selector:i}=n??{},o="slot"+(r?`[name=${r}]`:":not([name])");return ae(t,e,{get(){let s=this.renderRoot?.querySelector(o),a=s?.assignedElements(n)??[];return i===void 0?a:a.filter(c=>c.matches(i))}})}}var cr=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Yc={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},Mt=class extends C{constructor(){super(...arguments),this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};cr([p({type:String})],Mt.prototype,"category",void 0);cr([p({type:String})],Mt.prototype,"identifier",void 0);cr([p({type:Boolean,converter:Yc})],Mt.prototype,"required",void 0);cr([p({type:Boolean,converter:Yc})],Mt.prototype,"fixed",void 0);cr([p({type:String})],Mt.prototype,"href",void 0);cr([p({type:Object,attribute:!1})],Mt.prototype,"xmlDoc",void 0);var ce=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var lr=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let o=e;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ce(this.context,this.host,this.t,this.subscribe))}};var go=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var oa=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},dr=class extends go{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let o=i.contextTarget??i.composedPath()[0];o!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,o,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let o=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)o.has(s)||(o.add(s),a.dispatchEvent(new ce(this.context,a,s,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new oa(this.context,this.host))}};function B({context:n}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return r.get(this).setValue(i),t.set.call(this,i)},init(i){return r.set(this,new dr(this,{context:n,initialValue:i})),i}};{t.constructor.addInitializer((s=>{r.set(s,new dr(s,{context:n}))}));let i=Object.getOwnPropertyDescriptor(t,e),o;if(i===void 0){let s=new WeakMap;o={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;o={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,o)}}}function T({context:n,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new lr(this,{context:n,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new lr(i,{context:n,callback:o=>{i[r]=o},subscribe:t})}))}}var Kc=[];var sa=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(" "))}},na="custom-state-support-probe";function Wh(n){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(na)||customElements.define(na,class extends HTMLElement{});let t=n.call(document.createElement(na)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var Jc=!1;function Zc(){if(Jc)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let n=HTMLElement.prototype.attachInternals;if(!n)return"modern";let t=Wh(n);return t==="modern"||(Jc=!0,HTMLElement.prototype.attachInternals=function(){let r=n.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new sa(this)}),r}),t}Zc();for(let{tag:n,ctor:t}of Kc)customElements.get(n)||customElements.define(n,t);var le=Symbol("computedItemContext");var F=Symbol("computedContext");var dt=Symbol("configContext");var hr=Symbol("interactionContext");var j=Symbol("item");var tl=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Qh=/^[A-Za-z0-9-]+$/,Gh=n=>typeof n=="string"&&Qh.test(n),Xf=n=>Gh(n)?n:void 0,ht=Symbol("qtiContext");var aa={view:"candidate"},Nt=Symbol("testContext");var ca={items:[],testOutcomeVariables:[]},pt=Symbol("testContext");var R=q`
|
|
1
|
+
var Dc=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 Mt=function(n,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!i:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(n,e):i?i.value=e:t.set(n,e),e},Y=function(n,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!r:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(n):r?r.value:t.get(n)},dr,lo,ho,oi,Ys,ni,po,Me,si,le,uo,Nc;var F={__proto__:null};F.enumerable=!0;Object.freeze(F);var Ks=(le=class{constructor(t,e={}){if(dr.set(this,!1),lo.set(this,!1),ho.set(this,!1),oi.set(this,!1),Ys.set(this,Date.now()),ni.set(this,!1),po.set(this,void 0),Me.set(this,void 0),si.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:o}=e;Mt(this,dr,!!i,"f"),Mt(this,lo,!!r,"f"),Mt(this,ho,!!o,"f"),Mt(this,po,`${t}`,"f"),Mt(this,Me,null,"f"),Mt(this,si,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){Mt(this,oi,!0,"f")}get target(){return Y(this,Me,"f")}get currentTarget(){return Y(this,Me,"f")}get srcElement(){return Y(this,Me,"f")}get type(){return Y(this,po,"f")}get cancelable(){return Y(this,dr,"f")}get defaultPrevented(){return Y(this,dr,"f")&&Y(this,oi,"f")}get timeStamp(){return Y(this,Ys,"f")}composedPath(){return Y(this,si,"f")?[Y(this,Me,"f")]:[]}get returnValue(){return!Y(this,dr,"f")||!Y(this,oi,"f")}get bubbles(){return Y(this,lo,"f")}get composed(){return Y(this,ho,"f")}get eventPhase(){return Y(this,si,"f")?le.AT_TARGET:le.NONE}get cancelBubble(){return Y(this,ni,"f")}set cancelBubble(t){t&&Mt(this,ni,!0,"f")}stopPropagation(){Mt(this,ni,!0,"f")}get isTrusted(){return!1}},dr=new WeakMap,lo=new WeakMap,ho=new WeakMap,oi=new WeakMap,Ys=new WeakMap,ni=new WeakMap,po=new WeakMap,Me=new WeakMap,si=new WeakMap,le.NONE=0,le.CAPTURING_PHASE=1,le.AT_TARGET=2,le.BUBBLING_PHASE=3,le);Object.defineProperties(Ks.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 $c=(Nc=class extends Ks{constructor(t,e={}){super(t,e),uo.set(this,void 0),Mt(this,uo,e?.detail??null,"f")}initCustomEvent(t,e,r,i){throw new Error("Method not implemented.")}get detail(){return Y(this,uo,"f")}},uo=new WeakMap,Nc);Object.defineProperties($c.prototype,{detail:F});var Gt=Ks,Js=$c;var et;var am=(et=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}},et.STYLE_RULE=1,et.CHARSET_RULE=2,et.IMPORT_RULE=3,et.MEDIA_RULE=4,et.FONT_FACE_RULE=5,et.PAGE_RULE=6,et.NAMESPACE_RULE=10,et.KEYFRAMES_RULE=7,et.KEYFRAME_RULE=8,et.SUPPORTS_RULE=12,et.COUNTER_STYLE_RULE=11,et.FONT_FEATURE_VALUES_RULE=14,et.MARGIN_RULE=9,et);globalThis.Event??=Gt;globalThis.CustomEvent??=Js;var ta=Symbol(),Lc=n=>typeof n=="boolean"?n:n?.capture??!1,Xt={__proto__:null};Xt.enumerable=!0;Object.freeze(Xt);var mo=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let i=Lc(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(t);if(o===void 0)o=new Map,i.set(t,o);else if(o.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),o.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let i=Lc(r)?this.__captureEventListeners:this.__eventListeners,o=i.get(t);o!==void 0&&(o.delete(e),o.size||i.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,i=!1,o=Gt.NONE,s=null,a=null,l=null,c=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...Xt},srcElement:{get(){return t.target},...Xt},currentTarget:{get(){return l},...Xt},eventPhase:{get(){return o},...Xt},composedPath:{value:()=>e,...Xt},stopPropagation:{value:()=>{r=!0,c.call(t)},...Xt},stopImmediatePropagation:{value:()=>{i=!0,d.call(t)},...Xt}});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,o=Gt.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let w=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&w(m.slice(m.indexOf(u))),l=u,o=u===t.target?Gt.AT_TARGET:Gt.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[y,v]of g)if(h(y,v,g),i)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&w(x.slice(0,x.indexOf(u)+1)),l=u,o=u===t.target?Gt.AT_TARGET:Gt.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[y,v]of g)if(h(y,v,g),i)return f()}if(r)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,jc,Uh]}};var Vc=new WeakMap,ai=n=>{let t=Vc.get(n);return t===void 0&&Vc.set(n,t=new Map),t},ci=class extends mo{getRootNode(t){return t?.composed?Zs:this.__host?.__shadowRoot??Zs}};var zc=class extends ci{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var jc=new zc,Zs=jc;var Fc=class extends ci{constructor(t){if(super(),t!==ta)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:fo,customElements:ra,document:Zs,Document:zc,Element:Bc,EventTarget:mo,HTMLElement:Uc,Node:ci,ShadowRoot:Hc,window:this,Window:Fc})}};var Bc=class extends ci{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(ai(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){ai(this).set(t,String(e))}removeAttribute(t){ai(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 ai(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new Hc(ta,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 Dc(this);return this.__internals=t,t}getAttribute(t){return ai(this).get(t)??null}};var Uc=class extends Bc{},ea=Uc;var Hc=class extends ci{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 ea,"localName",{get(){return"lit-server-root"}});function Fh(){let n,t;return{promise:new Promise((r,i)=>{n=r,t=i}),resolve:n,reject:t}}var fo=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=Fh(),this.__pendingWhenDefineds.set(t,r)),r.promise}},Bh=fo;var ra=new Bh,Uh=new Fc(ta);var li=globalThis,go=li.ShadowRoot&&(li.ShadyCSS===void 0||li.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ia=Symbol(),Wc=new WeakMap,di=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==ia)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(go&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Wc.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Wc.set(e,t))}return t}toString(){return this.cssText}},Qc=n=>new di(typeof n=="string"?n:n+"",void 0,ia),q=(n,...t)=>{let e=n.length===1?n[0]:t.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new di(e,n,ia)},Gc=(n,t)=>{if(go)n.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=li.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,n.appendChild(r)}},oa=go||li.CSSStyleSheet===void 0?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Qc(e)})(n):n;var{is:Hh,defineProperty:Wh,getOwnPropertyDescriptor:Qh,getOwnPropertyNames:Gh,getOwnPropertySymbols:Xh,getPrototypeOf:Yh}=Object,ui=globalThis;ui.customElements??=ra;var Xc=ui.trustedTypes,Kh=Xc?Xc.emptyScript:"",Jh=ui.reactiveElementPolyfillSupport,hi=(n,t)=>n,pi={toAttribute(n,t){switch(t){case Boolean:n=n?Kh:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},bo=(n,t)=>!Hh(n,t),Yc={attribute:!0,type:String,converter:pi,reflect:!1,useDefault:!1,hasChanged:bo};Symbol.metadata??=Symbol("metadata"),ui.litPropertyMetadata??=new WeakMap;var Yt=class extends(globalThis.HTMLElement??ea){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Yc){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&Wh(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:o}=Qh(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:i,set(s){let a=i?.call(this);o?.call(this,s),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Yc}static _$Ei(){if(this.hasOwnProperty(hi("elementProperties")))return;let t=Yh(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(hi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(hi("properties"))){let e=this.properties,r=[...Gh(e),...Xh(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(oa(i))}else t!==void 0&&e.push(oa(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 Gc(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:pi).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:pi;this._$Em=i;let a=s.fromAttribute(e,o.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(t,e,r,i=!1,o){if(t!==void 0){let s=this.constructor;if(i===!1&&(o=this[t]),r??=s.getPropertyOptions(t),!((r.hasChanged??bo)(o,e)||r.useDefault&&r.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:i,wrapped:o},s){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),o!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r){let{wrapped:s}=o,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,o,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){}};Yt.elementStyles=[],Yt.shadowRootOptions={mode:"open"},Yt[hi("elementProperties")]=new Map,Yt[hi("finalized")]=new Map,Jh?.({ReactiveElement:Yt}),(ui.reactiveElementVersions??=[]).push("2.1.2");var ko=globalThis,Kc=n=>n,yo=ko.trustedTypes,Jc=yo?yo.createPolicy("lit-html",{createHTML:n=>n}):void 0,sa="$lit$",Kt=`lit$${Math.random().toFixed(9).slice(2)}$`,aa="?"+Kt,Zh=`<${aa}>`,$e=ko.document===void 0?{createTreeWalker:()=>({})}:document,fi=()=>$e.createComment(""),gi=n=>n===null||typeof n!="object"&&typeof n!="function",ca=Array.isArray,ol=n=>ca(n)||typeof n?.[Symbol.iterator]=="function",na=`[
|
|
3
|
+
\f\r]`,mi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Zc=/-->/g,tl=/>/g,De=RegExp(`>|${na}(?:([^\\s"'>=/]+)(${na}*=${na}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),el=/'/g,rl=/"/g,nl=/^(?:script|style|textarea|title)$/i,la=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),b=la(1),yi=la(2),zm=la(3),Z=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),il=new WeakMap,Ne=$e.createTreeWalker($e,129);function sl(n,t){if(!ca(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Jc!==void 0?Jc.createHTML(t):t}var al=(n,t)=>{let e=n.length-1,r=[],i,o=t===2?"<svg>":t===3?"<math>":"",s=mi;for(let a=0;a<e;a++){let l=n[a],c,d,h=-1,f=0;for(;f<l.length&&(s.lastIndex=f,d=s.exec(l),d!==null);)f=s.lastIndex,s===mi?d[1]==="!--"?s=Zc:d[1]!==void 0?s=tl:d[2]!==void 0?(nl.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=De):d[3]!==void 0&&(s=De):s===De?d[0]===">"?(s=i??mi,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?De:d[3]==='"'?rl:el):s===rl||s===el?s=De:s===Zc||s===tl?s=mi:(s=De,i=void 0);let m=s===De&&n[a+1].startsWith("/>")?" ":"";o+=s===mi?l+Zh:h>=0?(r.push(c),l.slice(0,h)+sa+l.slice(h)+Kt+m):l+Kt+(h===-2?a:m)}return[sl(n,o+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},bi=class n{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let o=0,s=0,a=t.length-1,l=this.parts,[c,d]=al(t,e);if(this.el=n.createElement(c,r),Ne.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=Ne.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(sa)){let f=d[s++],m=i.getAttribute(h).split(Kt),w=/([.?@])?(.*)/.exec(f);l.push({type:1,index:o,name:w[2],strings:m,ctor:w[1]==="."?wo:w[1]==="?"?xo:w[1]==="@"?qo:Ve}),i.removeAttribute(h)}else h.startsWith(Kt)&&(l.push({type:6,index:o}),i.removeAttribute(h));if(nl.test(i.tagName)){let h=i.textContent.split(Kt),f=h.length-1;if(f>0){i.textContent=yo?yo.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],fi()),Ne.nextNode(),l.push({type:2,index:++o});i.append(h[f],fi())}}}else if(i.nodeType===8)if(i.data===aa)l.push({type:2,index:o});else{let h=-1;for(;(h=i.data.indexOf(Kt,h+1))!==-1;)l.push({type:7,index:o}),h+=Kt.length-1}o++}}static createElement(t,e){let r=$e.createElement("template");return r.innerHTML=t,r}};function Le(n,t,e=n,r){if(t===Z)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,o=gi(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,e,r)),r!==void 0?(e._$Co??=[])[r]=i:e._$Cl=i),i!==void 0&&(t=Le(n,i._$AS(n,t.values),i,r)),t}var vo=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??$e).importNode(e,!0);Ne.currentNode=i;let o=Ne.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new hr(o,o.nextSibling,this,t):l.type===1?c=new l.ctor(o,l.name,l.strings,this,t):l.type===6&&(c=new Co(o,this,t)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=Ne.nextNode(),s++)}return Ne.currentNode=$e,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},hr=class n{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Le(this,t,e),gi(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==Z&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ol(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&&gi(this._$AH)?this._$AA.nextSibling.data=t:this.T($e.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=bi.createElement(sl(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let o=new vo(i,this),s=o.u(this.options);o.p(e),this.T(s),this._$AH=o}}_$AC(t){let e=il.get(t.strings);return e===void 0&&il.set(t.strings,e=new bi(t)),e}k(t){ca(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let o of t)i===e.length?e.push(r=new n(this.O(fi()),this.O(fi()),this,this.options)):r=e[i],r._$AI(o),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=Kc(t).nextSibling;Kc(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},Ve=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,o){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(t,e=this,r,i){let o=this.strings,s=!1;if(o===void 0)t=Le(this,t,e,0),s=!gi(t)||t!==this._$AH&&t!==Z,s&&(this._$AH=t);else{let a=t,l,c;for(t=o[0],l=0;l<o.length-1;l++)c=Le(this,a[r+l],e,l),c===Z&&(c=this._$AH[l]),s||=!gi(c)||c!==this._$AH[l],c===P?t=P:t!==P&&(t+=(c??"")+o[l+1]),this._$AH[l]=c}s&&!i&&this.j(t)}j(t){t===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},wo=class extends Ve{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},xo=class extends Ve{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},qo=class extends Ve{constructor(t,e,r,i,o){super(t,e,r,i,o),this.type=5}_$AI(t,e=this){if((t=Le(this,t,e,0)??P)===Z)return;let r=this._$AH,i=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),o&&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)}},Co=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){Le(this,t)}},K={M:sa,P:Kt,A:aa,C:1,L:al,R:vo,D:ol,V:Le,I:hr,H:Ve,N:xo,U:qo,B:wo,F:Co},tp=ko.litHtmlPolyfillSupport;tp?.(bi,hr),(ko.litHtmlVersions??=[]).push("3.3.3");var da=(n,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let o=e?.renderBefore??null;r._$litPart$=i=new hr(t.insertBefore(fi(),o),o,void 0,e??{})}return i._$AI(n),i};var ha=globalThis,C=class extends Yt{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=da(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Z}};C._$litElement$=!0,C.finalized=!0,ha.litElementHydrateSupport?.({LitElement:C});var ep=ha.litElementPolyfillSupport;ep?.({LitElement:C});(ha.litElementVersions??=[]).push("4.2.2");var rp={attribute:!0,type:String,converter:pi,reflect:!1,hasChanged:bo},ip=(n=rp,t,e)=>{let{kind:r,metadata:i}=e,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),r==="setter"&&((n=Object.create(n)).wrapped=!0),o.set(e.name,n),r==="accessor"){let{name:s}=e;return{set(a){let l=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,l,n,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,n,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let l=this[s];t.call(this,a),this.requestUpdate(s,l,n,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(n){return(t,e)=>typeof e=="object"?ip(n,t,e):((r,i,o)=>{let s=i.hasOwnProperty(o);return i.constructor.createProperty(o,r),s?Object.getOwnPropertyDescriptor(i,o):void 0})(n,t,e)}function _(n){return p({...n,state:!0,attribute:!1})}var de=(n,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(n,t,e),e);function pr(n,t){return(e,r,i)=>{let o=s=>s.renderRoot?.querySelector(n)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(c){this[l]=c}}})();return de(e,r,{get(){let l=s.call(this);return l===void 0&&(l=o(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return de(e,r,{get(){return o(this)}})}}function cl(n){return(t,e)=>{let{slot:r,selector:i}=n??{},o="slot"+(r?`[name=${r}]`:":not([name])");return de(t,e,{get(){let s=this.renderRoot?.querySelector(o),a=s?.assignedElements(n)??[];return i===void 0?a:a.filter(l=>l.matches(i))}})}}var ur=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ll={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},Dt=class extends C{constructor(){super(...arguments),this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};ur([p({type:String})],Dt.prototype,"category",void 0);ur([p({type:String})],Dt.prototype,"identifier",void 0);ur([p({type:Boolean,converter:ll})],Dt.prototype,"required",void 0);ur([p({type:Boolean,converter:ll})],Dt.prototype,"fixed",void 0);ur([p({type:String})],Dt.prototype,"href",void 0);ur([p({type:Object,attribute:!1})],Dt.prototype,"xmlDoc",void 0);var he=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var mr=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let o=e;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new he(this.context,this.host,this.t,this.subscribe))}};var Eo=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var pa=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},fr=class extends Eo{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let o=i.contextTarget??i.composedPath()[0];o!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,o,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let o=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)o.has(s)||(o.add(s),a.dispatchEvent(new he(this.context,a,s,!0)));i.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new pa(this.context,this.host))}};function B({context:n}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return r.get(this).setValue(i),t.set.call(this,i)},init(i){return r.set(this,new fr(this,{context:n,initialValue:i})),i}};{t.constructor.addInitializer((s=>{r.set(s,new fr(s,{context:n}))}));let i=Object.getOwnPropertyDescriptor(t,e),o;if(i===void 0){let s=new WeakMap;o={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;o={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,o)}}}function T({context:n,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new mr(this,{context:n,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new mr(i,{context:n,callback:o=>{i[r]=o},subscribe:t})}))}}var dl=[];var ma=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(" "))}},ua="custom-state-support-probe";function op(n){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(ua)||customElements.define(ua,class extends HTMLElement{});let t=n.call(document.createElement(ua)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var hl=!1;function pl(){if(hl)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let n=HTMLElement.prototype.attachInternals;if(!n)return"modern";let t=op(n);return t==="modern"||(hl=!0,HTMLElement.prototype.attachInternals=function(){let r=n.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new ma(this)}),r}),t}pl();for(let{tag:n,ctor:t}of dl)customElements.get(n)||customElements.define(n,t);var pe=Symbol("computedItemContext");var z=Symbol("computedContext");var ht=Symbol("configContext");var gr=Symbol("interactionContext");var j=Symbol("item");var ul=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var np=/^[A-Za-z0-9-]+$/,sp=n=>typeof n=="string"&&np.test(n),gg=n=>sp(n)?n:void 0,pt=Symbol("qtiContext");var fa={view:"candidate"},$t=Symbol("testContext");var ga={items:[],testOutcomeVariables:[]},ot=Symbol("testContext");var O=q`
|
|
5
5
|
:host {
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
}
|
|
@@ -11,7 +11,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
11
11
|
*::after {
|
|
12
12
|
box-sizing: inherit;
|
|
13
13
|
}
|
|
14
|
-
`;var
|
|
14
|
+
`;var Lt=q`
|
|
15
15
|
[part~='drop'] {
|
|
16
16
|
/*
|
|
17
17
|
* The one deliberate opt-out from the border-box reset.
|
|
@@ -55,20 +55,20 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
55
55
|
[part~='message'] {
|
|
56
56
|
display: none;
|
|
57
57
|
}
|
|
58
|
-
`;var
|
|
58
|
+
`;var ze=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},D=class extends C{#t;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.#t||(this.#t=!0,console.log("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),r.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",r,i){let o=r??this;this._internals.setValidity(t?{}:{customError:!0},e,o),i?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.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=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._internals=this.attachInternals()}firstUpdated(t){}};ze([T({context:j,subscribe:!0})],D.prototype,"_context",void 0);ze([T({context:ht,subscribe:!0})],D.prototype,"configContext",void 0);ze([B({context:gr})],D.prototype,"_interactionContext",void 0);ze([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);ze([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);ze([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);ze([p({type:String})],D.prototype,"name",void 0);var br=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(i=>i.innerHTML.trim());return r.length>1||t==="multiple"||t==="ordered"?r:r[0]}};var So=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},A=class extends C{constructor(){super(...arguments),this.getVariables=()=>Array.from(this.children).map(t=>{switch(console.debug("getVariables",t.tagName.toLowerCase()),t.tagName.toLowerCase()){case"qti-base-value":return{baseType:t.getAttribute("base-type"),value:t.textContent.trim(),cardinality:"single"};case"qti-variable":{let e=t.getAttribute("identifier")||"";return e==="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(e)}case"qti-multiple":{let r=t.getResult();return console.debug("values",r),r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(i=>i.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let r=t.getResult();return r?.length>0?{identifier:"",baseType:r[0].baseType,value:r.map(i=>i.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let r=t.getResult();return r?.length>0?r:null}case"qti-correct":{let e=t.getAttribute("identifier")||"",r=this.context?.variables?.find(i=>i.identifier===e)||null;return{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}}default:{try{return{baseType:"integer",value:t.getResult()?.toString()||null,cardinality:"single"}}catch{console.warn("default not sufficient")}return null}}}).flatMap(t=>Array.isArray(t)?t:[t]).filter(t=>t!==null)}static{this.styles=q`
|
|
59
59
|
slot {
|
|
60
60
|
display: none;
|
|
61
61
|
}
|
|
62
62
|
`}render(){return b`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
63
|
-
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};
|
|
63
|
+
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??null}};So([_()],A.prototype,"result",void 0);So([T({context:j,subscribe:!0}),_()],A.prototype,"context",void 0);So([T({context:pt,subscribe:!0}),_()],A.prototype,"qtiContext",void 0);So([T({context:ot,subscribe:!0}),_()],A.prototype,"_testContext",void 0);var ut=class extends A{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var ap=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),qt=n=>{if(typeof n=="string")return n;let t=ap();return t==="."?n.toLocaleString():n.toString().replace(".","").replace(t,".")};function ba(n){return n==null}function Ao(n){return n.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var yr=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},nt=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(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!ba(this.identifier)&&!ba(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(i=>i.active)?.sections.flatMap(i=>i.items).find(i=>i.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(i=>i.identifier==="numAttempts")?.value)||0)<e}};yr([p({type:String,attribute:"show-hide"})],nt.prototype,"showHide",void 0);yr([p({type:String,attribute:"outcome-identifier"})],nt.prototype,"outcomeIdentifier",void 0);yr([p({type:String})],nt.prototype,"identifier",void 0);yr([p({type:String,attribute:!1})],nt.prototype,"showStatus",void 0);yr([T({context:j,subscribe:!0}),_()],nt.prototype,"_context",void 0);yr([T({context:z,subscribe:!0}),_()],nt.prototype,"_computedContext",void 0);function ya(n){if(n==null)return null;if(!n.includes(",")){let e=n.trim();return e.length>0?e:null}let t=n.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function va(n){if(n==null)return null;if(Array.isArray(n)){let e=n.map(r=>r.trim()).filter(r=>r.length>0);return e.length>0?e.join(","):null}let t=n.trim();return t.length>0?t:null}function*tb(n){if(n!=null){if(Array.isArray(n)){for(let t of n){let e=t.trim();e&&(yield e)}return}if(!n.includes(",")){let t=n.trim();t&&(yield t);return}for(let t of n.split(",")){let e=t.trim();e&&(yield e)}}}function eb(n){let[t,e,...r]=n.trim().split(/\s+/);if(!t||!e||r.length>0)throw new Error(`malformed directed-pair value: "${n}" (expected "source target")`);return{source:t,target:e}}function rb(n,t){return`${n} ${t}`}function ib(n){let[t,e,...r]=n.trim().split(/\s+/),i=Number(t),o=Number(e);if(!Number.isFinite(i)||!Number.isFinite(o)||r.length>0)throw new Error(`malformed point value: "${n}" (expected "x y" numeric coords)`);return{x:i,y:o}}function ob(n,t){return`${n} ${t}`}function Vt(n){let{emptyAs:t}=n,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=ya(r);return i===null?t:i},toAttribute:r=>e(r)?null:va(r)}}var ml=class extends C{};var J=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,o]=t.split(" ").map(Number),[s,...a]=e.split(","),l=a.map(Number);switch(s.toLowerCase()){case"circle":case"default":{let[c,d,h]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-c)**2+(o-d)**2)<=h}case"rect":{let[c,d,h,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=c&&i<=h&&o>=d&&o<=f}case"ellipse":{let[c,d,h,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-c)**2/h**2,w=(o-d)**2/f**2;return m+w<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let c=[];for(let d=0;d<l.length;d+=2)c.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:i,y:o},c)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){let s=e[i].x,a=e[i].y,l=e[o].x,c=e[o].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 i=parseInt(t,10),o=parseInt(e,10);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),o=parseFloat(e);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" ").sort(),o=e.split(" ").sort();if(i.length===2&&o.length===2)return r==="pair"&&(i.sort(),o.sort()),i.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var ue=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},wa={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},mt=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>`}};ue([p({type:String})],mt.prototype,"identifier",void 0);ue([p({type:String})],mt.prototype,"required",void 0);ue([p({type:Boolean,converter:wa})],mt.prototype,"fixed",void 0);ue([p({type:Boolean,converter:wa})],mt.prototype,"visible",void 0);ue([p({type:Boolean,converter:wa,attribute:"keep-together"})],mt.prototype,"keepTogether",void 0);ue([p({type:String,attribute:"navigation-mode"})],mt.prototype,"navigationMode",void 0);ue([p({type:String,attribute:"submission-mode"})],mt.prototype,"submissionMode",void 0);ue([T({context:ot,subscribe:!0})],mt.prototype,"_testContext",void 0);var xa=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},je=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>`}};xa([p({type:String})],je.prototype,"identifier",void 0);xa([p({type:String})],je.prototype,"title",null);xa([T({context:ot,subscribe:!0})],je.prototype,"_testContext",void 0);var Fe=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},vr={fromAttribute(n){return n==="true"},toAttribute(n){return n?"true":"false"}},Ct=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>`}};Fe([p({type:Number,attribute:"max-attempts"})],Ct.prototype,"maxAttempts",void 0);Fe([p({type:Boolean,converter:vr,attribute:"show-feedback"})],Ct.prototype,"showFeedback",void 0);Fe([p({type:Boolean,converter:vr,attribute:"allow-review"})],Ct.prototype,"allowReview",void 0);Fe([p({type:Boolean,converter:vr,attribute:"show-solution"})],Ct.prototype,"showSolution",void 0);Fe([p({type:Boolean,converter:vr,attribute:"allow-comment"})],Ct.prototype,"allowComment",void 0);Fe([p({type:Boolean,converter:vr,attribute:"allow-skipping"})],Ct.prototype,"allowSkipping",void 0);Fe([p({type:Boolean,converter:vr,attribute:"validate-responses"})],Ct.prototype,"validateResponses",void 0);var Io=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 fa,e=[...this.children];t.process(e)}},fa=class{process(t){for(let e of t)e.process()}};function $(n,t){let e={waitUntilFirstUpdate:!1,...t};return(r,i)=>{let{update:o}=r,s=Array.isArray(n)?n:[n];r.update=function(a){s.forEach(c=>{let l=c;if(a.has(l)){let d=a.get(l),h=this[l];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,h)}}),o.call(this,a)}}}var ur={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ct=n=>(...t)=>({_$litDirective$:n,values:t}),he=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:Yh}=K,rl=n=>n,ol=n=>n===null||typeof n!="object"&&typeof n!="function";var nl=n=>n.strings===void 0,il=()=>document.createComment(""),mr=(n,t,e)=>{let r=n._$AA.parentNode,i=t===void 0?n._$AB:t._$AA;if(e===void 0){let o=r.insertBefore(il(),i),s=r.insertBefore(il(),i);e=new Yh(o,s,n,n.options)}else{let o=e._$AB.nextSibling,s=e._$AM,a=s!==n;if(a){let c;e._$AQ?.(n),e._$AM=n,e._$AP!==void 0&&(c=n._$AU)!==s._$AU&&e._$AP(c)}if(o!==i||a){let c=e._$AA;for(;c!==o;){let l=rl(c).nextSibling;rl(r).insertBefore(c,i),c=l}}}return e},pe=(n,t,e=n)=>(n._$AI(t,e),n),Kh={},sl=(n,t=Kh)=>n._$AH=t,al=n=>n._$AH,vo=n=>{n._$AR(),n._$AA.remove()};var pi=(n,t)=>{let e=n._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),pi(r,t);return!0},wo=n=>{let t,e;do{if((t=n._$AM)===void 0)break;e=t._$AN,e.delete(n),n=t}while(e?.size===0)},cl=n=>{for(let t;t=n._$AM;n=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(n))break;e.add(n),tp(t)}};function Jh(n){this._$AN!==void 0?(wo(this),this._$AM=n,cl(this)):this._$AM=n}function Zh(n,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let o=e;o<r.length;o++)pi(r[o],!1),wo(r[o]);else r!=null&&(pi(r,!1),wo(r));else pi(this,n)}var tp=n=>{n.type==ur.CHILD&&(n._$AP??=Zh,n._$AQ??=Jh)},ue=class extends he{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),cl(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(pi(this,t),wo(this))}setValue(t){if(nl(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 ga=class extends ue{constructor(){super(...arguments),this.prevData={}}render(t){return P}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},P}apply(t){let e=this.#t(t),{prevData:r,element:i}=this;for(let o in e){let s=e[o];s!==r[o]&&(s===!0?i.setAttribute(o,""):s===!1?i.removeAttribute(o):s!=null?i.setAttribute(o,String(s)):i.removeAttribute(o))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let i=t?this.#t(t):{};for(let o in e)(!i||!(o in i))&&r.removeAttribute(o)}#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)))}},Gb=Ct(ga);var Xt=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},et=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:tl},this.#r={...this._context,variables:this._context.variables},this.#i=[],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.#i.push(e),(Number(this._context.variables.find(i=>i.identifier==="numAttempts")?.value)||0)>0&&e.checkShowFeedback(e.outcomeIdentifier)},this.#c=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.#l=t=>{t.stopImmediatePropagation();let{outcomeIdentifier:e,value:r}=t.detail;this.updateOutcomeVariable(e,r),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.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(i=>i.identifier===e.identifier);return r?{...e,...r,interpolationTable:e.interpolationTable}:e})},this._context.variables.forEach(e=>{if(e.type==="response"){let r=this.interactionElements.find(i=>i.responseIdentifier===e.identifier);r&&(r.response=e.value)}}),this.variables.forEach(e=>{e.type==="outcome"&&this.#i.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;#i;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(o=>o.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#n(),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()}#n(){this.addEventListener("qti-register-variable",this.#s),this.addEventListener("qti-register-feedback",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#h),this.addEventListener("qti-set-outcome-value",this.#l),this.addEventListener("qti-set-template-value",this.#u),this.addEventListener("qti-set-correct-response",this.#d),this.addEventListener("qti-interaction-response",this.#p)}#o(){this.removeEventListener("qti-register-variable",this.#s),this.removeEventListener("qti-register-feedback",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#h),this.removeEventListener("qti-set-outcome-value",this.#l),this.removeEventListener("qti-set-template-value",this.#u),this.removeEventListener("qti-set-correct-response",this.#d),this.removeEventListener("qti-interaction-response",this.#p)}#s;#a;#c;#h;#l;#u;#d;#p;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(o=>o.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#f();let r=this.querySelector("qti-response-processing"),i=!!(r&&typeof r.process=="function");return i&&r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#b()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),i}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.#b())}updateTemplateVariable(t,e){let r=this._context.variables.find(o=>o.identifier===t&&o.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==t?o:{...o,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==t?o:{...o,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){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(i=>i.identifier!==t?i:{...i,value:r.cardinality==="single"||Array.isArray(e)?e:[e]})},this.#i.forEach(i=>i.checkShowFeedback(t)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(i=>i.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()}#b(){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 i=("defaultValue"in t?t.defaultValue:null)??null;return i==null&&(t.baseType==="integer"||t.baseType==="float")&&(i="0"),{...t,value:i}})}}};Xt([p({type:String})],et.prototype,"identifier",void 0);Xt([p({type:String})],et.prototype,"adaptive",void 0);Xt([p({type:String})],et.prototype,"timeDependent",void 0);Xt([p({type:String})],et.prototype,"title",null);Xt([p({type:Boolean})],et.prototype,"disabled",void 0);Xt([$("disabled",{waitUntilFirstUpdate:!0})],et.prototype,"_handleDisabledChange",void 0);Xt([p({type:Boolean})],et.prototype,"readonly",void 0);Xt([$("readonly",{waitUntilFirstUpdate:!0})],et.prototype,"_handleReadonlyChange",void 0);Xt([B({context:j})],et.prototype,"_context",void 0);function ll(n){n.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 dl(n,t,e,r="qti-portable-custom-interaction"){let i=[],o=n.querySelectorAll(r);if(o.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(o)){l.setAttribute("data-base-url",t);let d=l.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,l.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=l.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await c();let g=h.getAttribute("primary-configuration");if(g)try{let m=await e(t,`/${g}`),w=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of w){let f=x.getAttribute("id");if(f&&m.paths&&m.paths[f]){let u=m.paths[f],y=Array.isArray(u)?u[0]:u;if(x.setAttribute("primary-path",y),a&&a.paths&&a.paths[f]){let v=a.paths[f];Array.isArray(v)?x.setAttribute("fallback-path",v[0]):x.setAttribute("fallback-path",v)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let u=n.createElement("qti-interaction-module");u.setAttribute("id",x);let y=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(u.setAttribute("primary-path",y),a&&a.paths&&a.paths[x]){let v=a.paths[x];Array.isArray(v)?u.setAttribute("fallback-path",v[0]):u.setAttribute("fallback-path",v)}h.appendChild(u)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${g}`,m)}}else if(await c(),s){l.querySelector("qti-interaction-modules")===null?(h=n.createElement("qti-interaction-modules"),l.appendChild(h)):h=l.querySelector("qti-interaction-modules");for(let g in s.paths){let m=s.paths[g],w="";a&&a.paths&&a.paths[g]&&(w=a.paths[g]);let x=Array.isArray(m)?m:[m],f=Array.isArray(w)?w:[w],u=x.map((y,v)=>{let A=f.length>v?f[v]:"";return{primaryPath:y,fallbackPath:A}});for(let y of f)u.some(v=>v.fallbackPath===y)||u.push({primaryPath:x.length>0?x[0]:y,fallbackPath:y});for(let y of u){let v=n.createElement("qti-interaction-module");y.fallbackPath&&v.setAttribute("fallback-path",y.fallbackPath),v.setAttribute("id",g),v.setAttribute("primary-path",y.primaryPath),h&&h.appendChild(v)}}}}}function hl(n,t,e){Array.from(n.getElementsByTagName("*")).filter(o=>o.localName===t||o.localName?.toLowerCase()===t.toLowerCase()).forEach(o=>{let s=`${t}-${e}`,a=ul(o,s);o.replaceWith(a)})}function pl(n,t){n.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let o=i.slice(`${t}:`.length),s=`${e.nodeName}-${o}`,a=ul(e,s);e.replaceWith(a)}})})}function ul(n,t){let e=n.ownerDocument.createElement(t);for(let r of n.attributes)e.setAttribute(r.name,r.value);for(;n.firstChild;)e.appendChild(n.firstChild);return e}function ml(n,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let i of e)n.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var ba=class n{#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=rp(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new n(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 n(e)}static fromSeedKey(t){let e=new n(new Uint8Array);return e.#t=ep(`${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 xo(n){return ba.fromSeedKey(n)}function ep(n){let t=1779033703^n.length;for(let e=0;e<n.length;e++)t=Math.imul(t^n.charCodeAt(e),3432918353),t=t<<13|t>>>19;return fl(t)}function rp(n){let t=1779033703^n.length;for(let e=0;e<n.length;e++)t=Math.imul(t^n[e],3432918353),t=t<<13|t>>>19;return fl(t)}function fl(n){let t=Math.imul(n^n>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var ip=n=>typeof n=="function"?n():n.random();function qo(n,t){let e=n.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let o=Math.floor(ip(t)*(i+1));[e[i],e[o]]=[e[o],e[i]]}let r=0;return n.map(i=>i.fixed?i:e[r++])}function op(n){switch(n){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 ya(n,t){let e=n.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,o=n.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let c=a.getAttribute("response-identifier")??`${s}`;s++;let l=op(a.tagName.toLowerCase()),d=Array.isArray(l)?l:[l],h=!1,g=0;for(let m of d){if(!m)continue;let w=i?xo(`${t}:${o}:${c}:${g}`):Math.random;g++;let x=Array.from(a.querySelectorAll(m)).filter(v=>v.parentElement!==null);if(x.filter(v=>v.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let f=x[0].parentElement;if(!f||x.some(v=>v.parentElement!==f)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let u=x[x.length-1].nextSibling,y=qo(x.map(v=>({element:v,fixed:v.getAttribute("fixed")==="true"})),w);for(let v of x)v.remove();for(let{element:v}of y)f.insertBefore(v,u);h=!0}h&&a.removeAttribute("shuffle")}}function gl(n){n.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var bl=!1;function Co(n,t){bl||(bl=!0,console.warn(`[${n}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function fr(n,t){return fetch(n,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>new DOMParser().parseFromString(e,"text/xml")).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function gr(n){return new DOMParser().parseFromString(n,"text/xml")}function yl(n,t,e){if(n.nodeType===Node.ELEMENT_NODE){let r=n,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):i=t.createElementNS(r.namespaceURI,r.tagName);for(let o=0;o<r.attributes.length;o++){let s=r.attributes[o];i.setAttribute(s.localName,s.value)}for(let o=0;o<r.childNodes.length;o++)i.appendChild(yl(r.childNodes[o],t,e));return i}return n.cloneNode(!1)}function br(n,t){let e=document.createDocumentFragment();for(let r=0;r<n.childNodes.length;r++)e.appendChild(yl(n.childNodes[r],document,t));return e}function yr(n,t){t.endsWith("/")||(t+="/"),n.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let o=r.getAttribute(i)?.trim();if(o&&!/^(data:|https?:|blob:)/.test(o)){let s=t+encodeURI(o);r.setAttribute(i,s)}}})}var Vt=()=>{let n,t="",e={load(r,i){return t=r,fr(r,i).then(o=>(n=o,e))},parse(r){return n=gr(r),t="",e},path:r=>(yr(n,r),t=null,e),fn(r){return r(n),e},pciHooks(r){return ml(n,r),e},async configurePci(r,i,o="qti-portable-custom-interaction"){return await dl(n,r,i,o),e},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let o=t||"default-item-seed";return Co("qtiTransformItem",o),ya(n,o),e}return ya(n,i),e},extendElementName:(r,i)=>(hl(n,r,i),e),extendElementsWithClass:(r="extend")=>(pl(n,r),e),customInteraction(r,i){let o=n.querySelector("qti-custom-interaction"),s=o.querySelector("object");return o.setAttribute("data-base-ref",r),o.setAttribute("data-base-item",r+i),o.setAttribute("data",s.getAttribute("data")),o.setAttribute("width",s.getAttribute("width")),o.setAttribute("height",s.getAttribute("height")),o.removeChild(s),e},convertCDATAtoComment(){return ll(n),e},stripStyleSheets(){return gl(n),e},html(){return t!==null&&yr(n,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(br(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(r){return t!==null&&yr(n,t.substring(0,t.lastIndexOf("/"))),br(n,r)},xmlDoc(){return n}};return e};var vl=()=>{let n,t={async load(e,r){return n=await fr(e,r),t},parse(e){n=gr(e)},assessmentTest(){let e=n.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function wl(n){let t=[];return n.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),o=e.getAttribute("category");t.push({identifier:r,href:i,category:o})}),t}var ko=(n,...t)=>t.includes(n.localName)||t.includes(n.localName?.toLowerCase?.()),xl=n=>ko(n,"qti-assessment-item-ref","assessmentitemref"),mi=n=>ko(n,"qti-assessment-section","assessmentsection"),ui=(n,...t)=>t.some(e=>{let r=(n.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),np=(n,...t)=>t.some(e=>{let r=(n.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),va=n=>ko(n,"qti-ordering","ordering"),sp=n=>ko(n,"qti-selection","selection"),ap=n=>Array.from(n.children).filter(t=>va(t)&&ui(t,"shuffle")),cp=(n,t)=>xo(`${n}:${t}`);function lp(n){let t=[],e=[],r=i=>{for(let o of Array.from(i.children))xl(o)?t.push(o):mi(o)?r(o):!va(o)&&!sp(o)&&e.push(o.localName)};return r(n),{itemRefs:t,dropped:e}}function dp(n,t){if(t.length===0)return;let e=n.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function ql(n,t){for(let c of Array.from(n.children))mi(c)&&ql(c,t);let e=ap(n);if(e.length===0)return;let r=[],i=[];for(let c of Array.from(n.children))if(xl(c))r.push({nodes:[c],fixed:ui(c,"fixed")}),i.push(c);else if(mi(c)){let{itemRefs:l,dropped:d}=lp(c);if(dp(c,d),np(c,"keep-together","keeptogether"))for(let h of l)r.push({nodes:[h],fixed:ui(h,"fixed")});else l.length>0&&r.push({nodes:l,fixed:ui(c,"fixed")});i.push(c)}let o=i.length>0?i[i.length-1].nextSibling:null,s=n.getAttribute("identifier")??"",a=qo(r,cp(t,s));for(let c of i)c.remove();for(let c of a)for(let l of c.nodes)n.insertBefore(l,o);for(let c of e)c.remove()}function Cl(n){return Array.from(n.getElementsByTagName("*")).some(t=>va(t)&&ui(t,"shuffle"))}function wa(n,t){let e=Array.from(n.getElementsByTagName("*")).filter(r=>mi(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&mi(i)||ql(r,t)}}var vr=()=>{let n,t="",e={async load(r,i){return n=await fr(r,i),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return n=gr(r),t="",e},path:r=>(yr(n,r),e),fn(r){return r(n),e},shuffleOrdering(r){if(!Cl(n))return e;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let o=t||"default-test-seed";return Co("qtiTransformTest",o),wa(n,o),e}return wa(n,i),e},items(){return wl(n)},html(){return new XMLSerializer().serializeToString(br(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(r){return br(n,r)},xmlDoc(){return n}};return e};var kl=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},xa=class n extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(n.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},wr=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 xa(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 Vt().load(this.href).then(r=>r.htmlDoc());if(e){let r=e.querySelectorAll("qti-stimulus-body, qti-stylesheet");t.innerHTML="",t.append(...r)}}};kl([p({type:String})],wr.prototype,"identifier",void 0);kl([p({type:String})],wr.prototype,"href",void 0);var Eo=class extends C{};var hp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},fi=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(i=>i.type==="template");for(let i of e){let o=i;o.mathVariable!==!0||o.value===null||o.value===void 0||t.set(o.identifier,this.#e(o.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let o=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(o);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",o);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",o),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};hp([T({context:j,subscribe:!0}),_()],fi.prototype,"context",void 0);var El=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},xr=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 qa,e=[...this.children];t.process(e)}},qa=class{process(t){for(let e of t)e.process()}};function $(n,t){let e={waitUntilFirstUpdate:!1,...t};return(r,i)=>{let{update:o}=r,s=Array.isArray(n)?n:[n];r.update=function(a){s.forEach(l=>{let c=l;if(a.has(c)){let d=a.get(c),h=this[c];d!==h&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,h)}}),o.call(this,a)}}}var wr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},kt=n=>(...t)=>({_$litDirective$:n,values:t}),me=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:cp}=K,fl=n=>n,bl=n=>n===null||typeof n!="object"&&typeof n!="function";var yl=n=>n.strings===void 0,gl=()=>document.createComment(""),xr=(n,t,e)=>{let r=n._$AA.parentNode,i=t===void 0?n._$AB:t._$AA;if(e===void 0){let o=r.insertBefore(gl(),i),s=r.insertBefore(gl(),i);e=new cp(o,s,n,n.options)}else{let o=e._$AB.nextSibling,s=e._$AM,a=s!==n;if(a){let l;e._$AQ?.(n),e._$AM=n,e._$AP!==void 0&&(l=n._$AU)!==s._$AU&&e._$AP(l)}if(o!==i||a){let l=e._$AA;for(;l!==o;){let c=fl(l).nextSibling;fl(r).insertBefore(l,i),l=c}}}return e},fe=(n,t,e=n)=>(n._$AI(t,e),n),lp={},vl=(n,t=lp)=>n._$AH=t,wl=n=>n._$AH,_o=n=>{n._$AR(),n._$AA.remove()};var vi=(n,t)=>{let e=n._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),vi(r,t);return!0},To=n=>{let t,e;do{if((t=n._$AM)===void 0)break;e=t._$AN,e.delete(n),n=t}while(e?.size===0)},xl=n=>{for(let t;t=n._$AM;n=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(n))break;e.add(n),pp(t)}};function dp(n){this._$AN!==void 0?(To(this),this._$AM=n,xl(this)):this._$AM=n}function hp(n,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let o=e;o<r.length;o++)vi(r[o],!1),To(r[o]);else r!=null&&(vi(r,!1),To(r));else vi(this,n)}var pp=n=>{n.type==wr.CHILD&&(n._$AP??=hp,n._$AQ??=dp)},ge=class extends me{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),xl(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(vi(this,t),To(this))}setValue(t){if(yl(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 Ca=class extends ge{constructor(){super(...arguments),this.prevData={}}render(t){return P}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},P}apply(t){let e=this.#t(t),{prevData:r,element:i}=this;for(let o in e){let s=e[o];s!==r[o]&&(s===!0?i.setAttribute(o,""):s===!1?i.removeAttribute(o):s!=null?i.setAttribute(o,String(s)):i.removeAttribute(o))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let i=t?this.#t(t):{};for(let o in e)(!i||!(o in i))&&r.removeAttribute(o)}#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)))}},wy=kt(Ca);var Jt=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},rt=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:ul},this.#r={...this._context,variables:this._context.variables},this.#i=[],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.#i.push(e),(Number(this._context.variables.find(i=>i.identifier==="numAttempts")?.value)||0)>0&&e.checkShowFeedback(e.outcomeIdentifier)},this.#c=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.#l=t=>{t.stopImmediatePropagation();let{outcomeIdentifier:e,value:r}=t.detail;this.updateOutcomeVariable(e,r),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#d=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.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(i=>i.identifier===e.identifier);return r?{...e,...r,interpolationTable:e.interpolationTable}:e})},this._context.variables.forEach(e=>{if(e.type==="response"){let r=this.interactionElements.find(i=>i.responseIdentifier===e.identifier);r&&(r.response=e.value)}}),this.variables.forEach(e=>{e.type==="outcome"&&this.#i.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;#i;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(o=>o.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return b`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#m()})}disconnectedCallback(){this.#n(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#s),this.addEventListener("qti-register-feedback",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#h),this.addEventListener("qti-set-outcome-value",this.#l),this.addEventListener("qti-set-template-value",this.#u),this.addEventListener("qti-set-correct-response",this.#d),this.addEventListener("qti-interaction-response",this.#p)}#n(){this.removeEventListener("qti-register-variable",this.#s),this.removeEventListener("qti-register-feedback",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#h),this.removeEventListener("qti-set-outcome-value",this.#l),this.removeEventListener("qti-set-template-value",this.#u),this.removeEventListener("qti-set-correct-response",this.#d),this.removeEventListener("qti-interaction-response",this.#p)}#s;#a;#c;#h;#l;#u;#d;#p;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(o=>o.identifier==="numAttempts")?.value+1).toString()),this.adaptive==="false"&&this.#f();let r=this.querySelector("qti-response-processing"),i=!!(r&&typeof r.process=="function");return i&&r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this.#b()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}})),i}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.#b())}updateTemplateVariable(t,e){let r=this._context.variables.find(o=>o.identifier===t&&o.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==t?o:{...o,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(o=>o.identifier!==t?o:{...o,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){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(i=>i.identifier!==t?i:{...i,value:r.cardinality==="single"||Array.isArray(e)?e:[e]})},this.#i.forEach(i=>i.checkShowFeedback(t)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:t,value:this._context.variables.find(i=>i.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()}#b(){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 i=("defaultValue"in t?t.defaultValue:null)??null;return i==null&&(t.baseType==="integer"||t.baseType==="float")&&(i="0"),{...t,value:i}})}}};Jt([p({type:String})],rt.prototype,"identifier",void 0);Jt([p({type:String})],rt.prototype,"adaptive",void 0);Jt([p({type:String})],rt.prototype,"timeDependent",void 0);Jt([p({type:String})],rt.prototype,"title",null);Jt([p({type:Boolean})],rt.prototype,"disabled",void 0);Jt([$("disabled",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleDisabledChange",void 0);Jt([p({type:Boolean})],rt.prototype,"readonly",void 0);Jt([$("readonly",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleReadonlyChange",void 0);Jt([B({context:j})],rt.prototype,"_context",void 0);function ql(n){n.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 Cl(n,t,e,r="qti-portable-custom-interaction"){let i=[],o=n.querySelectorAll(r);if(o.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(o)){c.setAttribute("data-base-url",t);let d=c.getAttribute("custom-interaction-type-identifier");d&&i.includes(d)&&(d=d+i.length,c.setAttribute("custom-interaction-type-identifier",d),i.push(d)),d&&i.push(d);let h=c.querySelector("qti-interaction-modules");if(h&&h.getAttribute("primary-configuration")){await l();let f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),w=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of w){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 v=a.paths[u];Array.isArray(v)?x.setAttribute("fallback-path",v[0]):x.setAttribute("fallback-path",v)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=n.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 v=a.paths[x];Array.isArray(v)?g.setAttribute("fallback-path",v[0]):g.setAttribute("fallback-path",v)}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=n.createElement("qti-interaction-modules"),c.appendChild(h)):h=c.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],w="";a&&a.paths&&a.paths[f]&&(w=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(w)?w:[w],g=x.map((y,v)=>{let I=u.length>v?u[v]:"";return{primaryPath:y,fallbackPath:I}});for(let y of u)g.some(v=>v.fallbackPath===y)||g.push({primaryPath:x.length>0?x[0]:y,fallbackPath:y});for(let y of g){let v=n.createElement("qti-interaction-module");y.fallbackPath&&v.setAttribute("fallback-path",y.fallbackPath),v.setAttribute("id",f),v.setAttribute("primary-path",y.primaryPath),h&&h.appendChild(v)}}}}}function kl(n,t,e){Array.from(n.getElementsByTagName("*")).filter(o=>o.localName===t||o.localName?.toLowerCase()===t.toLowerCase()).forEach(o=>{let s=`${t}-${e}`,a=Sl(o,s);o.replaceWith(a)})}function El(n,t){n.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let o=i.slice(`${t}:`.length),s=`${e.nodeName}-${o}`,a=Sl(e,s);e.replaceWith(a)}})})}function Sl(n,t){let e=n.ownerDocument.createElement(t);for(let r of n.attributes)e.setAttribute(r.name,r.value);for(;n.firstChild;)e.appendChild(n.firstChild);return e}function Al(n,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let i of e)n.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var ka=class n{#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=mp(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new n(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 n(e)}static fromSeedKey(t){let e=new n(new Uint8Array);return e.#t=up(`${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 Ro(n){return ka.fromSeedKey(n)}function up(n){let t=1779033703^n.length;for(let e=0;e<n.length;e++)t=Math.imul(t^n.charCodeAt(e),3432918353),t=t<<13|t>>>19;return Il(t)}function mp(n){let t=1779033703^n.length;for(let e=0;e<n.length;e++)t=Math.imul(t^n[e],3432918353),t=t<<13|t>>>19;return Il(t)}function Il(n){let t=Math.imul(n^n>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var fp=n=>typeof n=="function"?n():n.random();function Oo(n,t){let e=n.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let o=Math.floor(fp(t)*(i+1));[e[i],e[o]]=[e[o],e[i]]}let r=0;return n.map(i=>i.fixed?i:e[r++])}function gp(n){switch(n){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 Ea(n,t){let e=n.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,o=n.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let l=a.getAttribute("response-identifier")??`${s}`;s++;let c=gp(a.tagName.toLowerCase()),d=Array.isArray(c)?c:[c],h=!1,f=0;for(let m of d){if(!m)continue;let w=i?Ro(`${t}:${o}:${l}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(v=>v.parentElement!==null);if(x.filter(v=>v.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(v=>v.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=Oo(x.map(v=>({element:v,fixed:v.getAttribute("fixed")==="true"})),w);for(let v of x)v.remove();for(let{element:v}of y)u.insertBefore(v,g);h=!0}h&&a.removeAttribute("shuffle")}}function _l(n){n.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Tl=!1;function Po(n,t){Tl||(Tl=!0,console.warn(`[${n}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function qr(n,t){return fetch(n,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>new DOMParser().parseFromString(e,"text/xml")).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Cr(n){return new DOMParser().parseFromString(n,"text/xml")}function Rl(n,t,e){if(n.nodeType===Node.ELEMENT_NODE){let r=n,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):i=t.createElementNS(r.namespaceURI,r.tagName);for(let o=0;o<r.attributes.length;o++){let s=r.attributes[o];i.setAttribute(s.localName,s.value)}for(let o=0;o<r.childNodes.length;o++)i.appendChild(Rl(r.childNodes[o],t,e));return i}return n.cloneNode(!1)}function kr(n,t){let e=document.createDocumentFragment();for(let r=0;r<n.childNodes.length;r++)e.appendChild(Rl(n.childNodes[r],document,t));return e}function Er(n,t){t.endsWith("/")||(t+="/"),n.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let o=r.getAttribute(i)?.trim();if(o&&!/^(data:|https?:|blob:)/.test(o)){let s=t+encodeURI(o);r.setAttribute(i,s)}}})}var zt=()=>{let n,t="",e={load(r,i){return t=r,qr(r,i).then(o=>(n=o,e))},parse(r){return n=Cr(r),t="",e},path:r=>(Er(n,r),t=null,e),fn(r){return r(n),e},pciHooks(r){return Al(n,r),e},async configurePci(r,i,o="qti-portable-custom-interaction"){return await Cl(n,r,i,o),e},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let o=t||"default-item-seed";return Po("qtiTransformItem",o),Ea(n,o),e}return Ea(n,i),e},extendElementName:(r,i)=>(kl(n,r,i),e),extendElementsWithClass:(r="extend")=>(El(n,r),e),customInteraction(r,i){let o=n.querySelector("qti-custom-interaction"),s=o.querySelector("object");return o.setAttribute("data-base-ref",r),o.setAttribute("data-base-item",r+i),o.setAttribute("data",s.getAttribute("data")),o.setAttribute("width",s.getAttribute("width")),o.setAttribute("height",s.getAttribute("height")),o.removeChild(s),e},convertCDATAtoComment(){return ql(n),e},stripStyleSheets(){return _l(n),e},html(){return t!==null&&Er(n,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(kr(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(r){return t!==null&&Er(n,t.substring(0,t.lastIndexOf("/"))),kr(n,r)},xmlDoc(){return n}};return e};var Ol=()=>{let n,t={async load(e,r){return n=await qr(e,r),t},parse(e){n=Cr(e)},assessmentTest(){let e=n.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Pl(n){let t=[];return n.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),o=e.getAttribute("category");t.push({identifier:r,href:i,category:o})}),t}var Mo=(n,...t)=>t.includes(n.localName)||t.includes(n.localName?.toLowerCase?.()),Ml=n=>Mo(n,"qti-assessment-item-ref","assessmentitemref"),xi=n=>Mo(n,"qti-assessment-section","assessmentsection"),wi=(n,...t)=>t.some(e=>{let r=(n.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),bp=(n,...t)=>t.some(e=>{let r=(n.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),Sa=n=>Mo(n,"qti-ordering","ordering"),yp=n=>Mo(n,"qti-selection","selection"),vp=n=>Array.from(n.children).filter(t=>Sa(t)&&wi(t,"shuffle")),wp=(n,t)=>Ro(`${n}:${t}`);function xp(n){let t=[],e=[],r=i=>{for(let o of Array.from(i.children))Ml(o)?t.push(o):xi(o)?r(o):!Sa(o)&&!yp(o)&&e.push(o.localName)};return r(n),{itemRefs:t,dropped:e}}function qp(n,t){if(t.length===0)return;let e=n.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function Dl(n,t){for(let l of Array.from(n.children))xi(l)&&Dl(l,t);let e=vp(n);if(e.length===0)return;let r=[],i=[];for(let l of Array.from(n.children))if(Ml(l))r.push({nodes:[l],fixed:wi(l,"fixed")}),i.push(l);else if(xi(l)){let{itemRefs:c,dropped:d}=xp(l);if(qp(l,d),bp(l,"keep-together","keeptogether"))for(let h of c)r.push({nodes:[h],fixed:wi(h,"fixed")});else c.length>0&&r.push({nodes:c,fixed:wi(l,"fixed")});i.push(l)}let o=i.length>0?i[i.length-1].nextSibling:null,s=n.getAttribute("identifier")??"",a=Oo(r,wp(t,s));for(let l of i)l.remove();for(let l of a)for(let c of l.nodes)n.insertBefore(c,o);for(let l of e)l.remove()}function Nl(n){return Array.from(n.getElementsByTagName("*")).some(t=>Sa(t)&&wi(t,"shuffle"))}function Aa(n,t){let e=Array.from(n.getElementsByTagName("*")).filter(r=>xi(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&xi(i)||Dl(r,t)}}var Sr=()=>{let n,t="",e={async load(r,i){return n=await qr(r,i),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return n=Cr(r),t="",e},path:r=>(Er(n,r),e),fn(r){return r(n),e},shuffleOrdering(r){if(!Nl(n))return e;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let o=t||"default-test-seed";return Po("qtiTransformTest",o),Aa(n,o),e}return Aa(n,i),e},items(){return Pl(n)},html(){return new XMLSerializer().serializeToString(kr(n))},xml(){return new XMLSerializer().serializeToString(n)},htmlDoc(r){return kr(n,r)},xmlDoc(){return n}};return e};var $l=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ia=class n extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(n.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},Ar=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 Ia(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 zt().load(this.href).then(r=>r.htmlDoc());if(e){let r=e.querySelectorAll("qti-stimulus-body, qti-stylesheet");t.innerHTML="",t.append(...r)}}};$l([p({type:String})],Ar.prototype,"identifier",void 0);$l([p({type:String})],Ar.prototype,"href",void 0);var Do=class extends C{};var Cp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},qi=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(i=>i.type==="template");for(let i of e){let o=i;o.mathVariable!==!0||o.value===null||o.value===void 0||t.set(o.identifier,this.#e(o.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let o=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(o);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",o);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",o),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};Cp([T({context:j,subscribe:!0}),_()],qi.prototype,"context",void 0);var Ll=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ir=class extends C{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[q`
|
|
68
68
|
:host {
|
|
69
69
|
display: none;
|
|
70
70
|
}
|
|
71
|
-
`]}render(){return b`<slot></slot>`}};
|
|
71
|
+
`]}render(){return b`<slot></slot>`}};Ll([p({type:String})],Ir.prototype,"identifier",void 0);Ll([p({type:String})],Ir.prototype,"cardinality",void 0);var kp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ci=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={variable:r=>this._context?.variables.find(i=>i.identifier===r)?.value??"",correct:r=>this._context?.variables.find(i=>i.identifier===r)?.correctResponse??""},e={getVariable:r=>this._context?.variables.find(i=>i.identifier===r),updateOutcomeVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:i}}))},updateResponseVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:r,response:i}}))}};return this.#t(this._context,t,e)}};kp([T({context:j,subscribe:!0}),_()],Ci.prototype,"_context",void 0);var No=class extends nt{static{this.styles=q`
|
|
72
72
|
:host {
|
|
73
73
|
display: block;
|
|
74
74
|
}
|
|
@@ -78,18 +78,18 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
78
78
|
.off {
|
|
79
79
|
display: none;
|
|
80
80
|
}
|
|
81
|
-
`}render(){return b` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var
|
|
81
|
+
`}render(){return b` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var jt=n=>n??P;var $o=class extends nt{constructor(){super(...arguments),this.render=()=>b` <slot part="feedback" class="${jt(this.showStatus)}"></slot> `}static{this.styles=q`
|
|
82
82
|
.on {
|
|
83
83
|
display: inline-block;
|
|
84
84
|
}
|
|
85
85
|
.off {
|
|
86
86
|
display: none;
|
|
87
87
|
}
|
|
88
|
-
`}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var
|
|
88
|
+
`}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Vl=q`
|
|
89
89
|
:host {
|
|
90
90
|
display: block;
|
|
91
91
|
}
|
|
92
|
-
`;var
|
|
92
|
+
`;var Lo=class extends C{static{this.styles=Vl}render(){return b`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var _r=class extends nt{static{this.styles=q`
|
|
93
93
|
.cito-dialog {
|
|
94
94
|
background: var(--qti-bg);
|
|
95
95
|
border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
|
|
@@ -134,15 +134,15 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
134
134
|
<button class="button close-button" @click="${this.closeFeedback}">Close</button>
|
|
135
135
|
</div>
|
|
136
136
|
</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
|
|
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 ki=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Zt=class extends br{constructor(){super(...arguments),this.externalScored=null}static{this.styles=[q`
|
|
138
138
|
:host {
|
|
139
139
|
display: none;
|
|
140
140
|
}
|
|
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){let e=new Map;for(let r of t.querySelectorAll("qti-interpolation-table-entry")){!r.getAttribute("source-value")&&r.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let i=parseFloat(r.getAttribute("source-value")),o=parseFloat(r.getAttribute("target-value"));(isNaN(i)||isNaN(o))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),e.set(i,o)}return e}return null}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,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}}))}};
|
|
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){let e=new Map;for(let r of t.querySelectorAll("qti-interpolation-table-entry")){!r.getAttribute("source-value")&&r.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let i=parseFloat(r.getAttribute("source-value")),o=parseFloat(r.getAttribute("target-value"));(isNaN(i)||isNaN(o))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),e.set(i,o)}return e}return null}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,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}}))}};ki([p({type:String,attribute:"base-type"})],Zt.prototype,"baseType",void 0);ki([p({type:String,attribute:"external-scored"})],Zt.prototype,"externalScored",void 0);ki([p({type:String})],Zt.prototype,"identifier",void 0);ki([p({type:String})],Zt.prototype,"cardinality",void 0);ki([T({context:j,subscribe:!0}),_()],Zt.prototype,"itemContext",void 0);var Vo=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},be=class extends br{static{this.styles=[q`
|
|
142
142
|
:host {
|
|
143
143
|
display: none;
|
|
144
144
|
}
|
|
145
|
-
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return b`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={baseType:this.baseType,identifier:this.identifier,correctResponse:this.#t,cardinality:this.cardinality||"single",mapping:this.#e,defaultValue:t,areaMapping:this.#r,value:null,type:"response",candidateResponse:null};e.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get#t(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){t=[];for(let i=0;i<r.length;i++)t.push(r[i].textContent.trim()),r[i].remove()}}return t}get#e(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(r)?null:r,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(o=>({mapKey:o.getAttribute("map-key")||"",mappedValue:Number(o.getAttribute("mapped-value"))||0,caseSensitive:o.hasAttribute("case-sensitive")?o.getAttribute("case-sensitive")!=="false":!1}))}}get#r(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,r=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound")),o=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(r)?null:r,upperBound:isNaN(i)?null:i,areaMapEntries:o}}};
|
|
145
|
+
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return b`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={baseType:this.baseType,identifier:this.identifier,correctResponse:this.#t,cardinality:this.cardinality||"single",mapping:this.#e,defaultValue:t,areaMapping:this.#r,value:null,type:"response",candidateResponse:null};e.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get#t(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){t=[];for(let i=0;i<r.length;i++)t.push(r[i].textContent.trim()),r[i].remove()}}return t}get#e(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(r)?null:r,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(o=>({mapKey:o.getAttribute("map-key")||"",mappedValue:Number(o.getAttribute("mapped-value"))||0,caseSensitive:o.hasAttribute("case-sensitive")?o.getAttribute("case-sensitive")!=="false":!1}))}}get#r(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,r=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound")),o=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(r)?null:r,upperBound:isNaN(i)?null:i,areaMapEntries:o}}};Vo([p({type:String,attribute:"base-type"})],be.prototype,"baseType",void 0);Vo([p({type:String})],be.prototype,"identifier",void 0);Vo([p({type:String})],be.prototype,"cardinality",void 0);Vo([T({context:j,subscribe:!0}),_()],be.prototype,"itemContext",void 0);var zl=`<qti-response-condition>
|
|
146
146
|
<qti-response-if>
|
|
147
147
|
<qti-match>
|
|
148
148
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -157,7 +157,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
157
157
|
<qti-base-value base-type="float">0</qti-base-value>
|
|
158
158
|
</qti-set-outcome-value>
|
|
159
159
|
</qti-response-else>
|
|
160
|
-
</qti-response-condition>`,
|
|
160
|
+
</qti-response-condition>`,jl=`<qti-response-condition>
|
|
161
161
|
<qti-response-if>
|
|
162
162
|
<qti-is-null>
|
|
163
163
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -171,7 +171,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
171
171
|
<qti-map-response identifier="RESPONSE"> </qti-map-response>
|
|
172
172
|
</qti-set-outcome-value>
|
|
173
173
|
</qti-response-else>
|
|
174
|
-
</qti-response-condition>`,
|
|
174
|
+
</qti-response-condition>`,Fl=`<qti-response-condition>
|
|
175
175
|
<qti-response-if>
|
|
176
176
|
<qti-is-null>
|
|
177
177
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -185,27 +185,27 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
185
185
|
<qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
|
|
186
186
|
</qti-set-outcome-value>
|
|
187
187
|
</qti-response-else>
|
|
188
|
-
</qti-response-condition>`;var
|
|
188
|
+
</qti-response-condition>`;var Ep={map_response:jl,map_response_point:Fl,match_correct:zl},zo=class extends C{static{this.styles=[q`
|
|
189
189
|
:host {
|
|
190
190
|
display: none;
|
|
191
191
|
}
|
|
192
|
-
`]}render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];for(let r of e)r.process()}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let r=e.split("/").pop().replace(".xml",""),i=
|
|
192
|
+
`]}render(){return b`<slot></slot>`}process(){if(!this.closest("qti-assessment-item"))return;let e=[...this.children];for(let r of e)r.process()}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let r=e.split("/").pop().replace(".xml",""),i=Ep[r];i&&(this.innerHTML=i)}};var Ei=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},te=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
193
|
:host {
|
|
194
194
|
display: block;
|
|
195
195
|
}
|
|
196
|
-
`}render(){return b`<slot></slot>`}};
|
|
196
|
+
`}render(){return b`<slot></slot>`}};Ei([p({type:String})],te.prototype,"id",void 0);Ei([p({type:String})],te.prototype,"use",void 0);Ei([p({type:String})],te.prototype,"view",void 0);Ei([p({type:String,attribute:"class"})],te.prototype,"classNames",void 0);Ei([$("classNames",{waitUntilFirstUpdate:!0})],te.prototype,"handleclassNamesChange",null);var jo=class extends C{#t=null;firstUpdated(t){super.firstUpdated(t);let e=this.getAttribute("href");if(e!==null&&fetch(e).then(r=>r.text()).then(r=>{let i=this.#e(r);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}).catch(r=>{console.error("Failed to load stylesheet:",r)}),this.textContent!==null&&this.textContent.trim()!==""){let r=this.#e(this.textContent);this.#t=document.createElement("style"),this.#t.media="screen",this.#t.textContent=`@scope {${r}}`,this.parentElement?this.parentElement.appendChild(this.#t):console.warn("No parent element to append the scoped stylesheet to.")}}#e(t){return t.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.#t)try{this.#t.remove()}catch(t){console.error("Could not remove stylesheet:",t)}super.disconnectedCallback()}};var Fo=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 Si=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ee=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
197
|
:host {
|
|
198
198
|
display: none;
|
|
199
199
|
}
|
|
200
|
-
`]}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}}};
|
|
200
|
+
`]}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}}};Si([p({type:String})],ee.prototype,"identifier",void 0);Si([p({type:String})],ee.prototype,"cardinality",void 0);Si([p({type:String,attribute:"base-type"})],ee.prototype,"baseType",void 0);Si([p({type:Boolean,attribute:"math-variable"})],ee.prototype,"mathVariable",void 0);Si([p({type:Boolean,attribute:"param-variable"})],ee.prototype,"paramVariable",void 0);var Bo=class extends C{static{this.styles=[q`
|
|
201
201
|
:host {
|
|
202
202
|
display: none;
|
|
203
203
|
}
|
|
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 i=[...this.children];for(let o of i)if(o.tagName.toLowerCase()==="qti-template-constraint"){if(o.calculate()===!1){r=!0;break}}else o.process()}catch(i){console.error("Error during template processing:",i);break}}while(r);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var
|
|
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 i=[...this.children];for(let o of i)if(o.tagName.toLowerCase()==="qti-template-constraint"){if(o.calculate()===!1){r=!0;break}}else o.process()}catch(i){console.error("Error during template processing:",i);break}}while(r);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var Bl=[{tag:"qti-assessment-item",ctor:rt},{tag:"qti-assessment-stimulus-ref",ctor:Ar},{tag:"qti-companion-materials-info",ctor:Do},{tag:"qti-content-body",ctor:qi},{tag:"qti-context-declaration",ctor:Ir},{tag:"qti-custom-operator",ctor:Ci},{tag:"qti-feedback-block",ctor:No},{tag:"qti-feedback-inline",ctor:$o},{tag:"qti-item-body",ctor:Lo},{tag:"qti-modal-feedback",ctor:_r},{tag:"qti-outcome-declaration",ctor:Zt},{tag:"qti-response-declaration",ctor:be},{tag:"qti-response-processing",ctor:zo},{tag:"qti-rubric-block",ctor:te},{tag:"qti-stylesheet",ctor:jo},{tag:"qti-template-constraint",ctor:Fo},{tag:"qti-template-declaration",ctor:ee},{tag:"qti-template-processing",ctor:Bo}];var Uo=class extends _r{static{this.styles=q`
|
|
205
205
|
:host {
|
|
206
206
|
color: gray;
|
|
207
207
|
}
|
|
208
|
-
`}render(){return b``}};var Do=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},fe=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>`}};Do([p({type:String})],fe.prototype,"identifier",void 0);Do([p({type:String})],fe.prototype,"class",void 0);Do([p({type:String,attribute:"navigation-mode"})],fe.prototype,"navigationMode",void 0);Do([p({type:String,attribute:"submission-mode"})],fe.prototype,"submissionMode",void 0);var mp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},wi=class extends E{#t;constructor(){super(),this.addEventListener("qti-assessment-test-connected",t=>this.#t=t.detail)}getResult(){let t=this.getAttribute("include-category")?.split(" ")??[],e=this.getAttribute("exclude-category")?.split(" ")??[],r=this.getAttribute("weight-identifier")??"",i=this.getAttribute("variable-identifier"),s=Array.from(this.#t.querySelectorAll("qti-asssessment-test qti-assessment-item-ref")).filter(l=>{let d=!0;return t.length>0&&(d=t.includes(l.category)),e.length>0&&(d=!e.includes(l.category)),d}).map(l=>{let d=1;if(r){let h=l.weigths.get(r);h!=null&&(d=h)}return{item:l.identifier,weight:d}});return new qa(this._testContext,i,s).calculate()}calculate(){return this.getResult()}};mp([T({context:pt,subscribe:!0})],wi.prototype,"_testContext",void 0);var qa=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let{items:t}=this.testContext,e=0,r=[...new Set(this.includedItems.map(i=>i.item))];return t.forEach(i=>{if(r.includes(i.identifier)){let o=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;o&&(e+=Number(o.value)*s)}}),e}};var No=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Rl=n=>{class t extends n{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,i){let o=i||this._getDefaultNavigationId(r);o&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:r,id:o},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 i=r.detail;this._loadingState.connectedItems++;let o=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=o.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:o}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:o.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,o),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.href)}}_getDefaultNavigationId(r){return r==="section"?this._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,i){let o=this.sessionContext?.navItemRefId;if(!o||r==="item"&&i===o)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${o}"]`);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(g=>g.identifier===o);if(r==="item"){let g=d.findIndex(m=>m.identifier===i);return g===-1||h===-1?!1:g!==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 i=++this._navigationId,o=new AbortController;try{this._dispatchLoadingStarted(r.type,r.id),this._activeController=o,await this._executeNavigation(r.type,r.id,i,o)}catch(s){this._handleNavigationError(s,r.type,r.id)}finally{this._activeController===o&&(this._activeController=null),this._dispatchLoadingEnded(r.type,r.id)}}_handleNavigationError(r,i,o){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,o))}async _executeNavigation(r,i,o,s){r==="item"?await this._navigateToItem(i,o,s):await this._navigateToSection(i,o,s)}async _navigateToItem(r,i,o){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,o),await this._waitForLoadingComplete(i,o),!this._isStaleNavigation(i,o)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(r,i,o){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,i,o),await this._waitForLoadingComplete(i,o),!this._isStaleNavigation(i,o)&&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,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,i))return;await new Promise(o=>setTimeout(o,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let o=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",o?"has content":"no content"),this._applyStimulusContent(o,r,i)}_applyStimulusContent(r,i,o){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 ${i.identifier}`),s.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let a=[],c=o.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(c)a.push(c),console.info("Found specific target:",c);else{let l=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.identifier}"]`));if(l.length>0)a=l,console.info("Found targets by identifier:",l.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((l,d)=>{l.innerHTML="";let h=Array.from(s).map(g=>g.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,i,o){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,i,o)))).filter(Boolean);this._isStaleNavigation(i,o)||(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(g=>g.identifier===d)?.state;h!==void 0&&l.updateComplete.then(()=>{let g=l.assessmentItem;g&&(g.state=h)})}),this._loadResults=c)}async _loadSingleItem(r,i,o){try{let s=this.querySelector("test-navigation")?.qtiContext?.QTI_CONTEXT?.seed,a=(await Vt().load(r.href,o.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,o)?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 Vt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!i)throw new Error(`Item with identifier "${r}" not found`);return i}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,i){let o=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:o,navSectionId:s,navItemRefId:i}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,i){return i.signal.aborted||r!==this._navigationId}_createNavigationError(r,i,o){return{message:r.message||`Failed to load ${i}: ${o}`,details:r,itemId:i==="item"?o:void 0,sectionId:i==="section"?o:void 0}}_dispatchLoadingStarted(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},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:i})=>({identifier:i?.identifier,element:i})),bubbles:!0,composed:!0}))})}}return No([p({type:String})],t.prototype,"navigate",void 0),No([p({type:Number})],t.prototype,"requestTimeout",void 0),No([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),No([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var Ol=n=>{class t extends n{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(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 o=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;o&&this.updateAssessmentItemView(o,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return t};var Pl=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ca=n=>{class t extends n{constructor(...r){super(...r),this.testContext=ca,this.sessionContext=aa,this._updateItemInTestContext=i=>{let o=i._context,s=o.identifier,a=o.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=[...i.variables];for(let d of c.variables){let h=l.find(g=>g.identifier===d.identifier);h?h.value=d.value:l.push(d)}i.variables=l}},this._initializeEventListeners()}updateItemVariables(r,i){let o=this.testContext.items.find(a=>a.identifier===r);o&&(o.variables=o.variables.map(a=>{let c=i.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=i)}_initializeEventListeners(){this.addEventListener("qti-assessment-test-connected",r=>{if(this.testContext=ca,this.sessionContext=aa,this.testContext&&this.testContext.items.length>0)return;this._testElement=r.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(o=>({href:o.href,identifier:o.identifier,category:o.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",r=>{let i=r.detail,o=i.closest("qti-assessment-item-ref")?.identifier;o&&(i.assessmentItemRefId=o),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,i,o){this.testContext={...this.testContext,items:this.testContext.items.map(s=>s.identifier!==r?s:{...s,variables:i.map(a=>{let c=s.variables.find(l=>l.identifier===a.identifier);return c?{...c,...a}:a}),...o!==void 0?{state:o?{...o}:void 0}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return Pl([p({attribute:!1,type:Object}),B({context:pt})],t.prototype,"testContext",void 0),Pl([p({attribute:!1,type:Object}),B({context:Nt})],t.prototype,"sessionContext",void 0),t},Ml=class extends Ca(C){};var Dl=n=>{class t extends n{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:o,value:s}=i.detail;this.updateOutcomeVariable(o,s),i.stopPropagation()})}outcomeProcessing(){let r=this.querySelector("qti-outcome-processing");return r?(r?.process(),!0):!1}updateOutcomeVariable(r,i){let o=this.getOutcome(r);if(!o){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:o.cardinality==="single"?i:[...s.value,i]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===r)||null}}return t};var fp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ve=class extends Rl(Ol(Dl(Ca(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>`}};fp([_(),B({context:dt})],Ve.prototype,"configContext",void 0);var Nl=q`
|
|
208
|
+
`}render(){return b``}};var Ho=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ye=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>`}};Ho([p({type:String})],ye.prototype,"identifier",void 0);Ho([p({type:String})],ye.prototype,"class",void 0);Ho([p({type:String,attribute:"navigation-mode"})],ye.prototype,"navigationMode",void 0);Ho([p({type:String,attribute:"submission-mode"})],ye.prototype,"submissionMode",void 0);var Sp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ai=class extends A{#t;constructor(){super(),this.addEventListener("qti-assessment-test-connected",t=>this.#t=t.detail)}getResult(){let t=this.getAttribute("include-category")?.split(" ")??[],e=this.getAttribute("exclude-category")?.split(" ")??[],r=this.getAttribute("weight-identifier")??"",i=this.getAttribute("variable-identifier"),s=Array.from(this.#t.querySelectorAll("qti-asssessment-test qti-assessment-item-ref")).filter(c=>{let d=!0;return t.length>0&&(d=t.includes(c.category)),e.length>0&&(d=!e.includes(c.category)),d}).map(c=>{let d=1;if(r){let h=c.weigths.get(r);h!=null&&(d=h)}return{item:c.identifier,weight:d}});return new _a(this._testContext,i,s).calculate()}calculate(){return this.getResult()}};Sp([T({context:ot,subscribe:!0})],Ai.prototype,"_testContext",void 0);var _a=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let{items:t}=this.testContext,e=0,r=[...new Set(this.includedItems.map(i=>i.item))];return t.forEach(i=>{if(r.includes(i.identifier)){let o=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;o&&(e+=Number(o.value)*s)}}),e}};var Wo=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ul=n=>{class t extends n{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,i){let o=i||this._getDefaultNavigationId(r);o&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:r,id:o},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 i=r.detail;this._loadingState.connectedItems++;let o=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=o.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:o}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:o.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,o),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.href)}}_getDefaultNavigationId(r){return r==="section"?this._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,i){let o=this.sessionContext?.navItemRefId;if(!o||r==="item"&&i===o)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${o}"]`);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===o);if(r==="item"){let f=d.findIndex(m=>m.identifier===i);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 i=++this._navigationId,o=new AbortController;try{this._dispatchLoadingStarted(r.type,r.id),this._activeController=o,await this._executeNavigation(r.type,r.id,i,o)}catch(s){this._handleNavigationError(s,r.type,r.id)}finally{this._activeController===o&&(this._activeController=null),this._dispatchLoadingEnded(r.type,r.id)}}_handleNavigationError(r,i,o){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,o))}async _executeNavigation(r,i,o,s){r==="item"?await this._navigateToItem(i,o,s):await this._navigateToSection(i,o,s)}async _navigateToItem(r,i,o){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,o),await this._waitForLoadingComplete(i,o),!this._isStaleNavigation(i,o)&&this._dispatchTestLoaded(this._loadResults)}async _navigateToSection(r,i,o){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,i,o),await this._waitForLoadingComplete(i,o),!this._isStaleNavigation(i,o)&&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,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,i))return;await new Promise(o=>setTimeout(o,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let o=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",o?"has content":"no content"),this._applyStimulusContent(o,r,i)}_applyStimulusContent(r,i,o){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 ${i.identifier}`),s.length===0){console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");return}let a=[],l=o.querySelector(`[data-stimulus-idref="${i.identifier}"]`);if(l)a.push(l),console.info("Found specific target:",l);else{let c=Array.from(this.querySelectorAll(`[data-stimulus-idref="${i.identifier}"]`));if(c.length>0)a=c,console.info("Found targets by identifier:",c.length);else{let d=Array.from(this.querySelectorAll("[data-stimulus-idref]"));a=d,console.info("Using fallback targets:",d.length)}}if(a.length===0){console.warn("No targets found for stimulus content");return}a.forEach((c,d)=>{c.innerHTML="";let h=Array.from(s).map(f=>f.cloneNode(!0));c.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,i,o){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,i,o)))).filter(Boolean);this._isStaleNavigation(i,o)||(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,i,o){try{let s=this.querySelector("test-navigation")?.qtiContext?.QTI_CONTEXT?.seed,a=(await zt().load(r.href,o.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,o)?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 zt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!i)throw new Error(`Item with identifier "${r}" not found`);return i}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,i){let o=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:o,navSectionId:s,navItemRefId:i}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,i){return i.signal.aborted||r!==this._navigationId}_createNavigationError(r,i,o){return{message:r.message||`Failed to load ${i}: ${o}`,details:r,itemId:i==="item"?o:void 0,sectionId:i==="section"?o:void 0}}_dispatchLoadingStarted(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-started",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},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:i})=>({identifier:i?.identifier,element:i})),bubbles:!0,composed:!0}))})}}return Wo([p({type:String})],t.prototype,"navigate",void 0),Wo([p({type:Number})],t.prototype,"requestTimeout",void 0),Wo([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),Wo([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var Hl=n=>{class t extends n{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(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 o=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;o&&this.updateAssessmentItemView(o,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return t};var Wl=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ta=n=>{class t extends n{constructor(...r){super(...r),this.testContext=ga,this.sessionContext=fa,this._updateItemInTestContext=i=>{let o=i._context,s=o.identifier,a=o.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);else{let c=[...i.variables];for(let d of l.variables){let h=c.find(f=>f.identifier===d.identifier);h?h.value=d.value:c.push(d)}i.variables=c}},this._initializeEventListeners()}updateItemVariables(r,i){let o=this.testContext.items.find(a=>a.identifier===r);o&&(o.variables=o.variables.map(a=>{let l=i.find(c=>c.identifier===a.identifier);return l?{...a,...l}:a}));let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);s&&s.assessmentItem&&(s.assessmentItem.variables=i)}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=ga,this.sessionContext=fa}),this.addEventListener("qti-assessment-test-connected",r=>{this._testElement=r.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(o=>({href:o.href,identifier:o.identifier,category:o.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",r=>{let i=r.detail,o=i.closest("qti-assessment-item-ref")?.identifier;o&&(i.assessmentItemRefId=o),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,i,o){this.testContext={...this.testContext,items:this.testContext.items.map(s=>s.identifier!==r?s:{...s,variables:i.map(a=>{let l=s.variables.find(c=>c.identifier===a.identifier);return l?{...l,...a}:a}),...o!==void 0?{state:o?{...o}:void 0}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}}return Wl([p({attribute:!1,type:Object}),B({context:ot})],t.prototype,"testContext",void 0),Wl([p({attribute:!1,type:Object}),B({context:$t})],t.prototype,"sessionContext",void 0),t},Ql=class extends Ta(C){};var Gl=n=>{class t extends n{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:o,value:s}=i.detail;this.updateOutcomeVariable(o,s),i.stopPropagation()})}outcomeProcessing(){let r=this.querySelector("qti-outcome-processing");return r?(r?.process(),!0):!1}updateOutcomeVariable(r,i){let o=this.getOutcome(r);if(!o){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:o.cardinality==="single"?i:[...s.value,i]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===r)||null}}return t};var Ap=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Be=class extends Ul(Hl(Gl(Ta(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>`}};Ap([_(),B({context:ht})],Be.prototype,"configContext",void 0);var Xl=q`
|
|
209
209
|
display: inline-flex;
|
|
210
210
|
align-items: center;
|
|
211
211
|
cursor: pointer;
|
|
@@ -214,22 +214,23 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
214
214
|
user-select: none;
|
|
215
215
|
`,ft=q`
|
|
216
216
|
background-color: lightgray;
|
|
217
|
-
${
|
|
217
|
+
${Xl};
|
|
218
218
|
`,gt=q`
|
|
219
219
|
cursor: not-allowed;
|
|
220
220
|
opacity: 0.8;
|
|
221
|
-
`,
|
|
222
|
-
${
|
|
221
|
+
`,Ax=q`
|
|
222
|
+
${Xl};
|
|
223
223
|
border: 1px solid gray;
|
|
224
|
-
`;var
|
|
224
|
+
`;var Rr=class extends C{static{this.styles=q`
|
|
225
225
|
:host {
|
|
226
226
|
${ft};
|
|
227
227
|
}
|
|
228
228
|
:host([disabled]) {
|
|
229
229
|
${gt};
|
|
230
230
|
}
|
|
231
|
-
`}constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}));let e=this.closest("qti-test").querySelector("test-container");Array.from(e.shadowRoot.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",!0)})})}render(){return b` <slot></slot> `}};var
|
|
231
|
+
`}constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0}));let e=this.closest("qti-test").querySelector("test-container");Array.from(e.shadowRoot.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",!0)})})}render(){return b` <slot></slot> `}};var Qo=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},Go=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 Yl=n=>!bl(n)&&typeof n.then=="function",Kl=1073741823,Ra=class extends ge{constructor(){super(...arguments),this._$Cwt=Kl,this._$Cbt=[],this._$CK=new Qo(this),this._$CX=new Go}render(...t){return t.find(e=>!Yl(e))??Z}update(t,e){let r=this._$Cbt,i=r.length;this._$Cbt=e;let o=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(!Yl(l))return this._$Cwt=a,l;a<i&&l===r[a]||(this._$Cwt=Kl,i=0,Promise.resolve(l).then(async c=>{for(;s.get();)await s.get();let d=o.deref();if(d!==void 0){let h=d._$Cbt.indexOf(l);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(c))}}))}return Z}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Xo=kt(Ra);var Yo=`
|
|
232
232
|
@layer qti-base, qti-components, qti-extended;
|
|
233
|
+
|
|
233
234
|
@layer qti-components.reset, qti-components.global, qti-components.interactions.base,
|
|
234
235
|
qti-components.interactions.brand, qti-components.interactions.states,
|
|
235
236
|
qti-components.interactions.corrections, qti-components.elements, qti-components.overrides;
|
|
@@ -244,6 +245,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
244
245
|
* Nothing is left unlayered: unlayered CSS outranks every layer, so a single stray rule here would
|
|
245
246
|
* sit above the whole theme AND above the \`qti-extended\` slot consumers are told to author in.
|
|
246
247
|
*/
|
|
248
|
+
|
|
247
249
|
@layer qti-base{
|
|
248
250
|
/* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */
|
|
249
251
|
/* ============================
|
|
@@ -1676,6 +1678,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1676
1678
|
text-orientation: upright;
|
|
1677
1679
|
}
|
|
1678
1680
|
}
|
|
1681
|
+
|
|
1679
1682
|
@layer qti-base{
|
|
1680
1683
|
|
|
1681
1684
|
.qti-layout-row {
|
|
@@ -1807,6 +1810,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1807
1810
|
* block is appended after every declared layer, which would put brand paint above the state and
|
|
1808
1811
|
* correction paint it is meant to sit under. Deleting the two names moved 7 of the 17 VRT baselines.
|
|
1809
1812
|
*/
|
|
1813
|
+
|
|
1810
1814
|
@layer qti-components.reset{
|
|
1811
1815
|
@scope (qti-item-body, .ProseMirror) {
|
|
1812
1816
|
:scope,
|
|
@@ -1858,6 +1862,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1858
1862
|
}
|
|
1859
1863
|
}
|
|
1860
1864
|
}
|
|
1865
|
+
|
|
1861
1866
|
@layer qti-components.elements{
|
|
1862
1867
|
|
|
1863
1868
|
/**
|
|
@@ -1929,6 +1934,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
1929
1934
|
* these blocks (--qti-correct reads --qti-success) is layer-independent. Nothing here renders
|
|
1930
1935
|
* differently for being grouped this way.
|
|
1931
1936
|
*/
|
|
1937
|
+
|
|
1932
1938
|
/* ============================================================================
|
|
1933
1939
|
* global \u2014 the foundation every layer reads.
|
|
1934
1940
|
* ========================================================================== */
|
|
@@ -2123,6 +2129,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2123
2129
|
}
|
|
2124
2130
|
}
|
|
2125
2131
|
}
|
|
2132
|
+
|
|
2126
2133
|
/* ============================================================================
|
|
2127
2134
|
* interactions.base \u2014 interaction-local geometry. Neutral, no judgement colour.
|
|
2128
2135
|
* ========================================================================== */
|
|
@@ -2294,6 +2301,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2294
2301
|
--qti-drag-padding: var(--qti-spacing) 0.8em;
|
|
2295
2302
|
}
|
|
2296
2303
|
}
|
|
2304
|
+
|
|
2297
2305
|
/* ============================================================================
|
|
2298
2306
|
* interactions.states \u2014 state paint. Selection, drag, and drop-target highlight.
|
|
2299
2307
|
* ========================================================================== */
|
|
@@ -2340,6 +2348,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2340
2348
|
--qti-drop-highlight-border-width: 2px;
|
|
2341
2349
|
}
|
|
2342
2350
|
}
|
|
2351
|
+
|
|
2343
2352
|
/* ============================================================================
|
|
2344
2353
|
* interactions.corrections \u2014 answer-key and judgement paint.
|
|
2345
2354
|
* ========================================================================== */
|
|
@@ -2364,15 +2373,18 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2364
2373
|
/* QTI base \u2014 shared theme utilities and semantic mixins. Only styles >=2 interactions share.
|
|
2365
2374
|
* They read the variables in qti-variables.css; a substrate re-colours by overriding those, not
|
|
2366
2375
|
* by editing these. Split from qti-base.css. */
|
|
2376
|
+
|
|
2367
2377
|
/* ============================================================================
|
|
2368
2378
|
* Shared semantic mixins. Only styles \u22652 interactions share belong here.
|
|
2369
2379
|
* A substrate expresses its look by overriding the --qti-* variables above
|
|
2370
2380
|
* (value first), not by editing these.
|
|
2371
2381
|
* ========================================================================== */
|
|
2382
|
+
|
|
2372
2383
|
/*
|
|
2373
2384
|
* Semantic PostCSS mixins. Interaction files wire these to their own parts and states; the mixins
|
|
2374
2385
|
* own the shared visual vocabulary.
|
|
2375
2386
|
*/
|
|
2387
|
+
|
|
2376
2388
|
/*
|
|
2377
2389
|
* A candidate correction, painted through the corrected element's own role.
|
|
2378
2390
|
*
|
|
@@ -2389,6 +2401,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2389
2401
|
*
|
|
2390
2402
|
* \`candidate-tint\` below survives for the one corrected element with no role: qti-hottext.
|
|
2391
2403
|
*/
|
|
2404
|
+
|
|
2392
2405
|
/*
|
|
2393
2406
|
* THE paint contract. Every visual component is, at rest, a bordered box on the theme's surface.
|
|
2394
2407
|
* This mixin binds each PAINT property to a variable exactly once, so a state \u2014 or a theme \u2014
|
|
@@ -2419,6 +2432,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2419
2432
|
* rings) and a MULTI-SLOT box-shadow (so an element's resting lift, in-flight elevation and focus
|
|
2420
2433
|
* ring compose instead of the last one winning \u2014 the documented four-rule box-shadow contention).
|
|
2421
2434
|
*/
|
|
2435
|
+
|
|
2422
2436
|
/*
|
|
2423
2437
|
* A drag: the movable token a candidate drags into a gap, a drop target or an order slot.
|
|
2424
2438
|
*
|
|
@@ -2436,6 +2450,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2436
2450
|
* Under content-box the clone's padding would be added to the width the drag code measured off the
|
|
2437
2451
|
* bank drag, and it would jump the instant it was picked up.
|
|
2438
2452
|
*/
|
|
2453
|
+
|
|
2439
2454
|
/*
|
|
2440
2455
|
* The hole a drag leaves behind: lifted mid-drag, or spent because its copy is already placed.
|
|
2441
2456
|
*
|
|
@@ -2446,6 +2461,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2446
2461
|
* bank would reflow around a hole 20px narrower than the thing that left it. Measured in
|
|
2447
2462
|
* drag-drop.invariance.spec.ts, "a spent drag keeps its footprint".
|
|
2448
2463
|
*/
|
|
2464
|
+
|
|
2449
2465
|
/*
|
|
2450
2466
|
* The drag handle glyph.
|
|
2451
2467
|
*
|
|
@@ -2458,6 +2474,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2458
2474
|
* else. This one is in flow and takes real width, which is why it reserves an explicit width/height
|
|
2459
2475
|
* rather than leaning on the glyph's intrinsic size.
|
|
2460
2476
|
*/
|
|
2477
|
+
|
|
2461
2478
|
/*
|
|
2462
2479
|
* The radio and the checkbox: the other two things this theme draws as boxes, and so the other two
|
|
2463
2480
|
* paint roles. A control is a bordered box on the theme's surface exactly like a chip is, and now it
|
|
@@ -2478,6 +2495,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2478
2495
|
* not a paint slot. Centring the mark is the component's job \u2014 qti-simple-choice.styles.ts already
|
|
2479
2496
|
* flex-centres [part='control'].
|
|
2480
2497
|
*/
|
|
2498
|
+
|
|
2481
2499
|
/*
|
|
2482
2500
|
* The mark inside a control at rest \u2014 the box the tick or dot is drawn into. Structural.
|
|
2483
2501
|
*
|
|
@@ -2490,10 +2508,12 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2490
2508
|
* border \u2014 so it would silently shrink by the border width and change with it. Multiplying the token
|
|
2491
2509
|
* keeps the mark proportional to the control's outer size, which is the size anyone reasons about.
|
|
2492
2510
|
*/
|
|
2511
|
+
|
|
2493
2512
|
/* A choice with its native control shown (radio/checkbox visible) is the button component with its
|
|
2494
2513
|
border made TRANSPARENT \u2014 no visible box, but the 1px edge is still there, so it is the same box
|
|
2495
2514
|
as the \`.qti-input-control-hidden\` choice (which keeps the border visible because the whole choice
|
|
2496
2515
|
is the control). Only the border COLOUR differs between the two, never the geometry. */
|
|
2516
|
+
|
|
2497
2517
|
/*
|
|
2498
2518
|
* The mark a checked control shows: a dot for a radio, a tick for a checkbox.
|
|
2499
2519
|
*
|
|
@@ -2502,6 +2522,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2502
2522
|
* \`control-selected\`), so the two belong together: override --checkbox-background-color and you will
|
|
2503
2523
|
* usually want --checkbox-mark-color with it. \`white\` is the resting value, not a fixed one.
|
|
2504
2524
|
*/
|
|
2525
|
+
|
|
2505
2526
|
/*
|
|
2506
2527
|
* \`act\`, \`readonly\` and \`dis\` used to live here. They are written out at their call sites now, for
|
|
2507
2528
|
* two different reasons.
|
|
@@ -2523,16 +2544,20 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2523
2544
|
*
|
|
2524
2545
|
* \`act-bor\` was deleted outright: zero call sites anywhere in the repo.
|
|
2525
2546
|
*/
|
|
2547
|
+
|
|
2526
2548
|
/* \`foc\` stays a mixin, deliberately, and is the one state still painting a property directly.
|
|
2527
2549
|
* Twenty call sites read it, and it draws a \`box-shadow\` \u2014 the property the contract has NOT bound
|
|
2528
2550
|
* (see \`paint\` above). Routing it through --<role>-box-shadow would not fix anything: focus would
|
|
2529
2551
|
* then fight the resting lift and the in-flight elevation over one slot, last-declared winning,
|
|
2530
2552
|
* which is the four-rule contention already documented in qti-variables.css. The intended fix
|
|
2531
2553
|
* recorded there is a single \`outline\` on \`:focus-visible\`, and that is its own VRT-checked step. */
|
|
2554
|
+
|
|
2532
2555
|
/* A choice \u2014 the clickable box a candidate picks. Nothing but the resting paint box; its padding is
|
|
2533
2556
|
the interaction's (qti-choice-interaction.css), because a choice's box differs per interaction and
|
|
2534
2557
|
a chip's does not. */
|
|
2558
|
+
|
|
2535
2559
|
/* A text field: the paint box, plus the cursor that says you can type in it. */
|
|
2560
|
+
|
|
2536
2561
|
/*
|
|
2537
2562
|
* A drop target: the paint box with a DASHED edge, the one thing that distinguishes it from every
|
|
2538
2563
|
* other role.
|
|
@@ -2547,9 +2572,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2547
2572
|
* dashed edge onto any chip standing in the drop (it did \u2014 a chip in a drop went dashed). Now that
|
|
2548
2573
|
* the chip reads --drag-border-style, the drop's value inherits past it harmlessly.
|
|
2549
2574
|
*/
|
|
2575
|
+
|
|
2550
2576
|
/* The initial \`display: none\` moved to \`validationMessage\` in qti-base \u2014 the message is a shadow
|
|
2551
2577
|
node, and \`Interaction.reportValidity\` already owns showing and hiding it with an inline style.
|
|
2552
2578
|
What is left here is paint. */
|
|
2579
|
+
|
|
2553
2580
|
/*
|
|
2554
2581
|
* The three roles qti-inline-choice-interaction is built from. They are separate roles rather than
|
|
2555
2582
|
* one, because they nest: the menu and the message live in the field's shadow root, so under a
|
|
@@ -2560,12 +2587,14 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2560
2587
|
* \`menu\` the popover the options are listed in.
|
|
2561
2588
|
* \`message\` the validation box. Its warning colouring is the interaction's, not the role's.
|
|
2562
2589
|
*/
|
|
2590
|
+
|
|
2563
2591
|
/*
|
|
2564
2592
|
* A drag in flight. The other \`drag\` modifier \u2014 applied with \`drag\`, never instead of it.
|
|
2565
2593
|
*
|
|
2566
2594
|
* \`rotate\` is paint: a transform never reflows, which is what lets a drag tilt under the cursor
|
|
2567
2595
|
* without the bank shifting behind it.
|
|
2568
2596
|
*/
|
|
2597
|
+
|
|
2569
2598
|
/*
|
|
2570
2599
|
* A drag darkens a little under the pointer. The one hover affordance in the theme.
|
|
2571
2600
|
*
|
|
@@ -2643,6 +2672,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2643
2672
|
height: calc(var(--qti-control-size) * 0.625);
|
|
2644
2673
|
}
|
|
2645
2674
|
}
|
|
2675
|
+
|
|
2646
2676
|
@layer qti-components.interactions.states {
|
|
2647
2677
|
/* A selected choice, repainted through the button role's slots rather than by re-declaring the
|
|
2648
2678
|
properties \u2014 the choice is \`@mixin button\`, so switching a variable is all a state has to do.
|
|
@@ -2722,6 +2752,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2722
2752
|
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='currentColor' width='100%' height='100%' viewBox='0 0 24 24'%3E%3Cpath d='M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z'/%3E%3C/svg%3E");
|
|
2723
2753
|
}
|
|
2724
2754
|
}
|
|
2755
|
+
|
|
2725
2756
|
@layer qti-components.interactions.corrections {
|
|
2726
2757
|
:is(:is(qti-choice-interaction qti-simple-choice):is(:state(correct-response), [data-state~='correct-response']),[data-correct-response='true']:is(qti-choice-interaction qti-simple-choice))::after {
|
|
2727
2758
|
content: '\\02714';
|
|
@@ -2798,6 +2829,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2798
2829
|
border-color: var(--qti-answer-border);
|
|
2799
2830
|
}
|
|
2800
2831
|
}
|
|
2832
|
+
|
|
2801
2833
|
@layer qti-components.interactions.base {
|
|
2802
2834
|
qti-graphic-gap-match-interaction.qti-selections-light:is(:state(dragzone-active), [data-state~='dragzone-active'])::part(drags) {
|
|
2803
2835
|
background-color: var(--qti-selections-light-bg);
|
|
@@ -2914,6 +2946,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2914
2946
|
padding: 0;
|
|
2915
2947
|
}
|
|
2916
2948
|
}
|
|
2949
|
+
|
|
2917
2950
|
@layer qti-components.interactions.states {
|
|
2918
2951
|
qti-graphic-gap-match-interaction qti-gap-img:is(:state(placeholder), [data-state~='placeholder']),
|
|
2919
2952
|
qti-graphic-gap-match-interaction qti-gap-text:is(:state(placeholder), [data-state~='placeholder']) {
|
|
@@ -2965,6 +2998,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2965
2998
|
background-color: var(--qti-drop-highlight-enabled-bg);
|
|
2966
2999
|
}
|
|
2967
3000
|
}
|
|
3001
|
+
|
|
2968
3002
|
@layer qti-components.interactions.corrections {
|
|
2969
3003
|
/*
|
|
2970
3004
|
* The one place this interaction joins the shared chip vocabulary: its chips take no card, but they
|
|
@@ -2995,6 +3029,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
2995
3029
|
box-shadow: none;
|
|
2996
3030
|
}
|
|
2997
3031
|
}
|
|
3032
|
+
|
|
2998
3033
|
@layer qti-components.interactions.base {
|
|
2999
3034
|
qti-text-entry-interaction {
|
|
3000
3035
|
background-color: var(--text-background-color, var(--qti-component-background-color));
|
|
@@ -3022,6 +3057,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3022
3057
|
background-color: transparent;
|
|
3023
3058
|
}
|
|
3024
3059
|
}
|
|
3060
|
+
|
|
3025
3061
|
@layer qti-components.interactions.corrections {
|
|
3026
3062
|
qti-text-entry-interaction:is(:state(candidate-partially-correct), [data-state~='candidate-partially-correct']) {
|
|
3027
3063
|
--text-background-color: var(--qti-partially-correct-light);
|
|
@@ -3063,6 +3099,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3063
3099
|
-webkit-mask: var(--qti-check-mask) no-repeat center / contain;
|
|
3064
3100
|
}
|
|
3065
3101
|
}
|
|
3102
|
+
|
|
3066
3103
|
@layer qti-components.interactions.base {
|
|
3067
3104
|
/*
|
|
3068
3105
|
* One block, and the ORDER inside it matters.
|
|
@@ -3142,6 +3179,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3142
3179
|
tab-size: 2;
|
|
3143
3180
|
}
|
|
3144
3181
|
}
|
|
3182
|
+
|
|
3145
3183
|
/*
|
|
3146
3184
|
* Corrections for the one interaction that cannot judge itself.
|
|
3147
3185
|
*
|
|
@@ -3270,6 +3308,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3270
3308
|
-webkit-mask: var(--qti-grip-mask) no-repeat center / contain;
|
|
3271
3309
|
}
|
|
3272
3310
|
}
|
|
3311
|
+
|
|
3273
3312
|
@layer qti-components.interactions.base {
|
|
3274
3313
|
/* No qti-selections-light / -dark here. Appendix B.1 of the QTI 3 implementation guide defines
|
|
3275
3314
|
that class pair for qti-hotspot-interaction and qti-graphic-gap-match-interaction only, and no
|
|
@@ -3542,6 +3581,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3542
3581
|
filter: var(--drag-filter, var(--qti-component-filter));
|
|
3543
3582
|
}
|
|
3544
3583
|
}
|
|
3584
|
+
|
|
3545
3585
|
@layer qti-components.interactions.states {
|
|
3546
3586
|
/* One chip vocabulary across the bank and placed drags for gap-match only. */
|
|
3547
3587
|
qti-gap::part(drag) {
|
|
@@ -3634,6 +3674,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3634
3674
|
background-color: var(--qti-drop-highlight-enabled-bg);
|
|
3635
3675
|
}
|
|
3636
3676
|
}
|
|
3677
|
+
|
|
3637
3678
|
@layer qti-components.interactions.corrections {
|
|
3638
3679
|
/* A corrected chip \u2014 in the bank, and where it landed. Moved here from the shared
|
|
3639
3680
|
qti-corrections.css, which claimed \`:state(drag)\` for EVERY interaction in one unscoped rule:
|
|
@@ -3665,6 +3706,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3665
3706
|
/* The bank is hidden by the interaction itself, on :host([answer-key]) \u2014 see
|
|
3666
3707
|
qti-gap-match-interaction.styles.ts. */
|
|
3667
3708
|
}
|
|
3709
|
+
|
|
3668
3710
|
/*
|
|
3669
3711
|
* A hotspot is indicated by a RING, not a fill \u2014 matching QTI 3's own figures (Impl-Guide Fig
|
|
3670
3712
|
* 54/55) and its shared-vocab wording ("selection lines and fills", the line being the ring).
|
|
@@ -3736,6 +3778,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3736
3778
|
outline-offset: 2px;
|
|
3737
3779
|
}
|
|
3738
3780
|
}
|
|
3781
|
+
|
|
3739
3782
|
@layer qti-components.interactions.states {
|
|
3740
3783
|
/*
|
|
3741
3784
|
* Selected: a bold, saturated ring \u2014 the Fig-54 weight jump. Same var, so poly and box shapes
|
|
@@ -3791,6 +3834,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3791
3834
|
pointer-events: none;
|
|
3792
3835
|
}
|
|
3793
3836
|
}
|
|
3837
|
+
|
|
3794
3838
|
@layer qti-components.interactions.corrections {
|
|
3795
3839
|
/*
|
|
3796
3840
|
* Correction and answer-key views recolour the same ring \u2014 one var, so circle and poly stay in
|
|
@@ -3834,6 +3878,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3834
3878
|
-webkit-mask-image: var(--qti-shape-outline-bold);
|
|
3835
3879
|
}
|
|
3836
3880
|
}
|
|
3881
|
+
|
|
3837
3882
|
@layer qti-components.interactions.base {
|
|
3838
3883
|
qti-hottext-interaction {
|
|
3839
3884
|
--qti-hottext-selected-padding: var(--qti-padding-inline);
|
|
@@ -3891,6 +3936,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3891
3936
|
box-shadow: 0 0 0 var(--qti-focus-border-width) var(--qti-focus-color);
|
|
3892
3937
|
}
|
|
3893
3938
|
}
|
|
3939
|
+
|
|
3894
3940
|
@layer qti-components.interactions.states {
|
|
3895
3941
|
:is(qti-hottext-interaction.qti-input-control-hidden qti-hottext):is(:state(checked), [data-state~='checked']) {
|
|
3896
3942
|
border-color: var(--qti-border-active);
|
|
@@ -3918,6 +3964,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3918
3964
|
cursor: not-allowed;
|
|
3919
3965
|
}
|
|
3920
3966
|
}
|
|
3967
|
+
|
|
3921
3968
|
@layer qti-components.interactions.corrections {
|
|
3922
3969
|
:is(:is(qti-hottext-interaction qti-hottext):is(:state(correct-response), [data-state~='correct-response']),[data-correct-response='true']:is(qti-hottext-interaction qti-hottext))::after {
|
|
3923
3970
|
content: '\\02714';
|
|
@@ -3983,6 +4030,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
3983
4030
|
height: 1em;
|
|
3984
4031
|
}
|
|
3985
4032
|
}
|
|
4033
|
+
|
|
3986
4034
|
@layer qti-components.interactions.base {
|
|
3987
4035
|
qti-inline-choice-interaction {
|
|
3988
4036
|
/* \u2500\u2500 Host: the closed combobox, painted through the paint contract so a brand can restyle the
|
|
@@ -4163,6 +4211,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
4163
4211
|
padding: var(--qti-padding-box);
|
|
4164
4212
|
}
|
|
4165
4213
|
}
|
|
4214
|
+
|
|
4166
4215
|
@layer qti-components.interactions.corrections {
|
|
4167
4216
|
/* The answer key, moved here from the shared qti-corrections.css: it names this interaction, so
|
|
4168
4217
|
this file owns it. */
|
|
@@ -4197,6 +4246,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
4197
4246
|
background: transparent;
|
|
4198
4247
|
}
|
|
4199
4248
|
}
|
|
4249
|
+
|
|
4200
4250
|
/* This interaction's chip vocabulary \u2014 the bank chip, the placed chip, and the floating clone. One
|
|
4201
4251
|
such block per drag-drop interaction, opt-in; graphic-gap-match deliberately declares none. See
|
|
4202
4252
|
qti-states.css. Kept in the \`global\` layer, where these rules used to live, so cascade position is
|
|
@@ -4279,6 +4329,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
4279
4329
|
-webkit-mask: var(--qti-grip-mask) no-repeat center / contain;
|
|
4280
4330
|
}
|
|
4281
4331
|
}
|
|
4332
|
+
|
|
4282
4333
|
@layer qti-components.interactions.base {
|
|
4283
4334
|
/* Editor fake-drag projected into the target choice's \`drop\` shadow.
|
|
4284
4335
|
Reuses the same \`drag\` styling so the editor preview matches what students
|
|
@@ -4616,6 +4667,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
4616
4667
|
background: none;
|
|
4617
4668
|
}
|
|
4618
4669
|
}
|
|
4670
|
+
|
|
4619
4671
|
@layer qti-components.interactions.states {
|
|
4620
4672
|
qti-match-interaction:not(.qti-match-tabular)
|
|
4621
4673
|
qti-simple-match-set:first-of-type
|
|
@@ -4684,6 +4736,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
4684
4736
|
color-mix(in srgb, var(--qti-drop-highlight-border-color) 55%, transparent);
|
|
4685
4737
|
}
|
|
4686
4738
|
}
|
|
4739
|
+
|
|
4687
4740
|
@layer qti-components.interactions.corrections {
|
|
4688
4741
|
/* A corrected chip \u2014 in the bank, and where it landed. Moved here from the shared
|
|
4689
4742
|
qti-corrections.css, which claimed \`:state(drag)\` for EVERY interaction in one unscoped rule:
|
|
@@ -4714,6 +4767,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
4714
4767
|
/* The bank is hidden by the interaction itself, on :host([answer-key]) \u2014 see
|
|
4715
4768
|
qti-match-interaction.styles.ts. */
|
|
4716
4769
|
}
|
|
4770
|
+
|
|
4717
4771
|
@layer qti-components.interactions.base {
|
|
4718
4772
|
qti-match-interaction.qti-match-tabular::part(corner) {
|
|
4719
4773
|
border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
|
|
@@ -4850,6 +4904,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
4850
4904
|
background-color: white;
|
|
4851
4905
|
}
|
|
4852
4906
|
}
|
|
4907
|
+
|
|
4853
4908
|
@layer qti-components.interactions.corrections {
|
|
4854
4909
|
/* Correct / incorrect overlays \u2014 border on the outer box, and a matching fill on the inner
|
|
4855
4910
|
indicator when checked. */
|
|
@@ -4879,6 +4934,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
4879
4934
|
background-color: var(--qti-answer-fg);
|
|
4880
4935
|
}
|
|
4881
4936
|
}
|
|
4937
|
+
|
|
4882
4938
|
/* This interaction's chip vocabulary \u2014 the bank chip, the placed chip, and the floating clone. One
|
|
4883
4939
|
such block per drag-drop interaction, opt-in; graphic-gap-match deliberately declares none. See
|
|
4884
4940
|
qti-states.css. Kept in the \`global\` layer, where these rules used to live, so cascade position is
|
|
@@ -4961,6 +5017,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
4961
5017
|
-webkit-mask: var(--qti-grip-mask) no-repeat center / contain;
|
|
4962
5018
|
}
|
|
4963
5019
|
}
|
|
5020
|
+
|
|
4964
5021
|
@layer qti-components.interactions.base {
|
|
4965
5022
|
qti-order-interaction:is(:state(dragzone-active), [data-state~='dragzone-active'])::part(drags) {
|
|
4966
5023
|
background-color: var(--qti-bg-active);
|
|
@@ -5266,6 +5323,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5266
5323
|
width: auto;
|
|
5267
5324
|
}
|
|
5268
5325
|
}
|
|
5326
|
+
|
|
5269
5327
|
@layer qti-components.interactions.states {
|
|
5270
5328
|
qti-order-interaction qti-simple-choice:is(:state(placeholder), [data-state~='placeholder']) {
|
|
5271
5329
|
/* The hole a spent/lifted chip leaves. Like the chip (see \`drag\`), it sets NO fill / border /
|
|
@@ -5307,6 +5365,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5307
5365
|
background-color: var(--qti-drop-highlight-enabled-bg);
|
|
5308
5366
|
}
|
|
5309
5367
|
}
|
|
5368
|
+
|
|
5310
5369
|
@layer qti-components.interactions.corrections {
|
|
5311
5370
|
/*
|
|
5312
5371
|
* Judgement paint, via the shared mixin \u2014 every other drag-drop interaction already uses it.
|
|
@@ -5349,6 +5408,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5349
5408
|
/* The bank is hidden by the interaction itself, on :host([answer-key]) \u2014 see
|
|
5350
5409
|
qti-order-interaction.styles.ts. */
|
|
5351
5410
|
}
|
|
5411
|
+
|
|
5352
5412
|
/* This interaction's chip vocabulary \u2014 the bank chip, the placed chip, and the floating clone. One
|
|
5353
5413
|
such block per drag-drop interaction, opt-in; graphic-gap-match deliberately declares none. See
|
|
5354
5414
|
qti-states.css. Kept in the \`global\` layer, where these rules used to live, so cascade position is
|
|
@@ -5436,6 +5496,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5436
5496
|
-webkit-mask: var(--qti-grip-mask) no-repeat center / contain;
|
|
5437
5497
|
}
|
|
5438
5498
|
}
|
|
5499
|
+
|
|
5439
5500
|
@layer qti-components.interactions.base {
|
|
5440
5501
|
/*
|
|
5441
5502
|
* NO \`--drag-border-color: transparent\` here, and that absence is the rule.
|
|
@@ -5638,6 +5699,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5638
5699
|
background-color: var(--qti-bg-active);
|
|
5639
5700
|
}
|
|
5640
5701
|
}
|
|
5702
|
+
|
|
5641
5703
|
@layer qti-components.interactions.states {
|
|
5642
5704
|
qti-simple-associable-choice::part(drag),
|
|
5643
5705
|
qti-associate-interaction::part(drag) {
|
|
@@ -5741,6 +5803,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5741
5803
|
color-mix(in srgb, var(--qti-drop-highlight-border-color) 55%, transparent);
|
|
5742
5804
|
}
|
|
5743
5805
|
}
|
|
5806
|
+
|
|
5744
5807
|
@layer qti-components.interactions.corrections {
|
|
5745
5808
|
/* A corrected chip \u2014 in the bank, and where it landed. Moved here from the shared
|
|
5746
5809
|
qti-corrections.css, which claimed \`:state(drag)\` for EVERY interaction in one unscoped rule:
|
|
@@ -5769,6 +5832,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5769
5832
|
/* The bank is hidden by the interaction itself, on :host([answer-key]) \u2014 see
|
|
5770
5833
|
qti-associate-interaction.styles.ts. */
|
|
5771
5834
|
}
|
|
5835
|
+
|
|
5772
5836
|
@layer qti-components.interactions.base {
|
|
5773
5837
|
qti-graphic-order-interaction {
|
|
5774
5838
|
--qti-graphic-order-pin-size: calc(var(--qti-select-point-marker-size, 1.5rem) * 1.2);
|
|
@@ -5858,6 +5922,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5858
5922
|
padding-top: calc(var(--qti-select-point-marker-size, 1.5rem) * 0.14);
|
|
5859
5923
|
}
|
|
5860
5924
|
}
|
|
5925
|
+
|
|
5861
5926
|
@layer qti-components.interactions.states {
|
|
5862
5927
|
:is(qti-graphic-order-interaction qti-hotspot-choice):is(:state(readonly), [data-state~='readonly']) {
|
|
5863
5928
|
cursor: pointer;
|
|
@@ -5896,6 +5961,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5896
5961
|
background-color: var(--qti-bg-active);
|
|
5897
5962
|
}
|
|
5898
5963
|
}
|
|
5964
|
+
|
|
5899
5965
|
@layer qti-components.interactions.corrections {
|
|
5900
5966
|
[shape='circle']:is(qti-graphic-order-interaction qti-hotspot-choice):is(:state(correct-response), [data-state~='correct-response']),[shape='rect']:is(qti-graphic-order-interaction qti-hotspot-choice):is(:state(correct-response), [data-state~='correct-response']),[shape='ellipse']:is(qti-graphic-order-interaction qti-hotspot-choice):is(:state(correct-response), [data-state~='correct-response']) {
|
|
5901
5967
|
background-color: color-mix(in srgb, var(--qti-answer-bg) 75%, transparent);
|
|
@@ -5928,6 +5994,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5928
5994
|
border-color: transparent !important;
|
|
5929
5995
|
}
|
|
5930
5996
|
}
|
|
5997
|
+
|
|
5931
5998
|
@layer qti-components.interactions.base {
|
|
5932
5999
|
/*
|
|
5933
6000
|
* qti-associable-hotspot does not use ActiveElementMixin, so it carries no
|
|
@@ -5945,6 +6012,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5945
6012
|
box-shadow: 0 0 0 var(--qti-focus-border-width) var(--qti-focus-color);
|
|
5946
6013
|
}
|
|
5947
6014
|
}
|
|
6015
|
+
|
|
5948
6016
|
@layer qti-components.interactions.states {
|
|
5949
6017
|
|
|
5950
6018
|
|
|
@@ -5964,12 +6032,14 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
5964
6032
|
background-color: var(--qti-bg-active);
|
|
5965
6033
|
}
|
|
5966
6034
|
}
|
|
6035
|
+
|
|
5967
6036
|
@layer qti-components.interactions.base{
|
|
5968
6037
|
qti-slider-interaction {
|
|
5969
6038
|
--qti-tick-color: rgb(229 231 235 / 100%);
|
|
5970
6039
|
--qti-tick-width: 1px;
|
|
5971
6040
|
}
|
|
5972
6041
|
}
|
|
6042
|
+
|
|
5973
6043
|
@layer qti-components.interactions.base {
|
|
5974
6044
|
qti-select-point-interaction {
|
|
5975
6045
|
/*
|
|
@@ -5991,6 +6061,7 @@ qti-slider-interaction {
|
|
|
5991
6061
|
box-shadow: 0 0 0 var(--qti-focus-border-width) var(--qti-focus-color);
|
|
5992
6062
|
}
|
|
5993
6063
|
}
|
|
6064
|
+
|
|
5994
6065
|
@layer qti-components.interactions.corrections {
|
|
5995
6066
|
/* Same knob as the resting colour above \u2014 these set \`color\` before, which stopped reaching the
|
|
5996
6067
|
marker once it was no longer painted with \`currentColor\`. */
|
|
@@ -6002,14 +6073,17 @@ qti-slider-interaction {
|
|
|
6002
6073
|
--qti-select-point-marker-color: var(--qti-incorrect);
|
|
6003
6074
|
}
|
|
6004
6075
|
}
|
|
6076
|
+
|
|
6005
6077
|
@layer qti-components.interactions.base{
|
|
6006
6078
|
qti-position-object-stage qti-position-object-interaction {
|
|
6007
6079
|
/* no styles necessary, only layout styles, defined in the component */
|
|
6008
6080
|
}
|
|
6009
6081
|
}
|
|
6082
|
+
|
|
6010
6083
|
@layer qti-components.interactions.base{
|
|
6011
6084
|
/* \`display: block\` lives in qti-prompt.styles.ts, which already declares it on :host. */
|
|
6012
6085
|
}
|
|
6086
|
+
|
|
6013
6087
|
@layer qti-components.interactions.corrections{
|
|
6014
6088
|
/*
|
|
6015
6089
|
* What is LEFT here is what the base class owns.
|
|
@@ -6081,6 +6155,7 @@ qti-slider-interaction {
|
|
|
6081
6155
|
-webkit-mask: var(--qti-check-mask) no-repeat center / contain;
|
|
6082
6156
|
}
|
|
6083
6157
|
}
|
|
6158
|
+
|
|
6084
6159
|
@layer qti-components.elements{
|
|
6085
6160
|
/* \`display: block\` is declared by the element itself, in qti-rubric-block.ts. */
|
|
6086
6161
|
qti-rubric-block {
|
|
@@ -6091,14 +6166,17 @@ qti-rubric-block {
|
|
|
6091
6166
|
margin-top: var(--qti-gap);
|
|
6092
6167
|
}
|
|
6093
6168
|
}
|
|
6169
|
+
|
|
6094
6170
|
@layer qti-components.elements{
|
|
6095
6171
|
qti-feedback-inline::part(feedback) {
|
|
6096
6172
|
}
|
|
6097
6173
|
}
|
|
6174
|
+
|
|
6098
6175
|
@layer qti-components.elements{
|
|
6099
6176
|
qti-feedback-block::part(feedback) {
|
|
6100
6177
|
}
|
|
6101
6178
|
}
|
|
6179
|
+
|
|
6102
6180
|
@layer qti-components.elements{
|
|
6103
6181
|
/*
|
|
6104
6182
|
* Neither selector below matches anything this repo renders \u2014 \`qti-modal-feedback-custom\` is not a
|
|
@@ -6117,6 +6195,7 @@ qti-feedback-block::part(feedback) {
|
|
|
6117
6195
|
margin-top: var(--qti-gap);
|
|
6118
6196
|
}
|
|
6119
6197
|
}
|
|
6198
|
+
|
|
6120
6199
|
@layer qti-components.global{
|
|
6121
6200
|
/*
|
|
6122
6201
|
* Cross-interaction custom states.
|
|
@@ -6171,8 +6250,10 @@ qti-feedback-block::part(feedback) {
|
|
|
6171
6250
|
outline-offset: 0.25rem;
|
|
6172
6251
|
}
|
|
6173
6252
|
}
|
|
6253
|
+
|
|
6174
6254
|
/* Item-shell structure (what is shown, what is hidden). Kept out of styles/qti-theme/ because it is
|
|
6175
6255
|
structure rather than paint \u2014 that directory is where the no-layout-in-theme lint rule applies. */
|
|
6256
|
+
|
|
6176
6257
|
@layer qti-components.global{
|
|
6177
6258
|
|
|
6178
6259
|
/**
|
|
@@ -6211,28 +6292,28 @@ div.full-correct-response-inline {
|
|
|
6211
6292
|
display: inline-block;
|
|
6212
6293
|
}
|
|
6213
6294
|
}
|
|
6214
|
-
`;var
|
|
6295
|
+
`;var Ue=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Et=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 Sr().load(this.testURL)).shuffleOrdering(t),r=this.closest("qti-test");if(r?.postLoadTestTransformCallback){let o=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");o&&(e=await r.postLoadTestTransformCallback(e,o))}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(Sr().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.#o(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:b``}#o(){let t=new CSSStyleSheet;t.replaceSync(Yo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
|
|
6215
6296
|
${this.#t}
|
|
6216
6297
|
<slot></slot>
|
|
6217
|
-
${
|
|
6218
|
-
`}};
|
|
6298
|
+
${Xo(this.testDoc,b`<span>Loading...</span>`)}
|
|
6299
|
+
`}};Ue([p({attribute:!1})],Et.prototype,"customElementRegistry",void 0);Ue([p({type:String,attribute:"test-url"})],Et.prototype,"testURL",void 0);Ue([_()],Et.prototype,"testDoc",void 0);Ue([_()],Et.prototype,"testXML",void 0);Ue([_(),T({context:pt,subscribe:!0})],Et.prototype,"qtiContext",void 0);Ue([$("testURL",{waitUntilFirstUpdate:!0})],Et.prototype,"handleTestURLChange",null);Ue([$("testXML",{waitUntilFirstUpdate:!0})],Et.prototype,"handleTestXMLChange",null);var Oa=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},He=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
|
|
6219
6300
|
:host {
|
|
6220
6301
|
${ft};
|
|
6221
6302
|
}
|
|
6222
6303
|
:host([disabled]) {
|
|
6223
6304
|
${gt};
|
|
6224
6305
|
}
|
|
6225
|
-
`}constructor(){super(),this.addEventListener("click",()
|
|
6306
|
+
`}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),i=e[r];if(!i){this._internalDisabled=!1;return}let o=i.maxAttempts??1,s=i.numAttempts||0;if(!i.adaptive&&i.optimal){this._internalDisabled=!0;return}if(!i.adaptive&&o>0&&s>=o){this._internalDisabled=!0;return}i.allowSkipping===!1?this._internalDisabled=i.valid===!1||i.isDefaultResponse:this._internalDisabled=!1}render(){return b` <slot></slot> `}};Oa([T({context:z,subscribe:!0}),p({attribute:!1})],He.prototype,"computedContext",void 0);Oa([p({type:Boolean,reflect:!0,attribute:"disabled"})],He.prototype,"_internalDisabled",void 0);Oa([$("computedContext")],He.prototype,"_handleTestElementChange",null);var _p=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ii=class extends C{static{this.styles=q`
|
|
6226
6307
|
:host {
|
|
6227
6308
|
${ft};
|
|
6228
6309
|
}
|
|
6229
6310
|
:host([disabled]) {
|
|
6230
6311
|
${gt};
|
|
6231
6312
|
}
|
|
6232
|
-
`}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> `}};
|
|
6233
|
-
::highlight(${
|
|
6234
|
-
::highlight(${
|
|
6235
|
-
`)),
|
|
6313
|
+
`}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> `}};_p([p({type:String,attribute:"item-id"})],Ii.prototype,"itemId",void 0);var sn=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Pa="tts-element",Jo="tts-word",Ko=null;function Tp(){return Ko||(Ko=new CSSStyleSheet,Ko.replaceSync(`
|
|
6314
|
+
::highlight(${Pa}) { background-color: #dbeafe; color: inherit; }
|
|
6315
|
+
::highlight(${Jo}) { background-color: #ffe066; color: inherit; }
|
|
6316
|
+
`)),Ko}var Jl=Symbol("tts-context"),re=class extends C{static{this.styles=q`
|
|
6236
6317
|
:host {
|
|
6237
6318
|
display: inline-block;
|
|
6238
6319
|
}
|
|
@@ -6243,46 +6324,46 @@ div.full-correct-response-inline {
|
|
|
6243
6324
|
opacity: 0.4;
|
|
6244
6325
|
cursor: default;
|
|
6245
6326
|
}
|
|
6246
|
-
`}#t=this.attachInternals();updated(t){t.has("_tts")&&(this.#t.states.clear(),this._tts?.state&&this.#t.states.add(this._tts.state))}};
|
|
6327
|
+
`}#t=this.attachInternals();updated(t){t.has("_tts")&&(this.#t.states.clear(),this._tts?.state&&this.#t.states.add(this._tts.state))}};sn([T({context:Jl,subscribe:!0})],re.prototype,"_tts",void 0);var We=class extends C{#t;#e;#r;#i;#o;#n;#s;#a;#c;#h;#l;constructor(){super(),this.language="nl-NL",this.#t=this.attachInternals(),this.#e=new Map,this.#r=this.#u.bind(this),this.#i=null,this.#o=null,this.#n=0,this.#s=[],this.#a=new Highlight,this.#c=new Highlight,this.#h=void 0,this.#l=()=>this.#v(),this._ttsContext={state:"idle",currentElementIndex:0,elementCount:0,play:()=>this.#b(),pause:()=>this.#y(),resume:()=>this.#q(),stop:()=>this.#v(),prevElement:()=>this.#C(),nextElement:()=>this.#w()}}willUpdate(t){}updated(t){let e=this._sessionContext?.navItemRefId??null;this.#h!==void 0&&this.#h!==e&&(this.#v(),this.#o=null,this.#n=0,this.#p()),this.#h=e}connectedCallback(){super.connectedCallback(),this.#d("idle"),this.#i=this.closest("test-navigation")??this.closest("qti-test")??this.getRootNode(),this.#i.addEventListener("qti-assessment-item-connected",this.#r),this.#i.addEventListener("qti-request-navigation",this.#l)}disconnectedCallback(){super.disconnectedCallback(),speechSynthesis.cancel(),this.#E(),this.#i?.removeEventListener("qti-assessment-item-connected",this.#r),this.#i?.removeEventListener("qti-request-navigation",this.#l),this.#i=null,this.#e.clear()}render(){return b`<slot></slot>`}#u(t){let e=t.detail;e?.identifier&&this.#e.set(e.identifier,e)}#d(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)}#p(){this._ttsContext={...this._ttsContext,currentElementIndex:this.#n,elementCount:this.#o?.length??0}}#m(){if(this.#o!==null)return this.#o;let t=this._sessionContext?.navItemRefId;if(!t)return[];let e=this.#e.get(t);if(!e)return[];let r=e.querySelector("qti-item-body");if(!r)return[];let i="p, h1, h2, h3, h4, h5, h6, li, blockquote, figcaption";return this.#o=Array.from(r.querySelectorAll(i)).filter(o=>(o.textContent??"").trim().length>0),this.#o}#b(){if(!this.#m().length){console.warn("test-item-to-speech: no readable elements found in qti-item-body");return}this.#f(this.#n)}#f(t){let e=this.#o??[];if(t>=e.length){this.#k(),this.#n=e.length-1,e.length>0&&this.#g(e[this.#n]),this.#d("idle"),this.#p();return}this.#n=t,this.#p();let r=e[t];r.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(r),this.#s=this.#x(r);let i=this.#s.map(s=>s.textContent??"").join("");if(!i.trim()){this.#f(t+1);return}let o=new SpeechSynthesisUtterance(i);o.lang=this.language,o.rate=1,o.onboundary=s=>{s.name==="word"&&this.#A(s.charIndex,s.charLength??0)},o.onend=()=>{this.#k(),this.#f(this.#n+1)},speechSynthesis.speak(o),this.#d("playing")}#y(){speechSynthesis.pause(),this.#d("paused")}#q(){speechSynthesis.resume(),this.#d("playing")}#v(){speechSynthesis.cancel(),this.#E(),this.#d("idle")}#C(){let t=this.#m();if(!t.length)return;speechSynthesis.cancel(),this.#k(),this.#n=Math.max(0,this.#n-1),this.#p();let e=t[this.#n];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(e),this.#d("idle")}#w(){let t=this.#m();if(!t.length)return;speechSynthesis.cancel(),this.#k(),this.#n=Math.min(t.length-1,this.#n+1),this.#p();let e=t[this.#n];e.scrollIntoView({behavior:"smooth",block:"nearest"}),this.#g(e),this.#d("idle")}#x(t){let e=[],r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),i;for(;i=r.nextNode();)(i.textContent??"").length>0&&e.push(i);return e}#g(t){if(!("highlights"in CSS))return;this.#S(),this.#a.clear();let e=new Range;e.selectNodeContents(t),this.#a.add(e),CSS.highlights.set(Pa,this.#a)}#A(t,e){if(!("highlights"in CSS))return;this.#S(),this.#c.clear();let r=this.#s.map(d=>d.textContent??"").join(""),i=t+(e>0?e:this.#I(t,r)),o=0,s=null,a=0,l=null,c=0;for(let d of this.#s){let h=d.textContent?.length??0;if(!s&&o+h>t&&(s=d,a=t-o),s&&o+h>=i){l=d,c=i-o;break}o+=h}if(s&&l){let d=new Range;d.setStart(s,a),d.setEnd(l,c),this.#c.add(d),CSS.highlights.set(Jo,this.#c)}}#k(){"highlights"in CSS&&(this.#c.clear(),CSS.highlights.delete(Jo))}#E(){"highlights"in CSS&&(this.#c.clear(),CSS.highlights.delete(Jo),this.#a.clear(),CSS.highlights.delete(Pa))}#I(t,e){let r=e.slice(t).search(/\s/);return r<0?e.length-t:r}#S(){if(!("highlights"in CSS))return;let t=Tp();document.adoptedStyleSheets.includes(t)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]);let r=(this.closest("test-navigation")?.querySelector("test-container")??this.closest("qti-test")?.querySelector("test-container"))?.shadowRoot;r&&!r.adoptedStyleSheets.includes(t)&&(r.adoptedStyleSheets=[...r.adoptedStyleSheets,t])}};sn([p({type:String})],We.prototype,"language",void 0);sn([T({context:$t,subscribe:!0})],We.prototype,"_sessionContext",void 0);sn([_(),B({context:Jl})],We.prototype,"_ttsContext",void 0);var Zo=class extends re{#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`
|
|
6247
6328
|
<button part="button" @click=${this.#t}>
|
|
6248
6329
|
${t?b`<slot name="pause">⏸</slot>`:b`<slot name="play">▶</slot>`}
|
|
6249
6330
|
</button>
|
|
6250
|
-
`}},
|
|
6331
|
+
`}},tn=class extends re{render(){return b`
|
|
6251
6332
|
<button part="button" ?disabled=${this._tts?.state!=="playing"} @click=${()=>this._tts?.pause()}>
|
|
6252
6333
|
<slot>⏸</slot>
|
|
6253
6334
|
</button>
|
|
6254
|
-
`}},
|
|
6335
|
+
`}},en=class extends re{render(){return b`
|
|
6255
6336
|
<button part="button" ?disabled=${this._tts?.state!=="paused"} @click=${()=>this._tts?.resume()}>
|
|
6256
6337
|
<slot>▶</slot>
|
|
6257
6338
|
</button>
|
|
6258
|
-
`}},
|
|
6339
|
+
`}},rn=class extends re{render(){return b`
|
|
6259
6340
|
<button part="button" ?disabled=${this._tts?.state==="idle"} @click=${()=>this._tts?.stop()}>
|
|
6260
6341
|
<slot>■</slot>
|
|
6261
6342
|
</button>
|
|
6262
|
-
`}},
|
|
6343
|
+
`}},on=class extends re{render(){let t=(this._tts?.currentElementIndex??0)===0,e=(this._tts?.elementCount??0)===0;return b`
|
|
6263
6344
|
<button part="button" ?disabled=${e||t} @click=${()=>this._tts?.prevElement()}>
|
|
6264
6345
|
<slot>◀◀</slot>
|
|
6265
6346
|
</button>
|
|
6266
|
-
`}},
|
|
6347
|
+
`}},nn=class extends re{render(){let t=(this._tts?.elementCount??0)>0&&(this._tts?.currentElementIndex??0)>=(this._tts?.elementCount??0)-1,e=(this._tts?.elementCount??0)===0;return b`
|
|
6267
6348
|
<button part="button" ?disabled=${e||t} @click=${()=>this._tts?.nextElement()}>
|
|
6268
6349
|
<slot>▶▶</slot>
|
|
6269
6350
|
</button>
|
|
6270
|
-
`}};var
|
|
6351
|
+
`}};var ve=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},st=class extends C{#t;#e;constructor(){super(),this.identifier=void 0,this.initContext=[],this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.configContext={},this.autoScoreItems=!1,this.#e=new Map,this.addEventListener("qti-assessment-test-connected",this.#a.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#h.bind(this)),this.addEventListener("qti-interaction-changed",this.#s.bind(this)),this.addEventListener("qti-item-context-updated",this.#r.bind(this)),this.addEventListener("test-end-attempt",this.#o.bind(this)),this.addEventListener("test-update-outcome-variable",this.#n.bind(this))}#r(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=this.#u(e);this.#e.set(e.identifier,r);let i=this.computedItemFor(e.identifier),o=Number(e.variables?.find(s=>s.identifier==="numAttempts")?.value)||0;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,this.#l(o,r,i?.maxAttempts))}afterAttemptEnded(t,e,r){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#i(t){return t?this.#t?.querySelector(`qti-assessment-item-ref[identifier="${t}"]`)?.assessmentItem??void 0:void 0}get activeAssessmentItem(){if(!(!this.#t||!this._sessionContext?.navItemRefId))return this.#t.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#o(t){let r=this.#t.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem,i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#n(t){this.#t.querySelector(`qti-assessment-item-ref[identifier="${t.detail.assessmentItemRefId}"]`).assessmentItem.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#s(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item"),r=e.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}}}render(){return b`<slot></slot>`}#a(t){if(this.#t=t.detail,this.#e.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.qtiContext={QTI_CONTEXT:{...i,testIdentifier:this.#t.identifier,environmentIdentifier:i.environmentIdentifier||"default"}}}this.#t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let o=this.#c(i);Object.keys(o).length>0&&(this.qtiContext={QTI_CONTEXT:{...o,...this.qtiContext.QTI_CONTEXT}})});let r=Array.from(this.#t?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:this.#t.identifier,title:this.#t.title,view:this._sessionContext?.view,testParts:r.map(i=>{let o=[...i.querySelectorAll("qti-assessment-section")],s=i.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:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,allowSkipping:a,sections:o.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),w=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:w,items:f.map(y=>{let v=y.querySelector(":scope > qti-item-session-control"),I=v?v.allowSkipping:w,S=v?v.maxAttempts:x,E=v?v.showFeedback:u,k=v?v.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:S,showFeedback:E,showSolution:k}})}})}})}}#c(t){let e={},r=t.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(o=>{let s=o.getAttribute("field-identifier"),a=o.getAttribute("base-type")||"string",l=o.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}#h(t){let e=t.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(r=>({...r,sections:r.sections.map(i=>({...i,items:i.items.map(o=>{if(o.identifier!==e.parentElement.getAttribute("identifier"))return o;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 w=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return w?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=c||d,f=!!e.querySelector("qti-response-processing");return{...o,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(i=>({...i,active:this._sessionContext?.navSectionId===i.identifier||!1,completed:i.items.every(o=>this._testContext.items.find(s=>s.identifier===o.identifier)?.variables.find(s=>s.identifier==="completionStatus").value==="completed"),items:i.items.map(o=>{let s=this._testContext?.items.find(E=>E.identifier===o.identifier),a={...o,...s,...this.initContext?.find(E=>E.identifier===o.identifier)},l=a.variables?.find(E=>E.identifier=="SCORE")?.value,c=l==null?null:parseFloat(l?.toString()),d=a.variables?.find(E=>E.identifier==="completionStatus")?.value,h=a.variables?.find(E=>E.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(E=>E.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,w=this.#i(a.identifier)?.validate(!1)??!0,u=(s?.variables?.filter(E=>E.type==="response")||[]).every(E=>{if(E.value===void 0||E.value===null)return!0;let k;switch(E.baseType){case"integer":case"float":case"duration":k="0";break;case"boolean":k="false";break;default:k="";break}let R=E.defaultValue??k;if(Array.isArray(E.value)){let N=Array.isArray(R)?R:[R];return E.value.length===N.length&&E.value.every((V,L)=>V===N[L])}return E.value===R}),g=o.categories.includes(this.configContext?.infoItemCategory)?null:e++,y=o.variables?.find(E=>E.identifier=="MAXSCORE")?.value,v=y==null?null:parseFloat(y?.toString()),I=this.#e.get(a.identifier);I===void 0&&(I=s?this.#u(s):"unscored",f>0&&this.#e.set(a.identifier,I));let S=this.#l(f,I,a.maxAttempts);return{...a,completionStatus:d,numAttempts:f,score:c,response:h,index:g,active:m,valid:w,isDefaultResponse:u,maxScore:v,done:S,optimal:this.#e.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}#l(t,e,r){if(t===0)return!1;if(e!=="suboptimal")return!0;let i=r??1;return i>0&&t>=i}#u(t){let e=t.variables??[],r=this.#d(e,"SCORE"),i=this.#d(e,"MAXSCORE");if(r!==null&&i!==null)return r>=i?"optimal":"suboptimal";let o=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return o.length===0?"unscored":o.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"}#d(t,e){let r=t?.find(o=>o.identifier===e)?.value;if(r==null||Array.isArray(r))return null;let i=parseFloat(r.toString());return Number.isNaN(i)?null:i}};ve([p({type:String})],st.prototype,"identifier",void 0);ve([_()],st.prototype,"initContext",void 0);ve([_(),B({context:pt})],st.prototype,"qtiContext",void 0);ve([_(),T({context:ht,subscribe:!0})],st.prototype,"configContext",void 0);ve([_(),T({context:ot,subscribe:!0})],st.prototype,"_testContext",void 0);ve([_(),T({context:$t,subscribe:!0})],st.prototype,"_sessionContext",void 0);ve([_(),B({context:z})],st.prototype,"computedContext",void 0);ve([p({type:Boolean,attribute:"auto-score-items"})],st.prototype,"autoScoreItems",void 0);var Ma=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Qe=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
|
|
6271
6352
|
:host {
|
|
6272
6353
|
${ft};
|
|
6273
6354
|
}
|
|
6274
6355
|
:host([disabled]) {
|
|
6275
6356
|
${gt};
|
|
6276
6357
|
}
|
|
6277
|
-
`}#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(
|
|
6278
|
-
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Zo=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;xp(this.#i);)this.#n(!0);if(kp(this.#i))return this.#a();if(Fl(this.#i))return this.#c();if(qi(this.#i))return this.#h();if(this.#i===46)return this.#l();if(this.#i===44)return this.#u();if(this.#i===58)return this.#d();if(Ep(this.#i))return this.#m();if(Sp(this.#i))return this.#b();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=jt(M.STRING,Ap(this.#o()));return this.#n(),r}#c(){do this.#n();while(qp(this.#i));let t=this.#o(),e=Cp(t)?M.KEYWORD:M.IDENTIFIER;return jt(e,t)}#h(){do this.#n();while(qi(this.#i));return this.#i===46?this.#l():jt(M.INTEGER,this.#o())}#l(){return this.#n(),qi(this.#i)?this.#p():(this.#s(),jt(M.DOT,".",Jo))}#u(){return this.#n(!0),jt(M.COMMA,",")}#d(){return this.#n(!0),jt(M.COLON,":")}#p(){do this.#n();while(qi(this.#i));return jt(M.DECIMAL,this.#o())}#m(){this.#n();let t=this.#o(2);if(wp.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),jt(M.ARROW,t);vp.indexOf(t)!==-1&&this.#n()}return t=this.#o(),jt(M.OPERATOR,t,Aa[t])}#b(){let t=String.fromCharCode(this.#i),e=jt(M.GROUPER,t,Aa[t]);return this.#n(!0),e}};var Ia=(n,t)=>new Ci(n,t).parse(),Ci=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new Zo(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.#y();t=this.#r.invoke(t,void 0,r)}else if(this._matches(M.GROUPER,"[")){let r=this.#q();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.#u(t):this.#h(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}`)}#h(t,e){if(jl.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.#w(t);if(this._matches(M.DECIMAL))return this.#x(t)}if(zl.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#d(),Jo);return this.#r.unary(t,e)}return this.#d()}#u(t){this.#o(M.OPERATOR,"?");let e=this.#s();this.#o(M.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#d(){switch(this.#t){case M.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#r.id(t);throw Ko.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case M.IDENTIFIER:return this.#b();case M.STRING:return this.#C();case M.INTEGER:return this.#w();case M.DECIMAL:return this.#x();case M.GROUPER:return this.#n==="("?this.#v():this.#n==="{"?this.#m():this.#n==="["?this.#p():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#p(){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.#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)}#b(){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.#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.#n}`);let t=this.#n;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}#q(){this.#o();let t=this.#s();return this.#o(M.GROUPER,"]"),t}#v(){let t=this.#y();if(this._matches(M.ARROW)){this.#o();let e=this.#s(),r=t?.map(i=>i.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#C(){let t=this.#r.literal(this.#n);return this.#o(),t}#w(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#x(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:Bl,fromEntries:Ip}=Object,_p={"+":(n,t)=>n+t,"-":(n,t)=>n-t,"*":(n,t)=>n*t,"/":(n,t)=>n/t,"%":(n,t)=>n%t,"==":(n,t)=>n==t,"!=":(n,t)=>n!=t,"===":(n,t)=>n===t,"!==":(n,t)=>n!==t,">":(n,t)=>n>t,">=":(n,t)=>n>=t,"<":(n,t)=>n<t,"<=":(n,t)=>n<=t,"||":(n,t)=>n||t,"&&":(n,t)=>n&&t,"??":(n,t)=>n??t,"|":(n,t)=>t(n),"|>":(n,t)=>t(n)},Tp={"+":n=>n,"-":n=>-n,"!":n=>!n},tn=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=Tp[t];return{type:"Unary",operator:t,child:e,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,r){let i=_p[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(o){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(o),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(o),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(o),c=this.left.argument.evaluate(o)):this.left.type==="ID"&&(a=o,c=this.left.value),a===void 0?void 0:a[c]=s}return i(this.left.evaluate(o),this.right.evaluate(o))},getIds(o){return this.left.getIds(o),this.right.getIds(o),o}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let o=this.receiver.evaluate(i),s=this.method?o:i?.this??i,a=this.method?o?.[e]:o,l=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,l)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(o=>o?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let o=this.entries[i];o&&(r[i]=o.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,o=this.body;return function(...s){let a=Ip(i.map((l,d)=>[l,s[d]])),c=new Proxy(r??{},{set(l,d,h){return Bl(a,d)&&(a[d]=h),l[d]=h},get(l,d){return Bl(a,d)?a[d]:l[d]}});return o.evaluate(c)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var _a=null,Ul={boundAttributeSuffix:K.M,marker:K.P,markerMatch:K.A,HTML_RESULT:K.C,getTemplateHtml:K.L,overrideDirectiveResolve:(n,t)=>class extends n{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(n,t)=>{if(n.prototype._$AS.name!==t.name){_a??=n.prototype._$AS.name;for(let e=n.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(_a))return void(e[_a]=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(n,t){n._$litDirective$=t},getAttributePartCommittedValue:(n,t,e)=>{let r=Z;return n.j=i=>r=i,n._$AI(t,n,e),r},connectedDisconnectable:n=>({...n,_$AU:!0}),resolveDirective:K.V,AttributePart:K.H,PropertyPart:K.B,BooleanAttributePart:K.N,EventPart:K.U,ElementPart:K.F,TemplateInstance:K.R,isIterable:K.D,ChildPart:K.I};var{AttributePart:Rp,PropertyPart:Op,BooleanAttributePart:Pp,EventPart:Mp}=Ul,Ra=new tn,Ta=new Map,Hl=n=>n.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),en=(n,t)=>{let e=Ta.get(n);if(e===void 0){if(Ta.has(n))return;if(n=n.trim(),n.startsWith("{{")&&n.endsWith("}}")){let r=n.substring(2,n.length-2).trim();e=new Ci(r,Ra).parse(),Ta.set(n,e)}}return e?.evaluate(t)},Dp=(n,t,e,r)=>{let i=n.getAttribute("if");if(i!==null&&en(i,t))return rn(n,t,e,r)},Wl=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Ql=n=>/(?:\\{{)|(?:\\}})/g.test(n),ki=n=>n.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Np=(n,t,e,r)=>{let i=n.getAttribute("repeat");if(i!==null){let o=en(i,t);if(!o[Symbol.iterator])return P;let s=Ei(n),a=-1,c=[];for(let l of o){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 w=m.update(d,e,r);m.type===1?h.push(...w):h.push(w)}let g={_$litType$:s,values:h};c.push(g)}return c}},Xl={if:Dp,repeat:Np},Ft=(n,t=Xl,e={},r)=>{let o=Ei(n).renderers;if(r){let a=Ei(r).renderers,c=o.super;c!==void 0?e={...o,...e,super:(l,d,h)=>(h={...a,...h,super:(g,m,w)=>rn(r,g,m,w)},c(l,d,h))}:(e={...a,...o,...e},n=r)}else e={...o,...e};return s=>rn(n,s,t,e)};var rn=(n,t,e=Xl,r={})=>{let i=Ei(n),o=[];for(let a of i.parts){let c=a.update(t,e,r);a.type===1?o.push(...c):o.push(c)}return{_$litType$:i,values:o}},Gl=new Map,Ei=n=>{let t=Gl.get(n);return t===void 0&&Gl.set(n,t=$p(n)),t},$p=n=>{let t={h:void 0,el:n.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,o=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)i++;else if(r.nodeType===Node.ELEMENT_NODE){i++;let s=r;if(s.tagName==="TEMPLATE"){let c=s.getAttribute("type"),l=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||c!==null||l!==null){s.parentNode.insertBefore(document.createComment(""),s),o.push(s);let h;if(d!==null){let g=d.trim(),m=g.startsWith("{{")&&g.endsWith("}}");h=(w,x,f)=>{let u=s.getAttribute("data"),y=u===null?void 0:en(u,w);return(m?en(g,w):f[d])?.(y,x,f)}}else c!==null?h=(g,m,w)=>{let x=m[c];return x?.(s,g,m,w)}:(l==="super"?t.renderers.super=(g,m,w)=>{let x=w.super,f=Ei(s);return w={...w,...f.renderers},x(g,m,w)}:t.renderers[l]=(g,m,w)=>rn(s,g,m,w),h=(g,m,w)=>{let x=w[l];return x?.(g,m,w)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let c of a){let l=s.getAttribute(c),d=l.split(Wl);if(d.length===1){Ql(l)&&s.setAttribute(c,ki(l));continue}s.removeAttribute(c);let h=c,g=Rp,m=c[0];m==="."?(h=Hl(c.substring(1)),g=Op):m==="?"?(h=c.substring(1),g=Pp):m==="@"&&(h=Hl(c.substring(1)),g=Mp);let w=[ki(d[0])],x=[];for(let f=1;f<d.length;f+=2){let u=d[f];x.push(Ia(u,Ra)),w.push(ki(d[f+1]))}t.parts.push({type:1,index:i,name:h,strings:w,ctor:g,update:(f,u,y)=>x.map(v=>v.evaluate(f))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,c=a.split(Wl);c.length>1?s.textContent=ki(c[0]):Ql(a)&&(s.textContent=ki(a));for(let l=1;l<c.length;l+=2){let d=c[l],h=Ia(d,Ra);t.parts.push({type:2,index:++i,update:(m,w)=>h.evaluate(m)});let g=new Text(c[l+1].replace("\\{{","{{"));s.parentNode.insertBefore(g,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=g,e.currentNode=g}}for(let s of o)s.remove();return t};var Lp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Si=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=Ft(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}))} `}};Lp([T({context:F,subscribe:!0})],Si.prototype,"computedContext",void 0);var Oa=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Be=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
|
|
6358
|
+
`}#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,i=e?.submissionMode||t.submissionMode,o=this.sectionItems[this.itemIndex],s=r==="linear"&&i==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!o?.done}_requestItem(t){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:t}}))}render(){return b`<slot></slot>`}};Ma([p({type:Boolean,reflect:!0,attribute:"disabled"})],Qe.prototype,"_internalDisabled",void 0);Ma([T({context:z,subscribe:!0})],Qe.prototype,"computedContext",void 0);Ma([$("computedContext")],Qe.prototype,"_handleTestElementChange",null);var an=["this"],Zl=["+","-","!"],td=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Da={"!":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},cn=13;var Rp=["==","!=","<=",">=","||","&&","??","|>"],Op=["===","!=="],M;(function(n){n[n.STRING=1]="STRING",n[n.IDENTIFIER=2]="IDENTIFIER",n[n.DOT=3]="DOT",n[n.COMMA=4]="COMMA",n[n.COLON=5]="COLON",n[n.INTEGER=6]="INTEGER",n[n.DECIMAL=7]="DECIMAL",n[n.OPERATOR=8]="OPERATOR",n[n.GROUPER=9]="GROUPER",n[n.KEYWORD=10]="KEYWORD",n[n.ARROW=11]="ARROW"})(M||(M={}));var Ft=(n,t,e=0)=>({kind:n,value:t,precedence:e}),Pp=n=>n===9||n===10||n===13||n===32,ed=n=>n===95||n===36||(n&=-33,65<=n&&n<=90),Mp=n=>ed(n)||_i(n),Dp=n=>an.indexOf(n)!==-1,Np=n=>n===34||n===39,_i=n=>48<=n&&n<=57,$p=n=>n===43||n===45||n===42||n===47||n===33||n===38||n===37||n===60||n===61||n===62||n===63||n===94||n===124,Lp=n=>n===40||n===41||n===91||n===93||n===123||n===125,Vp=n=>n.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
|
|
6359
|
+
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),ln=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#o()}nextToken(){for(;Pp(this.#i);)this.#o(!0);if(Np(this.#i))return this.#a();if(ed(this.#i))return this.#c();if(_i(this.#i))return this.#h();if(this.#i===46)return this.#l();if(this.#i===44)return this.#u();if(this.#i===58)return this.#d();if($p(this.#i))return this.#m();if(Lp(this.#i))return this.#b();if(this.#o(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#o(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}#n(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.#o(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#o(),this.#i===void 0))throw new Error(t);this.#o()}let r=Ft(M.STRING,Vp(this.#n()));return this.#o(),r}#c(){do this.#o();while(Mp(this.#i));let t=this.#n(),e=Dp(t)?M.KEYWORD:M.IDENTIFIER;return Ft(e,t)}#h(){do this.#o();while(_i(this.#i));return this.#i===46?this.#l():Ft(M.INTEGER,this.#n())}#l(){return this.#o(),_i(this.#i)?this.#p():(this.#s(),Ft(M.DOT,".",cn))}#u(){return this.#o(!0),Ft(M.COMMA,",")}#d(){return this.#o(!0),Ft(M.COLON,":")}#p(){do this.#o();while(_i(this.#i));return Ft(M.DECIMAL,this.#n())}#m(){this.#o();let t=this.#n(2);if(Op.indexOf(t)!==-1)this.#o(),this.#o();else{if(t=this.#n(1),t==="=>")return this.#o(),Ft(M.ARROW,t);Rp.indexOf(t)!==-1&&this.#o()}return t=this.#n(),Ft(M.OPERATOR,t,Da[t])}#b(){let t=String.fromCharCode(this.#i),e=Ft(M.GROUPER,t,Da[t]);return this.#o(!0),e}};var Na=(n,t)=>new Ti(n,t).parse(),Ti=class{#t;#e;#r;#i;#o;constructor(t,e){this.#e=new ln(t),this.#r=e}parse(){return this.#n(),this.#s()}#n(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.#o=r?.value}_matches(t,e){return!(t&&this.#t!==t||e&&this.#o!==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.#y();t=this.#r.invoke(t,void 0,r)}else if(this._matches(M.GROUPER,"[")){let r=this.#q();t=this.#r.index(t,r)}else if(this._matches(M.DOT)){this.#n();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.#o==="?"?this.#u(t):this.#h(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}`)}#h(t,e){if(td.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#n();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.#o;if(this.#n(),t==="+"||t==="-"){if(this._matches(M.INTEGER))return this.#w(t);if(this._matches(M.DECIMAL))return this.#x(t)}if(Zl.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#d(),cn);return this.#r.unary(t,e)}return this.#d()}#u(t){this.#n(M.OPERATOR,"?");let e=this.#s();this.#n(M.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#d(){switch(this.#t){case M.KEYWORD:let t=this.#o;if(t==="this")return this.#n(),this.#r.id(t);throw an.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case M.IDENTIFIER:return this.#b();case M.STRING:return this.#C();case M.INTEGER:return this.#w();case M.DECIMAL:return this.#x();case M.GROUPER:return this.#o==="("?this.#v():this.#o==="{"?this.#m():this.#o==="["?this.#p():void 0;case M.COLON:throw new Error('unexpected token ":"');default:return}}#p(){let t=[];do{if(this.#n(),this._matches(M.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(M.COMMA));return this.#n(M.GROUPER,"]"),this.#r.list(t)}#m(){let t={};do{if(this.#n(),this._matches(M.GROUPER,"}"))break;let e=this.#o;(this._matches(M.STRING)||this._matches(M.IDENTIFIER))&&this.#n(),this.#n(M.COLON),t[e]=this.#s()}while(this._matches(M.COMMA));return this.#n(M.GROUPER,"}"),this.#r.map(t)}#b(){let t=this.#o;if(t==="true")return this.#n(),this.#r.literal(!0);if(t==="false")return this.#n(),this.#r.literal(!1);if(t==="null")return this.#n(),this.#r.literal(null);if(t==="undefined")return this.#n(),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.#o}`);let t=this.#o;return this.#n(),this.#r.id(t)}#y(){if(!this._matches(M.GROUPER,"("))return;let t=[];do{if(this.#n(),this._matches(M.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(M.COMMA));return this.#n(M.GROUPER,")"),t}#q(){this.#n();let t=this.#s();return this.#n(M.GROUPER,"]"),t}#v(){let t=this.#y();if(this._matches(M.ARROW)){this.#n();let e=this.#s(),r=t?.map(i=>i.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#C(){let t=this.#r.literal(this.#o);return this.#n(),t}#w(t=""){let e=this.#r.literal(parseInt(`${t}${this.#o}`,10));return this.#n(),e}#x(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#o}`));return this.#n(),e}};var{hasOwn:rd,fromEntries:zp}=Object,jp={"+":(n,t)=>n+t,"-":(n,t)=>n-t,"*":(n,t)=>n*t,"/":(n,t)=>n/t,"%":(n,t)=>n%t,"==":(n,t)=>n==t,"!=":(n,t)=>n!=t,"===":(n,t)=>n===t,"!==":(n,t)=>n!==t,">":(n,t)=>n>t,">=":(n,t)=>n>=t,"<":(n,t)=>n<t,"<=":(n,t)=>n<=t,"||":(n,t)=>n||t,"&&":(n,t)=>n&&t,"??":(n,t)=>n??t,"|":(n,t)=>t(n),"|>":(n,t)=>t(n)},Fp={"+":n=>n,"-":n=>-n,"!":n=>!n},dn=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=Fp[t];return{type:"Unary",operator:t,child:e,evaluate(i){return r(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(t,e,r){let i=jp[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(o){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(o),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(o),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(o),l=this.left.argument.evaluate(o)):this.left.type==="ID"&&(a=o,l=this.left.value),a===void 0?void 0:a[l]=s}return i(this.left.evaluate(o),this.right.evaluate(o))},getIds(o){return this.left.getIds(o),this.right.getIds(o),o}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let o=this.receiver.evaluate(i),s=this.method?o:i?.this??i,a=this.method?o?.[e]:o,c=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,c)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(o=>o?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let o=this.entries[i];o&&(r[i]=o.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,o=this.body;return function(...s){let a=zp(i.map((c,d)=>[c,s[d]])),l=new Proxy(r??{},{set(c,d,h){return rd(a,d)&&(a[d]=h),c[d]=h},get(c,d){return rd(a,d)?a[d]:c[d]}});return o.evaluate(l)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var $a=null,id={boundAttributeSuffix:K.M,marker:K.P,markerMatch:K.A,HTML_RESULT:K.C,getTemplateHtml:K.L,overrideDirectiveResolve:(n,t)=>class extends n{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(n,t)=>{if(n.prototype._$AS.name!==t.name){$a??=n.prototype._$AS.name;for(let e=n.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty($a))return void(e[$a]=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(n,t){n._$litDirective$=t},getAttributePartCommittedValue:(n,t,e)=>{let r=Z;return n.j=i=>r=i,n._$AI(t,n,e),r},connectedDisconnectable:n=>({...n,_$AU:!0}),resolveDirective:K.V,AttributePart:K.H,PropertyPart:K.B,BooleanAttributePart:K.N,EventPart:K.U,ElementPart:K.F,TemplateInstance:K.R,isIterable:K.D,ChildPart:K.I};var{AttributePart:Bp,PropertyPart:Up,BooleanAttributePart:Hp,EventPart:Wp}=id,Va=new dn,La=new Map,od=n=>n.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),hn=(n,t)=>{let e=La.get(n);if(e===void 0){if(La.has(n))return;if(n=n.trim(),n.startsWith("{{")&&n.endsWith("}}")){let r=n.substring(2,n.length-2).trim();e=new Ti(r,Va).parse(),La.set(n,e)}}return e?.evaluate(t)},Qp=(n,t,e,r)=>{let i=n.getAttribute("if");if(i!==null&&hn(i,t))return pn(n,t,e,r)},nd=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,sd=n=>/(?:\\{{)|(?:\\}})/g.test(n),Ri=n=>n.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Gp=(n,t,e,r)=>{let i=n.getAttribute("repeat");if(i!==null){let o=hn(i,t);if(!o[Symbol.iterator])return P;let s=Oi(n),a=-1,l=[];for(let c of o){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 w=m.update(d,e,r);m.type===1?h.push(...w):h.push(w)}let f={_$litType$:s,values:h};l.push(f)}return l}},cd={if:Qp,repeat:Gp},Bt=(n,t=cd,e={},r)=>{let o=Oi(n).renderers;if(r){let a=Oi(r).renderers,l=o.super;l!==void 0?e={...o,...e,super:(c,d,h)=>(h={...a,...h,super:(f,m,w)=>pn(r,f,m,w)},l(c,d,h))}:(e={...a,...o,...e},n=r)}else e={...o,...e};return s=>pn(n,s,t,e)};var pn=(n,t,e=cd,r={})=>{let i=Oi(n),o=[];for(let a of i.parts){let l=a.update(t,e,r);a.type===1?o.push(...l):o.push(l)}return{_$litType$:i,values:o}},ad=new Map,Oi=n=>{let t=ad.get(n);return t===void 0&&ad.set(n,t=Xp(n)),t},Xp=n=>{let t={h:void 0,el:n.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,o=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)i++;else if(r.nodeType===Node.ELEMENT_NODE){i++;let s=r;if(s.tagName==="TEMPLATE"){let l=s.getAttribute("type"),c=s.getAttribute("name"),d=s.getAttribute("call");if(d!==null||l!==null||c!==null){s.parentNode.insertBefore(document.createComment(""),s),o.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(w,x,u)=>{let g=s.getAttribute("data"),y=g===null?void 0:hn(g,w);return(m?hn(f,w):u[d])?.(y,x,u)}}else l!==null?h=(f,m,w)=>{let x=m[l];return x?.(s,f,m,w)}:(c==="super"?t.renderers.super=(f,m,w)=>{let x=w.super,u=Oi(s);return w={...w,...u.renderers},x(f,m,w)}:t.renderers[c]=(f,m,w)=>pn(s,f,m,w),h=(f,m,w)=>{let x=w[c];return x?.(f,m,w)});t.parts.push({type:2,index:i,update:h});continue}}let a=s.getAttributeNames();for(let l of a){let c=s.getAttribute(l),d=c.split(nd);if(d.length===1){sd(c)&&s.setAttribute(l,Ri(c));continue}s.removeAttribute(l);let h=l,f=Bp,m=l[0];m==="."?(h=od(l.substring(1)),f=Up):m==="?"?(h=l.substring(1),f=Hp):m==="@"&&(h=od(l.substring(1)),f=Wp);let w=[Ri(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(Na(g,Va)),w.push(Ri(d[u+1]))}t.parts.push({type:1,index:i,name:h,strings:w,ctor:f,update:(u,g,y)=>x.map(v=>v.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,l=a.split(nd);l.length>1?s.textContent=Ri(l[0]):sd(a)&&(s.textContent=Ri(a));for(let c=1;c<l.length;c+=2){let d=l[c],h=Na(d,Va);t.parts.push({type:2,index:++i,update:(m,w)=>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 o)s.remove();return t};var Yp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Pi=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=Bt(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}))} `}};Yp([T({context:z,subscribe:!0})],Pi.prototype,"computedContext",void 0);var za=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ge=class extends C{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=q`
|
|
6279
6360
|
:host {
|
|
6280
6361
|
${ft};
|
|
6281
6362
|
}
|
|
6282
6363
|
:host([disabled]) {
|
|
6283
6364
|
${gt};
|
|
6284
6365
|
}
|
|
6285
|
-
`}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(i=>i.active),r=t?.sections.find(i=>i.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>`}};
|
|
6366
|
+
`}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(i=>i.active),r=t?.sections.find(i=>i.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>`}};za([p({type:Boolean,reflect:!0,attribute:"disabled"})],Ge.prototype,"_internalDisabled",void 0);za([T({context:z,subscribe:!0})],Ge.prototype,"computedContext",void 0);za([$("computedContext")],Ge.prototype,"_handleTestElementChange",null);var Kp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Mi=class extends C{render(){return b` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};Kp([_(),T({context:z,subscribe:!0})],Mi.prototype,"computedContext",void 0);var Jp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Di=class extends C{static{this.styles=q`
|
|
6286
6367
|
table {
|
|
6287
6368
|
width: 100%;
|
|
6288
6369
|
border-collapse: collapse;
|
|
@@ -6316,28 +6397,28 @@ div.full-correct-response-inline {
|
|
|
6316
6397
|
</tr>
|
|
6317
6398
|
</thead>
|
|
6318
6399
|
<tbody>
|
|
6319
|
-
${o.map(a=>{let
|
|
6400
|
+
${o.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`
|
|
6320
6401
|
<tr>
|
|
6321
6402
|
<td>${a.identifier}</td>
|
|
6322
6403
|
<td>${Array.isArray(a.value)?a.value.join(", "):a.value}</td>
|
|
6323
6404
|
<td>${a.cardinality}</td>
|
|
6324
6405
|
<td>${a.baseType}</td>
|
|
6325
|
-
<td>${c||
|
|
6406
|
+
<td>${l||c||d}</td>
|
|
6326
6407
|
</tr>
|
|
6327
6408
|
`})}
|
|
6328
6409
|
</tbody>
|
|
6329
6410
|
</table>
|
|
6330
6411
|
`;return b`
|
|
6331
6412
|
${i(e,"Response Variables")} ${i(r,"Outcome Variables")}
|
|
6332
|
-
`}};
|
|
6413
|
+
`}};Jp([T({context:z,subscribe:!0})],Di.prototype,"computedContext",void 0);var ja=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Xe=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=Bt(t)}#t(t){let i=(this.computedContext?.testParts.find(o=>o.active)).sections.flatMap(o=>o.items).find(o=>o.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:i,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"),i=r?.value,o=r?.externalScored!=="human";if(!e||!r)return P;let s=[...Array(Number(e)+1).keys()];return b`${this.myTemplate?this.myTemplate({scores:s,score:i,disabled:o}):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)})}};ja([p({type:String,attribute:"view"})],Xe.prototype,"view",void 0);ja([p({type:Boolean})],Xe.prototype,"disabled",void 0);ja([T({context:z,subscribe:!0})],Xe.prototype,"computedContext",void 0);var ld=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Or=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"),i=parseFloat(r?.value),o=t.externalScored;return b`<div>${e!=="completed"?this.dataset.textNoResponse:!o&&i!==void 0&&!Number.isNaN(i)?i>0?this.dataset.textCorrect:this.dataset.textIncorrect:o==="externalMachine"?Number.isNaN(i)||i===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${i===0?"geen punten":i==1?"\xE9\xE9n punt":`${i} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:o==="human"?Number.isNaN(i)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};ld([T({context:z,subscribe:!0})],Or.prototype,"computedContext",void 0);ld([p({type:String,attribute:"view"})],Or.prototype,"view",void 0);var Zp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ni=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=Bt(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}))} `}};Zp([T({context:z,subscribe:!0})],Ni.prototype,"computedContext",void 0);var tu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},$i=class extends C{static{this.styles=q`
|
|
6333
6414
|
:host {
|
|
6334
6415
|
${ft};
|
|
6335
6416
|
}
|
|
6336
6417
|
:host([disabled]) {
|
|
6337
6418
|
${gt};
|
|
6338
6419
|
}
|
|
6339
|
-
`}#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> `}};
|
|
6340
|
-
${this.myTemplate?this.myTemplate(this.stampContext):P}`}};
|
|
6420
|
+
`}#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> `}};tu([p({type:String,attribute:"section-id"})],$i.prototype,"sectionId",void 0);var Fa=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ye=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=Bt(t)}willUpdate(t){if(!this.computedContext)return;let e=this.computedContext.testParts.find(h=>h.active),r=e?.sections.find(h=>h.active),i=r?.items.find(h=>h.active),{variables:o,...s}=i||{};if(!e||!r||!i)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}
|
|
6421
|
+
${this.myTemplate?this.myTemplate(this.stampContext):P}`}};Fa([p({type:Boolean,reflect:!0})],Ye.prototype,"debug",void 0);Fa([_(),T({context:z,subscribe:!0})],Ye.prototype,"computedContext",void 0);Fa([_()],Ye.prototype,"stampContext",void 0);var Li=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},un,Ut=class extends C{constructor(){super(...arguments),this.label="view",this._handleViewOptionsChange=()=>{this.#t()},this._viewOptions=un.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=>un.DEFAULT_VIEW_OPTIONS.includes(e))}else this._viewOptions=un.DEFAULT_VIEW_OPTIONS}_switchView(t){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:t}))}render(){return b`
|
|
6341
6422
|
<label part="label" for="viewSelect">${this.label}</label>
|
|
6342
6423
|
<select
|
|
6343
6424
|
part="select"
|
|
@@ -6346,11 +6427,11 @@ div.full-correct-response-inline {
|
|
|
6346
6427
|
>
|
|
6347
6428
|
${this._viewOptions.map(t=>b`<option value="${t}" ?selected=${t===this.sessionContext.view}>${t}</option>`)}
|
|
6348
6429
|
</select>
|
|
6349
|
-
`}};
|
|
6430
|
+
`}};un=Ut;Li([T({context:$t,subscribe:!0})],Ut.prototype,"sessionContext",void 0);Li([p({type:String})],Ut.prototype,"label",void 0);Li([p({type:String,attribute:"view-options"})],Ut.prototype,"viewOptions",void 0);Li([$("viewOptions",{waitUntilFirstUpdate:!0})],Ut.prototype,"_handleViewOptionsChange",void 0);Li([_()],Ut.prototype,"_viewOptions",void 0);var eu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Vi=class extends C{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let t=this.querySelector("template");if(!t){this.myTemplate=null;return}this.myTemplate=Bt(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}`}};eu([T({context:$t,subscribe:!0})],Vi.prototype,"sessionContext",void 0);var dd=[{tag:"qti-assessment-item-ref",ctor:Dt},{tag:"qti-assessment-section",ctor:mt},{tag:"qti-assessment-test",ctor:je},{tag:"qti-item-session-control",ctor:Ct},{tag:"qti-outcome-processing",ctor:Io},{tag:"qti-test",ctor:Be},{tag:"qti-test-feedback",ctor:Uo},{tag:"qti-test-part",ctor:ye},{tag:"qti-test-variables",ctor:Ai},{tag:"test-check-item",ctor:Rr},{tag:"test-container",ctor:Et},{tag:"test-end-attempt",ctor:He},{tag:"test-item-link",ctor:Ii},{tag:"test-item-to-speech",ctor:We},{tag:"test-navigation",ctor:st},{tag:"test-next",ctor:Qe},{tag:"test-paging-buttons-stamp",ctor:Pi},{tag:"test-prev",ctor:Ge},{tag:"test-print-context",ctor:Mi},{tag:"test-print-item-variables",ctor:Di},{tag:"test-scoring-buttons",ctor:Xe},{tag:"test-scoring-feedback",ctor:Or},{tag:"test-section-buttons-stamp",ctor:Ni},{tag:"test-section-link",ctor:$i},{tag:"test-stamp",ctor:Ye},{tag:"test-tts-next",ctor:nn},{tag:"test-tts-pause",ctor:tn},{tag:"test-tts-play",ctor:Zo},{tag:"test-tts-prev",ctor:on},{tag:"test-tts-resume",ctor:en},{tag:"test-tts-stop",ctor:rn},{tag:"test-view",ctor:Ut},{tag:"test-view-toggle",ctor:Vi}];for(let{tag:n,ctor:t}of dd)customElements.get(n)||customElements.define(n,t);var Ke=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},St=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 zt().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=zt().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(Yo),this.shadowRoot.adoptedStyleSheets=[t]}render(){return b`
|
|
6350
6431
|
${this.#t}
|
|
6351
6432
|
<slot></slot>
|
|
6352
|
-
${
|
|
6353
|
-
`}};
|
|
6433
|
+
${Xo(this.itemDoc,b`<span>Loading...</span>`)}
|
|
6434
|
+
`}};Ke([p({attribute:!1})],St.prototype,"customElementRegistry",void 0);Ke([p({type:String,attribute:"item-url"})],St.prototype,"itemURL",void 0);Ke([_()],St.prototype,"itemDoc",void 0);Ke([_()],St.prototype,"itemXML",void 0);Ke([_(),T({context:pt,subscribe:!0})],St.prototype,"qtiContext",void 0);Ke([$("itemURL",{waitUntilFirstUpdate:!0})],St.prototype,"handleItemURLChange",null);Ke([$("itemXML",{waitUntilFirstUpdate:!0})],St.prototype,"handleItemXMLChange",null);var ru=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},zi=class extends C{static{this.styles=q`
|
|
6354
6435
|
table {
|
|
6355
6436
|
width: 100%;
|
|
6356
6437
|
border-collapse: collapse;
|
|
@@ -6384,20 +6465,20 @@ div.full-correct-response-inline {
|
|
|
6384
6465
|
</tr>
|
|
6385
6466
|
</thead>
|
|
6386
6467
|
<tbody>
|
|
6387
|
-
${o.map(a=>{let
|
|
6468
|
+
${o.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`
|
|
6388
6469
|
<tr>
|
|
6389
6470
|
<td>${a.identifier}</td>
|
|
6390
6471
|
<td>${Array.isArray(a.value)?a.value.join(", "):a.value}</td>
|
|
6391
6472
|
<td>${a.cardinality}</td>
|
|
6392
6473
|
<td>${a.baseType}</td>
|
|
6393
|
-
<td>${c||
|
|
6474
|
+
<td>${l||c||d}</td>
|
|
6394
6475
|
</tr>
|
|
6395
6476
|
`})}
|
|
6396
6477
|
</tbody>
|
|
6397
6478
|
</table>
|
|
6398
6479
|
`;return b`
|
|
6399
6480
|
${i(e,"Response Variables")} ${i(r,"Outcome Variables")}
|
|
6400
|
-
`}};
|
|
6481
|
+
`}};ru([T({context:pe,subscribe:!0})],zi.prototype,"computedContext",void 0);var Ba=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ie=class extends 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.#o(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.#o(this.assessmentItem.identifier,e||[])}#o(t,e){let r=e?.find(c=>c.identifier=="SCORE")?.value,i=parseFloat(r?.toString()),o=e?.find(c=>c.identifier==="completionStatus")?.value,s=i!==void 0&&!isNaN(i)&&i>0,a=i!==void 0&&!isNaN(i)&&i<=0,l=o==="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)}};Ba([_(),B({context:pe})],ie.prototype,"computedContext",void 0);Ba([_(),B({context:ht})],ie.prototype,"configContext",void 0);Ba([_(),B({context:pt})],ie.prototype,"qtiContext",void 0);var hd=[{tag:"item-container",ctor:St},{tag:"item-print-variables",ctor:zi},{tag:"qti-item",ctor:ie}];for(let{tag:n,ctor:t}of hd)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Bl)customElements.get(n)||customElements.define(n,t);var pd=(n,t,e)=>{let r=new Map;for(let i=t;i<=e;i++)r.set(n[i],i);return r},H=kt(class extends me{constructor(n){if(super(n),n.type!==wr.CHILD)throw Error("repeat() can only be used in text expressions")}dt(n,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let i=[],o=[],s=0;for(let a of n)i[s]=r?r(a,s):s,o[s]=e(a,s),s++;return{values:o,keys:i}}render(n,t,e){return this.dt(n,t,e).values}update(n,[t,e,r]){let i=wl(n),{values:o,keys:s}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=s,o;let a=this.ut??=[],l=[],c,d,h=0,f=i.length-1,m=0,w=o.length-1;for(;h<=f&&m<=w;)if(i[h]===null)h++;else if(i[f]===null)f--;else if(a[h]===s[m])l[m]=fe(i[h],o[m]),h++,m++;else if(a[f]===s[w])l[w]=fe(i[f],o[w]),f--,w--;else if(a[h]===s[w])l[w]=fe(i[h],o[w]),xr(n,l[w+1],i[h]),h++,w--;else if(a[f]===s[m])l[m]=fe(i[f],o[m]),xr(n,i[h],i[f]),f--,m++;else if(c===void 0&&(c=pd(s,m,w),d=pd(a,h,f)),c.has(a[h]))if(c.has(a[f])){let x=d.get(s[m]),u=x!==void 0?i[x]:null;if(u===null){let g=xr(n,i[h]);fe(g,o[m]),l[m]=g}else l[m]=fe(u,o[m]),xr(n,i[h],u),i[x]=null;m++}else _o(i[f]),f--;else _o(i[h]),h++;for(;m<=w;){let x=xr(n,l[w+1]);fe(x,o[m]),l[m++]=x}for(;h<=f;){let x=i[h++];x!==null&&_o(x)}return this.ut=s,vl(n,l),Z}});var we=Symbol("dragDropContext");var ud=[O,Lt,q`
|
|
6401
6482
|
/* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
|
|
6402
6483
|
custom properties on its host; the properties themselves live here. */
|
|
6403
6484
|
:host {
|
|
@@ -6415,9 +6496,9 @@ div.full-correct-response-inline {
|
|
|
6415
6496
|
width: 100%;
|
|
6416
6497
|
height: 100%;
|
|
6417
6498
|
}
|
|
6418
|
-
`];var
|
|
6499
|
+
`];var md=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Pr=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=ud}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">
|
|
6419
6500
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6420
|
-
</div>`}};
|
|
6501
|
+
</div>`}};md([p({type:String,reflect:!0})],Pr.prototype,"identifier",void 0);md([T({context:we,subscribe:!0}),_()],Pr.prototype,"_dragDrop",void 0);var fd=[{tag:"qti-associable-hotspot",ctor:Pr}];var gd=[O,Lt,q`
|
|
6421
6502
|
/*
|
|
6422
6503
|
* A drop target. The interaction measures its chips and publishes the result as custom
|
|
6423
6504
|
* properties on its own host; the actual CSS properties live here, not in a style attribute.
|
|
@@ -6462,9 +6543,9 @@ div.full-correct-response-inline {
|
|
|
6462
6543
|
min-height: var(--qti-dropzone-min-height, 0);
|
|
6463
6544
|
min-width: var(--qti-dropzone-min-width, 0);
|
|
6464
6545
|
}
|
|
6465
|
-
`];var
|
|
6546
|
+
`];var Ua=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Je=class extends C{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=gd}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`<div part="drop">
|
|
6466
6547
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6467
|
-
</div>`}};
|
|
6548
|
+
</div>`}};Ua([p({type:Number,reflect:!0})],Je.prototype,"tabindex",void 0);Ua([p({type:String,reflect:!0})],Je.prototype,"identifier",void 0);Ua([T({context:we,subscribe:!0}),_()],Je.prototype,"_dragDrop",void 0);var bd=[{tag:"qti-gap",ctor:Je}];var yd=[O,q`
|
|
6468
6549
|
/* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
|
|
6469
6550
|
graphic-gap-match rules, on the host from the document. */
|
|
6470
6551
|
:host {
|
|
@@ -6473,7 +6554,7 @@ div.full-correct-response-inline {
|
|
|
6473
6554
|
justify-content: center;
|
|
6474
6555
|
user-select: none;
|
|
6475
6556
|
}
|
|
6476
|
-
`];var
|
|
6557
|
+
`];var iu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ji=class extends C{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=yd}connectedCallback(){this.setAttribute("slot","drags")}};iu([p({type:Number,reflect:!0})],ji.prototype,"tabindex",void 0);var vd=[{tag:"qti-gap-img",ctor:ji}];var Ze=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},wd={toAttribute:n=>n?"true":"false",fromAttribute:n=>n==="true"};function bt(n,t){class e extends n{#t;#e(){let o=this._interactionContext?.choiceRole??null;o!==this.#t&&(this.#t&&this.internals.states.delete(this.#t),this.#t=o,this.internals.role=o,o&&this.internals.states.add(o))}handleDisabledChange(i,o){o?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=o?-1:0}handleReadonlyChange(i,o){o?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...i){super(...i),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=null,this.internals=this.attachInternals()}willUpdate(i){super.willUpdate(i),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(i){i.altKey||(i.code==="Space"||i.code==="Enter")&&(i.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 Ze([p({type:String})],e.prototype,"identifier",void 0),Ze([p({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",void 0),Ze([p({type:Boolean,attribute:"aria-disabled",converter:wd})],e.prototype,"disabled",void 0),Ze([p({type:Boolean,attribute:"aria-readonly",converter:wd})],e.prototype,"readonly",void 0),Ze([T({context:gr,subscribe:!0}),_()],e.prototype,"_interactionContext",void 0),Ze([$("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",null),Ze([$("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"handleReadonlyChange",null),e}var xd=[O,q`
|
|
6477
6558
|
/*
|
|
6478
6559
|
* A chip's own box. Both drag-drop interactions that use this element laid it out from the
|
|
6479
6560
|
* theme — gap-match with 'display: flex !important; align-items: center !important',
|
|
@@ -6504,8 +6585,20 @@ div.full-correct-response-inline {
|
|
|
6504
6585
|
justify-content: var(--qti-drag-justify-content, normal);
|
|
6505
6586
|
user-select: none;
|
|
6506
6587
|
}
|
|
6507
|
-
|
|
6508
|
-
|
|
6588
|
+
|
|
6589
|
+
/*
|
|
6590
|
+
* The control div's only content is the theme's ::before grip glyph. Centering it with
|
|
6591
|
+
* 'vertical-align: middle' (the theme's only lever on a pseudo-element it owns) aligns to the
|
|
6592
|
+
* line box's baseline metrics, which drift with font/line-height. Flex centering here is
|
|
6593
|
+
* geometric and font-independent — the same fix qti-simple-choice already has for its control.
|
|
6594
|
+
*/
|
|
6595
|
+
[part='control'] {
|
|
6596
|
+
display: flex;
|
|
6597
|
+
align-items: center;
|
|
6598
|
+
justify-content: center;
|
|
6599
|
+
}
|
|
6600
|
+
`];var ou=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},xe=class extends bt(C,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=xd}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return b`<div part="control"></div>
|
|
6601
|
+
<slot part="label"></slot>`}};ou([p({type:Number,reflect:!0})],xe.prototype,"tabindex",void 0);var qd=[{tag:"qti-gap-text",ctor:xe}];var Cd=[O,q`
|
|
6509
6602
|
:host {
|
|
6510
6603
|
display: flex;
|
|
6511
6604
|
user-select: none;
|
|
@@ -6525,7 +6618,7 @@ div.full-correct-response-inline {
|
|
|
6525
6618
|
display: grid;
|
|
6526
6619
|
place-content: center;
|
|
6527
6620
|
}
|
|
6528
|
-
`];var
|
|
6621
|
+
`];var nu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},tr=class extends bt(C,"qti-hotspot-choice"){static{this.styles=Cd}};nu([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],tr.prototype,"order",void 0);var kd=[{tag:"qti-hotspot-choice",ctor:tr}];var Ed=[O,q`
|
|
6529
6622
|
/* 'position: relative' is the containing block for the answer-key tick the theme draws as an
|
|
6530
6623
|
absolutely positioned ::before. See CONTRACT.md §7. */
|
|
6531
6624
|
:host {
|
|
@@ -6545,8 +6638,8 @@ div.full-correct-response-inline {
|
|
|
6545
6638
|
[part='control'] {
|
|
6546
6639
|
display: none;
|
|
6547
6640
|
}
|
|
6548
|
-
`];var
|
|
6549
|
-
<slot part="label"></slot>`}};var
|
|
6641
|
+
`];var er=class extends bt(C,"qti-hottext"){static{this.styles=Ed}render(){return b`<div part="control"><div part="control-mark"></div></div>
|
|
6642
|
+
<slot part="label"></slot>`}};var Sd=[{tag:"qti-hottext",ctor:er}];var su=q`
|
|
6550
6643
|
/*
|
|
6551
6644
|
* An option row: one line, clipped, with its text centred against the row's min-height. All four
|
|
6552
6645
|
* were in the theme, set on this host from the document — which is also why the 'display: block'
|
|
@@ -6563,13 +6656,13 @@ div.full-correct-response-inline {
|
|
|
6563
6656
|
slot {
|
|
6564
6657
|
display: inline;
|
|
6565
6658
|
}
|
|
6566
|
-
`,
|
|
6659
|
+
`,Ad=su;var au=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Fi=class extends bt(C,"qti-inline-choice"){static{this.styles=Ad}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}}))}};au([p({type:String})],Fi.prototype,"identifier",void 0);var Id=[{tag:"qti-inline-choice",ctor:Fi}];var _d=[O,q`
|
|
6567
6660
|
:host {
|
|
6568
6661
|
display: block;
|
|
6569
6662
|
margin: var(--qti-gap) 0;
|
|
6570
6663
|
width: 100%;
|
|
6571
6664
|
}
|
|
6572
|
-
`];var
|
|
6665
|
+
`];var mn=class extends C{static{this.styles=_d}render(){return b`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var Td=[{tag:"qti-prompt",ctor:mn}];var Rd=[O,Lt,q`
|
|
6573
6666
|
/*
|
|
6574
6667
|
* 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
|
|
6575
6668
|
* way. In tabular match this element is a light-DOM *grandchild* of the slotted
|
|
@@ -6706,13 +6799,25 @@ div.full-correct-response-inline {
|
|
|
6706
6799
|
::slotted(p) {
|
|
6707
6800
|
display: inline;
|
|
6708
6801
|
}
|
|
6709
|
-
|
|
6802
|
+
|
|
6803
|
+
/*
|
|
6804
|
+
* The control div's only content is the theme's ::before grip glyph. Centering it with
|
|
6805
|
+
* 'vertical-align: middle' (the theme's only lever on a pseudo-element it owns) aligns to the
|
|
6806
|
+
* line box's baseline metrics, which drift with font/line-height. Flex centering here is
|
|
6807
|
+
* geometric and font-independent — the same fix qti-simple-choice already has for its control.
|
|
6808
|
+
*/
|
|
6809
|
+
[part='control'] {
|
|
6810
|
+
display: flex;
|
|
6811
|
+
align-items: center;
|
|
6812
|
+
justify-content: center;
|
|
6813
|
+
}
|
|
6814
|
+
`];var fn=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},At=class extends bt(C,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=Rd}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return b`
|
|
6710
6815
|
<div part="control"></div>
|
|
6711
6816
|
<slot part="label"></slot>
|
|
6712
6817
|
<div part="drop">
|
|
6713
6818
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6714
6819
|
</div>
|
|
6715
|
-
`}};
|
|
6820
|
+
`}};fn([p({type:Number,attribute:"match-min"})],At.prototype,"matchMin",void 0);fn([p({type:Number,attribute:"match-max"})],At.prototype,"matchMax",void 0);fn([p({type:String,attribute:"fixed",converter:{fromAttribute:n=>n==="true",toAttribute:n=>String(n)}})],At.prototype,"fixed",void 0);fn([T({context:we,subscribe:!0}),_()],At.prototype,"_dragDrop",void 0);var Od=[{tag:"qti-simple-associable-choice",ctor:At}];var Pd=[O,q`
|
|
6716
6821
|
/*
|
|
6717
6822
|
* 'position: relative' unconditionally, because this element can carry a correction badge and a
|
|
6718
6823
|
* badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
|
|
@@ -6748,9 +6853,9 @@ div.full-correct-response-inline {
|
|
|
6748
6853
|
align-items: center;
|
|
6749
6854
|
justify-content: center;
|
|
6750
6855
|
}
|
|
6751
|
-
`];var
|
|
6856
|
+
`];var gn=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},It=class extends bt(C,"qti-simple-choice"){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=Pd}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>
|
|
6752
6857
|
${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:P}
|
|
6753
|
-
<slot part="label"></slot>`}};an([p({type:String,attribute:"template-identifier"})],At.prototype,"templateIdentifier",void 0);an([p({type:String,attribute:"show-hide"})],At.prototype,"showHide",void 0);an([p({type:Boolean,converter:{fromAttribute:n=>n==="true",toAttribute:n=>String(n)}})],At.prototype,"fixed",void 0);an([p({type:String,attribute:!1})],At.prototype,"marker",void 0);var xd=[{tag:"qti-simple-choice",ctor:At}];var qd=[...rd,...od,...sd,...ld,...hd,...ud,...fd,...bd,...vd,...xd];var Yp=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o};function Kp(n,t,e,r,i={}){let o=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,c=0,l=r.length?r:[n],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 g=h.getBoundingClientRect();a=Math.max(a,g.height),c=Math.max(c,g.width)}),d.forEach(({el:h,reservation:g,hadStyleAttribute:m})=>{g?h.style.setProperty("--qti-drag-min-width",g):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:c})!==!1&&(n.style.setProperty("--qti-dropzone-min-height",`${a}px`),o&&(n.style.setProperty("--qti-dropzone-min-width",`${c}px`),n.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`),o&&(h.style.setProperty("--qti-dropzone-min-width",`${c}px`),h.style.setProperty("--qti-drag-min-width",`${c}px`))}))}var $a=(n,t,e,r='slot[part="drags"]')=>{class i extends n{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#i=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#i;#n;collectAutoSizeTargets(){let s=(a,c)=>Array.from(c?.querySelectorAll(a)??[]);return{draggables:[...s(t,this),...s(t,this.shadowRoot)],droppables:[...s(e,this),...s(e,this.shadowRoot)],dragContainers:[...s(r,this),...s(r,this.shadowRoot)]}}dropzonePropertyTarget(){return this}updateMinDimensionsForDropZones(){if(!this.autoSizeDropzones)return;let{draggables:s,droppables:a,dragContainers:c}=this.collectAutoSizeTargets();s.length!==0&&(Kp(this.dropzonePropertyTarget(),s,a,c,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:l=>{let d=this.#n;return d&&d.height===l.height&&d.width===l.width?!1:(this.#n=l,!0)}}),this.#a(s),this.#o())}#o(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#s()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#s(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMinDimensionsForDropZones()}))}#a(s){if(typeof ResizeObserver>"u")return;this.#t??=new ResizeObserver(()=>this.#s());let a=new Set(s);for(let c of this.#e)a.has(c)||this.#t.unobserve(c);for(let c of a)this.#e.has(c)||this.#t.observe(c);this.#e=a}disconnectedCallback(){this.#t?.disconnect(),this.#t=null,this.#e.clear(),this.#r?.disconnect(),this.#r=null,this.#i&&cancelAnimationFrame(this.#i),this.#i=0,super.disconnectedCallback()}}return Yp([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Ut,AbortSignal:La,WeakMap:Jp,WeakRef:Zp,Window:Cd,reportError:cn=console.log}=globalThis,ve=n=>n&&n.defaultView!==null&&n.defaultView.document===n&&(n.defaultView.top===n.defaultView||ve(n.defaultView.parent.document)),Ke=()=>!!Cd&&globalThis instanceof Cd,Va=Symbol("unset"),[kd,tu]=(()=>{function n(x,f,u=!0){Object.defineProperty(x,f,{...Object.getOwnPropertyDescriptor(x,f),enumerable:u})}let t="try"in Promise?Promise.try.bind(Promise):(x,...f)=>new Promise(u=>u(x(...f))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,f;return{promise:new Promise((y,v)=>(x=y,f=v)),resolve:x,reject:f}};function r(x,f){let u=f.call(x);if(u===null||typeof u!="object")throw new TypeError("Iterator is not an object");return u}let i=new Jp,o={next(...x){let f=this,u=i.get(f);if(!u?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:y}=u;return t(()=>y.next(...x))},return(...x){let f=this,u=i.get(f);if(!u?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:y}=u;return t(()=>y.return?y.return(...x):{value:void 0,done:!0})},throw(...x){let f=this,u=i.get(f);if(!u?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:y}=u;return t(()=>{if(!y.throw)throw y.return(),new TypeError("no throw method");return y.throw(...x)})}};function s(x){let f=Object.create(o);return i.set(f,{syncIteratorRecord:x}),f}function a(x,f){let u;if(f){if(u=x[Symbol.asyncIterator],u==null){if(u=x[Symbol.iterator],u==null)throw new TypeError("Object is not async iterable");let y=r(x,u);return s(y)}}else u=x[Symbol.iterator];if(u==null)throw new TypeError("Object is not iterable");return r(x,u)}let c="any"in La?La.any.bind(La):x=>{let f=new Ut;for(let u of x)if(u.aborted)return f.abort(u.reason),f.signal;for(let u of x)u.addEventListener("abort",()=>{f.abort(u.reason)},{signal:f.signal});return f.signal},l=x=>c(x.filter(Boolean));class d{constructor({next:f,error:u,complete:y}={}){i.set(this,{next:f,error:u,complete:y})}next(f){let{next:u}=i.get(this)||{};u&&u(f)}error(f){let{error:u}=i.get(this)||{};u?u(f):cn(f)}complete(){let{complete:f}=i.get(this)||{};f&&f()}}function h(x,f){let u=i.get(x);if(u?.active){u.active=!1,u.subscriptionController.abort(f);for(let y of u.teardowns.reverse()){if(Ke()&&!ve(document))return;try{y()}catch(v){cn(v)}}}}function g(x,f,u={}){if(Ke()&&!ve(document))return;let y;typeof f=="function"?y=new d({next:f}):f&&!(f instanceof d)?y=new d(f):y=f||new d;let v=i.get(x),A=v.weakSubscriber?.deref();if(A?.active){let I=A,k=i.get(I);k.observers.add(y),u.signal&&(u.signal.aborted?k.observers.delete(y):u.signal.addEventListener("abort",()=>{let O=i.get(I);O?.active&&(O.observers.delete(y),O.observers.size==0&&h(I,u.signal.reason))}));return}let S=new m(y);if(v.weakSubscriber=new Zp(S),"signal"in u&&(u.signal.aborted?h(S,u.signal.reason):u.signal.addEventListener("abort",()=>{let I=i.get(S);I?.active&&(I.observers.delete(y),I.observers.size==0&&h(S,u.signal.reason))})),v.subscribeCallback)try{v.subscribeCallback(S)}catch(I){S.error(I)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(f=null){if(!(f instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([f]),teardowns:[],subscriptionController:new Ut})}next(f){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let u=i.get(this);if(!u?.active||Ke()&&!ve(document))return;let y=new Set(u.observers);for(let v of y)v.next(f)}error(f){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let u=i.get(this);if(!u?.active){cn(f);return}if(Ke()&&!ve(document))return;h(this,f);let y=new Set(u.observers);for(let v of y)v.error(f)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let f=i.get(this);if(!f?.active||Ke()&&!ve(document))return;h(this);let u=new Set(f.observers);for(let y of u)y.complete()}addTeardown(f){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(Ke()&&!ve(document))return;let u=i.get(this);u?.active?u.teardowns.push(f):f()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!i.has(this)){let f=new Ut;return f.abort(),f.signal}return i.get(this).subscriptionController.signal}}n(m.prototype,"next"),n(m.prototype,"error"),n(m.prototype,"complete"),n(m.prototype,"addTeardown"),n(m.prototype,"active"),n(m.prototype,"signal");class w{get[Symbol.toStringTag](){return"Observable"}constructor(f){if(!f)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:f})}static from(f){if(f===null||typeof f!="object")throw new TypeError("Observable.from only accepts objects");if(f instanceof w)return f;if(typeof(Symbol.asyncIterator in f&&f[Symbol.asyncIterator])=="function"){let A=function(S,I){if(S.signal.aborted)return;let k;try{let O=I.next();k=Promise.resolve(O)}catch(O){k=Promise.reject(O)}k.then(O=>{if(O===null||typeof O!="object"){S.error(new TypeError("Not an IteratorResult."));return}try{({done:v}=O)}catch(V){S.error(V);return}if(v){S.complete();return}let N;try{N=O.value}catch(V){S.error(V);return}S.next(N),A(S,I)},O=>{S.error(O)})},v=!1;return new w(S=>{if(S.signal.aborted)return;let I;try{I=a(f,!0)}catch(O){S.error(O);return}let k=I;S.signal.aborted||(S.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||v)return;t(()=>k.return(S.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),A(S,k))})}if(typeof(Symbol.iterator in f&&f[Symbol.iterator])=="function")return new w(v=>{if(v.signal.aborted)return;let A;try{A=a(f,!1)}catch(k){v.error(k);return}let S=!1,I=A;if(!v.signal.aborted)for(v.signal.addEventListener("abort",()=>{if(typeof I.return!="function"||S)return;let k=I.return();if(k===null||typeof k!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let k=I.next();if({done:S}=k,S){v.complete();return}if(v.next(k.value),v.signal.aborted)break}catch(k){v.error(k);break}});if(f instanceof Promise||typeof f.then=="function")return new w(v=>{f.then(A=>{v.next(A),v.complete()},A=>{v.error(A)})});throw new TypeError("Could not convert value to Observable")}subscribe(f=null,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");g(this,f,u)}takeUntil(f){if(!(this instanceof w))throw new TypeError("illegal invocation");let u=this,y=w.from(f);return new w(v=>{let A=new d({next(){v.complete()},error(){v.complete()}}),S={signal:v.signal};if(g(y,A,S),!v.active)return;let I=new d({next(k){v.next(k)},error(k){v.error(k)},complete(){v.complete()}});g(u,I,S)})}map(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=new d({next(I){let k;try{k=f(I,v)}catch(O){y.error(O);return}v+=1,y.next(k)},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}inspect(f={}){let u=null,y=null,v=null,A=null,S=null;typeof f=="function"?y=f:f&&typeof f=="object"&&("subscribe"in f&&(u=f.subscribe),"next"in f&&(y=f.next),"error"in f&&(v=f.error),"complete"in f&&(A=f.complete),"abort"in f&&(S=f.abort));let I=this;return new w(k=>{if(u!==null)try{u()}catch(L){k.error(L);return}let O=()=>{try{S!==null&&S(k.signal.reason)}catch(L){cn(L)}};k.signal.addEventListener("abort",O,{once:!0});let N=new d({next(L){if(y!==null)try{y(L)}catch(at){k.signal.removeEventListener("abort",O),k.error(at);return}k.next(L)},error(L){if(k.signal.removeEventListener("abort",O),v!==null)try{v(L)}catch(at){k.error(at);return}k.error(L)},complete(){if(k.signal.removeEventListener("abort",O),A!==null)try{A()}catch(L){k.error(L);return}k.complete()}}),V={signal:k.signal};g(I,N,V)})}filter(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=new d({next(I){let k=!1;try{k=f(I,v)}catch(O){y.error(O);return}v+=1,k&&y.next(I)},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}take(f){if(!(this instanceof w))throw new TypeError("illegal invocation");let u=this;return new w(y=>{let v=f;if(v==0)return y.complete();let A=new d({next(I){y.next(I),v-=1,v==0&&y.complete()},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}drop(f){if(!(this instanceof w))throw new TypeError("illegal invocation");let u=this;return new w(y=>{let v=f,A=new d({next(I){if(v>0)return v-=1;v==0&&y.next(I)},error(I){y.error(I)},complete(){y.complete()}}),S={signal:y.signal};g(u,A,S)})}flatMap(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=!1,S=[];function I(V){let L;try{L=f(V,v)}catch(Wt){return y.error(Wt)}v+=1;let at;try{at=w.from(L)}catch(Wt){return y.error(Wt)}let zs=new d({next(Wt){y.next(Wt)},error(Wt){y.error(Wt)},complete(){if(S.length){let Wt=S.shift();I(Wt)}else k=!1,A&&y.complete()}}),Ot={signal:y.signal};g(at,zs,Ot)}let k=!1,O=new d({next(V){k?S.push(V):(k=!0,I(V))},error(V){y.error(V)},complete(){A=!0,!k&&!S.length&&y.complete()}}),N={signal:y.signal};g(u,O,N)})}switchMap(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{let v=0,A=!1,S=null;function I(N){let V;try{V=f(N,v)}catch(Ot){return y.error(Ot)}v+=1;let L;try{L=w.from(V)}catch(Ot){return y.error(Ot)}let at=new d({next(Ot){y.next(Ot)},error(Ot){y.error(Ot)},complete(Ot){A?y.complete():S=null}}),zs={signal:l([S.signal,y.signal])};g(L,at,zs)}let k=new d({next(N){S&&S.abort(),S=new Ut,I(N)},error(N){y.error(N)},complete(){A=!0,S||y.complete()}}),O={signal:y.signal};g(u,k,O)})}catch(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(v=>{let A=new d({next(I){v.next(I)},error(I){let k;try{k=f(I)}catch(L){v.error(L);return}let O;try{O=w.from(k)}catch(L){v.error(L);return}let N=new d({next(L){v.next(L)},error(L){v.error(L)},complete(){v.complete()}}),V={signal:v.signal};g(O,N,V)},complete(){v.complete()}}),S={signal:v.signal};g(u,A,S)})}finally(f){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let u=this;return new w(y=>{y.addTeardown(f);let v=new d({next(S){y.next(S)},error(S){y.error(S)},complete(){y.complete()}}),A={signal:y.signal};g(u,v,A)})}toArray(f={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:u,resolve:y,reject:v}=e();if(f.signal){if(f.signal.aborted)return Promise.reject(f.signal.reason);f.signal.addEventListener("abort",()=>{v(f.signal.reason)})}let A=[],S=new d({next(I){A.push(I)},error(I){v(I)},complete(){y(A)}});return g(this,S,f),u}forEach(f,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=e(),S=new Ut,I={signal:l([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let k=0,O=new d({next(N){try{f(N,k)}catch(V){A(V),S.abort(V)}k+=1},error(N){A(N)},complete(){v()}});return g(this,O,I),y}every(f,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=e(),S=new Ut,I={signal:l([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let k=0,O=new d({next(N){let V=!1;try{V=f(N,k)}catch(L){A(L),S.abort(L)}k+=1,V||(v(!1),S.abort())},error(N){A(N)},complete(){v(!0)}});return g(this,O,I),y}first(f={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:u,resolve:y,reject:v}=e(),A=new Ut,S={signal:l([A.signal,f.signal])};if(S.signal.aborted)return v(S.signal.reason),u;S.signal.addEventListener("abort",()=>{v(S.signal.reason)});let I=new d({next(k){y(k),A.abort()},error(k){v(k)},complete(){v(new RangeError("No values in Observable"))}});return g(this,I,S),u}last(f={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:u,resolve:y,reject:v}=e();if(f.signal){if(f.signal.aborted)return v(f.signal.reason),u;f.signal.addEventListener("abort",()=>{v(f.signal.reason)})}let A=null,S=!1,I=new d({next(k){S=!0,A=k},error(k){v(k)},complete(){S?y(A):v(new RangeError("No values in Observable"))}});return g(this,I,f),u}find(f,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=e(),S=new Ut,I={signal:l([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let k=0,O=new d({next(N){let V=!1;try{V=f(N,k)}catch(L){A(L),S.abort(L)}k+=1,V&&(v(N),S.abort())},error(N){A(N)},complete(){v()}});return g(this,O,I),y}some(f,u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:A}=e(),S=new Ut,I={signal:l([S.signal,u.signal])};if(I.signal.aborted)return A(I.signal.reason),y;I.signal.addEventListener("abort",()=>{A(I.signal.reason)});let k=0,O=new d({next(N){let V=!1;try{V=f(N,k)}catch(L){A(L),S.abort(L)}k+=1,V&&(v(!0),S.abort())},error(N){A(N)},complete(){v(!1)}});return g(this,O,I),y}reduce(f,u,y={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof f!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:A,reject:S}=e(),I=new Ut,k={signal:l([I.signal,y.signal])};if(k.signal.aborted)return S(k.signal.reason),v;k.signal.addEventListener("abort",()=>{S(k.signal.reason)},{once:!0});let O=0,N=arguments.length>1?u:Va,V=new d({next(L){if(N===Va){N=L,O++;return}try{let at=f(N,L,O);O++,N=at}catch(at){S(at),I.abort(at);return}},error(L){S(L)},complete(){N!==Va?A(N):S(new TypeError("no initial value provided and no values emitted"))}});return g(this,V,k),v}}return n(w.prototype,"subscribe"),[w,m]})();function Ed(){return typeof globalThis.Observable=="function"}function Sd(){Object.defineProperties(globalThis,{Observable:{value:kd,configurable:!0,writable:!0},Subscriber:{value:tu,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(n,t={}){if(Ke()&&!ve(document))return;let e=this;return new kd(r=>{if(!e||r.signal.aborted)return;let i=o=>{r.next(o)};e.addEventListener(n,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function za(n,t,e){let r=n.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let o=i.getBoundingClientRect();if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom)return i}return null}function Ad(n,t,e,r){if(!r)return null;let i=n.filter(s=>!s.hasAttribute("disabled")),o=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(o.right<a.left||o.left>a.right||o.bottom<a.top||o.top>a.bottom))return s}return null}function Id(n,t,e,r){let i=n.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let o,s;if(r){let l=r.getBoundingClientRect();o=l.left+l.width/2,s=l.top+l.height/2}else o=t,s=e;let a=null,c=1/0;for(let l of i){let d=l.getBoundingClientRect(),h=d.left+d.width/2,g=d.top+d.height/2,m=Math.sqrt(Math.pow(o-h,2)+Math.pow(s-g,2));m<c&&(c=m,a=l)}return a}function _d(n,t,e,r){let i=n.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let o;if(r){let c=r.getBoundingClientRect();o=[{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 o=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let c of i){let l=c.getBoundingClientRect(),d=[{x:l.left,y:l.top},{x:l.right,y:l.top},{x:l.left,y:l.bottom},{x:l.right,y:l.bottom}],h=0,g=0;for(let w of o)for(let x of d){let f=Math.sqrt(Math.pow(w.x-x.x,2)+Math.pow(w.y-x.y,2));h+=f,g++}let m=h/g;m<a&&(a=m,s=c)}return s}function eu(n,t,e,r,i){let o=i&&i.length>0?n.filter(u=>i.includes(u)):n.filter(u=>u.tagName==="SLOT"&&u.hasAttribute("part")&&u.getAttribute("part")?.includes("drags")),a=n.filter(u=>!o.includes(u));if(o.length===0&&a.length===0)return null;let c;if(r){let u=r.getBoundingClientRect();c=[{x:u.left,y:u.top},{x:u.right,y:u.top},{x:u.left,y:u.bottom},{x:u.right,y:u.bottom}]}else c=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let l=u=>{let y=u.getBoundingClientRect(),v=[{x:y.left,y:y.top},{x:y.right,y:y.top},{x:y.left,y:y.bottom},{x:y.right,y:y.bottom}],A=0,S=0;for(let I of c)for(let k of v){let O=Math.sqrt(Math.pow(I.x-k.x,2)+Math.pow(I.y-k.y,2));A+=O,S++}return A/S},d=null,h=1/0;for(let u of o){let y=l(u);y<h&&(h=y,d=u)}let g=null,m=1/0;for(let u of a){let y=l(u);y<m&&(m=y,g=u)}if(d&&r){let u=r.getBoundingClientRect(),y=d.getBoundingClientRect(),v=u.left+u.width/2,A=u.top+u.height/2;if(v>=y.left&&v<=y.right&&A>=y.top&&A<=y.bottom)return d}let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&g?h<=m*x?d:g:d||g}function Td(n){switch(n){case"pointerWithin":return za;case"rectangleIntersection":return Ad;case"closestCenter":return Id;case"closestCorners":return _d;case"closestCornersWithInventoryPriority":return eu;default:return za}}function Ar(n,t,e,r,i="pointerWithin",o){return Td(i)(n,t,e,r,o)}function we(n,t){let e=n.composedPath?n.composedPath():[n.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("qti-draggable"))return r;let i=r.closest(t)||r.closest('[qti-draggable="true"]');if(i)return i}return null}function Ni(n){return n?n.hasAttribute("disabled")?!0:n.internals?.states?.has("disabled")??!1:!1}var ja=n=>n?.internals;function It(n,t,e){let r=ja(n)?.states;r&&(e?r.add(t):r.delete(t))}function ln(n,t){return ja(n)?.states?.has(t)??!1}function $i(n){It(n,"dragging",!1),It(n,"placeholder",!1),It(n,"return-anchor",!1)}function Je(n){return ln(n,"dragging")||ln(n,"placeholder")}function ee(n,t,e){if(!n)return;e?n.setAttribute(t,""):n.removeAttribute(t);let r=ja(n)?.states;if(r){e?r.add(t):r.delete(t);return}let i=new Set((n.getAttribute("part")??"").split(/\s+/).filter(Boolean));i.has("drop")&&(e?i.add(t):i.delete(t),n.setAttribute("part",[...i].join(" ")))}function Ir(n,t){ee(n,"filled",t)}function _r(n,t){let e=[];return n.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function Rd(n,t){let e=n.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var Fa={origin:{x:0,y:0},scale:{x:1,y:1}},dn=100,ru=n=>{let t=n.fullscreenElement??n.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},iu=n=>{let t=n.shadowRoot;return t?t.querySelector("slot:not([name])")?n:t:n},ou=(n,t)=>{let e=t;for(;e;){if(e===n)return!0;e=e.parentNode??e.host??null}return!1},Ba=(n,t)=>{let e=n.ownerDocument??document,r=t??e.body,i=ru(e);return i&&!ou(i,r)?iu(i):r},Ua=n=>{let e=(n.ownerDocument??document).createElement("div");e.style.cssText=`position:fixed;left:0;top:0;width:${dn}px;height:${dn}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,n.appendChild(e);let r=e.getBoundingClientRect();return e.remove(),{origin:{x:r.left,y:r.top},scale:{x:r.width/dn||1,y:r.height/dn||1}}},Od=(n,t,e)=>({x:(t-n.origin.x)/n.scale.x,y:(e-n.origin.y)/n.scale.y});Ed()||Sd();var Pd=new WeakSet;function nu(n){!n||Pd.has(n)||(n.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Pd.add(n))}var Md=n=>!!n.internals?.states,hn=(n,t,e,r='slot[part="drags"]',i="pointerWithin")=>{class o extends n{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Fa,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!==hr)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}),nu(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,O)=>Array.from(O?.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),g=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...c,...l,...d,...h,...g]));let m=a(e,this),w=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...w]));let x=a(r,this),f=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...f])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let u=this.isDragDropEnabled(),y=new Set(this.trackedDraggables),v=new Set(this.trackedDroppables),A=u?y:new Set,S=u?v:new Set,I=new Set([...y,...v].filter(Md));for(let k of this.#t)I.has(k)||(k.internals.states.delete("drag"),k.internals.states.delete("droppable"));for(let k of I){let O=A.has(k),N=!O&&S.has(k);O?k.internals.states.add("drag"):k.internals.states.delete("drag"),N?k.internals.states.add("droppable"):k.internals.states.delete("droppable")}this.#t=I,this.trackedDraggables.forEach(k=>{let O=Je(k);u&&!O?(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 w=we(m,t),x=this.disabled||this.readonly,f=Ni(w)||Je(w),u=Date.now()-this.lastTouchStartAt<50;return w&&m.isPrimary!==!1&&m.button===0&&!x&&!f&&!u}).subscribe(m=>{this.lastPointerDownAt=Date.now();let w=we(m,t);if(!w){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(w,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let f=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",f,!0),document.removeEventListener("pointercancel",f,!0)};document.addEventListener("pointerup",f,{once:!0,capture:!0}),document.addEventListener("pointercancel",f,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",f,!0),document.removeEventListener("pointercancel",f,!0),this.dragState.dragging||this.initiateDrag(w,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),l=a.when("mousedown").filter(m=>{let w=we(m,t),x=this.disabled||this.readonly,f=Ni(w)||Je(w),u=m.button===0,y=Date.now()-this.lastPointerDownAt<50;return w&&u&&!x&&!f&&!y}).subscribe(m=>{let w=we(m,t);!w||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(w,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let w=we(m,t),x=this.disabled||this.readonly,f=Ni(w)||Je(w),u=!!(m.touches?.[0]||m.changedTouches?.[0]),y=Date.now()-this.lastPointerDownAt<50;return w&&u&&!x&&!f&&!y}).subscribe(m=>{let w=we(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!w||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(w,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},g=a.when("keydown").subscribe(m=>{let w=this.trackedDraggables.filter(f=>!Je(f)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let f=(h.dropIndex+1)%x.length;h={...h,dropIndex:f,dropElement:x[f]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let f=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:f,dropElement:x[f]};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(f=>f.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(f=>f.removeAttribute("data-keyboard-dragging")),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let f=we(m,t),u=this.disabled||this.readonly,y=Ni(f)||Je(f);f&&["Space","Enter"].includes(m.code)&&!u&&!y&&(m.preventDefault(),f.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:f,dragIndex:w.indexOf(f),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(f=>f.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,g)}initiateDrag(a,c,l,d,h="pointer",g,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 w=y=>y.contains(a)||!!y.shadowRoot?.contains(a),x=this.trackedDroppables.some(w),f=this.trackedDroppables.find(w)||null;a.getAnimations().forEach(y=>y.cancel());let u=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,u),startOffset:{x:c-u.left,y:l-u.top},currentTarget:null,sourceDroppable:f,inputType:d,pointerId:g,startedFromTrustedEvent:m,initialCoordinates:{x:c,y:l},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(f,a),this.cacheInteractiveElements(),f&&f.setAttribute("data-drag-source","true");let y=a.getAttribute("identifier");if(y){let v=_r(this.trackedDragContainers,y);v.forEach(A=>It(A,"return-anchor",!0)),this.dragState.returnAnchorItems=v}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),It(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 v=this.dragState.dragSource,A=this.dragState.pointerId;v&&A!==void 0&&v.setPointerCapture&&v.setPointerCapture(A)}catch{}let u=v=>{v.cancelable&&(v.preventDefault(),c==="pointer"&&v.stopPropagation())};document.addEventListener("touchmove",u,{passive:!1,capture:!0}),document.addEventListener("touchstart",u,{passive:!1,capture:!0}),document.addEventListener("touchend",u,{passive:!1,capture:!0}),document.addEventListener("gesturestart",u,{passive:!1}),document.addEventListener("gesturechange",u,{passive:!1}),document.addEventListener("gestureend",u,{passive:!1});let y=()=>{if(document.removeEventListener("touchmove",u,{capture:!0}),document.removeEventListener("touchstart",u,{capture:!0}),document.removeEventListener("touchend",u,{capture:!0}),document.removeEventListener("gesturestart",u),document.removeEventListener("gesturechange",u),document.removeEventListener("gestureend",u),c==="pointer")try{let v=this.dragState.dragSource,A=this.dragState.pointerId;v&&A!==void 0&&v.releasePointerCapture&&v.releasePointerCapture(A)}catch{}};this.dragState.touchCleanup=y}let l=c==="mouse"?"mousemove":c==="touch"?"touchmove":"pointermove",d=c==="mouse"?"mouseup":c==="touch"?"touchend":"pointerup",h=u=>{let y=this.dragState.startedFromTrustedEvent;return y===void 0||u.isTrusted===y},g=document.when(l).takeUntil(document.when(d)).subscribe({next:u=>{if(h(u)){if(u.preventDefault(),u.stopPropagation(),c==="touch"){let y=u.touches?.[0]||u.changedTouches?.[0];if(!y)return;this.handleDragMove(y.clientX,y.clientY);return}if(c==="mouse"){let y=u;if(typeof y.buttons=="number"&&(y.buttons&1)!==1)return}this.handleDragMove(u.clientX,u.clientY)}}}),m=document.when(d).subscribe({next:u=>{h(u)&&(u.preventDefault(),u.stopPropagation(),this.handleDragEnd())}}),w=c==="touch"?document.when("touchcancel").subscribe({next:u=>{h(u)&&this.handleDragEnd()}}):c==="mouse"?null:document.when("pointercancel").subscribe({next:u=>{h(u)&&this.handleDragEnd()}}),x=document.when("keydown").filter(u=>u.key==="Escape").subscribe({next:u=>{h(u)&&this.handleDragEnd()}}),f=[g,m,x];w&&f.push(w),this.dragSubscriptions.push(...f)}handleDragMove(a,c){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,c);let l=Ar(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=>ee(m,"hover",!1)),l&&ee(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 w=c.getBoundingClientRect();h=Ar(this.allDropzones,w.left+w.width/2,w.top+w.height/2,c,this.collisionDetectionAlgorithm,this.trackedDragContainers)??l}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),It(a,"dragging",!1)):this.handleInvalidDrop(a),c&&c.remove(),(this.dragState.returnAnchorItems||[]).forEach(w=>{It(w,"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){$i(a)}createDragClone(a,c){let l=a.cloneNode(!0),d=window.getComputedStyle(a);for(let g=0;g<d.length;g++){let m=d[g];l.style.setProperty(m,d.getPropertyValue(m))}let h=Ba(a.isConnected?a:this,this.dragCloneRoot());return this.cloneFrame=Ua(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}=Od(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 g=d?.isConnected?d:this,m=Ba(g,this.dragCloneRoot());m!==l.parentNode&&(m.appendChild(l),this.cloneFrame=Ua(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=>{ee(a,"enabled",!0),ee(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{ee(a,"enabled",!1),ee(a,"active",!1),ee(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{It(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=Fa,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)Md(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return o};var Dd={duration:250,easing:"ease",fill:"both"};function Ha(n){let t=n.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Nd(n){return{left:n.left,top:n.top,width:n.width,height:n.height}}function xe(n){let t=new Map;return n.forEach(e=>{t.set(e,Ha(e))}),t}function $d(n,t){return{deltaX:n.left-t.left,deltaY:n.top-t.top,deltaW:n.width/t.width,deltaH:n.height/t.height}}function pn(n){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!n)return 1;let t=getComputedStyle(n).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function Wa(n){return pn(n)>0}function un(n,t,e={}){let r=pn(n);if(r<=0)return null;let i=Ha(n),{deltaX:o,deltaY:s,deltaW:a,deltaH:c}=$d(t,i);if(o===0&&s===0&&a===1&&c===1)return null;let{duration:l,easing:d,fill:h}={...Dd,...e};return n.animate([{transformOrigin:"top left",transform:`translate(${o}px, ${s}px) scale(${a}, ${c})`},{transformOrigin:"top left",transform:"none"}],{duration:l*r,easing:d,fill:h})}function qe(n,t={}){let e=new Map;return n.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let o=un(i,r,t);o&&e.set(i,o)}),e}var Li=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},_t=(n,t,e,r='slot[part="drags"]',i="closestCornersWithInventoryPriority")=>{let o=$a(n,t,e,r),s=hn(o,t,e,r,i);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 g=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,g),g.length===0&&Ir(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()),Ir(l,!1)}syncDragDropState(){let l={},d={},h={};for(let g of this.trackedDroppables){let m=g.getAttribute("identifier");if(!m)continue;let w=this.chipsIn(g),x=this.isDeclarativeTarget(g)?w:Array.from(g.querySelectorAll('[qti-draggable="true"]'));l[m]=w.map(f=>f.getAttribute("identifier")).filter(f=>!!f),d[m]=Math.max(w.length,x.length),h[m]=w}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(g=>`${g} ${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 g=l.getAttribute("identifier");return(g?this._dragDrop.countByTarget[g]??0:0)>=h}set disableAnimations(l){this._enableFlipAnimations=!l}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Wa(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,g=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),g.forEach(x=>this.placeResponse(x));let m=this.getResponse,w=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(w)?w:(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 g=this.getAttribute(h);if(g&&g.trim().length>0)return g}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),g=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return g&&this.isSwapTarget(d)?!0:h&&(!g||m)}handleDrop(l,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(l,d,h);let g=l.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.validate(),this.reportValidity()}handleInvalidDrop(l){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,g=!h,m=this.trackedDragContainers[0]||null;if(!l)return;if(d&&g&&m)this.dropDraggableInDroppable(l,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(l,d,this.dragState.dragClone?.getBoundingClientRect());else if(ln(l,"dragging")){this.restoreInventoryItem(l,this.dragState.dragClone?.getBoundingClientRect());let u=l.getAttribute("identifier");u&&this.updateInventoryBasedOnMatchMax(u),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let w=this.totalAssociationsFromState(),x=this.maxAssociations>0&&w>=this.maxAssociations,f=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=f&&x,this.validate(),this.reportValidity()}animateReturn(l,d){!l||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{un(l,Nd(d),this.flipAnimationConfig)})}restoreInventoryItem(l,d){$i(l),l.style.display="",l.style.position="",this.animateReturn(l,d)}placeResponse(l){let[d,...h]=l.split(" ").reverse(),g=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);g&&h.forEach(m=>{if(!m)return;let x=_r(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(f=>f.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,g)})}dropDraggableInDroppable(l,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(l,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(l,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let A=l.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(l),l),A&&this.restoreOriginalInInventory(A,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),w=Number.isNaN(m)?1:m,x=w===0||w>1,f=Array.from(d.querySelectorAll('[qti-draggable="true"]')),u=this.enableFlipAnimations&&f.length>0?xe(f):null;if(!x){let A=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(A){let S=A.getAttribute("identifier"),I=A.getBoundingClientRect();this.removeChipFromDroppable(d,A);let k=this.dragState.sourceDroppable,O=this.isDeclarativeTarget(d)&&k&&k!==d&&this.isDeclarativeTarget(k)?k:null;O?(this.placeChip(O,A),Ir(O,!0),this.animateReturn(A,I)):S&&this.restoreOriginalInInventory(S,I)}}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)),Ir(d,!0),this.syncDragDropState(),u&&this.enableFlipAnimations&&qe(u,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let A=y.getBoundingClientRect(),S=h.left-A.left,I=h.top-A.top;(S!==0||I!==0)&&y.animate([{transform:`translate(${S}px, ${I}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let v=l.getAttribute("identifier");v&&this.updateInventoryBasedOnMatchMax(v),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(l,d){let h=l.getAttribute("identifier");h&&(this.trackedDroppables.forEach(g=>{let m=this.chipsIn(g).filter(w=>w.getAttribute("identifier")===h);m.forEach(w=>this.removeChipFromDroppable(g,w)),m.length>0&&this.chipsIn(g).length===0&&Ir(g,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(l,d){let h=_r(this.trackedDragContainers,l),g=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[qti-draggable="true"]').forEach(f=>!g.has(f)&&m.push(f))});let w=this.enableFlipAnimations&&m.length>0?xe(m):null;h.forEach(x=>{$i(x),x.style.display="",x.style.visibility="visible"}),w&&this.enableFlipAnimations&&qe(w,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(l){let d=_r(this.trackedDragContainers,l),h=Rd(this.trackedDraggables,l),g=this.trackedDroppables.reduce((m,w)=>this.isDeclarativeTarget(w)?m+this.chipsIn(w).filter(x=>x.getAttribute("identifier")===l).length:m+w.querySelectorAll(`[identifier="${l}"]`).length,0);d.forEach(m=>{It(m,"placeholder",h!==0&&g>=h)})}checkAllMaxAssociations(){let l=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!0}),h=this.maxAssociations>0&&l>=this.maxAssociations;this.trackedDroppables.forEach(g=>{let m=g.hasAttribute("data-drag-source");(this.droppableAtCapacityFromState(g)||d&&h)&&!m?g.setAttribute("disabled",""):g.removeAttribute("disabled")})}saveResponse(l){let d=this.getResponse,h=l??(typeof d=="function"?d.call(this):void 0),g=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=g,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:g}})),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,g=this.minAssociations>0&&l<this.minAssociations,m="",w=!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}.`,w=!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}.`,w=!1):g?(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"}.`,w=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(w,m,x,{suppressInline:!0}),w}reportValidity(){return super.reportValidity()}}return Li([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),Li([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),Li([B({context:be})],a.prototype,"_dragDrop",void 0),Li([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),Li([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Lt({emptyAs:[]})})],a.prototype,"response",null),a};var mn=class{getInsertPosition(t,e,r,i,o){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),c=(o-a.top)/a.height,d=Math.min(1,Math.max(0,c))>.5;return{index:s,placeAfter:d}}};var Ld=new mn;var su={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function Vi(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function fn(n){n.placeholder?.remove(),n.placeholder=null,n.lastHoverTarget=null,n.lastPlacement=null,n.sortContainer=null}function gn(n,t,e={}){let r={...su,...e},i=document.createElement("div");return i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(n).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(n).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*pn(n)}ms ease`,i.style.pointerEvents="none",i}function Qa(n,t){for(let e of t)if(e.contains(n)&&e!==n)return e;return null}var Tt=(n,t='[qti-draggable="true"]')=>{class e extends n{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=Vi(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#n=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#r;#i;#n;#o;set allowReorder(i){this.#o=i}get allowReorder(){return this.#o??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(i){return Qa(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let o=this.#c(i);return o===0||o>1}#c(i){let o=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(o)?1:o}#h(i){return i.querySelectorAll(t).length}#l(i){let o=this.#c(i);return o===0?!1:this.#h(i)>=o}#u(){this.#i={hoveredSlot:null,originalPositions:new Map}}#d(i){if(!this.#t||i===this.#t){this.#p();return}if(this.#i.hoveredSlot===i)return;this.#p();let o=this.#s(i);if(!o){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#l(i)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#i.hoveredSlot=null;return}this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.isDeclarativeTarget(i)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#i.hoveredSlot=i;return}let a=xe([o]);this.#i.originalPositions.set(o,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(o),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,qe(a,this.sortableAnimationConfig)}#p(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),o=i.length>0?xe(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),o&&qe(o,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,o,s,a,...c){this.#t=null,this.#r=Vi(),this.#u();let l=this.findContainingDroppable(i);if(this.#e=l,l&&this.allowReorder){this.#t=l,this.#r.sortContainer=l;let h=i.getBoundingClientRect();this.#r.placeholder=gn(i,h,this.sortablePlaceholderConfig);let g=i.getAttribute("slot");g&&this.#r.placeholder.setAttribute("slot",g),this.#r.placeholder.style.visibility="hidden",l.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==l&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;m.removeAttribute("disabled"),this.#n.add(m)}})}let[d]=c;super.initiateDrag(i,o,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[o,s]of this.#i.originalPositions)s.appendChild(o);this.#r.placeholder&&this.#r.placeholder.remove(),fn(this.#r),this.#n.clear(),this.#t=null,this.#u()}onSortableDragMove(i,o){if(!this.isDraggingFromSlot)return;let s=Ar(this.trackedDroppables,i,o,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#p()}handleDragMove(i,o){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,o),this.onSortableDragMove(i,o)}allowDrop(i,o){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&o!==this.#e&&this.trackedDroppables.includes(o)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(o)?this.#a(o)?!this.#l(o):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(o)?!0:super.allowDrop(i,o)}handleDrop(i,o){super.handleDrop(i,o),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var Vd=[R,U,$t,q`
|
|
6858
|
+
<slot part="label"></slot>`}};gn([p({type:String,attribute:"template-identifier"})],It.prototype,"templateIdentifier",void 0);gn([p({type:String,attribute:"show-hide"})],It.prototype,"showHide",void 0);gn([p({type:Boolean,converter:{fromAttribute:n=>n==="true",toAttribute:n=>String(n)}})],It.prototype,"fixed",void 0);gn([p({type:String,attribute:!1})],It.prototype,"marker",void 0);var Md=[{tag:"qti-simple-choice",ctor:It}];var Dd=[...fd,...bd,...vd,...qd,...kd,...Sd,...Id,...Td,...Od,...Md];var cu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o};function lu(n,t,e,r,i={}){let o=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,l=0,c=r.length?r:[n],d=c.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));c.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),l=Math.max(l,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:l})!==!1&&(n.style.setProperty("--qti-dropzone-min-height",`${a}px`),o&&(n.style.setProperty("--qti-dropzone-min-width",`${l}px`),n.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`),o&&(h.style.setProperty("--qti-dropzone-min-width",`${l}px`),h.style.setProperty("--qti-drag-min-width",`${l}px`))}))}var Ha=(n,t,e,r='slot[part="drags"]')=>{class i extends n{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#i=0,this.#o=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#i;#o;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&&(lu(this.dropzonePropertyTarget(),s,a,l,{publishWidth:this.autoSizeDropzoneWidth,hasChanged:c=>{let d=this.#o;return d&&d.height===c.height&&d.width===c.width?!1:(this.#o=c,!0)}}),this.#a(s),this.#n())}#n(){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 cu([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Ht,AbortSignal:Wa,WeakMap:du,WeakRef:hu,Window:Nd,reportError:bn=console.log}=globalThis,qe=n=>n&&n.defaultView!==null&&n.defaultView.document===n&&(n.defaultView.top===n.defaultView||qe(n.defaultView.parent.document)),rr=()=>!!Nd&&globalThis instanceof Nd,Qa=Symbol("unset"),[$d,pu]=(()=>{function n(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,v)=>(x=y,u=v)),resolve:x,reject:u}};function r(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let i=new du,o={next(...x){let u=this,g=i.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=i.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=i.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(o);return i.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let 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 Wa?Wa.any.bind(Wa):x=>{let u=new Ht;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}={}){i.set(this,{next:u,error:g,complete:y})}next(u){let{next:g}=i.get(this)||{};g&&g(u)}error(u){let{error:g}=i.get(this)||{};g?g(u):bn(u)}complete(){let{complete:u}=i.get(this)||{};u&&u()}}function h(x,u){let g=i.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let y of g.teardowns.reverse()){if(rr()&&!qe(document))return;try{y()}catch(v){bn(v)}}}}function f(x,u,g={}){if(rr()&&!qe(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 v=i.get(x),I=v.weakSubscriber?.deref();if(I?.active){let E=I,k=i.get(E);k.observers.add(y),g.signal&&(g.signal.aborted?k.observers.delete(y):g.signal.addEventListener("abort",()=>{let R=i.get(E);R?.active&&(R.observers.delete(y),R.observers.size==0&&h(E,g.signal.reason))}));return}let S=new m(y);if(v.weakSubscriber=new hu(S),"signal"in g&&(g.signal.aborted?h(S,g.signal.reason):g.signal.addEventListener("abort",()=>{let E=i.get(S);E?.active&&(E.observers.delete(y),E.observers.size==0&&h(S,g.signal.reason))})),v.subscribeCallback)try{v.subscribeCallback(S)}catch(E){S.error(E)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Ht})}next(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active||rr()&&!qe(document))return;let y=new Set(g.observers);for(let v of y)v.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active){bn(u);return}if(rr()&&!qe(document))return;h(this,u);let y=new Set(g.observers);for(let v of y)v.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=i.get(this);if(!u?.active||rr()&&!qe(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(rr()&&!qe(document))return;let g=i.get(this);g?.active?g.teardowns.push(u):u()}get active(){if(!(this instanceof m))throw new TypeError("illegal invocation");return!!i.get(this)?.active}get signal(){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!i.has(this)){let u=new Ht;return u.abort(),u.signal}return i.get(this).subscriptionController.signal}}n(m.prototype,"next"),n(m.prototype,"error"),n(m.prototype,"complete"),n(m.prototype,"addTeardown"),n(m.prototype,"active"),n(m.prototype,"signal");class w{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof w)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let I=function(S,E){if(S.signal.aborted)return;let k;try{let R=E.next();k=Promise.resolve(R)}catch(R){k=Promise.reject(R)}k.then(R=>{if(R===null||typeof R!="object"){S.error(new TypeError("Not an IteratorResult."));return}try{({done:v}=R)}catch(V){S.error(V);return}if(v){S.complete();return}let N;try{N=R.value}catch(V){S.error(V);return}S.next(N),I(S,E)},R=>{S.error(R)})},v=!1;return new w(S=>{if(S.signal.aborted)return;let E;try{E=a(u,!0)}catch(R){S.error(R);return}let k=E;S.signal.aborted||(S.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||v)return;t(()=>k.return(S.signal.reason)).then(N=>{if(N===null||typeof N!="object")throw new TypeError("Iterator .return() must return an Object")})}),I(S,k))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new w(v=>{if(v.signal.aborted)return;let I;try{I=a(u,!1)}catch(k){v.error(k);return}let S=!1,E=I;if(!v.signal.aborted)for(v.signal.addEventListener("abort",()=>{if(typeof E.return!="function"||S)return;let k=E.return();if(k===null||typeof k!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let k=E.next();if({done:S}=k,S){v.complete();return}if(v.next(k.value),v.signal.aborted)break}catch(k){v.error(k);break}});if(u instanceof Promise||typeof u.then=="function")return new w(v=>{u.then(I=>{v.next(I),v.complete()},I=>{v.error(I)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof w))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof w))throw new TypeError("illegal invocation");let g=this,y=w.from(u);return new w(v=>{let I=new d({next(){v.complete()},error(){v.complete()}}),S={signal:v.signal};if(f(y,I,S),!v.active)return;let E=new d({next(k){v.next(k)},error(k){v.error(k)},complete(){v.complete()}});f(g,E,S)})}map(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(y=>{let v=0,I=new d({next(E){let k;try{k=u(E,v)}catch(R){y.error(R);return}v+=1,y.next(k)},error(E){y.error(E)},complete(){y.complete()}}),S={signal:y.signal};f(g,I,S)})}inspect(u={}){let g=null,y=null,v=null,I=null,S=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&&(v=u.error),"complete"in u&&(I=u.complete),"abort"in u&&(S=u.abort));let E=this;return new w(k=>{if(g!==null)try{g()}catch(L){k.error(L);return}let R=()=>{try{S!==null&&S(k.signal.reason)}catch(L){bn(L)}};k.signal.addEventListener("abort",R,{once:!0});let N=new d({next(L){if(y!==null)try{y(L)}catch(lt){k.signal.removeEventListener("abort",R),k.error(lt);return}k.next(L)},error(L){if(k.signal.removeEventListener("abort",R),v!==null)try{v(L)}catch(lt){k.error(lt);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(E,N,V)})}filter(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(y=>{let v=0,I=new d({next(E){let k=!1;try{k=u(E,v)}catch(R){y.error(R);return}v+=1,k&&y.next(E)},error(E){y.error(E)},complete(){y.complete()}}),S={signal:y.signal};f(g,I,S)})}take(u){if(!(this instanceof w))throw new TypeError("illegal invocation");let g=this;return new w(y=>{let v=u;if(v==0)return y.complete();let I=new d({next(E){y.next(E),v-=1,v==0&&y.complete()},error(E){y.error(E)},complete(){y.complete()}}),S={signal:y.signal};f(g,I,S)})}drop(u){if(!(this instanceof w))throw new TypeError("illegal invocation");let g=this;return new w(y=>{let v=u,I=new d({next(E){if(v>0)return v-=1;v==0&&y.next(E)},error(E){y.error(E)},complete(){y.complete()}}),S={signal:y.signal};f(g,I,S)})}flatMap(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(y=>{let v=0,I=!1,S=[];function E(V){let L;try{L=u(V,v)}catch(Qt){return y.error(Qt)}v+=1;let lt;try{lt=w.from(L)}catch(Qt){return y.error(Qt)}let Xs=new d({next(Qt){y.next(Qt)},error(Qt){y.error(Qt)},complete(){if(S.length){let Qt=S.shift();E(Qt)}else k=!1,I&&y.complete()}}),Pt={signal:y.signal};f(lt,Xs,Pt)}let k=!1,R=new d({next(V){k?S.push(V):(k=!0,E(V))},error(V){y.error(V)},complete(){I=!0,!k&&!S.length&&y.complete()}}),N={signal:y.signal};f(g,R,N)})}switchMap(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(y=>{let v=0,I=!1,S=null;function E(N){let V;try{V=u(N,v)}catch(Pt){return y.error(Pt)}v+=1;let L;try{L=w.from(V)}catch(Pt){return y.error(Pt)}let lt=new d({next(Pt){y.next(Pt)},error(Pt){y.error(Pt)},complete(Pt){I?y.complete():S=null}}),Xs={signal:c([S.signal,y.signal])};f(L,lt,Xs)}let k=new d({next(N){S&&S.abort(),S=new Ht,E(N)},error(N){y.error(N)},complete(){I=!0,S||y.complete()}}),R={signal:y.signal};f(g,k,R)})}catch(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(v=>{let I=new d({next(E){v.next(E)},error(E){let k;try{k=u(E)}catch(L){v.error(L);return}let R;try{R=w.from(k)}catch(L){v.error(L);return}let N=new d({next(L){v.next(L)},error(L){v.error(L)},complete(){v.complete()}}),V={signal:v.signal};f(R,N,V)},complete(){v.complete()}}),S={signal:v.signal};f(g,I,S)})}finally(u){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new w(y=>{y.addTeardown(u);let v=new d({next(S){y.next(S)},error(S){y.error(S)},complete(){y.complete()}}),I={signal:y.signal};f(g,v,I)})}toArray(u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:v}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{v(u.signal.reason)})}let I=[],S=new d({next(E){I.push(E)},error(E){v(E)},complete(){y(I)}});return f(this,S,u),g}forEach(u,g={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:I}=e(),S=new Ht,E={signal:c([S.signal,g.signal])};if(E.signal.aborted)return I(E.signal.reason),y;E.signal.addEventListener("abort",()=>{I(E.signal.reason)});let k=0,R=new d({next(N){try{u(N,k)}catch(V){I(V),S.abort(V)}k+=1},error(N){I(N)},complete(){v()}});return f(this,R,E),y}every(u,g={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:I}=e(),S=new Ht,E={signal:c([S.signal,g.signal])};if(E.signal.aborted)return I(E.signal.reason),y;E.signal.addEventListener("abort",()=>{I(E.signal.reason)});let k=0,R=new d({next(N){let V=!1;try{V=u(N,k)}catch(L){I(L),S.abort(L)}k+=1,V||(v(!1),S.abort())},error(N){I(N)},complete(){v(!0)}});return f(this,R,E),y}first(u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:v}=e(),I=new Ht,S={signal:c([I.signal,u.signal])};if(S.signal.aborted)return v(S.signal.reason),g;S.signal.addEventListener("abort",()=>{v(S.signal.reason)});let E=new d({next(k){y(k),I.abort()},error(k){v(k)},complete(){v(new RangeError("No values in Observable"))}});return f(this,E,S),g}last(u={}){if(!(this instanceof w))throw new TypeError("illegal invocation");let{promise:g,resolve:y,reject:v}=e();if(u.signal){if(u.signal.aborted)return v(u.signal.reason),g;u.signal.addEventListener("abort",()=>{v(u.signal.reason)})}let I=null,S=!1,E=new d({next(k){S=!0,I=k},error(k){v(k)},complete(){S?y(I):v(new RangeError("No values in Observable"))}});return f(this,E,u),g}find(u,g={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:I}=e(),S=new Ht,E={signal:c([S.signal,g.signal])};if(E.signal.aborted)return I(E.signal.reason),y;E.signal.addEventListener("abort",()=>{I(E.signal.reason)});let k=0,R=new d({next(N){let V=!1;try{V=u(N,k)}catch(L){I(L),S.abort(L)}k+=1,V&&(v(N),S.abort())},error(N){I(N)},complete(){v()}});return f(this,R,E),y}some(u,g={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:y,resolve:v,reject:I}=e(),S=new Ht,E={signal:c([S.signal,g.signal])};if(E.signal.aborted)return I(E.signal.reason),y;E.signal.addEventListener("abort",()=>{I(E.signal.reason)});let k=0,R=new d({next(N){let V=!1;try{V=u(N,k)}catch(L){I(L),S.abort(L)}k+=1,V&&(v(!0),S.abort())},error(N){I(N)},complete(){v(!1)}});return f(this,R,E),y}reduce(u,g,y={}){if(!(this instanceof w))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:v,resolve:I,reject:S}=e(),E=new Ht,k={signal:c([E.signal,y.signal])};if(k.signal.aborted)return S(k.signal.reason),v;k.signal.addEventListener("abort",()=>{S(k.signal.reason)},{once:!0});let R=0,N=arguments.length>1?g:Qa,V=new d({next(L){if(N===Qa){N=L,R++;return}try{let lt=u(N,L,R);R++,N=lt}catch(lt){S(lt),E.abort(lt);return}},error(L){S(L)},complete(){N!==Qa?I(N):S(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,k),v}}return n(w.prototype,"subscribe"),[w,m]})();function Ld(){return typeof globalThis.Observable=="function"}function Vd(){Object.defineProperties(globalThis,{Observable:{value:$d,configurable:!0,writable:!0},Subscriber:{value:pu,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(n,t={}){if(rr()&&!qe(document))return;let e=this;return new $d(r=>{if(!e||r.signal.aborted)return;let i=o=>{r.next(o)};e.addEventListener(n,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function Ga(n,t,e){let r=n.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let o=i.getBoundingClientRect();if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom)return i}return null}function zd(n,t,e,r){if(!r)return null;let i=n.filter(s=>!s.hasAttribute("disabled")),o=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(o.right<a.left||o.left>a.right||o.bottom<a.top||o.top>a.bottom))return s}return null}function jd(n,t,e,r){let i=n.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let o,s;if(r){let c=r.getBoundingClientRect();o=c.left+c.width/2,s=c.top+c.height/2}else o=t,s=e;let a=null,l=1/0;for(let c of i){let d=c.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(o-h,2)+Math.pow(s-f,2));m<l&&(l=m,a=c)}return a}function Fd(n,t,e,r){let i=n.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let o;if(r){let l=r.getBoundingClientRect();o=[{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 o=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let l of i){let c=l.getBoundingClientRect(),d=[{x:c.left,y:c.top},{x:c.right,y:c.top},{x:c.left,y:c.bottom},{x:c.right,y:c.bottom}],h=0,f=0;for(let w of o)for(let x of d){let u=Math.sqrt(Math.pow(w.x-x.x,2)+Math.pow(w.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=l)}return s}function uu(n,t,e,r,i){let o=i&&i.length>0?n.filter(g=>i.includes(g)):n.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.includes("drags")),a=n.filter(g=>!o.includes(g));if(o.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(),v=[{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,S=0;for(let E of l)for(let k of v){let R=Math.sqrt(Math.pow(E.x-k.x,2)+Math.pow(E.y-k.y,2));I+=R,S++}return I/S},d=null,h=1/0;for(let g of o){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(),v=g.left+g.width/2,I=g.top+g.height/2;if(v>=y.left&&v<=y.right&&I>=y.top&&I<=y.bottom)return d}let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function Bd(n){switch(n){case"pointerWithin":return Ga;case"rectangleIntersection":return zd;case"closestCenter":return jd;case"closestCorners":return Fd;case"closestCornersWithInventoryPriority":return uu;default:return Ga}}function Mr(n,t,e,r,i="pointerWithin",o){return Bd(i)(n,t,e,r,o)}function Ce(n,t){let e=n.composedPath?n.composedPath():[n.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("qti-draggable"))return r;let i=r.closest(t)||r.closest('[qti-draggable="true"]');if(i)return i}return null}function Bi(n){return n?n.hasAttribute("disabled")?!0:n.internals?.states?.has("disabled")??!1:!1}var Xa=n=>n?.internals;function _t(n,t,e){let r=Xa(n)?.states;r&&(e?r.add(t):r.delete(t))}function yn(n,t){return Xa(n)?.states?.has(t)??!1}function Ui(n){_t(n,"dragging",!1),_t(n,"placeholder",!1),_t(n,"return-anchor",!1)}function ir(n){return yn(n,"dragging")||yn(n,"placeholder")}function oe(n,t,e){if(!n)return;e?n.setAttribute(t,""):n.removeAttribute(t);let r=Xa(n)?.states;if(r){e?r.add(t):r.delete(t);return}let i=new Set((n.getAttribute("part")??"").split(/\s+/).filter(Boolean));i.has("drop")&&(e?i.add(t):i.delete(t),n.setAttribute("part",[...i].join(" ")))}function Dr(n,t){oe(n,"filled",t)}function Nr(n,t){let e=[];return n.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function Ud(n,t){let e=n.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var Ya={origin:{x:0,y:0},scale:{x:1,y:1}},vn=100,mu=n=>{let t=n.fullscreenElement??n.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},fu=n=>{let t=n.shadowRoot;return t?t.querySelector("slot:not([name])")?n:t:n},gu=(n,t)=>{let e=t;for(;e;){if(e===n)return!0;e=e.parentNode??e.host??null}return!1},Ka=(n,t)=>{let e=n.ownerDocument??document,r=t??e.body,i=mu(e);return i&&!gu(i,r)?fu(i):r},Ja=n=>{let e=(n.ownerDocument??document).createElement("div");e.style.cssText=`position:fixed;left:0;top:0;width:${vn}px;height:${vn}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,n.appendChild(e);let r=e.getBoundingClientRect();return e.remove(),{origin:{x:r.left,y:r.top},scale:{x:r.width/vn||1,y:r.height/vn||1}}},Hd=(n,t,e)=>({x:(t-n.origin.x)/n.scale.x,y:(e-n.origin.y)/n.scale.y});Ld()||Vd();var Wd=new WeakSet;function bu(n){!n||Wd.has(n)||(n.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Wd.add(n))}var Qd=n=>!!n.internals?.states,wn=(n,t,e,r='slot[part="drags"]',i="pointerWithin")=>{class o extends n{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Ya,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!==gr)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}),bu(this.ownerDocument?.defaultView),this.publishDraggablesSelector(),this.setupDragDrop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("context-request",this.#r,{capture:!0}),this.#e.clear(),this.cleanup()}async setupDragDrop(){await this.updateComplete,this.cacheInteractiveElements(),this.afterCache(),this.setupDragObservables()}afterCache(){}removeChipFromDroppable(a,l){l.remove()}#e;#r;registeredMatching(a){for(let l of this.#e)l.isConnected||this.#e.delete(l);return[...this.#e].filter(l=>l.matches(a))}cacheInteractiveElements(){let a=(k,R)=>Array.from(R?.querySelectorAll(k)??[]),l=a(t,this),c=a(t,this.shadowRoot),d=a('[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),w=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...w]));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),v=new Set(this.trackedDroppables),I=g?y:new Set,S=g?v:new Set,E=new Set([...y,...v].filter(Qd));for(let k of this.#t)E.has(k)||(k.internals.states.delete("drag"),k.internals.states.delete("droppable"));for(let k of E){let R=I.has(k),N=!R&&S.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=E,this.trackedDraggables.forEach(k=>{let R=ir(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 l=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let w=Ce(m,t),x=this.disabled||this.readonly,u=Bi(w)||ir(w),g=Date.now()-this.lastTouchStartAt<50;return w&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let w=Ce(m,t);if(!w){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(w,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(w,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),c=a.when("mousedown").filter(m=>{let w=Ce(m,t),x=this.disabled||this.readonly,u=Bi(w)||ir(w),g=m.button===0,y=Date.now()-this.lastPointerDownAt<50;return w&&g&&!x&&!u&&!y}).subscribe(m=>{let w=Ce(m,t);!w||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(w,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let w=Ce(m,t),x=this.disabled||this.readonly,u=Bi(w)||ir(w),g=!!(m.touches?.[0]||m.changedTouches?.[0]),y=Date.now()-this.lastPointerDownAt<50;return w&&g&&!x&&!u&&!y}).subscribe(m=>{let w=Ce(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!w||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(w,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 w=this.trackedDraggables.filter(u=>!ir(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=Ce(m,t),g=this.disabled||this.readonly,y=Bi(u)||ir(u);u&&["Space","Enter"].includes(m.code)&&!g&&!y&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),h={dragging:!0,dragElement:u,dragIndex:w.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 w=y=>y.contains(a)||!!y.shadowRoot?.contains(a),x=this.trackedDroppables.some(w),u=this.trackedDroppables.find(w)||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 v=Nr(this.trackedDragContainers,y);v.forEach(I=>_t(I,"return-anchor",!0)),this.dragState.returnAnchorItems=v}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),_t(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 v=this.dragState.dragSource,I=this.dragState.pointerId;v&&I!==void 0&&v.setPointerCapture&&v.setPointerCapture(I)}catch{}let g=v=>{v.cancelable&&(v.preventDefault(),l==="pointer"&&v.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 v=this.dragState.dragSource,I=this.dragState.pointerId;v&&I!==void 0&&v.releasePointerCapture&&v.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())}}),w=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];w&&u.push(w),this.dragSubscriptions.push(...u)}handleDragMove(a,l){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,l);let c=Mr(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=>oe(m,"hover",!1)),c&&oe(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 w=l.getBoundingClientRect();h=Mr(this.allDropzones,w.left+w.width/2,w.top+w.height/2,l,this.collisionDetectionAlgorithm,this.trackedDragContainers)??c}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),_t(a,"dragging",!1)):this.handleInvalidDrop(a),l&&l.remove(),(this.dragState.returnAnchorItems||[]).forEach(w=>{_t(w,"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){Ui(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=Ka(a.isConnected?a:this,this.dragCloneRoot());return this.cloneFrame=Ja(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}=Hd(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=Ka(f,this.dragCloneRoot());m!==c.parentNode&&(m.appendChild(c),this.cloneFrame=Ja(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=>{oe(a,"enabled",!0),oe(a,"active",!0)})}deactivateAllDroppables(){this.setInternalsState("dragzone-enabled",!1),this.setInternalsState("dragzone-active",!1),this.allDropzones.forEach(a=>{oe(a,"enabled",!1),oe(a,"active",!1),oe(a,"hover",!1)})}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{_t(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=Ya,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)Qd(a)&&(a.internals.states.delete("drag"),a.internals.states.delete("droppable"));this.#t.clear(),this.resetDragState()}}return o};var Gd={duration:250,easing:"ease",fill:"both"};function Za(n){let t=n.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Xd(n){return{left:n.left,top:n.top,width:n.width,height:n.height}}function ke(n){let t=new Map;return n.forEach(e=>{t.set(e,Za(e))}),t}function Yd(n,t){return{deltaX:n.left-t.left,deltaY:n.top-t.top,deltaW:n.width/t.width,deltaH:n.height/t.height}}function xn(n){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!n)return 1;let t=getComputedStyle(n).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function tc(n){return xn(n)>0}function qn(n,t,e={}){let r=xn(n);if(r<=0)return null;let i=Za(n),{deltaX:o,deltaY:s,deltaW:a,deltaH:l}=Yd(t,i);if(o===0&&s===0&&a===1&&l===1)return null;let{duration:c,easing:d,fill:h}={...Gd,...e};return n.animate([{transformOrigin:"top left",transform:`translate(${o}px, ${s}px) scale(${a}, ${l})`},{transformOrigin:"top left",transform:"none"}],{duration:c*r,easing:d,fill:h})}function Ee(n,t={}){let e=new Map;return n.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let o=qn(i,r,t);o&&e.set(i,o)}),e}var Hi=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Tt=(n,t,e,r='slot[part="drags"]',i="closestCornersWithInventoryPriority")=>{let o=Ha(n,t,e,r),s=wn(o,t,e,r,i);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&&Dr(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()),Dr(c,!1)}syncDragDropState(){let c={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let w=this.chipsIn(f),x=this.isDeclarativeTarget(f)?w:Array.from(f.querySelectorAll('[qti-draggable="true"]'));c[m]=w.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(w.length,x.length),h[m]=w}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&&tc(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,w=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(w)?w:(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(yn(c,"dragging")){this.restoreInventoryItem(c,this.dragState.dragClone?.getBoundingClientRect());let g=c.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let w=this.totalAssociationsFromState(),x=this.maxAssociations>0&&w>=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(()=>{qn(c,Xd(d),this.flipAnimationConfig)})}restoreInventoryItem(c,d){Ui(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=Nr(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),w=Number.isNaN(m)?1:m,x=w===0||w>1,u=Array.from(d.querySelectorAll('[qti-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?ke(u):null;if(!x){let I=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[qti-draggable="true"]'));if(I){let S=I.getAttribute("identifier"),E=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),Dr(R,!0),this.animateReturn(I,E)):S&&this.restoreOriginalInInventory(S,E)}}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)),Dr(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&Ee(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let I=y.getBoundingClientRect(),S=h.left-I.left,E=h.top-I.top;(S!==0||E!==0)&&y.animate([{transform:`translate(${S}px, ${E}px)`,opacity:.8},{transform:"translate(0, 0)",opacity:1}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let v=c.getAttribute("identifier");v&&this.updateInventoryBasedOnMatchMax(v),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(c,d){let h=c.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(w=>w.getAttribute("identifier")===h);m.forEach(w=>this.removeChipFromDroppable(f,w)),m.length>0&&this.chipsIn(f).length===0&&Dr(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(c,d){let h=Nr(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 w=this.enableFlipAnimations&&m.length>0?ke(m):null;h.forEach(x=>{Ui(x),x.style.display="",x.style.visibility="visible"}),w&&this.enableFlipAnimations&&Ee(w,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(c){let d=Nr(this.trackedDragContainers,c),h=Ud(this.trackedDraggables,c),f=this.trackedDroppables.reduce((m,w)=>this.isDeclarativeTarget(w)?m+this.chipsIn(w).filter(x=>x.getAttribute("identifier")===c).length:m+w.querySelectorAll(`[identifier="${c}"]`).length,0);d.forEach(m=>{_t(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="",w=!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}.`,w=!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}.`,w=!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"}.`,w=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let x=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(w,m,x,{suppressInline:!0}),w}reportValidity(){return super.reportValidity()}}return Hi([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),Hi([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",null),Hi([B({context:we})],a.prototype,"_dragDrop",void 0),Hi([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),Hi([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Vt({emptyAs:[]})})],a.prototype,"response",null),a};var Cn=class{getInsertPosition(t,e,r,i,o){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),l=(o-a.top)/a.height,d=Math.min(1,Math.max(0,l))>.5;return{index:s,placeAfter:d}}};var Kd=new Cn;var yu={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function Wi(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function kn(n){n.placeholder?.remove(),n.placeholder=null,n.lastHoverTarget=null,n.lastPlacement=null,n.sortContainer=null}function En(n,t,e={}){let r={...yu,...e},i=document.createElement("div");return i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(n).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(n).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*xn(n)}ms ease`,i.style.pointerEvents="none",i}function ec(n,t){for(let e of t)if(e.contains(n)&&e!==n)return e;return null}var Rt=(n,t='[qti-draggable="true"]')=>{class e extends n{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=Wi(),this.#i={hoveredSlot:null,originalPositions:new Map},this.#o=new Set,this.sortablePlaceholderConfig={},this.sortableAnimationConfig={duration:150,easing:"ease"}}#t;#e;#r;#i;#o;#n;set allowReorder(i){this.#n=i}get allowReorder(){return this.#n??this.resolveAllowReorder({defaultWhenUnset:!0})}get isDraggingFromSlot(){return this.#t!==null}findContainingDroppable(i){return ec(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let o=this.#c(i);return o===0||o>1}#c(i){let o=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(o)?1:o}#h(i){return i.querySelectorAll(t).length}#l(i){let o=this.#c(i);return o===0?!1:this.#h(i)>=o}#u(){this.#i={hoveredSlot:null,originalPositions:new Map}}#d(i){if(!this.#t||i===this.#t){this.#p();return}if(this.#i.hoveredSlot===i)return;this.#p();let o=this.#s(i);if(!o){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#l(i)){this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),this.#i.hoveredSlot=null;return}this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.isDeclarativeTarget(i)){this.#r.placeholder?.parentElement&&this.#r.placeholder.remove(),this.#i.hoveredSlot=i;return}let a=ke([o]);this.#i.originalPositions.set(o,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(o),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,Ee(a,this.sortableAnimationConfig)}#p(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),o=i.length>0?ke(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),o&&Ee(o,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,o,s,a,...l){this.#t=null,this.#r=Wi(),this.#u();let c=this.findContainingDroppable(i);if(this.#e=c,c&&this.allowReorder){this.#t=c,this.#r.sortContainer=c;let h=i.getBoundingClientRect();this.#r.placeholder=En(i,h,this.sortablePlaceholderConfig);let f=i.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",c.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==c&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;m.removeAttribute("disabled"),this.#o.add(m)}})}let[d]=l;super.initiateDrag(i,o,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[o,s]of this.#i.originalPositions)s.appendChild(o);this.#r.placeholder&&this.#r.placeholder.remove(),kn(this.#r),this.#o.clear(),this.#t=null,this.#u()}onSortableDragMove(i,o){if(!this.isDraggingFromSlot)return;let s=Mr(this.trackedDroppables,i,o,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#d(s):this.#p()}handleDragMove(i,o){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,o),this.onSortableDragMove(i,o)}allowDrop(i,o){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&o!==this.#e&&this.trackedDroppables.includes(o)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(o)?this.#a(o)?!this.#l(o):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(o)?!0:super.allowDrop(i,o)}handleDrop(i,o){super.handleDrop(i,o),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var Jd=[O,U,Lt,q`
|
|
6754
6859
|
:host {
|
|
6755
6860
|
display: block; /* necessary to calculate scaling position */
|
|
6756
6861
|
}
|
|
@@ -6803,7 +6908,7 @@ div.full-correct-response-inline {
|
|
|
6803
6908
|
:host([answer-key]) ::slotted(qti-simple-associable-choice) {
|
|
6804
6909
|
display: none;
|
|
6805
6910
|
}
|
|
6806
|
-
`];var
|
|
6911
|
+
`];var ku=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Eu=Tt(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),or=class extends Rt(Eu,'[qti-draggable="true"]'){static{this.styles=Jd}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}>
|
|
6807
6912
|
${H(r,i=>i.getAttribute("identifier"),i=>i)}
|
|
6808
6913
|
</div>`}get#e(){return this.maxAssociations>0?this.maxAssociations:Math.ceil(this._childrenMap.length/2)}getResponse(){let t=[];for(let e=0;e<this.#e;e++){let r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),i=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),o=r&&this.chipsIn(r)[0]?.getAttribute("identifier"),s=i&&this.chipsIn(i)[0]?.getAttribute("identifier");o&&s&&t.push(`${o} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,r)=>{let i=e.split(" ");return i.length!==2?[]:[`${i[0]} droplist${r}_left`,`${i[1]} droplist${r}_right`]})??[]}render(){return b` <slot name="prompt"></slot>
|
|
6809
6914
|
<slot part="drags" name="qti-simple-associable-choice"></slot>
|
|
@@ -6814,7 +6919,7 @@ div.full-correct-response-inline {
|
|
|
6814
6919
|
</div>`)}
|
|
6815
6920
|
|
|
6816
6921
|
<div role="alert" part="message" id="validation-message"></div>
|
|
6817
|
-
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};
|
|
6922
|
+
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};ku([_()],or.prototype,"_childrenMap",void 0);var Sn=[{tag:"qti-associate-interaction",ctor:or}];var Se=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ae=(n,t)=>{class e extends n{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(i,o)=>{this._choiceElements.forEach(s=>s.disabled=o)},this._handleReadonlyChange=(i,o)=>{this._choiceElements.forEach(s=>s.readonly=o)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(i,o){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(i){this.maxChoices>1&&(typeof i=="string"||i===null)?this.response=i?i.toString().split(","):[]:this.response=i||""}firstUpdated(){super.firstUpdated(),this._updateChoiceSelection()}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#t.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t&&(this.#t.disconnect(),this.#t=null)}_syncChoicesFromDOM(){let i=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{i.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let o=new Set(this._choiceElements.map(s=>s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>o.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!o.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let o=this._choiceElements.filter(c=>this._getChoiceChecked(c)).length,s=!0,a="";this.maxChoices!==0&&o>this.maxChoices?(s=!1,a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):o<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 i=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==i&&(this._interactionContext={...this._interactionContext,choiceRole:i})}_choiceElementSelectedHandler(i){this._toggleChoiceChecked(i.target);let o=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==i.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&o&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(i,o){i.internals?.states&&(o?(i.internals.states.add("checked"),i.internals.ariaChecked="true"):(i.internals.states.delete("checked"),i.internals.ariaChecked="false"))}_getChoiceChecked(i){return i.internals.states.has("checked")}_toggleChoiceChecked(i){let o=this._getChoiceChecked(i);this._setChoiceChecked(i,!o)}_handleChoiceSelection(){let o=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?o[0]||"":o,this.validate(),this.reportValidity(),this.saveResponse(this.response)}_updateChoiceSelection(){let i=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(o=>{let s=i.includes(o.identifier);this._setChoiceChecked(o,s)})}}return Se([pr("#validation-message")],e.prototype,"_validationMessageElement",void 0),Se([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Se([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Se([$("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Se([$("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Se([$("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Se([p({attribute:"response",reflect:!1,converter:Vt({emptyAs:""})})],e.prototype,"response",void 0),Se([$("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var Su=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Zd=(n,t)=>{class e extends n{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#r=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#i=null;set class(i){this.#t=this.#o(i),this.#n()}get class(){return this.#t.join(" ")}attributeChangedCallback(i,o,s){super.attributeChangedCallback(i,o,s),i==="class"&&o!==s&&(this.class=s??"")}updated(i){super.updated(i),this.#n()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(i=>{i.some(o=>o.type==="childList"||o.type==="attributes"&&o.attributeName==="style")&&this.#n()}),this.#i.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){super.disconnectedCallback(),this.#i?.disconnect(),this.#i=null}#o(i){return i?i.split(/\s+/).map(o=>o.trim()).filter(Boolean).filter((o,s,a)=>a.indexOf(o)===s):[]}#n(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(l=>l),o=this.#s(i),s=this.#a(),a=this.#c();o.forEach((l,c)=>{l.marker=this.#h(c+1,s,a)})}#s(i){return i.map((o,s)=>{let a=Number(o.style.order);return{el:o,order:Number.isFinite(a)?a:s+1,index:s}}).sort((o,s)=>o.order-s.order||o.index-s.index).map(o=>o.el)}#a(){return this.#t.filter(i=>this.#e.includes(i)).pop()??null}#c(){return this.#t.filter(i=>this.#r.includes(i)).pop()??null}#h(i,o,s){let a=o;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let l="";switch(a){case"qti-labels-decimal":l=`${i}`;break;case"qti-labels-lower-alpha":l=this.#l(i,"lower");break;case"qti-labels-upper-alpha":l=this.#l(i,"upper");break}return s==="qti-labels-suffix-period"?`${l}.`:s==="qti-labels-suffix-parenthesis"?`${l})`:l}#l(i,o){let s=i,a="",l=o==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(l+s%26)+a,s=Math.floor(s/26);return a}}return Su([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var th=[O,U,q`
|
|
6818
6923
|
:host {
|
|
6819
6924
|
display: block;
|
|
6820
6925
|
}
|
|
@@ -6881,16 +6986,16 @@ div.full-correct-response-inline {
|
|
|
6881
6986
|
:host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
|
|
6882
6987
|
grid-row: auto;
|
|
6883
6988
|
}
|
|
6884
|
-
`];var
|
|
6989
|
+
`];var Au=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},nr=class extends Zd(Ae(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=th}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return b`
|
|
6885
6990
|
<slot part="prompt" name="prompt"></slot>
|
|
6886
6991
|
<slot part="slot" @slotchange=${this.#t}></slot>
|
|
6887
6992
|
<div part="message" role="alert" id="validation-message"></div>
|
|
6888
|
-
`}};
|
|
6993
|
+
`}};Au([p({type:String})],nr.prototype,"orientation",void 0);var An=[{tag:"qti-choice-interaction",ctor:nr}];var eh=[O,q`
|
|
6889
6994
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
6890
6995
|
:host {
|
|
6891
6996
|
display: block;
|
|
6892
6997
|
}
|
|
6893
|
-
`];var
|
|
6998
|
+
`];var Qi=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},rc=`
|
|
6894
6999
|
const postToParentWindows = (type, data) => {
|
|
6895
7000
|
window.top.postMessage(data ? { type, data } : { type }, '*');
|
|
6896
7001
|
let w = window.parent;
|
|
@@ -6957,7 +7062,7 @@ window.CES = {
|
|
|
6957
7062
|
},
|
|
6958
7063
|
};
|
|
6959
7064
|
CES.load();
|
|
6960
|
-
`,
|
|
7065
|
+
`,Iu=`
|
|
6961
7066
|
(function() {
|
|
6962
7067
|
var blobUrlReceived = null;
|
|
6963
7068
|
|
|
@@ -7001,16 +7106,16 @@ CES.load();
|
|
|
7001
7106
|
requestBlobUrl();
|
|
7002
7107
|
}
|
|
7003
7108
|
})();
|
|
7004
|
-
`,
|
|
7109
|
+
`,ne=class extends D{#t;#e;#r;static{this.styles=eh}constructor(){super(),this.#t="",this.#e=null,this.#r=null,this._errorMessage=null,this.#i=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#i;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let r=this.querySelector("object[data]");if(r){t=r.getAttribute("data");let i=r.getAttribute("width"),o=r.getAttribute("height");i&&this.setAttribute("width",i),o&&this.setAttribute("height",o)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:Ao((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}async setupCES(){await this.updateComplete;let t=this.shadowRoot?.querySelector("#pciContainer");if(!t){this._errorMessage="pciContainer iframe not found";return}t.getAttribute("src")||t.setAttribute("src","about:blank");let e=t.contentDocument??t.contentWindow?.document??null;if(e||(await new Promise(d=>t.addEventListener("load",()=>d(),{once:!0})),e=t.contentDocument??t.contentWindow?.document??null),!e){this._errorMessage="pciContainer iframe document not available";return}if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let r=this.manifest.style[0],i=this.#a(),o=await this.#l(r,i),s=o.url;if(o.baseUrl&&!this.#r&&(this.#r=o.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#l(h,i,{returnText:!0});if(d=f.url,f.baseUrl&&!this.#r&&(this.#r=f.baseUrl),f.text){let m=f.text;if(!(m.includes("postToParentWindows")||m.includes("window.CES"))){let u="<script>"+rc+"</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",w=await this.#l(m,i,{returnText:!0});if(d=w.url,w.baseUrl&&!this.#r&&(this.#r=w.baseUrl),w.text){let x=w.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let y="<script>"+rc+"</script>",v=x.indexOf("<head>");v!==-1?x=x.slice(0,v+6)+y+x.slice(v+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>"+rc+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let w=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(w)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let l=`<script>${Iu}</script>`;window.addEventListener("message",this.handlePostMessage);let c=`
|
|
7005
7110
|
<!DOCTYPE html>
|
|
7006
7111
|
<html>
|
|
7007
7112
|
<head>
|
|
7008
7113
|
${s?`<link href='${s}' rel="stylesheet" />`:""}
|
|
7009
|
-
${
|
|
7114
|
+
${l}
|
|
7010
7115
|
</head>
|
|
7011
7116
|
<body></body>
|
|
7012
7117
|
</html>
|
|
7013
|
-
`;t.srcdoc=
|
|
7118
|
+
`;t.srcdoc=c}#o(){let t=this.shadowRoot.querySelectorAll("iframe"),e=this.querySelectorAll("iframe"),r=[...t,...e];for(let i of r){let o=i.src;if(new URL(o,window.location.href).origin===window.location.origin)try{let a=i.contentDocument||i.contentWindow.document;a&&this.#n(a,r)}catch(a){console.error("Error accessing nested iframe:",a)}}return r.forEach((i,o)=>{r.indexOf(i)!==o&&r.splice(o,1)}),r}#n(t,e=[]){return t.querySelectorAll("iframe").forEach(i=>{e.push(i);let o=i.src;if(new URL(o,window.location.href).origin===window.location.origin)try{let a=i.contentDocument||i.contentWindow.document;this.#n(a,e)}catch(a){console.error("Error accessing nested iframe:",a)}else console.warn("Skipped cross-origin iframe:",o)}),e}#s(t,e){window.postMessage({type:t,data:e},"*");let r=this.#o();for(let i of r)i.contentWindow&&i.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 i=this.#a(),o=this.manifest.media.map(s=>{if(s.startsWith("http")||s.startsWith("blob"))return s;let a=this.#r||i[0];return a?new URL(s,a.endsWith("/")?a:`${a}/`).toString():s});this.#s("mediaData",o);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
|
|
7014
7119
|
width=${this.getAttribute("width")}
|
|
7015
7120
|
height=${this.getAttribute("height")}
|
|
7016
7121
|
frameborder="0"
|
|
@@ -7021,7 +7126,7 @@ CES.load();
|
|
|
7021
7126
|
${this._errorMessage&&b`<div style="color:red">
|
|
7022
7127
|
<h1>Error</h1>
|
|
7023
7128
|
${this._errorMessage}
|
|
7024
|
-
</div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(i=>new URL(i,window.location.href).toString()),r=this.#h();return r&&e.push(r),[...new Set(e)]}#c(){return this.#e?new URL(".",this.#e).toString():null}#h(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let i of e){let o=new URL(i,window.location.href).toString(),s=new URL(t,o.endsWith("/")?o:`${o}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let
|
|
7129
|
+
</div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(i=>new URL(i,window.location.href).toString()),r=this.#h();return r&&e.push(r),[...new Set(e)]}#c(){return this.#e?new URL(".",this.#e).toString():null}#h(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let i of e){let o=new URL(i,window.location.href).toString(),s=new URL(t,o.endsWith("/")?o:`${o}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let l=await a.text();return{url:s,baseUrl:o,text:l}}return{url:s,baseUrl:o}}}catch{}}return{url:"",baseUrl:null}}};Qi([p({type:String,attribute:"data"})],ne.prototype,"data",void 0);Qi([p({type:String,attribute:"data-base-item"})],ne.prototype,"baseItemUrl",void 0);Qi([p({type:String,attribute:"data-base-ref"})],ne.prototype,"baseRefUrl",void 0);Qi([p({type:String,attribute:"id"})],ne.prototype,"id",void 0);Qi([_()],ne.prototype,"_errorMessage",void 0);var In=[{tag:"qti-custom-interaction",ctor:ne}];var rh=[O];var _n=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ie=class extends C{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=rh}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"}}))}};_n([p({type:String,attribute:"response-identifier"})],Ie.prototype,"responseIdentifier",void 0);_n([p({reflect:!0,type:Boolean})],Ie.prototype,"disabled",void 0);_n([p({type:String,attribute:"count-attempt"})],Ie.prototype,"countAttempt",void 0);_n([p({type:String})],Ie.prototype,"title",void 0);var Tn=[{tag:"qti-end-attempt-interaction",ctor:Ie}];var ih=[O,q`
|
|
7025
7130
|
/* PK: display host as block, else design will be collapsed */
|
|
7026
7131
|
/* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
|
|
7027
7132
|
:host {
|
|
@@ -7034,7 +7139,7 @@ CES.load();
|
|
|
7034
7139
|
height: 100%;
|
|
7035
7140
|
border: 0;
|
|
7036
7141
|
}
|
|
7037
|
-
`];var yt=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},
|
|
7142
|
+
`];var yt=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},oh=5,_u=50,nh="qti-height-lines-",sh=!1,Q=class extends D{constructor(){super(...arguments),this._rows=oh,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||sh||(sh=!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=ih}_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/_u):oh}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(nh))continue;let e=parseInt(t.slice(nh.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 i=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,o=new RegExp(i);r=t.checkValidity()&&o.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
|
|
7038
7143
|
part="textarea"
|
|
7039
7144
|
name="${this.responseIdentifier}"
|
|
7040
7145
|
spellcheck="false"
|
|
@@ -7044,12 +7149,12 @@ CES.load();
|
|
|
7044
7149
|
@keyup="${this.textChanged}"
|
|
7045
7150
|
@change="${this.textChanged}"
|
|
7046
7151
|
@blur="${t=>{this.reportValidity()}}"
|
|
7047
|
-
placeholder="${
|
|
7152
|
+
placeholder="${jt(this.placeholderText?this.placeholderText:void 0)}"
|
|
7048
7153
|
rows="${this._rows}"
|
|
7049
7154
|
?disabled="${this.disabled}"
|
|
7050
7155
|
?readonly="${this.readonly}"
|
|
7051
7156
|
.value=${this.response}
|
|
7052
|
-
></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))}};yt([_()],Q.prototype,"_rows",void 0);yt([p({type:Number,attribute:"expected-length"})],Q.prototype,"expectedLength",void 0);yt([p({type:Number,attribute:"expected-lines"})],Q.prototype,"expectedLines",void 0);yt([p({type:String,reflect:!0})],Q.prototype,"format",void 0);yt([$("format")],Q.prototype,"_handleFormatChange",void 0);yt([p({type:String,attribute:"pattern-mask"})],Q.prototype,"patternMask",void 0);yt([p({type:String,attribute:"placeholder-text"})],Q.prototype,"placeholderText",void 0);yt([p({type:String,attribute:"data-patternmask-message"})],Q.prototype,"dataPatternmaskMessage",void 0);yt([p({type:String,attribute:"class"})],Q.prototype,"classNames",void 0);yt([$(["classNames","expectedLines","expectedLength"])],Q.prototype,"_handleRowsInputChange",null);yt([p({type:String,attribute:"response",reflect:!1})],Q.prototype,"response",void 0);yt([$("response",{waitUntilFirstUpdate:!0})],Q.prototype,"_handleResponseChange",void 0);var
|
|
7157
|
+
></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))}};yt([_()],Q.prototype,"_rows",void 0);yt([p({type:Number,attribute:"expected-length"})],Q.prototype,"expectedLength",void 0);yt([p({type:Number,attribute:"expected-lines"})],Q.prototype,"expectedLines",void 0);yt([p({type:String,reflect:!0})],Q.prototype,"format",void 0);yt([$("format")],Q.prototype,"_handleFormatChange",void 0);yt([p({type:String,attribute:"pattern-mask"})],Q.prototype,"patternMask",void 0);yt([p({type:String,attribute:"placeholder-text"})],Q.prototype,"placeholderText",void 0);yt([p({type:String,attribute:"data-patternmask-message"})],Q.prototype,"dataPatternmaskMessage",void 0);yt([p({type:String,attribute:"class"})],Q.prototype,"classNames",void 0);yt([$(["classNames","expectedLines","expectedLength"])],Q.prototype,"_handleRowsInputChange",null);yt([p({type:String,attribute:"response",reflect:!1})],Q.prototype,"response",void 0);yt([$("response",{waitUntilFirstUpdate:!0})],Q.prototype,"_handleResponseChange",void 0);var Rn=[{tag:"qti-extended-text-interaction",ctor:Q}];var ah=[O,U,q`
|
|
7053
7158
|
:host {
|
|
7054
7159
|
display: flex;
|
|
7055
7160
|
align-items: flex-start;
|
|
@@ -7093,10 +7198,10 @@ CES.load();
|
|
|
7093
7198
|
:host([answer-key]) [part~='drags'] {
|
|
7094
7199
|
display: none;
|
|
7095
7200
|
}
|
|
7096
|
-
`];var
|
|
7201
|
+
`];var $r=class extends Rt(Tt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[qti-draggable="true"]'){static{this.styles=ah}render(){return b`<slot name="prompt"> </slot>
|
|
7097
7202
|
<slot part="drags" name="drags"></slot>
|
|
7098
7203
|
<slot part="drops"></slot>
|
|
7099
|
-
<div role="alert" part="message" id="validation-message"></div>`}};var
|
|
7204
|
+
<div role="alert" part="message" id="validation-message"></div>`}};var On=[{tag:"qti-gap-match-interaction",ctor:$r}];function _e(n,t,e,r){let i=e.getAttribute("width")?parseFloat(e.getAttribute("width")):e.naturalWidth,o=e.getAttribute("height")?parseFloat(e.getAttribute("height")):e.naturalHeight;switch(n){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[s,a,l]=t,c=s/i*100,d=a/o*100,h=l/i*100,f=l/o*100;r.style.left=c-h+"%",r.style.top=d-f+"%",r.style.width=2*h+"%",r.style.height=2*f+"%",r.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[s,a,l,c]=t,d=s/i*100,h=a/o*100,f=l/i*100,m=c/o*100;r.style.left=d+"%",r.style.top=h+"%",r.style.width=f-d+"%",r.style.height=m-h+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[s,a,l,c]=t,d=s/i*100,h=a/o*100,f=l/i*100,m=c/o*100;r.style.left=d-f+"%",r.style.top=h-m+"%",r.style.width=2*f+"%",r.style.height=2*m+"%",r.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let s=[];for(let v=0;v<t.length;v+=2)s.push({x:t[v],y:t[v+1]});let a=Math.min(...s.map(v=>v.x)),l=Math.max(...s.map(v=>v.x)),c=Math.min(...s.map(v=>v.y)),d=Math.max(...s.map(v=>v.y)),h=a/i*100,f=c/o*100,m=l/i*100,w=d/o*100;r.style.left=h+"%",r.style.top=f+"%",r.style.width=m-h+"%",r.style.height=w-f+"%";let x=s.map(v=>({x:(v.x-a)/(l-a)*100,y:(v.y-c)/(d-c)*100})),u=x.map(v=>`${v.x}% ${v.y}%`).join(",");r.style.clipPath=`polygon(${u})`;let g=x.map(v=>`${v.x},${v.y}`).join(" "),y=v=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${g}' fill='none' stroke='black' stroke-width='${v}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;r.style.setProperty("--qti-shape-outline",y(4)),r.style.setProperty("--qti-shape-outline-bold",y(8))}break;default:console.error(`Unsupported shape: ${n}`);break}}var ch=[O,U,q`
|
|
7100
7205
|
/* Containing block for the absolutely positioned hotspots over the image. Was on this host in
|
|
7101
7206
|
the theme, together with a 'display: block' this component now owns. */
|
|
7102
7207
|
:host {
|
|
@@ -7126,14 +7231,14 @@ CES.load();
|
|
|
7126
7231
|
top: 0px;
|
|
7127
7232
|
left: 0px;
|
|
7128
7233
|
}
|
|
7129
|
-
`];var
|
|
7234
|
+
`];var Gi=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ot=class extends D{static{this.styles=ch}#t;#e;#r;constructor(){super(),this.#e=null,this.#r=null,this._response=[],this.addEventListener("qti-register-hotspot",this.#n)}reset(){this._response=[]}validate(){return this.#o().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]}#o(){return this.#i(this._response)}renderSupplementalLines(){return P}render(){return b`<slot name="prompt"></slot>
|
|
7130
7235
|
<line-container>
|
|
7131
7236
|
<svg
|
|
7132
|
-
width=${
|
|
7133
|
-
height=${
|
|
7237
|
+
width=${jt(this.grImage[0]?.width)}
|
|
7238
|
+
height=${jt(this.grImage[0]?.height)}
|
|
7134
7239
|
viewbox="0 0 ${this.grImage[0]?.width} ${this.grImage[0]?.height}"
|
|
7135
7240
|
>
|
|
7136
|
-
${H(this.#
|
|
7241
|
+
${H(this.#o(),t=>t,(t,e)=>yi`
|
|
7137
7242
|
<line
|
|
7138
7243
|
part="line"
|
|
7139
7244
|
x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
|
|
@@ -7146,7 +7251,7 @@ CES.load();
|
|
|
7146
7251
|
/>
|
|
7147
7252
|
`)}
|
|
7148
7253
|
${this.renderSupplementalLines()}
|
|
7149
|
-
${this.#e&&
|
|
7254
|
+
${this.#e&&yi`<line
|
|
7150
7255
|
part="point"
|
|
7151
7256
|
x1=${this.startCoord.x}
|
|
7152
7257
|
y1=${this.startCoord.y}
|
|
@@ -7158,7 +7263,7 @@ CES.load();
|
|
|
7158
7263
|
</svg>
|
|
7159
7264
|
<slot></slot>
|
|
7160
7265
|
</line-container>
|
|
7161
|
-
<div role="alert" part="message" id="validation-message"></div>`}#
|
|
7266
|
+
<div role="alert" part="message" id="validation-message"></div>`}#n(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));_e(o,s,e,r)}firstUpdated(){super.firstUpdated(),this.#t=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.#o(),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.#n)}};Gi([_()],Ot.prototype,"startCoord",void 0);Gi([_()],Ot.prototype,"mouseCoord",void 0);Gi([cl({selector:"img"})],Ot.prototype,"grImage",void 0);Gi([_()],Ot.prototype,"_response",void 0);Gi([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Vt({emptyAs:[]})})],Ot.prototype,"response",null);var Pn=[{tag:"qti-graphic-associate-interaction",ctor:Ot}];var lh=[O,U,q`
|
|
7162
7267
|
:host {
|
|
7163
7268
|
display: flex;
|
|
7164
7269
|
align-items: flex-start;
|
|
@@ -7215,10 +7320,10 @@ CES.load();
|
|
|
7215
7320
|
user-select: none;
|
|
7216
7321
|
pointer-events: none;
|
|
7217
7322
|
}
|
|
7218
|
-
`];var
|
|
7323
|
+
`];var Tu=Tt(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='drags']"),Lr=class extends Rt(Tu,'[qti-draggable="true"]'){static{this.styles=lh}render(){return b` <slot name="prompt"></slot>
|
|
7219
7324
|
<slot part="image"></slot>
|
|
7220
7325
|
<slot part="drags" name="drags" class="hover-border"></slot>
|
|
7221
|
-
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#t(t){let e=t.target,r=e.getAttribute("coords"),i=e.getAttribute("shape"),o=r.split(",").map(s=>parseInt(s));switch(i){case"circle":{let[s,a,
|
|
7326
|
+
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#t(t){let e=t.target,r=e.getAttribute("coords"),i=e.getAttribute("shape"),o=r.split(",").map(s=>parseInt(s));switch(i){case"circle":{let[s,a,l]=o;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]=o;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 Mn=[{tag:"qti-graphic-gap-match-interaction",ctor:Lr}];var dh=[O,U,q`
|
|
7222
7327
|
/* The order pins are anchored outside their hotspot's box. */
|
|
7223
7328
|
:host {
|
|
7224
7329
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
@@ -7256,11 +7361,11 @@ CES.load();
|
|
|
7256
7361
|
pointer-events: none;
|
|
7257
7362
|
user-select: none;
|
|
7258
7363
|
}
|
|
7259
|
-
`];var
|
|
7364
|
+
`];var Vr=class n extends Ae(D,"qti-hotspot-choice"){constructor(){super(...arguments),this._choiceElements=[]}static{this.styles=dh}static#t="cito-graphic-order-marker";render(){return b`
|
|
7260
7365
|
<slot name="prompt"></slot>
|
|
7261
7366
|
<slot></slot>
|
|
7262
7367
|
<div role="alert" part="message" id="validation-message"></div>
|
|
7263
|
-
`}#e(t){let{identifier:e}=t.detail,r=this._choiceElements.find(o=>o.getAttribute("identifier")===e);if(!r)return;let i=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){let o=this._choiceElements.filter(s=>s.order!=null).length;if(o>=i){this.choiceOrdering=!1;return}r.order=o+1}else{let o=r.order;r.order=null,this._choiceElements.forEach(s=>{s.order!=null&&s.order>o&&s.order--})}this.refreshLocatorPins(),this.choiceOrdering=!1}}#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(){this.querySelectorAll(`.${n.#t}`).forEach(e=>e.remove()),this._choiceElements.forEach(e=>{e.style.removeProperty("anchor-name")}),this._choiceElements.filter(e=>e.order!=null).sort((e,r)=>e.order-r.order).forEach(e=>{let r=this.#r(e);e.style.setProperty("anchor-name",r);let i=document.createElement("span");i.className=n.#t,i.style.setProperty("position-anchor",r),i.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(e)),e.getAttribute("shape")==="poly"&&i.classList.add("cito-graphic-order-marker--poly"),i.setAttribute("aria-hidden","true"),i.textContent=String(e.order),this.append(i)})}#i(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));
|
|
7368
|
+
`}#e(t){let{identifier:e}=t.detail,r=this._choiceElements.find(o=>o.getAttribute("identifier")===e);if(!r)return;let i=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){let o=this._choiceElements.filter(s=>s.order!=null).length;if(o>=i){this.choiceOrdering=!1;return}r.order=o+1}else{let o=r.order;r.order=null,this._choiceElements.forEach(s=>{s.order!=null&&s.order>o&&s.order--})}this.refreshLocatorPins(),this.choiceOrdering=!1}}#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(){this.querySelectorAll(`.${n.#t}`).forEach(e=>e.remove()),this._choiceElements.forEach(e=>{e.style.removeProperty("anchor-name")}),this._choiceElements.filter(e=>e.order!=null).sort((e,r)=>e.order-r.order).forEach(e=>{let r=this.#r(e);e.style.setProperty("anchor-name",r);let i=document.createElement("span");i.className=n.#t,i.style.setProperty("position-anchor",r),i.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(e)),e.getAttribute("shape")==="poly"&&i.classList.add("cito-graphic-order-marker--poly"),i.setAttribute("aria-hidden","true"),i.textContent=String(e.order),this.append(i)})}#i(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));_e(o,s,e,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.#e),this.addEventListener("register-qti-hotspot-choice",this.#i),this.refreshLocatorPins()}disconnectedCallback(){this.querySelectorAll(`.${n.#t}`).forEach(t=>t.remove()),super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.#e),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var Dn=[{tag:"qti-graphic-order-interaction",ctor:Vr}];var hh=[O,U,q`
|
|
7264
7369
|
:host {
|
|
7265
7370
|
display: block;
|
|
7266
7371
|
}
|
|
@@ -7309,17 +7414,17 @@ CES.load();
|
|
|
7309
7414
|
max-width: 100%;
|
|
7310
7415
|
height: auto;
|
|
7311
7416
|
}
|
|
7312
|
-
`];var
|
|
7417
|
+
`];var zr=class extends Ae(D,"qti-hotspot-choice"){static{this.styles=hh}render(){return b`
|
|
7313
7418
|
<slot name="prompt"></slot>
|
|
7314
7419
|
<slot></slot>
|
|
7315
7420
|
<div part="message" role="alert" id="validation-message"></div>
|
|
7316
|
-
`}#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.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),s=i.split(",").map(
|
|
7421
|
+
`}#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.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),s=i.split(",").map(l=>parseInt(l)),a=await this.#e(e);_e(o,s,a,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#r)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("unregister-qti-hotspot-choice",this.#r)}};var Nn=[{tag:"qti-hotspot-interaction",ctor:zr}];var ph=[O,U,q`
|
|
7317
7422
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7318
7423
|
:host {
|
|
7319
7424
|
display: block;
|
|
7320
7425
|
}
|
|
7321
|
-
`];var
|
|
7322
|
-
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=
|
|
7426
|
+
`];var jr=class extends Ae(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>b`<slot></slot>
|
|
7427
|
+
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=ph}};var $n=[{tag:"qti-hottext-interaction",ctor:jr}];var ic=(n,t="[part='menu']",e="[part='trigger']",r="--qti-inline-choice-width")=>{class i extends n{#t=null;#e=null;#r=null;#i=0;#o=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.#n()+this.menuAutoSizeExtraWidth();l<=0||l===this.#o||(this.#o=l,s.style.setProperty(r,`${l}px`))}#n(){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 i};var Ru=q`
|
|
7323
7428
|
/* ── Host ──────────────────────────────────────────────────────────────────
|
|
7324
7429
|
Inline-block so the element flows with surrounding text.
|
|
7325
7430
|
--qti-inline-choice-width is the single width control surface:
|
|
@@ -7500,12 +7605,12 @@ CES.load();
|
|
|
7500
7605
|
z-index: var(--qti-overlay-z-index);
|
|
7501
7606
|
white-space: nowrap;
|
|
7502
7607
|
}
|
|
7503
|
-
`,
|
|
7608
|
+
`,Ou=Ru,uh=Ou;var se=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Pu=0,tt=class extends ic(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${Pu++}`,this._handleDataPromptChange=()=>{this.#e()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity()},this._pendingResponse=void 0,this.#o=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#n=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.#y(),r=this.renderRoot.activeElement,i=this.#h(),o=r||(i instanceof HTMLElement&&this.#l(i)?i:null),s=e.findIndex(a=>a===o);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(!o)return;if(t.preventDefault(),o instanceof HTMLButtonElement)o.click();else{let a=o.getAttribute("identifier")??"";this.#r(a)}}},this.#p=()=>{this.#e()},this.#m=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[uh]}renderTrigger(){let t=this.#t();return b`
|
|
7504
7609
|
<button
|
|
7505
7610
|
part="trigger"
|
|
7506
7611
|
type="button"
|
|
7507
|
-
@click=${this.#
|
|
7508
|
-
@keydown=${this.#
|
|
7612
|
+
@click=${this.#o}
|
|
7613
|
+
@keydown=${this.#n}
|
|
7509
7614
|
aria-haspopup="listbox"
|
|
7510
7615
|
aria-expanded="${this._dropdownOpen?"true":"false"}"
|
|
7511
7616
|
aria-controls="${this._menuId}"
|
|
@@ -7540,7 +7645,7 @@ CES.load();
|
|
|
7540
7645
|
</button>
|
|
7541
7646
|
<slot @slotchange=${this.#p}></slot>
|
|
7542
7647
|
</div>
|
|
7543
|
-
`}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.#d(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#e()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#f(),this.#y()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#f()}#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,i=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",o=[{content:e,value:"",selected:i===""},...t.map(a=>{let
|
|
7648
|
+
`}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.#d(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#e()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#f(),this.#y()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#f()}#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,i=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",o=[{content:e,value:"",selected:i===""},...t.map(a=>{let l=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(c=>c.cloneNode(!0)),value:l,selected:l!==""&&l===i}})],s=o.some(a=>a.selected);this.options=s?o:o.map((a,l)=>({...a,selected:l===0})),this._pendingResponse=void 0,this.#f(),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,i=e||!r,o=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(i,i?"":o,this,{suppressInline:!0}),i}reportValidity(){return super.reportValidity()}reset(){this.#i(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#f()}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.#f()}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.#f(),this.validate(),this.reportValidity(),this.saveResponse(t),this.#i(!1)}#i(t){let e=this.#u();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#o;#n;#s;#a;#c(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#h(){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)}#u(){return this.renderRoot.querySelector(`#${this._menuId}`)}#d(){this._slotObserver=new MutationObserver(()=>this.#e()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#p;#m;#b(){let t=Array.from(this.querySelectorAll("qti-inline-choice"));for(let e of t)e.removeEventListener("click",this.#m),e.removeAttribute("tabindex"),e.internals.role=null,e.internals.ariaSelected=null,e.internals.ariaChecked="false",e.internals.states.delete("checked")}async#f(){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 o=(r.getAttribute("identifier")??"")===t;r.removeEventListener("click",this.#m),r.addEventListener("click",this.#m),r.disabled=this.disabled,r.readonly=this.readonly,r.internals.role="option",r.internals.ariaSelected=o?"true":"false",r.internals.ariaChecked=o?"true":"false",r.internals.ariaDisabled=this.disabled?"true":"false",r.internals.ariaReadOnly=this.readonly?"true":"false",o?r.internals.states.add("checked"):r.internals.states.delete("checked"),r.tabIndex=-1}}#y(){let t=this.renderRoot.querySelector('button[part~="option"]'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};se([_()],tt.prototype,"options",void 0);se([_()],tt.prototype,"_dropdownOpen",void 0);se([T({context:ht,subscribe:!0}),p({attribute:!1})],tt.prototype,"configContext",void 0);se([p({type:String,attribute:"data-prompt"})],tt.prototype,"dataPrompt",void 0);se([$("dataPrompt",{waitUntilFirstUpdate:!0})],tt.prototype,"_handleDataPromptChange",void 0);se([p({type:Boolean,reflect:!0,converter:{fromAttribute:n=>n==="true"||n==="",toAttribute:n=>n?"true":null}})],tt.prototype,"required",void 0);se([p({type:Number,attribute:"min-choices"})],tt.prototype,"minChoices",void 0);se([$(["required","minChoices"],{waitUntilFirstUpdate:!0})],tt.prototype,"_handleRequiredChange",void 0);se([p({attribute:"response",reflect:!1,noAccessor:!0})],tt.prototype,"response",null);var Ln=[{tag:"qti-inline-choice-interaction",ctor:tt}];var mh=[O,U,q`
|
|
7544
7649
|
/*
|
|
7545
7650
|
* A custom element is inline unless it says otherwise, and this one never did. Its shadow content
|
|
7546
7651
|
* is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
|
|
@@ -7646,7 +7751,7 @@ CES.load();
|
|
|
7646
7751
|
:host(:disabled:not(.qti-match-tabular)) ::slotted(qti-simple-match-set:first-of-type) {
|
|
7647
7752
|
display: none;
|
|
7648
7753
|
}
|
|
7649
|
-
`];var
|
|
7754
|
+
`];var fh=[O,q`
|
|
7650
7755
|
:host(.qti-match-tabular) slot:not([hidden]) {
|
|
7651
7756
|
display: contents;
|
|
7652
7757
|
}
|
|
@@ -7702,7 +7807,7 @@ CES.load();
|
|
|
7702
7807
|
justify-content: center;
|
|
7703
7808
|
flex-shrink: 0;
|
|
7704
7809
|
}
|
|
7705
|
-
`];var
|
|
7810
|
+
`];var oc=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ae=class extends Rt(Tt(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,i=e.name,o=e.type;e.checked?(this.response?this.response.indexOf(r)===-1&&(o==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(i)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==r),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}static{this.styles=[mh,fh]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(t){this.classList.contains("qti-match-tabular")?this._response=t:super.response=t}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...t){this.classList.contains("qti-match-tabular")||super.initiateDrag(...t)}afterCache(){this.classList.contains("qti-match-tabular")||super.afterCache()}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.syncTabularSlotting()}willUpdate(t){super.willUpdate?.(t),t.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let t=this.classList.contains("qti-match-tabular"),e=this.querySelectorAll(":scope > qti-simple-match-set"),r=e[0],i=e[1],o=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(r?.setAttribute("slot","match-rows"),i?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{o(s),s.setAttribute("role","rowheader")}),this.targetChoices?.forEach(s=>{o(s),s.setAttribute("role","columnheader")})):(r?.removeAttribute("slot"),i?.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`
|
|
7706
7811
|
<slot name="prompt"></slot>
|
|
7707
7812
|
<slot ?hidden=${t}></slot>
|
|
7708
7813
|
|
|
@@ -7718,7 +7823,7 @@ CES.load();
|
|
|
7718
7823
|
<div part="checkbox-grid">
|
|
7719
7824
|
${this.sourceChoices.map((e,r)=>b`
|
|
7720
7825
|
<div role="row" style="display: contents;">
|
|
7721
|
-
${this.targetChoices.map((i,o)=>{let s=e.getAttribute("identifier"),a=i.getAttribute("identifier"),
|
|
7826
|
+
${this.targetChoices.map((i,o)=>{let s=e.getAttribute("identifier"),a=i.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":"",w=`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`
|
|
7722
7827
|
<label
|
|
7723
7828
|
part="input-cell"
|
|
7724
7829
|
role="gridcell"
|
|
@@ -7728,11 +7833,11 @@ CES.load();
|
|
|
7728
7833
|
type=${h}
|
|
7729
7834
|
hidden
|
|
7730
7835
|
name=${s}
|
|
7731
|
-
value=${
|
|
7836
|
+
value=${l}
|
|
7732
7837
|
.checked=${d}
|
|
7733
|
-
.disabled=${
|
|
7734
|
-
@change=${
|
|
7735
|
-
@click=${
|
|
7838
|
+
.disabled=${u}
|
|
7839
|
+
@change=${g=>this.handleRadioChange(g)}
|
|
7840
|
+
@click=${g=>e.matchMax===1?this.handleRadioClick(g):null}
|
|
7736
7841
|
/>
|
|
7737
7842
|
<span part=${w} role=${h} aria-checked=${d?"true":"false"}>
|
|
7738
7843
|
<span part=${x}></span>
|
|
@@ -7746,13 +7851,13 @@ CES.load();
|
|
|
7746
7851
|
`:P}
|
|
7747
7852
|
|
|
7748
7853
|
<div role="alert" part="message" id="validation-message"></div>
|
|
7749
|
-
`}};
|
|
7854
|
+
`}};oc([p({type:String})],ae.prototype,"class",void 0);oc([_()],ae.prototype,"_response",void 0);oc([p({type:String,attribute:"response-identifier"})],ae.prototype,"responseIdentifier",void 0);var Vn=[{tag:"qti-match-interaction",ctor:ae}];var gh=[O,q`
|
|
7750
7855
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7751
7856
|
:host {
|
|
7752
7857
|
display: block;
|
|
7753
7858
|
}
|
|
7754
|
-
`];var
|
|
7755
|
-
<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
|
|
7859
|
+
`];var zn=class extends D{static{this.styles=gh}#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>
|
|
7860
|
+
<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 jn=[{tag:"qti-media-interaction",ctor:zn}];var bh=[O,U,Lt,q`
|
|
7756
7861
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7757
7862
|
:host {
|
|
7758
7863
|
display: block;
|
|
@@ -7962,7 +8067,7 @@ CES.load();
|
|
|
7962
8067
|
:host([answer-key]) [part~='drags'] {
|
|
7963
8068
|
display: none;
|
|
7964
8069
|
}
|
|
7965
|
-
`];var
|
|
8070
|
+
`];var yh=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Mu=Tt(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Te=class extends Rt(Mu,'[qti-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=bh}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),b` <slot name="prompt"> </slot>
|
|
7966
8071
|
<div part="container">
|
|
7967
8072
|
<slot part="drags"> </slot>
|
|
7968
8073
|
<div part="drops">
|
|
@@ -7971,7 +8076,7 @@ CES.load();
|
|
|
7971
8076
|
</div>`})}
|
|
7972
8077
|
</div>
|
|
7973
8078
|
<div id="validation-message" part="message" role="alert" style="display:none;"></div>
|
|
7974
|
-
</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"))}};
|
|
8079
|
+
</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"))}};yh([_()],Te.prototype,"nrChoices",void 0);yh([p({type:String})],Te.prototype,"orientation",void 0);var Fn=[{tag:"qti-order-interaction",ctor:Te}];var vh=[O,q`
|
|
7975
8080
|
:host {
|
|
7976
8081
|
display: block;
|
|
7977
8082
|
width: 100%;
|
|
@@ -7981,14 +8086,14 @@ CES.load();
|
|
|
7981
8086
|
::slotted(qti-interaction-markup) {
|
|
7982
8087
|
display: none;
|
|
7983
8088
|
}
|
|
7984
|
-
`];var vt=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},
|
|
8089
|
+
`];var vt=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Du=["solution","review"];function Nu(n){return n==null?!1:Array.isArray(n)?n.length>0:n!==""}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.#o=null,this.#n=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.#x(),this.#q(),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,i=r&&typeof r=="object"?this.#u(r):null,o=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;o!==null&&(this.#n=o,o&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,l;if(a===void 0)l=void 0;else if(a===null)l=null;else if(typeof a=="string")l=a;else try{l=`__qti_json__::${JSON.stringify(a)}`}catch{l=null}if(i===null){let c=this.responseVariable?.cardinality==="single"?"":[];this.response=c,this.validate(),this.saveResponse(c,l);break}this.response=i,this.validate(),this.saveResponse(i,l);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#g=null}#t;static{this.styles=[vh,q`
|
|
7985
8090
|
:host {
|
|
7986
8091
|
display: block;
|
|
7987
8092
|
width: 100%;
|
|
7988
8093
|
min-height: 50px;
|
|
7989
8094
|
}
|
|
7990
|
-
`]}#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
|
|
7991
|
-
`);this.sendMessageToIframe("setStylesheets",i)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#x(){}connectedCallback(){super.connectedCallback(),this.#
|
|
8095
|
+
`]}#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 Nu(r)&&(e.correctResponse={value:r}),e}#r(){let t=this.responseDeclaration;if(!t?.correctResponse||Du.includes(this.status))return t;let{correctResponse:e,...r}=t;return r}#i;#o;#n;#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.#o===null&&this.requireShimJson)try{this.#o=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#o={}}return this.#o||{}}#h(){return this.#a()}#l(){return this.#c()}#u(t){for(let e in t)if(t.hasOwnProperty(e)){let r=t[e];if(r){for(let i in r)if(r.hasOwnProperty(i)){let o=r[i];if(Array.isArray(o))return o.map(String);if(o!=null)return String(o)}}}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 i=this.normalizeListValue(t).map(o=>this.coerceBaseValue(o,r));return{list:{[r]:i}}}return{base:{[r]:this.coerceBaseValue(t,r)}}}recordToQtiVariableJSON(t){if(!t||typeof t!="object")return{record:[]};let e=[];for(let[r,i]of Object.entries(t))e.push(this.recordEntryFromValue(r,i));return{record:e}}recordEntryFromValue(t,e){if(Array.isArray(e)){let r=e.filter(i=>i!=null);if(r.length&&r.every(i=>typeof i=="boolean"))return{name:t,list:{boolean:r}};if(r.length&&r.every(i=>typeof i=="number")){let i=r,o=i.every(s=>Number.isInteger(s));return{name:t,list:{[o?"integer":"float"]:i}}}return{name:t,list:{string:e.map(i=>i==null?"":String(i))}}}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(i=>{let o=i.querySelector("qti-default-value");if(!o)return;o.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 i={candidateIdentifier:r.candidateIdentifier??"",testIdentifier:r.testIdentifier??"",environmentIdentifier:r.environmentIdentifier??"",...r};return this.recordToQtiVariableJSON(i)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("template-identifier")||r.getAttribute("identifier")||"";if(!i)return;let o=this.context?.variables?.find(l=>l.identifier===i);if(!o)return;let s=o.cardinality||"single",a=o.baseType||"string";t[i]=this.variableToQtiVariableJSON(o.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("identifier")||"";if(!i)return;if(i==="QTI_CONTEXT"){let l=this.getQtiContextRecord();l&&(t[i]=l);return}let o=this.context?.variables?.find(l=>l.identifier===i);if(!o)return;let s=o.cardinality||"single",a=o.baseType||"string";t[i]=this.variableToQtiVariableJSON(o.value,s,a)}),t}#d(t){let e={...t};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=r.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`);e[i]=t[r]}return e}#p(t){let e={...t},r=(i,o,s)=>{let a=i;for(let l=0;l<o.length;l+=1){let c=o[l];if(l===o.length-1){a[c]=s;return}(!a[c]||typeof a[c]!="object"||Array.isArray(a[c]))&&(a[c]={}),a=a[c]}};for(let[i,o]of Object.entries(t)){if(!i.includes("__"))continue;let s=i.split("__").filter(Boolean);s.length<2||r(e,s,o)}return e}responseVariablesToQtiVariableJSON(t,e,r){if(e!=="single"){let i={list:{}};return i.list[r]=t,i}else{let i={base:{}};return i.base[r]=t,i}}#m(){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!==""}#b(t,e){let r=this.dataset.invalidresponsemessage||"Invalid response.",i=t?"":e&&e.trim().length>0?e:r;this._internals.setValidity(t?{}:{customError:!0},i)}validate(){let t=typeof this.#n=="boolean"?this.#n:this.#m();return this.#b(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.#u(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",i=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.baseType||"string",o=this.context?.variables?.find(a=>a.identifier===this.responseIdentifier)?.value||null,s=this.responseVariablesToQtiVariableJSON(o,r,i);t[this.responseIdentifier]=s}return t}#f(t){return t&&t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,"/").replace(/`/g,"`").replace(/=/g,"=")}#y(t){let e={};for(let[r,i]of Object.entries(t))typeof i=="string"?e[r]=this.#f(i):e[r]=i;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let r=this.iframe?.contentWindow;if(!this._iframeLoaded||!r){this._pendingMessages.push({method:t,params:e});return}r.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#q(){this._pendingMessages.length&&(this._pendingMessages.forEach(t=>{this.sendMessageToIframe(t.method,t.params)}),this._pendingMessages=[])}createIframe(){this._interactionReady=!1,this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this.#w(),this.#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.#d(this.#p(this.#y({...this.dataset}))),e=this.context?.state?.[this.responseIdentifier],r=typeof e=="string"&&e.length>0?e:null,i={module:this.module,customInteractionTypeIdentifier:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl?this.baseUrl.startsWith("http")||this.baseUrl.startsWith("blob")||this.baseUrl.startsWith("base64")?this.baseUrl:Ao(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#C(),boundTo:r?null:this.boundTo,responseDeclaration:this.#r(),status:this.status,state:r};this.sendMessageToIframe("initialize",i)}#C(){let t=[],e=this.querySelector("qti-interaction-modules");if(e){let r=e.querySelectorAll("qti-interaction-module");for(let i of r)t.push({id:i.getAttribute("id"),primaryPath:i.getAttribute("primary-path"),fallbackPath:i.getAttribute("fallback-path")})}return t}#w(){let t=this.querySelector("qti-interaction-markup");t&&this.sendMessageToIframe("setMarkup",t.innerHTML);let e=Array.from(this.querySelectorAll("qti-stylesheet"));if(e.length){let i=e.map(o=>o.outerHTML).join(`
|
|
8096
|
+
`);this.sendMessageToIframe("setStylesheets",i)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#x(){}connectedCallback(){super.connectedCallback(),this.#n=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.#h()),r=JSON.stringify(this.#l()),i=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",o=i?i.endsWith("/")?i:`${i}/`:`${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=`
|
|
7992
8097
|
font-family: ${t.getPropertyValue("font-family")};
|
|
7993
8098
|
font-size: ${t.getPropertyValue("font-size")};
|
|
7994
8099
|
line-height: ${t.getPropertyValue("line-height")};
|
|
@@ -8011,7 +8116,7 @@ CES.load();
|
|
|
8011
8116
|
height: auto;
|
|
8012
8117
|
overflow: hidden;
|
|
8013
8118
|
/* Add the extracted font styles here */
|
|
8014
|
-
${
|
|
8119
|
+
${f}
|
|
8015
8120
|
};
|
|
8016
8121
|
.qti-customInteraction {
|
|
8017
8122
|
width: 100%;
|
|
@@ -8885,7 +8990,7 @@ CES.load();
|
|
|
8885
8990
|
<h1>Error</h1>
|
|
8886
8991
|
${this._errorMessage}
|
|
8887
8992
|
</div>`:""}
|
|
8888
|
-
`}};vt([p({type:String,attribute:"module"})],W.prototype,"module",void 0);vt([p({type:String,attribute:"custom-interaction-type-identifier"})],W.prototype,"customInteractionTypeIdentifier",void 0);vt([p({type:String,attribute:"data-require-paths"})],W.prototype,"requirePathsJson",void 0);vt([p({type:String,attribute:"data-require-shim"})],W.prototype,"requireShimJson",void 0);vt([p({type:String,attribute:"data-require-js-url"})],W.prototype,"requireJsUrl",void 0);vt([p({type:String,attribute:"data-base-url"})],W.prototype,"baseUrl",void 0);vt([p({type:Boolean,attribute:"data-use-default-paths"})],W.prototype,"useDefaultPaths",void 0);vt([p({type:String,attribute:"data-status"})],W.prototype,"status",void 0);vt([_()],W.prototype,"_errorMessage",void 0);vt([T({context:j,subscribe:!0}),_()],W.prototype,"context",void 0);vt([T({context:
|
|
8993
|
+
`}};vt([p({type:String,attribute:"module"})],W.prototype,"module",void 0);vt([p({type:String,attribute:"custom-interaction-type-identifier"})],W.prototype,"customInteractionTypeIdentifier",void 0);vt([p({type:String,attribute:"data-require-paths"})],W.prototype,"requirePathsJson",void 0);vt([p({type:String,attribute:"data-require-shim"})],W.prototype,"requireShimJson",void 0);vt([p({type:String,attribute:"data-require-js-url"})],W.prototype,"requireJsUrl",void 0);vt([p({type:String,attribute:"data-base-url"})],W.prototype,"baseUrl",void 0);vt([p({type:Boolean,attribute:"data-use-default-paths"})],W.prototype,"useDefaultPaths",void 0);vt([p({type:String,attribute:"data-status"})],W.prototype,"status",void 0);vt([_()],W.prototype,"_errorMessage",void 0);vt([T({context:j,subscribe:!0}),_()],W.prototype,"context",void 0);vt([T({context:pt,subscribe:!0}),_()],W.prototype,"qtiContext",void 0);vt([p({attribute:"response",reflect:!1,converter:Vt({emptyAs:null})})],W.prototype,"response",void 0);var Bn=class extends W{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,r)=>{let i=()=>{window.clearTimeout(o),e()},o=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",i),r(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",i,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,r=i=>{let{data:o}=i;o?.source==="qti-pci-iframe"&&(!o?.responseIdentifier||o?.responseIdentifier===this.responseIdentifier)&&o?.method==="getContentResponse"&&o?.messageId===e&&(window.removeEventListener("message",r),t(o.content))};window.addEventListener("message",r),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",r),t("")},5e3)})}setTestContext(t){this.context=t,this.updateComplete.then(()=>{this.value=t?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#t=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#t=!1}}disconnectedCallback(){this.#t||super.disconnectedCallback()}async iFrameMouseClick(t,e){return new Promise(r=>{let i=`click-${Date.now()}`,o=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===i&&(window.removeEventListener("message",o),r())};window.addEventListener("message",o),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",o),r()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let r=`click-selector-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let r=`click-text-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(r=>{let i=`set-value-${Date.now()}`,o=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===i&&(window.removeEventListener("message",o),r(a.success))};window.addEventListener("message",o),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",o),r(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let r=`get-bounding-rect-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(r=>{let i=`set-value-text-${Date.now()}`,o=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===i&&(window.removeEventListener("message",o),r(a.success))};window.addEventListener("message",o),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",o),r(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let r=`mousedown-selector-${Date.now()}`,i=o=>{let{data:s}=o;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
|
|
8889
8994
|
// Test helper functions for QtiPortableCustomInteractionTest
|
|
8890
8995
|
// Base iframe implementation already provides PCIManager.getContent
|
|
8891
8996
|
|
|
@@ -9078,7 +9183,7 @@ CES.load();
|
|
|
9078
9183
|
}
|
|
9079
9184
|
},
|
|
9080
9185
|
true
|
|
9081
|
-
);`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var
|
|
9186
|
+
);`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var Un=[{tag:"qti-portable-custom-interaction",ctor:W},{tag:"qti-portable-custom-interaction-test",ctor:Bn}];var wh=[O,q`
|
|
9082
9187
|
:host {
|
|
9083
9188
|
display: block;
|
|
9084
9189
|
}
|
|
@@ -9089,12 +9194,12 @@ CES.load();
|
|
|
9089
9194
|
left: 50%;
|
|
9090
9195
|
transform: translateX(-50%);
|
|
9091
9196
|
}
|
|
9092
|
-
`];var
|
|
9197
|
+
`];var Hn=class extends C{static{this.styles=wh}render(){return b`<slot></slot>`}};var xh=[O,q`
|
|
9093
9198
|
:host {
|
|
9094
9199
|
display: inline-block;
|
|
9095
9200
|
position: relative;
|
|
9096
9201
|
}
|
|
9097
|
-
`];var
|
|
9202
|
+
`];var Wn=class extends C{static{this.styles=xh}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 Qn=[{tag:"qti-position-object-interaction",ctor:Hn},{tag:"qti-position-object-stage",ctor:Wn}];var qh="important",$u=" !"+qh,Gn=kt(class extends me{constructor(n){if(super(n),n.type!==wr.ATTRIBUTE||n.name!=="style"||n.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(n){return Object.keys(n).reduce((t,e)=>{let r=n[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(n,[t]){let{style:e}=n.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let i=t[r];if(i!=null){this.ft.add(r);let o=typeof i=="string"&&i.endsWith($u);r.includes("-")||o?e.setProperty(r,o?i.slice(0,-11):i,o?qh:""):e[r]=i}}return Z}});var Ch=[O,q`
|
|
9098
9203
|
:host {
|
|
9099
9204
|
display: block;
|
|
9100
9205
|
--qti-select-point-marker-size: 1.5rem;
|
|
@@ -9129,20 +9234,20 @@ CES.load();
|
|
|
9129
9234
|
-webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
9130
9235
|
mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
9131
9236
|
}
|
|
9132
|
-
`];var
|
|
9237
|
+
`];var Fr=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},dt=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.#o=0,this.#n=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#c();let e=this.#e.getBoundingClientRect(),r=(t.clientX-e.left)*this.#r,i=(t.clientY-e.top)*this.#i,o=`${r.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[o]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],o]),this.saveResponse(this.response)},this.#a=()=>{this.#c()}}static{this.styles=Ch}#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;#o;#n;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let t=this.response;return(Array.isArray(t)?t:t?[t]:[]).filter(r=>r).map(r=>{let[i,o]=r.split(" ").map(Number);return{x:i,y:o}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let r of t){let i=r.dataset.coord,o=r.dataset.shape;!i||!o||_e(o,i.split(",").map(s=>+s),e,r)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return b` <slot name="prompt"></slot>
|
|
9133
9238
|
<point-container>
|
|
9134
|
-
${H(e.filter(r=>r),r=>r,(r,i)=>{let[o,s]=r.split(" ").map(Number),a=o/(this.#
|
|
9239
|
+
${H(e.filter(r=>r),r=>r,(r,i)=>{let[o,s]=r.split(" ").map(Number),a=o/(this.#o||1)*100,l=s/(this.#n||1)*100;return b`
|
|
9135
9240
|
<button
|
|
9136
9241
|
part=${this.pointPart(r,i)}
|
|
9137
|
-
style=${
|
|
9242
|
+
style=${Gn({pointerEvents:this.maxChoices===1?"none":"auto",position:"absolute",left:`${a}%`,top:`${l}%`})}
|
|
9138
9243
|
aria-label="Remove point at ${r}"
|
|
9139
9244
|
?disabled=${this.disabled}
|
|
9140
|
-
@click=${
|
|
9245
|
+
@click=${c=>{c.stopPropagation(),this.response=(this.response||[]).filter((d,h)=>h!==i),this.saveResponse(this.response)}}
|
|
9141
9246
|
></button>
|
|
9142
9247
|
`})}
|
|
9143
9248
|
${this.renderSupplementalLayer()}
|
|
9144
9249
|
<slot></slot>
|
|
9145
|
-
</point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,i=!0,o="";return e?(i=!1,o=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(i=!1,o=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(i,o,this.#e??this,{suppressInline:!0}),i}reportValidity(){return super.reportValidity()}#c(){this.#
|
|
9250
|
+
</point-container>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,i=!0,o="";return e?(i=!1,o=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(i=!1,o=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(i,o,this.#e??this,{suppressInline:!0}),i}reportValidity(){return super.reportValidity()}#c(){this.#o=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#n=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#r=t.width===0?1:this.#o/t.width,this.#i=t.height===0?1:this.#n/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)}};Fr([p({type:Number,attribute:"max-choices"})],dt.prototype,"maxChoices",void 0);Fr([p({type:Number,attribute:"min-choices"})],dt.prototype,"minChoices",void 0);Fr([p({attribute:"response",reflect:!1,converter:{fromAttribute:n=>{let t=ya(n);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:n=>va(n)}})],dt.prototype,"response",void 0);Fr([p({attribute:"area-mappings"})],dt.prototype,"areaMappings",void 0);Fr([_()],dt.prototype,"_areaEntries",void 0);Fr([$("areaMappings")],dt.prototype,"_handleAreaMappingsChange",void 0);var Xn=[{tag:"qti-select-point-interaction",ctor:dt}];var kh=[O,q`
|
|
9146
9251
|
:host {
|
|
9147
9252
|
display: block;
|
|
9148
9253
|
--show-bounds: true;
|
|
@@ -9210,7 +9315,7 @@ CES.load();
|
|
|
9210
9315
|
text-align: center;
|
|
9211
9316
|
color: #6b7280; /* text-gray-500 */
|
|
9212
9317
|
}
|
|
9213
|
-
`];var
|
|
9318
|
+
`];var Xi=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},wt=class extends D{constructor(){super(...arguments),this.#t=0,this.min=0,this.max=100,this.step=1}static{this.styles=kh}#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`
|
|
9214
9319
|
<slot name="prompt"></slot>
|
|
9215
9320
|
<div id="slider" part="slider">
|
|
9216
9321
|
<div id="bounds" part="bounds">
|
|
@@ -9228,7 +9333,7 @@ CES.load();
|
|
|
9228
9333
|
${this.renderRailSupplement()}
|
|
9229
9334
|
</div>
|
|
9230
9335
|
</div>
|
|
9231
|
-
`}#r(t){this.#
|
|
9336
|
+
`}#r(t){this.#o(t.pageX);let e=i=>this.#n(i.pageX),r=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),this.#s()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",r)}#i(t){this.#o(t.touches[0].pageX);let e=i=>this.#n(i.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),this.#s()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r)}#o(t){this.#n(t)}#n(t){let e=this._rail.getBoundingClientRect(),r=t-e.left,i=Math.min(1,Math.max(0,r/e.width)),o=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#e(o)}#s(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};Xi([pr("#rail")],wt.prototype,"_rail",void 0);Xi([p({type:Number,attribute:"lower-bound"})],wt.prototype,"min",void 0);Xi([p({type:Number,attribute:"upper-bound"})],wt.prototype,"max",void 0);Xi([p({type:Number,attribute:"step"})],wt.prototype,"step",void 0);Xi([p({attribute:"response",reflect:!1,noAccessor:!0})],wt.prototype,"response",null);var Yn=[{tag:"qti-slider-interaction",ctor:wt}];var Eh=()=>new sc,sc=class{},nc=new WeakMap,O1=kt(class extends ge{render(n){return P}update(n,[t]){let e=t!==this.G;return e&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=n.options?.host,this.rt(this.ct=n.element)),P}rt(n){if(this.G!==void 0)if(this.isConnected||(n=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=nc.get(t);e===void 0&&(e=new WeakMap,nc.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,n),n!==void 0&&this.G.call(this.ht,n)}else this.G.value=n}get lt(){return typeof this.G=="function"?nc.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 Sh=[O,q`
|
|
9232
9337
|
:host {
|
|
9233
9338
|
display: inline-flex;
|
|
9234
9339
|
align-items: center;
|
|
@@ -9317,7 +9422,7 @@ CES.load();
|
|
|
9317
9422
|
:host(.qti-input-width-72) {
|
|
9318
9423
|
--qti-input-width: 72;
|
|
9319
9424
|
}
|
|
9320
|
-
`];var
|
|
9425
|
+
`];var sr=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},at=class extends D{constructor(){super(...arguments),this.inputRef=Eh(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Sh}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
|
|
9321
9426
|
part="input"
|
|
9322
9427
|
name="${this.responseIdentifier}"
|
|
9323
9428
|
spellcheck="false"
|
|
@@ -9327,13 +9432,13 @@ CES.load();
|
|
|
9327
9432
|
@keyup="${this.textChanged}"
|
|
9328
9433
|
@change="${this.textChanged}"
|
|
9329
9434
|
type="${this.patternMask=="[0-9]*"?"number":"text"}"
|
|
9330
|
-
placeholder="${
|
|
9435
|
+
placeholder="${jt(this.placeholderText?this.placeholderText:void 0)}"
|
|
9331
9436
|
.value="${this.response}"
|
|
9332
|
-
pattern="${
|
|
9437
|
+
pattern="${jt(this.patternMask?this.patternMask:void 0)}"
|
|
9333
9438
|
maxlength=${1e3}
|
|
9334
9439
|
?disabled="${this.disabled}"
|
|
9335
9440
|
?readonly="${this.readonly}"
|
|
9336
|
-
/>`}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=""}};
|
|
9441
|
+
/>`}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=""}};sr([p({type:Number,attribute:"expected-length"})],at.prototype,"expectedLength",void 0);sr([p({type:String,attribute:"pattern-mask"})],at.prototype,"patternMask",void 0);sr([p({type:String,attribute:"placeholder-text"})],at.prototype,"placeholderText",void 0);sr([p({type:String,attribute:"data-patternmask-message"})],at.prototype,"dataPatternmaskMessage",void 0);sr([p({type:String,attribute:"response",reflect:!1})],at.prototype,"response",void 0);sr([pr("input")],at.prototype,"_input",void 0);sr([$("response",{waitUntilFirstUpdate:!0})],at.prototype,"_handleValueChange",void 0);var Kn=[{tag:"qti-text-entry-interaction",ctor:at}];var Ah=[O,q`
|
|
9337
9442
|
:host {
|
|
9338
9443
|
display: block;
|
|
9339
9444
|
margin: 1em 0;
|
|
@@ -9342,12 +9447,12 @@ CES.load();
|
|
|
9342
9447
|
display: block;
|
|
9343
9448
|
margin-top: 0.5em;
|
|
9344
9449
|
}
|
|
9345
|
-
`];var
|
|
9450
|
+
`];var Jn=class extends D{static{this.styles=Ah}#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`
|
|
9346
9451
|
<div>
|
|
9347
9452
|
<slot name="prompt"></slot>
|
|
9348
9453
|
<input type="file" @change="${this.#r}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" />
|
|
9349
9454
|
</div>
|
|
9350
|
-
`}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 i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(t)})}};var Un=[{tag:"qti-upload-interaction",ctor:Bn}];var fh=[...qd,...bn,...yn,...vn,...xn,...qn,...Cn,...kn,...En,...Sn,...An,...In,..._n,...Tn,...On,...Pn,...Dn,...Ln,...zn,...jn,...Fn,...Un];for(let{tag:n,ctor:t}of fh)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of bn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of yn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of vn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of xn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of qn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Cn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of kn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of En)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Sn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of An)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of In)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of _n)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Tn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of On)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Pn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Dn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Ln)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of zn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of jn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Fn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Un)customElements.get(n)||customElements.define(n,t);var TM=async n=>{let t=n.substring(0,n.lastIndexOf("/")),e=await vl().load(`${n}`).then(a=>a.assessmentTest()),r=await vr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await vr().load(`${t}/${e.href}`).then(a=>a.items()),o=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:o,items:i,testIdentifier:e.identifier}},RM=async n=>Vt().load(n).then(t=>t.htmlDoc().firstElementChild);var Hn=class extends Su(ut){calculate(){return this.calculateChildren(Array.from(this.children))}};function Su(n){return class extends n{calculateChildren(e){return e.map(i=>{let o=i;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=o.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var gh=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Nr=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}};gh([p({type:Number})],Nr.prototype,"min",void 0);gh([p({type:Number})],Nr.prototype,"max",void 0);var Au=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Bi=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Au([p({type:String,attribute:"base-type"})],Bi.prototype,"baseType",void 0);var Wn=class extends E{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 Qn=class extends ut{getResult(){let t=this.getVariables();if(this.children.length===2){let e=t[0],r=t[1];if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,o=r.value;return i.filter(c=>o.includes(c)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return r.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};var Gn=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 Za=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},rr=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let o=this._testContext.items.find(a=>a.identifier===e);if(console.debug(`itemContext: ${JSON.stringify(o)}`),!this._testContext||!o)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(o=>o.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Za([p({type:String})],rr.prototype,"identifier",void 0);Za([T({context:j,subscribe:!0}),_()],rr.prototype,"context",void 0);Za([_(),T({context:pt,subscribe:!0})],rr.prototype,"_testContext",void 0);var Xn=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(o=>!e.value.includes(o))}return null}};var Yn=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.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(o=>i(o));continue}i(r.value)}return e}};var Kn=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 Jn=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 Iu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ui=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let i=parseFloat(e.value),o=parseFloat(r.value);if(!isNaN(i)&&!isNaN(o))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===o.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${o}`);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}};Iu([p({type:String})],Ui.prototype,"roundingMode",void 0);var _u=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Hi=class extends E{constructor(){super(...arguments),this.toleranceMode="exact"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):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:J.compareSingleValues(e.value,r.value,e.baseType)}return console.error("unexpected number of children in qti-equal"),null}};_u([p({type:String})],Hi.prototype,"toleranceMode",void 0);var Zn=class extends E{getResult(){let t=this.getAttribute("field-identifier");if(!t)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let r=this.getVariables()[0];if(r.baseType!=="record"||r.value===null)throw new Error("qti-field-value child expression must return a record");let i=r.value[t];if(i===void 0)throw new Error(`Field "${t}" not found in record`);return i}};var ts=class extends E{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(r.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(r.cardinality==="multiple"||r.cardinality==="ordered"){if(!Array.isArray(r.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of r.value){if(i==null)return null;let o=parseInt(i,10);if(isNaN(o))return console.error("qti-gcd non-numerical value"),null;e.push(o)}}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 es=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 rs=class extends ut{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.log("unexpected number of children in qte"),null}};var Tu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Wi=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)}};Tu([p({type:String})],Wi.prototype,"n",void 0);var bh=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},$r=class extends E{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),i=this.#e(this.coords);if(!r||i.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,i);case"rect":return this.#i(r,i);case"ellipse":return this.#n(r,i);case"poly":case"polygon":return this.#o(r,i);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(o=>o.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,o]=e;return(t.x-r)**2+(t.y-i)**2<=o**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,o,s]=e,a=Math.min(r,o),c=Math.max(r,o),l=Math.min(i,s),d=Math.max(i,s);return t.x>=a&&t.x<=c&&t.y>=l&&t.y<=d}#n(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,i,o,s]=e;return o===0||s===0?!1:(t.x-r)**2/o**2+(t.y-i)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,o=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],c=e[o],l=e[o+1];a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a||Number.EPSILON)+s&&(r=!r),o=i}return r}};bh([p({type:String})],$r.prototype,"shape",void 0);bh([p({type:String})],$r.prototype,"coords",void 0);var is=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};var os=class extends E{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]%t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};var ns=class extends E{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 ss=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t)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 as=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);continue}if(r.cardinality!=="multiple"&&r.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(r.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let i of r.value){let o=Number.parseInt(i,10);if(Number.isNaN(o))return console.error("qti-lcm requires integer values"),[];e.push(o)}}return e}#e(t,e){let r=Math.abs(t),i=Math.abs(e);for(;i!==0;){let o=r%i;r=i,i=o}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var st=class extends C{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var yh=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Lr=class extends st{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context.variables.find(i=>i.identifier===t)||null,r;return e.interpolationTable&&(r=e.interpolationTable.get(parseFloat(this.childExpression.calculate()))),r==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:qt(r)}})),r)}};yh([p({type:String})],Lr.prototype,"identifier",void 0);yh([T({context:j,subscribe:!0}),_()],Lr.prototype,"context",void 0);var cs=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 ls=class extends ut{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.log("unexpected number of children in lte"),null}};var Ru=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Qi=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 i=0,o=new Set;for(let s of r)for(let a of e.areaMapEntries){if(o.has(a.coords))continue;J.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)&&(i+=a.mappedValue??0,o.add(a.coords))}return o.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Ru([p({type:String})],Qi.prototype,"identifier",void 0);var Ou=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Gi=class extends E{getResult(){let t=this.context.variables.find(o=>o.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let o of r){let s=e.mapEntries.filter(c=>t.baseType==="string"&&!c.caseSensitive?J.compareSingleValues(c.mapKey.toLowerCase(),o.toLowerCase(),t.baseType):J.compareSingleValues(c.mapKey,o,t.baseType)),a=s.reduce((c,l)=>c.mappedValue>l.mappedValue?c:l,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};Ou([p({type:String})],Gi.prototype,"identifier",void 0);var ds=class n extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return n.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):J.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!J.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let o=null,s=[...t.value];for(let a of s)if(J.compareSingleValues(i,a,e.baseType)){o=a;break}if(o!==null)s.splice(s.indexOf(o),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Pu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Xi=class extends E{constructor(){super(...arguments),this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let i=parseFloat(r.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}return this.#t(this.name,e)}#t(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"log":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],i=e[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(e.length!==2)return null;let r=e[0],i=e[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};Pu([p({type:String})],Xi.prototype,"name",void 0);var hs=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.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(o=>i(o));continue}i(r.value)}return e}};var ps=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};var us=class extends E{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.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(o=>i(o));continue}i(r.value)}return e}};var ms=class extends E{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);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 fs=class extends E{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var gs=class extends E{getResult(){return null}};var bs=class extends ut{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),o=!1;if(typeof i=="string")if(i==="true")o=!0;else if(i==="false")o=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(o=i);return o}).some(e=>typeof e=="boolean"&&e)}};var ys=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 vs=class extends C{render(){return b`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},Vr=class extends vs{shouldProcess(){return!0}getSubRules(){return[...this.children]}},zr=class extends vs{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},jr=class extends st{render(){return b`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var ws=class extends jr{};var Fr=class extends zr{};var xs=class extends Fr{};var qs=class extends Vr{};var Mu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Yi=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;try{return new RegExp(this.pattern).test(e.value.toString())}catch(r){return console.error("qti-pattern-match requires a valid regular expression",r),null}}};Mu([p({type:String})],Yi.prototype,"pattern",void 0);var Cs=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),o=parseFloat(r.value);if(isNaN(i)||isNaN(o))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&o<=0||i<0&&!Number.isInteger(o))return null;let s;try{s=Math.pow(i,o)}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 vh=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Br=class extends C{render(){let t=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return t===null?P:b`${JSON.stringify(t,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};vh([p({type:String})],Br.prototype,"identifier",void 0);vh([T({context:j,subscribe:!0}),_()],Br.prototype,"context",void 0);var ks=class extends E{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};var tc=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ir=class extends E{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),e++}if(t.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let r=Math.floor(Math.random()*t.length);return t[r]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};tc([p({type:Number})],ir.prototype,"min",void 0);tc([p({type:Number})],ir.prototype,"max",void 0);tc([p({type:Number})],ir.prototype,"step",void 0);var Es=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 Du=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ki=class extends E{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let i=0;i<t;i++){let o=e.calculate(),s=this.#e(o);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 t;let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,o=parseInt(i?.toString()??"",10);return Number.isNaN(o)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):o}#e(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"}}};Du([p({type:String,attribute:"number-repeats"})],Ki.prototype,"numberRepeats",void 0);var Ss=class extends jr{};var Ur=class extends zr{};var As=class extends Ur{};var Is=class extends Vr{};var wh=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Hr=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),i=Math.pow(10,e-r-1);return Math.round(t*i)/i}};wh([p({type:String,attribute:"rounding-mode"})],Hr.prototype,"roundingMode",void 0);wh([p({type:Number})],Hr.prototype,"figures",void 0);var _s=class extends E{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 Ts=class extends st{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new ec(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>qt(this.#e(e))):qt(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()??""}},ec=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 Rs=class extends st{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new rc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(qt):t!==null?qt(t):null}},rc=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 Os=class extends st{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new ic(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>qt(this.#e(e))):qt(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()??""}},ic=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 Nu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ji=class extends E{constructor(){super(...arguments),this.name=""}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#e(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return t.reduce((e,r)=>e+r,0)/t.length;case"popsd":return this.#t(t);default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){let e=t.reduce((i,o)=>i+o,0)/t.length,r=t.reduce((i,o)=>i+Math.pow(o-e,2),0)/t.length;return Math.sqrt(r)}#e(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.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(o=>i(o));continue}i(r.value)}return e}};Nu([p({type:String})],Ji.prototype,"name",void 0);var $u=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Zi=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),o=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return J.compareSingleValues(i,o,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};$u([p({type:String,attribute:"case-sensitive"})],Zi.prototype,"caseSensitive",void 0);var Lu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},to=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let i=e.value.toString(),o=r.value.toString();return this.caseSensitive!=="true"?o.toLowerCase().includes(i.toLowerCase()):o.includes(i)}};Lu([p({type:String,attribute:"case-sensitive"})],to.prototype,"caseSensitive",void 0);var Ps=class extends Vu(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function Vu(n){return class extends n{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=i.calculate();return Number.isNaN(o)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(o)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var Ms=class extends E{getResult(){return new oc(Array.from(this.children)).calculate()}},oc=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(r=>r.calculate!==void 0).some(r=>r.calculate()===null)?null:this.expressions.map(r=>{let i=r.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((r,i)=>r+i,0)}};var Ds=class extends E{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 Ns=class extends E{getResult(){let t=this.getAttribute("identifier");return this.context.variables.find(r=>r.identifier===t).value}};var xh=[{tag:"qti-and",ctor:Hn},{tag:"qti-any-n",ctor:Nr},{tag:"qti-base-value",ctor:Bi},{tag:"qti-container-size",ctor:Wn},{tag:"qti-contains",ctor:Qn},{tag:"qti-correct",ctor:Gn},{tag:"qti-default",ctor:rr},{tag:"qti-delete",ctor:Xn},{tag:"qti-divide",ctor:Yn},{tag:"qti-duration-gte",ctor:Kn},{tag:"qti-duration-lt",ctor:Jn},{tag:"qti-equal",ctor:Hi},{tag:"qti-equal-rounded",ctor:Ui},{tag:"qti-field-value",ctor:Zn},{tag:"qti-gcd",ctor:ts},{tag:"qti-gt",ctor:es},{tag:"qti-gte",ctor:rs},{tag:"qti-index",ctor:Wi},{tag:"qti-inside",ctor:$r},{tag:"qti-integer-divide",ctor:is},{tag:"qti-integer-modulus",ctor:os},{tag:"qti-integer-to-float",ctor:ns},{tag:"qti-is-null",ctor:ss},{tag:"qti-lcm",ctor:as},{tag:"qti-lookup-outcome-value",ctor:Lr},{tag:"qti-lt",ctor:cs},{tag:"qti-lte",ctor:ls},{tag:"qti-map-response",ctor:Gi},{tag:"qti-map-response-point",ctor:Qi},{tag:"qti-match",ctor:ds},{tag:"qti-math-operator",ctor:Xi},{tag:"qti-max",ctor:hs},{tag:"qti-member",ctor:ps},{tag:"qti-min",ctor:us},{tag:"qti-multiple",ctor:ms},{tag:"qti-not",ctor:fs},{tag:"qti-null",ctor:gs},{tag:"qti-or",ctor:bs},{tag:"qti-ordered",ctor:ys},{tag:"qti-outcome-condition",ctor:ws},{tag:"qti-outcome-else",ctor:qs},{tag:"qti-outcome-else-if",ctor:xs},{tag:"qti-outcome-if",ctor:Fr},{tag:"qti-pattern-match",ctor:Yi},{tag:"qti-power",ctor:Cs},{tag:"qti-printed-variable",ctor:Br},{tag:"qti-product",ctor:ks},{tag:"qti-random",ctor:Es},{tag:"qti-random-integer",ctor:ir},{tag:"qti-repeat",ctor:Ki},{tag:"qti-response-condition",ctor:Ss},{tag:"qti-response-else",ctor:Is},{tag:"qti-response-else-if",ctor:As},{tag:"qti-response-if",ctor:Ur},{tag:"qti-round",ctor:_s},{tag:"qti-round-to",ctor:Hr},{tag:"qti-rule",ctor:st},{tag:"qti-set-correct-response",ctor:Ts},{tag:"qti-set-outcome-value",ctor:Rs},{tag:"qti-set-template-value",ctor:Os},{tag:"qti-stats-operator",ctor:Ji},{tag:"qti-string-match",ctor:Zi},{tag:"qti-substring",ctor:to},{tag:"qti-subtract",ctor:Ps},{tag:"qti-sum",ctor:Ms},{tag:"qti-truncate",ctor:Ds},{tag:"qti-variable",ctor:Ns}];for(let{tag:n,ctor:t}of xh)customElements.get(n)||customElements.define(n,t);var ne=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},X;(function(n){n.Correct="correct",n.PartiallyCorrect="partially-correct",n.Incorrect="incorrect"})(X||(X={}));var nc=n=>{class t extends n{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,i)=>{this.toggleCandidateCorrection(i)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let i=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",i)}get correctness(){let r=this.correctResponse;if(!r)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let o=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let c=a.filter(d=>o.includes(d)).length,l=a.filter(d=>!o.includes(d)).length;return c===o.length&&l===0&&a.length===o.length?X.Correct:c>0&&(c<o.length||l>0)?X.PartiallyCorrect:X.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let i=this.nextSibling,o=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==X.Correct))){if(!o)return;this.parentElement?.removeChild(i);return}if(o)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 ne([p({attribute:"correct-response",reflect:!0,converter:Lt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),ne([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),ne([$("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),ne([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),ne([$("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),ne([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),ne([$("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),ne([_()],t.prototype,"_isFullCorrectResponse",void 0),ne([_()],t.prototype,"_correctResponse",void 0),t};var rt=q`
|
|
9455
|
+
`}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 i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(t)})}};var Zn=[{tag:"qti-upload-interaction",ctor:Jn}];var Ih=[...Dd,...Sn,...An,...In,...Tn,...Rn,...On,...Pn,...Mn,...Dn,...Nn,...$n,...Ln,...Vn,...jn,...Fn,...Un,...Qn,...Xn,...Yn,...Kn,...Zn];for(let{tag:n,ctor:t}of Ih)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Sn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of An)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of In)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Tn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Rn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of On)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Pn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Mn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Dn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Nn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of $n)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Ln)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Vn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of jn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Fn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Un)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Qn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Xn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Yn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Kn)customElements.get(n)||customElements.define(n,t);for(let{tag:n,ctor:t}of Zn)customElements.get(n)||customElements.define(n,t);var cD=async n=>{let t=n.substring(0,n.lastIndexOf("/")),e=await Ol().load(`${n}`).then(a=>a.assessmentTest()),r=await Sr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Sr().load(`${t}/${e.href}`).then(a=>a.items()),o=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:o,items:i,testIdentifier:e.identifier}},lD=async n=>zt().load(n).then(t=>t.htmlDoc().firstElementChild);var ts=class extends Lu(ut){calculate(){return this.calculateChildren(Array.from(this.children))}};function Lu(n){return class extends n{calculateChildren(e){return e.map(i=>{let o=i;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=o.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var _h=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Br=class extends A{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}};_h([p({type:Number})],Br.prototype,"min",void 0);_h([p({type:Number})],Br.prototype,"max",void 0);var Vu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Yi=class extends A{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Vu([p({type:String,attribute:"base-type"})],Yi.prototype,"baseType",void 0);var es=class extends A{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 rs=class extends ut{getResult(){let t=this.getVariables();if(this.children.length===2){let e=t[0],r=t[1];if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,o=r.value;return i.filter(l=>o.includes(l)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return r.value.includes(i)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};var is=class extends A{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 ac=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ar=class extends A{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 o=this._testContext.items.find(a=>a.identifier===e);if(console.debug(`itemContext: ${JSON.stringify(o)}`),!this._testContext||!o)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(o=>o.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};ac([p({type:String})],ar.prototype,"identifier",void 0);ac([T({context:j,subscribe:!0}),_()],ar.prototype,"context",void 0);ac([_(),T({context:ot,subscribe:!0})],ar.prototype,"_testContext",void 0);var os=class extends A{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(o=>!e.value.includes(o))}return null}};var ns=class extends A{getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.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(o=>i(o));continue}i(r.value)}return e}};var ss=class extends A{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 as=class extends A{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 zu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ki=class extends A{constructor(){super(...arguments),this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let e=parseInt(this.getAttribute("figures")||"0");return isNaN(e)?(console.error("figures attribute is not a number"),null):e<0?(console.error("figures attribute is negative"),null):e<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):e}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(this.roundingMode===null)return null;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(t[0].baseType){case"integer":case"float":{let i=parseFloat(e.value),o=parseFloat(r.value);if(!isNaN(i)&&!isNaN(o))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===o.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${o}`);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}};zu([p({type:String})],Ki.prototype,"roundingMode",void 0);var ju=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ji=class extends A{constructor(){super(...arguments),this.toleranceMode="exact"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):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:J.compareSingleValues(e.value,r.value,e.baseType)}return console.error("unexpected number of children in qti-equal"),null}};ju([p({type:String})],Ji.prototype,"toleranceMode",void 0);var cs=class extends A{getResult(){let t=this.getAttribute("field-identifier");if(!t)throw new Error("field-identifier attribute is required");if(Array.from(this.children).length!==1)throw new Error("qti-field-value must have exactly one child expression");let r=this.getVariables()[0];if(r.baseType!=="record"||r.value===null)throw new Error("qti-field-value child expression must return a record");let i=r.value[t];if(i===void 0)throw new Error(`Field "${t}" not found in record`);return i}};var ls=class extends A{getResult(){if(this.children.length===0)return console.error("qti-gcd must have at least one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-gcd requires integer base-type"),null;if(r.value===null||r.value===void 0)return null;if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-gcd unexpected array value for single cardinality"),null;let i=parseInt(r.value,10);if(isNaN(i))return console.error("qti-gcd non-numerical value"),null;e.push(i)}else if(r.cardinality==="multiple"||r.cardinality==="ordered"){if(!Array.isArray(r.value))return console.error("qti-gcd expected array value for multiple/ordered cardinality"),null;for(let i of r.value){if(i==null)return null;let o=parseInt(i,10);if(isNaN(o))return console.error("qti-gcd non-numerical value"),null;e.push(o)}}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 ds=class extends A{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 hs=class extends ut{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.log("unexpected number of children in qte"),null}};var Fu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Zi=class extends A{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)}};Fu([p({type:String})],Zi.prototype,"n",void 0);var Th=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ur=class extends A{constructor(){super(...arguments),this.shape="",this.coords=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-inside requires exactly one point expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-inside requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(!this.shape||!this.coords)return console.error("qti-inside requires shape and coords attributes"),null;let r=this.#t(e.value.toString()),i=this.#e(this.coords);if(!r||i.length===0)return null;switch(this.shape.toLowerCase()){case"circle":return this.#r(r,i);case"rect":return this.#i(r,i);case"ellipse":return this.#o(r,i);case"poly":case"polygon":return this.#n(r,i);default:return console.error(`qti-inside does not support shape "${this.shape}"`),null}}#t(t){let e=t.split(/[,\s]+/).map(o=>o.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,o]=e;return(t.x-r)**2+(t.y-i)**2<=o**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,o,s]=e,a=Math.min(r,o),l=Math.max(r,o),c=Math.min(i,s),d=Math.max(i,s);return t.x>=a&&t.x<=l&&t.y>=c&&t.y<=d}#o(t,e){if(e.length!==4)return console.error("qti-inside ellipse requires centerX,centerY,radiusX,radiusY"),null;let[r,i,o,s]=e;return o===0||s===0?!1:(t.x-r)**2/o**2+(t.y-i)**2/s**2<=1}#n(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,o=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],l=e[o],c=e[o+1];a>t.y!=c>t.y&&t.x<(l-s)*(t.y-a)/(c-a||Number.EPSILON)+s&&(r=!r),o=i}return r}};Th([p({type:String})],Ur.prototype,"shape",void 0);Th([p({type:String})],Ur.prototype,"coords",void 0);var ps=class extends A{getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-divide requires integer values"),[];e.push(i)}return e}};var us=class extends A{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]%t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};var ms=class extends A{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 fs=class extends A{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t)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 gs=class extends A{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.error("qti-lcm requires at least one integer value"),null):t.reduce((e,r)=>this.#r(e,r))}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-lcm requires integer base-type"),[];if(r.value===null||r.value===void 0)return[];if(r.cardinality==="single"){if(Array.isArray(r.value))return console.error("qti-lcm unexpected array value for single cardinality"),[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-lcm requires integer values"),[];e.push(i);continue}if(r.cardinality!=="multiple"&&r.cardinality!=="ordered")return console.error("qti-lcm unsupported cardinality"),[];if(!Array.isArray(r.value))return console.error("qti-lcm expected array value for container cardinality"),[];for(let i of r.value){let o=Number.parseInt(i,10);if(Number.isNaN(o))return console.error("qti-lcm requires integer values"),[];e.push(o)}}return e}#e(t,e){let r=Math.abs(t),i=Math.abs(e);for(;i!==0;){let o=r%i;r=i,i=o}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var ct=class extends C{render(){return b`<slot></slot>`}process(){throw new Error("Not implemented")}};var Rh=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Hr=class extends ct{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context.variables.find(i=>i.identifier===t)||null,r;return e.interpolationTable&&(r=e.interpolationTable.get(parseFloat(this.childExpression.calculate()))),r==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:qt(r)}})),r)}};Rh([p({type:String})],Hr.prototype,"identifier",void 0);Rh([T({context:j,subscribe:!0}),_()],Hr.prototype,"context",void 0);var bs=class extends A{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 ys=class extends ut{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.log("unexpected number of children in lte"),null}};var Bu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},to=class extends A{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 i=0,o=new Set;for(let s of r)for(let a of e.areaMapEntries){if(o.has(a.coords))continue;J.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)&&(i+=a.mappedValue??0,o.add(a.coords))}return o.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Bu([p({type:String})],to.prototype,"identifier",void 0);var Uu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},eo=class extends A{getResult(){let t=this.context.variables.find(o=>o.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let o of r){let s=e.mapEntries.filter(l=>t.baseType==="string"&&!l.caseSensitive?J.compareSingleValues(l.mapKey.toLowerCase(),o.toLowerCase(),t.baseType):J.compareSingleValues(l.mapKey,o,t.baseType)),a=s.reduce((l,c)=>l.mappedValue>c.mappedValue?l:c,s.length>0?s[0]:{mapKey:null,mappedValue:null});a===null||a.mappedValue==null?i+=e.defaultValue:i+=a.mappedValue}return e?.lowerBound!==null&&e?.lowerBound!==void 0&&(i=Math.max(e.lowerBound,i)),e?.upperBound!==null&&e?.upperBound!==void 0&&(i=Math.min(e.upperBound,i)),i}};Uu([p({type:String})],eo.prototype,"identifier",void 0);var vs=class n extends A{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return n.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):J.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!J.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let o=null,s=[...t.value];for(let a of s)if(J.compareSingleValues(i,a,e.baseType)){o=a;break}if(o!==null)s.splice(s.indexOf(o),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Hu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ro=class extends A{constructor(){super(...arguments),this.name=""}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let i=parseFloat(r.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}return this.#t(this.name,e)}#t(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"log":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],i=e[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(e.length!==2)return null;let r=e[0],i=e[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};Hu([p({type:String})],ro.prototype,"name",void 0);var ws=class extends A{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-max: no numeric values provided"),null):Math.max(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.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(o=>i(o));continue}i(r.value)}return e}};var xs=class extends A{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};var qs=class extends A{getResult(){let t=this.#t(this.getVariables());return t.length===0?(console.warn("qti-min: no numeric values provided"),null):Math.min(...t)}#t(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.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(o=>i(o));continue}i(r.value)}return e}};var Cs=class extends A{getResult(){console.debug("qti-multiple getResult called",this.innerHTML);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 ks=class extends A{render(){return b`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var Es=class extends A{getResult(){return null}};var Ss=class extends ut{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),o=!1;if(typeof i=="string")if(i==="true")o=!0;else if(i==="false")o=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(o=i);return o}).some(e=>typeof e=="boolean"&&e)}};var As=class extends A{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 Is=class extends C{render(){return b`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},Wr=class extends Is{shouldProcess(){return!0}getSubRules(){return[...this.children]}},Qr=class extends Is{shouldProcess(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},Gr=class extends ct{render(){return b`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var _s=class extends Gr{};var Xr=class extends Qr{};var Ts=class extends Xr{};var Rs=class extends Wr{};var Wu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},io=class extends A{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;try{return new RegExp(this.pattern).test(e.value.toString())}catch(r){return console.error("qti-pattern-match requires a valid regular expression",r),null}}};Wu([p({type:String})],io.prototype,"pattern",void 0);var Os=class extends A{getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),o=parseFloat(r.value);if(isNaN(i)||isNaN(o))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&o<=0||i<0&&!Number.isInteger(o))return null;let s;try{s=Math.pow(i,o)}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 Oh=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Yr=class extends C{render(){let t=this.context?.variables.find(e=>e.identifier===this.identifier)?.value;return t===null?P:b`${JSON.stringify(t,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};Oh([p({type:String})],Yr.prototype,"identifier",void 0);Oh([T({context:j,subscribe:!0}),_()],Yr.prototype,"context",void 0);var Ps=class extends A{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseFloat(i.value.toString())}catch{console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};var cc=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},cr=class extends A{constructor(){super(...arguments),this.min=0,this.max=10,this.step=1}getResult(){if(this.min>this.max)return console.error("qti-random-integer: min cannot be greater than max"),this.min;if(this.step<=0)return console.error("qti-random-integer: step must be positive"),this.min;let t=[],e=0;for(;;){let i=this.min+this.step*e;if(i>this.max)break;Number.isInteger(i)&&t.push(i),e++}if(t.length===0)return console.warn("qti-random-integer: no valid integer values in range"),Number.isInteger(this.min)?this.min:Math.floor(this.min);let r=Math.floor(Math.random()*t.length);return t[r]}getPossibleValues(){let t=[];if(this.min>this.max||this.step<=0)return[Number.isInteger(this.min)?this.min:Math.floor(this.min)];let e=0;for(;;){let r=this.min+this.step*e;if(r>this.max)break;Number.isInteger(r)&&t.push(r),e++}return t.length>0?t:[Number.isInteger(this.min)?this.min:Math.floor(this.min)]}};cc([p({type:Number})],cr.prototype,"min",void 0);cc([p({type:Number})],cr.prototype,"max",void 0);cc([p({type:Number})],cr.prototype,"step",void 0);var Ms=class extends A{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 Qu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},oo=class extends A{constructor(){super(...arguments),this.numberRepeats=""}getResult(){let t=this.#t();if(t<=0)return[];let e=this.firstElementChild;if(!e)return console.warn("qti-repeat: missing child expression"),[];let r=[];for(let i=0;i<t;i++){let o=e.calculate(),s=this.#e(o);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 t;let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,o=parseInt(i?.toString()??"",10);return Number.isNaN(o)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):o}#e(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"}}};Qu([p({type:String,attribute:"number-repeats"})],oo.prototype,"numberRepeats",void 0);var Ds=class extends Gr{};var Kr=class extends Qr{};var Ns=class extends Kr{};var $s=class extends Wr{};var Ph=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Jr=class extends A{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),i=Math.pow(10,e-r-1);return Math.round(t*i)/i}};Ph([p({type:String,attribute:"rounding-mode"})],Jr.prototype,"roundingMode",void 0);Ph([p({type:Number})],Jr.prototype,"figures",void 0);var Ls=class extends A{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 Vs=class extends ct{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetCorrectResponse: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetCorrectResponse: No expression found.");return}let i=new lc(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>qt(this.#e(e))):qt(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()??""}},lc=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 zs=class extends ct{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetOutcomeValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetOutcomeValue: No expression found.");return}let i=new dc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(qt):t!==null?qt(t):null}},dc=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 js=class extends ct{process(){let t=this.getAttribute("identifier");if(!t){console.warn('QtiSetTemplateValue: Missing "identifier" attribute.');return}let e=this.firstElementChild;if(!e){console.warn("QtiSetTemplateValue: No expression found.");return}let i=new hc(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>qt(this.#e(e))):qt(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()??""}},hc=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 Gu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},no=class extends A{constructor(){super(...arguments),this.name=""}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#e(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return t.reduce((e,r)=>e+r,0)/t.length;case"popsd":return this.#t(t);default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){let e=t.reduce((i,o)=>i+o,0)/t.length,r=t.reduce((i,o)=>i+Math.pow(o-e,2),0)/t.length;return Math.sqrt(r)}#e(t){let e=[];for(let r of t){if(!r)continue;let i=o=>{if(o==null)return;let s=parseFloat(o.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(o=>i(o));continue}i(r.value)}return e}};Gu([p({type:String})],no.prototype,"name",void 0);var Xu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},so=class extends A{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),o=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return J.compareSingleValues(i,o,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Xu([p({type:String,attribute:"case-sensitive"})],so.prototype,"caseSensitive",void 0);var Yu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},ao=class extends A{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){let t=this.getVariables();if(t.length!==2)return console.error("qti-substring requires exactly 2 child expressions"),null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-substring requires single cardinality"),null;if(e.value===null||r.value===null||e.value===void 0||r.value===void 0)return null;let i=e.value.toString(),o=r.value.toString();return this.caseSensitive!=="true"?o.toLowerCase().includes(i.toLowerCase()):o.includes(i)}};Yu([p({type:String,attribute:"case-sensitive"})],ao.prototype,"caseSensitive",void 0);var Fs=class extends Ku(A){getResult(){return this.calculateChildren(Array.from(this.children))}};function Ku(n){return class extends n{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=i.calculate();return Number.isNaN(o)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(o)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var Bs=class extends A{getResult(){return new pc(Array.from(this.children)).calculate()}},pc=class{constructor(t){this.expressions=t}calculate(){return this.expressions.filter(r=>r.calculate!==void 0).some(r=>r.calculate()===null)?null:this.expressions.map(r=>{let i=r.calculate();return Number.isNaN(i)?(console.error("unexpected value in qti-sum, expected number"),null):Number(i)}).reduce((r,i)=>r+i,0)}};var Us=class extends A{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 Hs=class extends A{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var Mh=[{tag:"qti-and",ctor:ts},{tag:"qti-any-n",ctor:Br},{tag:"qti-base-value",ctor:Yi},{tag:"qti-container-size",ctor:es},{tag:"qti-contains",ctor:rs},{tag:"qti-correct",ctor:is},{tag:"qti-default",ctor:ar},{tag:"qti-delete",ctor:os},{tag:"qti-divide",ctor:ns},{tag:"qti-duration-gte",ctor:ss},{tag:"qti-duration-lt",ctor:as},{tag:"qti-equal",ctor:Ji},{tag:"qti-equal-rounded",ctor:Ki},{tag:"qti-field-value",ctor:cs},{tag:"qti-gcd",ctor:ls},{tag:"qti-gt",ctor:ds},{tag:"qti-gte",ctor:hs},{tag:"qti-index",ctor:Zi},{tag:"qti-inside",ctor:Ur},{tag:"qti-integer-divide",ctor:ps},{tag:"qti-integer-modulus",ctor:us},{tag:"qti-integer-to-float",ctor:ms},{tag:"qti-is-null",ctor:fs},{tag:"qti-lcm",ctor:gs},{tag:"qti-lookup-outcome-value",ctor:Hr},{tag:"qti-lt",ctor:bs},{tag:"qti-lte",ctor:ys},{tag:"qti-map-response",ctor:eo},{tag:"qti-map-response-point",ctor:to},{tag:"qti-match",ctor:vs},{tag:"qti-math-operator",ctor:ro},{tag:"qti-max",ctor:ws},{tag:"qti-member",ctor:xs},{tag:"qti-min",ctor:qs},{tag:"qti-multiple",ctor:Cs},{tag:"qti-not",ctor:ks},{tag:"qti-null",ctor:Es},{tag:"qti-or",ctor:Ss},{tag:"qti-ordered",ctor:As},{tag:"qti-outcome-condition",ctor:_s},{tag:"qti-outcome-else",ctor:Rs},{tag:"qti-outcome-else-if",ctor:Ts},{tag:"qti-outcome-if",ctor:Xr},{tag:"qti-pattern-match",ctor:io},{tag:"qti-power",ctor:Os},{tag:"qti-printed-variable",ctor:Yr},{tag:"qti-product",ctor:Ps},{tag:"qti-random",ctor:Ms},{tag:"qti-random-integer",ctor:cr},{tag:"qti-repeat",ctor:oo},{tag:"qti-response-condition",ctor:Ds},{tag:"qti-response-else",ctor:$s},{tag:"qti-response-else-if",ctor:Ns},{tag:"qti-response-if",ctor:Kr},{tag:"qti-round",ctor:Ls},{tag:"qti-round-to",ctor:Jr},{tag:"qti-rule",ctor:ct},{tag:"qti-set-correct-response",ctor:Vs},{tag:"qti-set-outcome-value",ctor:zs},{tag:"qti-set-template-value",ctor:js},{tag:"qti-stats-operator",ctor:no},{tag:"qti-string-match",ctor:so},{tag:"qti-substring",ctor:ao},{tag:"qti-subtract",ctor:Fs},{tag:"qti-sum",ctor:Bs},{tag:"qti-truncate",ctor:Us},{tag:"qti-variable",ctor:Hs}];for(let{tag:n,ctor:t}of Mh)customElements.get(n)||customElements.define(n,t);var ce=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},X;(function(n){n.Correct="correct",n.PartiallyCorrect="partially-correct",n.Incorrect="incorrect"})(X||(X={}));var uc=n=>{class t extends n{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,i)=>{this.toggleCandidateCorrection(i)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let i=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",i)}get correctness(){let r=this.correctResponse;if(!r)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let o=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let l=a.filter(d=>o.includes(d)).length,c=a.filter(d=>!o.includes(d)).length;return l===o.length&&c===0&&a.length===o.length?X.Correct:l>0&&(l<o.length||c>0)?X.PartiallyCorrect:X.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let i=this.nextSibling,o=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==X.Correct))){if(!o)return;this.parentElement?.removeChild(i);return}if(o)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 ce([p({attribute:"correct-response",reflect:!0,converter:Vt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),ce([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),ce([$("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),ce([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),ce([$("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),ce([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),ce([$("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),ce([_()],t.prototype,"_isFullCorrectResponse",void 0),ce([_()],t.prototype,"_correctResponse",void 0),t};var it=q`
|
|
9351
9456
|
/* Nothing at all until the item judges this element. */
|
|
9352
9457
|
[part~='correction'] {
|
|
9353
9458
|
display: none;
|
|
@@ -9380,21 +9485,21 @@ CES.load();
|
|
|
9380
9485
|
|
|
9381
9486
|
pointer-events: none;
|
|
9382
9487
|
}
|
|
9383
|
-
`;var
|
|
9488
|
+
`;var Ju=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},G=n=>{class t extends uc(n){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 i=this._internals;i.states.delete("candidate-correct"),i.states.delete("candidate-partially-correct"),i.states.delete("candidate-incorrect");let o=null;r&&(this.correctness===X.Correct&&(i.states.add("candidate-correct"),o="correct"),this.correctness===X.PartiallyCorrect&&(i.states.add("candidate-partially-correct"),o="partially-correct"),this.correctness===X.Incorrect&&(i.states.add("candidate-incorrect"),o="incorrect")),this._candidateCorrection!==o&&(this._candidateCorrection=o)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return Ju([_()],t.prototype,"_candidateCorrection",void 0),t};var lr=n=>{class t extends G(n){toggleInternalCorrectResponse(r){super.toggleInternalCorrectResponse(r);let i=this.correctResponse,o=i?Array.isArray(i)?i:[i]:[];for(let s of this._choiceElements)s.internals.states.delete("correct-response"),s.internals.states.delete("incorrect-response"),r&&o.length>0&&s.internals.states.add(o.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 i=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],o=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)o.includes(s.identifier)&&(s.candidateCorrection=i.includes(s.identifier)?"correct":"incorrect")}}return t};var xt=n=>{class t extends n{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(r){if(this.#t===r)return;let i=this.#t;this.#t=r;let o=this.internals.states;o.delete("candidate-correct"),o.delete("candidate-incorrect"),o.delete("candidate-partially-correct"),r&&o.add(`candidate-${r}`),this.requestUpdate("candidateCorrection",i)}get correctionPart(){return this.#t?`correction correction-${this.#t}`:"correction"}}return t};var mc=class extends xt(xe){static{this.styles=[xe.styles,it]}render(){return b`<div part="control"></div>
|
|
9384
9489
|
<slot part="label"></slot>
|
|
9385
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
9490
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Zu=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Ws=class extends xt(tr){constructor(){super(...arguments),this.orderCorrect=null}};Zu([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],Ws.prototype,"orderCorrect",void 0);var fc=class extends xt(er){static{this.styles=[er.styles,it]}render(){return b`<div part="control"><div part="control-mark"></div></div>
|
|
9386
9491
|
<slot part="label"></slot>
|
|
9387
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
9492
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var gc=class extends xt(At){static{this.styles=[At.styles,it]}render(){return b`
|
|
9388
9493
|
<div part="control"></div>
|
|
9389
9494
|
<slot part="label"></slot>
|
|
9390
9495
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9391
9496
|
<div part="drop">
|
|
9392
9497
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
9393
9498
|
</div>
|
|
9394
|
-
`}};var
|
|
9499
|
+
`}};var bc=class extends xt(It){static{this.styles=[It.styles,it]}render(){return b`<div part="control" tabindex="0"><div part="control-mark"></div></div>
|
|
9395
9500
|
${this.marker?b`<div id="label" part="marker">${this.marker}</div>`:P}
|
|
9396
9501
|
<slot part="label"></slot>
|
|
9397
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
9502
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Dh=class extends rt{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let r=this.getRootNode();for(;;){if(r.querySelectorAll(t).forEach(i=>i.shown=e),!(r instanceof ShadowRoot))return;r=r.host.getRootNode()}}};var Nh=class extends ie{#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}};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 $h=class extends st{#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 i=t;i.showCandidateCorrection?.(!0),i.showCorrectResponse?.(r)}},Lh=class extends Be{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}},Vh=class extends Rr{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}))})}};var yc=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},co=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`
|
|
9398
9503
|
<label part="label" for="modeSelect">${this.label}</label>
|
|
9399
9504
|
<select
|
|
9400
9505
|
part="select"
|
|
@@ -9405,44 +9510,44 @@ CES.load();
|
|
|
9405
9510
|
${this._options[t]}
|
|
9406
9511
|
</option>`)}
|
|
9407
9512
|
</select>
|
|
9408
|
-
`}};
|
|
9513
|
+
`}};yc([T({context:ht,subscribe:!0})],co.prototype,"itemContext",void 0);yc([p({type:String})],co.prototype,"label",void 0);yc([_()],co.prototype,"_options",void 0);var zh=q`
|
|
9409
9514
|
display: inline-flex;
|
|
9410
9515
|
align-items: center;
|
|
9411
9516
|
cursor: pointer;
|
|
9412
9517
|
padding: 0.5rem 1rem;
|
|
9413
9518
|
border-radius: 0.25rem;
|
|
9414
9519
|
user-select: none;
|
|
9415
|
-
`,
|
|
9520
|
+
`,Zr=q`
|
|
9416
9521
|
background-color: lightgray;
|
|
9417
|
-
${
|
|
9418
|
-
`,
|
|
9522
|
+
${zh};
|
|
9523
|
+
`,ti=q`
|
|
9419
9524
|
cursor: not-allowed;
|
|
9420
9525
|
opacity: 0.8;
|
|
9421
|
-
`,
|
|
9422
|
-
${
|
|
9526
|
+
`,sz=q`
|
|
9527
|
+
${zh};
|
|
9423
9528
|
border: 1px solid gray;
|
|
9424
|
-
`;var
|
|
9529
|
+
`;var ei=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Re=class extends C{static{this.styles=q`
|
|
9425
9530
|
:host {
|
|
9426
|
-
${
|
|
9531
|
+
${Zr};
|
|
9427
9532
|
}
|
|
9428
9533
|
:host([disabled]) {
|
|
9429
|
-
${
|
|
9534
|
+
${ti};
|
|
9430
9535
|
}
|
|
9431
|
-
`}#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> `}};
|
|
9536
|
+
`}#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> `}};ei([T({context:pe,subscribe:!0})],Re.prototype,"computedContext",void 0);ei([p({type:Boolean,reflect:!0})],Re.prototype,"shown",void 0);ei([p({type:Boolean,reflect:!0})],Re.prototype,"disabled",void 0);ei([p({type:String})],Re.prototype,"showCandidateCorrectionText",void 0);ei([p({type:String})],Re.prototype,"hideCandidateCorrectionText",void 0);ei([p({type:String})],Re.prototype,"noCorrectResponseText",void 0);var ri=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Oe=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`
|
|
9432
9537
|
:host {
|
|
9433
|
-
${
|
|
9538
|
+
${Zr};
|
|
9434
9539
|
}
|
|
9435
9540
|
:host([disabled]) {
|
|
9436
|
-
${
|
|
9541
|
+
${ti};
|
|
9437
9542
|
}
|
|
9438
|
-
`}#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> `}};
|
|
9543
|
+
`}#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> `}};ri([T({context:pe,subscribe:!0})],Oe.prototype,"computedContext",void 0);ri([p({type:Boolean,reflect:!0})],Oe.prototype,"shown",void 0);ri([p({type:Boolean,reflect:!0})],Oe.prototype,"disabled",void 0);ri([p({type:String})],Oe.prototype,"showCorrectText",void 0);ri([p({type:String})],Oe.prototype,"hideCorrectText",void 0);ri([p({type:String})],Oe.prototype,"noCorrectResponseText",void 0);var ii=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Pe=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`
|
|
9439
9544
|
:host {
|
|
9440
|
-
${
|
|
9545
|
+
${Zr};
|
|
9441
9546
|
}
|
|
9442
9547
|
:host([disabled]) {
|
|
9443
|
-
${
|
|
9548
|
+
${ti};
|
|
9444
9549
|
}
|
|
9445
|
-
`}#t;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(i=>i.items)).find(r=>r.active);if(this.#t!==e&&(this.shown=!1,this.#t=e),e){let r=!!e?.variables?.some(o=>o.correctResponse),i=!!e?.variables?.some(o=>o.mapping?.mapEntries?.length>0||o.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!i}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> `}};
|
|
9550
|
+
`}#t;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(i=>i.items)).find(r=>r.active);if(this.#t!==e&&(this.shown=!1,this.#t=e),e){let r=!!e?.variables?.some(o=>o.correctResponse),i=!!e?.variables?.some(o=>o.mapping?.mapEntries?.length>0||o.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!i}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> `}};ii([T({context:z,subscribe:!0})],Pe.prototype,"computedContext",void 0);ii([p({type:Boolean,reflect:!0})],Pe.prototype,"shown",void 0);ii([p({type:Boolean,reflect:!0})],Pe.prototype,"disabled",void 0);ii([p({type:String})],Pe.prototype,"showCorrectText",void 0);ii([p({type:String})],Pe.prototype,"hideCorrectText",void 0);ii([p({type:String})],Pe.prototype,"noCorrectResponseText",void 0);var Wt=n=>{class t extends G(n){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 wc=class extends Wt(or){};var xc=class extends lr(nr){};var tm=function(n,t,e,r){var i=arguments.length,o=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(s=n[a])&&(o=(i<3?s(o):i>3?s(t,e,o):s(t,e))||o);return i>3&&o&&Object.defineProperty(t,e,o),o},Qs=class extends xt(Q){static{this.styles=[Q.styles,it,q`
|
|
9446
9551
|
/*
|
|
9447
9552
|
* Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
|
|
9448
9553
|
* is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
|
|
@@ -9505,7 +9610,7 @@ CES.load();
|
|
|
9505
9610
|
}
|
|
9506
9611
|
`]}render(){return b`${this.renderPrompt()}${this.renderTextarea()}
|
|
9507
9612
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9508
|
-
${this.renderValidationMessage()}`}};
|
|
9613
|
+
${this.renderValidationMessage()}`}};tm([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],Qs.prototype,"candidateCorrection",void 0);var Gs=n=>n?(Array.isArray(n)?n:[n]).map(e=>{let[r,i]=e.split(" ");return{source:r,target:i}}):[];var qc=class extends Wt($r){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Gs(this.correctResponse);for(let r of this.querySelectorAll("qti-gap")){let i=r.getAttribute("identifier"),o=r.drags;for(let s of o)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===i)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var Cc=class extends G(Ot){#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=>yi`
|
|
9509
9614
|
<line
|
|
9510
9615
|
part="correct-line"
|
|
9511
9616
|
x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
|
|
@@ -9516,7 +9621,7 @@ CES.load();
|
|
|
9516
9621
|
stroke-width="3"
|
|
9517
9622
|
stroke-dasharray="5,5"
|
|
9518
9623
|
/>
|
|
9519
|
-
`)}};var
|
|
9624
|
+
`)}};var kc=class extends Wt(Lr){};var Ec=class extends G(Vr){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 i of this._choiceElements){let o=r.indexOf(i.identifier);i.orderCorrect=t&&o>=0?o+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements)i.candidateCorrection=null,t&&i.order!=null&&(i.candidateCorrection=r[i.order-1]===i.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var Sc=class extends lr(zr){};var Ac=class extends lr(jr){};var Ic=class extends G(tt){static get styles(){return[tt.styles,it,q`
|
|
9520
9625
|
/*
|
|
9521
9626
|
* Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
|
|
9522
9627
|
* badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
|
|
@@ -9535,20 +9640,20 @@ CES.load();
|
|
|
9535
9640
|
`]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return b`
|
|
9536
9641
|
${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
|
|
9537
9642
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9538
|
-
`}};var
|
|
9643
|
+
`}};var _c=class extends Wt(ae){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=Gs(this.correctResponse);this.#t=t?new Set(e.map(r=>`${r.source} ${r.target}`)):new Set;for(let r of this.targetChoices){let i=r.getAttribute("identifier"),o=r.drags;for(let s of o)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${i}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"correct":"incorrect"}};function em(n){if(n.length===0)return new Set;let t=new Array(n.length).fill(1),e=new Array(n.length).fill(-1);for(let o=0;o<n.length;o++)for(let s=0;s<o;s++)n[s]<n[o]&&t[s]+1>t[o]&&(t[o]=t[s]+1,e[o]=s);let r=0;for(let o=1;o<n.length;o++)t[o]>t[r]&&(r=o);let i=new Set;for(let o=r;o!==-1;o=e[o])i.add(o);return i}function jh(n,t){let e=new Map(t.map((a,l)=>[a,l])),r=n.filter(a=>e.has(a)),i=r.map(a=>e.get(a)),o=em(i),s=new Set;return o.forEach(a=>s.add(r[a])),s}var Tc=class extends Wt(Te){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let r=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(c=>this.chipsIn(c));for(let c of r)c.candidateCorrection=null;if(!t)return;let i=this.correctResponse,s=(i?Array.isArray(i)?i:[i]:[]).map((c,d)=>{let[h,f]=c.split(" "),m=f?.startsWith("droplist")?parseInt(f.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(m)?d:m}}).filter(c=>c.identifier).sort((c,d)=>c.dropIndex-d.dropIndex).map(c=>c.identifier);if(s.length===0)return;let a=r.map(c=>({choice:c,identifier:c.getAttribute("identifier")})).filter(c=>!!c.identifier),l=jh(a.map(c=>c.identifier),s);for(let{choice:c,identifier:d}of a)c.candidateCorrection=l.has(d)?"correct":"incorrect"}};var Rc=class extends G(W){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,r=e?.correctResponse??this.correctResponse;this.correctResponse=t?r:e?.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${i}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let o=document.createElement("div");o.id=i,o.className="pci-correct-response-container",Object.assign(o.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"}),o.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",o.append(a),this.after(o)}};var Oc=class extends G(dt){#t=[];#e=[];static{this.styles=[dt.styles,q`
|
|
9539
9644
|
[part~='correct'] {
|
|
9540
9645
|
--qti-select-point-marker-color: var(--qti-correct);
|
|
9541
9646
|
}
|
|
9542
9647
|
[part~='incorrect'] {
|
|
9543
9648
|
--qti-select-point-marker-color: var(--qti-incorrect);
|
|
9544
9649
|
}
|
|
9545
|
-
`]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let r=this._effectiveAreaEntries,i=this.responseVariable?.baseType,o=this.correctResponse;for(let s of this.responsePoints){let a=r.some(
|
|
9546
|
-
style=${
|
|
9650
|
+
`]}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.#e;if(this.#e=[],!t){this.requestUpdate("responseCorrection",e);return}let r=this._effectiveAreaEntries,i=this.responseVariable?.baseType,o=this.correctResponse;for(let s of this.responsePoints){let a=r.some(l=>J.isPointInArea(`${s.x} ${s.y}`,`${l.shape},${l.coords}`,i));!r.length&&o&&(a=(Array.isArray(o)?o:[o]).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 i=this.#t;this.#t=[],this.requestUpdate("correctAreas",i);return}let e=this._effectiveAreaEntries;if(!e.length){let i=this.correctResponse,o=i?Array.isArray(i)?i:[i]:[];if(o.some(s=>s.split(" ").length<2)){console.error("No valid correct responses found.");return}e=o.map(s=>({shape:"circle",coords:`${s.split(" ").join(",")},10`,defaultValue:1,mappedValue:1}))}let r=this.#t;this.#t=e.map(i=>({shape:i.shape,coords:i.coords})),this.requestUpdate("correctAreas",r)}pointPart(t,e){let r=this.#e[e];return r===void 0?"point":`point ${r?"correct":"incorrect"}`}renderSupplementalLayer(){return H(this.#t,t=>`${t.shape}:${t.coords}`,(t,e)=>b`<div
|
|
9651
|
+
style=${Gn({position:"absolute",pointerEvents:"none",backgroundColor:"var(--qti-correct)",opacity:"0.5"})}
|
|
9547
9652
|
data-correction-area
|
|
9548
9653
|
data-coord=${t.coords}
|
|
9549
9654
|
data-shape=${t.shape}
|
|
9550
9655
|
alt=${`correct-response-${e+1}`}
|
|
9551
|
-
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var
|
|
9656
|
+
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var Pc=class extends G(wt){#t=null;static{this.styles=[wt.styles,q`
|
|
9552
9657
|
[part='knob-correct'] {
|
|
9553
9658
|
background-color: var(--qti-correct-light);
|
|
9554
9659
|
border: 2px solid var(--qti-correct);
|
|
@@ -9563,7 +9668,7 @@ CES.load();
|
|
|
9563
9668
|
}
|
|
9564
9669
|
`]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=Array.isArray(e)?e[0]:e,i=t&&r?parseFloat(r):NaN,o=this.#t;if(this.#t=Number.isFinite(i)?i:null,this.#t!==null){let s=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}else this.style.removeProperty("--value-percentage-correct");this.requestUpdate("correctResponseNumber",o)}renderRailSupplement(){return this.#t===null?P:b`<div id="knob-correct" part="knob-correct">
|
|
9565
9670
|
<div id="value" part="value">${this.#t}</div>
|
|
9566
|
-
</div>`}};var
|
|
9671
|
+
</div>`}};var Mc=class extends G(at){static{this.styles=[at.styles,it,q`
|
|
9567
9672
|
/*
|
|
9568
9673
|
* The trailing inset only — size and leading gap come from the shared sheet.
|
|
9569
9674
|
*
|
|
@@ -9596,7 +9701,7 @@ CES.load();
|
|
|
9596
9701
|
${this.renderAnswer()} ${this.renderInput()}
|
|
9597
9702
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
9598
9703
|
${this.renderValidationMessage()}
|
|
9599
|
-
`}};export{G as CandidateCorrectionMixin,
|
|
9704
|
+
`}};export{G as CandidateCorrectionMixin,lr as ChoiceCorrectionMixin,uc as CorrectResponseMixin,X as Correctness,ma as CustomStateSetShim,fa as INITIAL_SESSION_CONTEXT,ga as INITIAL_TEST_CONTEXT,D as Interaction,ba as IsNullOrUndefined,St as ItemContainer,co as ItemCorrectResponseMode,zi as ItemPrintVariables,Re as ItemShowCandidateCorrection,Oe as ItemShowCorrectResponse,ts as QtiAnd,Br as QtiAnyN,rt as QtiAssessmentItem,Dh as QtiAssessmentItemCorrection,Dt as QtiAssessmentItemRef,mt as QtiAssessmentSection,Ar as QtiAssessmentStimulusRef,Ia as QtiAssessmentStimulusRefConnectedEvent,je as QtiAssessmentTest,Pr as QtiAssociableHotspot,or as QtiAssociateInteraction,wc as QtiAssociateInteractionCorrection,Yi as QtiBaseValue,nr as QtiChoiceInteraction,xc as QtiChoiceInteractionCorrection,Do as QtiCompanionMaterialsInfo,ut as QtiConditionExpression,es as QtiContainerSize,rs as QtiContains,qi as QtiContentBody,Ir as QtiContextDeclaration,is as QtiCorrect,ne as QtiCustomInteraction,Ci as QtiCustomOperator,ar as QtiDefault,os as QtiDelete,ns as QtiDivide,ss as QtiDurationGte,as as QtiDurationLt,Ie as QtiEndAttemptInteraction,Ji as QtiEqual,Ki as QtiEqualRounded,A as QtiExpression,Q as QtiExtendedTextInteraction,Qs as QtiExtendedTextInteractionCorrection,nt as QtiFeedback,No as QtiFeedbackBlock,$o as QtiFeedbackInline,cs as QtiFieldValue,Je as QtiGap,ji as QtiGapImg,$r as QtiGapMatchInteraction,qc as QtiGapMatchInteractionCorrection,xe as QtiGapText,mc as QtiGapTextCorrection,ls as QtiGcd,Ot as QtiGraphicAssociateInteraction,Cc as QtiGraphicAssociateInteractionCorrection,Lr as QtiGraphicGapMatchInteraction,kc as QtiGraphicGapMatchInteractionCorrection,Vr as QtiGraphicOrderInteraction,Ec as QtiGraphicOrderInteractionCorrection,ds as QtiGt,hs as QtiGte,tr as QtiHotspotChoice,Ws as QtiHotspotChoiceCorrection,zr as QtiHotspotInteraction,Sc as QtiHotspotInteractionCorrection,er as QtiHottext,fc as QtiHottextCorrection,jr as QtiHottextInteraction,Ac as QtiHottextInteractionCorrection,Zi as QtiIndex,Fi as QtiInlineChoice,tt as QtiInlineChoiceInteraction,Ic as QtiInlineChoiceInteractionCorrection,Ur as QtiInside,ps as QtiIntegerDivide,us as QtiIntegerModulus,ms as QtiIntegerToFloat,fs as QtiIsNull,ie as QtiItem,Lo as QtiItemBody,Nh as QtiItemCorrection,Ct as QtiItemSessionControl,gs as QtiLcm,Hr as QtiLookupOutcomeValue,bs as QtiLt,ys as QtiLte,eo as QtiMapResponse,to as QtiMapResponsePoint,vs as QtiMatch,ae as QtiMatchInteraction,_c as QtiMatchInteractionCorrection,ro as QtiMathOperator,ws as QtiMax,zn as QtiMediaInteraction,xs as QtiMember,qs as QtiMin,_r as QtiModalFeedback,Cs as QtiMultiple,ks as QtiNot,Es as QtiNull,Ss as QtiOr,Te as QtiOrderInteraction,Tc as QtiOrderInteractionCorrection,As as QtiOrdered,_s as QtiOutcomeCondition,Zt as QtiOutcomeDeclaration,Rs as QtiOutcomeElse,Ts as QtiOutcomeElseIf,Xr as QtiOutcomeIf,Io as QtiOutcomeProcessing,qa as QtiOutcomeProcessingProcessor,io as QtiPatternMatch,W as QtiPortableCustomInteraction,Rc as QtiPortableCustomInteractionCorrection,Hn as QtiPositionObjectInteraction,Wn as QtiPositionObjectStage,Os as QtiPower,Yr as QtiPrintedVariable,Ps as QtiProduct,mn as QtiPrompt,Ms as QtiRandom,cr as QtiRandomInteger,oo as QtiRepeat,Ds as QtiResponseCondition,be as QtiResponseDeclaration,$s as QtiResponseElse,Ns as QtiResponseElseIf,Kr as QtiResponseIf,zo as QtiResponseProcessing,Ls as QtiRound,Jr as QtiRoundTo,te as QtiRubricBlock,ml as QtiRuleElement,dt as QtiSelectPointInteraction,Oc as QtiSelectPointInteractionCorrection,Vs as QtiSetCorrectResponse,lc as QtiSetCorrectResponseRule,zs as QtiSetOutcomeValue,dc as QtiSetOutcomeValueRule,js as QtiSetTemplateValue,hc as QtiSetTemplateValueRule,At as QtiSimpleAssociableChoice,gc as QtiSimpleAssociableChoiceCorrection,It as QtiSimpleChoice,bc as QtiSimpleChoiceCorrection,wt as QtiSliderInteraction,Pc as QtiSliderInteractionCorrection,no as QtiStatsOperator,so as QtiStringMatch,jo as QtiStylesheet,ao as QtiSubstring,Fs as QtiSubtract,Bs as QtiSum,pc as QtiSumExpression,Fo as QtiTemplateConstraint,ee as QtiTemplateDeclaration,Bo as QtiTemplateProcessing,Be as QtiTest,Lh as QtiTestCorrection,Uo as QtiTestFeedback,ye as QtiTestPart,Ai as QtiTestVariables,_a as QtiTestVariablesExpression,at as QtiTextEntryInteraction,Mc as QtiTextEntryInteractionCorrection,Us as QtiTruncate,Jn as QtiUploadInteraction,Hs as QtiVariable,br as QtiVariableDeclaration,J as ScoringHelper,Rr as TestCheckItem,Vh as TestCheckItemCorrection,Et as TestContainer,He as TestEndAttempt,Ii as TestItemLink,We as TestItemToSpeech,st as TestNavigation,$h as TestNavigationCorrection,Qe as TestNext,Pi as TestPagingButtonsStamp,Ge as TestPrev,Mi as TestPrintContext,Di as TestPrintVariables,Xe as TestScoringButtons,Or as TestScoringFeedback,Ni as TestSectionButtonsStamp,$i as TestSectionLink,Pe as TestShowCorrectResponse,Ye as TestStamp,nn as TestTtsNext,tn as TestTtsPause,Zo as TestTtsPlay,on as TestTtsPrev,en as TestTtsResume,rn as TestTtsStop,Ut as TestView,Vi as TestViewToggle,gg as asSeed,O as boxSizing,op as classifyCustomStateSupport,z as computedContext,pe as computedItemContext,ht as configContext,qt as convertNumberToUniversalFormat,it as correctionPart,ap as decimalSeparator,Lt as dropRegion,lD as getItemByUri,cD as getManifestInfo,pl as installCustomStateSetFallback,gr as interactionContext,sp as isSeed,j as itemContext,ul as itemContextVariables,tb as iterResponseValues,eb as parsePair,ib as parsePoint,ya as parseResponseAttribute,Lu as qtiAndMixin,pt as qtiContext,Ih as qtiInteractionElements,Ku as qtiSubtractMixin,zt as qtiTransformItem,Ol as qtiTransformManifest,Sr as qtiTransformTest,Ao as removeDoubleSlashes,Vt as responseAttributeConverter,rb as serializePair,ob as serializePoint,va as serializeResponseAttribute,$t as sessionContext,ot as testContext,Jl as ttsContext,U as validationMessage};
|
|
9600
9705
|
/*! Bundled license information:
|
|
9601
9706
|
|
|
9602
9707
|
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|
|
@@ -9608,6 +9713,7 @@ CES.load();
|
|
|
9608
9713
|
*)
|
|
9609
9714
|
|
|
9610
9715
|
@lit-labs/ssr-dom-shim/lib/css.js:
|
|
9716
|
+
@lit-labs/ssr-dom-shim/lib/observers.js:
|
|
9611
9717
|
(**
|
|
9612
9718
|
* @license
|
|
9613
9719
|
* Copyright 2024 Google LLC
|