@citolab/qti-components 10.0.0-next.17 → 10.0.0-next.19
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 +150 -150
- package/dist/base.d.ts +2 -2
- package/dist/base.js +1 -1
- package/dist/{chunk-UDJ7MHLF.js → chunk-3FQZRJFH.js} +2 -2
- package/dist/{chunk-OG5HIRHE.js → chunk-4UO6AGJ6.js} +2 -2
- package/dist/{chunk-L7J2ZOJL.js → chunk-HSOILZC6.js} +2 -2
- package/dist/{chunk-UURHLJVM.js → chunk-JE6X3IZT.js} +3 -3
- package/dist/{chunk-WGUQCB2Z.js → chunk-MFKH6BZM.js} +2 -2
- package/dist/{chunk-7MYZHZWV.js → chunk-MXY66QOH.js} +53 -5
- package/dist/chunk-MXY66QOH.js.map +1 -0
- package/dist/{chunk-V5GL7PTC.js → chunk-QECECKEC.js} +2 -2
- package/dist/{chunk-QLGUI5VG.js → chunk-QKCVC4HF.js} +2 -2
- package/dist/{chunk-J3F3JSCW.js → chunk-WTGUKDVH.js} +2 -2
- package/dist/{chunk-NZ7ZC4SP.js → chunk-XBBTYGCX.js} +1 -1
- package/dist/chunk-XBBTYGCX.js.map +1 -0
- package/dist/{chunk-L3LBSAGZ.js → chunk-Y7RSSGDY.js} +2 -2
- package/dist/{chunk-ZAHZVBV7.js → chunk-YRXH3YMJ.js} +6 -6
- package/dist/{config.context.d-CCqlJXpE.d.ts → config.context.d-Dm11aAuw.d.ts} +16 -0
- package/dist/corrections.d.ts +5 -5
- package/dist/corrections.js +7 -7
- package/dist/elements.js +3 -3
- package/dist/index.d.ts +5 -5
- package/dist/index.js +12 -12
- package/dist/interactions.d.ts +4 -4
- package/dist/interactions.js +3 -3
- package/dist/item.d.ts +2 -2
- package/dist/item.js +3 -3
- package/dist/processing.js +3 -3
- package/dist/{qti-item.d-CLChmRvB.d.ts → qti-item.d-CxP6KtCH.d.ts} +1 -1
- package/dist/{qti-test.d-COzv7YZG.d.ts → qti-test.d-CRqJF2DM.d.ts} +1 -1
- package/dist/{qti-text-entry-interaction.d-DsUyecBC.d.ts → qti-text-entry-interaction.d-m0EFv9no.d.ts} +2 -2
- package/dist/{record.d-BfZhFr0L.d.ts → record.d-N1Bq7e1f.d.ts} +1 -1
- package/dist/test.d.ts +3 -3
- package/dist/test.js +4 -4
- package/package.json +2 -2
- package/dist/chunk-7MYZHZWV.js.map +0 -1
- package/dist/chunk-NZ7ZC4SP.js.map +0 -1
- /package/dist/{chunk-UDJ7MHLF.js.map → chunk-3FQZRJFH.js.map} +0 -0
- /package/dist/{chunk-OG5HIRHE.js.map → chunk-4UO6AGJ6.js.map} +0 -0
- /package/dist/{chunk-L7J2ZOJL.js.map → chunk-HSOILZC6.js.map} +0 -0
- /package/dist/{chunk-UURHLJVM.js.map → chunk-JE6X3IZT.js.map} +0 -0
- /package/dist/{chunk-WGUQCB2Z.js.map → chunk-MFKH6BZM.js.map} +0 -0
- /package/dist/{chunk-V5GL7PTC.js.map → chunk-QECECKEC.js.map} +0 -0
- /package/dist/{chunk-QLGUI5VG.js.map → chunk-QKCVC4HF.js.map} +0 -0
- /package/dist/{chunk-J3F3JSCW.js.map → chunk-WTGUKDVH.js.map} +0 -0
- /package/dist/{chunk-L3LBSAGZ.js.map → chunk-Y7RSSGDY.js.map} +0 -0
- /package/dist/{chunk-ZAHZVBV7.js.map → chunk-YRXH3YMJ.js.map} +0 -0
package/cdn/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var sl=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var zt=function(o,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(o,e):i?i.value=e:t.set(o,e),e},tt=function(o,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(o):r?r.value:t.get(o)},Er,Sn,En,bi,ma,vi,An,Ge,yi,qe,_n,al;var W={__proto__:null};W.enumerable=!0;Object.freeze(W);var fa=(qe=class{constructor(t,e={}){if(Er.set(this,!1),Sn.set(this,!1),En.set(this,!1),bi.set(this,!1),ma.set(this,Date.now()),vi.set(this,!1),An.set(this,void 0),Ge.set(this,void 0),yi.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:n}=e;zt(this,Er,!!i,"f"),zt(this,Sn,!!r,"f"),zt(this,En,!!n,"f"),zt(this,An,`${t}`,"f"),zt(this,Ge,null,"f"),zt(this,yi,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){zt(this,bi,!0,"f")}get target(){return tt(this,Ge,"f")}get currentTarget(){return tt(this,Ge,"f")}get srcElement(){return tt(this,Ge,"f")}get type(){return tt(this,An,"f")}get cancelable(){return tt(this,Er,"f")}get defaultPrevented(){return tt(this,Er,"f")&&tt(this,bi,"f")}get timeStamp(){return tt(this,ma,"f")}composedPath(){return tt(this,yi,"f")?[tt(this,Ge,"f")]:[]}get returnValue(){return!tt(this,Er,"f")||!tt(this,bi,"f")}get bubbles(){return tt(this,Sn,"f")}get composed(){return tt(this,En,"f")}get eventPhase(){return tt(this,yi,"f")?qe.AT_TARGET:qe.NONE}get cancelBubble(){return tt(this,vi,"f")}set cancelBubble(t){t&&zt(this,vi,!0,"f")}stopPropagation(){zt(this,vi,!0,"f")}get isTrusted(){return!1}},Er=new WeakMap,Sn=new WeakMap,En=new WeakMap,bi=new WeakMap,ma=new WeakMap,vi=new WeakMap,An=new WeakMap,Ge=new WeakMap,yi=new WeakMap,qe.NONE=0,qe.CAPTURING_PHASE=1,qe.AT_TARGET=2,qe.BUBBLING_PHASE=3,qe);Object.defineProperties(fa.prototype,{initEvent:W,stopImmediatePropagation:W,preventDefault:W,target:W,currentTarget:W,srcElement:W,type:W,cancelable:W,defaultPrevented:W,timeStamp:W,composedPath:W,returnValue:W,bubbles:W,composed:W,eventPhase:W,cancelBubble:W,stopPropagation:W,isTrusted:W});var cl=(al=class extends fa{constructor(t,e={}){super(t,e),_n.set(this,void 0),zt(this,_n,e?.detail??null,"f")}initCustomEvent(t,e,r,i){throw new Error("Method not implemented.")}get detail(){return tt(this,_n,"f")}},_n=new WeakMap,al);Object.defineProperties(cl.prototype,{detail:W});var ie=fa,ga=cl;var ot;var Jf=(ot=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},ot.STYLE_RULE=1,ot.CHARSET_RULE=2,ot.IMPORT_RULE=3,ot.MEDIA_RULE=4,ot.FONT_FACE_RULE=5,ot.PAGE_RULE=6,ot.NAMESPACE_RULE=10,ot.KEYFRAMES_RULE=7,ot.KEYFRAME_RULE=8,ot.SUPPORTS_RULE=12,ot.COUNTER_STYLE_RULE=11,ot.FONT_FEATURE_VALUES_RULE=14,ot.MARGIN_RULE=9,ot);globalThis.Event??=ie;globalThis.CustomEvent??=ga;var va=Symbol(),ll=o=>typeof o=="boolean"?o:o?.capture??!1,ne={__proto__:null};ne.enumerable=!0;Object.freeze(ne);var Tn=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let i=ll(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);if(n===void 0)n=new Map,i.set(t,n);else if(n.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),n.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let i=ll(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);n!==void 0&&(n.delete(e),n.size||i.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,i=!1,n=ie.NONE,s=null,a=null,c=null,l=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...ne},srcElement:{get(){return t.target},...ne},currentTarget:{get(){return c},...ne},eventPhase:{get(){return n},...ne},composedPath:{value:()=>e,...ne},stopPropagation:{value:()=>{r=!0,l.call(t)},...ne},stopImmediatePropagation:{value:()=>{i=!0,d.call(t)},...ne}});let h=(u,g,b)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&b.delete(u)},f=()=>(c=null,n=ie.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),c=u,n=u===t.target?ie.AT_TARGET:ie.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&y(x.slice(0,x.indexOf(u)+1)),c=u,n=u===t.target?ie.AT_TARGET:ie.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,pl,tu]}};var dl=new WeakMap,qi=o=>{let t=dl.get(o);return t===void 0&&dl.set(o,t=new Map),t},xi=class extends Tn{getRootNode(t){return t?.composed?ba:this.__host?.__shadowRoot??ba}};var hl=class extends xi{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var pl=new hl,ba=pl;var ul=class extends xi{constructor(t){if(super(),t!==va)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Rn,customElements:qa,document:ba,Document:hl,Element:ml,EventTarget:Tn,HTMLElement:fl,Node:xi,ShadowRoot:gl,window:this,Window:ul})}};var ml=class extends xi{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(qi(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){qi(this).set(t,String(e))}removeAttribute(t){qi(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 qi(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new gl(va,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 sl(this);return this.__internals=t,t}getAttribute(t){return qi(this).get(t)??null}};var fl=class extends ml{},ya=fl;var gl=class extends xi{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 ya,"localName",{get(){return"lit-server-root"}});function Kp(){let o,t;return{promise:new Promise((r,i)=>{o=r,t=i}),resolve:o,reject:t}}var Rn=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(t,e){if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
-
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=t,this.__definitions.set(t,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,t),this.__pendingWhenDefineds.get(t)?.resolve(e),this.__pendingWhenDefineds.delete(t)}get(t){return this.__definitions.get(t)?.ctor}getName(t){return this.__reverseDefinitions.get(t)??null}initialize(t){throw new Error("customElements.initialize is not currently supported in SSR. Please file a bug if you need it.")}upgrade(t){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(t){let e=this.__definitions.get(t);if(e)return e.ctor;let r=this.__pendingWhenDefineds.get(t);return r||(r=
|
|
3
|
-
\f\r]`,Ai=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
4
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),El=/'/g,Al=/"/g,Rl=/^(?:script|style|textarea|title)$/i,Aa=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=Aa(1),Ii=Aa(2),Tg=Aa(3),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),_l=new WeakMap,Ye=Ke.createTreeWalker(Ke,129);function Il(o,t){if(!Ea(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Cl!==void 0?Cl.createHTML(t):t}var Ml=(o,t)=>{let e=o.length-1,r=[],i,n=t===2?"<svg>":t===3?"<math>":"",s=Ai;for(let a=0;a<e;a++){let c=o[a],l,d,h=-1,f=0;for(;f<c.length&&(s.lastIndex=f,d=s.exec(c),d!==null);)f=s.lastIndex,s===Ai?d[1]==="!--"?s=kl:d[1]!==void 0?s=Sl:d[2]!==void 0?(Rl.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=Je):d[3]!==void 0&&(s=Je):s===Je?d[0]===">"?(s=i??Ai,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,l=d[1],s=d[3]===void 0?Je:d[3]==='"'?Al:El):s===Al||s===El?s=Je:s===kl||s===Sl?s=Ai:(s=Je,i=void 0);let m=s===Je&&o[a+1].startsWith("/>")?" ":"";n+=s===Ai?c+lu:h>=0?(r.push(l),c.slice(0,h)+ka+c.slice(h)+se+m):c+se+(h===-2?a:m)}return[Il(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Ri=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,s=0,a=t.length-1,c=this.parts,[l,d]=Ml(t,e);if(this.el=o.createElement(l,r),Ye.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=Ye.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(ka)){let f=d[s++],m=i.getAttribute(h).split(se),y=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?Dn:y[1]==="?"?$n:y[1]==="@"?Nn:tr}),i.removeAttribute(h)}else h.startsWith(se)&&(c.push({type:6,index:n}),i.removeAttribute(h));if(Rl.test(i.tagName)){let h=i.textContent.split(se),f=h.length-1;if(f>0){i.textContent=Pn?Pn.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],_i()),Ye.nextNode(),c.push({type:2,index:++n});i.append(h[f],_i())}}}else if(i.nodeType===8)if(i.data===Sa)c.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(se,h+1))!==-1;)c.push({type:7,index:n}),h+=se.length-1}n++}}static createElement(t,e){let r=Ke.createElement("template");return r.innerHTML=t,r}};function Ze(o,t,e=o,r){if(t===it)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,n=Ti(t)?void 0:t._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(o),i._$AT(o,e,r)),r!==void 0?(e._$Co??=[])[r]=i:e._$Cl=i),i!==void 0&&(t=Ze(o,i._$AS(o,t.values),i,r)),t}var On=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??Ke).importNode(e,!0);Ye.currentNode=i;let n=Ye.nextNode(),s=0,a=0,c=r[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new Ar(n,n.nextSibling,this,t):c.type===1?l=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(l=new Ln(n,this,t)),this._$AV.push(l),c=r[++a]}s!==c?.index&&(n=Ye.nextNode(),s++)}return Ye.currentNode=Ke,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++}},Ar=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ze(this,t,e),Ti(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Tl(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&&Ti(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ke.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=Ri.createElement(Il(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new On(i,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(t){let e=_l.get(t.strings);return e===void 0&&_l.set(t.strings,e=new Ri(t)),e}k(t){Ea(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let n of t)i===e.length?e.push(r=new o(this.O(_i()),this.O(_i()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=wl(t).nextSibling;wl(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},tr=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,n){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(t,e=this,r,i){let n=this.strings,s=!1;if(n===void 0)t=Ze(this,t,e,0),s=!Ti(t)||t!==this._$AH&&t!==it,s&&(this._$AH=t);else{let a=t,c,l;for(t=n[0],c=0;c<n.length-1;c++)l=Ze(this,a[r+c],e,c),l===it&&(l=this._$AH[c]),s||=!Ti(l)||l!==this._$AH[c],l===P?t=P:t!==P&&(t+=(l??"")+n[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??"")}},Dn=class extends tr{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},$n=class extends tr{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},Nn=class extends tr{constructor(t,e,r,i,n){super(t,e,r,i,n),this.type=5}_$AI(t,e=this){if((t=Ze(this,t,e,0)??P)===it)return;let r=this._$AH,i=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Ln=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){Ze(this,t)}},et={M:ka,P:se,A:Sa,C:1,L:Ml,R:On,D:Tl,V:Ze,I:Ar,H:tr,N:$n,U:Nn,B:Dn,F:Ln},du=Vn.litHtmlPolyfillSupport;du?.(Ri,Ar),(Vn.litHtmlVersions??=[]).push("3.3.3");var _a=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let n=e?.renderBefore??null;r._$litPart$=i=new Ar(t.insertBefore(_i(),n),n,void 0,e??{})}return i._$AI(o),i};var Ta=globalThis,S=class extends oe{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=_a(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};S._$litElement$=!0,S.finalized=!0,Ta.litElementHydrateSupport?.({LitElement:S});var hu=Ta.litElementPolyfillSupport;hu?.({LitElement:S});(Ta.litElementVersions??=[]).push("4.2.2");var pu={attribute:!0,type:String,converter:Si,reflect:!1,hasChanged:Mn},uu=(o=pu,t,e)=>{let{kind:r,metadata:i}=e,n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),r==="setter"&&((o=Object.create(o)).wrapped=!0),n.set(e.name,o),r==="accessor"){let{name:s}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,c,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let c=this[s];t.call(this,a),this.requestUpdate(s,c,o,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(o){return(t,e)=>typeof e=="object"?uu(o,t,e):((r,i,n)=>{let s=i.hasOwnProperty(n);return i.constructor.createProperty(n,r),s?Object.getOwnPropertyDescriptor(i,n):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var xe=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function _r(o,t){return(e,r,i)=>{let n=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:i??(()=>{let c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return xe(e,r,{get(){let c=s.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return xe(e,r,{get(){return n(this)}})}}function Pl(o){return(t,e)=>{let{slot:r,selector:i}=o??{},n="slot"+(r?`[name=${r}]`:":not([name])");return xe(t,e,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(o)??[];return i===void 0?a:a.filter(c=>c.matches(i))}})}}var ae=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var at=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ae(this.context,this.host,this.t,this.subscribe))}};var jn=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 Ra=class extends Event{constructor(t,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e}},Bt=class extends jn{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let n=i.contextTarget??i.composedPath()[0];n!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,n,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let n=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)n.has(s)||(n.add(s),a.dispatchEvent(new ae(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 Ra(this.context,this.host))}};var Mi=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:r}=e;for(let{elementRef:i,callbackRef:n}of r){let s=i.deref(),a=n.deref();s===void 0||a===void 0||s.dispatchEvent(new ae(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],r=t.callback,i=this.pendingContextRequests.get(t.context);i===void 0&&this.pendingContextRequests.set(t.context,i={callbacks:new WeakMap,requests:[]});let n=i.callbacks.get(e);n===void 0&&i.callbacks.set(e,n=new WeakSet),n.has(r)||(n.add(r),i.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(r)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function J({context:o}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return r.get(this).setValue(i),t.set.call(this,i)},init(i){return r.set(this,new Bt(this,{context:o,initialValue:i})),i}};{t.constructor.addInitializer((s=>{r.set(s,new Bt(s,{context:o}))}));let i=Object.getOwnPropertyDescriptor(t,e),n;if(i===void 0){let s=new WeakMap;n={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;n={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}function R({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new at(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new at(i,{context:o,callback:n=>{i[r]=n},subscribe:t})}))}}var Fn=["this"],Ol=["+","-","!"],Dl=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],Ia={"!":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},zn=13;var mu=["==","!=","<=",">=","||","&&","??","|>"],fu=["===","!=="],O;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(O||(O={}));var Ht=(o,t,e=0)=>({kind:o,value:t,precedence:e}),gu=o=>o===9||o===10||o===13||o===32,$l=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),bu=o=>$l(o)||Pi(o),vu=o=>Fn.indexOf(o)!==-1,yu=o=>o===34||o===39,Pi=o=>48<=o&&o<=57,qu=o=>o===43||o===45||o===42||o===47||o===33||o===38||o===37||o===60||o===61||o===62||o===63||o===94||o===124,xu=o=>o===40||o===41||o===91||o===93||o===123||o===125,wu=o=>o.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
|
|
5
|
-
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Bn=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;gu(this.#i);)this.#n(!0);if(yu(this.#i))return this.#a();if($l(this.#i))return this.#c();if(Pi(this.#i))return this.#p();if(this.#i===46)return this.#l();if(this.#i===44)return this.#d();if(this.#i===58)return this.#h();if(qu(this.#i))return this.#g();if(xu(this.#i))return this.#m();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(t);this.#n()}let r=Ht(O.STRING,wu(this.#o()));return this.#n(),r}#c(){do this.#n();while(bu(this.#i));let t=this.#o(),e=vu(t)?O.KEYWORD:O.IDENTIFIER;return Ht(e,t)}#p(){do this.#n();while(Pi(this.#i));return this.#i===46?this.#l():Ht(O.INTEGER,this.#o())}#l(){return this.#n(),Pi(this.#i)?this.#u():(this.#s(),Ht(O.DOT,".",zn))}#d(){return this.#n(!0),Ht(O.COMMA,",")}#h(){return this.#n(!0),Ht(O.COLON,":")}#u(){do this.#n();while(Pi(this.#i));return Ht(O.DECIMAL,this.#o())}#g(){this.#n();let t=this.#o(2);if(fu.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Ht(O.ARROW,t);mu.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Ht(O.OPERATOR,t,Ia[t])}#m(){let t=String.fromCharCode(this.#i),e=Ht(O.GROUPER,t,Ia[t]);return this.#n(!0),e}};var Ma=(o,t)=>new Oi(o,t).parse(),Oi=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new Bn(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(O.GROUPER,"(")){let r=this.#f();t=this.#r.invoke(t,void 0,r)}else if(this._matches(O.GROUPER,"[")){let r=this.#v();t=this.#r.index(t,r)}else if(this._matches(O.DOT)){this.#o();let r=this.#l();t=this.#c(t,r)}else{if(this._matches(O.KEYWORD))break;if(this._matches(O.OPERATOR)&&this.#i.precedence>=e)t=this.#n==="?"?this.#d(t):this.#p(t,this.#i);else break}return t}#c(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this.#r.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(Dl.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#l();for(;(this.#t===O.OPERATOR||this.#t===O.DOT||this.#t===O.GROUPER)&&this.#i.precedence>e.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(t,e.value,r)}#l(){if(this._matches(O.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(O.INTEGER))return this.#x(t);if(this._matches(O.DECIMAL))return this.#C(t)}if(Ol.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#h(),zn);return this.#r.unary(t,e)}return this.#h()}#d(t){this.#o(O.OPERATOR,"?");let e=this.#s();this.#o(O.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#h(){switch(this.#t){case O.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#r.id(t);throw Fn.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case O.IDENTIFIER:return this.#m();case O.STRING:return this.#q();case O.INTEGER:return this.#x();case O.DECIMAL:return this.#C();case O.GROUPER:return this.#n==="("?this.#y():this.#n==="{"?this.#g():this.#n==="["?this.#u():void 0;case O.COLON:throw new Error('unexpected token ":"');default:return}}#u(){let t=[];do{if(this.#o(),this._matches(O.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"]"),this.#r.list(t)}#g(){let t={};do{if(this.#o(),this._matches(O.GROUPER,"}"))break;let e=this.#n;(this._matches(O.STRING)||this._matches(O.IDENTIFIER))&&this.#o(),this.#o(O.COLON),t[e]=this.#s()}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"}"),this.#r.map(t)}#m(){let t=this.#n;if(t==="true")return this.#o(),this.#r.literal(!0);if(t==="false")return this.#o(),this.#r.literal(!1);if(t==="null")return this.#o(),this.#r.literal(null);if(t==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#b(),r=this.#f();return r?this.#r.invoke(e,void 0,r):e}#b(){if(!this._matches(O.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let t=this.#n;return this.#o(),this.#r.id(t)}#f(){if(!this._matches(O.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(O.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(O.COMMA));return this.#o(O.GROUPER,")"),t}#v(){this.#o();let t=this.#s();return this.#o(O.GROUPER,"]"),t}#y(){let t=this.#f();if(this._matches(O.ARROW)){this.#o();let e=this.#s(),r=t?.map(i=>i.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#q(){let t=this.#r.literal(this.#n);return this.#o(),t}#x(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#C(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:Nl,fromEntries:Cu}=Object,ku={"+":(o,t)=>o+t,"-":(o,t)=>o-t,"*":(o,t)=>o*t,"/":(o,t)=>o/t,"%":(o,t)=>o%t,"==":(o,t)=>o==t,"!=":(o,t)=>o!=t,"===":(o,t)=>o===t,"!==":(o,t)=>o!==t,">":(o,t)=>o>t,">=":(o,t)=>o>=t,"<":(o,t)=>o<t,"<=":(o,t)=>o<=t,"||":(o,t)=>o||t,"&&":(o,t)=>o&&t,"??":(o,t)=>o??t,"|":(o,t)=>t(o),"|>":(o,t)=>t(o)},Su={"+":o=>o,"-":o=>-o,"!":o=>!o},Un=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=Su[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=ku[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(n){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(n),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),c=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,c=this.left.value),a===void 0?void 0:a[c]=s}return i(this.left.evaluate(n),this.right.evaluate(n))},getIds(n){return this.left.getIds(n),this.right.getIds(n),n}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let n=this.receiver.evaluate(i),s=this.method?n:i?.this??i,a=this.method?n?.[e]:n,l=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,l)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(n=>n?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let n=this.entries[i];n&&(r[i]=n.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,n=this.body;return function(...s){let a=Cu(i.map((l,d)=>[l,s[d]])),c=new Proxy(r??{},{set(l,d,h){return Nl(a,d)&&(a[d]=h),l[d]=h},get(l,d){return Nl(a,d)?a[d]:l[d]}});return n.evaluate(c)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var Pa=null,Ll={boundAttributeSuffix:et.M,marker:et.P,markerMatch:et.A,HTML_RESULT:et.C,getTemplateHtml:et.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){Pa??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Pa))return void(e[Pa]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let r=it;return o.j=i=>r=i,o._$AI(t,o,e),r},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:et.V,AttributePart:et.H,PropertyPart:et.B,BooleanAttributePart:et.N,EventPart:et.U,ElementPart:et.F,TemplateInstance:et.R,isIterable:et.D,ChildPart:et.I};var{AttributePart:Eu,PropertyPart:Au,BooleanAttributePart:_u,EventPart:Tu}=Ll,Da=new Un,Oa=new Map,Vl=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),Hn=(o,t)=>{let e=Oa.get(o);if(e===void 0){if(Oa.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new Oi(r,Da).parse(),Oa.set(o,e)}}return e?.evaluate(t)},Ru=(o,t,e,r)=>{let i=o.getAttribute("if");if(i!==null&&Hn(i,t))return Wn(o,t,e,r)},jl=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Fl=o=>/(?:\\{{)|(?:\\}})/g.test(o),Di=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Iu=(o,t,e,r)=>{let i=o.getAttribute("repeat");if(i!==null){let n=Hn(i,t);if(!n[Symbol.iterator])return P;let s=$i(o),a=-1,c=[];for(let l of n){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 y=m.update(d,e,r);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};c.push(f)}return c}},Bl={if:Ru,repeat:Iu},Ul=(o,t=Bl,e={},r)=>{let n=$i(o).renderers;if(r){let a=$i(r).renderers,c=n.super;c!==void 0?e={...n,...e,super:(l,d,h)=>(h={...a,...h,super:(f,m,y)=>Wn(r,f,m,y)},c(l,d,h))}:(e={...a,...n,...e},o=r)}else e={...n,...e};return s=>Wn(o,s,t,e)};var Wn=(o,t,e=Bl,r={})=>{let i=$i(o),n=[];for(let a of i.parts){let c=a.update(t,e,r);a.type===1?n.push(...c):n.push(c)}return{_$litType$:i,values:n}},zl=new Map,$i=o=>{let t=zl.get(o);return t===void 0&&zl.set(o,t=Mu(o)),t},Mu=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,n=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)i++;else if(r.nodeType===Node.ELEMENT_NODE){i++;let s=r;if(s.tagName==="TEMPLATE"){let 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),n.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:Hn(g,y);return(m?Hn(f,y):u[d])?.(b,x,u)}}else c!==null?h=(f,m,y)=>{let x=m[c];return x?.(s,f,m,y)}:(l==="super"?t.renderers.super=(f,m,y)=>{let x=y.super,u=$i(s);return y={...y,...u.renderers},x(f,m,y)}:t.renderers[l]=(f,m,y)=>Wn(s,f,m,y),h=(f,m,y)=>{let x=y[l];return x?.(f,m,y)});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(jl);if(d.length===1){Fl(l)&&s.setAttribute(c,Di(l));continue}s.removeAttribute(c);let h=c,f=Eu,m=c[0];m==="."?(h=Vl(c.substring(1)),f=Au):m==="?"?(h=c.substring(1),f=_u):m==="@"&&(h=Vl(c.substring(1)),f=Tu);let y=[Di(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push(Ma(g,Da)),y.push(Di(d[u+1]))}t.parts.push({type:1,index:i,name:h,strings:y,ctor:f,update:(u,g,b)=>x.map(q=>q.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,c=a.split(jl);c.length>1?s.textContent=Di(c[0]):Fl(a)&&(s.textContent=Di(a));for(let l=1;l<c.length;l+=2){let d=c[l],h=Ma(d,Da);t.parts.push({type:2,index:++i,update:(m,y)=>h.evaluate(m)});let f=new Text(c[l+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of n)s.remove();return t};var $a=Symbol.for("qti-components.context-root"),Pu=()=>{if(typeof document>"u")return;let o=globalThis;o[$a]||(o[$a]=new Mi,o[$a].attach(document.documentElement))};Pu();var Hl=[];var La=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 Ou(o){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=o.call(document.createElement(Na)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var Wl=!1;function Ql(){if(Wl)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Ou(o);return t==="modern"||(Wl=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new La(this)}),r}),t}Ql();for(let{tag:o,ctor:t}of Hl)customElements.get(o)||customElements.define(o,t);var we=Symbol("computedItemContext");var ct=Symbol("computedContext");var yt=Symbol("configContext");var Tr=Symbol("interactionContext");var j=Symbol("item");var Xl=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Du=/^[A-Za-z0-9-]+$/,$u=o=>typeof o=="string"&&Du.test(o),xv=o=>$u(o)?o:void 0,qt=Symbol("qtiContext");var Va={view:"candidate"},Qn=Symbol("sessionContext");var ja={items:[],testOutcomeVariables:[]},nt=Symbol("testContext");var M=w`
|
|
1
|
+
var dl=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var zt=function(o,t,e,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(o,e):i?i.value=e:t.set(o,e),e},tt=function(o,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(o):r?r.value:t.get(o)},Er,_n,Tn,bi,va,vi,Rn,Ge,yi,qe,In,hl;var W={__proto__:null};W.enumerable=!0;Object.freeze(W);var ya=(qe=class{constructor(t,e={}){if(Er.set(this,!1),_n.set(this,!1),Tn.set(this,!1),bi.set(this,!1),va.set(this,Date.now()),vi.set(this,!1),Rn.set(this,void 0),Ge.set(this,void 0),yi.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:r,cancelable:i,composed:n}=e;zt(this,Er,!!i,"f"),zt(this,_n,!!r,"f"),zt(this,Tn,!!n,"f"),zt(this,Rn,`${t}`,"f"),zt(this,Ge,null,"f"),zt(this,yi,!1,"f")}initEvent(t,e,r){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){zt(this,bi,!0,"f")}get target(){return tt(this,Ge,"f")}get currentTarget(){return tt(this,Ge,"f")}get srcElement(){return tt(this,Ge,"f")}get type(){return tt(this,Rn,"f")}get cancelable(){return tt(this,Er,"f")}get defaultPrevented(){return tt(this,Er,"f")&&tt(this,bi,"f")}get timeStamp(){return tt(this,va,"f")}composedPath(){return tt(this,yi,"f")?[tt(this,Ge,"f")]:[]}get returnValue(){return!tt(this,Er,"f")||!tt(this,bi,"f")}get bubbles(){return tt(this,_n,"f")}get composed(){return tt(this,Tn,"f")}get eventPhase(){return tt(this,yi,"f")?qe.AT_TARGET:qe.NONE}get cancelBubble(){return tt(this,vi,"f")}set cancelBubble(t){t&&zt(this,vi,!0,"f")}stopPropagation(){zt(this,vi,!0,"f")}get isTrusted(){return!1}},Er=new WeakMap,_n=new WeakMap,Tn=new WeakMap,bi=new WeakMap,va=new WeakMap,vi=new WeakMap,Rn=new WeakMap,Ge=new WeakMap,yi=new WeakMap,qe.NONE=0,qe.CAPTURING_PHASE=1,qe.AT_TARGET=2,qe.BUBBLING_PHASE=3,qe);Object.defineProperties(ya.prototype,{initEvent:W,stopImmediatePropagation:W,preventDefault:W,target:W,currentTarget:W,srcElement:W,type:W,cancelable:W,defaultPrevented:W,timeStamp:W,composedPath:W,returnValue:W,bubbles:W,composed:W,eventPhase:W,cancelBubble:W,stopPropagation:W,isTrusted:W});var pl=(hl=class extends ya{constructor(t,e={}){super(t,e),In.set(this,void 0),zt(this,In,e?.detail??null,"f")}initCustomEvent(t,e,r,i){throw new Error("Method not implemented.")}get detail(){return tt(this,In,"f")}},In=new WeakMap,hl);Object.defineProperties(pl.prototype,{detail:W});var ie=ya,qa=pl;var ot;var tg=(ot=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.MARGIN_RULE=9,this.__parentStyleSheet=null,this.cssText=""}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},ot.STYLE_RULE=1,ot.CHARSET_RULE=2,ot.IMPORT_RULE=3,ot.MEDIA_RULE=4,ot.FONT_FACE_RULE=5,ot.PAGE_RULE=6,ot.NAMESPACE_RULE=10,ot.KEYFRAMES_RULE=7,ot.KEYFRAME_RULE=8,ot.SUPPORTS_RULE=12,ot.COUNTER_STYLE_RULE=11,ot.FONT_FEATURE_VALUES_RULE=14,ot.MARGIN_RULE=9,ot);globalThis.Event??=ie;globalThis.CustomEvent??=qa;var wa=Symbol(),ul=o=>typeof o=="boolean"?o:o?.capture??!1,ne={__proto__:null};ne.enumerable=!0;Object.freeze(ne);var Mn=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(t,e,r){if(e==null)return;let i=ul(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);if(n===void 0)n=new Map,i.set(t,n);else if(n.has(e))return;let s=typeof r=="object"&&r?r:{};s.signal?.addEventListener("abort",()=>this.removeEventListener(t,e,r)),n.set(e,s??{})}removeEventListener(t,e,r){if(e==null)return;let i=ul(r)?this.__captureEventListeners:this.__eventListeners,n=i.get(t);n!==void 0&&(n.delete(e),n.size||i.delete(t))}dispatchEvent(t){let e=this.__resolveFullEventPath();!t.composed&&this.__host&&(e=e.slice(0,e.indexOf(this.__host)));let r=!1,i=!1,n=ie.NONE,s=null,a=null,c=null,l=t.stopPropagation,d=t.stopImmediatePropagation;Object.defineProperties(t,{target:{get(){return s??a},...ne},srcElement:{get(){return t.target},...ne},currentTarget:{get(){return c},...ne},eventPhase:{get(){return n},...ne},composedPath:{value:()=>e,...ne},stopPropagation:{value:()=>{r=!0,l.call(t)},...ne},stopImmediatePropagation:{value:()=>{i=!0,d.call(t)},...ne}});let h=(u,g,b)=>{typeof u=="function"?u(t):typeof u?.handleEvent=="function"&&u.handleEvent(t),g.once&&b.delete(u)},f=()=>(c=null,n=ie.NONE,!t.defaultPrevented),m=e.slice().reverse();s=!this.__host||!t.composed?this:null;let y=u=>{for(a=this;a.__host&&u.includes(a.__host);)a=a.__host};for(let u of m){!s&&(!a||a===u.__host)&&y(m.slice(m.indexOf(u))),c=u,n=u===t.target?ie.AT_TARGET:ie.CAPTURING_PHASE;let g=u.__captureEventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}let x=t.bubbles?e:[this];a=null;for(let u of x){!s&&(!a||u===a.__host)&&y(x.slice(0,x.indexOf(u)+1)),c=u,n=u===t.target?ie.AT_TARGET:ie.BUBBLING_PHASE;let g=u.__eventListeners.get(t.type);if(g){for(let[b,q]of g)if(h(b,q,g),i)return f()}if(r)return f()}return f()}__resolveFullEventPath(){return this.__eventPathCache?this.__eventPathCache:this.__eventTargetParent?this.__eventPathCache=[this,...this.__eventTargetParent.__resolveFullEventPath()]:this.__eventPathCache=[this,gl,nu]}};var ml=new WeakMap,qi=o=>{let t=ml.get(o);return t===void 0&&ml.set(o,t=new Map),t},xi=class extends Mn{getRootNode(t){return t?.composed?xa:this.__host?.__shadowRoot??xa}};var fl=class extends xi{get adoptedStyleSheets(){return[]}createTreeWalker(){return{}}createTextNode(){return{}}createElement(){return{}}};var gl=new fl,xa=gl;var bl=class extends xi{constructor(t){if(super(),t!==wa)throw new TypeError("Illegal constructor");Object.assign(this,globalThis,{CustomElementRegistry:Pn,customElements:ka,document:xa,Document:fl,Element:vl,EventTarget:Mn,HTMLElement:yl,Node:xi,ShadowRoot:ql,window:this,Window:bl})}};var vl=class extends xi{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(qi(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){qi(this).set(t,String(e))}removeAttribute(t){qi(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 qi(this).has(t)}attachShadow(t){this.__shadowRootMode=t.mode;let e=new ql(wa,t);return e.__eventTargetParent=this,e.__host=this,this.__shadowRoot=e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new dl(this);return this.__internals=t,t}getAttribute(t){return qi(this).get(t)??null}};var yl=class extends vl{},Ca=yl;var ql=class extends xi{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 Ca,"localName",{get(){return"lit-server-root"}});function ru(){let o,t;return{promise:new Promise((r,i)=>{o=r,t=i}),resolve:o,reject:t}}var Pn=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=ru(),this.__pendingWhenDefineds.set(t,r)),r.promise}},iu=Pn;var ka=new iu,nu=new bl(wa);var wi=globalThis,On=wi.ShadowRoot&&(wi.ShadyCSS===void 0||wi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Sa=Symbol(),xl=new WeakMap,Ci=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Sa)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(On&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=xl.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&xl.set(e,t))}return t}toString(){return this.cssText}},wl=o=>new Ci(typeof o=="string"?o:o+"",void 0,Sa),w=(o,...t)=>{let e=o.length===1?o[0]:t.reduce((r,i,n)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[n+1],o[0]);return new Ci(e,o,Sa)},Cl=(o,t)=>{if(On)o.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=wi.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,o.appendChild(r)}},Ea=On||wi.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return wl(e)})(o):o;var{is:ou,defineProperty:su,getOwnPropertyDescriptor:au,getOwnPropertyNames:cu,getOwnPropertySymbols:lu,getPrototypeOf:du}=Object,Ei=globalThis;Ei.customElements??=ka;var kl=Ei.trustedTypes,hu=kl?kl.emptyScript:"",pu=Ei.reactiveElementPolyfillSupport,ki=(o,t)=>o,Si={toAttribute(o,t){switch(t){case Boolean:o=o?hu:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,t){let e=o;switch(t){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},Dn=(o,t)=>!ou(o,t),Sl={attribute:!0,type:String,converter:Si,reflect:!1,useDefault:!1,hasChanged:Dn};Symbol.metadata??=Symbol("metadata"),Ei.litPropertyMetadata??=new WeakMap;var oe=class extends(globalThis.HTMLElement??Ca){static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Sl){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&&su(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:n}=au(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get:i,set(s){let a=i?.call(this);n?.call(this,s),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??Sl}static _$Ei(){if(this.hasOwnProperty(ki("elementProperties")))return;let t=du(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ki("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ki("properties"))){let e=this.properties,r=[...cu(e),...lu(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(Ea(i))}else t!==void 0&&e.push(Ea(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 Cl(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:Si).toAttribute(e,r.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let n=r.getPropertyOptions(i),s=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Si;this._$Em=i;let a=s.fromAttribute(e,n.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(t,e,r,i=!1,n){if(t!==void 0){let s=this.constructor;if(i===!1&&(n=this[t]),r??=s.getPropertyOptions(t),!((r.hasChanged??Dn)(n,e)||r.useDefault&&r.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,r))))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:i,wrapped:n},s){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),n!==!0||s!==void 0)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),i===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,n]of this._$Ep)this[i]=n;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,n]of r){let{wrapped:s}=n,a=this[i];s!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EM()}catch(r){throw t=!1,this._$EM(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};oe.elementStyles=[],oe.shadowRootOptions={mode:"open"},oe[ki("elementProperties")]=new Map,oe[ki("finalized")]=new Map,pu?.({ReactiveElement:oe}),(Ei.reactiveElementVersions??=[]).push("2.1.2");var zn=globalThis,El=o=>o,$n=zn.trustedTypes,Al=$n?$n.createPolicy("lit-html",{createHTML:o=>o}):void 0,_a="$lit$",se=`lit$${Math.random().toFixed(9).slice(2)}$`,Ta="?"+se,uu=`<${Ta}>`,Ke=zn.document===void 0?{createTreeWalker:()=>({})}:document,_i=()=>Ke.createComment(""),Ti=o=>o===null||typeof o!="object"&&typeof o!="function",Ra=Array.isArray,Pl=o=>Ra(o)||typeof o?.[Symbol.iterator]=="function",Aa=`[
|
|
3
|
+
\f\r]`,Ai=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_l=/-->/g,Tl=/>/g,Je=RegExp(`>|${Aa}(?:([^\\s"'>=/]+)(${Aa}*=${Aa}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Rl=/'/g,Il=/"/g,Ol=/^(?:script|style|textarea|title)$/i,Ia=o=>(t,...e)=>({_$litType$:o,strings:t,values:e}),v=Ia(1),Ii=Ia(2),Pg=Ia(3),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Ml=new WeakMap,Ye=Ke.createTreeWalker(Ke,129);function Dl(o,t){if(!Ra(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Al!==void 0?Al.createHTML(t):t}var $l=(o,t)=>{let e=o.length-1,r=[],i,n=t===2?"<svg>":t===3?"<math>":"",s=Ai;for(let a=0;a<e;a++){let c=o[a],l,d,h=-1,f=0;for(;f<c.length&&(s.lastIndex=f,d=s.exec(c),d!==null);)f=s.lastIndex,s===Ai?d[1]==="!--"?s=_l:d[1]!==void 0?s=Tl:d[2]!==void 0?(Ol.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=Je):d[3]!==void 0&&(s=Je):s===Je?d[0]===">"?(s=i??Ai,h=-1):d[1]===void 0?h=-2:(h=s.lastIndex-d[2].length,l=d[1],s=d[3]===void 0?Je:d[3]==='"'?Il:Rl):s===Il||s===Rl?s=Je:s===_l||s===Tl?s=Ai:(s=Je,i=void 0);let m=s===Je&&o[a+1].startsWith("/>")?" ":"";n+=s===Ai?c+uu:h>=0?(r.push(l),c.slice(0,h)+_a+c.slice(h)+se+m):c+se+(h===-2?a:m)}return[Dl(o,n+(o[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Ri=class o{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let n=0,s=0,a=t.length-1,c=this.parts,[l,d]=$l(t,e);if(this.el=o.createElement(l,r),Ye.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=Ye.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let h of i.getAttributeNames())if(h.endsWith(_a)){let f=d[s++],m=i.getAttribute(h).split(se),y=/([.?@])?(.*)/.exec(f);c.push({type:1,index:n,name:y[2],strings:m,ctor:y[1]==="."?Ln:y[1]==="?"?Vn:y[1]==="@"?jn:tr}),i.removeAttribute(h)}else h.startsWith(se)&&(c.push({type:6,index:n}),i.removeAttribute(h));if(Ol.test(i.tagName)){let h=i.textContent.split(se),f=h.length-1;if(f>0){i.textContent=$n?$n.emptyScript:"";for(let m=0;m<f;m++)i.append(h[m],_i()),Ye.nextNode(),c.push({type:2,index:++n});i.append(h[f],_i())}}}else if(i.nodeType===8)if(i.data===Ta)c.push({type:2,index:n});else{let h=-1;for(;(h=i.data.indexOf(se,h+1))!==-1;)c.push({type:7,index:n}),h+=se.length-1}n++}}static createElement(t,e){let r=Ke.createElement("template");return r.innerHTML=t,r}};function Ze(o,t,e=o,r){if(t===it)return t;let i=r!==void 0?e._$Co?.[r]:e._$Cl,n=Ti(t)?void 0:t._$litDirective$;return i?.constructor!==n&&(i?._$AO?.(!1),n===void 0?i=void 0:(i=new n(o),i._$AT(o,e,r)),r!==void 0?(e._$Co??=[])[r]=i:e._$Cl=i),i!==void 0&&(t=Ze(o,i._$AS(o,t.values),i,r)),t}var Nn=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??Ke).importNode(e,!0);Ye.currentNode=i;let n=Ye.nextNode(),s=0,a=0,c=r[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new Ar(n,n.nextSibling,this,t):c.type===1?l=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(l=new Fn(n,this,t)),this._$AV.push(l),c=r[++a]}s!==c?.index&&(n=Ye.nextNode(),s++)}return Ye.currentNode=Ke,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++}},Ar=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,i){this.type=2,this._$AH=P,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Ze(this,t,e),Ti(t)?t===P||t==null||t===""?(this._$AH!==P&&this._$AR(),this._$AH=P):t!==this._$AH&&t!==it&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Pl(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&&Ti(this._$AH)?this._$AA.nextSibling.data=t:this.T(Ke.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=Ri.createElement(Dl(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let n=new Nn(i,this),s=n.u(this.options);n.p(e),this.T(s),this._$AH=n}}_$AC(t){let e=Ml.get(t.strings);return e===void 0&&Ml.set(t.strings,e=new Ri(t)),e}k(t){Ra(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let n of t)i===e.length?e.push(r=new o(this.O(_i()),this.O(_i()),this,this.options)):r=e[i],r._$AI(n),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let r=El(t).nextSibling;El(t).remove(),t=r}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},tr=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,n){this.type=1,this._$AH=P,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=P}_$AI(t,e=this,r,i){let n=this.strings,s=!1;if(n===void 0)t=Ze(this,t,e,0),s=!Ti(t)||t!==this._$AH&&t!==it,s&&(this._$AH=t);else{let a=t,c,l;for(t=n[0],c=0;c<n.length-1;c++)l=Ze(this,a[r+c],e,c),l===it&&(l=this._$AH[c]),s||=!Ti(l)||l!==this._$AH[c],l===P?t=P:t!==P&&(t+=(l??"")+n[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??"")}},Ln=class extends tr{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===P?void 0:t}},Vn=class extends tr{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==P)}},jn=class extends tr{constructor(t,e,r,i,n){super(t,e,r,i,n),this.type=5}_$AI(t,e=this){if((t=Ze(this,t,e,0)??P)===it)return;let r=this._$AH,i=t===P&&r!==P||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==P&&(r===P||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},Fn=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){Ze(this,t)}},et={M:_a,P:se,A:Ta,C:1,L:$l,R:Nn,D:Pl,V:Ze,I:Ar,H:tr,N:Vn,U:jn,B:Ln,F:Fn},mu=zn.litHtmlPolyfillSupport;mu?.(Ri,Ar),(zn.litHtmlVersions??=[]).push("3.3.3");var Ma=(o,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let n=e?.renderBefore??null;r._$litPart$=i=new Ar(t.insertBefore(_i(),n),n,void 0,e??{})}return i._$AI(o),i};var Pa=globalThis,S=class extends oe{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=Ma(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return it}};S._$litElement$=!0,S.finalized=!0,Pa.litElementHydrateSupport?.({LitElement:S});var fu=Pa.litElementPolyfillSupport;fu?.({LitElement:S});(Pa.litElementVersions??=[]).push("4.2.2");var gu={attribute:!0,type:String,converter:Si,reflect:!1,hasChanged:Dn},bu=(o=gu,t,e)=>{let{kind:r,metadata:i}=e,n=globalThis.litPropertyMetadata.get(i);if(n===void 0&&globalThis.litPropertyMetadata.set(i,n=new Map),r==="setter"&&((o=Object.create(o)).wrapped=!0),n.set(e.name,o),r==="accessor"){let{name:s}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(s,c,o,!0,a)},init(a){return a!==void 0&&this.C(s,void 0,o,a),a}}}if(r==="setter"){let{name:s}=e;return function(a){let c=this[s];t.call(this,a),this.requestUpdate(s,c,o,!0,a)}}throw Error("Unsupported decorator location: "+r)};function p(o){return(t,e)=>typeof e=="object"?bu(o,t,e):((r,i,n)=>{let s=i.hasOwnProperty(n);return i.constructor.createProperty(n,r),s?Object.getOwnPropertyDescriptor(i,n):void 0})(o,t,e)}function T(o){return p({...o,state:!0,attribute:!1})}var xe=(o,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(o,t,e),e);function _r(o,t){return(e,r,i)=>{let n=s=>s.renderRoot?.querySelector(o)??null;if(t){let{get:s,set:a}=typeof r=="object"?e:i??(()=>{let c=Symbol();return{get(){return this[c]},set(l){this[c]=l}}})();return xe(e,r,{get(){let c=s.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return xe(e,r,{get(){return n(this)}})}}function Nl(o){return(t,e)=>{let{slot:r,selector:i}=o??{},n="slot"+(r?`[name=${r}]`:":not([name])");return xe(t,e,{get(){let s=this.renderRoot?.querySelector(n),a=s?.assignedElements(o)??[];return i===void 0?a:a.filter(c=>c.matches(i))}})}}var ae=class extends Event{constructor(t,e,r,i){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.contextTarget=e,this.callback=r,this.subscribe=i??!1}};var at=class{constructor(t,e,r,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,s)=>{this.unsubscribe&&(this.unsubscribe!==s&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,s)),this.unsubscribe=s},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=n.subscribe??!1}else this.context=e,this.callback=r,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ae(this.context,this.host,this.t,this.subscribe))}};var Bn=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}},Bt=class extends Bn{constructor(t,e,r){super(e.context!==void 0?e.initialValue:r),this.onContextRequest=i=>{if(i.context!==this.context)return;let n=i.contextTarget??i.composedPath()[0];n!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,n,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let n=new Set;for(let[s,{consumerHost:a}]of this.subscriptions)n.has(s)||(n.add(s),a.dispatchEvent(new ae(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))}};var Mi=class{constructor(){this.pendingContextRequests=new Map,this.onContextProvider=t=>{let e=this.pendingContextRequests.get(t.context);if(e===void 0)return;this.pendingContextRequests.delete(t.context);let{requests:r}=e;for(let{elementRef:i,callbackRef:n}of r){let s=i.deref(),a=n.deref();s===void 0||a===void 0||s.dispatchEvent(new ae(t.context,s,a,!0))}},this.onContextRequest=t=>{if(t.subscribe!==!0)return;let e=t.contextTarget??t.composedPath()[0],r=t.callback,i=this.pendingContextRequests.get(t.context);i===void 0&&this.pendingContextRequests.set(t.context,i={callbacks:new WeakMap,requests:[]});let n=i.callbacks.get(e);n===void 0&&i.callbacks.set(e,n=new WeakSet),n.has(r)||(n.add(r),i.requests.push({elementRef:new WeakRef(e),callbackRef:new WeakRef(r)}))}}attach(t){t.addEventListener("context-request",this.onContextRequest),t.addEventListener("context-provider",this.onContextProvider)}detach(t){t.removeEventListener("context-request",this.onContextRequest),t.removeEventListener("context-provider",this.onContextProvider)}};function J({context:o}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return{get(){return t.get.call(this)},set(i){return r.get(this).setValue(i),t.set.call(this,i)},init(i){return r.set(this,new Bt(this,{context:o,initialValue:i})),i}};{t.constructor.addInitializer((s=>{r.set(s,new Bt(s,{context:o}))}));let i=Object.getOwnPropertyDescriptor(t,e),n;if(i===void 0){let s=new WeakMap;n={get(){return s.get(this)},set(a){r.get(this).setValue(a),s.set(this,a)},configurable:!0,enumerable:!0}}else{let s=i.set;n={...i,set(a){r.get(this).setValue(a),s?.call(this,a)}}}return void Object.defineProperty(t,e,n)}}}function R({context:o,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer((function(){new at(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:t})})):e.constructor.addInitializer((i=>{new at(i,{context:o,callback:n=>{i[r]=n},subscribe:t})}))}}var Un=["this"],Ll=["+","-","!"],Vl=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],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},Hn=13;var vu=["==","!=","<=",">=","||","&&","??","|>"],yu=["===","!=="],O;(function(o){o[o.STRING=1]="STRING",o[o.IDENTIFIER=2]="IDENTIFIER",o[o.DOT=3]="DOT",o[o.COMMA=4]="COMMA",o[o.COLON=5]="COLON",o[o.INTEGER=6]="INTEGER",o[o.DECIMAL=7]="DECIMAL",o[o.OPERATOR=8]="OPERATOR",o[o.GROUPER=9]="GROUPER",o[o.KEYWORD=10]="KEYWORD",o[o.ARROW=11]="ARROW"})(O||(O={}));var Ht=(o,t,e=0)=>({kind:o,value:t,precedence:e}),qu=o=>o===9||o===10||o===13||o===32,jl=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),xu=o=>jl(o)||Pi(o),wu=o=>Un.indexOf(o)!==-1,Cu=o=>o===34||o===39,Pi=o=>48<=o&&o<=57,ku=o=>o===43||o===45||o===42||o===47||o===33||o===38||o===37||o===60||o===61||o===62||o===63||o===94||o===124,Su=o=>o===40||o===41||o===91||o===93||o===123||o===125,Eu=o=>o.replace(/\\(.)/g,(t,e)=>{switch(e){case"n":return`
|
|
5
|
+
`;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),Wn=class{#t;#e=-1;#r=0;#i;constructor(t){this.#t=t,this.#n()}nextToken(){for(;qu(this.#i);)this.#n(!0);if(Cu(this.#i))return this.#a();if(jl(this.#i))return this.#c();if(Pi(this.#i))return this.#p();if(this.#i===46)return this.#l();if(this.#i===44)return this.#d();if(this.#i===58)return this.#h();if(ku(this.#i))return this.#g();if(Su(this.#i))return this.#m();if(this.#n(),this.#i!==void 0)throw new Error(`Expected end of input, got ${this.#i}`)}#n(t){this.#e++,this.#e<this.#t.length?(this.#i=this.#t.charCodeAt(this.#e),t===!0&&(this.#r=this.#e)):this.#i=void 0}#o(t=0){let e=this.#t.substring(this.#r,this.#e+t);return t===0&&this.#s(),e}#s(){this.#r=this.#e}#a(){let t="unterminated string",e=this.#i;for(this.#n(!0);this.#i!==e;){if(this.#i===void 0)throw new Error(t);if(this.#i===92&&(this.#n(),this.#i===void 0))throw new Error(t);this.#n()}let r=Ht(O.STRING,Eu(this.#o()));return this.#n(),r}#c(){do this.#n();while(xu(this.#i));let t=this.#o(),e=wu(t)?O.KEYWORD:O.IDENTIFIER;return Ht(e,t)}#p(){do this.#n();while(Pi(this.#i));return this.#i===46?this.#l():Ht(O.INTEGER,this.#o())}#l(){return this.#n(),Pi(this.#i)?this.#u():(this.#s(),Ht(O.DOT,".",Hn))}#d(){return this.#n(!0),Ht(O.COMMA,",")}#h(){return this.#n(!0),Ht(O.COLON,":")}#u(){do this.#n();while(Pi(this.#i));return Ht(O.DECIMAL,this.#o())}#g(){this.#n();let t=this.#o(2);if(yu.indexOf(t)!==-1)this.#n(),this.#n();else{if(t=this.#o(1),t==="=>")return this.#n(),Ht(O.ARROW,t);vu.indexOf(t)!==-1&&this.#n()}return t=this.#o(),Ht(O.OPERATOR,t,Da[t])}#m(){let t=String.fromCharCode(this.#i),e=Ht(O.GROUPER,t,Da[t]);return this.#n(!0),e}};var $a=(o,t)=>new Oi(o,t).parse(),Oi=class{#t;#e;#r;#i;#n;constructor(t,e){this.#e=new Wn(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(O.GROUPER,"(")){let r=this.#f();t=this.#r.invoke(t,void 0,r)}else if(this._matches(O.GROUPER,"[")){let r=this.#v();t=this.#r.index(t,r)}else if(this._matches(O.DOT)){this.#o();let r=this.#l();t=this.#c(t,r)}else{if(this._matches(O.KEYWORD))break;if(this._matches(O.OPERATOR)&&this.#i.precedence>=e)t=this.#n==="?"?this.#d(t):this.#p(t,this.#i);else break}return t}#c(t,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#r.getter(t,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let r=e.receiver;return this.#r.invoke(t,r.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#p(t,e){if(Vl.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#o();let r=this.#l();for(;(this.#t===O.OPERATOR||this.#t===O.DOT||this.#t===O.GROUPER)&&this.#i.precedence>e.precedence;)r=this.#a(r,this.#i.precedence);return this.#r.binary(t,e.value,r)}#l(){if(this._matches(O.OPERATOR)){let t=this.#n;if(this.#o(),t==="+"||t==="-"){if(this._matches(O.INTEGER))return this.#x(t);if(this._matches(O.DECIMAL))return this.#C(t)}if(Ll.indexOf(t)===-1)throw new Error(`unexpected token: ${t}`);let e=this.#a(this.#h(),Hn);return this.#r.unary(t,e)}return this.#h()}#d(t){this.#o(O.OPERATOR,"?");let e=this.#s();this.#o(O.COLON);let r=this.#s();return this.#r.ternary(t,e,r)}#h(){switch(this.#t){case O.KEYWORD:let t=this.#n;if(t==="this")return this.#o(),this.#r.id(t);throw Un.indexOf(t)!==-1?new Error(`unexpected keyword: ${t}`):new Error(`unrecognized keyword: ${t}`);case O.IDENTIFIER:return this.#m();case O.STRING:return this.#q();case O.INTEGER:return this.#x();case O.DECIMAL:return this.#C();case O.GROUPER:return this.#n==="("?this.#y():this.#n==="{"?this.#g():this.#n==="["?this.#u():void 0;case O.COLON:throw new Error('unexpected token ":"');default:return}}#u(){let t=[];do{if(this.#o(),this._matches(O.GROUPER,"]"))break;t.push(this.#s())}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"]"),this.#r.list(t)}#g(){let t={};do{if(this.#o(),this._matches(O.GROUPER,"}"))break;let e=this.#n;(this._matches(O.STRING)||this._matches(O.IDENTIFIER))&&this.#o(),this.#o(O.COLON),t[e]=this.#s()}while(this._matches(O.COMMA));return this.#o(O.GROUPER,"}"),this.#r.map(t)}#m(){let t=this.#n;if(t==="true")return this.#o(),this.#r.literal(!0);if(t==="false")return this.#o(),this.#r.literal(!1);if(t==="null")return this.#o(),this.#r.literal(null);if(t==="undefined")return this.#o(),this.#r.literal(void 0);let e=this.#b(),r=this.#f();return r?this.#r.invoke(e,void 0,r):e}#b(){if(!this._matches(O.IDENTIFIER))throw new Error(`expected identifier: ${this.#n}`);let t=this.#n;return this.#o(),this.#r.id(t)}#f(){if(!this._matches(O.GROUPER,"("))return;let t=[];do{if(this.#o(),this._matches(O.GROUPER,")"))break;let e=this.#s();t.push(e)}while(this._matches(O.COMMA));return this.#o(O.GROUPER,")"),t}#v(){this.#o();let t=this.#s();return this.#o(O.GROUPER,"]"),t}#y(){let t=this.#f();if(this._matches(O.ARROW)){this.#o();let e=this.#s(),r=t?.map(i=>i.value)??[];return this.#r.arrowFunction(r,e)}else return this.#r.paren(t[0])}#q(){let t=this.#r.literal(this.#n);return this.#o(),t}#x(t=""){let e=this.#r.literal(parseInt(`${t}${this.#n}`,10));return this.#o(),e}#C(t=""){let e=this.#r.literal(parseFloat(`${t}${this.#n}`));return this.#o(),e}};var{hasOwn:Fl,fromEntries:Au}=Object,_u={"+":(o,t)=>o+t,"-":(o,t)=>o-t,"*":(o,t)=>o*t,"/":(o,t)=>o/t,"%":(o,t)=>o%t,"==":(o,t)=>o==t,"!=":(o,t)=>o!=t,"===":(o,t)=>o===t,"!==":(o,t)=>o!==t,">":(o,t)=>o>t,">=":(o,t)=>o>=t,"<":(o,t)=>o<t,"<=":(o,t)=>o<=t,"||":(o,t)=>o||t,"&&":(o,t)=>o&&t,"??":(o,t)=>o??t,"|":(o,t)=>t(o),"|>":(o,t)=>t(o)},Tu={"+":o=>o,"-":o=>-o,"!":o=>!o},Qn=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=Tu[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=_u[e];return{type:"Binary",operator:e,left:t,right:r,evaluate(n){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let s=this.right.evaluate(n),a,c;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(n),c=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(n),c=this.left.argument.evaluate(n)):this.left.type==="ID"&&(a=n,c=this.left.value),a===void 0?void 0:a[c]=s}return i(this.left.evaluate(n),this.right.evaluate(n))},getIds(n){return this.left.getIds(n),this.right.getIds(n),n}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(r){return this.receiver.evaluate(r)?.[this.name]},getIds(r){return this.receiver.getIds(r),r}}}invoke(t,e,r){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:r,evaluate(i){let n=this.receiver.evaluate(i),s=this.method?n:i?.this??i,a=this.method?n?.[e]:n,l=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(s,l)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(n=>n?.getIds(i)),i}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(r){return this.receiver.evaluate(r)?.[this.argument.evaluate(r)]},getIds(r){return this.receiver.getIds(r),r}}}ternary(t,e,r){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:r,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(t){return{type:"Map",entries:t,evaluate(e){let r={};if(t&&this.entries)for(let i in t){let n=this.entries[i];n&&(r[i]=n.evaluate(e))}return r},getIds(e){if(t&&this.entries)for(let r in t){let i=this.entries[r];i&&i.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(e){return this.items?.map(r=>r?.evaluate(e))},getIds(e){return this.items?.forEach(r=>r?.getIds(e)),e}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(r){let i=this.params,n=this.body;return function(...s){let a=Au(i.map((l,d)=>[l,s[d]])),c=new Proxy(r??{},{set(l,d,h){return Fl(a,d)&&(a[d]=h),l[d]=h},get(l,d){return Fl(a,d)?a[d]:l[d]}});return n.evaluate(c)}},getIds(r){return this.body.getIds(r).filter(i=>!this.params.includes(i))}}}};var Na=null,zl={boundAttributeSuffix:et.M,marker:et.P,markerMatch:et.A,HTML_RESULT:et.C,getTemplateHtml:et.L,overrideDirectiveResolve:(o,t)=>class extends o{_$AS(e,r){return t(this,r)}},patchDirectiveResolve:(o,t)=>{if(o.prototype._$AS.name!==t.name){Na??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Na))return void(e[Na]=t);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,t){o._$litDirective$=t},getAttributePartCommittedValue:(o,t,e)=>{let r=it;return o.j=i=>r=i,o._$AI(t,o,e),r},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:et.V,AttributePart:et.H,PropertyPart:et.B,BooleanAttributePart:et.N,EventPart:et.U,ElementPart:et.F,TemplateInstance:et.R,isIterable:et.D,ChildPart:et.I};var{AttributePart:Ru,PropertyPart:Iu,BooleanAttributePart:Mu,EventPart:Pu}=zl,Va=new Qn,La=new Map,Bl=o=>o.replace(/-(-|\w)/g,(t,e)=>e.toUpperCase()),Xn=(o,t)=>{let e=La.get(o);if(e===void 0){if(La.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let r=o.substring(2,o.length-2).trim();e=new Oi(r,Va).parse(),La.set(o,e)}}return e?.evaluate(t)},Ou=(o,t,e,r)=>{let i=o.getAttribute("if");if(i!==null&&Xn(i,t))return Gn(o,t,e,r)},Ul=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,Hl=o=>/(?:\\{{)|(?:\\}})/g.test(o),Di=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Du=(o,t,e,r)=>{let i=o.getAttribute("repeat");if(i!==null){let n=Xn(i,t);if(!n[Symbol.iterator])return P;let s=$i(o),a=-1,c=[];for(let l of n){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 y=m.update(d,e,r);m.type===1?h.push(...y):h.push(y)}let f={_$litType$:s,values:h};c.push(f)}return c}},Ql={if:Ou,repeat:Du},Xl=(o,t=Ql,e={},r)=>{let n=$i(o).renderers;if(r){let a=$i(r).renderers,c=n.super;c!==void 0?e={...n,...e,super:(l,d,h)=>(h={...a,...h,super:(f,m,y)=>Gn(r,f,m,y)},c(l,d,h))}:(e={...a,...n,...e},o=r)}else e={...n,...e};return s=>Gn(o,s,t,e)};var Gn=(o,t,e=Ql,r={})=>{let i=$i(o),n=[];for(let a of i.parts){let c=a.update(t,e,r);a.type===1?n.push(...c):n.push(c)}return{_$litType$:i,values:n}},Wl=new Map,$i=o=>{let t=Wl.get(o);return t===void 0&&Wl.set(o,t=$u(o)),t},$u=o=>{let t={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(t.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),r=e.currentNode,i=-1,n=[];for(;(r=e.nextNode())!==null;)if(r.nodeType===Node.COMMENT_NODE)i++;else if(r.nodeType===Node.ELEMENT_NODE){i++;let s=r;if(s.tagName==="TEMPLATE"){let 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),n.push(s);let h;if(d!==null){let f=d.trim(),m=f.startsWith("{{")&&f.endsWith("}}");h=(y,x,u)=>{let g=s.getAttribute("data"),b=g===null?void 0:Xn(g,y);return(m?Xn(f,y):u[d])?.(b,x,u)}}else c!==null?h=(f,m,y)=>{let x=m[c];return x?.(s,f,m,y)}:(l==="super"?t.renderers.super=(f,m,y)=>{let x=y.super,u=$i(s);return y={...y,...u.renderers},x(f,m,y)}:t.renderers[l]=(f,m,y)=>Gn(s,f,m,y),h=(f,m,y)=>{let x=y[l];return x?.(f,m,y)});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(Ul);if(d.length===1){Hl(l)&&s.setAttribute(c,Di(l));continue}s.removeAttribute(c);let h=c,f=Ru,m=c[0];m==="."?(h=Bl(c.substring(1)),f=Iu):m==="?"?(h=c.substring(1),f=Mu):m==="@"&&(h=Bl(c.substring(1)),f=Pu);let y=[Di(d[0])],x=[];for(let u=1;u<d.length;u+=2){let g=d[u];x.push($a(g,Va)),y.push(Di(d[u+1]))}t.parts.push({type:1,index:i,name:h,strings:y,ctor:f,update:(u,g,b)=>x.map(q=>q.evaluate(u))})}}else if(r.nodeType===Node.TEXT_NODE){let s=r,a=s.textContent,c=a.split(Ul);c.length>1?s.textContent=Di(c[0]):Hl(a)&&(s.textContent=Di(a));for(let l=1;l<c.length;l+=2){let d=c[l],h=$a(d,Va);t.parts.push({type:2,index:++i,update:(m,y)=>h.evaluate(m)});let f=new Text(c[l+1].replace("\\{{","{{"));s.parentNode.insertBefore(f,s.nextSibling),s.parentNode.insertBefore(document.createComment(""),s.nextSibling),s=f,e.currentNode=f}}for(let s of n)s.remove();return t};var ja=Symbol.for("qti-components.context-root"),Nu=()=>{if(typeof document>"u")return;let o=globalThis;o[ja]||(o[ja]=new Mi,o[ja].attach(document.documentElement))};Nu();var Gl=[];var za=class extends Set{#t;constructor(t){super(),this.#t=t}add(t){return super.add(t),this.#e(),this}delete(t){let e=super.delete(t);return this.#e(),e}clear(){super.clear(),this.#e()}#e(){this.#t.isConnected?this.#r():queueMicrotask(()=>this.#r())}#r(){this.size===0?this.#t.removeAttribute("data-state"):this.#t.setAttribute("data-state",Array.from(this).join(" "))}},Fa="custom-state-support-probe";function Lu(o){if(!("states"in ElementInternals.prototype))return"missing";if(typeof customElements>"u")return"modern";try{customElements.get(Fa)||customElements.define(Fa,class extends HTMLElement{});let t=o.call(document.createElement(Fa)).states;return t?(t.add("probe"),t.delete("probe"),"modern"):"missing"}catch{return"legacy"}}var Jl=!1;function Yl(){if(Jl)return"already-installed";if(typeof HTMLElement>"u"||typeof ElementInternals>"u")return"modern";let o=HTMLElement.prototype.attachInternals;if(!o)return"modern";let t=Lu(o);return t==="modern"||(Jl=!0,HTMLElement.prototype.attachInternals=function(){let r=o.call(this);return Object.defineProperty(r,"states",{configurable:!0,enumerable:!0,value:new za(this)}),r}),t}Yl();for(let{tag:o,ctor:t}of Gl)customElements.get(o)||customElements.define(o,t);var we=Symbol("computedItemContext");var ct=Symbol("computedContext");var yt=Symbol("configContext");var Tr=Symbol("interactionContext");var j=Symbol("item");var Kl=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var Vu=/^[A-Za-z0-9-]+$/,ju=o=>typeof o=="string"&&Vu.test(o),Sv=o=>ju(o)?o:void 0,qt=Symbol("qtiContext");var Ba={view:"candidate"},Jn=Symbol("sessionContext");var Ua={items:[],testOutcomeVariables:[]},nt=Symbol("testContext");var M=w`
|
|
6
6
|
:host {
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
@@ -56,23 +56,23 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
56
56
|
[part~='message'] {
|
|
57
57
|
display: none;
|
|
58
58
|
}
|
|
59
|
-
`;var
|
|
59
|
+
`;var Zl={chip:["drag"],drop:["droppable"],lifted:["dragging"],used:["placeholder"],"return-target":["return-anchor"],"drag-over":["hover"],"candidate-partial":["candidate-partially-correct"]};function z(o,t,e,r){if(!o)return;let i=[t,...r??Zl[t]??[]];for(let n of i)e?o.add(n):o.delete(n)}function Ni(o,t){return o?o.has(t)?!0:(Zl[t]??[]).some(e=>o.has(e)):!1}var Rr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},D=class extends S{#t;get _context(){return this.#t.value}#e;#r;#i(t){t?.readonly!==void 0&&t.readonly!==this.#e&&(this.#e=t.readonly,this.readonly=t.readonly),t?.disabled!==void 0&&t.disabled!==this.#r&&(this.#r=t.disabled,this.disabled=t.disabled),this.#a(t)}#n;#o;#s;#a(t){let e=this.responseIdentifier??this.getAttribute("response-identifier"),r=t?.variables?.find(s=>s.type==="response"&&s.identifier===e);if(!r)return;if(!this.hasUpdated){this.#s||(this.#s=!0,this.updateComplete.then(()=>{this.#s=!1,this.#a(this._context)}));return}let i=this.#n===void 0,n=JSON.stringify(r.value??null);n!==this.#n&&(this.#n=n,!(i&&(r.value===null||r.value===void 0))&&n!==this.#o&&(this.#o=n,this.response=r.value))}#c;static{this.formAssociated=!0}get internals(){return this._internals}get registersWithItem(){return!0}get isInline(){return!1}get responseVariable(){if(!this._context?.variables)return;let t=this._context.variables.filter(r=>r.type==="response"),e=this.getAttribute("response-identifier");return t.find(r=>r.identifier===e)}get value(){return JSON.stringify(this.response)}set value(t){this.response=t?JSON.parse(t):null}resetValidityReport(){this._validityReported=!1,this.clearInlineValidationMessage()}reportValidity(t){let e=t?.trigger??"submit";e==="submit"&&this.validate?.();let r=this._internals.validity.valid,i=this.validationDisplayMode;if(e==="submit"&&(this._validityReported=!0),e==="change"&&!this._validityReported&&this._validityKind==="min")return this.clearInlineValidationMessage(),r;if(i==="native"||i==="both"){this._reportingNatively=!0;try{this._internals.reportValidity()}finally{this._reportingNatively=!1}}return i==="inline"||i==="both"?this.updateInlineValidationMessage():this.clearInlineValidationMessage(),i==="none"&&this.clearInlineValidationMessage(),r}get validationDisplayMode(){return this.configContext?.validationDisplayMode??"inline"}resolveAllowReorder(t){let e=t?.defaultWhenUnset??!0,r=this.configContext;return r&&r.allowReorder!==void 0?r.allowReorder:e}resolveDisableAfterMaxReached(t){let e=t?.defaultWhenUnset??!1,r=this.configContext;return r?r.disableAfterMaxReached!==void 0?r.disableAfterMaxReached:r.disableAfterIfMaxChoicesReached!==void 0?(this.#c||(this.#c=!0,console.warn("[QTI Config] `disableAfterIfMaxChoicesReached` is deprecated. Use `disableAfterMaxReached` instead.")),r.disableAfterIfMaxChoicesReached):e:e}setInteractionValidity(t,e="",r,i){let n=r??this;this._internals.setValidity(t?{}:{customError:!0},e,n),this._validityKind=t?void 0:i?.kind??"other",i?.suppressInline!==!0&&(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage()}updateInlineValidationMessage(){let t=this.getValidationMessageElement();if(t){if(!this._internals.validity.valid){t.textContent=this._internals.validationMessage,t.style.setProperty("display","block","important");return}t.textContent="",t.style.display="none"}}clearInlineValidationMessage(){let t=this.getValidationMessageElement();t&&(t.textContent="",t.style.display="none")}getValidationMessageElement(){return this.shadowRoot?.querySelector("#validation-message")}reset(){this.resetValidityReport(),this.response=null}formResetCallback(){this.resetValidityReport(),this.reset()}connectedCallback(){super.connectedCallback(),this.registersWithItem&&this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1,detail:{interactionElement:this,responseIdentifier:this.responseIdentifier}}))}saveResponse(t,e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(t)?[...t]:t,...e!==void 0?{state:e}:{}}}))}update(t){let e=!this.hasUpdated;if(super.update(t),e){let r=()=>this.isConnected&&this.validate();this.updateComplete.then(r),requestAnimationFrame(()=>requestAnimationFrame(r))}t.has("disabled")&&z(this._internals.states,"disabled",this.disabled),t.has("readonly")&&z(this._internals.states,"readonly",this.readonly)}constructor(){super(),this.#t=new at(this,{context:j,subscribe:!0,callback:t=>this.#i(t)}),this.#s=!1,this.#c=!1,this._interactionContext={choiceRole:null,draggablesSelector:null},this.disabled=!1,this.readonly=!1,this._validityReported=!1,this._reportingNatively=!1,this._internals=this.attachInternals(),this.addEventListener("invalid",()=>{this._reportingNatively||(this._validityReported=!0,(this.validationDisplayMode==="inline"||this.validationDisplayMode==="both")&&this.updateInlineValidationMessage())}),this.addEventListener("qti-interaction-response",t=>{this.#o=JSON.stringify(t.detail?.response??null)})}firstUpdated(t){}};Rr([R({context:yt,subscribe:!0})],D.prototype,"configContext",void 0);Rr([J({context:Tr})],D.prototype,"_interactionContext",void 0);Rr([p({type:String,attribute:"response-identifier"})],D.prototype,"responseIdentifier",void 0);Rr([p({reflect:!0,type:Boolean})],D.prototype,"disabled",void 0);Rr([p({reflect:!0,type:Boolean})],D.prototype,"readonly",void 0);Rr([p({type:String})],D.prototype,"name",void 0);var Ir=class extends S{render(){return v`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(i=>i.innerHTML.trim());return r.length>1||t==="multiple"||t==="ordered"?r:r[0]}};var Wa=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ha=(o,t)=>o==null?{identifier:"",baseType:"string",value:null,cardinality:"single",type:"response"}:Array.isArray(o)?{identifier:"",baseType:t??td(o[0]),value:o.map(e=>String(e)),cardinality:"multiple",type:"response"}:{identifier:"",baseType:t??td(o),value:String(o),cardinality:"single",type:"response"},td=o=>typeof o=="number"?Number.isInteger(o)?"integer":"float":typeof o=="boolean"?"boolean":"string",Fu=(o,t)=>{if(!(!Array.isArray(t)||t.length>0))return o.lastVariables.find(e=>e?.baseType&&e.baseType!=="record"&&e.cardinality!=="record")?.baseType},E=class extends S{constructor(){super(...arguments),this.#t=[],this.getVariables=()=>{let t=Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent.trim(),cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return r==="QTI_CONTEXT"?this.qtiContext?.QTI_CONTEXT?{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}:(console.warn("QTI_CONTEXT not available"),{identifier:"QTI_CONTEXT",baseType:"record",value:this.qtiContext.QTI_CONTEXT,cardinality:"record",type:"context"}):this.resolveVariable(r)}case"qti-multiple":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"multiple",type:"response"}:null}case"qti-ordered":{let i=e.getResult();return i?.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(n=>n.value),cardinality:"ordered",type:"response"}:null}case"qti-repeat":{let i=e.getResult();return i?.length>0?i:null}case"qti-custom-operator":return Ha(e.calculate?.());case"qti-correct":{let r=e.getAttribute("identifier")||"",i=this.context?.variables?.find(n=>n.identifier===r);return i?{baseType:i.baseType,value:i.correctResponse,cardinality:i.cardinality}:(console.warn(`qti-correct: no response declaration for "${r}"`),Ha(null))}default:{try{let r=e,i=r.getResult();return Ha(i,r.resultBaseType??Fu(r,i))}catch(r){console.warn(`getVariables: could not read a value from <${e.tagName.toLowerCase()}>`,r)}return null}}}).flatMap(e=>Array.isArray(e)?e:[e]).filter(e=>e!==null);return this.#t=t,t}}#t;get lastResult(){return this.result}get lastVariables(){return this.#t}static{this.styles=w`
|
|
60
60
|
slot {
|
|
61
61
|
display: none;
|
|
62
62
|
}
|
|
63
|
-
`}render(){return v`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(i=>i.identifier===e[0])?.variables?.find(i=>i.identifier===e[e.length-1])??null}};za([R({context:j,subscribe:!0})],E.prototype,"context",void 0);za([R({context:qt,subscribe:!0})],E.prototype,"qtiContext",void 0);za([R({context:nt,subscribe:!0})],E.prototype,"_testContext",void 0);var Qt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Kv=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Mt=o=>typeof o=="string"?o:o.toString();function Ba(o){return o==null}function Xn(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Li=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pt=class extends S{constructor(){super(...arguments),this.showHide="show",this.#t=new at(this,{context:j,subscribe:!0,callback:t=>this.#r(t)}),this.#i=!1}#t;get _context(){return this.#t.value}#e;#r(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let r=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),i=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,n=this.#e===void 0?i>0:this.#e!==r||i>0;this.#e=r,n&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!Ba(this.identifier)&&!Ba(e?.value)&&this.identifier===e.value||!1,this.#n(r)}#i;#n(t){let e=this.#s()&&this.#o(t)?"on":"off";if(e==="on"){if(this.showStatus==="on"||this.#i)return;if(!this.feedbackShowing()){this.#i=!0,this.showStatus="off";return}}else if(this.#i=!1,this.showStatus==="on"&&!this.feedbackHiding())return;this.showStatus=e}#o(t){return t&&this.showHide==="show"||!t&&this.showHide==="hide"}feedbackShowing(){return!0}feedbackHiding(){return!0}#s(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(i=>i.active)?.sections.flatMap(i=>i.items).find(i=>i.active);if(!t||t.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}};Li([p({type:String,attribute:"show-hide"})],pt.prototype,"showHide",void 0);Li([p({type:String,attribute:"outcome-identifier"})],pt.prototype,"outcomeIdentifier",void 0);Li([p({type:String})],pt.prototype,"identifier",void 0);Li([p({type:String,attribute:!1})],pt.prototype,"showStatus",void 0);Li([R({context:ct,subscribe:!0}),T()],pt.prototype,"_computedContext",void 0);function Vi(o){if(o==null)return null;if(!o.includes(",")){let e=o.trim();return e.length>0?e:null}let t=o.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function er(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(r=>r.trim()).filter(r=>r.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*ay(o){if(o!=null){if(Array.isArray(o)){for(let t of o){let e=t.trim();e&&(yield e)}return}if(!o.includes(",")){let t=o.trim();t&&(yield t);return}for(let t of o.split(",")){let e=t.trim();e&&(yield e)}}}function cy(o){let[t,e,...r]=o.trim().split(/\s+/);if(!t||!e||r.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function ly(o,t){return`${o} ${t}`}function dy(o){let[t,e,...r]=o.trim().split(/\s+/),i=Number(t),n=Number(e);if(!Number.isFinite(i)||!Number.isFinite(n)||r.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:i,y:n}}function hy(o,t){return`${o} ${t}`}function Xt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=Vi(r);return i===null?t:i},toAttribute:r=>e(r)?null:er(r)}}var ce=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),ji=o=>{let t={},e={};for(let r of o){let i=r.getAttribute("field-identifier");if(!i)continue;t[i]=r.textContent?.trim()??"";let n=r.getAttribute("base-type");n&&(e[i]=n)}return{value:t,baseTypes:e}},Yl=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,Gn=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(Yl.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(r=>Yl.test(r))?"point":"string"};var Kl=class extends S{},Mr=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Pr=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var Lu=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},Ua=o=>t=>{let e=Lu(t);return e===null?null:o(e)},Vu=["depcp","questify","qade"],ju={Trim:Ua(o=>o.trim()),ToAscii:Ua(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:Ua(o=>o.replace(",","."))},Fu=new Map(Vu.flatMap(o=>Object.entries(ju).map(([t,e])=>[`${o}:${t}`,e]))),Ha=new Map,gy=(o,t)=>{Ha.set(o,t)},by=o=>{Ha.delete(o)},Zl=o=>Ha.get(o)??Fu.get(o)??null;var td={true:!0,1:!0,false:!1,0:!1},Y=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,n]=t.split(" ").map(Number),[s,...a]=e.split(","),c=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[l,d,h]=c;return c.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-l)**2+(n-d)**2)<=h}case"rect":{let[l,d,h,f]=c;return c.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=l&&i<=h&&n>=d&&n<=f}case"ellipse":{let[l,d,h,f]=c;if(c.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-l)**2/h**2,y=(n-d)**2/f**2;return m+y<=1}case"poly":{if(c.length<6||c.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let l=[];for(let d=0;d<c.length;d+=2)l.push({x:c[d],y:c[d+1]});return this.isPointInPolygon({x:i,y:n},l)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let s=e[i].x,a=e[i].y,c=e[n].x,l=e[n].y;a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"boolean":{let i=td[t.trim().toLowerCase()];return i!==void 0&&i===td[e.trim().toLowerCase()]}case"integer":{let i=parseInt(t,10),n=parseInt(e,10);if(!isNaN(i)&&!isNaN(n)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:i===n}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),n=parseFloat(e);if(!isNaN(i)&&!isNaN(n))return i===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" "),n=e.split(" ");if(i.length===2&&n.length===2)return r==="pair"&&(i.sort(),n.sort()),i.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Ce=Symbol("testHost");var rd={"qc-item-rendered":{kind:"notification",scope:"item",deprecated:"cito-item-rendered"},"qc-item-response-changed":{kind:"notification",scope:"item",deprecated:"cito-item-response-changed"},"qc-item-set-outcomes":{kind:"request",scope:"item",deprecated:"cito-item-set-outcomes"},"qc-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcome-changed"},"qc-item-outcomes-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcomes-changed"},"qc-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"cito-item-rubric-placement"},"qc-feedback-show":{kind:"notification",scope:"item",deprecated:"cito-feedback-show"},"qc-feedback-hide":{kind:"notification",scope:"item",deprecated:"cito-feedback-hide"}};function Wa(o,t,e,r,i=!1){let n={detail:r??{},bubbles:!0,composed:!0,cancelable:i},s=o.dispatchEvent(new CustomEvent(e,n)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,n))&&s:s}var ed=new Set;function Qa(o,t,e,r){let i;o.addEventListener(e,s=>{i=s.detail,queueMicrotask(()=>i=void 0),r(s)});let{deprecated:n}=t[e];n&&o.addEventListener(n,s=>{i!==void 0&&s.detail===i||(ed.has(n)||(ed.add(n),console.warn(`[qti-components] The event "${n}" is deprecated; dispatch "${e}" instead.`)),r(s))})}function xt(o,t,e,r=!1){return Wa(o,rd,t,e,r)}function id(o,t,e){Qa(o,rd,t,e)}var nd={"qc-test-navigate":{kind:"request",scope:"test",deprecated:"cito-test-navigate"},"qc-test-end-attempt":{kind:"request",scope:"test",deprecated:"cito-test-end-attempt"},"qc-test-submit":{kind:"request",scope:"test",deprecated:"cito-test-submit"},"qc-test-update-outcome":{kind:"request",scope:"test",deprecated:"cito-test-update-outcome"},"qc-test-update-plugin-state":{kind:"request",scope:"test",deprecated:"cito-test-update-plugin-state"},"qc-test-switch-view":{kind:"request",scope:"test",deprecated:"cito-test-switch-view"},"qc-test-submitted":{kind:"notification",scope:"test",deprecated:"cito-test-submitted"},"qc-test-navigated":{kind:"notification",scope:"test",deprecated:"cito-test-navigated"},"qc-test-navigation-started":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-started"},"qc-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-failed"},"qc-test-rendered":{kind:"notification",scope:"test",deprecated:"cito-test-rendered"},"qc-test-loaded":{kind:"notification",scope:"test",deprecated:"cito-test-loaded"},"qc-test-state-changed":{kind:"notification",scope:"test",deprecated:"cito-test-state-changed"},"qc-test-items-skipped":{kind:"notification",scope:"test",deprecated:"cito-test-items-skipped"},"qc-test-end-reached":{kind:"notification",scope:"test",deprecated:"cito-test-end-reached"},"qc-item-ref-connected":{kind:"notification",scope:"item",deprecated:"cito-item-ref-connected"}};function F(o,t,e){Wa(o,nd,t,e)}function B(o,t,e){Qa(o,nd,t,e)}var ke=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},od={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},wt=class extends S{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let r=e.getAttribute("identifier");if(!r)continue;let i=Number(e.getAttribute("value"));if(Number.isNaN(i)){console.warn(`qti-weight "${r}" has a non-numeric value, ignoring it`);continue}t.set(r,i)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?Ul(t):null,this.requestUpdate(),await this.updateComplete,F(this,"qc-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let r=e.items.find(i=>i.identifier===this.identifier);if(r)return r}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};ke([p({type:String})],wt.prototype,"category",void 0);ke([p({type:String})],wt.prototype,"identifier",void 0);ke([p({type:Boolean,converter:od})],wt.prototype,"required",void 0);ke([p({type:Boolean,converter:od})],wt.prototype,"fixed",void 0);ke([p({type:String})],wt.prototype,"href",void 0);ke([T(),R({context:ct,subscribe:!0})],wt.prototype,"computedContext",void 0);ke([p({type:Object,attribute:!1})],wt.prototype,"xmlDoc",void 0);ke([R({context:Ce,subscribe:!0})],wt.prototype,"testHost",void 0);var Se=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Xa={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ct=class extends S{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return v`<slot name="qti-rubric-block"></slot><slot></slot>`}};Se([p({type:String})],Ct.prototype,"identifier",void 0);Se([p({type:String})],Ct.prototype,"required",void 0);Se([p({type:Boolean,converter:Xa})],Ct.prototype,"fixed",void 0);Se([p({type:Boolean,converter:Xa})],Ct.prototype,"visible",void 0);Se([p({type:Boolean,converter:Xa,attribute:"keep-together"})],Ct.prototype,"keepTogether",void 0);Se([p({type:String,attribute:"navigation-mode"})],Ct.prototype,"navigationMode",void 0);Se([p({type:String,attribute:"submission-mode"})],Ct.prototype,"submissionMode",void 0);Se([R({context:nt,subscribe:!0})],Ct.prototype,"_testContext",void 0);var Ga=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},rr=class extends S{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,F(this,"qc-test-loaded",this)}render(){return v` <slot></slot>`}};Ga([p({type:String})],rr.prototype,"identifier",void 0);Ga([p({type:String})],rr.prototype,"title",null);Ga([R({context:nt,subscribe:!0})],rr.prototype,"_testContext",void 0);function Jn(o,t){let e=o.firstElementChild;if(!e||typeof e.calculate!="function")return console.warn(`<${o.localName}> has no evaluable expression child`,o),t;try{let r=e.calculate();return r===!0||r==="true"}catch(r){return console.warn(`<${o.localName}> could not evaluate its expression`,r),t}}var zu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},le=class extends S{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=w`
|
|
63
|
+
`}render(){return v`<slot></slot>`}shouldUpdate(){return!this.hasUpdated}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get resultBaseType(){}resolveVariable(t){return this.context?.variables.find(e=>e.identifier===t)??this._testContext?.testOutcomeVariables?.find(e=>e.identifier===t)??this.resolveItemVariable(t)}resolveItemVariable(t){if(!t?.includes("."))return null;let e=t.split(".");return this._testContext?.items?.find(i=>i.identifier===e[0])?.variables?.find(i=>i.identifier===e[e.length-1])??null}};Wa([R({context:j,subscribe:!0})],E.prototype,"context",void 0);Wa([R({context:qt,subscribe:!0})],E.prototype,"qtiContext",void 0);Wa([R({context:nt,subscribe:!0})],E.prototype,"_testContext",void 0);var Qt=class extends E{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var ry=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Mt=o=>typeof o=="string"?o:o.toString();function Qa(o){return o==null}function Yn(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Li=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pt=class extends S{constructor(){super(...arguments),this.showHide="show",this.#t=new at(this,{context:j,subscribe:!0,callback:t=>this.#r(t)}),this.#i=!1}#t;get _context(){return this.#t.value}#e;#r(t){let e=t?.variables;if(!e||!this.outcomeIdentifier)return;let r=JSON.stringify(e.find(s=>s.identifier===this.outcomeIdentifier)?.value??null),i=Number(e.find(s=>s.identifier==="numAttempts")?.value)||0,n=this.#e===void 0?i>0:this.#e!==r||i>0;this.#e=r,n&&this.checkShowFeedback(this.outcomeIdentifier)}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!Qa(this.identifier)&&!Qa(e?.value)&&this.identifier===e.value||!1,this.#n(r)}#i;#n(t){let e=this.#s()&&this.#o(t)?"on":"off";if(e==="on"){if(this.showStatus==="on"||this.#i)return;if(!this.feedbackShowing()){this.#i=!0,this.showStatus="off";return}}else if(this.#i=!1,this.showStatus==="on"&&!this.feedbackHiding())return;this.showStatus=e}#o(t){return t&&this.showHide==="show"||!t&&this.showHide==="hide"}feedbackShowing(){return!0}feedbackHiding(){return!0}#s(){if(!this._computedContext)return!0;let t=this._computedContext.testParts?.find(i=>i.active)?.sections.flatMap(i=>i.items).find(i=>i.active);if(!t||t.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}};Li([p({type:String,attribute:"show-hide"})],pt.prototype,"showHide",void 0);Li([p({type:String,attribute:"outcome-identifier"})],pt.prototype,"outcomeIdentifier",void 0);Li([p({type:String})],pt.prototype,"identifier",void 0);Li([p({type:String,attribute:!1})],pt.prototype,"showStatus",void 0);Li([R({context:ct,subscribe:!0}),T()],pt.prototype,"_computedContext",void 0);function Vi(o){if(o==null)return null;if(!o.includes(",")){let e=o.trim();return e.length>0?e:null}let t=o.split(",").map(e=>e.trim()).filter(e=>e.length>0);return t.length===0?null:t.length===1?t[0]:t}function er(o){if(o==null)return null;if(Array.isArray(o)){let e=o.map(r=>r.trim()).filter(r=>r.length>0);return e.length>0?e.join(","):null}let t=o.trim();return t.length>0?t:null}function*hy(o){if(o!=null){if(Array.isArray(o)){for(let t of o){let e=t.trim();e&&(yield e)}return}if(!o.includes(",")){let t=o.trim();t&&(yield t);return}for(let t of o.split(",")){let e=t.trim();e&&(yield e)}}}function py(o){let[t,e,...r]=o.trim().split(/\s+/);if(!t||!e||r.length>0)throw new Error(`malformed directed-pair value: "${o}" (expected "source target")`);return{source:t,target:e}}function uy(o,t){return`${o} ${t}`}function my(o){let[t,e,...r]=o.trim().split(/\s+/),i=Number(t),n=Number(e);if(!Number.isFinite(i)||!Number.isFinite(n)||r.length>0)throw new Error(`malformed point value: "${o}" (expected "x y" numeric coords)`);return{x:i,y:n}}function fy(o,t){return`${o} ${t}`}function Xt(o){let{emptyAs:t}=o,e=r=>r===t||r==null||r===""||Array.isArray(r)&&r.length===0;return{fromAttribute:r=>{let i=Vi(r);return i===null?t:i},toAttribute:r=>e(r)?null:er(r)}}var ce=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),ji=o=>{let t={},e={};for(let r of o){let i=r.getAttribute("field-identifier");if(!i)continue;t[i]=r.textContent?.trim()??"";let n=r.getAttribute("base-type");n&&(e[i]=n)}return{value:t,baseTypes:e}},ed=/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/,Kn=o=>{if(typeof o=="number")return Number.isInteger(o)?"integer":"float";if(typeof o=="boolean")return"boolean";if(typeof o!="string")return"string";let t=o.trim();if(ed.test(t))return"float";let e=t.split(/\s+/);return e.length===2&&e.every(r=>ed.test(r))?"point":"string"};var rd=class extends S{},Mr=class extends Error{constructor(){super("qti-exit-response"),this.name="QtiExitResponseSignal"}},Pr=class extends Error{constructor(){super("qti-exit-test"),this.name="QtiExitTestSignal"}};var zu=o=>{let t=o[0];return t==null?null:Array.isArray(t)?t[0]??null:String(t)},Xa=o=>t=>{let e=zu(t);return e===null?null:o(e)},Bu=["depcp","questify","qade"],Uu={Trim:Xa(o=>o.trim()),ToAscii:Xa(o=>o.normalize("NFD").replace(/[̀-ͯ]/g,"")),ParseCommaDecimal:Xa(o=>o.replace(",","."))},Hu=new Map(Bu.flatMap(o=>Object.entries(Uu).map(([t,e])=>[`${o}:${t}`,e]))),Ga=new Map,qy=(o,t)=>{Ga.set(o,t)},xy=o=>{Ga.delete(o)},id=o=>Ga.get(o)??Hu.get(o)??null;var nd={true:!0,1:!0,false:!1,0:!1},Y=class{static isPointInArea(t,e,r){if(r!=="point")return console.warn(`Base type ${r} is not supported for point area mapping.`),!1;let[i,n]=t.split(" ").map(Number),[s,...a]=e.split(","),c=a.map(Number);switch(s.toLowerCase()){case"default":return!0;case"circle":{let[l,d,h]=c;return c.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-l)**2+(n-d)**2)<=h}case"rect":{let[l,d,h,f]=c;return c.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=l&&i<=h&&n>=d&&n<=f}case"ellipse":{let[l,d,h,f]=c;if(c.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let m=(i-l)**2/h**2,y=(n-d)**2/f**2;return m+y<=1}case"poly":{if(c.length<6||c.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let l=[];for(let d=0;d<c.length;d+=2)l.push({x:c[d],y:c[d+1]});return this.isPointInPolygon({x:i,y:n},l)}default:return console.warn(`Unsupported shape type: ${s}`),!1}}static isPointInPolygon(t,e){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let s=e[i].x,a=e[i].y,c=e[n].x,l=e[n].y;a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a)+s&&(r=!r)}return r}static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"boolean":{let i=nd[t.trim().toLowerCase()];return i!==void 0&&i===nd[e.trim().toLowerCase()]}case"integer":{let i=parseInt(t,10),n=parseInt(e,10);if(!isNaN(i)&&!isNaN(n)){let s=parseFloat(t),a=parseFloat(e);return!Number.isInteger(s)||!Number.isInteger(a)?s===a:i===n}else console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),n=parseFloat(e);if(!isNaN(i)&&!isNaN(n))return i===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" "),n=e.split(" ");if(i.length===2&&n.length===2)return r==="pair"&&(i.sort(),n.sort()),i.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Ce=Symbol("testHost");var sd={"qc-item-rendered":{kind:"notification",scope:"item",deprecated:"cito-item-rendered"},"qc-item-response-changed":{kind:"notification",scope:"item",deprecated:"cito-item-response-changed"},"qc-item-set-outcomes":{kind:"request",scope:"item",deprecated:"cito-item-set-outcomes"},"qc-item-outcome-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcome-changed"},"qc-item-outcomes-changed":{kind:"notification",scope:"item",deprecated:"cito-item-outcomes-changed"},"qc-item-rubric-placement":{kind:"notification",scope:"item",deprecated:"cito-item-rubric-placement"},"qc-feedback-show":{kind:"notification",scope:"item",deprecated:"cito-feedback-show"},"qc-feedback-hide":{kind:"notification",scope:"item",deprecated:"cito-feedback-hide"}};function Ja(o,t,e,r,i=!1){let n={detail:r??{},bubbles:!0,composed:!0,cancelable:i},s=o.dispatchEvent(new CustomEvent(e,n)),{deprecated:a}=t[e];return a?o.dispatchEvent(new CustomEvent(a,n))&&s:s}var od=new Set;function Ya(o,t,e,r){let i;o.addEventListener(e,s=>{i=s.detail,queueMicrotask(()=>i=void 0),r(s)});let{deprecated:n}=t[e];n&&o.addEventListener(n,s=>{i!==void 0&&s.detail===i||(od.has(n)||(od.add(n),console.warn(`[qti-components] The event "${n}" is deprecated; dispatch "${e}" instead.`)),r(s))})}function xt(o,t,e,r=!1){return Ja(o,sd,t,e,r)}function ad(o,t,e){Ya(o,sd,t,e)}var cd={"qc-test-navigate":{kind:"request",scope:"test",deprecated:"cito-test-navigate"},"qc-test-end-attempt":{kind:"request",scope:"test",deprecated:"cito-test-end-attempt"},"qc-test-submit":{kind:"request",scope:"test",deprecated:"cito-test-submit"},"qc-test-update-outcome":{kind:"request",scope:"test",deprecated:"cito-test-update-outcome"},"qc-test-update-plugin-state":{kind:"request",scope:"test",deprecated:"cito-test-update-plugin-state"},"qc-test-switch-view":{kind:"request",scope:"test",deprecated:"cito-test-switch-view"},"qc-test-submitted":{kind:"notification",scope:"test",deprecated:"cito-test-submitted"},"qc-test-navigated":{kind:"notification",scope:"test",deprecated:"cito-test-navigated"},"qc-test-navigation-started":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-started"},"qc-test-navigation-failed":{kind:"notification",scope:"test",deprecated:"cito-test-navigation-failed"},"qc-test-rendered":{kind:"notification",scope:"test",deprecated:"cito-test-rendered"},"qc-test-loaded":{kind:"notification",scope:"test",deprecated:"cito-test-loaded"},"qc-test-state-changed":{kind:"notification",scope:"test",deprecated:"cito-test-state-changed"},"qc-test-items-skipped":{kind:"notification",scope:"test",deprecated:"cito-test-items-skipped"},"qc-test-end-reached":{kind:"notification",scope:"test",deprecated:"cito-test-end-reached"},"qc-item-ref-connected":{kind:"notification",scope:"item",deprecated:"cito-item-ref-connected"}};function F(o,t,e){Ja(o,cd,t,e)}function B(o,t,e){Ya(o,cd,t,e)}var ke=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ld={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},wt=class extends S{constructor(){super(...arguments),this.xmlDoc=null,this.myTemplate=null,this.#e=null}get weights(){let t=new Map;for(let e of this.querySelectorAll(":scope > qti-weight")){let r=e.getAttribute("identifier");if(!r)continue;let i=Number(e.getAttribute("value"));if(Number.isNaN(i)){console.warn(`qti-weight "${r}" has a non-numeric value, ignoring it`);continue}t.set(r,i)}return t}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}disconnectedCallback(){super.disconnectedCallback(),this.testHost=void 0}async connectedCallback(){super.connectedCallback();let t=this.testHost?.querySelector("template[item-ref]");this.myTemplate=t?Xl(t):null,this.requestUpdate(),await this.updateComplete,F(this,"qc-item-ref-connected",{identifier:this.identifier,href:this.href,category:this.category})}#t(){for(let t of this.computedContext?.testParts??[])for(let e of t.sections){let r=e.items.find(i=>i.identifier===this.identifier);if(r)return r}}#e;render(){if(!this.xmlDoc)return this.#e=null,P;(this.#e?.source!==this.xmlDoc||this.#e.template!==this.myTemplate)&&(this.#e={source:this.xmlDoc,template:this.myTemplate,doc:this.xmlDoc.cloneNode(!0)});let t=this.#e.doc;if(!this.myTemplate)return t;let e={xmlDoc:t,identifier:this.identifier,href:this.href,category:this.category,item:this.#t(),itemRef:this};return this.myTemplate(e)}};ke([p({type:String})],wt.prototype,"category",void 0);ke([p({type:String})],wt.prototype,"identifier",void 0);ke([p({type:Boolean,converter:ld})],wt.prototype,"required",void 0);ke([p({type:Boolean,converter:ld})],wt.prototype,"fixed",void 0);ke([p({type:String})],wt.prototype,"href",void 0);ke([T(),R({context:ct,subscribe:!0})],wt.prototype,"computedContext",void 0);ke([p({type:Object,attribute:!1})],wt.prototype,"xmlDoc",void 0);ke([R({context:Ce,subscribe:!0})],wt.prototype,"testHost",void 0);var Se=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ka={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Ct=class extends S{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){this.#t=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return v`<slot name="qti-rubric-block"></slot><slot></slot>`}};Se([p({type:String})],Ct.prototype,"identifier",void 0);Se([p({type:String})],Ct.prototype,"required",void 0);Se([p({type:Boolean,converter:Ka})],Ct.prototype,"fixed",void 0);Se([p({type:Boolean,converter:Ka})],Ct.prototype,"visible",void 0);Se([p({type:Boolean,converter:Ka,attribute:"keep-together"})],Ct.prototype,"keepTogether",void 0);Se([p({type:String,attribute:"navigation-mode"})],Ct.prototype,"navigationMode",void 0);Se([p({type:String,attribute:"submission-mode"})],Ct.prototype,"submissionMode",void 0);Se([R({context:nt,subscribe:!0})],Ct.prototype,"_testContext",void 0);var Za=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},rr=class extends S{get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t="";async connectedCallback(){super.connectedCallback(),await this.updateComplete,F(this,"qc-test-loaded",this)}render(){return v` <slot></slot>`}};Za([p({type:String})],rr.prototype,"identifier",void 0);Za([p({type:String})],rr.prototype,"title",null);Za([R({context:nt,subscribe:!0})],rr.prototype,"_testContext",void 0);function Zn(o,t){let e=o.firstElementChild;if(!e||typeof e.calculate!="function")return console.warn(`<${o.localName}> has no evaluable expression child`,o),t;try{let r=e.calculate();return r===!0||r==="true"}catch(r){return console.warn(`<${o.localName}> could not evaluate its expression`,r),t}}var Wu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},le=class extends S{constructor(){super(...arguments),this.target=""}static{this.EXIT_SECTION="EXIT_SECTION"}static{this.EXIT_TESTPART="EXIT_TESTPART"}static{this.EXIT_TEST="EXIT_TEST"}static{this.styles=w`
|
|
64
64
|
:host {
|
|
65
65
|
display: none;
|
|
66
66
|
}
|
|
67
|
-
`}evaluate(){return
|
|
67
|
+
`}evaluate(){return Zn(this,!1)}render(){return v`<slot></slot>`}};Wu([p({type:String})],le.prototype,"target",void 0);var ir=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Or={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Pt=class extends S{constructor(){super(...arguments),this.maxAttempts=1,this.showFeedback=!1,this.allowReview=!0,this.showSolution=!1,this.allowComment=!1,this.allowSkipping=!0,this.validateResponses=!1}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-session-control-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return v`<slot></slot>`}};ir([p({type:Number,attribute:"max-attempts"})],Pt.prototype,"maxAttempts",void 0);ir([p({type:Boolean,converter:Or,attribute:"show-feedback"})],Pt.prototype,"showFeedback",void 0);ir([p({type:Boolean,converter:Or,attribute:"allow-review"})],Pt.prototype,"allowReview",void 0);ir([p({type:Boolean,converter:Or,attribute:"show-solution"})],Pt.prototype,"showSolution",void 0);ir([p({type:Boolean,converter:Or,attribute:"allow-comment"})],Pt.prototype,"allowComment",void 0);ir([p({type:Boolean,converter:Or,attribute:"allow-skipping"})],Pt.prototype,"allowSkipping",void 0);ir([p({type:Boolean,converter:Or,attribute:"validate-responses"})],Pt.prototype,"validateResponses",void 0);var tc=o=>o?.split(/\s+/).filter(Boolean)??[],Dr=o=>({sectionIdentifier:o.getAttribute("section-identifier"),includeCategories:tc(o.getAttribute("include-category")),excludeCategories:tc(o.getAttribute("exclude-category"))}),$r=(o,{sectionIdentifier:t,includeCategories:e,excludeCategories:r})=>{let i=t?Array.from(o.querySelectorAll(`qti-assessment-section[identifier="${CSS.escape(t)}"]`)):[o];return i.length===0?(console.warn(`no qti-assessment-section with identifier "${t}"`),[]):i.flatMap(n=>Array.from(n.querySelectorAll("qti-assessment-item-ref"))).filter(n=>{let s=tc(n.category);return!(e.length>0&&!s.some(a=>e.includes(a))||r.length>0&&s.some(a=>r.includes(a)))})};var Qu=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Fi=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-number-presented: no enclosing qti-assessment-test, nothing to count"),0;let e=new Set((this._testContext?.items??[]).filter(r=>{let i=r.variables?.find(n=>n.identifier==="completionStatus")?.value;return i!=null&&i!=="not_attempted"}).map(r=>r.identifier));return $r(t,Dr(this)).filter(r=>e.has(r.identifier)).length}calculate(){return this.getResult()}};Qu([R({context:nt,subscribe:!0})],Fi.prototype,"_testContext",void 0);var to=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;return t?$r(t,Dr(this)).length:(console.warn("qti-number-selected: no enclosing qti-assessment-test, nothing to count"),0)}calculate(){return this.getResult()}};var eo=class extends S{static{this.styles=w`
|
|
68
68
|
:host {
|
|
69
69
|
display: none;
|
|
70
70
|
}
|
|
71
|
-
`}evaluate(){return
|
|
71
|
+
`}evaluate(){return Zn(this,!0)}render(){return v`<slot></slot>`}};var ro=class extends S{static{this.styles=[w`
|
|
72
72
|
:host {
|
|
73
73
|
display: none;
|
|
74
74
|
}
|
|
75
|
-
`]}render(){return v`<slot></slot>`}process(){let t=new Ya,e=[...this.children];t.process(e)}},Ya=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Pr))throw e}}};var nr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ut=class extends S{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:Xl},this.#r={...this._context,variables:this._context.variables},this.#i=new Map,this.#n=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,r=e.type==="template"?this.#i.get(e.identifier):void 0,i=r!==void 0?{...e,value:r}:e;this._context={...this._context,variables:[...this._context.variables,i]},this.#r=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.#b(r,!0,e)},this.#l=t=>{t.stopImmediatePropagation();let{outcomes:e=[],responseProcessed:r=!1}=t.detail??{},i=[];r&&this.adaptive==="false"&&(e.find(s=>s.identifier==="completionStatus")?.value??this.getVariable("completionStatus")?.value)==="unknown"&&i.push({identifier:"completionStatus",value:"completed"}),this.#y([...e,...i],this.#q(!1)),r&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),r=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||r)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...r?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(n=>!("identifier"in n))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,r=t.filter(n=>n.value!==null&&n.value!==void 0&&(n.type==="template"||e.some(s=>s.identifier===n.identifier&&s.type==="template")));r.forEach(n=>this.#i.set(n.identifier,n.value));let i=r.some(n=>JSON.stringify(e.find(s=>s.identifier===n.identifier)?.value)!==JSON.stringify(n.value));this._context={...this._context,variables:this._context.variables.map(n=>{let s=t.find(a=>a.identifier===n.identifier);return s?{...n,...s,interpolationTable:n.interpolationTable,matchTable:n.matchTable}:n})},this.#n&&i&&this.#m(),this.updateComplete.then(()=>this.#C()),this.isConnected&&this.#v()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#i;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(n=>n.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#v(),xt(this,"qc-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#g()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#p),this.addEventListener("qc-item-set-outcomes",this.#l),this.addEventListener("qti-set-template-value",this.#d),this.addEventListener("qti-set-correct-response",this.#h),this.addEventListener("qti-interaction-response",this.#u)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qc-item-set-outcomes",this.#l),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#h),this.removeEventListener("qti-interaction-response",this.#u)}#a;#c;#p;#l;#d;#h;#u;async#g(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#m()}#m(){this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#b(t,e)}#b(t,e,r){this.#q(e),this.#f(r);let i=+this.getVariable("numAttempts")?.value+(t?1:0),n=this.querySelector("qti-response-processing");if(typeof n?.processResponse=="function"){try{n.processResponse({numAttempts:i})}catch(s){throw this.#y([{identifier:"numAttempts",value:String(i)}]),s}return!0}return xt(this,"qc-item-set-outcomes",{outcomes:[{identifier:"numAttempts",value:String(i)}],responseProcessed:!0}),!1}#f(t){let e=Array.from(this.querySelectorAll("qti-end-attempt-interaction"),r=>r.getAttribute("response-identifier")).filter(r=>r&&r!==t);e.length!==0&&(this._context={...this._context,variables:this._context.variables.map(r=>e.includes(r.identifier)?{...r,value:"false"}:r)})}resetResponses(){this._context=this.#r,this.isConnected&&this.#v()}#v(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),xt(this,"qc-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let r=this._context.variables.find(n=>n.identifier===t&&n.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){this.#y([{identifier:t,value:e}])}#y(t,e){let r=new Map;for(let{identifier:n,value:s}of t){let a=this.getVariable(n);if(!a){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);continue}r.set(n,a.cardinality==="single"||Array.isArray(s)?s:[s])}let i=e!==void 0&&e!==this._context.valid;if(!(r.size===0&&!i)&&(this._context={...this._context,...i?{valid:e}:{},variables:this._context.variables.map(n=>r.has(n.identifier)?{...n,value:r.get(n.identifier)}:n)},r.size>0)){for(let[n,s]of r)xt(this,"qc-item-outcome-changed",{item:this.identifier,outcomeIdentifier:n,value:s});xt(this,"qc-item-outcomes-changed",{item:this.identifier,outcomes:[...r].map(([n,s])=>({identifier:n,value:s}))})}}validate(t=!0){let e=this.#q(t);return this.#x(e),e}#q(t){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}#x(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#C(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}};nr([p({type:String})],ut.prototype,"identifier",void 0);nr([p({type:String})],ut.prototype,"adaptive",void 0);nr([p({type:String,attribute:"time-dependent"})],ut.prototype,"timeDependent",void 0);nr([p({type:String})],ut.prototype,"title",null);nr([p({type:Boolean})],ut.prototype,"disabled",void 0);nr([p({type:Boolean})],ut.prototype,"readonly",void 0);nr([J({context:j})],ut.prototype,"_context",void 0);var sd=w`
|
|
75
|
+
`]}render(){return v`<slot></slot>`}process(){let t=new ec,e=[...this.children];t.process(e)}},ec=class{process(t){try{for(let e of t)e.process()}catch(e){if(!(e instanceof Pr))throw e}}};var nr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ut=class extends S{constructor(){super(...arguments),this.#e=null,this.identifier="",this.adaptive="false",this.timeDependent=null,this._context={variables:Kl},this.#r={...this._context,variables:this._context.variables},this.#i=new Map,this.#n=!1,this.interactionElements=[],this.#a=t=>{t.stopImmediatePropagation();let{variable:e}=t.detail,r=e.type==="template"?this.#i.get(e.identifier):void 0,i=r!==void 0?{...e,value:r}:e;this._context={...this._context,variables:[...this._context.variables,i]},this.#r=this._context,t.stopPropagation()},this.#c=t=>{t.stopImmediatePropagation(),this.interactionElements.push(t.detail.interactionElement)},this.#p=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,countAttempt:r}=t.detail;this.validate(),this.updateResponseVariable(e,"true"),this.#b(r,!0,e)},this.#l=t=>{t.stopImmediatePropagation();let{outcomes:e=[],responseProcessed:r=!1}=t.detail??{},i=[];r&&this.adaptive==="false"&&(e.find(s=>s.identifier==="completionStatus")?.value??this.getVariable("completionStatus")?.value)==="unknown"&&i.push({identifier:"completionStatus",value:"completed"}),this.#y([...e,...i],this.#q(!1)),r&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context,responseProcessed:!0}}))},this.#d=t=>{t.stopImmediatePropagation();let{templateIdentifier:e,value:r}=t.detail;this.#i.has(e)||this.updateTemplateVariable(e,r??void 0),t.stopPropagation()},this.#h=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,value:r}=t.detail;this.updateCorrectResponse(e,r??void 0),t.stopPropagation()},this.#u=t=>{t.stopImmediatePropagation();let{responseIdentifier:e,response:r,state:i}=t.detail;this.updateResponseVariable(e,r),i!==void 0&&(this._context={...this._context,state:{...this._context.state||{},[e]:i}}),this.validate(!1),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}#t;#e;get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}willUpdate(t){super.willUpdate(t);let e=t.has("readonly")&&(this.readonly??!1)!==(this._context.readonly??!1),r=t.has("disabled")&&(this.disabled??!1)!==(this._context.disabled??!1);(e||r)&&(this._context={...this._context,...e?{readonly:!!this.readonly}:{},...r?{disabled:!!this.disabled}:{}})}set assessmentItemRefId(t){this._context={...this._context,identifier:t}}get assessmentItemRefId(){return this._context.identifier}get itemContext(){return this._context}get variables(){return this._context.variables.map(t=>({identifier:t.identifier,value:t.value,type:t.type,...t.type==="outcome"&&t.identifier==="SCORE"?{externalScored:t.externalScored}:{}}))}set variables(t){if(!Array.isArray(t)||t.some(n=>!("identifier"in n))){console.warn("variables property should be an array of VariableDeclaration");return}let e=this._context.variables,r=t.filter(n=>n.value!==null&&n.value!==void 0&&(n.type==="template"||e.some(s=>s.identifier===n.identifier&&s.type==="template")));r.forEach(n=>this.#i.set(n.identifier,n.value));let i=r.some(n=>JSON.stringify(e.find(s=>s.identifier===n.identifier)?.value)!==JSON.stringify(n.value));this._context={...this._context,variables:this._context.variables.map(n=>{let s=t.find(a=>a.identifier===n.identifier);return s?{...n,...s,interpolationTable:n.interpolationTable,matchTable:n.matchTable}:n})},this.#n&&i&&this.#m(),this.updateComplete.then(()=>this.#C()),this.isConnected&&this.#v()}get state(){return this._context.state}set state(t){this._context={...this._context,state:t?{...t}:void 0}}#r;#i;#n;set responses(t){if(t)for(let e of t){this.getResponse(e.responseIdentifier)&&this.updateResponseVariable(e.responseIdentifier,e.response);let i=this.interactionElements.find(n=>n.getAttribute("response-identifier")===e.responseIdentifier);i&&(i.response=e.response)}}render(){return v`<slot></slot>`}connectedCallback(){this.#o(),super.connectedCallback(),this.updateComplete.then(()=>{this.validate(!1),this.#v(),xt(this,"qc-item-rendered",this),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this})),this.#g()})}disconnectedCallback(){this.#s(),super.disconnectedCallback()}#o(){this.addEventListener("qti-register-variable",this.#a),this.addEventListener("qti-register-interaction",this.#c),this.addEventListener("end-attempt",this.#p),this.addEventListener("qc-item-set-outcomes",this.#l),this.addEventListener("qti-set-template-value",this.#d),this.addEventListener("qti-set-correct-response",this.#h),this.addEventListener("qti-interaction-response",this.#u)}#s(){this.removeEventListener("qti-register-variable",this.#a),this.removeEventListener("qti-register-interaction",this.#c),this.removeEventListener("end-attempt",this.#p),this.removeEventListener("qc-item-set-outcomes",this.#l),this.removeEventListener("qti-set-template-value",this.#d),this.removeEventListener("qti-set-correct-response",this.#h),this.removeEventListener("qti-interaction-response",this.#u)}#a;#c;#p;#l;#d;#h;#u;async#g(){let t=Array.from(this.querySelectorAll("qti-template-declaration"));t.length>0&&(await Promise.all(t.map(e=>e.updateComplete)),await Promise.resolve()),this.#e=this.querySelector("qti-template-processing"),this.#n=!0,this.#m()}#m(){this.#e&&(this.#e.process(),this.#r={...this._context,variables:this._context.variables})}processResponse(t=!0,e=!0){return this.#b(t,e)}#b(t,e,r){this.#q(e),this.#f(r);let i=+this.getVariable("numAttempts")?.value+(t?1:0),n=this.querySelector("qti-response-processing");if(typeof n?.processResponse=="function"){try{n.processResponse({numAttempts:i})}catch(s){throw this.#y([{identifier:"numAttempts",value:String(i)}]),s}return!0}return xt(this,"qc-item-set-outcomes",{outcomes:[{identifier:"numAttempts",value:String(i)}],responseProcessed:!0}),!1}#f(t){let e=Array.from(this.querySelectorAll("qti-end-attempt-interaction"),r=>r.getAttribute("response-identifier")).filter(r=>r&&r!==t);e.length!==0&&(this._context={...this._context,variables:this._context.variables.map(r=>e.includes(r.identifier)?{...r,value:"false"}:r)})}resetResponses(){this._context=this.#r,this.isConnected&&this.#v()}#v(){this.getVariable("completionStatus")?.value==="not_attempted"&&(this._context={...this._context,variables:this._context.variables.map(t=>t.identifier==="completionStatus"?{...t,value:"unknown"}:t)})}getResponse(t){return this.getVariable(t)}getOutcome(t){return this.getVariable(t)}getVariable(t){return this._context.variables.find(e=>e.identifier===t)||null}afterResponseVariableUpdated(){}updateResponseVariable(t,e){this._context={...this._context,variables:this._context.variables.map(r=>r.identifier!==t?r:{...r,value:e})},this.afterResponseVariableUpdated(),xt(this,"qc-item-response-changed",{item:this.identifier,responseIdentifier:t,response:Array.isArray(e)?[...e]:e}),this.validate(!1)}updateTemplateVariable(t,e){let r=this._context.variables.find(n=>n.identifier===t&&n.type==="template");if(!r){console.warn(`Can not set qti-template-identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,value:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateCorrectResponse(t,e){let r=this.getResponse(t);if(!r){console.warn(`Can not set correct response for identifier: ${t}, it is not available`);return}let i=r.cardinality==="single"?Array.isArray(e)?e[0]:e??null:e==null?null:Array.isArray(e)?e:[e];this._context={...this._context,variables:this._context.variables.map(n=>n.identifier!==t?n:{...n,correctResponse:i})},this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}setOutcomeVariable(t,e){this.updateOutcomeVariable(t,e),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(t,e){this.#y([{identifier:t,value:e}])}#y(t,e){let r=new Map;for(let{identifier:n,value:s}of t){let a=this.getVariable(n);if(!a){console.warn(`Can not set qti-outcome-identifier: ${n}, it is not available`);continue}r.set(n,a.cardinality==="single"||Array.isArray(s)?s:[s])}let i=e!==void 0&&e!==this._context.valid;if(!(r.size===0&&!i)&&(this._context={...this._context,...i?{valid:e}:{},variables:this._context.variables.map(n=>r.has(n.identifier)?{...n,value:r.get(n.identifier)}:n)},r.size>0)){for(let[n,s]of r)xt(this,"qc-item-outcome-changed",{item:this.identifier,outcomeIdentifier:n,value:s});xt(this,"qc-item-outcomes-changed",{item:this.identifier,outcomes:[...r].map(([n,s])=>({identifier:n,value:s}))})}}validate(t=!0){let e=this.#q(t);return this.#x(e),e}#q(t){let e=this.interactionElements.every(r=>r.validate());return t&&this.reportValidity(),e}#x(t){this._context.valid!==t&&(this._context={...this._context,valid:t})}#C(){let t=this._context.valid;this.validate(!1),this._context.valid!==t&&this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}reportValidity(){for(let t of this.interactionElements)t.reportValidity()}};nr([p({type:String})],ut.prototype,"identifier",void 0);nr([p({type:String})],ut.prototype,"adaptive",void 0);nr([p({type:String,attribute:"time-dependent"})],ut.prototype,"timeDependent",void 0);nr([p({type:String})],ut.prototype,"title",null);nr([p({type:Boolean})],ut.prototype,"disabled",void 0);nr([p({type:Boolean})],ut.prototype,"readonly",void 0);nr([J({context:j})],ut.prototype,"_context",void 0);var dd=w`
|
|
76
76
|
:host {
|
|
77
77
|
display: contents;
|
|
78
78
|
}
|
|
@@ -80,11 +80,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
80
80
|
::slotted(qti-catalog-info) {
|
|
81
81
|
display: none;
|
|
82
82
|
}
|
|
83
|
-
`;var to=class extends S{static{this.styles=sd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function ad(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function cd(o,t,e,r="qti-portable-custom-interaction"){let i=[],n=o.querySelectorAll(r);if(n.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(n)){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 f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of y){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],b=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",b),a&&a.paths&&a.paths[u]){let q=a.paths[u];Array.isArray(q)?x.setAttribute("fallback-path",q[0]):x.setAttribute("fallback-path",q)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let b=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",b),a&&a.paths&&a.paths[x]){let q=a.paths[x];Array.isArray(q)?g.setAttribute("fallback-path",q[0]):g.setAttribute("fallback-path",q)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await c(),s){l.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),l.appendChild(h)):h=l.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=x.map((b,q)=>{let _=u.length>q?u[q]:"";return{primaryPath:b,fallbackPath:_}});for(let b of u)g.some(q=>q.fallbackPath===b)||g.push({primaryPath:x.length>0?x[0]:b,fallbackPath:b});for(let b of g){let q=o.createElement("qti-interaction-module");b.fallbackPath&&q.setAttribute("fallback-path",b.fallbackPath),q.setAttribute("id",f),q.setAttribute("primary-path",b.primaryPath),h&&h.appendChild(q)}}}}}function ld(o,t,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===t||n.localName?.toLowerCase()===t.toLowerCase()).forEach(n=>{let s=`${t}-${e}`,a=hd(n,s);n.replaceWith(a)})}function dd(o,t){o.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let n=i.slice(`${t}:`.length),s=`${e.nodeName}-${n}`,a=hd(e,s);e.replaceWith(a)}})})}function hd(o,t){let e=o.ownerDocument.createElement(t);for(let r of o.attributes)e.setAttribute(r.name,r.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function pd(o,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let i of e)o.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var Ka=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=Hu(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=Uu(`${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 eo(o){return Ka.fromSeedKey(o)}function Uu(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o.charCodeAt(e),3432918353),t=t<<13|t>>>19;return ud(t)}function Hu(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return ud(t)}function ud(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var Wu=o=>typeof o=="function"?o():o.random();function ro(o,t){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let n=Math.floor(Wu(t)*(i+1));[e[i],e[n]]=[e[n],e[i]]}let r=0;return o.map(i=>i.fixed?i:e[r++])}function Qu(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}function Za(o,t){let e=o.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,n=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let c=a.getAttribute("response-identifier")??`${s}`;s++;let l=Qu(a.tagName.toLowerCase()),d=Array.isArray(l)?l:[l],h=!1,f=0;for(let m of d){if(!m)continue;let y=i?eo(`${t}:${n}:${c}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(q=>q.parentElement!==null);if(x.filter(q=>q.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(q=>q.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=ro(x.map(q=>({element:q,fixed:q.getAttribute("fixed")==="true"})),y);for(let q of x)q.remove();for(let{element:q}of b)u.insertBefore(q,g);h=!0}h&&a.removeAttribute("shuffle")}}function md(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Xu={"qti-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-choice-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-drawing-interaction":{baseTypes:["file"],cardinalities:["single"]},"qti-end-attempt-interaction":{baseTypes:["boolean"],cardinalities:["single"]},"qti-extended-text-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","multiple","ordered","record"]},"qti-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["multiple"]},"qti-graphic-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-hotspot-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-hottext-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-inline-choice-interaction":{baseTypes:["identifier"],cardinalities:["single"]},"qti-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-media-interaction":{baseTypes:["integer"],cardinalities:["single"]},"qti-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-position-object-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-select-point-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:0}},"qti-slider-interaction":{baseTypes:["integer","float"],cardinalities:["single"]},"qti-text-entry-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","record"]},"qti-upload-interaction":{baseTypes:["file"],cardinalities:["single"]}},fd=o=>o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o[o.length-1]}`;function gd(o){let t=new Map(Array.from(o.querySelectorAll("qti-response-declaration"),r=>[r.getAttribute("identifier"),r])),e=[];for(let[r,i]of Object.entries(Xu))for(let n of Array.from(o.querySelectorAll(r))){let s=n.getAttribute("response-identifier"),a=t.get(s);if(!a)continue;let c=`${r} (response "${s}")`,l=a.getAttribute("cardinality"),d=a.getAttribute("base-type");if(l&&!i.cardinalities.includes(l))e.push(`${c}: ${l} cardinality is not permitted; it must be ${fd(i.cardinalities)}`);else if(l&&i.max&&l!=="multiple"){let h=n.getAttribute(i.max.attribute),f=h===null?i.max.default:Number(h);(f===0||f>1)&&e.push(`${c}: ${i.max.attribute} ${f} requires multiple cardinality, not ${l}`)}l!=="record"&&d&&!i.baseTypes.includes(d)&&e.push(`${c}: base-type ${d} is not permitted; it must be ${fd(i.baseTypes)}`)}if(e.length>0)throw new Error(`QTI validation error: ${e.join("; ")}.`)}var bd=!1;function io(o,t){bd||(bd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function Gu(o){return(o.textContent||"").replace(/\s+/g," ").trim().replace(/^This page contains the following errors:\s*/i,"").replace(/\s*Below is a rendering of the page up to the first error\.?\s*$/i,"").trim()||"malformed XML"}function vd(o,t){let r=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),i=r.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??r.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(i)throw new Error(t(Gu(i)));return r}function Nr(o,t){return fetch(o,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>vd(e,r=>`is not well-formed XML: ${r}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Lr(o){return vd(o,t=>`Failed to parse XML: ${t}`)}function yd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let r=o,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):i=t.createElementNS(r.namespaceURI,r.tagName);for(let n=0;n<r.attributes.length;n++){let s=r.attributes[n];i.setAttribute(s.localName,s.value)}for(let n=0;n<r.childNodes.length;n++)i.appendChild(yd(r.childNodes[n],t,e));return i}return o.cloneNode(!1)}function Vr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild(yd(o.childNodes[r],document,t));return e}function jr(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let n=r.getAttribute(i)?.trim();if(n&&!/^(data:|https?:|blob:)/.test(n)){let s=t+encodeURI(n);r.setAttribute(i,s)}}})}var Gt=()=>{let o,t="",e={load(r,i){return t=r,Nr(r,i).then(n=>(o=n,e))},parse(r){return o=Lr(r),t="",e},path:r=>(jr(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return pd(o,r),e},async configurePci(r,i,n="qti-portable-custom-interaction"){return await cd(o,r,i,n),e},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-item-seed";return io("qtiTransformItem",n),Za(o,n),e}return Za(o,i),e},extendElementName:(r,i)=>(ld(o,r,i),e),extendElementsWithClass:(r="extend")=>(dd(o,r),e),customInteraction(r,i){let n=o.querySelector("qti-custom-interaction"),s=n.querySelector("object");return n.setAttribute("data-base-ref",r),n.setAttribute("data-base-item",r+i),n.setAttribute("data",s.getAttribute("data")),n.setAttribute("width",s.getAttribute("width")),n.setAttribute("height",s.getAttribute("height")),n.removeChild(s),e},convertCDATAtoComment(){return ad(o),e},stripStyleSheets(){return md(o),e},validateBindings(){return gd(o),e},html(){return t!==null&&jr(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Vr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&jr(o,t.substring(0,t.lastIndexOf("/"))),Vr(o,r)},xmlDoc(){return o}};return e};var qd=()=>{let o,t={async load(e,r){return o=await Nr(e,r),t},parse(e){o=Lr(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function xd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:i,category:n})}),t}var no=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),wd=o=>no(o,"qti-assessment-item-ref","assessmentitemref"),Bi=o=>no(o,"qti-assessment-section","assessmentsection"),zi=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),Ju=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),tc=o=>no(o,"qti-ordering","ordering"),Yu=o=>no(o,"qti-selection","selection"),Ku=o=>Array.from(o.children).filter(t=>tc(t)&&zi(t,"shuffle")),Zu=(o,t)=>eo(`${o}:${t}`);function tm(o){let t=[],e=[],r=i=>{for(let n of Array.from(i.children))wd(n)?t.push(n):Bi(n)?r(n):!tc(n)&&!Yu(n)&&e.push(n.localName)};return r(o),{itemRefs:t,dropped:e}}function em(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function Cd(o,t){for(let c of Array.from(o.children))Bi(c)&&Cd(c,t);let e=Ku(o);if(e.length===0)return;let r=[],i=[];for(let c of Array.from(o.children))if(wd(c))r.push({nodes:[c],fixed:zi(c,"fixed")}),i.push(c);else if(Bi(c)){let{itemRefs:l,dropped:d}=tm(c);if(em(c,d),Ju(c,"keep-together","keeptogether"))for(let h of l)r.push({nodes:[h],fixed:zi(h,"fixed")});else l.length>0&&r.push({nodes:l,fixed:zi(c,"fixed")});i.push(c)}let n=i.length>0?i[i.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=ro(r,Zu(t,s));for(let c of i)c.remove();for(let c of a)for(let l of c.nodes)o.insertBefore(l,n);for(let c of e)c.remove()}function kd(o){return Array.from(o.getElementsByTagName("*")).some(t=>tc(t)&&zi(t,"shuffle"))}function ec(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Bi(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&Bi(i)||Cd(r,t)}}var Fr=()=>{let o,t="",e={async load(r,i){return o=await Nr(r,i),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return o=Lr(r),t="",e},path:r=>(jr(o,r),e),fn(r){return r(o),e},shuffleOrdering(r){if(!kd(o))return e;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-test-seed";return io("qtiTransformTest",n),ec(o,n),e}return ec(o,i),e},items(){return xd(o)},html(){return new XMLSerializer().serializeToString(Vr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return Vr(o,r)},xmlDoc(){return o}};return e};var Sd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},rc=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},zr=class extends S{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new rc(this,t);this.dispatchEvent(e);let r=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(t){let r=(await Gt().load(this.href).then(i=>i.htmlDoc()))?.querySelector("qti-assessment-stimulus");r&&(t.innerHTML="",t.append(r))}};Sd([p({type:String})],zr.prototype,"identifier",void 0);Sd([p({type:String})],zr.prototype,"href",void 0);var oo=class extends S{};var rm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ui=class extends S{render(){return v`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let n=i;n.mathVariable!==!0||n.value===null||n.value===void 0||t.set(n.identifier,this.#e(n.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let n=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(n);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",n);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",n),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};rm([R({context:j,subscribe:!0}),T()],Ui.prototype,"context",void 0);var Ed=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Br=class extends S{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[w`
|
|
83
|
+
`;var io=class extends S{static{this.styles=dd}connectedCallback(){super.connectedCallback(),this.removeAttribute("title")}render(){return v`<slot></slot>`}};function hd(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}async function pd(o,t,e,r="qti-portable-custom-interaction"){let i=[],n=o.querySelectorAll(r);if(n.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(n)){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 f=h.getAttribute("primary-configuration");if(f)try{let m=await e(t,`/${f}`),y=Array.from(h.querySelectorAll("qti-interaction-module"));for(let x of y){let u=x.getAttribute("id");if(u&&m.paths&&m.paths[u]){let g=m.paths[u],b=Array.isArray(g)?g[0]:g;if(x.setAttribute("primary-path",b),a&&a.paths&&a.paths[u]){let q=a.paths[u];Array.isArray(q)?x.setAttribute("fallback-path",q[0]):x.setAttribute("fallback-path",q)}}}if(m.paths){for(let x in m.paths)if(!h.querySelector(`qti-interaction-module[id="${x}"]`)){let g=o.createElement("qti-interaction-module");g.setAttribute("id",x);let b=Array.isArray(m.paths[x])?m.paths[x][0]:m.paths[x];if(g.setAttribute("primary-path",b),a&&a.paths&&a.paths[x]){let q=a.paths[x];Array.isArray(q)?g.setAttribute("fallback-path",q[0]):g.setAttribute("fallback-path",q)}h.appendChild(g)}}m.urlArgs&&h.setAttribute("url-args",m.urlArgs)}catch(m){console.warn(`Failed to load primary configuration: ${f}`,m)}}else if(await c(),s){l.querySelector("qti-interaction-modules")===null?(h=o.createElement("qti-interaction-modules"),l.appendChild(h)):h=l.querySelector("qti-interaction-modules");for(let f in s.paths){let m=s.paths[f],y="";a&&a.paths&&a.paths[f]&&(y=a.paths[f]);let x=Array.isArray(m)?m:[m],u=Array.isArray(y)?y:[y],g=x.map((b,q)=>{let _=u.length>q?u[q]:"";return{primaryPath:b,fallbackPath:_}});for(let b of u)g.some(q=>q.fallbackPath===b)||g.push({primaryPath:x.length>0?x[0]:b,fallbackPath:b});for(let b of g){let q=o.createElement("qti-interaction-module");b.fallbackPath&&q.setAttribute("fallback-path",b.fallbackPath),q.setAttribute("id",f),q.setAttribute("primary-path",b.primaryPath),h&&h.appendChild(q)}}}}}function ud(o,t,e){Array.from(o.getElementsByTagName("*")).filter(n=>n.localName===t||n.localName?.toLowerCase()===t.toLowerCase()).forEach(n=>{let s=`${t}-${e}`,a=fd(n,s);n.replaceWith(a)})}function md(o,t){o.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let n=i.slice(`${t}:`.length),s=`${e.nodeName}-${n}`,a=fd(e,s);e.replaceWith(a)}})})}function fd(o,t){let e=o.ownerDocument.createElement(t);for(let r of o.attributes)e.setAttribute(r.name,r.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function gd(o,t){let e=["hook","module"],r=t.substring(0,t.lastIndexOf("/"));for(let i of e)o.querySelectorAll("["+i+"]").forEach(s=>{let a=s.getAttribute(i);!a.startsWith("data:")&&!a.startsWith("http")&&(s.setAttribute("base-url",t),s.setAttribute("module",r+"/"+encodeURI(a+(a.endsWith(".js")?"":".js"))))})}var rc=class o{#t;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("SeededRandom seed must be a Uint8Array.");if(t.length>32)throw new RangeError("SeededRandom seed must be 32 bytes or less.");let e=new Uint8Array(32);e.set(t,32-t.length),this.#t=Gu(e)}static fromSeed(t){if(t.length!==32)throw new RangeError("SeededRandom.fromSeed requires a 32-byte seed.");return new o(t)}static fromFixed(t){if(typeof t!="number")throw new TypeError("SeededRandom.fromFixed requires a number.");if(!Number.isInteger(t)||t<0||t>255)throw new RangeError("SeededRandom.fromFixed requires an integer from 0 to 255.");let e=new Uint8Array(32);return e[31]=t,new o(e)}static fromSeedKey(t){let e=new o(new Uint8Array);return e.#t=Xu(`${t}`),e}random(){this.#t|=0,this.#t=this.#t+1831565813|0;let t=Math.imul(this.#t^this.#t>>>15,1|this.#t);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}};function no(o){return rc.fromSeedKey(o)}function Xu(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o.charCodeAt(e),3432918353),t=t<<13|t>>>19;return bd(t)}function Gu(o){let t=1779033703^o.length;for(let e=0;e<o.length;e++)t=Math.imul(t^o[e],3432918353),t=t<<13|t>>>19;return bd(t)}function bd(o){let t=Math.imul(o^o>>>16,2246822507);return t=Math.imul(t^t>>>13,3266489909),(t^t>>>16)>>>0}var Ju=o=>typeof o=="function"?o():o.random();function oo(o,t){let e=o.filter(i=>!i.fixed);for(let i=e.length-1;i>0;i--){let n=Math.floor(Ju(t)*(i+1));[e[i],e[n]]=[e[n],e[i]]}let r=0;return o.map(i=>i.fixed?i:e[r++])}function Yu(o){switch(o){case"qti-choice-interaction":case"qti-order-interaction":return"qti-simple-choice";case"qti-inline-choice-interaction":return"qti-inline-choice";case"qti-match-interaction":return["qti-simple-match-set:first-of-type qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice"];case"qti-gap-match-interaction":return"qti-gap-text";case"qti-associate-interaction":return"qti-simple-associable-choice";default:return null}}function ic(o,t){let e=o.querySelectorAll('[shuffle="true"]'),r=Array.from(e).filter(a=>a.tagName?.toLowerCase().endsWith("-interaction")),i=t!=null&&`${t}`.length>0,n=o.querySelector?.("qti-assessment-item")?.getAttribute("identifier")??"",s=0;for(let a of r){let c=a.getAttribute("response-identifier")??`${s}`;s++;let l=Yu(a.tagName.toLowerCase()),d=Array.isArray(l)?l:[l],h=!1,f=0;for(let m of d){if(!m)continue;let y=i?no(`${t}:${n}:${c}:${f}`):Math.random;f++;let x=Array.from(a.querySelectorAll(m)).filter(q=>q.parentElement!==null);if(x.filter(q=>q.getAttribute("fixed")!=="true").length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");continue}let u=x[0].parentElement;if(!u||x.some(q=>q.parentElement!==u)){console.warn("Shuffling is not possible when choices do not share the same parent element.");continue}let g=x[x.length-1].nextSibling,b=oo(x.map(q=>({element:q,fixed:q.getAttribute("fixed")==="true"})),y);for(let q of x)q.remove();for(let{element:q}of b)u.insertBefore(q,g);h=!0}h&&a.removeAttribute("shuffle")}}function vd(o){o.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Ku={"qti-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-choice-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-drawing-interaction":{baseTypes:["file"],cardinalities:["single"]},"qti-end-attempt-interaction":{baseTypes:["boolean"],cardinalities:["single"]},"qti-extended-text-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","multiple","ordered","record"]},"qti-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-associate-interaction":{baseTypes:["pair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-graphic-gap-match-interaction":{baseTypes:["directedPair"],cardinalities:["multiple"]},"qti-graphic-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-hotspot-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-hottext-interaction":{baseTypes:["identifier"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-inline-choice-interaction":{baseTypes:["identifier"],cardinalities:["single"]},"qti-match-interaction":{baseTypes:["directedPair"],cardinalities:["single","multiple"],max:{attribute:"max-associations",default:1}},"qti-media-interaction":{baseTypes:["integer"],cardinalities:["single"]},"qti-order-interaction":{baseTypes:["identifier"],cardinalities:["ordered"]},"qti-position-object-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:1}},"qti-select-point-interaction":{baseTypes:["point"],cardinalities:["single","multiple"],max:{attribute:"max-choices",default:0}},"qti-slider-interaction":{baseTypes:["integer","float"],cardinalities:["single"]},"qti-text-entry-interaction":{baseTypes:["string","integer","float"],cardinalities:["single","record"]},"qti-upload-interaction":{baseTypes:["file"],cardinalities:["single"]}},yd=o=>o.length===1?o[0]:`${o.slice(0,-1).join(", ")} or ${o[o.length-1]}`;function qd(o){let t=new Map(Array.from(o.querySelectorAll("qti-response-declaration"),r=>[r.getAttribute("identifier"),r])),e=[];for(let[r,i]of Object.entries(Ku))for(let n of Array.from(o.querySelectorAll(r))){let s=n.getAttribute("response-identifier"),a=t.get(s);if(!a)continue;let c=`${r} (response "${s}")`,l=a.getAttribute("cardinality"),d=a.getAttribute("base-type");if(l&&!i.cardinalities.includes(l))e.push(`${c}: ${l} cardinality is not permitted; it must be ${yd(i.cardinalities)}`);else if(l&&i.max&&l!=="multiple"){let h=n.getAttribute(i.max.attribute),f=h===null?i.max.default:Number(h);(f===0||f>1)&&e.push(`${c}: ${i.max.attribute} ${f} requires multiple cardinality, not ${l}`)}l!=="record"&&d&&!i.baseTypes.includes(d)&&e.push(`${c}: base-type ${d} is not permitted; it must be ${yd(i.baseTypes)}`)}if(e.length>0)throw new Error(`QTI validation error: ${e.join("; ")}.`)}var xd=!1;function so(o,t){xd||(xd=!0,console.warn(`[${o}] No QTI_CONTEXT.seed provided; using "${t}" as deterministic fallback seed.`))}function Zu(o){return(o.textContent||"").replace(/\s+/g," ").trim().replace(/^This page contains the following errors:\s*/i,"").replace(/\s*Below is a rendering of the page up to the first error\.?\s*$/i,"").trim()||"malformed XML"}function wd(o,t){let r=new DOMParser().parseFromString(o.replace(/^[\s\uFEFF]+/,""),"text/xml"),i=r.getElementsByTagNameNS("http://www.w3.org/1999/xhtml","parsererror")[0]??r.getElementsByTagNameNS("http://www.mozilla.org/newlayout/xml/parsererror.xml","parsererror")[0];if(i)throw new Error(t(Zu(i)));return r}function Nr(o,t){return fetch(o,{signal:t}).then(e=>{if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.text()}).then(e=>wd(e,r=>`is not well-formed XML: ${r}`)).catch(e=>{throw e.name==="AbortError"?e:new Error(`Failed to load XML: ${e.message}`)})}function Lr(o){return wd(o,t=>`Failed to parse XML: ${t}`)}function Cd(o,t,e){if(o.nodeType===Node.ELEMENT_NODE){let r=o,i;!r.namespaceURI||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/qti/")||r.namespaceURI.startsWith("http://www.imsglobal.org/xsd/imsqti")?i=e?t.createElement(r.localName,{customElementRegistry:e}):t.createElement(r.localName):i=t.createElementNS(r.namespaceURI,r.tagName);for(let n=0;n<r.attributes.length;n++){let s=r.attributes[n];i.setAttribute(s.localName,s.value)}for(let n=0;n<r.childNodes.length;n++)i.appendChild(Cd(r.childNodes[n],t,e));return i}return o.cloneNode(!1)}function Vr(o,t){let e=document.createDocumentFragment();for(let r=0;r<o.childNodes.length;r++)e.appendChild(Cd(o.childNodes[r],document,t));return e}function jr(o,t){t.endsWith("/")||(t+="/"),o.querySelectorAll("*").forEach(r=>{for(let i of["src","href","srcset","poster"]){let n=r.getAttribute(i)?.trim();if(n&&!/^(data:|https?:|blob:)/.test(n)){let s=t+encodeURI(n);r.setAttribute(i,s)}}})}var Gt=()=>{let o,t="",e={load(r,i){return t=r,Nr(r,i).then(n=>(o=n,e))},parse(r){return o=Lr(r),t="",e},path:r=>(jr(o,r),t=null,e),fn(r){return r(o),e},pciHooks(r){return gd(o,r),e},async configurePci(r,i,n="qti-portable-custom-interaction"){return await pd(o,r,i,n),e},shuffleInteractions(r){let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-item-seed";return so("qtiTransformItem",n),ic(o,n),e}return ic(o,i),e},extendElementName:(r,i)=>(ud(o,r,i),e),extendElementsWithClass:(r="extend")=>(md(o,r),e),customInteraction(r,i){let n=o.querySelector("qti-custom-interaction"),s=n.querySelector("object");return n.setAttribute("data-base-ref",r),n.setAttribute("data-base-item",r+i),n.setAttribute("data",s.getAttribute("data")),n.setAttribute("width",s.getAttribute("width")),n.setAttribute("height",s.getAttribute("height")),n.removeChild(s),e},convertCDATAtoComment(){return hd(o),e},stripStyleSheets(){return vd(o),e},validateBindings(){return qd(o),e},html(){return t!==null&&jr(o,t.substring(0,t.lastIndexOf("/"))),new XMLSerializer().serializeToString(Vr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return t!==null&&jr(o,t.substring(0,t.lastIndexOf("/"))),Vr(o,r)},xmlDoc(){return o}};return e};var kd=()=>{let o,t={async load(e,r){return o=await Nr(e,r),t},parse(e){o=Lr(e)},assessmentTest(){let e=o.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};function Sd(o){let t=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:i,category:n})}),t}var ao=(o,...t)=>t.includes(o.localName)||t.includes(o.localName?.toLowerCase?.()),Ed=o=>ao(o,"qti-assessment-item-ref","assessmentitemref"),Bi=o=>ao(o,"qti-assessment-section","assessmentsection"),zi=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="true"||r==="1"}),tm=(o,...t)=>t.some(e=>{let r=(o.getAttribute(e)??"").trim().toLowerCase();return r==="false"||r==="0"}),nc=o=>ao(o,"qti-ordering","ordering"),em=o=>ao(o,"qti-selection","selection"),rm=o=>Array.from(o.children).filter(t=>nc(t)&&zi(t,"shuffle")),im=(o,t)=>no(`${o}:${t}`);function nm(o){let t=[],e=[],r=i=>{for(let n of Array.from(i.children))Ed(n)?t.push(n):Bi(n)?r(n):!nc(n)&&!em(n)&&e.push(n.localName)};return r(o),{itemRefs:t,dropped:e}}function om(o,t){if(t.length===0)return;let e=o.getAttribute("identifier")??"(no identifier)";console.warn(`[qtiTransformTest] Subsection "${e}" is consumed by section ordering; discarding its ${[...new Set(t)].join(", ")}.`)}function Ad(o,t){for(let c of Array.from(o.children))Bi(c)&&Ad(c,t);let e=rm(o);if(e.length===0)return;let r=[],i=[];for(let c of Array.from(o.children))if(Ed(c))r.push({nodes:[c],fixed:zi(c,"fixed")}),i.push(c);else if(Bi(c)){let{itemRefs:l,dropped:d}=nm(c);if(om(c,d),tm(c,"keep-together","keeptogether"))for(let h of l)r.push({nodes:[h],fixed:zi(h,"fixed")});else l.length>0&&r.push({nodes:l,fixed:zi(c,"fixed")});i.push(c)}let n=i.length>0?i[i.length-1].nextSibling:null,s=o.getAttribute("identifier")??"",a=oo(r,im(t,s));for(let c of i)c.remove();for(let c of a)for(let l of c.nodes)o.insertBefore(l,n);for(let c of e)c.remove()}function _d(o){return Array.from(o.getElementsByTagName("*")).some(t=>nc(t)&&zi(t,"shuffle"))}function oc(o,t){let e=Array.from(o.getElementsByTagName("*")).filter(r=>Bi(r));for(let r of e){if(!r.parentNode)continue;let i=r.parentElement;i&&Bi(i)||Ad(r,t)}}var Fr=()=>{let o,t="",e={async load(r,i){return o=await Nr(r,i),t=r,e.path(r.substring(0,r.lastIndexOf("/"))),e},parse(r){return o=Lr(r),t="",e},path:r=>(jr(o,r),e),fn(r){return r(o),e},shuffleOrdering(r){if(!_d(o))return e;let i=typeof r=="string"?r.trim():r;if(i==null||i===""){let n=t||"default-test-seed";return so("qtiTransformTest",n),oc(o,n),e}return oc(o,i),e},items(){return Sd(o)},html(){return new XMLSerializer().serializeToString(Vr(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(r){return Vr(o,r)},xmlDoc(){return o}};return e};var Td=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},sc=class o extends Event{static{this.eventName="qti-assessment-stimulus-ref-connected"}constructor(t,e){super(o.eventName,{bubbles:!0,composed:!0,cancelable:!0}),this.element=t,this.item=e}},zr=class extends S{constructor(){super(...arguments),this.identifier="",this.href=""}async connectedCallback(){super.connectedCallback(),await this.updateComplete;let t=this.closest("qti-assessment-item"),e=new sc(this,t);this.dispatchEvent(e);let r=t?.querySelector(`[data-stimulus-idref="${this.identifier}"]`);!e.defaultPrevented&&r&&await this.updateStimulusRef(r)}async updateStimulusRef(t){let r=(await Gt().load(this.href).then(i=>i.htmlDoc()))?.querySelector("qti-assessment-stimulus");r&&(t.innerHTML="",t.append(r))}};Td([p({type:String})],zr.prototype,"identifier",void 0);Td([p({type:String})],zr.prototype,"href",void 0);var co=class extends S{};var sm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ui=class extends S{render(){return v`<slot @slotchange=${this.#t}></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.#t())}updated(t){t.has("context")&&this.#t()}#t(){let t=new Map,e=(this.context?.variables??[]).filter(i=>i.type==="template");for(let i of e){let n=i;n.mathVariable!==!0||n.value===null||n.value===void 0||t.set(n.identifier,this.#e(n.value))}if(t.size===0)return;let r=Array.from(this.querySelectorAll("*")).filter(i=>i.localName.toLowerCase()==="mi"||i.localName.toLowerCase()==="mn");for(let i of r){let n=i.getAttribute("data-qti-math-variable-source")??i.textContent?.trim()??"",s=t.get(n);if(!s)continue;if(i.localName.toLowerCase()==="mn"){i.textContent=s,i.setAttribute("data-qti-math-variable-source",n);continue}let a=document.createElement("mn");a.textContent=s,a.setAttribute("data-qti-math-variable-source",n),i.replaceWith(a)}}#e(t){return Array.isArray(t)?t.join(" "):t?.toString()??""}};sm([R({context:j,subscribe:!0}),T()],Ui.prototype,"context",void 0);var Rd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Br=class extends S{constructor(){super(...arguments),this.identifier="",this.cardinality="record"}static{this.styles=[w`
|
|
84
84
|
:host {
|
|
85
85
|
display: none;
|
|
86
86
|
}
|
|
87
|
-
`]}render(){return v`<slot></slot>`}};
|
|
87
|
+
`]}render(){return v`<slot></slot>`}};Rd([p({type:String})],Br.prototype,"identifier",void 0);Rd([p({type:String})],Br.prototype,"cardinality",void 0);var am=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Hi=class extends S{#t;render(){return v`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let t=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.#t=new Function("context","fn","item",t?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let t=this.getAttribute("definition");if(t)return this.#e(t);let e={variable:i=>this._context?.variables.find(n=>n.identifier===i)?.value??"",correct:i=>this._context?.variables.find(n=>n.identifier===i)?.correctResponse??""},r={getVariable:i=>this._context?.variables.find(n=>n.identifier===i),updateOutcomeVariable:(i,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:i,value:n}}))}};return this.#t(this._context,e,r)}#e(t){let e=id(t);if(!e)return console.warn(`qti-custom-operator: no operator registered for definition "${t}"`),null;let r=Array.from(this.children).map(i=>{let n=i.calculate;return typeof n=="function"?n.call(i):null});return e(r)}};am([R({context:j,subscribe:!0}),T()],Hi.prototype,"_context",void 0);function de(o,t,e,r){let i=o.closest("qti-assessment-item")?.getAttribute("identifier")??void 0,n={kind:e,identifier:r,outcomeIdentifier:o.outcomeIdentifier,element:o,...i?{itemIdentifier:i}:{}};return xt(o,t,n,!0)}var lo=class extends pt{static{this.styles=w`
|
|
88
88
|
:host {
|
|
89
89
|
display: block;
|
|
90
90
|
}
|
|
@@ -94,18 +94,18 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
94
94
|
.off {
|
|
95
95
|
display: none;
|
|
96
96
|
}
|
|
97
|
-
`}render(){return v` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}feedbackShowing(){return de(this,"qc-feedback-show","block",this.identifier)}feedbackHiding(){return de(this,"qc-feedback-hide","block",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var kt=o=>o??P;var
|
|
97
|
+
`}render(){return v` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}feedbackShowing(){return de(this,"qc-feedback-show","block",this.identifier)}feedbackHiding(){return de(this,"qc-feedback-hide","block",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var kt=o=>o??P;var ho=class extends pt{constructor(){super(...arguments),this.render=()=>v` <slot part="feedback" class="${kt(this.showStatus)}"></slot> `}static{this.styles=w`
|
|
98
98
|
.on {
|
|
99
99
|
display: inline-block;
|
|
100
100
|
}
|
|
101
101
|
.off {
|
|
102
102
|
display: none;
|
|
103
103
|
}
|
|
104
|
-
`}feedbackShowing(){return de(this,"qc-feedback-show","inline",this.identifier)}feedbackHiding(){return de(this,"qc-feedback-hide","inline",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var
|
|
104
|
+
`}feedbackShowing(){return de(this,"qc-feedback-show","inline",this.identifier)}feedbackHiding(){return de(this,"qc-feedback-hide","inline",this.identifier)}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};var Id=w`
|
|
105
105
|
:host {
|
|
106
106
|
display: block;
|
|
107
107
|
}
|
|
108
|
-
`;var
|
|
108
|
+
`;var po=class extends S{static{this.styles=Id}render(){return v`<slot part="rubrics qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`}};var Ur=class extends pt{static{this.styles=w`
|
|
109
109
|
.cito-dialog {
|
|
110
110
|
background: var(--qti-bg);
|
|
111
111
|
border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
|
|
@@ -154,11 +154,11 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
154
154
|
:host {
|
|
155
155
|
display: none;
|
|
156
156
|
}
|
|
157
|
-
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let r of t.querySelectorAll("qti-interpolation-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=parseFloat(r.getAttribute("target-value"));if(Number.isNaN(i)||Number.isNaN(n)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:i,targetValue:n,includeBoundary:r.getAttribute("include-boundary")!=="false"})}return e}get matchTable(){let t=this.querySelector("qti-match-table");if(!t)return null;let e=new Map;for(let r of t.querySelectorAll("qti-match-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=r.getAttribute("target-value");if(Number.isNaN(i)||n===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(i,n)}return e}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:t,type:"outcome",value:null,interpolationTable:this.interpolationTable,matchTable:this.matchTable,externalScored:this.externalScored};e.value=t,(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};Wi([p({type:String,attribute:"base-type"})],he.prototype,"baseType",void 0);Wi([p({type:String,attribute:"external-scored"})],he.prototype,"externalScored",void 0);Wi([p({type:String})],he.prototype,"identifier",void 0);Wi([p({type:String})],he.prototype,"cardinality",void 0);Wi([R({context:j,subscribe:!0}),T()],he.prototype,"itemContext",void 0);var
|
|
157
|
+
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(!t)return null;let e=[];for(let r of t.querySelectorAll("qti-interpolation-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=parseFloat(r.getAttribute("target-value"));if(Number.isNaN(i)||Number.isNaN(n)){console.error("source-value or target-value is missing or not a number in qti-interpolation-table-entry");continue}e.push({sourceValue:i,targetValue:n,includeBoundary:r.getAttribute("include-boundary")!=="false"})}return e}get matchTable(){let t=this.querySelector("qti-match-table");if(!t)return null;let e=new Map;for(let r of t.querySelectorAll("qti-match-table-entry")){let i=parseFloat(r.getAttribute("source-value")),n=r.getAttribute("target-value");if(Number.isNaN(i)||n===null){console.error("source-value or target-value is missing or invalid in qti-match-table-entry");continue}e.set(i,n)}return e}connectedCallback(){super.connectedCallback();let t=this.defaultValues(this.cardinality),e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:t,type:"outcome",value:null,interpolationTable:this.interpolationTable,matchTable:this.matchTable,externalScored:this.externalScored};e.value=t,(e.value===null||e.value==null)&&(e.baseType==="integer"||e.baseType==="float")&&(e.value="0"),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};Wi([p({type:String,attribute:"base-type"})],he.prototype,"baseType",void 0);Wi([p({type:String,attribute:"external-scored"})],he.prototype,"externalScored",void 0);Wi([p({type:String})],he.prototype,"identifier",void 0);Wi([p({type:String})],he.prototype,"cardinality",void 0);Wi([R({context:j,subscribe:!0}),T()],he.prototype,"itemContext",void 0);var uo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ee=class extends Ir{static{this.styles=[w`
|
|
158
158
|
:host {
|
|
159
159
|
display: none;
|
|
160
160
|
}
|
|
161
|
-
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:r}=this.#t(),i={baseType:this.baseType,identifier:this.identifier,correctResponse:e,...r?{fieldBaseTypes:r}:{},cardinality:this.cardinality||"single",mapping:this.#i,defaultValue:t,areaMapping:this.#n,value:null,type:"response",candidateResponse:null};i.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:i}}))}#t(){if(this.cardinality!=="record")return{correctResponse:this.#r};let t=this.querySelector("qti-correct-response");if(!t)return{correctResponse:void 0};let e=Array.from(t.querySelectorAll("qti-value")),{value:r,baseTypes:i}=ji(e);return e.forEach(n=>n.remove()),{correctResponse:Object.keys(r).length?r:void 0,fieldBaseTypes:i}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=ji(t);return Object.keys(e).length?e:null}get#r(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){t=[];for(let i=0;i<r.length;i++)t.push(r[i].textContent.trim()),r[i].remove()}}return t}get#i(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(r)?null:r,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(n=>({mapKey:n.getAttribute("map-key")||"",mappedValue:Number(n.getAttribute("mapped-value"))||0,caseSensitive:n.hasAttribute("case-sensitive")?n.getAttribute("case-sensitive")!=="false":!1}))}}get#n(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,r=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound")),n=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(r)?null:r,upperBound:isNaN(i)?null:i,areaMapEntries:n}}};
|
|
161
|
+
`]}render(){let t=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return v`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t=this.cardinality==="record"?this.#e:this.defaultValues(this.cardinality),{correctResponse:e,fieldBaseTypes:r}=this.#t(),i={baseType:this.baseType,identifier:this.identifier,correctResponse:e,...r?{fieldBaseTypes:r}:{},cardinality:this.cardinality||"single",mapping:this.#i,defaultValue:t,areaMapping:this.#n,value:null,type:"response",candidateResponse:null};i.value=t,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:i}}))}#t(){if(this.cardinality!=="record")return{correctResponse:this.#r};let t=this.querySelector("qti-correct-response");if(!t)return{correctResponse:void 0};let e=Array.from(t.querySelectorAll("qti-value")),{value:r,baseTypes:i}=ji(e);return e.forEach(n=>n.remove()),{correctResponse:Object.keys(r).length?r:void 0,fieldBaseTypes:i}}get#e(){let t=this.querySelectorAll("qti-default-value > qti-value");if(t.length===0)return null;let{value:e}=ji(t);return Object.keys(e).length?e:null}get#r(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent.trim(),r[0].remove();else if(this.cardinality!=="single"){t=[];for(let i=0;i<r.length;i++)t.push(r[i].textContent.trim()),r[i].remove()}}return t}get#i(){let t=this.querySelector("qti-mapping"),e=parseFloat(t?.getAttribute("lower-bound")),r=parseFloat(t?.getAttribute("upper-bound"));return{defaultValue:Number(t?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(r)?null:r,mapEntries:Array.from(t?.querySelectorAll("qti-map-entry")||[]).map(n=>({mapKey:n.getAttribute("map-key")||"",mappedValue:Number(n.getAttribute("mapped-value"))||0,caseSensitive:n.hasAttribute("case-sensitive")?n.getAttribute("case-sensitive")!=="false":!1}))}}get#n(){let t=this.querySelector("qti-area-mapping"),e=Number(t?.getAttribute("default-value"))||0,r=parseFloat(t?.getAttribute("lower-bound")),i=parseFloat(t?.getAttribute("upper-bound")),n=Array.from(t?.querySelectorAll("qti-area-map-entry")||[]).map(s=>({shape:s.getAttribute("shape")||"default",coords:s.getAttribute("coords")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,defaultValue:Number(s.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(r)?null:r,upperBound:isNaN(i)?null:i,areaMapEntries:n}}};uo([p({type:String,attribute:"base-type"})],Ee.prototype,"baseType",void 0);uo([p({type:String})],Ee.prototype,"identifier",void 0);uo([p({type:String})],Ee.prototype,"cardinality",void 0);uo([R({context:j,subscribe:!0}),T()],Ee.prototype,"itemContext",void 0);var Md=`<qti-response-condition>
|
|
162
162
|
<qti-response-if>
|
|
163
163
|
<qti-match>
|
|
164
164
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -173,7 +173,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
173
173
|
<qti-base-value base-type="float">0</qti-base-value>
|
|
174
174
|
</qti-set-outcome-value>
|
|
175
175
|
</qti-response-else>
|
|
176
|
-
</qti-response-condition>`,
|
|
176
|
+
</qti-response-condition>`,Pd=`<qti-response-condition>
|
|
177
177
|
<qti-response-if>
|
|
178
178
|
<qti-is-null>
|
|
179
179
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -187,7 +187,7 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
187
187
|
<qti-map-response identifier="RESPONSE"> </qti-map-response>
|
|
188
188
|
</qti-set-outcome-value>
|
|
189
189
|
</qti-response-else>
|
|
190
|
-
</qti-response-condition>`,
|
|
190
|
+
</qti-response-condition>`,Od=`<qti-response-condition>
|
|
191
191
|
<qti-response-if>
|
|
192
192
|
<qti-is-null>
|
|
193
193
|
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
@@ -201,27 +201,27 @@ Make sure to test your application with a production build as repeat registratio
|
|
|
201
201
|
<qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
|
|
202
202
|
</qti-set-outcome-value>
|
|
203
203
|
</qti-response-else>
|
|
204
|
-
</qti-response-condition>`;var
|
|
204
|
+
</qti-response-condition>`;var cm={map_response:Pd,map_response_point:Od,match_correct:Md},mo=class extends S{static{this.styles=[w`
|
|
205
205
|
:host {
|
|
206
206
|
display: none;
|
|
207
207
|
}
|
|
208
|
-
`]}#t=new Bt(this,{context:j});#e;constructor(){super(),new at(this,{context:j,subscribe:!0,callback:t=>{this.#e={...t,variables:t.variables.map(e=>({...e}))},this.#t.setValue(this.#e)}}),this.addEventListener("qti-set-outcome-value",t=>{t.stopImmediatePropagation();let e=this.#e?.variables.find(i=>i.identifier===t.detail.outcomeIdentifier);if(!e){console.warn(`Can not set qti-outcome-identifier: ${t.detail.outcomeIdentifier}, it is not available`);return}let{value:r}=t.detail;e.value=e.cardinality==="single"||Array.isArray(r)?r:[r]})}render(){return v`<slot></slot>`}processResponse({numAttempts:t}){let e=this.#e;if(!e)return;let r=this.closest("qti-assessment-item")?.getAttribute("adaptive")!=="true";for(let i of e.variables)i.identifier==="numAttempts"&&(i.value=String(t)),i.type==="outcome"&&r&&i.identifier!=="completionStatus"&&(i.value=
|
|
208
|
+
`]}#t=new Bt(this,{context:j});#e;constructor(){super(),new at(this,{context:j,subscribe:!0,callback:t=>{this.#e={...t,variables:t.variables.map(e=>({...e}))},this.#t.setValue(this.#e)}}),this.addEventListener("qti-set-outcome-value",t=>{t.stopImmediatePropagation();let e=this.#e?.variables.find(i=>i.identifier===t.detail.outcomeIdentifier);if(!e){console.warn(`Can not set qti-outcome-identifier: ${t.detail.outcomeIdentifier}, it is not available`);return}let{value:r}=t.detail;e.value=e.cardinality==="single"||Array.isArray(r)?r:[r]})}render(){return v`<slot></slot>`}processResponse({numAttempts:t}){let e=this.#e;if(!e)return;let r=this.closest("qti-assessment-item")?.getAttribute("adaptive")!=="true";for(let i of e.variables)i.identifier==="numAttempts"&&(i.value=String(t)),i.type==="outcome"&&r&&i.identifier!=="completionStatus"&&(i.value=lm(i));this.#r(),xt(this,"qc-item-set-outcomes",{outcomes:e.variables.filter(i=>i.type==="outcome"||i.identifier==="numAttempts").map(({identifier:i,value:n})=>({identifier:i,value:n})),responseProcessed:!0})}#r(){let t=[...this.children];try{for(let e of t)e.process()}catch(e){if(!(e instanceof Mr))throw e}}firstUpdated(t){let e=this.getAttribute("template");if(!e)return;let r=e.split("/").pop().replace(".xml",""),i=cm[r];i&&(this.innerHTML=i)}};function lm(o){let t=("defaultValue"in o?o.defaultValue:null)??null;return t===null&&(o.baseType==="integer"||o.baseType==="float")?"0":t}function N(o,t){let e={waitUntilFirstUpdate:!1,...t};return(r,i)=>{let{update:n}=r,s=Array.isArray(o)?o:[o];r.update=function(a){s.forEach(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)}}),n.call(this,a)}}}var Hr={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ot=o=>(...t)=>({_$litDirective$:o,values:t}),Ae=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:dm}=et,Dd=o=>o,Nd=o=>o===null||typeof o!="object"&&typeof o!="function";var Ld=o=>o.strings===void 0,$d=()=>document.createComment(""),Wr=(o,t,e)=>{let r=o._$AA.parentNode,i=t===void 0?o._$AB:t._$AA;if(e===void 0){let n=r.insertBefore($d(),i),s=r.insertBefore($d(),i);e=new dm(n,s,o,o.options)}else{let n=e._$AB.nextSibling,s=e._$AM,a=s!==o;if(a){let c;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(c=o._$AU)!==s._$AU&&e._$AP(c)}if(n!==i||a){let c=e._$AA;for(;c!==n;){let l=Dd(c).nextSibling;Dd(r).insertBefore(c,i),c=l}}}return e},_e=(o,t,e=o)=>(o._$AI(t,e),o),hm={},Vd=(o,t=hm)=>o._$AH=t,jd=o=>o._$AH,fo=o=>{o._$AR(),o._$AA.remove()};var Qi=(o,t)=>{let e=o._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),Qi(r,t);return!0},go=o=>{let t,e;do{if((t=o._$AM)===void 0)break;e=t._$AN,e.delete(o),o=t}while(e?.size===0)},Fd=o=>{for(let t;t=o._$AM;o=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(o))break;e.add(o),mm(t)}};function pm(o){this._$AN!==void 0?(go(this),this._$AM=o,Fd(this)):this._$AM=o}function um(o,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let n=e;n<r.length;n++)Qi(r[n],!1),go(r[n]);else r!=null&&(Qi(r,!1),go(r));else Qi(this,o)}var mm=o=>{o.type==Hr.CHILD&&(o._$AP??=um,o._$AQ??=pm)},Te=class extends Ae{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Fd(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(Qi(this,t),go(this))}setValue(t){if(Ld(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 ac=class extends Te{constructor(){super(...arguments),this.prevData={}}render(t){return P}update(t,[e]){return this.element!==t.element&&(this.element=t.element),this.host=t.options?.host||this.element,this.apply(e),this.groom(e),this.prevData={...e},P}apply(t){let e=this.#t(t),{prevData:r,element:i}=this;for(let n in e){let s=e[n];s!==r[n]&&(s===!0?i.setAttribute(n,""):s===!1?i.removeAttribute(n):s!=null?i.setAttribute(n,String(s)):i.removeAttribute(n))}}groom(t){let{prevData:e,element:r}=this;if(!e)return;let i=t?this.#t(t):{};for(let n in e)(!i||!(n in i))&&r.removeAttribute(n)}#t(t){return Object.fromEntries(Object.entries(t).filter(([e,r])=>typeof r=="function"?!1:e==="max-choices"&&r===0?!0:!(r===""||r===null||r===void 0)))}},x0=Ot(ac);var Xi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pe=class extends S{handleclassNamesChange(){this.classNames.split(" ").forEach(e=>{switch(e){case"qti-rubric-discretionary-placement":{if(!xt(this,"qc-item-rubric-placement",{className:e,element:this},!0))return;this.setAttribute("slot","qti-rubric-block")}break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}static{this.styles=w`
|
|
209
209
|
:host {
|
|
210
210
|
display: block;
|
|
211
211
|
}
|
|
212
|
-
`}render(){return v`<slot></slot>`}};Xi([p({type:String})],pe.prototype,"id",void 0);Xi([p({type:String})],pe.prototype,"use",void 0);Xi([p({type:String})],pe.prototype,"view",void 0);Xi([p({type:String,attribute:"class"})],pe.prototype,"classNames",void 0);Xi([N("classNames",{waitUntilFirstUpdate:!0})],pe.prototype,"handleclassNamesChange",null);var
|
|
212
|
+
`}render(){return v`<slot></slot>`}};Xi([p({type:String})],pe.prototype,"id",void 0);Xi([p({type:String})],pe.prototype,"use",void 0);Xi([p({type:String})],pe.prototype,"view",void 0);Xi([p({type:String,attribute:"class"})],pe.prototype,"classNames",void 0);Xi([N("classNames",{waitUntilFirstUpdate:!0})],pe.prototype,"handleclassNamesChange",null);var bo=class extends S{#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 vo=class extends S{render(){return v`<slot></slot>`}calculate(){let t=[...this.children];if(t.length!==1)return console.error("qti-template-constraint must have exactly one child expression"),!0;try{return!!t[0].calculate()}catch(e){return console.error("Error evaluating template constraint:",e),!0}}getSubRules(){return[]}process(){let t=this.calculate();return t||console.debug("Template constraint not satisfied, restarting template processing"),t}};var Gi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ue=class extends S{constructor(){super(...arguments),this.identifier="",this.cardinality="single",this.baseType="string",this.mathVariable=!1,this.paramVariable=!1,this.#t=null}#t;static{this.styles=[w`
|
|
213
213
|
:host {
|
|
214
214
|
display: none;
|
|
215
215
|
}
|
|
216
|
-
`]}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#i()})}#e(){let t=this.querySelector("qti-default-value");if(!t)return;let e=t.textContent?.trim()||"";this.#t=this.#r(e)}#r(t){if(!t)return null;switch(this.baseType){case"integer":return parseInt(t,10);case"float":case"duration":return parseFloat(t);case"boolean":return t.toLowerCase()==="true";default:return t}}#i(){let e={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:this.#t,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:this.#t?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};Gi([p({type:String})],ue.prototype,"identifier",void 0);Gi([p({type:String})],ue.prototype,"cardinality",void 0);Gi([p({type:String,attribute:"base-type"})],ue.prototype,"baseType",void 0);Gi([p({type:Boolean,attribute:"math-variable"})],ue.prototype,"mathVariable",void 0);Gi([p({type:Boolean,attribute:"param-variable"})],ue.prototype,"paramVariable",void 0);var
|
|
216
|
+
`]}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.#e(),this.#i()})}#e(){let t=this.querySelector("qti-default-value");if(!t)return;let e=t.textContent?.trim()||"";this.#t=this.#r(e)}#r(t){if(!t)return null;switch(this.baseType){case"integer":return parseInt(t,10);case"float":case"duration":return parseFloat(t);case"boolean":return t.toLowerCase()==="true";default:return t}}#i(){let e={...{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,defaultValue:this.#t,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable},value:this.#t?.toString()||""};this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}getTemplateVariable(){return{identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,value:this.#t,type:"template",mathVariable:this.mathVariable,paramVariable:this.paramVariable}}};Gi([p({type:String})],ue.prototype,"identifier",void 0);Gi([p({type:String})],ue.prototype,"cardinality",void 0);Gi([p({type:String,attribute:"base-type"})],ue.prototype,"baseType",void 0);Gi([p({type:Boolean,attribute:"math-variable"})],ue.prototype,"mathVariable",void 0);Gi([p({type:Boolean,attribute:"param-variable"})],ue.prototype,"paramVariable",void 0);var yo=class extends S{static{this.styles=[w`
|
|
217
217
|
:host {
|
|
218
218
|
display: none;
|
|
219
219
|
}
|
|
220
|
-
`]}#t=100;render(){return v`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,r=!1;do{if(r=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let i=[...this.children];for(let n of i)if(n.tagName.toLowerCase()==="qti-template-constraint"){if(n.calculate()===!1){r=!0;break}}else n.process()}catch(i){console.error("Error during template processing:",i);break}}while(r);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var
|
|
220
|
+
`]}#t=100;render(){return v`<slot></slot>`}process(){if(!this.closest("qti-assessment-item")){console.warn("qti-template-processing must be inside qti-assessment-item");return}let e=0,r=!1;do{if(r=!1,e++,e>this.#t){console.error("Template processing exceeded maximum iterations. Possible infinite loop.");break}try{let i=[...this.children];for(let n of i)if(n.tagName.toLowerCase()==="qti-template-constraint"){if(n.calculate()===!1){r=!0;break}}else n.process()}catch(i){console.error("Error during template processing:",i);break}}while(r);this.dispatchEvent(new CustomEvent("qti-template-processing-complete",{bubbles:!0,composed:!0,detail:{iterations:e}}))}firstUpdated(t){this.getAttribute("template")&&console.info("Template processing with external template not yet implemented")}};var zd=[{tag:"qti-assessment-item",ctor:ut},{tag:"qti-assessment-stimulus",ctor:io},{tag:"qti-assessment-stimulus-ref",ctor:zr},{tag:"qti-companion-materials-info",ctor:co},{tag:"qti-content-body",ctor:Ui},{tag:"qti-context-declaration",ctor:Br},{tag:"qti-custom-operator",ctor:Hi},{tag:"qti-feedback-block",ctor:lo},{tag:"qti-feedback-inline",ctor:ho},{tag:"qti-item-body",ctor:po},{tag:"qti-modal-feedback",ctor:Ur},{tag:"qti-outcome-declaration",ctor:he},{tag:"qti-response-declaration",ctor:Ee},{tag:"qti-response-processing",ctor:mo},{tag:"qti-rubric-block",ctor:pe},{tag:"qti-stylesheet",ctor:bo},{tag:"qti-template-constraint",ctor:vo},{tag:"qti-template-declaration",ctor:ue},{tag:"qti-template-processing",ctor:yo}];var fm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ji=class extends Ur{constructor(){super(...arguments),this.access="atEnd"}static{this.styles=w`
|
|
221
221
|
:host {
|
|
222
222
|
color: gray;
|
|
223
223
|
}
|
|
224
|
-
`}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return v``}};hm([p({type:String})],Ji.prototype,"access",void 0);var bo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Re=class extends S{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return v` <slot></slot>`}};bo([p({type:String})],Re.prototype,"identifier",void 0);bo([p({type:String})],Re.prototype,"class",void 0);bo([p({type:String,attribute:"navigation-mode"})],Re.prototype,"navigationMode",void 0);bo([p({type:String,attribute:"submission-mode"})],Re.prototype,"submissionMode",void 0);var pm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Yi=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",r=this.getAttribute("variable-identifier"),i=$r(t,Dr(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new nc(this._testContext,r,i).calculate()}calculate(){return this.getResult()}};pm([R({context:nt,subscribe:!0})],Yi.prototype,"_testContext",void 0);var nc=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let t=this.testContext?.items??[],e=0,r=[...new Set(this.includedItems.map(i=>i.item))];return t.forEach(i=>{if(r.includes(i.identifier)){let n=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;if(n){let a=Number(n.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var Ki="qti-assessment-section",vo="qti-test-part",Dt=o=>o.identifier||o.getAttribute("identifier")||"";function Vd(o,t){let e=o[t],r=t+1,i=um(e,o,t);if(i){let s=mm(i,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map(Dt)};s>t?r=s:console.warn(`qti-branch-rule target "${i.target}" is not ahead of "${Dt(e)}", ignored`)}let n=o.slice(t+1,r).map(Dt);for(let s=r;s<o.length;s++){if(Fd(o[s],e))return{id:Dt(o[s]),skipped:n};n.push(Dt(o[s]))}return{id:null,skipped:n}}function jd(o){let t=[];for(let e of o){if(Fd(e,null))return{id:Dt(e),skipped:t};t.push(Dt(e))}return{id:null,skipped:t}}function um(o,t,e){let r=[o];for(let i=o.parentElement;i&&(i.localName===Ki||i.localName===vo)&&!i.contains(t[e+1]??null);i=i.parentElement)r.push(i);for(let i of r)for(let n of i.querySelectorAll(":scope > qti-branch-rule"))if(n.evaluate?.())return n;return null}function mm(o,t,e){let r=o.parentElement,i=n=>{if(!n)return null;let s=t.findLastIndex(a=>n.contains(a));return s+1<t.length?s+1:null};switch(o.target){case le.EXIT_TEST:return null;case le.EXIT_TESTPART:return i(r.closest(vo));case le.EXIT_SECTION:{let n=r.localName===Ki?r:r.closest(Ki);return i(n??r)}default:{let n=t.findIndex(c=>Dt(c)===o.target);if(n>=0)return n;let s=[...r.closest("qti-assessment-test")?.querySelectorAll(`${Ki}, ${vo}`)??[]].find(c=>c.getAttribute("identifier")===o.target),a=s?t.findIndex(c=>s.contains(c)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function Fd(o,t){let e=[o];for(let r=o.parentElement;r&&(r.localName===Ki||r.localName===vo);r=r.parentElement)(!t||!r.contains(t))&&e.push(r);return e.every(r=>[...r.querySelectorAll(":scope > qti-pre-condition")].every(i=>i.evaluate?.()??!0))}var yo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},zd=o=>{class t extends o{constructor(...r){super(...r),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(r,i){let n=i||this._getDefaultNavigationId(r);n&&F(this,"qc-test-navigate",{type:r,id:n})}_bindEventHandlers(){B(this,"qc-test-navigate",this._handleNavigationRequest.bind(this)),B(this,"qc-test-loaded",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(r){this._testElement=r.detail,this._initializeNavigation()}_handleItemConnected(r){let i=r.detail;this._loadingState.connectedItems++;let n=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:n}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:n.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,n),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.href)}}_getDefaultNavigationId(r){return r==="section"?this.sessionContext?.navSectionId??this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let r=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(i[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let n=jd(i);if(n.skipped.length&&F(this,"qc-test-items-skipped",{ids:n.skipped}),n.id===null){F(this,"qc-test-end-reached",{});return}r=n.id}}r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,i){let n=this.sessionContext?.navItemRefId;if(!n||r==="item"&&i===n)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),c=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||c?.navigationMode||c?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===n);if(r==="item"){let f=d.findIndex(m=>m.identifier===i);return f===-1||h===-1?!1:f!==h+1}return!0}_resolveLinearNext(r,i){if(r!=="item"||!this._testElement)return;let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=n.findIndex(c=>Dt(c)===this.sessionContext?.navItemRefId);if(s<0||!n[s+1]||Dt(n[s+1])!==i||n[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=Vd(n,s);if(a.id!==i)return a}async _handleNavigationRequest({detail:r}){if(!r?.id)return;let i=this._resolveLinearNext(r.type,r.id);if(i?.id===null){i.skipped.length&&F(this,"qc-test-items-skipped",{ids:i.skipped}),F(this,"qc-test-end-reached",{});return}let n=i?.id??r.id;if(!i&&this._isLinearNavigationRestricted(r.type,n)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(r.type,n),this._activeController=a,await this._executeNavigation(r.type,n,s,a),i?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&F(this,"qc-test-items-skipped",{ids:i.skipped})}catch(c){this._handleNavigationError(c,r.type,n)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(r.type,n)}}_handleNavigationError(r,i,n){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,n))}async _executeNavigation(r,i,n,s){r==="item"?await this._navigateToItem(i,n,s):await this._navigateToSection(i,n,s)}async _navigateToItem(r,i,n){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"item",r)}async _navigateToSection(r,i,n){let a=this._findSection(r)?.closest("qti-test-part")?.identifier,c=this._getSectionItemIds(r);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:this.navigate==="item"?c[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=c.length,await this._loadItems(c,i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"section",r)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let r=this._loadingState.connectedItems>=this._loadingState.expectedItems,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,i))return;await new Promise(n=>setTimeout(n,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let n=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,r,i)}_applyStimulusContent(r,i,n){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],c=n.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="",l.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,i,n){if(!this._testElement||r.length===0)return;let s=r.map(l=>this._findItemRef(l));this._clearLoadedItems(),this._clearStimulusRef();let c=(await Promise.all(s.map(l=>this._loadSingleItem(l,i,n)))).filter(Boolean);this._isStaleNavigation(i,n)||(c.forEach(({itemRef:l,doc:d})=>{l&&d&&(l.xmlDoc=d)}),c.forEach(({itemRef:l})=>{let d=l?.identifier;if(!l||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&l.updateComplete.then(()=>{let f=l.assessmentItem;f&&(f.state=h)})}),this._loadResults=c)}async _loadSingleItem(r,i,n){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Gt().load(r.href,n.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,n)?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 Gt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!i)throw new Error(`Item with identifier "${r}" not found`);return i}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,i){let n=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:s,navItemRefId:i}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,i){return i.signal.aborted||r!==this._navigationId}_createNavigationError(r,i,n){return{message:r.message||`Failed to load ${i}: ${n}`,details:r,itemId:i==="item"?n:void 0,sectionId:i==="section"?n:void 0}}_dispatchLoadingStarted(r,i){F(this,"qc-test-navigation-started",{type:r,id:i})}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchError(r){F(this,"qc-test-navigation-failed",r)}_dispatchTestLoaded(r,i,n){requestAnimationFrame(()=>{F(this,"qc-test-rendered",r.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),F(this,"qc-test-navigated",{type:i,id:n})})}}return yo([p({type:String})],t.prototype,"navigate",void 0),yo([p({type:Number})],t.prototype,"requestTimeout",void 0),yo([p({attribute:!1})],t.prototype,"postLoadTransformCallback",void 0),yo([p({attribute:!1})],t.prototype,"postLoadTestTransformCallback",void 0),t};var Bd=o=>{class t extends o{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},B(this,"qc-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),B(this,"qc-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(r){super.willUpdate(r),r.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let n=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;n&&this.updateAssessmentItemView(n,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return t};var Ud=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},oc=o=>{class t extends o{constructor(...r){super(...r),this.testContext=ja,this.sessionContext=Va,this._updateItemInTestContext=i=>{let n=i.itemContext,s=n.identifier,a=n.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,void 0,n.valid);else{let l=[...i.variables];for(let d of c.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=l.find(f=>f.identifier===d.identifier);h?h.value=d.value:l.push(d)}i.variables=l,this.#t(s,l.find(d=>d.identifier==="completionStatus")?.value),c.state&&(i.state=c.state)}},this._initializeEventListeners()}updateItemVariables(r,i,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==r)return a;let c=[...a.variables??[]];for(let{identifier:l,type:d,value:h}of i){let f=c.findIndex(y=>y.identifier===l),m={...f>=0?c[f]:{},identifier:l,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?c[f]=m:c.push(m)}return{...a,variables:c,...n?{state:{...n}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(r)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===r)?.variables??[]],n&&(s.state=n))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=ja,this.sessionContext=Va}),B(this,"qc-test-loaded",r=>{this._testElement=r.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(n=>({href:n.href,identifier:n.identifier,category:n.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",r=>{let i=r.detail,n=i.closest("qti-assessment-item-ref")?.identifier;n&&(i.assessmentItemRefId=n),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables,r.detail.itemContext.state,r.detail.itemContext.valid)})}_updateItemVariablesInTestContext(r,i,n,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:i.map(c=>{let l=a.variables.find(d=>d.identifier===c.identifier);return l?{...l,...c}:c}),...n!==void 0?{state:n?{...n}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(r,i){typeof i!="string"||i==="not_attempted"||this.testContext.items.find(a=>a.identifier===r)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:a.variables.map(c=>c.identifier==="completionStatus"?{...c,value:i}:c)})})}}return Ud([p({attribute:!1,type:Object}),J({context:nt})],t.prototype,"testContext",void 0),Ud([p({attribute:!1,type:Object}),J({context:Qn})],t.prototype,"sessionContext",void 0),t},Hd=class extends oc(S){};var qo=1;var sc=o=>Array.isArray(o)?[...o]:o??null,fm=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},gm=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(r=>({identifier:r.identifier,...r.type?{type:r.type}:{},value:sc(r.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:sc(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),Wd=o=>{class t extends o{#t=null;#e=!1;#r=null;constructor(...r){super(...r),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#r=null}),B(this,"qc-test-update-plugin-state",({detail:i})=>this.#i(i)),B(this,"qc-test-loaded",()=>{this.#t&&(this.#n(this.#t),this.#t=null),this.#e=!0})}#i({plugin:r,value:i}){if(typeof r!="string"||r==="")return;let{[r]:n,...s}=this.sessionContext.plugins??{},a=s;if(i!=null)try{a={...s,[r]:JSON.parse(JSON.stringify(i))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${r}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return gm(this.testContext,this.sessionContext)}set state(r){if(!fm(r)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=r;return}let{navItemRefId:i,navSectionId:n}=this.sessionContext;this.#n(r);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==i?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==n&&this.#s("section",s.navSectionId)}updated(r){if(super.updated(r),!this.#e||!(r.has("testContext")||r.has("sessionContext")))return;let i=this.state,n=JSON.stringify(i);n!==this.#r&&(this.#r=n,F(this,"qc-test-state-changed",i))}#n(r){for(let n of r.test.items)this.updateItemVariables(n.identifier,n.variables,n.state);let i=new Map(r.test.outcomes.map(n=>[n.identifier,n.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>i.has(n.identifier)?{...n,value:sc(i.get(n.identifier))}:n)},this.sessionContext={...this.sessionContext,...this.#o(r.session),plugins:r.session.plugins&&typeof r.session.plugins=="object"?{...r.session.plugins}:{}}}#o(r){let i=(n,s)=>!!s&&!!this._testElement?.querySelector(`${n}[identifier="${CSS.escape(s)}"]`);return{...i("qti-test-part",r.navPartId)?{navPartId:r.navPartId}:{},...i("qti-assessment-section",r.navSectionId)?{navSectionId:r.navSectionId}:{},...this.testContext.items.some(n=>n.identifier===r.navItemRefId)?{navItemRefId:r.navItemRefId}:{}}}#s(r,i){F(this,"qc-test-navigate",{type:r,id:i})}}return t};var Qd=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),B(this,"qc-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:n,value:s}=i.detail;this.updateOutcomeVariable(n,s),i.stopPropagation()})}outcomeProcessing(){let r=(this._testElement??this).querySelector("qti-outcome-processing");return r?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>({...i,value:i.defaultValue??null}))},r.process(),!0):!1}submit(){return this.outcomeProcessing()?(F(this,"qc-test-submitted",{}),!0):!1}getTestFeedback(r){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(n=>(!r||n.access===r)&&n.matches(this.getOutcome(n.outcomeIdentifier)?.value))}updateOutcomeVariable(r,i){let n=this.getOutcome(r);if(!n){console.warn(`Can not set qti-outcome-identifier: ${r}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==r?s:{...s,value:n.cardinality==="single"?i:[...s.value,i]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===r)||null}}return t};var Xd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ie=class extends zd(Bd(Qd(Wd(oc(S))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Bt(this,{context:Ce,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};Xd([T(),J({context:yt})],Ie.prototype,"configContext",void 0);Xd([T(),J({context:qt})],Ie.prototype,"qtiContext",void 0);var xo=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},wo=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 Gd=o=>!Pd(o)&&typeof o.then=="function",Jd=1073741823,ac=class extends Te{constructor(){super(...arguments),this._$Cwt=Jd,this._$Cbt=[],this._$CK=new xo(this),this._$CX=new wo}render(...t){return t.find(e=>!Gd(e))??it}update(t,e){let r=this._$Cbt,i=r.length;this._$Cbt=e;let n=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let c=e[a];if(!Gd(c))return this._$Cwt=a,c;a<i&&c===r[a]||(this._$Cwt=Jd,i=0,Promise.resolve(c).then(async l=>{for(;s.get();)await s.get();let d=n.deref();if(d!==void 0){let h=d._$Cbt.indexOf(c);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(l))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Co=Ot(ac);var ko=`
|
|
224
|
+
`}matches(t){let e=Array.isArray(t)?t.includes(this.identifier):t!=null&&t===this.identifier;return this.showHide==="hide"?!e:e}render(){return v``}};fm([p({type:String})],Ji.prototype,"access",void 0);var qo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Re=class extends S{constructor(){super(...arguments),this.identifier="",this.class="",this.navigationMode="nonlinear",this.submissionMode="individual",this.#t=""}get title(){return this.#t}set title(t){this.#t=t,this.removeAttribute("title"),this.setAttribute("data-title",t)}#t;async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return v` <slot></slot>`}};qo([p({type:String})],Re.prototype,"identifier",void 0);qo([p({type:String})],Re.prototype,"class",void 0);qo([p({type:String,attribute:"navigation-mode"})],Re.prototype,"navigationMode",void 0);qo([p({type:String,attribute:"submission-mode"})],Re.prototype,"submissionMode",void 0);var gm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Yi=class extends E{#t=null;constructor(){super(),B(this,"qc-test-loaded",t=>this.#t=t.detail)}get#e(){return this.#t??this.closest("qti-assessment-test")}getResult(){let t=this.#e;if(!t)return console.warn("qti-test-variables: no enclosing qti-assessment-test, nothing to aggregate"),0;let e=this.getAttribute("weight-identifier")??"",r=this.getAttribute("variable-identifier"),i=$r(t,Dr(this)).map(a=>({item:a.identifier,weight:(e?a.weights.get(e):void 0)??1}));return new cc(this._testContext,r,i).calculate()}calculate(){return this.getResult()}};gm([R({context:nt,subscribe:!0})],Yi.prototype,"_testContext",void 0);var cc=class{constructor(t,e,r){this.testContext=t,this.itemVariable=e,this.includedItems=r}calculate(){let t=this.testContext?.items??[],e=0,r=[...new Set(this.includedItems.map(i=>i.item))];return t.forEach(i=>{if(r.includes(i.identifier)){let n=i.variables.find(a=>a.identifier===this.itemVariable),s=this.includedItems.find(a=>a.item===i.identifier)?.weight??1;if(n){let a=Number(n.value);Number.isNaN(a)||(e+=a*s)}}}),e}};var Ki="qti-assessment-section",xo="qti-test-part",Dt=o=>o.identifier||o.getAttribute("identifier")||"";function Bd(o,t){let e=o[t],r=t+1,i=bm(e,o,t);if(i){let s=vm(i,o,t);if(s===null)return{id:null,skipped:o.slice(t+1).map(Dt)};s>t?r=s:console.warn(`qti-branch-rule target "${i.target}" is not ahead of "${Dt(e)}", ignored`)}let n=o.slice(t+1,r).map(Dt);for(let s=r;s<o.length;s++){if(Hd(o[s],e))return{id:Dt(o[s]),skipped:n};n.push(Dt(o[s]))}return{id:null,skipped:n}}function Ud(o){let t=[];for(let e of o){if(Hd(e,null))return{id:Dt(e),skipped:t};t.push(Dt(e))}return{id:null,skipped:t}}function bm(o,t,e){let r=[o];for(let i=o.parentElement;i&&(i.localName===Ki||i.localName===xo)&&!i.contains(t[e+1]??null);i=i.parentElement)r.push(i);for(let i of r)for(let n of i.querySelectorAll(":scope > qti-branch-rule"))if(n.evaluate?.())return n;return null}function vm(o,t,e){let r=o.parentElement,i=n=>{if(!n)return null;let s=t.findLastIndex(a=>n.contains(a));return s+1<t.length?s+1:null};switch(o.target){case le.EXIT_TEST:return null;case le.EXIT_TESTPART:return i(r.closest(xo));case le.EXIT_SECTION:{let n=r.localName===Ki?r:r.closest(Ki);return i(n??r)}default:{let n=t.findIndex(c=>Dt(c)===o.target);if(n>=0)return n;let s=[...r.closest("qti-assessment-test")?.querySelectorAll(`${Ki}, ${xo}`)??[]].find(c=>c.getAttribute("identifier")===o.target),a=s?t.findIndex(c=>s.contains(c)):-1;return a>=0?a:(console.warn(`qti-branch-rule target "${o.target}" not found`),e+1)}}}function Hd(o,t){let e=[o];for(let r=o.parentElement;r&&(r.localName===Ki||r.localName===xo);r=r.parentElement)(!t||!r.contains(t))&&e.push(r);return e.every(r=>[...r.querySelectorAll(":scope > qti-pre-condition")].every(i=>i.evaluate?.()??!0))}var wo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Wd=o=>{class t extends o{constructor(...r){super(...r),this.navigate=null,this.requestTimeout=3e4,this.postLoadTransformCallback=null,this.postLoadTestTransformCallback=null,this._activeController=null,this._loadResults=[],this._navigationId=0,this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs=new Set,this._loadingStimulusHrefs=new Set,this._bindEventHandlers()}navigateTo(r,i){let n=i||this._getDefaultNavigationId(r);n&&F(this,"qc-test-navigate",{type:r,id:n})}_bindEventHandlers(){B(this,"qc-test-navigate",this._handleNavigationRequest.bind(this)),B(this,"qc-test-loaded",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-assessment-stimulus-ref-connected",this._handleStimulusRefConnected.bind(this))}_handleTestConnected(r){this._testElement=r.detail,this._initializeNavigation()}_handleItemConnected(r){let i=r.detail;this._loadingState.connectedItems++;let n=i.querySelectorAll("qti-assessment-stimulus-ref");this._loadingState.expectedStimulus+=n.length,this._checkLoadingComplete()}async _handleStimulusRefConnected(r){r.preventDefault();let{element:i,item:n}=r;if(console.info("Stimulus ref connected:",{identifier:i.identifier,href:i.href,item:n.identifier}),this._loadedStimulusHrefs.has(i.href)){console.info("Stimulus already loaded, skipping:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}if(this._loadingStimulusHrefs.has(i.href)){console.info("Stimulus already loading, skipping duplicate:",i.href),this._loadingState.loadedStimulus++,this._checkLoadingComplete();return}this._loadingStimulusHrefs.add(i.href),console.info("Starting stimulus load:",i.href);try{await this._loadStimulusRef(i,n),this._loadedStimulusHrefs.add(i.href),this._loadingState.loadedStimulus++,console.info("Stimulus loaded successfully:",i.href),this._checkLoadingComplete()}catch(s){s.name!=="AbortError"&&console.warn(`Failed to load stimulus ${i.identifier}:`,s),this._loadingState.loadedStimulus++,this._checkLoadingComplete()}finally{this._loadingStimulusHrefs.delete(i.href)}}_getDefaultNavigationId(r){return r==="section"?this.sessionContext?.navSectionId??this._testElement?.querySelector("qti-assessment-section")?.identifier:this.sessionContext?.navItemRefId??this._testElement?.querySelector("qti-assessment-item-ref")?.identifier}_initializeNavigation(){if(!this.navigate)return;let r=this._getDefaultNavigationId(this.navigate);if(this.navigate==="item"&&this._testElement&&!this.sessionContext?.navItemRefId){let i=[...this._testElement.querySelectorAll("qti-assessment-item-ref")];if(i[0]?.closest("qti-test-part")?.getAttribute("navigation-mode")==="linear"){let n=Ud(i);if(n.skipped.length&&F(this,"qc-test-items-skipped",{ids:n.skipped}),n.id===null){F(this,"qc-test-end-reached",{});return}r=n.id}}r&&this.navigateTo(this.navigate,r)}_isLinearNavigationRestricted(r,i){let n=this.sessionContext?.navItemRefId;if(!n||r==="item"&&i===n)return!1;let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${n}"]`);if(!s)return!1;let a=s.closest("qti-assessment-section"),c=s.closest("qti-test-part");if((a?.navigationMode||a?.getAttribute("navigation-mode")||c?.navigationMode||c?.getAttribute("navigation-mode")||"nonlinear")!=="linear")return!1;let d=Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref")||[]),h=d.findIndex(f=>f.identifier===n);if(r==="item"){let f=d.findIndex(m=>m.identifier===i);return f===-1||h===-1?!1:f!==h+1}return!0}_resolveLinearNext(r,i){if(r!=="item"||!this._testElement)return;let n=[...this._testElement.querySelectorAll("qti-assessment-item-ref")],s=n.findIndex(c=>Dt(c)===this.sessionContext?.navItemRefId);if(s<0||!n[s+1]||Dt(n[s+1])!==i||n[s].closest("qti-test-part")?.getAttribute("navigation-mode")!=="linear")return;let a=Bd(n,s);if(a.id!==i)return a}async _handleNavigationRequest({detail:r}){if(!r?.id)return;let i=this._resolveLinearNext(r.type,r.id);if(i?.id===null){i.skipped.length&&F(this,"qc-test-items-skipped",{ids:i.skipped}),F(this,"qc-test-end-reached",{});return}let n=i?.id??r.id;if(!i&&this._isLinearNavigationRestricted(r.type,n)){this._handleNavigationError(new Error("Navigation restricted in linear mode"),r.type,r.id);return}this._cancelPreviousNavigation();let s=++this._navigationId,a=new AbortController;try{this._dispatchLoadingStarted(r.type,n),this._activeController=a,await this._executeNavigation(r.type,n,s,a),i?.skipped.length&&s===this._navigationId&&!a.signal.aborted&&F(this,"qc-test-items-skipped",{ids:i.skipped})}catch(c){this._handleNavigationError(c,r.type,n)}finally{this._activeController===a&&(this._activeController=null),this._dispatchLoadingEnded(r.type,n)}}_handleNavigationError(r,i,n){r.name!=="AbortError"&&this._dispatchError(this._createNavigationError(r,i,n))}async _executeNavigation(r,i,n,s){r==="item"?await this._navigateToItem(i,n,s):await this._navigateToSection(i,n,s)}async _navigateToItem(r,i,n){let s=this._findItemRef(r);this._updateSessionContext(s,r),this._resetLoadingState(),this._loadingState.expectedItems=1,await this._loadItems([r],i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"item",r)}async _navigateToSection(r,i,n){let a=this._findSection(r)?.closest("qti-test-part")?.identifier,c=this._getSectionItemIds(r);this.sessionContext={...this.sessionContext,navPartId:a,navSectionId:r,navItemRefId:this.navigate==="item"?c[0]??null:null},this._resetLoadingState(),this._loadingState.expectedItems=c.length,await this._loadItems(c,i,n),await this._waitForLoadingComplete(i,n),!this._isStaleNavigation(i,n)&&this._dispatchTestLoaded(this._loadResults,"section",r)}_resetLoadingState(){this._loadingState={expectedItems:0,connectedItems:0,expectedStimulus:0,loadedStimulus:0,isComplete:!1},this._loadedStimulusHrefs.clear(),this._loadingStimulusHrefs.clear()}_checkLoadingComplete(){let r=this._loadingState.connectedItems>=this._loadingState.expectedItems,i=this._loadingState.loadedStimulus>=this._loadingState.expectedStimulus;r&&i&&!this._loadingState.isComplete&&(this._loadingState.isComplete=!0)}async _waitForLoadingComplete(r,i){for(;!this._loadingState.isComplete;){if(this._isStaleNavigation(r,i))return;await new Promise(n=>setTimeout(n,10))}}getLoadingProgress(){return{...this._loadingState}}async _loadStimulusRef(r,i){console.info("Loading stimulus:",r.href);let n=await this._loadStimulus(r.href);console.info("Stimulus loaded, applying content:",n?"has content":"no content"),this._applyStimulusContent(n,r,i)}_applyStimulusContent(r,i,n){if(!r){console.warn("No stimulus content to apply");return}let s=r.querySelector("qti-assessment-stimulus");if(!s){console.warn("No qti-assessment-stimulus element found in stimulus");return}let a=[],c=n.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="",l.append(s.cloneNode(!0)),console.info(`Applied stimulus content to target ${d+1}/${a.length}`)})}_cancelPreviousNavigation(){this._activeController&&(this._activeController.abort(),console.info("Previous navigation request cancelled")),this._clearNavigationState()}_clearNavigationState(){this._clearLoadedItems(),this._resetLoadingState(),this._loadResults=[]}async _loadItems(r,i,n){if(!this._testElement||r.length===0)return;let s=r.map(l=>this._findItemRef(l));this._clearLoadedItems(),this._clearStimulusRef();let c=(await Promise.all(s.map(l=>this._loadSingleItem(l,i,n)))).filter(Boolean);this._isStaleNavigation(i,n)||(c.forEach(({itemRef:l,doc:d})=>{l&&d&&(l.xmlDoc=d)}),c.forEach(({itemRef:l})=>{let d=l?.identifier;if(!l||!d)return;let h=this.testContext.items.find(f=>f.identifier===d)?.state;h!==void 0&&l.updateComplete.then(()=>{let f=l.assessmentItem;f&&(f.state=h)})}),this._loadResults=c)}async _loadSingleItem(r,i,n){try{let s=this.qtiContext?.QTI_CONTEXT?.seed,a=(await Gt().load(r.href,n.signal)).shuffleInteractions(s);return this.postLoadTransformCallback&&(a=await this.postLoadTransformCallback(a,r)),this._isStaleNavigation(i,n)?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 Gt().load(r,this._activeController?.signal)).htmlDoc(this._customElementRegistry())}_customElementRegistry(){let r=this.querySelector("test-container");if(r)return r.customElementRegistry??void 0}_findItemRef(r){let i=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${r}"]`);if(!i)throw new Error(`Item with identifier "${r}" not found`);return i}_findSection(r){return this._testElement?.querySelector(`qti-assessment-section[identifier="${r}"]`)||null}_updateSessionContext(r,i){let n=r.closest("qti-test-part")?.identifier,s=r.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:s,navItemRefId:i}}_getSectionItemIds(r){return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${r}"] > qti-assessment-item-ref`)).map(i=>i.identifier).filter(Boolean)}_clearLoadedItems(){let r=this._testElement?.querySelectorAll("qti-assessment-item-ref");Array.from(r||[]).forEach(i=>{i.xmlDoc=null})}_clearStimulusRef(){this.querySelectorAll("[data-stimulus-idref]").forEach(r=>r.innerHTML="")}_isStaleNavigation(r,i){return i.signal.aborted||r!==this._navigationId}_createNavigationError(r,i,n){return{message:r.message||`Failed to load ${i}: ${n}`,details:r,itemId:i==="item"?n:void 0,sectionId:i==="section"?n:void 0}}_dispatchLoadingStarted(r,i){F(this,"qc-test-navigation-started",{type:r,id:i})}_dispatchLoadingEnded(r,i){this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended",{detail:{type:r,id:i},bubbles:!0,composed:!0}))}_dispatchError(r){F(this,"qc-test-navigation-failed",r)}_dispatchTestLoaded(r,i,n){requestAnimationFrame(()=>{F(this,"qc-test-rendered",r.map(({itemRef:s})=>({identifier:s?.identifier,element:s}))),F(this,"qc-test-navigated",{type:i,id:n})})}}return 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 Qd=o=>{class t extends o{constructor(...r){super(...r),this.sessionContext={...this.sessionContext,view:"candidate"},B(this,"qc-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),B(this,"qc-test-loaded",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(r){super.willUpdate(r),r.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(s=>{s.classList.toggle("show",s.getAttribute("view")===this.sessionContext.view)});let n=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;n&&this.updateAssessmentItemView(n,this.sessionContext.view)}}_setCorrectResponseVisibility(r){this.updateAssessmentItemView(r,this.sessionContext.view)}updateAssessmentItemView(r,i){}}return t};var Xd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lc=o=>{class t extends o{constructor(...r){super(...r),this.testContext=Ua,this.sessionContext=Ba,this._updateItemInTestContext=i=>{let n=i.itemContext,s=n.identifier,a=n.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,void 0,n.valid);else{let l=[...i.variables];for(let d of c.variables){if(d.identifier==="completionStatus"&&d.value==="not_attempted")continue;let h=l.find(f=>f.identifier===d.identifier);h?h.value=d.value:l.push(d)}i.variables=l,this.#t(s,l.find(d=>d.identifier==="completionStatus")?.value),c.state&&(i.state=c.state)}},this._initializeEventListeners()}updateItemVariables(r,i,n){this.testContext={...this.testContext,items:this.testContext.items.map(a=>{if(a.identifier!==r)return a;let c=[...a.variables??[]];for(let{identifier:l,type:d,value:h}of i){let f=c.findIndex(y=>y.identifier===l),m={...f>=0?c[f]:{},identifier:l,...d?{type:d}:{},value:Array.isArray(h)?[...h]:h};f>=0?c[f]=m:c.push(m)}return{...a,variables:c,...n?{state:{...n}}:{}}})};let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(r)}"]`)?.assessmentItem;s&&(s.variables=[...this.testContext.items.find(a=>a.identifier===r)?.variables??[]],n&&(s.state=n))}_initializeEventListeners(){this.addEventListener("qti-testdoc-loaded",()=>{this.testContext=Ua,this.sessionContext=Ba}),B(this,"qc-test-loaded",r=>{this._testElement=r.detail;let i=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(n=>({href:n.href,identifier:n.identifier,category:n.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:i}}),this.addEventListener("qti-assessment-item-connected",r=>{let i=r.detail,n=i.closest("qti-assessment-item-ref")?.identifier;n&&(i.assessmentItemRefId=n),this._updateItemInTestContext(r.detail)}),this.addEventListener("qti-item-context-updated",r=>{this._updateItemVariablesInTestContext(r.detail.itemContext.identifier,r.detail.itemContext.variables,r.detail.itemContext.state,r.detail.itemContext.valid)})}_updateItemVariablesInTestContext(r,i,n,s){this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:i.map(c=>{let l=a.variables.find(d=>d.identifier===c.identifier);return l?{...l,...c}:c}),...n!==void 0?{state:n?{...n}:void 0}:{},...s!==void 0?{valid:s}:{}})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}#t(r,i){typeof i!="string"||i==="not_attempted"||this.testContext.items.find(a=>a.identifier===r)?.variables.find(a=>a.identifier==="completionStatus")?.value!=="not_attempted"||(this.testContext={...this.testContext,items:this.testContext.items.map(a=>a.identifier!==r?a:{...a,variables:a.variables.map(c=>c.identifier==="completionStatus"?{...c,value:i}:c)})})}}return Xd([p({attribute:!1,type:Object}),J({context:nt})],t.prototype,"testContext",void 0),Xd([p({attribute:!1,type:Object}),J({context:Jn})],t.prototype,"sessionContext",void 0),t},Gd=class extends lc(S){};var Co=1;var dc=o=>Array.isArray(o)?[...o]:o??null,ym=o=>{let t=o;return t?.version===1&&Array.isArray(t.test?.items)&&Array.isArray(t.test?.outcomes)&&typeof t.session=="object"&&t.session!==null},qm=(o,t)=>({version:1,test:{items:(o?.items??[]).filter(e=>e.identifier).map(e=>({identifier:e.identifier,variables:(e.variables??[]).map(r=>({identifier:r.identifier,...r.type?{type:r.type}:{},value:dc(r.value)})),...e.state?{state:{...e.state}}:{}})),outcomes:(o?.testOutcomeVariables??[]).map(e=>({identifier:e.identifier,value:dc(e.value)}))},session:{...t?.plugins&&Object.keys(t.plugins).length>0?{plugins:{...t.plugins}}:{},...t?.navPartId!==void 0?{navPartId:t.navPartId}:{},...t?.navSectionId!==void 0?{navSectionId:t.navSectionId}:{},...t?.navItemRefId!==void 0?{navItemRefId:t.navItemRefId}:{}}}),Jd=o=>{class t extends o{#t=null;#e=!1;#r=null;constructor(...r){super(...r),this.addEventListener("qti-testdoc-loaded",()=>{this.#e=!1,this.#r=null}),B(this,"qc-test-update-plugin-state",({detail:i})=>this.#i(i)),B(this,"qc-test-loaded",()=>{this.#t&&(this.#n(this.#t),this.#t=null),this.#e=!0})}#i({plugin:r,value:i}){if(typeof r!="string"||r==="")return;let{[r]:n,...s}=this.sessionContext.plugins??{},a=s;if(i!=null)try{a={...s,[r]:JSON.parse(JSON.stringify(i))}}catch{console.warn(`[qti-test] Ignoring plugin state for "${r}": it is not JSON.`);return}this.sessionContext={...this.sessionContext,plugins:a}}get state(){return qm(this.testContext,this.sessionContext)}set state(r){if(!ym(r)){console.warn(`[qti-test] Ignoring a state that is not a version ${1} QtiTestState.`);return}if(!this.#e){this.#t=r;return}let{navItemRefId:i,navSectionId:n}=this.sessionContext;this.#n(r);let s=this.sessionContext;s.navItemRefId&&s.navItemRefId!==i?this.#s("item",s.navItemRefId):!s.navItemRefId&&s.navSectionId&&s.navSectionId!==n&&this.#s("section",s.navSectionId)}updated(r){if(super.updated(r),!this.#e||!(r.has("testContext")||r.has("sessionContext")))return;let i=this.state,n=JSON.stringify(i);n!==this.#r&&(this.#r=n,F(this,"qc-test-state-changed",i))}#n(r){for(let n of r.test.items)this.updateItemVariables(n.identifier,n.variables,n.state);let i=new Map(r.test.outcomes.map(n=>[n.identifier,n.value]));this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>i.has(n.identifier)?{...n,value:dc(i.get(n.identifier))}:n)},this.sessionContext={...this.sessionContext,...this.#o(r.session),plugins:r.session.plugins&&typeof r.session.plugins=="object"?{...r.session.plugins}:{}}}#o(r){let i=(n,s)=>!!s&&!!this._testElement?.querySelector(`${n}[identifier="${CSS.escape(s)}"]`);return{...i("qti-test-part",r.navPartId)?{navPartId:r.navPartId}:{},...i("qti-assessment-section",r.navSectionId)?{navSectionId:r.navSectionId}:{},...this.testContext.items.some(n=>n.identifier===r.navItemRefId)?{navItemRefId:r.navItemRefId}:{}}}#s(r,i){F(this,"qc-test-navigate",{type:r,id:i})}}return t};var Yd=o=>{class t extends o{constructor(...r){super(...r),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),B(this,"qc-test-submit",()=>this.submit()),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:n,value:s}=i.detail;this.updateOutcomeVariable(n,s),i.stopPropagation()})}outcomeProcessing(){let r=(this._testElement??this).querySelector("qti-outcome-processing");return r?(this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(i=>({...i,value:i.defaultValue??null}))},r.process(),!0):!1}submit(){return this.outcomeProcessing()?(F(this,"qc-test-submitted",{}),!0):!1}getTestFeedback(r){return Array.from((this._testElement??this).querySelectorAll("qti-test-feedback")??[]).filter(n=>(!r||n.access===r)&&n.matches(this.getOutcome(n.outcomeIdentifier)?.value))}updateOutcomeVariable(r,i){let n=this.getOutcome(r);if(!n){console.warn(`Can not set qti-outcome-identifier: ${r}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(s=>s.identifier!==r?s:{...s,value:n.cardinality==="single"?i:[...s.value,i]})}}getOutcome(r){return this.getVariable(r)}getVariable(r){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===r)||null}}return t};var Kd=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ie=class extends Wd(Qd(Yd(Jd(lc(S))))){constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},new Bt(this,{context:Ce,initialValue:this})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return v`<slot></slot>`}};Kd([T(),J({context:yt})],Ie.prototype,"configContext",void 0);Kd([T(),J({context:qt})],Ie.prototype,"qtiContext",void 0);var ko=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},So=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 Zd=o=>!Nd(o)&&typeof o.then=="function",th=1073741823,hc=class extends Te{constructor(){super(...arguments),this._$Cwt=th,this._$Cbt=[],this._$CK=new ko(this),this._$CX=new So}render(...t){return t.find(e=>!Zd(e))??it}update(t,e){let r=this._$Cbt,i=r.length;this._$Cbt=e;let n=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let c=e[a];if(!Zd(c))return this._$Cwt=a,c;a<i&&c===r[a]||(this._$Cwt=th,i=0,Promise.resolve(c).then(async l=>{for(;s.get();)await s.get();let d=n.deref();if(d!==void 0){let h=d._$Cbt.indexOf(c);h>-1&&h<d._$Cwt&&(d._$Cwt=h,d.setValue(l))}}))}return it}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Eo=Ot(hc);var Ao=`
|
|
225
225
|
@layer qti-base, qti-components, qti-extended;
|
|
226
226
|
|
|
227
227
|
@layer qti-components.reset, qti-components.global, qti-components.interactions.base,
|
|
@@ -6307,16 +6307,16 @@ div.full-correct-response-inline {
|
|
|
6307
6307
|
display: inline-block;
|
|
6308
6308
|
}
|
|
6309
6309
|
}
|
|
6310
|
-
`;var Me=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},St=class extends S{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 Fr().load(this.testURL)).shuffleOrdering(t),r=this.testHost;if(r?.postLoadTestTransformCallback){let n=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");n&&(e=await r.postLoadTestTransformCallback(e,n))}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(Fr().parse(this.testXML).shuffleOrdering(t).htmlDoc(this.#e??void 0))}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#i(),this.#n(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:v``}#n(){let t=new CSSStyleSheet;t.replaceSync(
|
|
6310
|
+
`;var Me=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},St=class extends S{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 Fr().load(this.testURL)).shuffleOrdering(t),r=this.testHost;if(r?.postLoadTestTransformCallback){let n=e.htmlDoc(this.#e??void 0).querySelector("qti-assessment-test");n&&(e=await r.postLoadTestTransformCallback(e,n))}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(Fr().parse(this.testXML).shuffleOrdering(t).htmlDoc(this.#e??void 0))}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#i(),this.#n(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}#i(){let t=this.querySelector("template");this.#t=t?t.content:v``}#n(){let t=new CSSStyleSheet;t.replaceSync(Ao),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
|
|
6311
6311
|
${this.#t}
|
|
6312
6312
|
<slot></slot>
|
|
6313
|
-
${
|
|
6314
|
-
`}};Me([p({attribute:!1})],St.prototype,"customElementRegistry",void 0);Me([p({type:String,attribute:"test-url"})],St.prototype,"testURL",void 0);Me([T()],St.prototype,"testDoc",void 0);Me([T()],St.prototype,"testXML",void 0);Me([R({context:Ce,subscribe:!0})],St.prototype,"testHost",void 0);Me([T(),R({context:qt,subscribe:!0})],St.prototype,"qtiContext",void 0);Me([N("testURL",{waitUntilFirstUpdate:!0})],St.prototype,"handleTestURLChange",null);Me([N("testXML",{waitUntilFirstUpdate:!0})],St.prototype,"handleTestXMLChange",null);var
|
|
6313
|
+
${Eo(this.testDoc,v`<span>Loading...</span>`)}
|
|
6314
|
+
`}};Me([p({attribute:!1})],St.prototype,"customElementRegistry",void 0);Me([p({type:String,attribute:"test-url"})],St.prototype,"testURL",void 0);Me([T()],St.prototype,"testDoc",void 0);Me([T()],St.prototype,"testXML",void 0);Me([R({context:Ce,subscribe:!0})],St.prototype,"testHost",void 0);Me([T(),R({context:qt,subscribe:!0})],St.prototype,"qtiContext",void 0);Me([N("testURL",{waitUntilFirstUpdate:!0})],St.prototype,"handleTestURLChange",null);Me([N("testXML",{waitUntilFirstUpdate:!0})],St.prototype,"handleTestXMLChange",null);var _o=w`var(--qti-color-base-100, var(--qc-color-base-100, var(--cito-color-base-100, Canvas)))`,pc=w`var(--qti-color-base-content, var(--qc-color-base-content, var(--cito-color-base-content, CanvasText)))`,To=w`var(--qti-color-neutral, var(--qc-color-neutral, var(--cito-color-neutral, CanvasText)))`,uc=w`var(--qti-color-neutral-content, var(--qc-color-neutral-content, var(--cito-color-neutral-content, Canvas)))`,eh=w`var(--button-border-radius, var(--test-button-border-radius, var(--qti-radius-field, var(--qc-radius-field, var(--cito-radius-field, 0.2rem)))))`,rh=w`var(--qti-border-width, var(--qc-border-width, var(--cito-border-width, 1px)))`,xm=w`
|
|
6315
6315
|
display: inline-flex;
|
|
6316
6316
|
cursor: pointer;
|
|
6317
6317
|
user-select: none;
|
|
6318
|
-
border-radius: ${
|
|
6319
|
-
`,
|
|
6318
|
+
border-radius: ${eh};
|
|
6319
|
+
`,ih=w`
|
|
6320
6320
|
display: flex;
|
|
6321
6321
|
flex: 1 1 auto;
|
|
6322
6322
|
align-items: center;
|
|
@@ -6329,69 +6329,69 @@ div.full-correct-response-inline {
|
|
|
6329
6329
|
line-height: 1.25;
|
|
6330
6330
|
cursor: pointer;
|
|
6331
6331
|
user-select: none;
|
|
6332
|
-
border-radius: ${
|
|
6333
|
-
`,
|
|
6334
|
-
${
|
|
6335
|
-
background-color: var(--button-background-color, var(--test-button-background-color, ${
|
|
6332
|
+
border-radius: ${eh};
|
|
6333
|
+
`,wm=w`
|
|
6334
|
+
${ih};
|
|
6335
|
+
background-color: var(--button-background-color, var(--test-button-background-color, ${_o}));
|
|
6336
6336
|
color: var(--button-color, var(--test-button-color, inherit));
|
|
6337
|
-
border: ${
|
|
6337
|
+
border: ${rh} solid
|
|
6338
6338
|
var(
|
|
6339
6339
|
--button-border-color,
|
|
6340
|
-
var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${
|
|
6340
|
+
var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${pc} 45%, ${_o})))
|
|
6341
6341
|
);
|
|
6342
|
-
`,
|
|
6343
|
-
background-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${
|
|
6344
|
-
color: var(--button-primary-color, var(--test-button-primary-color, ${
|
|
6345
|
-
border-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${
|
|
6346
|
-
`,
|
|
6342
|
+
`,Cm=w`
|
|
6343
|
+
background-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${To}));
|
|
6344
|
+
color: var(--button-primary-color, var(--test-button-primary-color, ${uc}));
|
|
6345
|
+
border-color: var(--button-primary-background-color, var(--test-button-primary-background-color, ${To}));
|
|
6346
|
+
`,km=w`
|
|
6347
6347
|
background-color: var(
|
|
6348
6348
|
--button-hover-background-color,
|
|
6349
|
-
var(--test-button-hover-background-color, color-mix(in oklab, ${
|
|
6349
|
+
var(--test-button-hover-background-color, color-mix(in oklab, ${_o}, ${pc} var(--qti-hover-mix, 8%)))
|
|
6350
6350
|
);
|
|
6351
|
-
`,
|
|
6351
|
+
`,Sm=w`
|
|
6352
6352
|
background-color: var(
|
|
6353
6353
|
--button-primary-hover-background-color,
|
|
6354
6354
|
var(
|
|
6355
6355
|
--test-button-primary-hover-background-color,
|
|
6356
|
-
color-mix(in oklab, ${
|
|
6356
|
+
color-mix(in oklab, ${To}, ${uc} var(--qti-hover-mix, 8%))
|
|
6357
6357
|
)
|
|
6358
6358
|
);
|
|
6359
|
-
`,
|
|
6359
|
+
`,Em=w`
|
|
6360
6360
|
background-color: var(
|
|
6361
6361
|
--button-active-background-color,
|
|
6362
|
-
var(--test-button-active-background-color, color-mix(in oklab, ${
|
|
6362
|
+
var(--test-button-active-background-color, color-mix(in oklab, ${_o}, ${pc} var(--qti-active-mix, 16%)))
|
|
6363
6363
|
);
|
|
6364
|
-
`,
|
|
6364
|
+
`,Am=w`
|
|
6365
6365
|
background-color: var(
|
|
6366
6366
|
--button-primary-active-background-color,
|
|
6367
6367
|
var(
|
|
6368
6368
|
--test-button-primary-active-background-color,
|
|
6369
|
-
color-mix(in oklab, ${
|
|
6369
|
+
color-mix(in oklab, ${To}, ${uc} var(--qti-active-mix, 16%))
|
|
6370
6370
|
)
|
|
6371
6371
|
);
|
|
6372
|
-
`,
|
|
6372
|
+
`,_m=w`
|
|
6373
6373
|
outline: var(--qti-focus-border-width, 2px) solid var(--qti-focus-color, Highlight);
|
|
6374
6374
|
outline-offset: var(--qti-focus-offset, 2px);
|
|
6375
|
-
`,
|
|
6375
|
+
`,Tm=w`
|
|
6376
6376
|
cursor: not-allowed;
|
|
6377
6377
|
opacity: 0.45;
|
|
6378
|
-
`,
|
|
6379
|
-
${
|
|
6380
|
-
border: ${
|
|
6378
|
+
`,Sk=w`
|
|
6379
|
+
${ih};
|
|
6380
|
+
border: ${rh} solid var(--qti-border-color, GrayText);
|
|
6381
6381
|
`,Pe=v`<span class="control" part="button"><slot></slot></span>`,Oe=w`
|
|
6382
6382
|
:host {
|
|
6383
|
-
${
|
|
6383
|
+
${xm};
|
|
6384
6384
|
}
|
|
6385
6385
|
.control {
|
|
6386
|
-
${
|
|
6386
|
+
${wm};
|
|
6387
6387
|
}
|
|
6388
6388
|
@media (hover: hover) and (pointer: fine) {
|
|
6389
6389
|
:host(:hover:not([disabled])) .control {
|
|
6390
|
-
${
|
|
6390
|
+
${km};
|
|
6391
6391
|
}
|
|
6392
6392
|
}
|
|
6393
6393
|
:host(:active:not([disabled])) .control {
|
|
6394
|
-
${
|
|
6394
|
+
${Em};
|
|
6395
6395
|
}
|
|
6396
6396
|
/* The press the theme gives a choice (qti-motion.css), from the same knob: a touch smaller while
|
|
6397
6397
|
the button is down, springing back on release; 0 motion means no press. */
|
|
@@ -6404,31 +6404,31 @@ div.full-correct-response-inline {
|
|
|
6404
6404
|
scale: calc(1 - 0.03 * var(--qti-motion, 1));
|
|
6405
6405
|
}
|
|
6406
6406
|
:host(:focus-visible) {
|
|
6407
|
-
${
|
|
6407
|
+
${_m};
|
|
6408
6408
|
}
|
|
6409
6409
|
:host([disabled]) {
|
|
6410
|
-
${
|
|
6410
|
+
${Tm};
|
|
6411
6411
|
}
|
|
6412
6412
|
:host([disabled]) .control {
|
|
6413
6413
|
cursor: not-allowed;
|
|
6414
6414
|
}
|
|
6415
|
-
`,
|
|
6415
|
+
`,nh=w`
|
|
6416
6416
|
.control {
|
|
6417
|
-
${
|
|
6417
|
+
${Cm};
|
|
6418
6418
|
}
|
|
6419
6419
|
@media (hover: hover) and (pointer: fine) {
|
|
6420
6420
|
:host(:hover:not([disabled])) .control {
|
|
6421
|
-
${
|
|
6421
|
+
${Sm};
|
|
6422
6422
|
}
|
|
6423
6423
|
}
|
|
6424
6424
|
:host(:active:not([disabled])) .control {
|
|
6425
|
-
${
|
|
6425
|
+
${Am};
|
|
6426
6426
|
}
|
|
6427
|
-
`;var Zi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},eh=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?eh(e.host):void 0},me=class extends S{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=Oe}constructor(){super(),this._internalDisabled=!1,this.requireAnswer=!1,this.addEventListener("click",t=>{if(t.preventDefault(),!this._internalDisabled){let e=this.#t;F(this,"qc-test-end-attempt",e?{itemId:e}:{})}})}get#t(){return this.item||eh(this)}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts,e=this.#t,r=t?.find(a=>a.active);if(!t||!e&&!r)return;let i=e?t.flatMap(a=>a.sections.flatMap(c=>c.items)).find(a=>a.identifier===e):r.sections.flatMap(a=>a.items).find(a=>a.active);if(!i){this._internalDisabled=!1;return}let n=i.maxAttempts??1,s=i.numAttempts||0;if(!i.adaptive&&i.optimal){this._internalDisabled=!0;return}if(i.adaptive&&i.completionStatus==="completed"){this._internalDisabled=!0;return}if(!i.adaptive&&n>0&&s>=n){this._internalDisabled=!0;return}this.requireAnswer||i.allowSkipping===!1?this._internalDisabled=i.valid===!1||i.isDefaultResponse:this._internalDisabled=!1}render(){return Pe}};Zi([R({context:ct,subscribe:!0}),p({attribute:!1})],me.prototype,"computedContext",void 0);Zi([p({type:Boolean,reflect:!0,attribute:"disabled"})],me.prototype,"_internalDisabled",void 0);Zi([p({reflect:!0})],me.prototype,"item",void 0);Zi([p({type:Boolean,reflect:!0,attribute:"require-answer"})],me.prototype,"requireAnswer",void 0);Zi([N("computedContext")],me.prototype,"_handleTestElementChange",null);var or=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Em=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),mt=class extends S{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=Em())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#r(t)}#t;#e;#r(t){let e=this.#n();e?e.qtiContext=t:this.#t=t}#i;#n(){return this.#i.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#i=new at(this,{context:Ce,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#p=t=>this.#c(t)??null,this.#b=new WeakSet,B(this,"qc-test-loaded",this.#u.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#m.bind(this)),id(this,"qc-item-response-changed",this.#h.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),B(this,"qc-test-end-attempt",this.#l.bind(this)),B(this,"qc-test-update-outcome",this.#d.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=this.#q(e);this.#s.set(e.identifier,r);let i=this.computedItemFor(e.identifier),n=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,this.#y(n,r,i?.maxAttempts,i?.adaptive,s))}afterAttemptEnded(t,e,r){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#c(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#p;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#l(t){let e=t.detail?.itemId,r=e?this.#c(e):this.activeAssessmentItem;if(!r)return;let i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#d(t){let e=this.#c(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#h(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}}}render(){return v`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#r({QTI_CONTEXT:{...i,testIdentifier:this.#o.identifier,environmentIdentifier:i.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=this.#g(i);Object.keys(n).length>0&&this.#r({QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let r=Array.from(this.#o?.querySelectorAll("qti-test-part")||[]);this.computedContext={itemElement:this.#p,identifier:this.#o.identifier,title:this.#o.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:r.map(i=>{let n=[...i.querySelectorAll("qti-assessment-section")],s=i.querySelector(":scope > qti-item-session-control"),a=s?s.allowSkipping:!0,c=s?s.maxAttempts:1,l=s?s.showFeedback:!1,d=s?s.showSolution:!1;return{active:!1,identifier:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,allowSkipping:a,sections:n.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),y=m?m.allowSkipping:a,x=m?m.maxAttempts:c,u=m?m.showFeedback:l,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:y,items:f.map(b=>{let q=b.querySelector(":scope > qti-item-session-control"),_=q?q.allowSkipping:y,A=q?q.maxAttempts:x,C=q?q.showFeedback:u,k=q?q.showSolution:g;return{...this.initContext?.find(I=>I.identifier===b.identifier),active:!1,identifier:b.identifier,categories:b.category?b.category?.split(" "):[],href:b.href,variables:[],allowSkipping:_,maxAttempts:A,showFeedback:C,showSolution:k}})}})}})}}#g(t){let e={},r=t.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let s=n.getAttribute("field-identifier"),a=n.getAttribute("base-type")||"string",c=n.textContent?.trim()||"";if(s){let l=c;switch(a){case"integer":l=parseInt(c,10);break;case"float":case"duration":l=parseFloat(c);break;case"boolean":l=c.toLowerCase()==="true";break;default:l=c;break}e[s]=l}}),e}#m(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(n=>{if(n.identifier!==e.parentElement.getAttribute("identifier"))return n;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),c=e.querySelectorAll("qti-response-declaration"),l=Array.from(c).some(m=>m.querySelector("qti-correct-response")),d=Array.from(c).some(m=>{let y=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return y?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=l||d,f=!!e.querySelector("qti-response-processing");return{...n,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,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(r=>({...r,active:this._sessionContext?.navPartId===r.identifier||!1,sections:r.sections.map(i=>({...i,active:this._sessionContext?.navSectionId===i.identifier||!1,completed:i.items.every(n=>this._testContext.items.find(s=>s.identifier===n.identifier)?.variables.find(s=>s.identifier==="completionStatus")?.value==="completed"),items:i.items.map(n=>{let s=this._testContext?.items.find(C=>C.identifier===n.identifier),a={...n,...s,...this.initContext?.find(C=>C.identifier===n.identifier)},c=a.variables?.find(C=>C.identifier=="SCORE")?.value,l=c==null?null:parseFloat(c?.toString()),d=a.variables?.find(C=>C.identifier==="completionStatus")?.value,h=a.variables?.find(C=>C.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(C=>C.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(C=>C.type==="response"&&C.identifier!=="numAttempts")||[]).every(C=>{if(C.value===void 0||C.value===null)return!0;let k;switch(C.baseType){case"integer":case"float":case"duration":k="0";break;case"boolean":k="false";break;default:k="";break}let I=C.defaultValue??k;if(Array.isArray(C.value)){let $=Array.isArray(I)?I:[I];return C.value.length===$.length&&C.value.every((V,L)=>V===$[L])}return C.value===I}),g=n.categories.includes(this.configContext?.infoItemCategory)?null:e++,b=n.variables?.find(C=>C.identifier=="MAXSCORE")?.value,q=b==null?null:parseFloat(b?.toString()),_=this.#s.get(a.identifier);_===void 0&&(_=s?this.#q(s):"unscored",f>0&&this.#s.set(a.identifier,_));let A=this.#y(f,_,a.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:l,response:h,index:g,active:m,valid:y,isDefaultResponse:u,maxScore:q,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}updated(t){super.updated(t),this.#f()}#b;#f(){if(!this.#o||!this.computedContext)return;let t=new Map(this.computedContext.testParts.flatMap(e=>e.sections.flatMap(r=>(r.submissionMode||e.submissionMode)==="simultaneous"?[]:r.items.map(i=>[i.identifier,i]))));for(let e of this.#o.querySelectorAll("qti-assessment-item-ref")){let r=e.assessmentItem;if(!r)continue;let i=this.#v(t.get(e.identifier),r);i&&!r.disabled?(r.disabled=!0,this.#b.add(r)):!i&&this.#b.has(r)&&(this.#b.delete(r),r.disabled=!1)}}#v(t,e){if(!t||this.autoScoreItems||t.adaptive||e.adaptive==="true")return!1;let r=t.maxAttempts??1;return r>0&&(t.numAttempts??0)>=r}#y(t,e,r,i,n){if(t===0)return!1;if(i)return n==="completed";if(e!=="suboptimal")return!0;let s=r??1;return s>0&&t>=s}#q(t){let e=t.variables??[],r=this.#x(e,"SCORE"),i=this.#x(e,"MAXSCORE");if(r!==null&&i!==null)return r>=i?"optimal":"suboptimal";let n=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return n.length===0?"unscored":n.every(a=>{let c=a.correctResponse,l=a.value;return l==null?!1:Array.isArray(c)&&Array.isArray(l)?c.length===l.length&&c.every(d=>l.includes(d)):Array.isArray(c)||Array.isArray(l)?!1:c===l})?"optimal":"suboptimal"}#x(t,e){let r=t?.find(n=>n.identifier===e)?.value;if(r==null||Array.isArray(r))return null;let i=parseFloat(r.toString());return Number.isNaN(i)?null:i}};or([p({type:String})],mt.prototype,"identifier",void 0);or([T()],mt.prototype,"initContext",void 0);or([T(),R({context:yt,subscribe:!0})],mt.prototype,"configContext",void 0);or([T(),R({context:nt,subscribe:!0})],mt.prototype,"_testContext",void 0);or([T(),R({context:Qn,subscribe:!0})],mt.prototype,"_sessionContext",void 0);or([T(),J({context:ct})],mt.prototype,"computedContext",void 0);or([p({type:Boolean,attribute:"auto-score-items"})],mt.prototype,"autoScoreItems",void 0);var dc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},sr=class extends S{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[Oe,th]}#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,n=this.sectionItems[this.itemIndex],s=r==="linear"&&i==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!n?.done}_requestItem(t){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return Pe}};dc([p({type:Boolean,reflect:!0,attribute:"disabled"})],sr.prototype,"_internalDisabled",void 0);dc([R({context:ct,subscribe:!0})],sr.prototype,"computedContext",void 0);dc([N("computedContext")],sr.prototype,"_handleTestElementChange",null);var hc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ar=class extends S{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=Oe}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){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return Pe}};hc([p({type:Boolean,reflect:!0,attribute:"disabled"})],ar.prototype,"_internalDisabled",void 0);hc([R({context:ct,subscribe:!0})],ar.prototype,"computedContext",void 0);hc([N("computedContext")],ar.prototype,"_handleTestElementChange",null);var _o=class extends S{static{this.styles=Oe}constructor(){super(),this.addEventListener("click",()=>F(this,"qc-test-submit",{}))}render(){return Pe}};var rh=[{tag:"test-submit",ctor:_o}];var ih=[{tag:"qti-assessment-item-ref",ctor:wt},{tag:"qti-assessment-section",ctor:Ct},{tag:"qti-assessment-test",ctor:rr},{tag:"qti-branch-rule",ctor:le},{tag:"qti-item-session-control",ctor:Pt},{tag:"qti-number-presented",ctor:Fi},{tag:"qti-number-selected",ctor:Yn},{tag:"qti-outcome-processing",ctor:Zn},{tag:"qti-pre-condition",ctor:Kn},{tag:"qti-test",ctor:Ie},{tag:"qti-test-feedback",ctor:Ji},{tag:"qti-test-part",ctor:Re},{tag:"qti-test-variables",ctor:Yi},{tag:"test-container",ctor:St},{tag:"test-end-attempt",ctor:me},{tag:"test-navigation",ctor:mt},{tag:"test-next",ctor:sr},{tag:"test-prev",ctor:ar},...rh];for(let{tag:o,ctor:t}of ih)customElements.get(o)||customElements.define(o,t);var XS=(o,t)=>o?.plugins?.[t];var cr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},$t=class extends S{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 Gt().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=Gt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#r(){let t=this.querySelector("template");this.#t=t?t.content:v``}#i(){let t=new CSSStyleSheet;t.replaceSync(ko),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
|
|
6427
|
+
`;var Zi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},oh=o=>{let t=o.closest("qti-assessment-item-ref");if(t)return t.getAttribute("identifier")??void 0;let e=o.getRootNode();return e instanceof ShadowRoot?oh(e.host):void 0},me=class extends S{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=Oe}constructor(){super(),this._internalDisabled=!1,this.requireAnswer=!1,this.addEventListener("click",t=>{if(t.preventDefault(),!this._internalDisabled){let e=this.#t;F(this,"qc-test-end-attempt",e?{itemId:e}:{})}})}get#t(){return this.item||oh(this)}willUpdate(t){this.checkDisabled()}checkDisabled(){let t=this.computedContext?.testParts,e=this.#t,r=t?.find(a=>a.active);if(!t||!e&&!r)return;let i=e?t.flatMap(a=>a.sections.flatMap(c=>c.items)).find(a=>a.identifier===e):r.sections.flatMap(a=>a.items).find(a=>a.active);if(!i){this._internalDisabled=!1;return}let n=i.maxAttempts??1,s=i.numAttempts||0;if(!i.adaptive&&i.optimal){this._internalDisabled=!0;return}if(i.adaptive&&i.completionStatus==="completed"){this._internalDisabled=!0;return}if(!i.adaptive&&n>0&&s>=n){this._internalDisabled=!0;return}this.requireAnswer||i.allowSkipping===!1?this._internalDisabled=i.valid===!1||i.isDefaultResponse:this._internalDisabled=!1}render(){return Pe}};Zi([R({context:ct,subscribe:!0}),p({attribute:!1})],me.prototype,"computedContext",void 0);Zi([p({type:Boolean,reflect:!0,attribute:"disabled"})],me.prototype,"_internalDisabled",void 0);Zi([p({reflect:!0})],me.prototype,"item",void 0);Zi([p({type:Boolean,reflect:!0,attribute:"require-answer"})],me.prototype,"requireAnswer",void 0);Zi([N("computedContext")],me.prototype,"_handleTestElementChange",null);var or=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Rm=()=>({QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}}),mt=class extends S{get qtiContext(){return this.#n()?.qtiContext??(this.#t??=Rm())}set qtiContext(t){this.#e||(this.#e=!0,console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.")),this.#r(t)}#t;#e;#r(t){let e=this.#n();e?e.qtiContext=t:this.#t=t}#i;#n(){return this.#i.value??null}#o;#s;constructor(){super(),this.identifier=void 0,this.initContext=[],this.#e=!1,this.#i=new at(this,{context:Ce,subscribe:!0,callback:t=>{t&&this.#t&&(t.qtiContext=this.#t,this.#t=void 0)}}),this.configContext={},this.autoScoreItems=!1,this.#s=new Map,this.#p=t=>this.#c(t)??null,this.#b=new WeakSet,B(this,"qc-test-loaded",this.#u.bind(this)),this.addEventListener("qti-assessment-item-connected",this.#m.bind(this)),ad(this,"qc-item-response-changed",this.#h.bind(this)),this.addEventListener("qti-item-context-updated",this.#a.bind(this)),B(this,"qc-test-end-attempt",this.#l.bind(this)),B(this,"qc-test-update-outcome",this.#d.bind(this))}#a(t){if(!t.detail?.responseProcessed)return;let e=t.detail.itemContext;if(!e?.identifier)return;let r=this.#q(e);this.#s.set(e.identifier,r);let i=this.computedItemFor(e.identifier),n=Number(e.variables?.find(a=>a.identifier==="numAttempts")?.value)||0,s=e.variables?.find(a=>a.identifier==="completionStatus")?.value;this.afterAttemptEnded(t.composedPath()[0]?.closest("qti-assessment-item"),i,this.#y(n,r,i?.maxAttempts,i?.adaptive,s))}afterAttemptEnded(t,e,r){}computedItemFor(t){return this.computedContext?.testParts?.flatMap(e=>e.sections).flatMap(e=>e.items).find(e=>e.identifier===t)}#c(t){return t?this.#o?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(t)}"]`)?.assessmentItem??void 0:void 0}#p;get activeAssessmentItem(){if(!(!this.#o||!this._sessionContext?.navItemRefId))return this.#o.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem}#l(t){let e=t.detail?.itemId,r=e?this.#c(e):this.activeAssessmentItem;if(!r)return;let i=this.configContext?.reportValidityAfterScoring===!0;r.processResponse(!0,i)}#d(t){let e=this.#c(t.detail?.assessmentItemRefId);e&&e.setOutcomeVariable(t.detail.outcomeVariableId,t.detail.value)}#h(t){if(this.autoScoreItems){let e=t.composedPath()[0].closest("qti-assessment-item");if(!e)return;let r=e.variables.find(i=>i.identifier==="SCORE");if(r&&r.externalScored===null&&e.adaptive==="false"){let i=this.configContext?.reportValidityAfterScoring===!0;e.processResponse(!0,i)}}}render(){return v`<slot></slot>`}#u(t){if(this.#o=t.detail,this.#s.clear(),!this.qtiContext.QTI_CONTEXT?.testIdentifier){let i=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.#r({QTI_CONTEXT:{...i,testIdentifier:this.#o.identifier,environmentIdentifier:i.environmentIdentifier||"default"}})}this.#o.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=this.#g(i);Object.keys(n).length>0&&this.#r({QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let r=Array.from(this.#o?.querySelectorAll("qti-test-part")||[]);this.computedContext={itemElement:this.#p,identifier:this.#o.identifier,title:this.#o.title,view:this._sessionContext?.view,plugins:this._sessionContext?.plugins??{},testParts:r.map(i=>{let n=[...i.querySelectorAll("qti-assessment-section")],s=i.querySelector(":scope > qti-item-session-control"),a=s?s.allowSkipping:!0,c=s?s.maxAttempts:1,l=s?s.showFeedback:!1,d=s?s.showSolution:!1;return{active:!1,identifier:i.identifier,navigationMode:i.navigationMode,submissionMode:i.submissionMode,allowSkipping:a,sections:n.map(h=>{let f=[...h.querySelectorAll("qti-assessment-item-ref")],m=h.querySelector(":scope > qti-item-session-control"),y=m?m.allowSkipping:a,x=m?m.maxAttempts:c,u=m?m.showFeedback:l,g=m?m.showSolution:d;return{active:!1,identifier:h.identifier,title:h.title,navigationMode:h.navigationMode,submissionMode:h.submissionMode,allowSkipping:y,items:f.map(b=>{let q=b.querySelector(":scope > qti-item-session-control"),_=q?q.allowSkipping:y,A=q?q.maxAttempts:x,C=q?q.showFeedback:u,k=q?q.showSolution:g;return{...this.initContext?.find(I=>I.identifier===b.identifier),active:!1,identifier:b.identifier,categories:b.category?b.category?.split(" "):[],href:b.href,variables:[],allowSkipping:_,maxAttempts:A,showFeedback:C,showSolution:k}})}})}})}}#g(t){let e={},r=t.querySelector("qti-default-value");return r&&r.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let s=n.getAttribute("field-identifier"),a=n.getAttribute("base-type")||"string",c=n.textContent?.trim()||"";if(s){let l=c;switch(a){case"integer":l=parseInt(c,10);break;case"float":case"duration":l=parseFloat(c);break;case"boolean":l=c.toLowerCase()==="true";break;default:l=c;break}e[s]=l}}),e}#m(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(n=>{if(n.identifier!==e.parentElement.getAttribute("identifier"))return n;let a=e.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),c=e.querySelectorAll("qti-response-declaration"),l=Array.from(c).some(m=>m.querySelector("qti-correct-response")),d=Array.from(c).some(m=>{let y=m.querySelector("qti-mapping"),x=m.querySelector("qti-area-mapping");return y?.querySelector("qti-map-entry")||x?.querySelector("qti-area-map-entry")}),h=l||d,f=!!e.querySelector("qti-response-processing");return{...n,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,plugins:this._sessionContext?.plugins??{},testParts:this.computedContext.testParts.map(r=>({...r,active:this._sessionContext?.navPartId===r.identifier||!1,sections:r.sections.map(i=>({...i,active:this._sessionContext?.navSectionId===i.identifier||!1,completed:i.items.every(n=>this._testContext.items.find(s=>s.identifier===n.identifier)?.variables.find(s=>s.identifier==="completionStatus")?.value==="completed"),items:i.items.map(n=>{let s=this._testContext?.items.find(C=>C.identifier===n.identifier),a={...n,...s,...this.initContext?.find(C=>C.identifier===n.identifier)},c=a.variables?.find(C=>C.identifier=="SCORE")?.value,l=c==null?null:parseFloat(c?.toString()),d=a.variables?.find(C=>C.identifier==="completionStatus")?.value,h=a.variables?.find(C=>C.identifier==="RESPONSE")?.value||"",f=Number(a.variables?.find(C=>C.identifier==="numAttempts")?.value)||0,m=this._sessionContext?.navItemRefId===a.identifier||!1,y=s?.valid??!0,u=(s?.variables?.filter(C=>C.type==="response"&&C.identifier!=="numAttempts")||[]).every(C=>{if(C.value===void 0||C.value===null)return!0;let k;switch(C.baseType){case"integer":case"float":case"duration":k="0";break;case"boolean":k="false";break;default:k="";break}let I=C.defaultValue??k;if(Array.isArray(C.value)){let $=Array.isArray(I)?I:[I];return C.value.length===$.length&&C.value.every((V,L)=>V===$[L])}return C.value===I}),g=n.categories.includes(this.configContext?.infoItemCategory)?null:e++,b=n.variables?.find(C=>C.identifier=="MAXSCORE")?.value,q=b==null?null:parseFloat(b?.toString()),_=this.#s.get(a.identifier);_===void 0&&(_=s?this.#q(s):"unscored",f>0&&this.#s.set(a.identifier,_));let A=this.#y(f,_,a.maxAttempts,a.adaptive,d);return{...a,completionStatus:d,numAttempts:f,score:l,response:h,index:g,active:m,valid:y,isDefaultResponse:u,maxScore:q,done:A,optimal:this.#s.get(a.identifier)==="optimal"}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}updated(t){super.updated(t),this.#f()}#b;#f(){if(!this.#o||!this.computedContext)return;let t=new Map(this.computedContext.testParts.flatMap(e=>e.sections.flatMap(r=>(r.submissionMode||e.submissionMode)==="simultaneous"?[]:r.items.map(i=>[i.identifier,i]))));for(let e of this.#o.querySelectorAll("qti-assessment-item-ref")){let r=e.assessmentItem;if(!r)continue;let i=this.#v(t.get(e.identifier),r);i&&!r.disabled?(r.disabled=!0,this.#b.add(r)):!i&&this.#b.has(r)&&(this.#b.delete(r),r.disabled=!1)}}#v(t,e){if(!t||this.autoScoreItems||t.adaptive||e.adaptive==="true")return!1;let r=t.maxAttempts??1;return r>0&&(t.numAttempts??0)>=r}#y(t,e,r,i,n){if(t===0)return!1;if(i)return n==="completed";if(e!=="suboptimal")return!0;let s=r??1;return s>0&&t>=s}#q(t){let e=t.variables??[],r=this.#x(e,"SCORE"),i=this.#x(e,"MAXSCORE");if(r!==null&&i!==null)return r>=i?"optimal":"suboptimal";let n=e.filter(a=>a.type==="response"&&a.correctResponse!==void 0&&a.correctResponse!==null);return n.length===0?"unscored":n.every(a=>{let c=a.correctResponse,l=a.value;return l==null?!1:Array.isArray(c)&&Array.isArray(l)?c.length===l.length&&c.every(d=>l.includes(d)):Array.isArray(c)||Array.isArray(l)?!1:c===l})?"optimal":"suboptimal"}#x(t,e){let r=t?.find(n=>n.identifier===e)?.value;if(r==null||Array.isArray(r))return null;let i=parseFloat(r.toString());return Number.isNaN(i)?null:i}};or([p({type:String})],mt.prototype,"identifier",void 0);or([T()],mt.prototype,"initContext",void 0);or([T(),R({context:yt,subscribe:!0})],mt.prototype,"configContext",void 0);or([T(),R({context:nt,subscribe:!0})],mt.prototype,"_testContext",void 0);or([T(),R({context:Jn,subscribe:!0})],mt.prototype,"_sessionContext",void 0);or([T(),J({context:ct})],mt.prototype,"computedContext",void 0);or([p({type:Boolean,attribute:"auto-score-items"})],mt.prototype,"autoScoreItems",void 0);var mc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},sr=class extends S{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=[Oe,nh]}#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,n=this.sectionItems[this.itemIndex],s=r==="linear"&&i==="individual";this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=(this.sectionItems?.length??0)-1||s&&!n?.done}_requestItem(t){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return Pe}};mc([p({type:Boolean,reflect:!0,attribute:"disabled"})],sr.prototype,"_internalDisabled",void 0);mc([R({context:ct,subscribe:!0})],sr.prototype,"computedContext",void 0);mc([N("computedContext")],sr.prototype,"_handleTestElementChange",null);var fc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ar=class extends S{_handleTestElementChange(t,e){e&&this.requestUpdate()}static{this.styles=Oe}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){F(this,"qc-test-navigate",{type:"item",id:t})}render(){return Pe}};fc([p({type:Boolean,reflect:!0,attribute:"disabled"})],ar.prototype,"_internalDisabled",void 0);fc([R({context:ct,subscribe:!0})],ar.prototype,"computedContext",void 0);fc([N("computedContext")],ar.prototype,"_handleTestElementChange",null);var Io=class extends S{static{this.styles=Oe}constructor(){super(),this.addEventListener("click",()=>F(this,"qc-test-submit",{}))}render(){return Pe}};var sh=[{tag:"test-submit",ctor:Io}];var ah=[{tag:"qti-assessment-item-ref",ctor:wt},{tag:"qti-assessment-section",ctor:Ct},{tag:"qti-assessment-test",ctor:rr},{tag:"qti-branch-rule",ctor:le},{tag:"qti-item-session-control",ctor:Pt},{tag:"qti-number-presented",ctor:Fi},{tag:"qti-number-selected",ctor:to},{tag:"qti-outcome-processing",ctor:ro},{tag:"qti-pre-condition",ctor:eo},{tag:"qti-test",ctor:Ie},{tag:"qti-test-feedback",ctor:Ji},{tag:"qti-test-part",ctor:Re},{tag:"qti-test-variables",ctor:Yi},{tag:"test-container",ctor:St},{tag:"test-end-attempt",ctor:me},{tag:"test-navigation",ctor:mt},{tag:"test-next",ctor:sr},{tag:"test-prev",ctor:ar},...sh];for(let{tag:o,ctor:t}of ah)customElements.get(o)||customElements.define(o,t);var KS=(o,t)=>o?.plugins?.[t];var cr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},$t=class extends S{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 Gt().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=Gt().parse(this.itemXML).htmlDoc(this.#e??void 0)}catch(t){console.error("Error parsing XML:",t)}}async connectedCallback(){super.connectedCallback(),this.#r(),this.#i(),this.itemURL&&this.handleItemURLChange(),this.itemXML&&this.handleItemXMLChange()}#r(){let t=this.querySelector("template");this.#t=t?t.content:v``}#i(){let t=new CSSStyleSheet;t.replaceSync(Ao),this.shadowRoot.adoptedStyleSheets=[t]}render(){return v`
|
|
6428
6428
|
${this.#t}
|
|
6429
6429
|
<slot></slot>
|
|
6430
|
-
${
|
|
6431
|
-
`}};cr([p({attribute:!1})],$t.prototype,"customElementRegistry",void 0);cr([p({type:String,attribute:"item-url"})],$t.prototype,"itemURL",void 0);cr([T()],$t.prototype,"itemDoc",void 0);cr([T()],$t.prototype,"itemXML",void 0);cr([T(),R({context:qt,subscribe:!0})],$t.prototype,"qtiContext",void 0);cr([N("itemURL",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemURLChange",null);cr([N("itemXML",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemXMLChange",null);var
|
|
6430
|
+
${Eo(this.itemDoc,v`<span>Loading...</span>`)}
|
|
6431
|
+
`}};cr([p({attribute:!1})],$t.prototype,"customElementRegistry",void 0);cr([p({type:String,attribute:"item-url"})],$t.prototype,"itemURL",void 0);cr([T()],$t.prototype,"itemDoc",void 0);cr([T()],$t.prototype,"itemXML",void 0);cr([T(),R({context:qt,subscribe:!0})],$t.prototype,"qtiContext",void 0);cr([N("itemURL",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemURLChange",null);cr([N("itemXML",{waitUntilFirstUpdate:!0})],$t.prototype,"handleItemXMLChange",null);var Im=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},tn=class extends S{static{this.styles=w`
|
|
6432
6432
|
table {
|
|
6433
6433
|
width: 100%;
|
|
6434
6434
|
border-collapse: collapse;
|
|
@@ -6475,7 +6475,7 @@ div.full-correct-response-inline {
|
|
|
6475
6475
|
</table>
|
|
6476
6476
|
`;return v`
|
|
6477
6477
|
${i(e,"Response Variables")} ${i(r,"Outcome Variables")}
|
|
6478
|
-
`}};
|
|
6478
|
+
`}};Im([R({context:we,subscribe:!0})],tn.prototype,"computedContext",void 0);var Mm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ch=o=>{class t extends o{#t;constructor(...r){super(...r),this.view="candidate",this.addEventListener("qti-assessment-item-connected",i=>{this.#t=i.detail,this.#e()}),this.addEventListener("item-switch-view",i=>{this.view=i.detail})}willUpdate(r){super.willUpdate(r),r.has("view")&&this.#e()}#e(){let r=this.#t;r&&(r.querySelectorAll("[view]").forEach(i=>{i.classList.toggle("show",i.getAttribute("view")===this.view)}),this.updateAssessmentItemView(r,this.view))}updateAssessmentItemView(r,i){}}return Mm([p({type:String})],t.prototype,"view",void 0),t};var gc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fe=class extends ch(S){#t;#e;constructor(){super(),this.configContext={},this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}},this.#t=this.#r.bind(this),this.#e=this.#i.bind(this),this.addEventListener("qti-item-context-updated",this.#t),this.addEventListener("qti-assessment-item-connected",this.#e)}#r(t){this.#n(t.detail.itemContext.identifier,t.detail?.itemContext?.variables||[])}#i(t){let e=t.detail._context.variables;this.assessmentItem=t.detail,this.computedContext=this.computedContext?.identifier===this.assessmentItem.identifier?{...this.computedContext,title:this.assessmentItem.title}:{identifier:this.assessmentItem.identifier,title:this.assessmentItem.title,adaptive:this.assessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:e},this.#n(this.assessmentItem.identifier,e||[])}#n(t,e){let r=e?.find(l=>l.identifier=="SCORE")?.value,i=parseFloat(r?.toString()),n=e?.find(l=>l.identifier==="completionStatus")?.value,s=i!==void 0&&!isNaN(i)&&i>0,a=i!==void 0&&!isNaN(i)&&i<=0,c=n==="completed";this.computedContext={...this.computedContext,identifier:t,correct:s,incorrect:a,completed:c,variables:e}}render(){return v`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this.#t),this.removeEventListener("qti-assessment-item-connected",this.#e)}};gc([T(),J({context:we})],fe.prototype,"computedContext",void 0);gc([T(),J({context:yt})],fe.prototype,"configContext",void 0);gc([T(),J({context:qt})],fe.prototype,"qtiContext",void 0);var lh=[{tag:"item-container",ctor:$t},{tag:"item-print-variables",ctor:tn},{tag:"qti-item",ctor:fe}];for(let{tag:o,ctor:t}of lh)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of zd)customElements.get(o)||customElements.define(o,t);var dh=(o,t,e)=>{let r=new Map;for(let i=t;i<=e;i++)r.set(o[i],i);return r},H=Ot(class extends Ae{constructor(o){if(super(o),o.type!==Hr.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let i=[],n=[],s=0;for(let a of o)i[s]=r?r(a,s):s,n[s]=e(a,s),s++;return{values:n,keys:i}}render(o,t,e){return this.dt(o,t,e).values}update(o,[t,e,r]){let i=jd(o),{values:n,keys:s}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=s,n;let a=this.ut??=[],c=[],l,d,h=0,f=i.length-1,m=0,y=n.length-1;for(;h<=f&&m<=y;)if(i[h]===null)h++;else if(i[f]===null)f--;else if(a[h]===s[m])c[m]=_e(i[h],n[m]),h++,m++;else if(a[f]===s[y])c[y]=_e(i[f],n[y]),f--,y--;else if(a[h]===s[y])c[y]=_e(i[h],n[y]),Wr(o,c[y+1],i[h]),h++,y--;else if(a[f]===s[m])c[m]=_e(i[f],n[m]),Wr(o,i[h],i[f]),f--,m++;else if(l===void 0&&(l=dh(s,m,y),d=dh(a,h,f)),l.has(a[h]))if(l.has(a[f])){let x=d.get(s[m]),u=x!==void 0?i[x]:null;if(u===null){let g=Wr(o,i[h]);_e(g,n[m]),c[m]=g}else c[m]=_e(u,n[m]),Wr(o,i[h],u),i[x]=null;m++}else fo(i[f]),f--;else fo(i[h]),h++;for(;m<=y;){let x=Wr(o,c[y+1]);_e(x,n[m]),c[m++]=x}for(;h<=f;){let x=i[h++];x!==null&&fo(x)}return this.ut=s,Vd(o,c),it}});var De=Symbol("dragDropContext");var hh=[M,Wt,w`
|
|
6479
6479
|
/* A drop target — see qti-gap.styles.ts. The interaction publishes the chip measurements as
|
|
6480
6480
|
custom properties on its host; the properties themselves live here. */
|
|
6481
6481
|
:host {
|
|
@@ -6499,9 +6499,9 @@ div.full-correct-response-inline {
|
|
|
6499
6499
|
[part~='chip'] {
|
|
6500
6500
|
flex-shrink: 0;
|
|
6501
6501
|
}
|
|
6502
|
-
`];var
|
|
6502
|
+
`];var ph=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Qr=class extends S{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0}static{this.styles=hh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return v`<div part="drop">
|
|
6503
6503
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6504
|
-
</div>`}};
|
|
6504
|
+
</div>`}};ph([p({type:String,reflect:!0})],Qr.prototype,"identifier",void 0);ph([R({context:De,subscribe:!0}),T()],Qr.prototype,"_dragDrop",void 0);var uh=[{tag:"qti-associable-hotspot",ctor:Qr}];var mh=[M,Wt,w`
|
|
6505
6505
|
/*
|
|
6506
6506
|
* A drop target. The interaction measures its chips and publishes the result as custom
|
|
6507
6507
|
* properties on its own host; the actual CSS properties live here, not in a style attribute.
|
|
@@ -6546,9 +6546,9 @@ div.full-correct-response-inline {
|
|
|
6546
6546
|
min-height: var(--qti-dropzone-min-height, 0);
|
|
6547
6547
|
min-width: var(--qti-dropzone-min-width, 0);
|
|
6548
6548
|
}
|
|
6549
|
-
`];var
|
|
6549
|
+
`];var bc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lr=class extends S{constructor(){super(...arguments),this.internals=this.attachInternals(),this.acceptsDeclarativeDrops=!0,this.tabindex=0}static{this.styles=mh}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`<div part="drop">
|
|
6550
6550
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6551
|
-
</div>`}};
|
|
6551
|
+
</div>`}};bc([p({type:Number,reflect:!0})],lr.prototype,"tabindex",void 0);bc([p({type:String,reflect:!0})],lr.prototype,"identifier",void 0);bc([R({context:De,subscribe:!0}),T()],lr.prototype,"_dragDrop",void 0);var fh=[{tag:"qti-gap",ctor:lr}];var gh=[M,w`
|
|
6552
6552
|
/* Centred, because a gap-img is a picture inside a drop the same size as it. Was in the theme's
|
|
6553
6553
|
graphic-gap-match rules, on the host from the document. */
|
|
6554
6554
|
:host {
|
|
@@ -6561,7 +6561,7 @@ div.full-correct-response-inline {
|
|
|
6561
6561
|
anywhere else it is unset and the chip keeps its size. */
|
|
6562
6562
|
zoom: var(--qti-graphic-scale, 1);
|
|
6563
6563
|
}
|
|
6564
|
-
`];var
|
|
6564
|
+
`];var Pm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},en=class extends S{constructor(){super(...arguments),this.tabindex=0,this.internals=this.attachInternals()}static{this.styles=gh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<slot part="label"></slot>`}};Pm([p({type:Number,reflect:!0})],en.prototype,"tabindex",void 0);var bh=[{tag:"qti-gap-img",ctor:en}];var dr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vh={toAttribute:o=>o?"true":"false",fromAttribute:o=>o==="true"};function Et(o,t,{activateOn:e="click"}={}){class r extends o{#t;#e;#r(){let s=this._interactionContext?.choiceRole??null;s!==this.#e&&(this.#e&&this.internals.states.delete(this.#e),this.#e=s,this.internals.role=s,s&&this.internals.states.add(s))}handleDisabledChange(n,s){s?(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.blur()):(this.internals.ariaDisabled=null,this.internals.states.delete("disabled")),this.tabIndex=s?-1:0}handleReadonlyChange(n,s){s?(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")):(this.internals.ariaReadOnly=null,this.internals.states.delete("readonly"))}constructor(...n){super(...n),this.identifier="",this.tabIndex=0,this.disabled=!1,this.readonly=!1,this.#t=!1,this.#e=null,this._onMouseDown=s=>{this.disabled&&s.preventDefault()},this._onPointerDown=s=>{this.#t=!1,!(e!=="press"||s.button!==0||!s.isPrimary)&&(this.hasAttribute("data-draggable")||this.disabled||this.readonly||(this.#t=!0,this.focus(),this._activate()))},this.internals=this.attachInternals()}willUpdate(n){super.willUpdate(n),this.#r()}connectedCallback(){super.connectedCallback(),this.internals.ariaChecked="false",this.disabled&&(this.internals.ariaDisabled="true",this.internals.states.add("disabled"),this.tabIndex=-1),this.readonly&&(this.internals.ariaReadOnly="true",this.internals.states.add("readonly")),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.addEventListener("pointerdown",this._onPointerDown),this.addEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.removeEventListener("pointerdown",this._onPointerDown),this.removeEventListener("mousedown",this._onMouseDown),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(n){n.altKey||(n.code==="Space"||n.code==="Enter")&&(n.preventDefault(),this._activate())}_onClick(){if(this.#t){this.#t=!1;return}this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return v`<slot></slot>`}}return dr([p({type:String})],r.prototype,"identifier",void 0),dr([p({type:Number,reflect:!0,attribute:"tabindex"})],r.prototype,"tabIndex",void 0),dr([p({type:Boolean,attribute:"aria-disabled",converter:vh})],r.prototype,"disabled",void 0),dr([p({type:Boolean,attribute:"aria-readonly",converter:vh})],r.prototype,"readonly",void 0),dr([R({context:Tr,subscribe:!0}),T()],r.prototype,"_interactionContext",void 0),dr([N("disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",null),dr([N("readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",null),r}var yh=[M,w`
|
|
6565
6565
|
/*
|
|
6566
6566
|
* A chip's own box. Both drag-drop interactions that use this element laid it out from the
|
|
6567
6567
|
* theme — gap-match with 'display: flex !important; align-items: center !important',
|
|
@@ -6604,8 +6604,8 @@ div.full-correct-response-inline {
|
|
|
6604
6604
|
align-items: center;
|
|
6605
6605
|
justify-content: center;
|
|
6606
6606
|
}
|
|
6607
|
-
`];var
|
|
6608
|
-
<slot part="label"></slot>`}};
|
|
6607
|
+
`];var Om=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},$e=class extends Et(S,"qti-gap-text"){constructor(){super(...arguments),this.tabindex=0}static{this.styles=yh}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","drags")}render(){return v`<div part="control"></div>
|
|
6608
|
+
<slot part="label"></slot>`}};Om([p({type:Number,reflect:!0})],$e.prototype,"tabindex",void 0);var qh=[{tag:"qti-gap-text",ctor:$e}];var xh=[M,w`
|
|
6609
6609
|
:host {
|
|
6610
6610
|
display: flex;
|
|
6611
6611
|
user-select: none;
|
|
@@ -6625,7 +6625,7 @@ div.full-correct-response-inline {
|
|
|
6625
6625
|
display: grid;
|
|
6626
6626
|
place-content: center;
|
|
6627
6627
|
}
|
|
6628
|
-
`];var
|
|
6628
|
+
`];var Dm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},hr=class extends Et(S,"qti-hotspot-choice"){static{this.styles=xh}updated(t){super.updated(t),t.has("order")&&(this.order===void 0||this.order===null?this.removeAttribute("data-order"):this.setAttribute("data-order",String(this.order)))}};Dm([p({attribute:"aria-ordervalue",type:Number,reflect:!0})],hr.prototype,"order",void 0);var wh=[{tag:"qti-hotspot-choice",ctor:hr}];var Ch=[M,w`
|
|
6629
6629
|
/* 'position: relative' is the containing block for the answer-key tick the theme draws as an
|
|
6630
6630
|
absolutely positioned ::before. See CONTRACT.md §7. */
|
|
6631
6631
|
:host {
|
|
@@ -6645,8 +6645,8 @@ div.full-correct-response-inline {
|
|
|
6645
6645
|
[part='control'] {
|
|
6646
6646
|
display: none;
|
|
6647
6647
|
}
|
|
6648
|
-
`];var pr=class extends Et(S,"qti-hottext"){static{this.styles=
|
|
6649
|
-
<slot part="label"></slot>`}};var
|
|
6648
|
+
`];var pr=class extends Et(S,"qti-hottext"){static{this.styles=Ch}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
6649
|
+
<slot part="label"></slot>`}};var kh=[{tag:"qti-hottext",ctor:pr}];var $m=w`
|
|
6650
6650
|
/*
|
|
6651
6651
|
* An option row: one line, clipped, with its text centred against the row's min-height. All four
|
|
6652
6652
|
* were in the theme, set on this host from the document — which is also why the 'display: block'
|
|
@@ -6669,13 +6669,13 @@ div.full-correct-response-inline {
|
|
|
6669
6669
|
slot {
|
|
6670
6670
|
display: inline;
|
|
6671
6671
|
}
|
|
6672
|
-
`,
|
|
6672
|
+
`,Sh=$m;var Nm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},rn=class extends Et(S,"qti-inline-choice"){static{this.styles=Sh}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#t),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this.#t)}render(){return v` <slot></slot> `}#t(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};Nm([p({type:String})],rn.prototype,"identifier",void 0);var Eh=[{tag:"qti-inline-choice",ctor:rn}];var Ah=[M,w`
|
|
6673
6673
|
:host {
|
|
6674
6674
|
display: block;
|
|
6675
6675
|
margin: var(--qti-gap) 0;
|
|
6676
6676
|
width: 100%;
|
|
6677
6677
|
}
|
|
6678
|
-
`];var
|
|
6678
|
+
`];var Mo=class extends S{static{this.styles=Ah}render(){return v`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.parentElement?.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};var _h=[{tag:"qti-prompt",ctor:Mo}];var Th=[M,Wt,w`
|
|
6679
6679
|
/*
|
|
6680
6680
|
* 'align-items' / 'justify-content' are variables because one caller cannot be reached any other
|
|
6681
6681
|
* way. In tabular match this element is a light-DOM *grandchild* of the slotted
|
|
@@ -6824,13 +6824,13 @@ div.full-correct-response-inline {
|
|
|
6824
6824
|
align-items: center;
|
|
6825
6825
|
justify-content: center;
|
|
6826
6826
|
}
|
|
6827
|
-
`];var
|
|
6827
|
+
`];var Po=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Nt=class extends Et(S,"qti-simple-associable-choice"){constructor(){super(...arguments),this.matchMin=0,this.matchMax=1,this.fixed=!1,this.acceptsDeclarativeDrops=!0}static{this.styles=Th}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice")}get drags(){return this._dragDrop?.nodesByTarget?.[this.identifier]??[]}render(){return v`
|
|
6828
6828
|
<div part="control"></div>
|
|
6829
6829
|
<slot part="label"></slot>
|
|
6830
6830
|
<div part="drop">
|
|
6831
6831
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
6832
6832
|
</div>
|
|
6833
|
-
`}};
|
|
6833
|
+
`}};Po([p({type:Number,attribute:"match-min"})],Nt.prototype,"matchMin",void 0);Po([p({type:Number,attribute:"match-max"})],Nt.prototype,"matchMax",void 0);Po([p({type:String,attribute:"fixed",converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Nt.prototype,"fixed",void 0);Po([R({context:De,subscribe:!0}),T()],Nt.prototype,"_dragDrop",void 0);var Rh=[{tag:"qti-simple-associable-choice",ctor:Nt}];var Ih=[M,w`
|
|
6834
6834
|
/*
|
|
6835
6835
|
* 'position: relative' unconditionally, because this element can carry a correction badge and a
|
|
6836
6836
|
* badge needs a containing block. The theme draws the badge as an absolutely positioned ::after
|
|
@@ -6866,9 +6866,9 @@ div.full-correct-response-inline {
|
|
|
6866
6866
|
align-items: center;
|
|
6867
6867
|
justify-content: center;
|
|
6868
6868
|
}
|
|
6869
|
-
`];var
|
|
6869
|
+
`];var Oo=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Lt=class extends Et(S,"qti-simple-choice",{activateOn:"press"}){constructor(){super(...arguments),this.templateIdentifier=null,this.showHide="show",this.fixed=!1}static{this.styles=Ih}get checked(){return this.internals.states.has("checked")}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
6870
6870
|
${this.marker?v`<div id="label" part="marker">${this.marker}</div>`:P}
|
|
6871
|
-
<slot part="label"></slot>`}};Io([p({type:String,attribute:"template-identifier"})],Lt.prototype,"templateIdentifier",void 0);Io([p({type:String,attribute:"show-hide"})],Lt.prototype,"showHide",void 0);Io([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Lt.prototype,"fixed",void 0);Io([p({type:String,attribute:!1})],Lt.prototype,"marker",void 0);var _h=[{tag:"qti-simple-choice",ctor:Lt}];var Th=[...lh,...hh,...uh,...gh,...vh,...qh,...wh,...kh,...Eh,..._h];var Om=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n};function Dm(o,t,e,r,i={}){let n=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,c=0,l=r.length?r:[o],d=l.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));l.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),c=Math.max(c,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:c})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(o.style.setProperty("--qti-dropzone-min-width",`${c}px`),o.style.setProperty("--qti-drag-min-width",`${c}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(h.style.setProperty("--qti-dropzone-min-width",`${c}px`),h.style.setProperty("--qti-drag-min-width",`${c}px`))}))}var mc=(o,t,e,r='slot[part~="bank"]')=>{class i extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#i=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#i;#n;collectAutoSizeTargets(){let s=(a,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&&(Dm(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 Om([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Jt,AbortSignal:fc,WeakMap:$m,WeakRef:Nm,Window:Rh,reportError:Mo=console.log}=globalThis,Ne=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||Ne(o.defaultView.parent.document)),ur=()=>!!Rh&&globalThis instanceof Rh,gc=Symbol("unset"),[Ih,Lm]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((b,q)=>(x=b,u=q)),resolve:x,reject:u}};function r(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let i=new $m,n={next(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.next(...x))},return(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.return?b.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>{if(!b.throw)throw b.return(),new TypeError("no throw method");return b.throw(...x)})}};function s(x){let u=Object.create(n);return i.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let b=r(x,g);return s(b)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(x,g)}let c="any"in fc?fc.any.bind(fc):x=>{let u=new Jt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},l=x=>c(x.filter(Boolean));class d{constructor({next:u,error:g,complete:b}={}){i.set(this,{next:u,error:g,complete:b})}next(u){let{next:g}=i.get(this)||{};g&&g(u)}error(u){let{error:g}=i.get(this)||{};g?g(u):Mo(u)}complete(){let{complete:u}=i.get(this)||{};u&&u()}}function h(x,u){let g=i.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let b of g.teardowns.reverse()){if(ur()&&!Ne(document))return;try{b()}catch(q){Mo(q)}}}}function f(x,u,g={}){if(ur()&&!Ne(document))return;let b;typeof u=="function"?b=new d({next:u}):u&&!(u instanceof d)?b=new d(u):b=u||new d;let q=i.get(x),_=q.weakSubscriber?.deref();if(_?.active){let C=_,k=i.get(C);k.observers.add(b),g.signal&&(g.signal.aborted?k.observers.delete(b):g.signal.addEventListener("abort",()=>{let I=i.get(C);I?.active&&(I.observers.delete(b),I.observers.size==0&&h(C,g.signal.reason))}));return}let A=new m(b);if(q.weakSubscriber=new Nm(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let C=i.get(A);C?.active&&(C.observers.delete(b),C.observers.size==0&&h(A,g.signal.reason))})),q.subscribeCallback)try{q.subscribeCallback(A)}catch(C){A.error(C)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Jt})}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||ur()&&!Ne(document))return;let b=new Set(g.observers);for(let q of b)q.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active){Mo(u);return}if(ur()&&!Ne(document))return;h(this,u);let b=new Set(g.observers);for(let q of b)q.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=i.get(this);if(!u?.active||ur()&&!Ne(document))return;h(this);let g=new Set(u.observers);for(let b of g)b.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(ur()&&!Ne(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 Jt;return u.abort(),u.signal}return i.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let _=function(A,C){if(A.signal.aborted)return;let k;try{let I=C.next();k=Promise.resolve(I)}catch(I){k=Promise.reject(I)}k.then(I=>{if(I===null||typeof I!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:q}=I)}catch(V){A.error(V);return}if(q){A.complete();return}let $;try{$=I.value}catch(V){A.error(V);return}A.next($),_(A,C)},I=>{A.error(I)})},q=!1;return new y(A=>{if(A.signal.aborted)return;let C;try{C=a(u,!0)}catch(I){A.error(I);return}let k=C;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||q)return;t(()=>k.return(A.signal.reason)).then($=>{if($===null||typeof $!="object")throw new TypeError("Iterator .return() must return an Object")})}),_(A,k))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(q=>{if(q.signal.aborted)return;let _;try{_=a(u,!1)}catch(k){q.error(k);return}let A=!1,C=_;if(!q.signal.aborted)for(q.signal.addEventListener("abort",()=>{if(typeof C.return!="function"||A)return;let k=C.return();if(k===null||typeof k!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let k=C.next();if({done:A}=k,A){q.complete();return}if(q.next(k.value),q.signal.aborted)break}catch(k){q.error(k);break}});if(u instanceof Promise||typeof u.then=="function")return new y(q=>{u.then(_=>{q.next(_),q.complete()},_=>{q.error(_)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,b=y.from(u);return new y(q=>{let _=new d({next(){q.complete()},error(){q.complete()}}),A={signal:q.signal};if(f(b,_,A),!q.active)return;let C=new d({next(k){q.next(k)},error(k){q.error(k)},complete(){q.complete()}});f(g,C,A)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(C){let k;try{k=u(C,q)}catch(I){b.error(I);return}q+=1,b.next(k)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}inspect(u={}){let g=null,b=null,q=null,_=null,A=null;typeof u=="function"?b=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(b=u.next),"error"in u&&(q=u.error),"complete"in u&&(_=u.complete),"abort"in u&&(A=u.abort));let C=this;return new y(k=>{if(g!==null)try{g()}catch(L){k.error(L);return}let I=()=>{try{A!==null&&A(k.signal.reason)}catch(L){Mo(L)}};k.signal.addEventListener("abort",I,{once:!0});let $=new d({next(L){if(b!==null)try{b(L)}catch(ht){k.signal.removeEventListener("abort",I),k.error(ht);return}k.next(L)},error(L){if(k.signal.removeEventListener("abort",I),q!==null)try{q(L)}catch(ht){k.error(ht);return}k.error(L)},complete(){if(k.signal.removeEventListener("abort",I),_!==null)try{_()}catch(L){k.error(L);return}k.complete()}}),V={signal:k.signal};f(C,$,V)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(C){let k=!1;try{k=u(C,q)}catch(I){b.error(I);return}q+=1,k&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u;if(q==0)return b.complete();let _=new d({next(C){b.next(C),q-=1,q==0&&b.complete()},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u,_=new d({next(C){if(q>0)return q-=1;q==0&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=[];function C(V){let L;try{L=u(V,q)}catch(re){return b.error(re)}q+=1;let ht;try{ht=y.from(L)}catch(re){return b.error(re)}let ua=new d({next(re){b.next(re)},error(re){b.error(re)},complete(){if(A.length){let re=A.shift();C(re)}else k=!1,_&&b.complete()}}),Ft={signal:b.signal};f(ht,ua,Ft)}let k=!1,I=new d({next(V){k?A.push(V):(k=!0,C(V))},error(V){b.error(V)},complete(){_=!0,!k&&!A.length&&b.complete()}}),$={signal:b.signal};f(g,I,$)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=null;function C($){let V;try{V=u($,q)}catch(Ft){return b.error(Ft)}q+=1;let L;try{L=y.from(V)}catch(Ft){return b.error(Ft)}let ht=new d({next(Ft){b.next(Ft)},error(Ft){b.error(Ft)},complete(Ft){_?b.complete():A=null}}),ua={signal:l([A.signal,b.signal])};f(L,ht,ua)}let k=new d({next($){A&&A.abort(),A=new Jt,C($)},error($){b.error($)},complete(){_=!0,A||b.complete()}}),I={signal:b.signal};f(g,k,I)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(q=>{let _=new d({next(C){q.next(C)},error(C){let k;try{k=u(C)}catch(L){q.error(L);return}let I;try{I=y.from(k)}catch(L){q.error(L);return}let $=new d({next(L){q.next(L)},error(L){q.error(L)},complete(){q.complete()}}),V={signal:q.signal};f(I,$,V)},complete(){q.complete()}}),A={signal:q.signal};f(g,_,A)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{b.addTeardown(u);let q=new d({next(A){b.next(A)},error(A){b.error(A)},complete(){b.complete()}}),_={signal:b.signal};f(g,q,_)})}toArray(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=[],A=new d({next(C){_.push(C)},error(C){q(C)},complete(){b(_)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){try{u($,k)}catch(V){_(V),A.abort(V)}k+=1},error($){_($)},complete(){q()}});return f(this,I,C),b}every(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V||(q(!1),A.abort())},error($){_($)},complete(){q(!0)}});return f(this,I,C),b}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e(),_=new Jt,A={signal:l([_.signal,u.signal])};if(A.signal.aborted)return q(A.signal.reason),g;A.signal.addEventListener("abort",()=>{q(A.signal.reason)});let C=new d({next(k){b(k),_.abort()},error(k){q(k)},complete(){q(new RangeError("No values in Observable"))}});return f(this,C,A),g}last(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return q(u.signal.reason),g;u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=null,A=!1,C=new d({next(k){A=!0,_=k},error(k){q(k)},complete(){A?b(_):q(new RangeError("No values in Observable"))}});return f(this,C,u),g}find(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V&&(q($),A.abort())},error($){_($)},complete(){q()}});return f(this,I,C),b}some(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V&&(q(!0),A.abort())},error($){_($)},complete(){q(!1)}});return f(this,I,C),b}reduce(u,g,b={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:q,resolve:_,reject:A}=e(),C=new Jt,k={signal:l([C.signal,b.signal])};if(k.signal.aborted)return A(k.signal.reason),q;k.signal.addEventListener("abort",()=>{A(k.signal.reason)},{once:!0});let I=0,$=arguments.length>1?g:gc,V=new d({next(L){if($===gc){$=L,I++;return}try{let ht=u($,L,I);I++,$=ht}catch(ht){A(ht),C.abort(ht);return}},error(L){A(L)},complete(){$!==gc?_($):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,k),q}}return o(y.prototype,"subscribe"),[y,m]})();function Mh(){return typeof globalThis.Observable=="function"}function Ph(){Object.defineProperties(globalThis,{Observable:{value:Ih,configurable:!0,writable:!0},Subscriber:{value:Lm,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(ur()&&!Ne(document))return;let e=this;return new Ih(r=>{if(!e||r.signal.aborted)return;let i=n=>{r.next(n)};e.addEventListener(o,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function bc(o,t,e){let r=o.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let n=i.getBoundingClientRect();if(t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom)return i}return null}function Oh(o,t,e,r){if(!r)return null;let i=o.filter(s=>!s.hasAttribute("disabled")),n=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom))return s}return null}function Dh(o,t,e,r){let i=o.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let n,s;if(r){let l=r.getBoundingClientRect();n=l.left+l.width/2,s=l.top+l.height/2}else n=t,s=e;let a=null,c=1/0;for(let l of i){let d=l.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(n-h,2)+Math.pow(s-f,2));m<c&&(c=m,a=l)}return a}function $h(o,t,e,r){let i=o.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let n;if(r){let c=r.getBoundingClientRect();n=[{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 n=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let 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,f=0;for(let y of n)for(let x of d){let u=Math.sqrt(Math.pow(y.x-x.x,2)+Math.pow(y.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=c)}return s}function Vm(o,t,e){let r=o.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function jm(o,t,e,r,i){let n=i&&i.length>0?o.filter(g=>i.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.split(/\s+/).includes("bank")),a=o.filter(g=>!n.includes(g));if(n.length===0&&a.length===0)return null;let c;if(r){let g=r.getBoundingClientRect();c=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else c=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let l=g=>{let b=g.getBoundingClientRect(),q=[{x:b.left,y:b.top},{x:b.right,y:b.top},{x:b.left,y:b.bottom},{x:b.right,y:b.bottom}],_=0,A=0;for(let C of c)for(let k of q){let I=Math.sqrt(Math.pow(C.x-k.x,2)+Math.pow(C.y-k.y,2));_+=I,A++}return _/A},d=null,h=1/0;for(let g of n){let b=l(g);b<h&&(h=b,d=g)}let f=null,m=1/0;for(let g of a){let b=l(g);b<m&&(m=b,f=g)}if(d&&r){let g=r.getBoundingClientRect(),b=d.getBoundingClientRect(),q=g.left+g.width/2,_=g.top+g.height/2;if(q>=b.left&&q<=b.right&&_>=b.top&&_<=b.bottom)return d}if(f&&Vm(f,t,e))return f;let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function Nh(o){switch(o){case"pointerWithin":return bc;case"rectangleIntersection":return Oh;case"closestCenter":return Dh;case"closestCorners":return $h;case"closestCornersWithInventoryPriority":return jm;default:return bc}}function Xr(o,t,e,r,i="pointerWithin",n){return Nh(i)(o,t,e,r,n)}function Le(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("data-draggable"))return r;let i=r.closest(t)||r.closest('[data-draggable="true"]');if(i)return i}return null}function nn(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var vc=o=>o?.internals;function ft(o,t,e){z(vc(o)?.states,t,e)}function Po(o,t){return Ni(vc(o)?.states,t)}function on(o){ft(o,"lifted",!1),ft(o,"used",!1),ft(o,"return-target",!1)}function mr(o){return Po(o,"lifted")||Po(o,"used")}var Lh={filled:[],full:[],"drag-active":["active","enabled"],"drag-over":["hover"]};function Yt(o,t,e){if(!o)return;let r=[t,...Lh[t]];for(let s of r)e?o.setAttribute(s,""):o.removeAttribute(s);let i=vc(o)?.states;if(i){z(i,t,e,Lh[t]);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));if(!(!n.has("drop")&&!n.has("bank"))){for(let s of r)e?n.add(s):n.delete(s);o.setAttribute("part",[...n].join(" "))}}function fr(o,t){o&&(t?o.setAttribute("disabled",""):o.removeAttribute("disabled"),Yt(o,"full",t))}function Gr(o,t){Yt(o,"filled",t)}function Jr(o,t){let e=[];return o.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function Vh(o,t){let e=o.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var yc={origin:{x:0,y:0},scale:{x:1,y:1}},Oo=100,Fm=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},zm=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},Bm=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},qc=(o,t)=>{let e=o.ownerDocument??document,r=t??e.body,i=Fm(e);return i&&!Bm(i,r)?zm(i):r},xc=(o,t=1)=>{let r=(o.ownerDocument??document).createElement("div");r.style.cssText=`position:fixed;left:0;top:0;width:${Oo}px;height:${Oo}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(r);let i=r.getBoundingClientRect();return r.remove(),{origin:{x:i.left,y:i.top},scale:{x:(i.width/Oo||1)*t,y:(i.height/Oo||1)*t}}},jh=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});Mh()||Ph();var Fh=new WeakSet;function Um(o){!o||Fh.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Fh.add(o))}var zh=o=>!!o.internals?.states,Do=(o,t,e,r='slot[part~="bank"]',i="pointerWithin")=>{class n extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=yc,this.cursorBeforeDrag=null,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#r=a=>{let c=a;if(c.context!==Tr)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}),Um(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,I)=>Array.from(I?.querySelectorAll(k)??[]),c=a(t,this),l=a(t,this.shadowRoot),d=a('[data-draggable="true"]:not([data-drag-clone])',this),h=a('[data-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...c,...l,...d,...h,...f]));let m=a(e,this),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let x=a(r,this),u=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),b=new Set(this.trackedDraggables),q=new Set(this.trackedDroppables),_=g?b:new Set,A=g?q:new Set,C=new Set([...b,...q].filter(zh));for(let k of this.#t)C.has(k)||(z(k.internals.states,"chip",!1),z(k.internals.states,"drop",!1));for(let k of C){let I=_.has(k),$=!I&&A.has(k);z(k.internals.states,"chip",I),z(k.internals.states,"drop",$)}this.#t=C,this.trackedDraggables.forEach(k=>{let I=mr(k);g&&!I?(k.style.cursor="grab",k.style.userSelect="none",k.style.touchAction="none",k.style.webkitUserSelect="none",k.style.webkitTouchCallout="none",k.setAttribute("data-draggable","true"),k.setAttribute("tabindex","0")):(k.style.cursor="",k.style.userSelect="",k.style.touchAction="",k.style.webkitUserSelect="",k.style.webkitTouchCallout="",k.removeAttribute("data-draggable"),k.getAttribute("tabindex")==="0"&&k.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let c=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let y=Le(m,t),x=this.disabled||this.readonly,u=nn(y)||mr(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=Le(m,t);if(!y){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),l=a.when("mousedown").filter(m=>{let y=Le(m,t),x=this.disabled||this.readonly,u=nn(y)||mr(y),g=m.button===0,b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Le(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=Le(m,t),x=this.disabled||this.readonly,u=nn(y)||mr(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Le(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!y||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let y=this.trackedDraggables.filter(u=>!mr(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.endKeyboardDrag(),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.endKeyboardDrag(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=Le(m,t),g=this.disabled||this.readonly,b=nn(u)||mr(u);u&&["Space","Enter"].includes(m.code)&&!g&&!b&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),ft(u,"lifted",!0),this.activateAllDroppables(this.trackedDroppables.some(q=>q.contains(u)||!!q.shadowRoot?.contains(u))),h={dragging:!0,dragElement:u,dragIndex:y.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>Yt(u,"drag-over",!1)),h.dragging&&h.dropElement&&(Yt(h.dropElement,"drag-over",!0),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(c,l,d,f)}initiateDrag(a,c,l,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let y=b=>b.contains(a)||!!b.shadowRoot?.contains(a),x=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||null;a.getAnimations().forEach(b=>b.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:c-g.left,y:l-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:c,y:l},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),fr(u,!1),u&&u.setAttribute("data-drag-source","true");let b=a.getAttribute("identifier");if(b){let q=Jr(this.trackedDragContainers,b);q.forEach(_=>ft(_,"return-target",!0)),this.dragState.returnAnchorItems=q}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),ft(a,"lifted",!0);if(this.updateClonePosition(c,l),this.activateAllDroppables(x),this.watchDragCloneHost(),h==="pointer"){let b=this.ownerDocument.documentElement;this.cursorBeforeDrag=b.style.cursor,b.style.cursor="grabbing"}this.setupMoveObservables(d,h)}setupMoveObservables(a,c="pointer"){if(a==="touch"){if(c==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.setPointerCapture&&q.setPointerCapture(_)}catch{}let g=q=>{q.cancelable&&(q.preventDefault(),c==="pointer"&&q.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let b=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),c==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.releasePointerCapture&&q.releasePointerCapture(_)}catch{}};this.dragState.touchCleanup=b}let l=c==="mouse"?"mousemove":c==="touch"?"touchmove":"pointermove",d=c==="mouse"?"mouseup":c==="touch"?"touchend":"pointerup",h=g=>{let b=this.dragState.startedFromTrustedEvent;return b===void 0||g.isTrusted===b},f=document.when(l).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),c==="touch"){let b=g.touches?.[0]||g.changedTouches?.[0];if(!b)return;this.handleDragMove(b.clientX,b.clientY);return}if(c==="mouse"){let b=g;if(typeof b.buttons=="number"&&(b.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),y=c==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):c==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,c){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,c);let l=Xr(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=>Yt(m,"drag-over",!1)),l&&Yt(l,"drag-over",!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 y=c.getBoundingClientRect();h=Xr(this.allDropzones,y.left+y.width/2,y.top+y.height/2,c,this.collisionDetectionAlgorithm,this.trackedDragContainers)??l}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),ft(a,"lifted",!1)):this.handleInvalidDrop(a),c&&c.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{ft(y,"return-target",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,c){return this.trackedDroppables.includes(c)||this.trackedDragContainers.includes(c)}handleInvalidDrop(a){on(a)}createDragClone(a,c){let l=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];l.style.setProperty(m,d.getPropertyValue(m))}l.style.removeProperty("box-shadow");let h=qc(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=xc(h,this.cloneZoom),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.removeAttribute("data-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}=jh(this.cloneFrame,a-l.x,c-l.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,c=()=>{let{dragClone:l,dragSource:d,lastCoordinates:h}=this.dragState;if(!l)return;let f=d?.isConnected?d:this,m=qc(f,this.dragCloneRoot());m!==l.parentNode&&(m.appendChild(l),this.cloneFrame=xc(m,this.cloneZoom),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(a=!1){this.setDragActive(!0),this.allDropzones.forEach(c=>{let l=this.trackedDragContainers.includes(c);Yt(c,"drag-active",a||!l)})}deactivateAllDroppables(){this.setDragActive(!1),this.allDropzones.forEach(a=>{Yt(a,"drag-active",!1),Yt(a,"drag-over",!1)})}endKeyboardDrag(){this.trackedDraggables.forEach(a=>{a.hasAttribute("data-keyboard-dragging")&&ft(a,"lifted",!1),a.removeAttribute("data-keyboard-dragging")}),this.deactivateAllDroppables()}setDragActive(a){z(this._internals?.states,"drag-active",a,["dragzone-active","dragzone-enabled"])}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{ft(a,"return-target",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(c){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",c)}}),this.dragSubscriptions=[],this.cloneFrame=yc,this.cloneZoom=1,this.cursorBeforeDrag!==null&&(this.ownerDocument.documentElement.style.cursor=this.cursorBeforeDrag,this.cursorBeforeDrag=null),this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,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)zh(a)&&(z(a.internals.states,"chip",!1),z(a.internals.states,"drop",!1));this.#t.clear(),this.resetDragState()}}return n};var Bh={duration:250,easing:"ease",fill:"both"};function wc(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Uh(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Ve(o){let t=new Map;return o.forEach(e=>{t.set(e,wc(e))}),t}function Hh(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function $o(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function Cc(o){return $o(o)>0}function No(o,t,e={}){let r=$o(o);if(r<=0)return null;let i=wc(o),{deltaX:n,deltaY:s,deltaW:a,deltaH:c}=Hh(t,i);if(n===0&&s===0&&a===1&&c===1)return null;let{duration:l,easing:d,fill:h}={...Bh,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${n}px, ${s}px) scale(${a}, ${c})`},{transformOrigin:"top left",transform:"none"}],{duration:l*r,easing:d,fill:h})}function je(o,t={}){let e=new Map;return o.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let n=No(i,r,t);n&&e.set(i,n)}),e}var sn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Vt=(o,t,e,r='slot[part~="bank"]',i="closestCornersWithInventoryPriority")=>{let n=mc(o,t,e,r),s=Do(n,t,e,r,i);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this.maxAssociations=0,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}#t;isSwapTarget(l){let d=this.dragState.sourceDroppable,h=parseInt(l.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(l)&&!!d&&d!==l&&this.trackedDroppables.includes(d)}isDeclarativeTarget(l){return l?l.acceptsDeclarativeDrops===!0?!0:l.hasAttribute("data-declarative-drops"):!1}chipsIn(l){return this.isDeclarativeTarget(l)?[...this.#t.get(l)??[]]:Array.from(l.querySelectorAll(t))}droppableHolding(l){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(l)||d.contains(l)||!!d.shadowRoot?.contains(l))??null}placeChip(l,d){this.#t.set(l,[...this.#t.get(l)??[],d])}removeChipFromDroppable(l,d){let h=l??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&Gr(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()),Gr(l,!1)}syncDragDropState(){let l={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),x=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[data-draggable="true"]'));l[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,x.length),h[m]=y}this._dragDrop={dragsByTarget:l,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:l}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(l[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((l,d)=>l+d,0)}droppableAtCapacityFromState(l){let d=parseInt(l.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=l.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(l){this._enableFlipAnimations=!l}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Cc(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let l=this.getResponse,d=typeof l=="function"?l.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(l){if(Array.isArray(l)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=l,this._internals.setFormValue(JSON.stringify(l));return}let d=this.getValue,h=typeof d=="function"?d.call(this,l):l,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof l=="string"&&l.length>0?[l]:[];this._internals.setFormValue(JSON.stringify(this._response)),this.trackedDroppables?.length&&this.validate()}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let l=this._pendingResponse;this._pendingResponse=void 0,this.response=l}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let l=this.dataset.choicesContainerWidth;l&&this.trackedDroppables.forEach(d=>{d.style.width=`${l}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(l){for(let h of l){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=l.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(l,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(l,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(l,d,h);let f=l.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity({trigger:"change"})}handleInvalidDrop(l){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!l)return;if(d&&f&&m)this.dropDraggableInDroppable(l,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(l,d,this.dragState.dragClone?.getBoundingClientRect());else if(Po(l,"lifted")){this.restoreInventoryItem(l,this.dragState.dragClone?.getBoundingClientRect());let g=l.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),x=this.maxAssociations>0&&y>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity({trigger:"change"})}animateReturn(l,d){!l||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{No(l,Uh(d),this.flipAnimationConfig)})}restoreInventoryItem(l,d){on(l),l.style.display="",l.style.position="",this.animateReturn(l,d)}placeResponse(l){let[d,...h]=l.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=Jr(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(l,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(l,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(l,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let _=l.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(l),l),_&&this.restoreOriginalInInventory(_,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,x=y===0||y>1,u=Array.from(d.querySelectorAll('[data-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Ve(u):null;if(!x){let _=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[data-draggable="true"]'));if(_){let A=_.getAttribute("identifier"),C=_.getBoundingClientRect();this.removeChipFromDroppable(d,_);let k=this.dragState.sourceDroppable,I=this.isDeclarativeTarget(d)&&k&&k!==d&&this.isDeclarativeTarget(k)?k:null;I?(this.placeChip(I,_),Gr(I,!0),this.animateReturn(_,C)):A&&this.restoreOriginalInInventory(A,C)}}let b=l.cloneNode(!0);b.removeAttribute("style"),b.removeAttribute("data-keyboard-dragging"),b.setAttribute("data-draggable","true"),b.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(b.setAttribute("part",b.localName==="qti-gap-text"?"chip text drag drag-text":"chip drag"),b.setAttribute("exportparts",["control: chip-control, control: drag-control, label: chip-label, label: drag-label","correction, candidate-correct, candidate-incorrect, candidate-partial","correction-correct, correction-incorrect, correction-partially-correct"].join(", ")),this.placeChip(d,b)):d.tagName==="SLOT"?b.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&b.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(b)),Gr(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&je(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let _=b.getBoundingClientRect(),A=h.left-_.left,C=h.top-_.top;(A!==0||C!==0)&&b.animate([{transform:`translate(${A}px, ${C}px)`},{transform:"translate(0, 0)"}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let q=l.getAttribute("identifier");q&&this.updateInventoryBasedOnMatchMax(q),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(l,d){let h=l.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&Gr(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(l,d){let h=Jr(this.trackedDragContainers,l),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[data-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let y=this.enableFlipAnimations&&m.length>0?Ve(m):null;h.forEach(x=>{on(x),x.style.display="",x.style.visibility="visible"}),y&&this.enableFlipAnimations&&je(y,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(l){let d=Jr(this.trackedDragContainers,l),h=Vh(this.trackedDraggables,l),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(x=>x.getAttribute("identifier")===l).length:m+y.querySelectorAll(`[identifier="${l}"]`).length,0);d.forEach(m=>{ft(m,"used",h!==0&&f>=h)})}checkAllMaxAssociations(){let l=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1}),h=this.maxAssociations>0&&l>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source"),y=this.droppableAtCapacityFromState(f);fr(f,(y||d&&h)&&!m)})}saveResponse(l){let d=this.getResponse,h=l??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(l=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this.trackedDroppables.forEach(d=>fr(d,!1)),this.checkAllMaxAssociations(),this.resetValidityReport(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),l&&this.saveResponse()}validate(){let l=this.totalAssociationsFromState(),d=this.maxAssociations>0&&l>=this.maxAssociations,h=this.maxAssociations>0&&l>this.maxAssociations,f=this.minAssociations>0&&l<this.minAssociations,m="",y=!0,x="other";h?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):f?(x="min",m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let u=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,u,{suppressInline:!0,kind:x}),y}reportValidity(l){return super.reportValidity(l)}}return sn([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),sn([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",void 0),sn([J({context:De})],a.prototype,"_dragDrop",void 0),sn([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),sn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Xt({emptyAs:[]})})],a.prototype,"response",null),a};var Lo=class{getInsertPosition(t,e,r,i,n){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),c=(n-a.top)/a.height,d=Math.min(1,Math.max(0,c))>.5;return{index:s,placeAfter:d}}};var Wh=new Lo;var Hm={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function an(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function Vo(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function jo(o,t,e={}){let r={...Hm,...e},i=document.createElement("div");return i.setAttribute("data-drop-preview","true"),i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(o).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(o).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*$o(o)}ms ease`,i.style.pointerEvents="none",i}function kc(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var jt=(o,t='[data-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=an(),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 kc(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let n=this.#c(i);return n===0||n>1}#c(i){let n=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(n)?1:n}#p(i){return i.querySelectorAll(t).length}#l(i){let n=this.#c(i);return n===0?!1:this.#p(i)>=n}#d(){this.#i={hoveredSlot:null,originalPositions:new Map}}#h(i){if(!this.#t||i===this.#t){this.#u();return}if(this.#i.hoveredSlot===i)return;this.#u();let n=this.#s(i);if(!n){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#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=Ve([n]);this.#i.originalPositions.set(n,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(n),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,je(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),n=i.length>0?Ve(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),n&&je(n,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,n,s,a,...c){this.#t=null,this.#r=an(),this.#d();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=jo(i,h,this.sortablePlaceholderConfig);let f=i.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",l.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==l&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;fr(m,!1),this.#n.add(m)}})}let[d]=c;super.initiateDrag(i,n,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[n,s]of this.#i.originalPositions)s.appendChild(n);this.#r.placeholder&&this.#r.placeholder.remove(),Vo(this.#r),this.#n.clear(),this.#t=null,this.#d()}onSortableDragMove(i,n){if(!this.isDraggingFromSlot)return;let s=Xr(this.trackedDroppables,i,n,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#h(s):this.#u()}handleDragMove(i,n){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,n),this.onSortableDragMove(i,n)}allowDrop(i,n){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&n!==this.#e&&this.trackedDroppables.includes(n)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(n)?this.#a(n)?!this.#l(n):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(n)?!0:super.allowDrop(i,n)}handleDrop(i,n){super.handleDrop(i,n),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var Qh=[M,U,Wt,w`
|
|
6871
|
+
<slot part="label"></slot>`}};Oo([p({type:String,attribute:"template-identifier"})],Lt.prototype,"templateIdentifier",void 0);Oo([p({type:String,attribute:"show-hide"})],Lt.prototype,"showHide",void 0);Oo([p({type:Boolean,converter:{fromAttribute:o=>o==="true",toAttribute:o=>String(o)}})],Lt.prototype,"fixed",void 0);Oo([p({type:String,attribute:!1})],Lt.prototype,"marker",void 0);var Mh=[{tag:"qti-simple-choice",ctor:Lt}];var Ph=[...uh,...fh,...bh,...qh,...wh,...kh,...Eh,..._h,...Rh,...Mh];var Lm=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n};function Vm(o,t,e,r,i={}){let n=i.publishWidth??!0,s=i.hostWindow??(typeof window<"u"?window:null);if(!t.length||!e.length||!s)return;let a=0,c=0,l=r.length?r:[o],d=l.map(h=>({el:h,reservation:h.style.getPropertyValue("--qti-drag-min-width"),hadStyleAttribute:h.hasAttribute("style")}));l.forEach(h=>h.style.setProperty("--qti-drag-min-width","0px")),t.forEach(h=>{let f=h.getBoundingClientRect();a=Math.max(a,f.height),c=Math.max(c,f.width)}),d.forEach(({el:h,reservation:f,hadStyleAttribute:m})=>{f?h.style.setProperty("--qti-drag-min-width",f):h.style.removeProperty("--qti-drag-min-width"),!m&&h.getAttribute("style")===""&&h.removeAttribute("style")}),i.hasChanged?.({height:a,width:c})!==!1&&(o.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(o.style.setProperty("--qti-dropzone-min-width",`${c}px`),o.style.setProperty("--qti-drag-min-width",`${c}px`)),r.forEach(h=>{h.style.minHeight=`var(--qti-drag-container-min-height, ${a}px)`,h.style.setProperty("--qti-dropzone-min-height",`${a}px`),n&&(h.style.setProperty("--qti-dropzone-min-width",`${c}px`),h.style.setProperty("--qti-drag-min-width",`${c}px`))}))}var vc=(o,t,e,r='slot[part~="bank"]')=>{class i extends o{constructor(){super(...arguments),this.autoSizeDropzones=!0,this.#t=null,this.#e=new Set,this.#r=null,this.#i=0,this.#n=null}get autoSizeDropzoneWidth(){return!0}#t;#e;#r;#i;#n;collectAutoSizeTargets(){let s=(a,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&&(Vm(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 Lm([p({type:Boolean,attribute:"auto-size-dropzones"})],i.prototype,"autoSizeDropzones",void 0),i};var{AbortController:Jt,AbortSignal:yc,WeakMap:jm,WeakRef:Fm,Window:Oh,reportError:Do=console.log}=globalThis,Ne=o=>o&&o.defaultView!==null&&o.defaultView.document===o&&(o.defaultView.top===o.defaultView||Ne(o.defaultView.parent.document)),ur=()=>!!Oh&&globalThis instanceof Oh,qc=Symbol("unset"),[Dh,zm]=(()=>{function o(x,u,g=!0){Object.defineProperty(x,u,{...Object.getOwnPropertyDescriptor(x,u),enumerable:g})}let t="try"in Promise?Promise.try.bind(Promise):(x,...u)=>new Promise(g=>g(x(...u))),e="withResolvers"in Promise?Promise.withResolvers.bind(Promise):()=>{let x,u;return{promise:new Promise((b,q)=>(x=b,u=q)),resolve:x,reject:u}};function r(x,u){let g=u.call(x);if(g===null||typeof g!="object")throw new TypeError("Iterator is not an object");return g}let i=new jm,n={next(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.next called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.next(...x))},return(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.return called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>b.return?b.return(...x):{value:void 0,done:!0})},throw(...x){let u=this,g=i.get(u);if(!g?.syncIteratorRecord)throw new TypeError("AsyncFromSyncIteratorPrototype.throw called on invalid object");let{syncIteratorRecord:b}=g;return t(()=>{if(!b.throw)throw b.return(),new TypeError("no throw method");return b.throw(...x)})}};function s(x){let u=Object.create(n);return i.set(u,{syncIteratorRecord:x}),u}function a(x,u){let g;if(u){if(g=x[Symbol.asyncIterator],g==null){if(g=x[Symbol.iterator],g==null)throw new TypeError("Object is not async iterable");let b=r(x,g);return s(b)}}else g=x[Symbol.iterator];if(g==null)throw new TypeError("Object is not iterable");return r(x,g)}let c="any"in yc?yc.any.bind(yc):x=>{let u=new Jt;for(let g of x)if(g.aborted)return u.abort(g.reason),u.signal;for(let g of x)g.addEventListener("abort",()=>{u.abort(g.reason)},{signal:u.signal});return u.signal},l=x=>c(x.filter(Boolean));class d{constructor({next:u,error:g,complete:b}={}){i.set(this,{next:u,error:g,complete:b})}next(u){let{next:g}=i.get(this)||{};g&&g(u)}error(u){let{error:g}=i.get(this)||{};g?g(u):Do(u)}complete(){let{complete:u}=i.get(this)||{};u&&u()}}function h(x,u){let g=i.get(x);if(g?.active){g.active=!1,g.subscriptionController.abort(u);for(let b of g.teardowns.reverse()){if(ur()&&!Ne(document))return;try{b()}catch(q){Do(q)}}}}function f(x,u,g={}){if(ur()&&!Ne(document))return;let b;typeof u=="function"?b=new d({next:u}):u&&!(u instanceof d)?b=new d(u):b=u||new d;let q=i.get(x),_=q.weakSubscriber?.deref();if(_?.active){let C=_,k=i.get(C);k.observers.add(b),g.signal&&(g.signal.aborted?k.observers.delete(b):g.signal.addEventListener("abort",()=>{let I=i.get(C);I?.active&&(I.observers.delete(b),I.observers.size==0&&h(C,g.signal.reason))}));return}let A=new m(b);if(q.weakSubscriber=new Fm(A),"signal"in g&&(g.signal.aborted?h(A,g.signal.reason):g.signal.addEventListener("abort",()=>{let C=i.get(A);C?.active&&(C.observers.delete(b),C.observers.size==0&&h(A,g.signal.reason))})),q.subscribeCallback)try{q.subscribeCallback(A)}catch(C){A.error(C)}}class m{get[Symbol.toStringTag](){return"Subscriber"}constructor(u=null){if(!(u instanceof d))throw new TypeError("Illegal constructor");i.set(this,{active:!0,observers:new Set([u]),teardowns:[],subscriptionController:new Jt})}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||ur()&&!Ne(document))return;let b=new Set(g.observers);for(let q of b)q.next(u)}error(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(!arguments.length)throw new TypeError("too few arguments");let g=i.get(this);if(!g?.active){Do(u);return}if(ur()&&!Ne(document))return;h(this,u);let b=new Set(g.observers);for(let q of b)q.error(u)}complete(){if(!(this instanceof m))throw new TypeError("illegal invocation");let u=i.get(this);if(!u?.active||ur()&&!Ne(document))return;h(this);let g=new Set(u.observers);for(let b of g)b.complete()}addTeardown(u){if(!(this instanceof m))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");if(ur()&&!Ne(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 Jt;return u.abort(),u.signal}return i.get(this).subscriptionController.signal}}o(m.prototype,"next"),o(m.prototype,"error"),o(m.prototype,"complete"),o(m.prototype,"addTeardown"),o(m.prototype,"active"),o(m.prototype,"signal");class y{get[Symbol.toStringTag](){return"Observable"}constructor(u){if(!u)throw new TypeError("1 argument required but 0 present");i.set(this,{weakSubscriber:null,subscribeCallback:u})}static from(u){if(u===null||typeof u!="object")throw new TypeError("Observable.from only accepts objects");if(u instanceof y)return u;if(typeof(Symbol.asyncIterator in u&&u[Symbol.asyncIterator])=="function"){let _=function(A,C){if(A.signal.aborted)return;let k;try{let I=C.next();k=Promise.resolve(I)}catch(I){k=Promise.reject(I)}k.then(I=>{if(I===null||typeof I!="object"){A.error(new TypeError("Not an IteratorResult."));return}try{({done:q}=I)}catch(V){A.error(V);return}if(q){A.complete();return}let $;try{$=I.value}catch(V){A.error(V);return}A.next($),_(A,C)},I=>{A.error(I)})},q=!1;return new y(A=>{if(A.signal.aborted)return;let C;try{C=a(u,!0)}catch(I){A.error(I);return}let k=C;A.signal.aborted||(A.signal.addEventListener("abort",()=>{if(typeof k.return!="function"||q)return;t(()=>k.return(A.signal.reason)).then($=>{if($===null||typeof $!="object")throw new TypeError("Iterator .return() must return an Object")})}),_(A,k))})}if(typeof(Symbol.iterator in u&&u[Symbol.iterator])=="function")return new y(q=>{if(q.signal.aborted)return;let _;try{_=a(u,!1)}catch(k){q.error(k);return}let A=!1,C=_;if(!q.signal.aborted)for(q.signal.addEventListener("abort",()=>{if(typeof C.return!="function"||A)return;let k=C.return();if(k===null||typeof k!="object")throw new TypeError("Iterator .return() must return an Object")});;)try{let k=C.next();if({done:A}=k,A){q.complete();return}if(q.next(k.value),q.signal.aborted)break}catch(k){q.error(k);break}});if(u instanceof Promise||typeof u.then=="function")return new y(q=>{u.then(_=>{q.next(_),q.complete()},_=>{q.error(_)})});throw new TypeError("Could not convert value to Observable")}subscribe(u=null,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");f(this,u,g)}takeUntil(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this,b=y.from(u);return new y(q=>{let _=new d({next(){q.complete()},error(){q.complete()}}),A={signal:q.signal};if(f(b,_,A),!q.active)return;let C=new d({next(k){q.next(k)},error(k){q.error(k)},complete(){q.complete()}});f(g,C,A)})}map(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(C){let k;try{k=u(C,q)}catch(I){b.error(I);return}q+=1,b.next(k)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}inspect(u={}){let g=null,b=null,q=null,_=null,A=null;typeof u=="function"?b=u:u&&typeof u=="object"&&("subscribe"in u&&(g=u.subscribe),"next"in u&&(b=u.next),"error"in u&&(q=u.error),"complete"in u&&(_=u.complete),"abort"in u&&(A=u.abort));let C=this;return new y(k=>{if(g!==null)try{g()}catch(L){k.error(L);return}let I=()=>{try{A!==null&&A(k.signal.reason)}catch(L){Do(L)}};k.signal.addEventListener("abort",I,{once:!0});let $=new d({next(L){if(b!==null)try{b(L)}catch(ht){k.signal.removeEventListener("abort",I),k.error(ht);return}k.next(L)},error(L){if(k.signal.removeEventListener("abort",I),q!==null)try{q(L)}catch(ht){k.error(ht);return}k.error(L)},complete(){if(k.signal.removeEventListener("abort",I),_!==null)try{_()}catch(L){k.error(L);return}k.complete()}}),V={signal:k.signal};f(C,$,V)})}filter(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=new d({next(C){let k=!1;try{k=u(C,q)}catch(I){b.error(I);return}q+=1,k&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}take(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u;if(q==0)return b.complete();let _=new d({next(C){b.next(C),q-=1,q==0&&b.complete()},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}drop(u){if(!(this instanceof y))throw new TypeError("illegal invocation");let g=this;return new y(b=>{let q=u,_=new d({next(C){if(q>0)return q-=1;q==0&&b.next(C)},error(C){b.error(C)},complete(){b.complete()}}),A={signal:b.signal};f(g,_,A)})}flatMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=[];function C(V){let L;try{L=u(V,q)}catch(re){return b.error(re)}q+=1;let ht;try{ht=y.from(L)}catch(re){return b.error(re)}let ba=new d({next(re){b.next(re)},error(re){b.error(re)},complete(){if(A.length){let re=A.shift();C(re)}else k=!1,_&&b.complete()}}),Ft={signal:b.signal};f(ht,ba,Ft)}let k=!1,I=new d({next(V){k?A.push(V):(k=!0,C(V))},error(V){b.error(V)},complete(){_=!0,!k&&!A.length&&b.complete()}}),$={signal:b.signal};f(g,I,$)})}switchMap(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{let q=0,_=!1,A=null;function C($){let V;try{V=u($,q)}catch(Ft){return b.error(Ft)}q+=1;let L;try{L=y.from(V)}catch(Ft){return b.error(Ft)}let ht=new d({next(Ft){b.next(Ft)},error(Ft){b.error(Ft)},complete(Ft){_?b.complete():A=null}}),ba={signal:l([A.signal,b.signal])};f(L,ht,ba)}let k=new d({next($){A&&A.abort(),A=new Jt,C($)},error($){b.error($)},complete(){_=!0,A||b.complete()}}),I={signal:b.signal};f(g,k,I)})}catch(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(q=>{let _=new d({next(C){q.next(C)},error(C){let k;try{k=u(C)}catch(L){q.error(L);return}let I;try{I=y.from(k)}catch(L){q.error(L);return}let $=new d({next(L){q.next(L)},error(L){q.error(L)},complete(){q.complete()}}),V={signal:q.signal};f(I,$,V)},complete(){q.complete()}}),A={signal:q.signal};f(g,_,A)})}finally(u){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let g=this;return new y(b=>{b.addTeardown(u);let q=new d({next(A){b.next(A)},error(A){b.error(A)},complete(){b.complete()}}),_={signal:b.signal};f(g,q,_)})}toArray(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return Promise.reject(u.signal.reason);u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=[],A=new d({next(C){_.push(C)},error(C){q(C)},complete(){b(_)}});return f(this,A,u),g}forEach(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){try{u($,k)}catch(V){_(V),A.abort(V)}k+=1},error($){_($)},complete(){q()}});return f(this,I,C),b}every(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V||(q(!1),A.abort())},error($){_($)},complete(){q(!0)}});return f(this,I,C),b}first(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e(),_=new Jt,A={signal:l([_.signal,u.signal])};if(A.signal.aborted)return q(A.signal.reason),g;A.signal.addEventListener("abort",()=>{q(A.signal.reason)});let C=new d({next(k){b(k),_.abort()},error(k){q(k)},complete(){q(new RangeError("No values in Observable"))}});return f(this,C,A),g}last(u={}){if(!(this instanceof y))throw new TypeError("illegal invocation");let{promise:g,resolve:b,reject:q}=e();if(u.signal){if(u.signal.aborted)return q(u.signal.reason),g;u.signal.addEventListener("abort",()=>{q(u.signal.reason)})}let _=null,A=!1,C=new d({next(k){A=!0,_=k},error(k){q(k)},complete(){A?b(_):q(new RangeError("No values in Observable"))}});return f(this,C,u),g}find(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V&&(q($),A.abort())},error($){_($)},complete(){q()}});return f(this,I,C),b}some(u,g={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:b,resolve:q,reject:_}=e(),A=new Jt,C={signal:l([A.signal,g.signal])};if(C.signal.aborted)return _(C.signal.reason),b;C.signal.addEventListener("abort",()=>{_(C.signal.reason)});let k=0,I=new d({next($){let V=!1;try{V=u($,k)}catch(L){_(L),A.abort(L)}k+=1,V&&(q(!0),A.abort())},error($){_($)},complete(){q(!1)}});return f(this,I,C),b}reduce(u,g,b={}){if(!(this instanceof y))throw new TypeError("illegal invocation");if(typeof u!="function")throw new TypeError("Parameter 1 is not of type 'Function'");let{promise:q,resolve:_,reject:A}=e(),C=new Jt,k={signal:l([C.signal,b.signal])};if(k.signal.aborted)return A(k.signal.reason),q;k.signal.addEventListener("abort",()=>{A(k.signal.reason)},{once:!0});let I=0,$=arguments.length>1?g:qc,V=new d({next(L){if($===qc){$=L,I++;return}try{let ht=u($,L,I);I++,$=ht}catch(ht){A(ht),C.abort(ht);return}},error(L){A(L)},complete(){$!==qc?_($):A(new TypeError("no initial value provided and no values emitted"))}});return f(this,V,k),q}}return o(y.prototype,"subscribe"),[y,m]})();function $h(){return typeof globalThis.Observable=="function"}function Nh(){Object.defineProperties(globalThis,{Observable:{value:Dh,configurable:!0,writable:!0},Subscriber:{value:zm,configurable:!0,writable:!0}}),EventTarget.prototype.when=function(o,t={}){if(ur()&&!Ne(document))return;let e=this;return new Dh(r=>{if(!e||r.signal.aborted)return;let i=n=>{r.next(n)};e.addEventListener(o,i,{capture:t.capture||!1,passive:t.passive,once:!1,signal:r.signal})})}}function xc(o,t,e){let r=o.filter(i=>!i.hasAttribute("disabled"));for(let i of r){let n=i.getBoundingClientRect();if(t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom)return i}return null}function Lh(o,t,e,r){if(!r)return null;let i=o.filter(s=>!s.hasAttribute("disabled")),n=r.getBoundingClientRect();for(let s of i){let a=s.getBoundingClientRect();if(!(n.right<a.left||n.left>a.right||n.bottom<a.top||n.top>a.bottom))return s}return null}function Vh(o,t,e,r){let i=o.filter(l=>!l.hasAttribute("disabled"));if(i.length===0)return null;let n,s;if(r){let l=r.getBoundingClientRect();n=l.left+l.width/2,s=l.top+l.height/2}else n=t,s=e;let a=null,c=1/0;for(let l of i){let d=l.getBoundingClientRect(),h=d.left+d.width/2,f=d.top+d.height/2,m=Math.sqrt(Math.pow(n-h,2)+Math.pow(s-f,2));m<c&&(c=m,a=l)}return a}function jh(o,t,e,r){let i=o.filter(c=>!c.hasAttribute("disabled"));if(i.length===0)return null;let n;if(r){let c=r.getBoundingClientRect();n=[{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 n=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let s=null,a=1/0;for(let 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,f=0;for(let y of n)for(let x of d){let u=Math.sqrt(Math.pow(y.x-x.x,2)+Math.pow(y.y-x.y,2));h+=u,f++}let m=h/f;m<a&&(a=m,s=c)}return s}function Bm(o,t,e){let r=o.getBoundingClientRect();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}function Um(o,t,e,r,i){let n=i&&i.length>0?o.filter(g=>i.includes(g)):o.filter(g=>g.tagName==="SLOT"&&g.hasAttribute("part")&&g.getAttribute("part")?.split(/\s+/).includes("bank")),a=o.filter(g=>!n.includes(g));if(n.length===0&&a.length===0)return null;let c;if(r){let g=r.getBoundingClientRect();c=[{x:g.left,y:g.top},{x:g.right,y:g.top},{x:g.left,y:g.bottom},{x:g.right,y:g.bottom}]}else c=[{x:t,y:e},{x:t,y:e},{x:t,y:e},{x:t,y:e}];let l=g=>{let b=g.getBoundingClientRect(),q=[{x:b.left,y:b.top},{x:b.right,y:b.top},{x:b.left,y:b.bottom},{x:b.right,y:b.bottom}],_=0,A=0;for(let C of c)for(let k of q){let I=Math.sqrt(Math.pow(C.x-k.x,2)+Math.pow(C.y-k.y,2));_+=I,A++}return _/A},d=null,h=1/0;for(let g of n){let b=l(g);b<h&&(h=b,d=g)}let f=null,m=1/0;for(let g of a){let b=l(g);b<m&&(m=b,f=g)}if(d&&r){let g=r.getBoundingClientRect(),b=d.getBoundingClientRect(),q=g.left+g.width/2,_=g.top+g.height/2;if(q>=b.left&&q<=b.right&&_>=b.top&&_<=b.bottom)return d}if(f&&Bm(f,t,e))return f;let x=r?.getAttribute("data-drag-origin")==="droppable"?.85:1.5;return d&&f?h<=m*x?d:f:d||f}function Fh(o){switch(o){case"pointerWithin":return xc;case"rectangleIntersection":return Lh;case"closestCenter":return Vh;case"closestCorners":return jh;case"closestCornersWithInventoryPriority":return Um;default:return xc}}function Xr(o,t,e,r,i="pointerWithin",n){return Fh(i)(o,t,e,r,n)}function Le(o,t){let e=o.composedPath?o.composedPath():[o.target];for(let r of e)if(r instanceof HTMLElement&&r.tagName!=="SLOT"){if(r.matches(t)||r.hasAttribute("data-draggable"))return r;let i=r.closest(t)||r.closest('[data-draggable="true"]');if(i)return i}return null}function nn(o){return o?o.hasAttribute("disabled")?!0:o.internals?.states?.has("disabled")??!1:!1}var wc=o=>o?.internals;function ft(o,t,e){z(wc(o)?.states,t,e)}function $o(o,t){return Ni(wc(o)?.states,t)}function on(o){ft(o,"lifted",!1),ft(o,"used",!1),ft(o,"return-target",!1)}function mr(o){return $o(o,"lifted")||$o(o,"used")}var zh={filled:[],full:[],"drag-active":["active","enabled"],"drag-over":["hover"]};function Yt(o,t,e){if(!o)return;let r=[t,...zh[t]];for(let s of r)e?o.setAttribute(s,""):o.removeAttribute(s);let i=wc(o)?.states;if(i){z(i,t,e,zh[t]);return}let n=new Set((o.getAttribute("part")??"").split(/\s+/).filter(Boolean));if(!(!n.has("drop")&&!n.has("bank"))){for(let s of r)e?n.add(s):n.delete(s);o.setAttribute("part",[...n].join(" "))}}function fr(o,t){o&&(t?o.setAttribute("disabled",""):o.removeAttribute("disabled"),Yt(o,"full",t))}function Gr(o,t){Yt(o,"filled",t)}function Jr(o,t){let e=[];return o.forEach(r=>{let i=[];r.tagName.toLowerCase()==="slot"?i=r.assignedElements({flatten:!0}).filter(a=>a.getAttribute("identifier")===t):i=Array.from(r.querySelectorAll(`[identifier="${t}"]`)),e.push(...i)}),e}function Bh(o,t){let e=o.find(i=>i.getAttribute("identifier")===t);if(!e)return 1;let r=e.getAttribute("match-max");return r?parseInt(r,10)||0:1}var Cc={origin:{x:0,y:0},scale:{x:1,y:1}},No=100,Hm=o=>{let t=o.fullscreenElement??o.webkitFullscreenElement??null;for(;t instanceof HTMLElement;){let e=t.shadowRoot?.fullscreenElement??null;if(!e||e===t)break;t=e}return t instanceof HTMLElement?t:null},Wm=o=>{let t=o.shadowRoot;return t?t.querySelector("slot:not([name])")?o:t:o},Qm=(o,t)=>{let e=t;for(;e;){if(e===o)return!0;e=e.parentNode??e.host??null}return!1},kc=(o,t)=>{let e=o.ownerDocument??document,r=t??e.body,i=Hm(e);return i&&!Qm(i,r)?Wm(i):r},Sc=(o,t=1)=>{let r=(o.ownerDocument??document).createElement("div");r.style.cssText=`position:fixed;left:0;top:0;width:${No}px;height:${No}px;margin:0;padding:0;border:0;visibility:hidden;pointer-events:none;`,o.appendChild(r);let i=r.getBoundingClientRect();return r.remove(),{origin:{x:i.left,y:i.top},scale:{x:(i.width/No||1)*t,y:(i.height/No||1)*t}}},Uh=(o,t,e)=>({x:(t-o.origin.x)/o.scale.x,y:(e-o.origin.y)/o.scale.y});$h()||Nh();var Hh=new WeakSet;function Xm(o){!o||Hh.has(o)||(o.addEventListener("touchmove",()=>{},{capture:!1,passive:!1}),Hh.add(o))}var Wh=o=>!!o.internals?.states,Lo=(o,t,e,r='slot[part~="bank"]',i="pointerWithin")=>{class n extends o{constructor(){super(...arguments),this.trackedDraggables=[],this.trackedDroppables=[],this.trackedDragContainers=[],this.allDropzones=[],this.collisionDetectionAlgorithm=i,this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,returnAnchorItems:[]},this.cloneFrame=Cc,this.cursorBeforeDrag=null,this.cloneZoom=1,this.subscriptions=[],this.dragSubscriptions=[],this.lastPointerDownAt=0,this.lastTouchStartAt=0,this.#t=new Set,this.#e=new Set,this.#r=a=>{let c=a;if(c.context!==Tr)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}),Xm(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,I)=>Array.from(I?.querySelectorAll(k)??[]),c=a(t,this),l=a(t,this.shadowRoot),d=a('[data-draggable="true"]:not([data-drag-clone])',this),h=a('[data-draggable="true"]:not([data-drag-clone])',this.shadowRoot),f=this.registeredMatching(t);this.trackedDraggables=Array.from(new Set([...c,...l,...d,...h,...f]));let m=a(e,this),y=a(e,this.shadowRoot);this.trackedDroppables=Array.from(new Set([...m,...y]));let x=a(r,this),u=a(r,this.shadowRoot);this.trackedDragContainers=Array.from(new Set([...x,...u])),this.allDropzones=[...this.trackedDroppables,...this.trackedDragContainers];let g=this.isDragDropEnabled(),b=new Set(this.trackedDraggables),q=new Set(this.trackedDroppables),_=g?b:new Set,A=g?q:new Set,C=new Set([...b,...q].filter(Wh));for(let k of this.#t)C.has(k)||(z(k.internals.states,"chip",!1),z(k.internals.states,"drop",!1));for(let k of C){let I=_.has(k),$=!I&&A.has(k);z(k.internals.states,"chip",I),z(k.internals.states,"drop",$)}this.#t=C,this.trackedDraggables.forEach(k=>{let I=mr(k);g&&!I?(k.style.cursor="grab",k.style.userSelect="none",k.style.touchAction="none",k.style.webkitUserSelect="none",k.style.webkitTouchCallout="none",k.setAttribute("data-draggable","true"),k.setAttribute("tabindex","0")):(k.style.cursor="",k.style.userSelect="",k.style.touchAction="",k.style.webkitUserSelect="",k.style.webkitTouchCallout="",k.removeAttribute("data-draggable"),k.getAttribute("tabindex")==="0"&&k.removeAttribute("tabindex"))})}setupDragObservables(){let a=this.shadowRoot;if(!a){console.error("\u274C [Observable DnD] No shadow root found!");return}let c=a.when("pointerdown").filter(m=>{if(!m.isTrusted)return!1;let y=Le(m,t),x=this.disabled||this.readonly,u=nn(y)||mr(y),g=Date.now()-this.lastTouchStartAt<50;return y&&m.isPrimary!==!1&&m.button===0&&!x&&!u&&!g}).subscribe(m=>{this.lastPointerDownAt=Date.now();let y=Le(m,t);if(!y){console.warn("\u26A0\uFE0F [Observable DnD] No draggable target found");return}m.pointerType==="touch"&&(m.preventDefault(),m.stopPropagation());let x=m.isTrusted?m.pointerType==="touch"?100:10:0;if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),x===0){this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted);return}let u=()=>{this.dragState.activationTimeout&&(clearTimeout(this.dragState.activationTimeout),this.dragState.activationTimeout=void 0),document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0)};document.addEventListener("pointerup",u,{once:!0,capture:!0}),document.addEventListener("pointercancel",u,{once:!0,capture:!0}),this.dragState.activationTimeout=window.setTimeout(()=>{this.dragState.activationTimeout=void 0,document.removeEventListener("pointerup",u,!0),document.removeEventListener("pointercancel",u,!0),this.dragState.dragging||this.initiateDrag(y,m.clientX,m.clientY,m.pointerType,"pointer",m.pointerId,m.isTrusted)},x)}),l=a.when("mousedown").filter(m=>{let y=Le(m,t),x=this.disabled||this.readonly,u=nn(y)||mr(y),g=m.button===0,b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Le(m,t);!y||this.dragState.dragging||(m.preventDefault(),this.initiateDrag(y,m.clientX,m.clientY,"mouse","mouse",void 0,m.isTrusted))}),d=a.when("touchstart").filter(m=>{let y=Le(m,t),x=this.disabled||this.readonly,u=nn(y)||mr(y),g=!!(m.touches?.[0]||m.changedTouches?.[0]),b=Date.now()-this.lastPointerDownAt<50;return y&&g&&!x&&!u&&!b}).subscribe(m=>{let y=Le(m,t),x=m.touches?.[0]||m.changedTouches?.[0];!y||!x||this.dragState.dragging||(this.lastTouchStartAt=Date.now(),m.preventDefault(),m.stopPropagation(),this.initiateDrag(y,x.clientX,x.clientY,"touch","touch",void 0,m.isTrusted))}),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null},f=a.when("keydown").subscribe(m=>{let y=this.trackedDraggables.filter(u=>!mr(u)),x=[...this.trackedDroppables,...this.trackedDragContainers];if(h.dragging)switch(m.code){case"ArrowRight":case"ArrowDown":{m.preventDefault();let u=(h.dropIndex+1)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"ArrowLeft":case"ArrowUp":{m.preventDefault();let u=(h.dropIndex-1+x.length)%x.length;h={...h,dropIndex:u,dropElement:x[u]};break}case"Space":case"Enter":case"Tab":{m.preventDefault(),h.dragElement&&h.dropElement&&(this.allowDrop(h.dragElement,h.dropElement)||this.trackedDragContainers.includes(h.dropElement)?this.handleDrop(h.dragElement,h.dropElement):this.handleInvalidDrop(h.dragElement)),this.endKeyboardDrag(),this.saveResponse(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}case"Escape":{m.preventDefault(),this.endKeyboardDrag(),h={dragging:!1,dragElement:null,dragIndex:0,dropIndex:0,dropElement:null};break}}else{let u=Le(m,t),g=this.disabled||this.readonly,b=nn(u)||mr(u);u&&["Space","Enter"].includes(m.code)&&!g&&!b&&(m.preventDefault(),u.setAttribute("data-keyboard-dragging","true"),ft(u,"lifted",!0),this.activateAllDroppables(this.trackedDroppables.some(q=>q.contains(u)||!!q.shadowRoot?.contains(u))),h={dragging:!0,dragElement:u,dragIndex:y.indexOf(u),dropIndex:0,dropElement:x[0]})}this.allDropzones.forEach(u=>Yt(u,"drag-over",!1)),h.dragging&&h.dropElement&&(Yt(h.dropElement,"drag-over",!0),h.dropElement.hasAttribute("tabindex")&&h.dropElement.getAttribute("tabindex")!=="-1"&&h.dropElement.focus())});this.subscriptions.push(c,l,d,f)}initiateDrag(a,c,l,d,h="pointer",f,m){if(this.dragState.dragging){console.warn("\u26A0\uFE0F [Observable DnD] Already dragging, ignoring initiateDrag");return}if(a.hasAttribute("data-drag-clone")){console.warn("\u26A0\uFE0F [Observable DnD] Attempted to drag visual clone, ignoring");return}let y=b=>b.contains(a)||!!b.shadowRoot?.contains(a),x=this.trackedDroppables.some(y),u=this.trackedDroppables.find(y)||null;a.getAnimations().forEach(b=>b.cancel());let g=a.getBoundingClientRect();if(this.dragState={dragging:!0,dragSource:a,dragClone:this.createDragClone(a,g),startOffset:{x:c-g.left,y:l-g.top},currentTarget:null,sourceDroppable:u,inputType:d,pointerId:f,startedFromTrustedEvent:m,initialCoordinates:{x:c,y:l},returnAnchorItems:[]},x){this.dragState.dragClone?.setAttribute("data-drag-origin","droppable"),this.removeChipFromDroppable(u,a),this.cacheInteractiveElements(),fr(u,!1),u&&u.setAttribute("data-drag-source","true");let b=a.getAttribute("identifier");if(b){let q=Jr(this.trackedDragContainers,b);q.forEach(_=>ft(_,"return-target",!0)),this.dragState.returnAnchorItems=q}}else this.dragState.dragClone?.setAttribute("data-drag-origin","inventory"),ft(a,"lifted",!0);if(this.updateClonePosition(c,l),this.activateAllDroppables(x),this.watchDragCloneHost(),h==="pointer"){let b=this.ownerDocument.documentElement;this.cursorBeforeDrag=b.style.cursor,b.style.cursor="grabbing"}this.setupMoveObservables(d,h)}setupMoveObservables(a,c="pointer"){if(a==="touch"){if(c==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.setPointerCapture&&q.setPointerCapture(_)}catch{}let g=q=>{q.cancelable&&(q.preventDefault(),c==="pointer"&&q.stopPropagation())};document.addEventListener("touchmove",g,{passive:!1,capture:!0}),document.addEventListener("touchstart",g,{passive:!1,capture:!0}),document.addEventListener("touchend",g,{passive:!1,capture:!0}),document.addEventListener("gesturestart",g,{passive:!1}),document.addEventListener("gesturechange",g,{passive:!1}),document.addEventListener("gestureend",g,{passive:!1});let b=()=>{if(document.removeEventListener("touchmove",g,{capture:!0}),document.removeEventListener("touchstart",g,{capture:!0}),document.removeEventListener("touchend",g,{capture:!0}),document.removeEventListener("gesturestart",g),document.removeEventListener("gesturechange",g),document.removeEventListener("gestureend",g),c==="pointer")try{let q=this.dragState.dragSource,_=this.dragState.pointerId;q&&_!==void 0&&q.releasePointerCapture&&q.releasePointerCapture(_)}catch{}};this.dragState.touchCleanup=b}let l=c==="mouse"?"mousemove":c==="touch"?"touchmove":"pointermove",d=c==="mouse"?"mouseup":c==="touch"?"touchend":"pointerup",h=g=>{let b=this.dragState.startedFromTrustedEvent;return b===void 0||g.isTrusted===b},f=document.when(l).takeUntil(document.when(d)).subscribe({next:g=>{if(h(g)){if(g.preventDefault(),g.stopPropagation(),c==="touch"){let b=g.touches?.[0]||g.changedTouches?.[0];if(!b)return;this.handleDragMove(b.clientX,b.clientY);return}if(c==="mouse"){let b=g;if(typeof b.buttons=="number"&&(b.buttons&1)!==1)return}this.handleDragMove(g.clientX,g.clientY)}}}),m=document.when(d).subscribe({next:g=>{h(g)&&(g.preventDefault(),g.stopPropagation(),this.handleDragEnd())}}),y=c==="touch"?document.when("touchcancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}):c==="mouse"?null:document.when("pointercancel").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),x=document.when("keydown").filter(g=>g.key==="Escape").subscribe({next:g=>{h(g)&&this.handleDragEnd()}}),u=[f,m,x];y&&u.push(y),this.dragSubscriptions.push(...u)}handleDragMove(a,c){if(!this.dragState.dragging||!this.dragState.dragClone)return;this.updateClonePosition(a,c);let l=Xr(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=>Yt(m,"drag-over",!1)),l&&Yt(l,"drag-over",!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 y=c.getBoundingClientRect();h=Xr(this.allDropzones,y.left+y.width/2,y.top+y.height/2,c,this.collisionDetectionAlgorithm,this.trackedDragContainers)??l}!!a&&!!h&&this.allowDrop(a,h)&&a&&h?(this.handleDrop(a,h),ft(a,"lifted",!1)):this.handleInvalidDrop(a),c&&c.remove(),(this.dragState.returnAnchorItems||[]).forEach(y=>{ft(y,"return-target",!1)}),this.dragState.touchCleanup&&this.dragState.touchCleanup(),this.resetDragState(),this.deactivateAllDroppables(),this.saveResponse(),d&&d.removeAttribute("data-drag-source"),this.cacheInteractiveElements();let m=this.checkAllMaxAssociations;typeof m=="function"&&m.call(this)}allowDrop(a,c){return this.trackedDroppables.includes(c)||this.trackedDragContainers.includes(c)}handleInvalidDrop(a){on(a)}createDragClone(a,c){let l=a.cloneNode(!0),d=window.getComputedStyle(a);for(let f=0;f<d.length;f++){let m=d[f];l.style.setProperty(m,d.getPropertyValue(m))}l.style.removeProperty("box-shadow");let h=kc(a.isConnected?a:this,this.dragCloneRoot());return this.cloneZoom=parseFloat(d.zoom)||1,this.cloneFrame=Sc(h,this.cloneZoom),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.removeAttribute("data-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}=Uh(this.cloneFrame,a-l.x,c-l.y);this.dragState.dragClone.style.left=`${d}px`,this.dragState.dragClone.style.top=`${h}px`}watchDragCloneHost(){let a=this.ownerDocument??document,c=()=>{let{dragClone:l,dragSource:d,lastCoordinates:h}=this.dragState;if(!l)return;let f=d?.isConnected?d:this,m=kc(f,this.dragCloneRoot());m!==l.parentNode&&(m.appendChild(l),this.cloneFrame=Sc(m,this.cloneZoom),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(a=!1){this.setDragActive(!0),this.allDropzones.forEach(c=>{let l=this.trackedDragContainers.includes(c);Yt(c,"drag-active",a||!l)})}deactivateAllDroppables(){this.setDragActive(!1),this.allDropzones.forEach(a=>{Yt(a,"drag-active",!1),Yt(a,"drag-over",!1)})}endKeyboardDrag(){this.trackedDraggables.forEach(a=>{a.hasAttribute("data-keyboard-dragging")&&ft(a,"lifted",!1),a.removeAttribute("data-keyboard-dragging")}),this.deactivateAllDroppables()}setDragActive(a){z(this._internals?.states,"drag-active",a,["dragzone-active","dragzone-enabled"])}resetDragState(){if(this.dragState.activationTimeout&&clearTimeout(this.dragState.activationTimeout),(this.dragState.returnAnchorItems||[]).forEach(a=>{ft(a,"return-target",!1)}),this.dragState.touchCleanup)try{this.dragState.touchCleanup()}catch(a){console.warn("\u26A0\uFE0F [Observable DnD] Error during touch cleanup:",a)}this.dragSubscriptions.forEach(a=>{try{a&&typeof a.unsubscribe=="function"&&a.unsubscribe()}catch(c){console.warn("\u26A0\uFE0F [Observable DnD] Error unsubscribing:",c)}}),this.dragSubscriptions=[],this.cloneFrame=Cc,this.cloneZoom=1,this.cursorBeforeDrag!==null&&(this.ownerDocument.documentElement.style.cursor=this.cursorBeforeDrag,this.cursorBeforeDrag=null),this.dragState={dragging:!1,dragSource:null,dragClone:null,startOffset:{x:0,y:0},currentTarget:null,sourceDroppable:null,inputType:null,pointerId:void 0,startedFromTrustedEvent:void 0,touchCleanup:void 0,returnAnchorItems:[]}}setInternalsState(a,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)Wh(a)&&(z(a.internals.states,"chip",!1),z(a.internals.states,"drop",!1));this.#t.clear(),this.resetDragState()}}return n};var Qh={duration:250,easing:"ease",fill:"both"};function Ec(o){let t=o.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function Xh(o){return{left:o.left,top:o.top,width:o.width,height:o.height}}function Ve(o){let t=new Map;return o.forEach(e=>{t.set(e,Ec(e))}),t}function Gh(o,t){return{deltaX:o.left-t.left,deltaY:o.top-t.top,deltaW:o.width/t.width,deltaH:o.height/t.height}}function Vo(o){if(typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return 0;if(!o)return 1;let t=getComputedStyle(o).getPropertyValue("--qti-motion").trim();if(t==="")return 1;let e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:0}function Ac(o){return Vo(o)>0}function jo(o,t,e={}){let r=Vo(o);if(r<=0)return null;let i=Ec(o),{deltaX:n,deltaY:s,deltaW:a,deltaH:c}=Gh(t,i);if(n===0&&s===0&&a===1&&c===1)return null;let{duration:l,easing:d,fill:h}={...Qh,...e};return o.animate([{transformOrigin:"top left",transform:`translate(${n}px, ${s}px) scale(${a}, ${c})`},{transformOrigin:"top left",transform:"none"}],{duration:l*r,easing:d,fill:h})}function je(o,t={}){let e=new Map;return o.forEach((r,i)=>{if(!(i instanceof HTMLElement))return;let n=jo(i,r,t);n&&e.set(i,n)}),e}var sn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Vt=(o,t,e,r='slot[part~="bank"]',i="closestCornersWithInventoryPriority")=>{let n=vc(o,t,e,r),s=Lo(n,t,e,r,i);class a extends s{constructor(){super(...arguments),this.minAssociations=1,this.maxAssociations=0,this._response=[],this._dragDrop={dragsByTarget:{},countByTarget:{},nodesByTarget:{}},this.#t=new WeakMap,this._dropBlockedDueToMax=!1,this.flipAnimationConfig={duration:200,easing:"ease"},this._enableFlipAnimations=!0,this._pendingResponse=void 0}#t;isSwapTarget(l){let d=this.dragState.sourceDroppable,h=parseInt(l.getAttribute("match-max")||"1",10);return(Number.isNaN(h)?1:h)===1&&this.isDeclarativeTarget(l)&&!!d&&d!==l&&this.trackedDroppables.includes(d)}isDeclarativeTarget(l){return l?l.acceptsDeclarativeDrops===!0?!0:l.hasAttribute("data-declarative-drops"):!1}chipsIn(l){return this.isDeclarativeTarget(l)?[...this.#t.get(l)??[]]:Array.from(l.querySelectorAll(t))}droppableHolding(l){return this.trackedDroppables.find(d=>this.chipsIn(d).includes(l)||d.contains(l)||!!d.shadowRoot?.contains(l))??null}placeChip(l,d){this.#t.set(l,[...this.#t.get(l)??[],d])}removeChipFromDroppable(l,d){let h=l??this.droppableHolding(d);if(h&&this.isDeclarativeTarget(h)){let f=(this.#t.get(h)??[]).filter(m=>m!==d);this.#t.set(h,f),f.length===0&&Gr(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()),Gr(l,!1)}syncDragDropState(){let l={},d={},h={};for(let f of this.trackedDroppables){let m=f.getAttribute("identifier");if(!m)continue;let y=this.chipsIn(f),x=this.isDeclarativeTarget(f)?y:Array.from(f.querySelectorAll('[data-draggable="true"]'));l[m]=y.map(u=>u.getAttribute("identifier")).filter(u=>!!u),d[m]=Math.max(y.length,x.length),h[m]=y}this._dragDrop={dragsByTarget:l,countByTarget:d,nodesByTarget:h},this.requestUpdate()}responseFromState(){this.syncDragDropState();let{dragsByTarget:l}=this._dragDrop;return this.trackedDroppables.flatMap(d=>{let h=d.getAttribute("identifier");return h?(l[h]??[]).map(f=>`${f} ${h}`):[]})}totalAssociationsFromState(){return this.syncDragDropState(),Object.values(this._dragDrop.countByTarget).reduce((l,d)=>l+d,0)}droppableAtCapacityFromState(l){let d=parseInt(l.getAttribute("match-max")||"1",10),h=Number.isNaN(d)?1:d;if(h===0)return!1;let f=l.getAttribute("identifier");return(f?this._dragDrop.countByTarget[f]??0:0)>=h}set disableAnimations(l){this._enableFlipAnimations=!l}get disableAnimations(){return!this._enableFlipAnimations}get enableFlipAnimations(){return this._enableFlipAnimations&&Ac(this)}collectAutoSizeTargets(){return{draggables:this.trackedDraggables,droppables:this.trackedDroppables,dragContainers:this.trackedDragContainers}}get response(){let l=this.getResponse,d=typeof l=="function"?l.call(this):void 0;return(Array.isArray(d)?d:(this.cacheInteractiveElements(),this.responseFromState())).join(",")}set response(l){if(Array.isArray(l)){if(!this.trackedDroppables||this.trackedDroppables.length===0){this._pendingResponse=l,this._internals.setFormValue(JSON.stringify(l));return}let d=this.getValue,h=typeof d=="function"?d.call(this,l):l,f=Array.isArray(h)?h:typeof h=="string"&&h.length>0?[h]:[];this.reset(!1),f.forEach(x=>this.placeResponse(x));let m=this.getResponse,y=typeof m=="function"?m.call(this):void 0;this._response=Array.isArray(y)?y:(this.cacheInteractiveElements(),this.responseFromState())}else this._response=typeof l=="string"&&l.length>0?[l]:[];this._internals.setFormValue(JSON.stringify(this._response)),this.trackedDroppables?.length&&this.validate()}afterCache(){if(this.updateMinDimensionsForDropZones(),this.applyConfiguredChoicesContainerWidth(),this._pendingResponse!==void 0){let l=this._pendingResponse;this._pendingResponse=void 0,this.response=l}}get autoSizeDropzoneWidth(){return!this.dataset.choicesContainerWidth}applyConfiguredChoicesContainerWidth(){let l=this.dataset.choicesContainerWidth;l&&this.trackedDroppables.forEach(d=>{d.style.width=`${l}px`,d.style.boxSizing="border-box"})}shouldTreatBlockedMaxAsInvalid(){return!0}shouldReturnToInventoryOnInventoryDrop(){return!1}getFirstMessageAttribute(l){for(let h of l){let f=this.getAttribute(h);if(f&&f.trim().length>0)return f}let d=l.map(h=>h.toLowerCase());for(let h of Array.from(this.attributes))if(d.includes(h.name.toLowerCase())&&h.value.trim().length>0)return h.value;return null}allowDrop(l,d){if(this.trackedDragContainers.includes(d))return!0;let h=this.trackedDroppables.includes(d),f=d.hasAttribute("disabled"),m=d.hasAttribute("data-drag-source");return f&&this.isSwapTarget(d)?!0:h&&(!f||m)}handleDrop(l,d){let h=this.dragState.dragClone?.getBoundingClientRect();this.dropDraggableInDroppable(l,d,h);let f=l.getAttribute("identifier");f&&this.updateInventoryBasedOnMatchMax(f),this.validate(),this.reportValidity({trigger:"change"})}handleInvalidDrop(l){let d=this.dragState.sourceDroppable,h=this.dragState.currentTarget,f=!h,m=this.trackedDragContainers[0]||null;if(!l)return;if(d&&f&&m)this.dropDraggableInDroppable(l,m);else if(d&&this.trackedDroppables.includes(d))this.dropDraggableInDroppable(l,d,this.dragState.dragClone?.getBoundingClientRect());else if($o(l,"lifted")){this.restoreInventoryItem(l,this.dragState.dragClone?.getBoundingClientRect());let g=l.getAttribute("identifier");g&&this.updateInventoryBasedOnMatchMax(g),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}let y=this.totalAssociationsFromState(),x=this.maxAssociations>0&&y>=this.maxAssociations,u=!!h&&h.hasAttribute("disabled")&&!h.hasAttribute("data-drag-source");this._dropBlockedDueToMax=u&&x,this.validate(),this.reportValidity({trigger:"change"})}animateReturn(l,d){!l||!d||!this.enableFlipAnimations||requestAnimationFrame(()=>{jo(l,Xh(d),this.flipAnimationConfig)})}restoreInventoryItem(l,d){on(l),l.style.display="",l.style.position="",this.animateReturn(l,d)}placeResponse(l){let[d,...h]=l.split(" ").reverse(),f=this.trackedDroppables.find(m=>m.getAttribute("identifier")===d);f&&h.forEach(m=>{if(!m)return;let x=Jr(this.trackedDragContainers,m).at(0)||this.trackedDraggables.find(u=>u.getAttribute("identifier")===m);x&&this.dropDraggableInDroppable(x,f)})}dropDraggableInDroppable(l,d,h){if(this.trackedDragContainers.includes(d)){if(!this.dragState.sourceDroppable){if(this.shouldReturnToInventoryOnInventoryDrop()){this.returnToInventory(l,h),this._dropBlockedDueToMax=!1,this.validate();return}this.restoreInventoryItem(l,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let _=l.getAttribute("identifier");this.removeChipFromDroppable(this.droppableHolding(l),l),_&&this.restoreOriginalInInventory(_,h),this.cacheInteractiveElements(),this.checkAllMaxAssociations(),this._dropBlockedDueToMax=!1,this.validate();return}let m=parseInt(d.getAttribute("match-max")||"1",10),y=Number.isNaN(m)?1:m,x=y===0||y>1,u=Array.from(d.querySelectorAll('[data-draggable="true"]')),g=this.enableFlipAnimations&&u.length>0?Ve(u):null;if(!x){let _=this.chipsIn(d)[0]??(this.isDeclarativeTarget(d)?null:d.querySelector('[data-draggable="true"]'));if(_){let A=_.getAttribute("identifier"),C=_.getBoundingClientRect();this.removeChipFromDroppable(d,_);let k=this.dragState.sourceDroppable,I=this.isDeclarativeTarget(d)&&k&&k!==d&&this.isDeclarativeTarget(k)?k:null;I?(this.placeChip(I,_),Gr(I,!0),this.animateReturn(_,C)):A&&this.restoreOriginalInInventory(A,C)}}let b=l.cloneNode(!0);b.removeAttribute("style"),b.removeAttribute("data-keyboard-dragging"),b.setAttribute("data-draggable","true"),b.setAttribute("tabindex","0"),this.isDeclarativeTarget(d)?(b.setAttribute("part",b.localName==="qti-gap-text"?"chip text drag drag-text":"chip drag"),b.setAttribute("exportparts",["control: chip-control, control: drag-control, label: chip-label, label: drag-label","correction, candidate-correct, candidate-incorrect, candidate-partial","correction-correct, correction-incorrect, correction-partially-correct"].join(", ")),this.placeChip(d,b)):d.tagName==="SLOT"?b.setAttribute("slot",d.getAttribute("name")||""):(d.tagName==="QTI-SIMPLE-ASSOCIABLE-CHOICE"&&b.setAttribute("slot","qti-simple-associable-choice"),d.appendChild(b)),Gr(d,!0),this.syncDragDropState(),g&&this.enableFlipAnimations&&je(g,this.flipAnimationConfig),h&&this.enableFlipAnimations&&requestAnimationFrame(()=>{let _=b.getBoundingClientRect(),A=h.left-_.left,C=h.top-_.top;(A!==0||C!==0)&&b.animate([{transform:`translate(${A}px, ${C}px)`},{transform:"translate(0, 0)"}],{duration:this.flipAnimationConfig.duration||200,easing:this.flipAnimationConfig.easing||"ease",fill:"both"})});let q=l.getAttribute("identifier");q&&this.updateInventoryBasedOnMatchMax(q),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}returnToInventory(l,d){let h=l.getAttribute("identifier");h&&(this.trackedDroppables.forEach(f=>{let m=this.chipsIn(f).filter(y=>y.getAttribute("identifier")===h);m.forEach(y=>this.removeChipFromDroppable(f,y)),m.length>0&&this.chipsIn(f).length===0&&Gr(f,!1)}),this.restoreOriginalInInventory(h,d)),this.cacheInteractiveElements(),this.checkAllMaxAssociations()}restoreOriginalInInventory(l,d){let h=Jr(this.trackedDragContainers,l),f=new Set(h),m=[];this.trackedDragContainers.forEach(x=>{x.querySelectorAll('[data-draggable="true"]').forEach(u=>!f.has(u)&&m.push(u))});let y=this.enableFlipAnimations&&m.length>0?Ve(m):null;h.forEach(x=>{on(x),x.style.display="",x.style.visibility="visible"}),y&&this.enableFlipAnimations&&je(y,this.flipAnimationConfig),h.forEach(x=>this.animateReturn(x,d))}updateInventoryBasedOnMatchMax(l){let d=Jr(this.trackedDragContainers,l),h=Bh(this.trackedDraggables,l),f=this.trackedDroppables.reduce((m,y)=>this.isDeclarativeTarget(y)?m+this.chipsIn(y).filter(x=>x.getAttribute("identifier")===l).length:m+y.querySelectorAll(`[identifier="${l}"]`).length,0);d.forEach(m=>{ft(m,"used",h!==0&&f>=h)})}checkAllMaxAssociations(){let l=this.totalAssociationsFromState(),d=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1}),h=this.maxAssociations>0&&l>=this.maxAssociations;this.trackedDroppables.forEach(f=>{let m=f.hasAttribute("data-drag-source"),y=this.droppableAtCapacityFromState(f);fr(f,(y||d&&h)&&!m)})}saveResponse(l){let d=this.getResponse,h=l??(typeof d=="function"?d.call(this):void 0),f=Array.isArray(h)?h:typeof h=="string"?[h]:(this.cacheInteractiveElements(),this.responseFromState());this._response=f,this._internals.setFormValue(JSON.stringify(this._response)),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:f}})),this.requestUpdate()}reset(l=!0){this.trackedDroppables.forEach(d=>{this.clearChips(d)}),this.trackedDraggables.forEach(d=>{let h=d.getAttribute("identifier");h&&this.restoreOriginalInInventory(h)}),this.resetDragState(),this.cacheInteractiveElements(),this.trackedDroppables.forEach(d=>fr(d,!1)),this.checkAllMaxAssociations(),this.resetValidityReport(),this._response=[],this._internals.setFormValue(JSON.stringify(this._response)),l&&this.saveResponse()}validate(){let l=this.totalAssociationsFromState(),d=this.maxAssociations>0&&l>=this.maxAssociations,h=this.maxAssociations>0&&l>this.maxAssociations,f=this.minAssociations>0&&l<this.minAssociations,m="",y=!0,x="other";h?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):d&&this._dropBlockedDueToMax&&this.shouldTreatBlockedMaxAsInvalid()?(x="max",m=this.getFirstMessageAttribute(["data-max-associations-message","data-max-selections-message"])||this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`,y=!1):f?(x="min",m=this.getFirstMessageAttribute(["data-min-associations-message","data-min-selections-message"])||this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`,y=!1,this._dropBlockedDueToMax=!1):this._dropBlockedDueToMax=!1;let u=this.trackedDroppables[0]??this.trackedDraggables[0]??this;return this.setInteractionValidity(y,m,u,{suppressInline:!0,kind:x}),y}reportValidity(l){return super.reportValidity(l)}}return sn([p({type:Number,reflect:!0,attribute:"min-associations"})],a.prototype,"minAssociations",void 0),sn([p({type:Number,reflect:!0,attribute:"max-associations"})],a.prototype,"maxAssociations",void 0),sn([J({context:De})],a.prototype,"_dragDrop",void 0),sn([p({type:Boolean,attribute:"disable-animations"})],a.prototype,"disableAnimations",null),sn([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Xt({emptyAs:[]})})],a.prototype,"response",null),a};var Fo=class{getInsertPosition(t,e,r,i,n){let s=t.indexOf(r);if(s===-1)return null;let a=r.getBoundingClientRect(),c=(n-a.top)/a.height,d=Math.min(1,Math.max(0,c))>.5;return{index:s,placeAfter:d}}};var Jh=new Fo;var Gm={borderStyle:"2px dashed",borderColor:"var(--qti-drop-highlight-border-color, #c1c1c1)",background:"transparent",transitionDuration:150};function an(){return{placeholder:null,lastHoverTarget:null,lastPlacement:null,sortContainer:null}}function zo(o){o.placeholder?.remove(),o.placeholder=null,o.lastHoverTarget=null,o.lastPlacement=null,o.sortContainer=null}function Bo(o,t,e={}){let r={...Gm,...e},i=document.createElement("div");return i.setAttribute("data-drop-preview","true"),i.setAttribute("data-drop-placeholder","true"),i.style.width=`${t.width}px`,i.style.height=`${t.height}px`,i.style.margin=window.getComputedStyle(o).margin,i.style.boxSizing="border-box",i.style.border=`${r.borderStyle} ${r.borderColor}`,i.style.borderRadius=getComputedStyle(o).borderRadius,i.style.background=r.background,i.style.transition=`transform ${r.transitionDuration*Vo(o)}ms ease`,i.style.pointerEvents="none",i}function _c(o,t){for(let e of t)if(e.contains(o)&&e!==o)return e;return null}var jt=(o,t='[data-draggable="true"]')=>{class e extends o{constructor(){super(...arguments),this.#t=null,this.#e=null,this.#r=an(),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 _c(i,this.trackedDroppables)}#s(i){return i.querySelector(t)}#a(i){let n=this.#c(i);return n===0||n>1}#c(i){let n=parseInt(i.getAttribute("match-max")||"1",10);return Number.isNaN(n)?1:n}#p(i){return i.querySelectorAll(t).length}#l(i){let n=this.#c(i);return n===0?!1:this.#p(i)>=n}#d(){this.#i={hoveredSlot:null,originalPositions:new Map}}#h(i){if(!this.#t||i===this.#t){this.#u();return}if(this.#i.hoveredSlot===i)return;this.#u();let n=this.#s(i);if(!n){this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i;return}if(this.#a(i)){if(this.#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=Ve([n]);this.#i.originalPositions.set(n,i),this.#r.placeholder&&this.#r.placeholder.parentElement&&this.#r.placeholder.remove(),this.#t.appendChild(n),this.#r.placeholder&&i.appendChild(this.#r.placeholder),this.#i.hoveredSlot=i,je(a,this.sortableAnimationConfig)}#u(){if(this.#i.originalPositions.size===0&&this.#i.hoveredSlot===null)return;let i=Array.from(this.#i.originalPositions.keys()),n=i.length>0?Ve(i):null;for(let[s,a]of this.#i.originalPositions)a.appendChild(s);this.#r.placeholder&&this.#t&&this.#t.appendChild(this.#r.placeholder),n&&je(n,this.sortableAnimationConfig),this.#i.originalPositions.clear(),this.#i.hoveredSlot=null}initiateDrag(i,n,s,a,...c){this.#t=null,this.#r=an(),this.#d();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=Bo(i,h,this.sortablePlaceholderConfig);let f=i.getAttribute("slot");f&&this.#r.placeholder.setAttribute("slot",f),this.#r.placeholder.style.visibility="hidden",l.appendChild(this.#r.placeholder),this.trackedDroppables.forEach(m=>{if(m!==l&&m.hasAttribute("disabled")){if(this.#a(m)&&this.#l(m))return;fr(m,!1),this.#n.add(m)}})}let[d]=c;super.initiateDrag(i,n,s,a,d)}cleanupSortableState(i=!0){if(i)for(let[n,s]of this.#i.originalPositions)s.appendChild(n);this.#r.placeholder&&this.#r.placeholder.remove(),zo(this.#r),this.#n.clear(),this.#t=null,this.#d()}onSortableDragMove(i,n){if(!this.isDraggingFromSlot)return;let s=Xr(this.trackedDroppables,i,n,this.dragState.dragClone,this.collisionDetectionAlgorithm);s?this.#h(s):this.#u()}handleDragMove(i,n){Object.getPrototypeOf(e.prototype).handleDragMove?.call(this,i,n),this.onSortableDragMove(i,n)}allowDrop(i,n){return!this.allowReorder&&this.#e&&!this.trackedDragContainers.includes(this.#e)&&n!==this.#e&&this.trackedDroppables.includes(n)?!1:this.isDraggingFromSlot&&this.trackedDroppables.includes(n)?this.#a(n)?!this.#l(n):!0:this.isDraggingFromSlot&&this.trackedDragContainers.includes(n)?!0:super.allowDrop(i,n)}handleDrop(i,n){super.handleDrop(i,n),this.cleanupSortableState(!1)}handleInvalidDrop(i){this.cleanupSortableState(),super.handleInvalidDrop(i)}}return e};var Yh=[M,U,Wt,w`
|
|
6872
6872
|
:host {
|
|
6873
6873
|
display: block; /* necessary to calculate scaling position */
|
|
6874
6874
|
}
|
|
@@ -6925,7 +6925,7 @@ div.full-correct-response-inline {
|
|
|
6925
6925
|
:host([answer-key]) ::slotted(qti-simple-associable-choice) {
|
|
6926
6926
|
display: none;
|
|
6927
6927
|
}
|
|
6928
|
-
`];var
|
|
6928
|
+
`];var ef=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},rf=Vt(D,"qti-simple-associable-choice","[part~='drop']","slot[name='qti-simple-associable-choice']","pointerWithin"),gr=class extends jt(rf,'[data-draggable="true"]'){static{this.styles=Yh}constructor(){super(),this._childrenMap=[],this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(t){let e=t.composedPath()[0];if(this.shadowRoot?.contains(e))return;let r=e;this._childrenMap.includes(r)||(this._childrenMap=[...this._childrenMap,r])}#t(t,e){let r=this._dragDrop?.nodesByTarget?.[t]??[];return v`<div name=${e} part="drop" data-declarative-drops identifier=${t}>
|
|
6929
6929
|
${H(r,i=>i.getAttribute("identifier"),i=>i)}
|
|
6930
6930
|
</div>`}get#e(){return this.maxAssociations>0?this.maxAssociations:Math.ceil(this._childrenMap.length/2)}getResponse(){let t=[];for(let e=0;e<this.#e;e++){let r=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_left"]`),i=this.shadowRoot?.querySelector(`[part~='drop'][identifier="droplist${e}_right"]`),n=r&&this.chipsIn(r)[0]?.getAttribute("identifier"),s=i&&this.chipsIn(i)[0]?.getAttribute("identifier");n&&s&&t.push(`${n} ${s}`)}return t}totalAssociationsFromState(){return this.syncDragDropState(),this.getResponse().length}getValue(t){return t?.flatMap((e,r)=>{let i=e.split(" ");return i.length!==2?[]:[`${i[0]} droplist${r}_left`,`${i[1]} droplist${r}_right`]})??[]}render(){return v` <slot name="prompt"></slot>
|
|
6931
6931
|
<slot part="bank drags" name="qti-simple-associable-choice"></slot>
|
|
@@ -6936,7 +6936,7 @@ div.full-correct-response-inline {
|
|
|
6936
6936
|
</div>`)}
|
|
6937
6937
|
|
|
6938
6938
|
<div role="alert" part="message" id="validation-message"></div>
|
|
6939
|
-
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};
|
|
6939
|
+
</div>`}updated(t){super.updated(t),t.has("_childrenMap")&&this.cacheInteractiveElements()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};ef([T()],gr.prototype,"_childrenMap",void 0);var Uo=[{tag:"qti-associate-interaction",ctor:gr}];var Fe=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ze=(o,t)=>{class e extends o{constructor(){super(...arguments),this._choiceElements=[],this.#t=null,this.minChoices=0,this.maxChoices=1,this._handleDisabledChange=(i,n)=>{this._choiceElements.forEach(s=>s.disabled=n)},this._handleReadonlyChange=(i,n)=>{this._choiceElements.forEach(s=>s.readonly=n)},this.response="",this._handleValueChange=()=>{this._internals.setFormValue(this.value),this._updateChoiceSelection()}}#t;_handleMaxChoicesChange(i,n){this._determineInputType()}get value(){return Array.isArray(this.response)&&this.response.length===0||this.response===""?null:Array.isArray(this.response)?this.response.join(","):this.response}set value(i){this.maxChoices>1&&(typeof i=="string"||i===null)?this.response=i?i.toString().split(","):[]:this.response=i||""}firstUpdated(){super.firstUpdated(),this._updateChoiceSelection()}connectedCallback(){super.connectedCallback(),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t=new MutationObserver(()=>this._syncChoicesFromDOM()),this.#t.observe(this,{childList:!0,subtree:!0}),this._syncChoicesFromDOM()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler),this.#t&&(this.#t.disconnect(),this.#t=null)}_syncChoicesFromDOM(){let i=new Set(this._choiceElements);this._choiceElements=Array.from(this.querySelectorAll(t)),this._choiceElements.forEach(s=>{i.has(s)||(this.disabled&&(s.disabled=!0),s.readonly=this.readonly,s.internals&&!s.internals.ariaChecked&&(s.internals.ariaChecked="false"))}),this._determineInputType();let n=new Set(this._choiceElements.map(s=>s.getAttribute("identifier")??s.identifier));if(Array.isArray(this.response)){let s=this.response.filter(a=>n.has(a));s.length!==this.response.length&&(this.response=s)}else this.response&&!n.has(this.response)&&(this.response="");this._updateChoiceSelection()}validate(){let n=this._choiceElements.filter(d=>this._getChoiceChecked(d)).length,s=!0,a="",c="other";this.maxChoices!==0&&n>this.maxChoices?(s=!1,c="max",a=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"option":"options"}.`):n<this.minChoices&&(s=!1,c="min",a=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"option":"options"}.`);let l=this._choiceElements.find(d=>this.contains(d))||this;return this.setInteractionValidity(s,a,l,{suppressInline:!0,kind:c}),s}reportValidity(i){return super.reportValidity(i)}_determineInputType(){this._internals.role=this.maxChoices===1?"radiogroup":null;let i=this.maxChoices===1?"radio":"checkbox";this._interactionContext.choiceRole!==i&&(this._interactionContext={...this._interactionContext,choiceRole:i})}_choiceElementSelectedHandler(i){this._toggleChoiceChecked(i.target);let n=this.resolveDisableAfterMaxReached({defaultWhenUnset:!1});this.maxChoices===1?this._choiceElements.forEach(s=>{s.identifier!==i.detail.identifier&&this._setChoiceChecked(s,!1)}):this.maxChoices!==0&&n&&(this._choiceElements.filter(a=>this._getChoiceChecked(a)).length>=this.maxChoices?this._choiceElements.forEach(a=>{this._getChoiceChecked(a)||(a.disabled=!0)}):this._choiceElements.forEach(a=>a.disabled=!1)),this._handleChoiceSelection()}_setChoiceChecked(i,n){i.internals?.states&&(n?(i.internals.states.add("checked"),i.internals.ariaChecked="true"):(i.internals.states.delete("checked"),i.internals.ariaChecked="false"))}_getChoiceChecked(i){return i.internals.states.has("checked")}_toggleChoiceChecked(i){let n=this._getChoiceChecked(i);this._setChoiceChecked(i,!n)}_handleChoiceSelection(){let n=this._choiceElements.filter(s=>this._getChoiceChecked(s)).map(s=>s.identifier);this.response=this.maxChoices===1?n[0]||"":n,this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(this.response)}_updateChoiceSelection(){let i=Array.isArray(this.response)?this.response:[this.response];this._choiceElements.forEach(n=>{let s=i.includes(n.identifier);this._setChoiceChecked(n,s)})}}return Fe([_r("#validation-message")],e.prototype,"_validationMessageElement",void 0),Fe([p({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",void 0),Fe([p({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",void 0),Fe([N("maxChoices")],e.prototype,"_handleMaxChoicesChange",null),Fe([N("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",void 0),Fe([N("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",void 0),Fe([p({attribute:"response",reflect:!1,converter:Xt({emptyAs:""})})],e.prototype,"response",void 0),Fe([N("response",{waitUntilFirstUpdate:!0})],e.prototype,"_handleValueChange",void 0),e};var nf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Kh=(o,t)=>{class e extends o{#t=[];#e=["qti-labels-none","qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];#r=["qti-labels-suffix-none","qti-labels-suffix-period","qti-labels-suffix-parenthesis"];#i=null;set class(i){this.#t=this.#n(i),this.#o()}get class(){return this.#t.join(" ")}attributeChangedCallback(i,n,s){super.attributeChangedCallback(i,n,s),i==="class"&&n!==s&&(this.class=s??"")}updated(i){super.updated(i),this.#o()}connectedCallback(){super.connectedCallback(),this.class=this.getAttribute("class")??"",this.#i=new MutationObserver(i=>{i.some(n=>n.type==="childList"||n.type==="attributes"&&n.attributeName==="style")&&this.#o()}),this.#i.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]})}disconnectedCallback(){super.disconnectedCallback(),this.#i?.disconnect(),this.#i=null}#n(i){return i?i.split(/\s+/).map(n=>n.trim()).filter(Boolean).filter((n,s,a)=>a.indexOf(n)===s):[]}#o(){let i=Array.from(this.querySelectorAll("qti-simple-choice")).map(c=>c),n=this.#s(i),s=this.#a(),a=this.#c();n.forEach((c,l)=>{c.marker=this.#p(l+1,s,a)})}#s(i){return i.map((n,s)=>{let a=Number(n.style.order);return{el:n,order:Number.isFinite(a)?a:s+1,index:s}}).sort((n,s)=>n.order-s.order||n.index-s.index).map(n=>n.el)}#a(){return this.#t.filter(i=>this.#e.includes(i)).pop()??null}#c(){return this.#t.filter(i=>this.#r.includes(i)).pop()??null}#p(i,n,s){let a=n;if(!a&&s&&s!=="qti-labels-suffix-none"&&(a="qti-labels-upper-alpha"),!a||a==="qti-labels-none")return"";let c="";switch(a){case"qti-labels-decimal":c=`${i}`;break;case"qti-labels-lower-alpha":c=this.#l(i,"lower");break;case"qti-labels-upper-alpha":c=this.#l(i,"upper");break}return s==="qti-labels-suffix-period"?`${c}.`:s==="qti-labels-suffix-parenthesis"?`${c})`:c}#l(i,n){let s=i,a="",c=n==="lower"?97:65;for(;s>0;)s-=1,a=String.fromCharCode(c+s%26)+a,s=Math.floor(s/26);return a}}return nf([p({type:String,attribute:"class"})],e.prototype,"class",null),e};var Zh=[M,U,w`
|
|
6940
6940
|
:host {
|
|
6941
6941
|
display: block;
|
|
6942
6942
|
}
|
|
@@ -7005,16 +7005,16 @@ div.full-correct-response-inline {
|
|
|
7005
7005
|
:host(.qti-orientation-vertical) ::slotted(qti-simple-choice:nth-child(even)) {
|
|
7006
7006
|
grid-row: auto;
|
|
7007
7007
|
}
|
|
7008
|
-
`];var
|
|
7008
|
+
`];var of=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},br=class extends Kh(ze(D,"qti-simple-choice"),"qti-simple-choice"){constructor(){super(...arguments),this.orientation="vertical"}static{this.styles=Zh}#t(){let t=this.querySelectorAll("qti-simple-choice");this.style.setProperty("--item-count",t.length.toString())}render(){return v`
|
|
7009
7009
|
<slot part="prompt" name="prompt"></slot>
|
|
7010
7010
|
<slot part="choices slot" @slotchange=${this.#t}></slot>
|
|
7011
7011
|
<div part="message" role="alert" id="validation-message"></div>
|
|
7012
|
-
`}};
|
|
7012
|
+
`}};of([p({type:String})],br.prototype,"orientation",void 0);var Ho=[{tag:"qti-choice-interaction",ctor:br}];var tp=[M,w`
|
|
7013
7013
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7014
7014
|
:host {
|
|
7015
7015
|
display: block;
|
|
7016
7016
|
}
|
|
7017
|
-
`];var cn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},
|
|
7017
|
+
`];var cn=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Tc=`
|
|
7018
7018
|
const postToParentWindows = (type, data) => {
|
|
7019
7019
|
window.top.postMessage(data ? { type, data } : { type }, '*');
|
|
7020
7020
|
let w = window.parent;
|
|
@@ -7081,7 +7081,7 @@ window.CES = {
|
|
|
7081
7081
|
},
|
|
7082
7082
|
};
|
|
7083
7083
|
CES.load();
|
|
7084
|
-
`,
|
|
7084
|
+
`,sf=`
|
|
7085
7085
|
(function() {
|
|
7086
7086
|
var blobUrlReceived = null;
|
|
7087
7087
|
|
|
@@ -7125,7 +7125,7 @@ CES.load();
|
|
|
7125
7125
|
requestBlobUrl();
|
|
7126
7126
|
}
|
|
7127
7127
|
})();
|
|
7128
|
-
`,ge=class extends D{#t;#e;#r;static{this.styles=
|
|
7128
|
+
`,ge=class extends D{#t;#e;#r;static{this.styles=tp}constructor(){super(),this.#t="",this.#e=null,this.#r=null,this._errorMessage=null,this.#i=null,this.handlePostMessage=this.handlePostMessage.bind(this)}#i;connectedCallback(){super.connectedCallback();let t=this.data;if(!t){let r=this.querySelector("object[data]");if(r){t=r.getAttribute("data");let i=r.getAttribute("width"),n=r.getAttribute("height");i&&this.setAttribute("width",i),n&&this.setAttribute("height",n)}}if(!t){this._errorMessage="No manifest path found (neither data attribute nor object child)";return}let e=t.startsWith("http")||t.startsWith("blob")?t:Yn((this.baseItemUrl||"")+"/"+t);this.#e=new URL(e,window.location.href).toString(),fetch(e).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}async setupCES(){await this.updateComplete;let t=this.shadowRoot?.querySelector("#pciContainer");if(!t){this._errorMessage="pciContainer iframe not found";return}t.getAttribute("src")||t.setAttribute("src","about:blank");let e=t.contentDocument??t.contentWindow?.document??null;if(e||(await new Promise(d=>t.addEventListener("load",()=>d(),{once:!0})),e=t.contentDocument??t.contentWindow?.document??null),!e){this._errorMessage="pciContainer iframe document not available";return}if(!this.manifest.script||this.manifest.script.length===0){this._errorMessage="No script found in manifest";return}if(!this.manifest.style||this.manifest.style.length===0){this._errorMessage="No style found in manifest";return}let r=this.manifest.style[0],i=this.#a(),n=await this.#l(r,i),s=n.url;if(n.baseUrl&&!this.#r&&(this.#r=n.baseUrl),!0){let d="";if(this.manifest.media&&this.manifest.media.length>0){let h=this.manifest.media[0],f=await this.#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>"+Tc+"</script>",g=m.indexOf("<head>");g!==-1?m=m.slice(0,g+6)+u+m.slice(g+6):m=u+m}let x=new Blob([m],{type:"text/html"});this.#i=URL.createObjectURL(x)}}else{let h=this.data||"manifest.json",f=h.includes("/")?h.substring(0,h.lastIndexOf("/")):"",m=f?`${f}/index.html`:"index.html",y=await this.#l(m,i,{returnText:!0});if(d=y.url,y.baseUrl&&!this.#r&&(this.#r=y.baseUrl),y.text){let x=y.text;if(!(x.includes("postToParentWindows")||x.includes("window.CES"))){let b="<script>"+Tc+"</script>",q=x.indexOf("<head>");q!==-1?x=x.slice(0,q+6)+b+x.slice(q+6):x=b+x}let g=new Blob([x],{type:"text/html"});this.#i=URL.createObjectURL(g)}}if(d&&!this.#i)try{let h=await fetch(d);if(h.ok){let f=await h.text();if(!(f.includes("postToParentWindows")||f.includes("window.CES"))){let x="<script>"+Tc+"</script>",u=f.indexOf("<head>");u!==-1?f=f.slice(0,u+6)+x+f.slice(u+6):f=x+f}let y=new Blob([f],{type:"text/html"});this.#i=URL.createObjectURL(y)}else console.error(`Failed to fetch index.html: ${h.status}`)}catch(h){console.error(`Error fetching index.html: ${h}`)}}let c=`<script>${sf}</script>`;window.addEventListener("message",this.handlePostMessage);let l=`
|
|
7129
7129
|
<!DOCTYPE html>
|
|
7130
7130
|
<html>
|
|
7131
7131
|
<head>
|
|
@@ -7145,9 +7145,9 @@ CES.load();
|
|
|
7145
7145
|
${this._errorMessage&&v`<div style="color:red">
|
|
7146
7146
|
<h1>Error</h1>
|
|
7147
7147
|
${this._errorMessage}
|
|
7148
|
-
</div>`}`}#a(){let e=[this.#r,this.baseRefUrl,this.baseItemUrl,this.#c()].filter(Boolean).map(i=>new URL(i,window.location.href).toString()),r=this.#p();return r&&e.push(r),[...new Set(e)]}#c(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let i of e){let n=new URL(i,window.location.href).toString(),s=new URL(t,n.endsWith("/")?n:`${n}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let c=await a.text();return{url:s,baseUrl:n,text:c}}return{url:s,baseUrl:n}}}catch{}}return{url:"",baseUrl:null}}};cn([p({type:String,attribute:"data"})],ge.prototype,"data",void 0);cn([p({type:String,attribute:"data-base-item"})],ge.prototype,"baseItemUrl",void 0);cn([p({type:String,attribute:"data-base-ref"})],ge.prototype,"baseRefUrl",void 0);cn([p({type:String,attribute:"id"})],ge.prototype,"id",void 0);cn([T()],ge.prototype,"_errorMessage",void 0);var
|
|
7148
|
+
</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.#p();return r&&e.push(r),[...new Set(e)]}#c(){return this.#e?new URL(".",this.#e).toString():null}#p(){return this.#e?new URL("..",this.#e).toString():null}async#l(t,e,r={}){if(!t)return{url:"",baseUrl:null};if(t.startsWith("http")||t.startsWith("blob"))return{url:t,baseUrl:null};for(let i of e){let n=new URL(i,window.location.href).toString(),s=new URL(t,n.endsWith("/")?n:`${n}/`).toString();try{let a=await fetch(s);if(a.ok){if(r.returnText){let c=await a.text();return{url:s,baseUrl:n,text:c}}return{url:s,baseUrl:n}}}catch{}}return{url:"",baseUrl:null}}};cn([p({type:String,attribute:"data"})],ge.prototype,"data",void 0);cn([p({type:String,attribute:"data-base-item"})],ge.prototype,"baseItemUrl",void 0);cn([p({type:String,attribute:"data-base-ref"})],ge.prototype,"baseRefUrl",void 0);cn([p({type:String,attribute:"id"})],ge.prototype,"id",void 0);cn([T()],ge.prototype,"_errorMessage",void 0);var Wo=[{tag:"qti-custom-interaction",ctor:ge}];var ep=[M];var ln=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},be=class extends S{constructor(){super(...arguments),this.disabled=!1,this.countAttempt=null,this.title="end attempt"}static{this.styles=ep}get#t(){let t=this._itemContext;if(!t)return!1;if(t.disabled||t.readonly)return!0;let e=this.closest("qti-assessment-item")?.getAttribute("adaptive")==="true",r=t.variables?.find(i=>i.identifier==="completionStatus")?.value;return e&&r==="completed"}render(){return v`<button ?disabled=${this.disabled||this.#t} part="button" @click=${this.endAttempt}>
|
|
7149
7149
|
${this.title}
|
|
7150
|
-
</button>`}endAttempt(t){this.disabled||this.#t||this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt!=="false"}}))}};ln([p({type:String,attribute:"response-identifier"})],be.prototype,"responseIdentifier",void 0);ln([p({reflect:!0,type:Boolean})],be.prototype,"disabled",void 0);ln([R({context:j,subscribe:!0}),T()],be.prototype,"_itemContext",void 0);ln([p({type:String,attribute:"count-attempt"})],be.prototype,"countAttempt",void 0);ln([p({type:String})],be.prototype,"title",void 0);var
|
|
7150
|
+
</button>`}endAttempt(t){this.disabled||this.#t||this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt!=="false"}}))}};ln([p({type:String,attribute:"response-identifier"})],be.prototype,"responseIdentifier",void 0);ln([p({reflect:!0,type:Boolean})],be.prototype,"disabled",void 0);ln([R({context:j,subscribe:!0}),T()],be.prototype,"_itemContext",void 0);ln([p({type:String,attribute:"count-attempt"})],be.prototype,"countAttempt",void 0);ln([p({type:String})],be.prototype,"title",void 0);var Qo=[{tag:"qti-end-attempt-interaction",ctor:be}];var rp=[M,w`
|
|
7151
7151
|
/* PK: display host as block, else design will be collapsed */
|
|
7152
7152
|
/* 'position: relative' anchors the correction glyph the theme draws over the textarea. */
|
|
7153
7153
|
:host {
|
|
@@ -7160,7 +7160,7 @@ CES.load();
|
|
|
7160
7160
|
height: 100%;
|
|
7161
7161
|
border: 0;
|
|
7162
7162
|
}
|
|
7163
|
-
`];var gt=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},
|
|
7163
|
+
`];var gt=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ip=5,af=50,np="qti-height-lines-",op=!1,Q=class extends D{constructor(){super(...arguments),this._rows=ip,this.format="plain",this._handleFormatChange=()=>{this.format!=="xhtml"||op||(op=!0,console.warn('<qti-extended-text-interaction format="xhtml"> renders as plain text. The interaction has no rich-text editor; the recorded response will contain no markup.'))},this.minStrings=0,this.response=null,this._handleResponseChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=rp}_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/af):ip}#e(){for(let t of(this.classNames??"").split(" ")){if(!t.startsWith(np))continue;let e=parseInt(t.slice(np.length),10);if(!Number.isNaN(e)&&e>0)return e}return null}get value(){return this.response||null}set value(t){this.response=t||null}validate(){let t=this.shadowRoot.querySelector("textarea");if(!t)return!1;let e="",r=!1;if(this.patternMask&&this.dataPatternmaskMessage){t.setCustomValidity("");let n=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,s=new RegExp(n);r=t.checkValidity()&&s.test(t.value),r||(e=this.dataPatternmaskMessage,t.setCustomValidity(this.dataPatternmaskMessage))}else r=t.checkValidity();let i="other";return r&&!this.response&&this.minStrings>=1&&(r=!1,i="min"),!r&&!e&&(e=t.validationMessage||"Invalid value."),this.setInteractionValidity(r,e,t,{suppressInline:!0,kind:i}),r}reportValidity(t){return this.validate(),super.reportValidity(t)}renderPrompt(){return v`<slot name="prompt"></slot>`}renderTextarea(){return v`<textarea
|
|
7164
7164
|
part="textarea"
|
|
7165
7165
|
name="${this.responseIdentifier}"
|
|
7166
7166
|
spellcheck="false"
|
|
@@ -7175,7 +7175,7 @@ CES.load();
|
|
|
7175
7175
|
?disabled="${this.disabled}"
|
|
7176
7176
|
?readonly="${this.readonly}"
|
|
7177
7177
|
.value=${this.response}
|
|
7178
|
-
></textarea>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value),this.reportValidity({trigger:"change"}))}};gt([T()],Q.prototype,"_rows",void 0);gt([p({type:Number,attribute:"expected-length"})],Q.prototype,"expectedLength",void 0);gt([p({type:Number,attribute:"expected-lines"})],Q.prototype,"expectedLines",void 0);gt([p({type:String,reflect:!0})],Q.prototype,"format",void 0);gt([N("format")],Q.prototype,"_handleFormatChange",void 0);gt([p({type:Number,attribute:"min-strings"})],Q.prototype,"minStrings",void 0);gt([p({type:String,attribute:"pattern-mask"})],Q.prototype,"patternMask",void 0);gt([p({type:String,attribute:"placeholder-text"})],Q.prototype,"placeholderText",void 0);gt([p({type:String,attribute:"data-patternmask-message"})],Q.prototype,"dataPatternmaskMessage",void 0);gt([p({type:String,attribute:"class"})],Q.prototype,"classNames",void 0);gt([N(["classNames","expectedLines","expectedLength"])],Q.prototype,"_handleRowsInputChange",null);gt([p({type:String,attribute:"response",reflect:!1})],Q.prototype,"response",void 0);gt([N("response",{waitUntilFirstUpdate:!0})],Q.prototype,"_handleResponseChange",void 0);var
|
|
7178
|
+
></textarea>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v`${this.renderPrompt()}${this.renderTextarea()} ${this.renderValidationMessage()}`}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value),this.reportValidity({trigger:"change"}))}};gt([T()],Q.prototype,"_rows",void 0);gt([p({type:Number,attribute:"expected-length"})],Q.prototype,"expectedLength",void 0);gt([p({type:Number,attribute:"expected-lines"})],Q.prototype,"expectedLines",void 0);gt([p({type:String,reflect:!0})],Q.prototype,"format",void 0);gt([N("format")],Q.prototype,"_handleFormatChange",void 0);gt([p({type:Number,attribute:"min-strings"})],Q.prototype,"minStrings",void 0);gt([p({type:String,attribute:"pattern-mask"})],Q.prototype,"patternMask",void 0);gt([p({type:String,attribute:"placeholder-text"})],Q.prototype,"placeholderText",void 0);gt([p({type:String,attribute:"data-patternmask-message"})],Q.prototype,"dataPatternmaskMessage",void 0);gt([p({type:String,attribute:"class"})],Q.prototype,"classNames",void 0);gt([N(["classNames","expectedLines","expectedLength"])],Q.prototype,"_handleRowsInputChange",null);gt([p({type:String,attribute:"response",reflect:!1})],Q.prototype,"response",void 0);gt([N("response",{waitUntilFirstUpdate:!0})],Q.prototype,"_handleResponseChange",void 0);var Xo=[{tag:"qti-extended-text-interaction",ctor:Q}];var sp=[M,U,w`
|
|
7179
7179
|
:host {
|
|
7180
7180
|
display: flex;
|
|
7181
7181
|
align-items: flex-start;
|
|
@@ -7223,10 +7223,10 @@ CES.load();
|
|
|
7223
7223
|
:host([answer-key]) [part~='bank'] {
|
|
7224
7224
|
display: none;
|
|
7225
7225
|
}
|
|
7226
|
-
`];var Yr=class extends jt(Vt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1}static{this.styles=
|
|
7226
|
+
`];var Yr=class extends jt(Vt(D,"qti-gap-text","qti-gap","slot[part~='drags']"),'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1}static{this.styles=sp}render(){return v`<slot name="prompt"> </slot>
|
|
7227
7227
|
<slot part="bank drags" name="drags"></slot>
|
|
7228
7228
|
<slot part="drops"></slot>
|
|
7229
|
-
<div role="alert" part="message" id="validation-message"></div>`}};var
|
|
7229
|
+
<div role="alert" part="message" id="validation-message"></div>`}};var Go=[{tag:"qti-gap-match-interaction",ctor:Yr}];function dp(o){return o.querySelector('img, object[type^="image"]')}function ap(o,t){let e=o.getAttribute(t)?.trim();if(!e||e.endsWith("%"))return null;let r=parseFloat(e);return Number.isFinite(r)&&r>0?r:null}var hp=new WeakMap,cp=new WeakMap;function cf(o){let t=cp.get(o);return t||(t=new Promise(e=>{let r=o.data;if(!r){e(null);return}let i=new Image;i.onload=()=>{let n={width:i.naturalWidth,height:i.naturalHeight};if(!(n.width>0)||!(n.height>0)){e(null);return}hp.set(o,n),e(n)},i.onerror=()=>e(null),i.src=r}),cp.set(o,t)),t}function lf(o){if(o.localName==="object")return hp.get(o)??null;let t=o;return t.naturalWidth>0&&t.naturalHeight>0?{width:t.naturalWidth,height:t.naturalHeight}:null}function Jo(o){let t=ap(o,"width"),e=ap(o,"height");if(t!==null&&e!==null)return{width:t,height:e};let r=lf(o);return r?{width:t??r.width,height:e??r.height}:null}function df(o){let t=Jo(o);if(t)return Promise.resolve(t);if(o.localName==="object")return cf(o).then(()=>Jo(o));let e=o;return e.complete?Promise.resolve(null):new Promise(r=>{let i=()=>{e.removeEventListener("load",i),e.removeEventListener("error",i),r(Jo(o))};e.addEventListener("load",i),e.addEventListener("error",i)})}function Kt(o,t,e,r){let i=Jo(e);if(i){lp(o,t,i,r);return}df(e).then(n=>{if(!n){console.error("Cannot position hotspots: the graphic has no usable width/height.",e);return}lp(o,t,n,r)})}function lp(o,t,{width:e,height:r},i){switch(o){case"circle":{if(t.length!==3){console.error("Invalid circle coordinates:",t);return}let[n,s,a]=t,c=n/e*100,l=s/r*100,d=a/e*100,h=a/r*100;i.style.left=c-d+"%",i.style.top=l-h+"%",i.style.width=2*d+"%",i.style.height=2*h+"%",i.style.borderRadius="50%"}break;case"rect":{if(t.length!==4){console.error("Invalid rectangle coordinates:",t);return}let[n,s,a,c]=t,l=n/e*100,d=s/r*100,h=a/e*100,f=c/r*100;i.style.left=l+"%",i.style.top=d+"%",i.style.width=h-l+"%",i.style.height=f-d+"%"}break;case"ellipse":{if(t.length!==4){console.error("Invalid ellipse coordinates:",t);return}let[n,s,a,c]=t,l=n/e*100,d=s/r*100,h=a/e*100,f=c/r*100;i.style.left=l-h+"%",i.style.top=d-f+"%",i.style.width=2*h+"%",i.style.height=2*f+"%",i.style.borderRadius="50%"}break;case"poly":{if(t.length<6||t.length%2!==0){console.error("Invalid polygon coordinates:",t);return}let n=[];for(let b=0;b<t.length;b+=2)n.push({x:t[b],y:t[b+1]});let s=Math.min(...n.map(b=>b.x)),a=Math.max(...n.map(b=>b.x)),c=Math.min(...n.map(b=>b.y)),l=Math.max(...n.map(b=>b.y)),d=s/e*100,h=c/r*100,f=a/e*100,m=l/r*100;i.style.left=d+"%",i.style.top=h+"%",i.style.width=f-d+"%",i.style.height=m-h+"%";let y=n.map(b=>({x:(b.x-s)/(a-s)*100,y:(b.y-c)/(l-c)*100})),x=y.map(b=>`${b.x}% ${b.y}%`).join(",");i.style.clipPath=`polygon(${x})`;let u=y.map(b=>`${b.x},${b.y}`).join(" "),g=b=>`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'><polygon points='${u}' fill='none' stroke='black' stroke-width='${b}' vector-effect='non-scaling-stroke' stroke-linejoin='round'/></svg>`)}")`;i.style.setProperty("--qti-shape-outline",g(4)),i.style.setProperty("--qti-shape-outline-bold",g(8))}break;case"default":i.style.left="0%",i.style.top="0%",i.style.width="100%",i.style.height="100%";break;default:console.error(`Unsupported shape: ${o}`);break}}var pp=[M,U,w`
|
|
7230
7230
|
/* Containing block for the absolutely positioned hotspots over the image. Was on this host in
|
|
7231
7231
|
the theme, together with a 'display: block' this component now owns. */
|
|
7232
7232
|
:host {
|
|
@@ -7275,7 +7275,7 @@ CES.load();
|
|
|
7275
7275
|
::slotted(qti-associable-hotspot) {
|
|
7276
7276
|
cursor: pointer;
|
|
7277
7277
|
}
|
|
7278
|
-
`];var vr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bt=class extends D{static{this.styles=
|
|
7278
|
+
`];var vr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bt=class extends D{static{this.styles=pp}#t;#e;constructor(){super(),this.#t=[],this.#e=null,this._response=[],this.minAssociations=0,this.maxAssociations=1,this.addEventListener("qti-register-hotspot",this.#o)}reset(){this.resetValidityReport(),this._response=[],this._internals.setFormValue(null),this.validate(),this.#e=null,this.#h()}validate(){let t=this.#n().length,e=this.maxAssociations>0&&t>this.maxAssociations,r=t<this.minAssociations,i="other",n="";e?(i="max",n=this.dataset.maxAssociationsMessage||this.dataset.maxSelectionsMessage||`You've selected too many associations. Maximum allowed is ${this.maxAssociations}.`):r&&(i="min",n=this.dataset.minAssociationsMessage||this.dataset.minSelectionsMessage||`Please select at least ${this.minAssociations} ${this.minAssociations===1?"association":"associations"}.`);let s=!e&&!r;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:i}),s}reportValidity(t){return super.reportValidity(t)}set response(t){this._response=this.#i(t),this.#r(!1),this.#h()}#r(t){let e=this.#n();this._internals.setFormValue(e.length?JSON.stringify(e):null),this.validate(),t&&this.reportValidity({trigger:"change"})}get response(){return this._response}#i(t){return t==null||t===""?[]:Array.isArray(t)?t:[t]}#n(){return this.#i(this._response)}renderSupplementalLines(){return P}render(){return v`<slot name="prompt"></slot>
|
|
7279
7279
|
<line-container
|
|
7280
7280
|
@click=${t=>{this.#e&&!t.composedPath().some(e=>this.#t.includes(e))&&this.#a()}}
|
|
7281
7281
|
>
|
|
@@ -7312,7 +7312,7 @@ CES.load();
|
|
|
7312
7312
|
</svg>
|
|
7313
7313
|
<slot></slot>
|
|
7314
7314
|
</line-container>
|
|
7315
|
-
<div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),n=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));Kt(n,s,e,r)}firstUpdated(){super.firstUpdated(),this.#t=Array.from(this.querySelectorAll("qti-associable-hotspot")),this.addEventListener("mousemove",t=>{let e=this.grImage[0];if(!e)return;let r=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-r.left,y:t.clientY-r.top}}),this.#t.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.tabIndex=0,t.setAttribute("role","button"),t.hasAttribute("aria-label")||t.setAttribute("aria-label",t.getAttribute("hotspot-label")||t.getAttribute("identifier")),t.addEventListener("click",()=>this.#s(t)),t.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.#s(t))})}),this.addEventListener("keydown",t=>{t.key==="Escape"&&this.#e&&this.#a()}),this.#h()}#s(t){if(this.disabled||this.readonly)return;if(!this.#e){if(this.#l(t))return;this.#e=t,this.startCoord=this.#d(t),this.mouseCoord=this.startCoord,this.#h();return}if(t===this.#e){this.#a();return}let e=this.#e.getAttribute("identifier"),r=t.getAttribute("identifier"),i=this.#n(),n=i.some(a=>this.#p(a,e,r)),s=this.maxAssociations===0||i.length<this.maxAssociations;!n&&s&&!this.#l(t)&&(this._response=[...i,`${e} ${r}`],this.saveResponse(this.response),this.#r(!0)),this.#a()}#a(){this.#e=null,this.#h(),this.requestUpdate()}#c(t){this.disabled||this.readonly||(this._response=this.#n().filter((e,r)=>r!==t),this.saveResponse(this.response),this.#r(!0),this.#h())}#p(t,e,r){let[i,n]=t.split(" ");return i===e&&n===r||i===r&&n===e}#l(t){let e=Number(t.getAttribute("match-max")??0);if(!e)return!1;let r=t.getAttribute("identifier");return this.#n().filter(i=>i.split(" ").includes(r)).length>=e}#d(t){let[e,r]=(t.getAttribute("coords")??"0,0").split(",").map(i=>parseInt(i));return{x:e,y:r}}#h(){for(let t of this.#t){let e=t.internals?.states;z(e,"checked",t===this.#e),z(e,"full",this.#l(t))}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};vr([T()],bt.prototype,"startCoord",void 0);vr([T()],bt.prototype,"mouseCoord",void 0);vr([
|
|
7315
|
+
<div role="alert" part="message" id="validation-message"></div>`}#o(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),n=r.getAttribute("shape"),s=i.split(",").map(a=>parseInt(a));Kt(n,s,e,r)}firstUpdated(){super.firstUpdated(),this.#t=Array.from(this.querySelectorAll("qti-associable-hotspot")),this.addEventListener("mousemove",t=>{let e=this.grImage[0];if(!e)return;let r=e.getBoundingClientRect();this.mouseCoord={x:t.clientX-r.left,y:t.clientY-r.top}}),this.#t.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.tabIndex=0,t.setAttribute("role","button"),t.hasAttribute("aria-label")||t.setAttribute("aria-label",t.getAttribute("hotspot-label")||t.getAttribute("identifier")),t.addEventListener("click",()=>this.#s(t)),t.addEventListener("keydown",e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.#s(t))})}),this.addEventListener("keydown",t=>{t.key==="Escape"&&this.#e&&this.#a()}),this.#h()}#s(t){if(this.disabled||this.readonly)return;if(!this.#e){if(this.#l(t))return;this.#e=t,this.startCoord=this.#d(t),this.mouseCoord=this.startCoord,this.#h();return}if(t===this.#e){this.#a();return}let e=this.#e.getAttribute("identifier"),r=t.getAttribute("identifier"),i=this.#n(),n=i.some(a=>this.#p(a,e,r)),s=this.maxAssociations===0||i.length<this.maxAssociations;!n&&s&&!this.#l(t)&&(this._response=[...i,`${e} ${r}`],this.saveResponse(this.response),this.#r(!0)),this.#a()}#a(){this.#e=null,this.#h(),this.requestUpdate()}#c(t){this.disabled||this.readonly||(this._response=this.#n().filter((e,r)=>r!==t),this.saveResponse(this.response),this.#r(!0),this.#h())}#p(t,e,r){let[i,n]=t.split(" ");return i===e&&n===r||i===r&&n===e}#l(t){let e=Number(t.getAttribute("match-max")??0);if(!e)return!1;let r=t.getAttribute("identifier");return this.#n().filter(i=>i.split(" ").includes(r)).length>=e}#d(t){let[e,r]=(t.getAttribute("coords")??"0,0").split(",").map(i=>parseInt(i));return{x:e,y:r}}#h(){for(let t of this.#t){let e=t.internals?.states;z(e,"checked",t===this.#e),z(e,"full",this.#l(t))}}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#o)}};vr([T()],bt.prototype,"startCoord",void 0);vr([T()],bt.prototype,"mouseCoord",void 0);vr([Nl({selector:"img"})],bt.prototype,"grImage",void 0);vr([T()],bt.prototype,"_response",void 0);vr([p({type:Number,attribute:"min-associations"})],bt.prototype,"minAssociations",void 0);vr([p({type:Number,attribute:"max-associations"})],bt.prototype,"maxAssociations",void 0);vr([p({attribute:"response",reflect:!1,noAccessor:!0,converter:Xt({emptyAs:[]})})],bt.prototype,"response",null);var Yo=[{tag:"qti-graphic-associate-interaction",ctor:bt}];var up=[M,U,w`
|
|
7316
7316
|
:host {
|
|
7317
7317
|
display: flex;
|
|
7318
7318
|
align-items: flex-start;
|
|
@@ -7401,10 +7401,10 @@ CES.load();
|
|
|
7401
7401
|
user-select: none;
|
|
7402
7402
|
pointer-events: none;
|
|
7403
7403
|
}
|
|
7404
|
-
`];var
|
|
7404
|
+
`];var hf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pf=Vt(D,"qti-gap-img, qti-gap-text","qti-associable-hotspot","slot[part~='bank']"),yr=class extends jt(pf,'[data-draggable="true"]'){constructor(){super(...arguments),this.maxAssociations=1,this.autoSizeDropzones=!1,this._graphicScale=1,this.#t=null,this.#e=null,this.#s=t=>{this.#n(t.target)}}static{this.styles=up}#t;#e;render(){let t=`--qti-graphic-scale: ${this._graphicScale}`;return v` <slot name="prompt"></slot>
|
|
7405
7405
|
<slot part="image" style=${t}></slot>
|
|
7406
7406
|
<slot part="bank drags" name="drags" class="hover-border" style=${t}></slot>
|
|
7407
|
-
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#r(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#i(t){if(t.style.aspectRatio)return;let e=n=>{let s=(t.getAttribute(n)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},r=e("width"),i=e("height");r&&i&&(t.style.aspectRatio=`${r} / ${i}`)}#n(t){let e=this.#r(),r=t.getAttribute("coords"),i=t.getAttribute("shape");!e||!r||!i||(this.#i(e),this.#o(e),Kt(i,r.split(",").map(n=>parseFloat(n)),e,t))}#o(t){this.#e!==t&&(this.#t?.disconnect(),this.#e=t,this.#t=new ResizeObserver(()=>{let e=parseFloat(t.getAttribute("width")??""),r=t.getBoundingClientRect().width,i=e>0&&r>0?Math.min(1,r/e):1,n=Math.round(i*1e3)/1e3;n!==this._graphicScale&&(this._graphicScale=n)}),this.#t.observe(t))}#s;connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#s),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#n(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s),this.#t?.disconnect(),this.#t=null,this.#e=null}};
|
|
7407
|
+
<div role="alert" part="message" id="validation-message"></div>`}shouldReturnToInventoryOnInventoryDrop(){return!0}#r(){return this.querySelector(':scope > img, :scope > object[type^="image"]')}#i(t){if(t.style.aspectRatio)return;let e=n=>{let s=(t.getAttribute(n)??"").trim(),a=parseFloat(s);return s.endsWith("%")||!(a>0)?null:a},r=e("width"),i=e("height");r&&i&&(t.style.aspectRatio=`${r} / ${i}`)}#n(t){let e=this.#r(),r=t.getAttribute("coords"),i=t.getAttribute("shape");!e||!r||!i||(this.#i(e),this.#o(e),Kt(i,r.split(",").map(n=>parseFloat(n)),e,t))}#o(t){this.#e!==t&&(this.#t?.disconnect(),this.#e=t,this.#t=new ResizeObserver(()=>{let e=parseFloat(t.getAttribute("width")??""),r=t.getBoundingClientRect().width,i=e>0&&r>0?Math.min(1,r/e):1,n=Math.round(i*1e3)/1e3;n!==this._graphicScale&&(this._graphicScale=n)}),this.#t.observe(t))}#s;connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.#s),this.querySelectorAll(":scope > qti-associable-hotspot").forEach(t=>this.#n(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.#s),this.#t?.disconnect(),this.#t=null,this.#e=null}};hf([T()],yr.prototype,"_graphicScale",void 0);var Ko=[{tag:"qti-graphic-gap-match-interaction",ctor:yr}];var mp=[M,U,w`
|
|
7408
7408
|
/* The order pins are anchored outside their hotspot's box. */
|
|
7409
7409
|
:host {
|
|
7410
7410
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
@@ -7442,11 +7442,11 @@ CES.load();
|
|
|
7442
7442
|
pointer-events: none;
|
|
7443
7443
|
user-select: none;
|
|
7444
7444
|
}
|
|
7445
|
-
`];var
|
|
7445
|
+
`];var fp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Be=class o extends ze(D,"qti-hotspot-choice"){constructor(){super(...arguments),this.maxChoices=0,this._choiceElements=[],this.#n=t=>{this.#i(t.target),this.refreshLocatorPins()}}static{this.styles=mp}static#t="cito-graphic-order-marker";render(){return v`
|
|
7446
7446
|
<slot name="prompt"></slot>
|
|
7447
7447
|
<slot></slot>
|
|
7448
7448
|
<div role="alert" part="message" id="validation-message"></div>
|
|
7449
|
-
`}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(n=>n.identifier===e))return;let r=[...this.#e()],i=r.indexOf(e);if(i>=0)r.splice(i,1);else{let n=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(r.length>=n)return;r.push(e)}this.response=r,this.saveResponse(this.response),this.updateComplete.then(()=>{this.validate(),this.reportValidity({trigger:"change"})})}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#r(t){return`--qti-graphic-order-${(t.identifier||t.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(t){return"var(--qti-selected-bg)"}refreshLocatorPins(){let t=this.#e();for(let n of this._choiceElements){let s=t.indexOf(n.identifier);n.order=s>=0?s+1:null}let e=this._choiceElements.filter(n=>n.order!=null).sort((n,s)=>n.order-s.order),r=Array.from(this.querySelectorAll(`.${o.#t}`));r.length===e.length&&e.every((n,s)=>{let a=r[s];return a.textContent===String(n.order)&&a.style.getPropertyValue("position-anchor")===this.#r(n)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(n)})||(r.forEach(n=>n.remove()),this._choiceElements.forEach(n=>{n.style.removeProperty("anchor-name")}),e.forEach(n=>{let s=this.#r(n);n.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(n)),n.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(n.order),this.append(a)}))}#i(t){let e=
|
|
7449
|
+
`}_choiceElementSelectedHandler(t){let{identifier:e}=t.detail;if(!this._choiceElements.some(n=>n.identifier===e))return;let r=[...this.#e()],i=r.indexOf(e);if(i>=0)r.splice(i,1);else{let n=this.maxChoices>0?this.maxChoices:this._choiceElements.length;if(r.length>=n)return;r.push(e)}this.response=r,this.saveResponse(this.response),this.updateComplete.then(()=>{this.validate(),this.reportValidity({trigger:"change"})})}#e(){return Array.isArray(this.response)?this.response:this.response?[this.response]:[]}handleOrderedResponseChange(){this.refreshLocatorPins()}#r(t){return`--qti-graphic-order-${(t.identifier||t.getAttribute("identifier")||"hotspot").toLowerCase().replace(/[^a-z0-9_-]/g,"-")}`}resolvePinColor(t){return"var(--qti-selected-bg)"}refreshLocatorPins(){let t=this.#e();for(let n of this._choiceElements){let s=t.indexOf(n.identifier);n.order=s>=0?s+1:null}let e=this._choiceElements.filter(n=>n.order!=null).sort((n,s)=>n.order-s.order),r=Array.from(this.querySelectorAll(`.${o.#t}`));r.length===e.length&&e.every((n,s)=>{let a=r[s];return a.textContent===String(n.order)&&a.style.getPropertyValue("position-anchor")===this.#r(n)&&a.style.getPropertyValue("--qti-graphic-order-pin-color")===this.resolvePinColor(n)})||(r.forEach(n=>n.remove()),this._choiceElements.forEach(n=>{n.style.removeProperty("anchor-name")}),e.forEach(n=>{let s=this.#r(n);n.style.setProperty("anchor-name",s);let a=document.createElement("span");a.className=o.#t,a.style.setProperty("position-anchor",s),a.style.setProperty("--qti-graphic-order-pin-color",this.resolvePinColor(n)),n.getAttribute("shape")==="poly"&&a.classList.add("cito-graphic-order-marker--poly"),a.setAttribute("aria-hidden","true"),a.textContent=String(n.order),this.append(a)}))}#i(t){let e=dp(this),r=t.getAttribute("coords"),i=t.getAttribute("shape");if(!e){console.error('No <img> or <object type="image/*"> found in <qti-graphic-order-interaction>.');return}let n=r.split(",").map(s=>parseInt(s));Kt(i,n,e,t)}#n;connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#n),this.refreshLocatorPins(),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#i(t))}disconnectedCallback(){this.querySelectorAll(`.${o.#t}`).forEach(t=>t.remove()),super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#n)}};fp([p({type:Number,attribute:"max-choices"})],Be.prototype,"maxChoices",void 0);fp([N("response")],Be.prototype,"handleOrderedResponseChange",null);var Zo=[{tag:"qti-graphic-order-interaction",ctor:Be}];var gp=[M,U,w`
|
|
7450
7450
|
:host {
|
|
7451
7451
|
display: block;
|
|
7452
7452
|
}
|
|
@@ -7495,17 +7495,17 @@ CES.load();
|
|
|
7495
7495
|
max-width: 100%;
|
|
7496
7496
|
height: auto;
|
|
7497
7497
|
}
|
|
7498
|
-
`];var Kr=class extends ze(D,"qti-hotspot-choice"){static{this.styles=
|
|
7498
|
+
`];var Kr=class extends ze(D,"qti-hotspot-choice"){static{this.styles=gp}render(){return v`
|
|
7499
7499
|
<slot name="prompt"></slot>
|
|
7500
7500
|
<slot></slot>
|
|
7501
7501
|
<div part="message" role="alert" id="validation-message"></div>
|
|
7502
|
-
`}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let r=()=>{t.removeEventListener("load",r),e(t)};t.addEventListener("load",r)})),this.#t}async#r(t){let e=this.querySelector("img");if(!e)return;let r=t.getAttribute("coords"),i=t.getAttribute("shape"),n=r.split(",").map(a=>parseInt(a)),s=await this.#e(e);Kt(i,n,s,t)}#i=t=>{this.#r(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#i),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var
|
|
7502
|
+
`}#t=null;#e(t){return this.#t||(t.naturalWidth>0&&t.naturalHeight>0?this.#t=Promise.resolve(t):this.#t=new Promise(e=>{let r=()=>{t.removeEventListener("load",r),e(t)};t.addEventListener("load",r)})),this.#t}async#r(t){let e=this.querySelector("img");if(!e)return;let r=t.getAttribute("coords"),i=t.getAttribute("shape"),n=r.split(",").map(a=>parseInt(a)),s=await this.#e(e);Kt(i,n,s,t)}#i=t=>{this.#r(t.target)};connectedCallback(){super.connectedCallback(),this.addEventListener("register-qti-hotspot-choice",this.#i),this.querySelectorAll("qti-hotspot-choice").forEach(t=>this.#r(t))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-hotspot-choice",this.#i)}};var ts=[{tag:"qti-hotspot-interaction",ctor:Kr}];var bp=[M,U,w`
|
|
7503
7503
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
7504
7504
|
:host {
|
|
7505
7505
|
display: block;
|
|
7506
7506
|
}
|
|
7507
7507
|
`];var Zr=class extends ze(D,"qti-hottext"){constructor(){super(...arguments),this.render=()=>v`<slot></slot>
|
|
7508
|
-
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=
|
|
7508
|
+
<div part="message" role="alert" id="validation-message"></div>`}static{this.styles=bp}};var es=[{tag:"qti-hottext-interaction",ctor:Zr}];var Rc=(o,t="[part='menu']",e="[part='trigger']",r="--qti-inline-choice-width")=>{class i extends o{#t=null;#e=null;#r=null;#i=0;#n=null;shouldAutoSizeMenu(){return!1}menuAutoSizeExtraWidth(){return 0}menuAutoSizePropertyTarget(){return this.renderRoot?.querySelector(e)??null}menuAutoSizeRows(){let s=this.renderRoot?.querySelector(t);return s?Array.from(s.children).flatMap(a=>a instanceof HTMLSlotElement?a.assignedElements().filter(c=>c instanceof HTMLElement):a instanceof HTMLElement?[a]:[]):[]}withMenuMeasurable(s){let a=this.renderRoot?.querySelector(t);if(!a)return s();let c=a.matches(":popover-open"),l=a.style.visibility,d=a.style.display;c||(a.style.visibility="hidden",a.style.display="block",a.showPopover?.());try{return s()}finally{c||(a.hidePopover?.(),a.style.visibility=l,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 c=this.#o()+this.menuAutoSizeExtraWidth();c<=0||c===this.#n||(this.#n=c,s.style.setProperty(r,`${c}px`))}#o(){return this.withMenuMeasurable(()=>{let s=0;for(let l of this.menuAutoSizeRows()){let d=l.style.width;l.style.width="max-content",s=Math.max(s,l.getBoundingClientRect().width),l.style.width=d}if(s<=0)return 0;let a=this.renderRoot?.querySelector(t);if(!a)return s;let c=getComputedStyle(a);return s+parseFloat(c.paddingLeft)+parseFloat(c.paddingRight)})}#s(){typeof MutationObserver>"u"||this.#r||(this.#r=new MutationObserver(()=>this.#a()),this.#r.observe(this,{childList:!0,subtree:!0,characterData:!0}))}#a(){this.#i||(this.#i=requestAnimationFrame(()=>{this.#i=0,this.updateMenuWidth()}))}#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 uf=w`
|
|
7509
7509
|
/* ── Host ──────────────────────────────────────────────────────────────────
|
|
7510
7510
|
Inline-block so the element flows with surrounding text.
|
|
7511
7511
|
--qti-inline-choice-width is the single width control surface:
|
|
@@ -7723,7 +7723,7 @@ CES.load();
|
|
|
7723
7723
|
z-index: var(--qti-overlay-z-index);
|
|
7724
7724
|
white-space: nowrap;
|
|
7725
7725
|
}
|
|
7726
|
-
`,
|
|
7726
|
+
`,mf=uf,vp=mf;var Zt=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ff=0,rt=class extends Rc(D){constructor(){super(),this.options=[],this._dropdownOpen=!1,this._slotObserver=null,this._menuId=`qti-inline-choice-menu-${ff++}`,this._handleDataPromptChange=()=>{this.#r()},this.required=!1,this.minChoices=0,this._handleRequiredChange=()=>{this.validate(),this.reportValidity({trigger:"change"})},this._pendingResponse=void 0,this.#o=t=>{(this.disabled||this.readonly)&&t.preventDefault()},this.#s=t=>{this.disabled||this.readonly||(t.key==="ArrowDown"||t.key==="Enter"||t.key===" ")&&(t.preventDefault(),this.#n(!0))},this.#a=t=>{let r=t.newState==="open";this._dropdownOpen!==r&&(this._dropdownOpen=r),r?this._internals.states.add("open"):this._internals.states.delete("open")},this.#c=t=>{if(!this._dropdownOpen)return;if(t.key==="Escape"){t.preventDefault(),this.#n(!1),this.#p();return}let e=this.#v(),r=this.renderRoot.activeElement,i=this.#l(),n=r||(i instanceof HTMLElement&&this.#d(i)?i:null),s=e.findIndex(a=>a===n);if(t.key==="ArrowDown"&&(t.preventDefault(),e[Math.min(e.length-1,Math.max(0,s+1))]?.focus()),t.key==="ArrowUp"&&(t.preventDefault(),e[Math.max(0,s-1)]?.focus()),t.key==="Enter"||t.key===" "){if(!n)return;if(t.preventDefault(),n instanceof HTMLButtonElement)n.click();else{let a=n.getAttribute("identifier")??"";this.#i(a)}}},this.#g=()=>{this.#r()},this.#m=t=>{if(this.disabled||this.readonly)return;let r=t.currentTarget.getAttribute("identifier")??"";this.#i(r)},this.internals.role="listbox"}get isInline(){return!0}static get styles(){return[vp]}renderTrigger(){let t=this.#e();return v`
|
|
7727
7727
|
<button
|
|
7728
7728
|
part="trigger"
|
|
7729
7729
|
type="button"
|
|
@@ -7767,7 +7767,7 @@ CES.load();
|
|
|
7767
7767
|
</button>
|
|
7768
7768
|
<slot @slotchange=${this.#g}></slot>
|
|
7769
7769
|
</div>
|
|
7770
|
-
`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#r(),this.#u(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#r()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#f(),this.#v()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#f()}#t(){let t=this.options[0]?.content;return typeof t=="string"&&t.trim()===""}menuAutoSizeRows(){let t=super.menuAutoSizeRows();return this.#t()?t.filter(e=>!e.matches('button[part~="option-prompt"]')):t}#e(){return this.options.find(t=>t.selected)??this.options[0]}#r(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt??this.configContext?.inlineChoicePrompt??"select",r=this._pendingResponse,i=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",n=[{content:e,value:"",selected:i===""},...t.map(a=>{let c=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(l=>l.cloneNode(!0)),value:c,selected:c!==""&&c===i}})],s=n.some(a=>a.selected);this.options=s?n:n.map((a,c)=>({...a,selected:c===0})),this._pendingResponse=void 0,this.#f(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize===!1?!1:!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-"))}menuAutoSizeExtraWidth(){let t=this.renderRoot.querySelector('span[part~="icon"]');if(!t)return 0;let e=this.renderRoot.querySelector('button[part="trigger"]'),r=e&&parseFloat(getComputedStyle(e).columnGap)||0;return t.offsetWidth+r}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,r=this.required||this.minChoices>=1,i=e||!r,n=this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(i,i?"":n,this,{suppressInline:!0,kind:"min"}),i}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this.#n(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#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}#i(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#f(),this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(t),this.#n(!1)}#n(t){let e=this.#h();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#o;#s;#a;#c;#p(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#l(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#d(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#h(){return this.renderRoot.querySelector(`#${this._menuId}`)}#u(){this._slotObserver=new MutationObserver(()=>this.#r()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#g;#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(){this._internals.setFormValue(this.response),await this.updateComplete;let t=this.options.find(r=>r.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let r of e){let n=(r.getAttribute("identifier")??"")===t;r.removeEventListener("click",this.#m),r.addEventListener("click",this.#m),r.disabled=this.disabled,r.readonly=this.readonly,r.internals.role="option",r.internals.ariaSelected=n?"true":"false",r.internals.ariaChecked=n?"true":"false",r.internals.ariaDisabled=this.disabled?"true":"false",r.internals.ariaReadOnly=this.readonly?"true":"false",n?r.internals.states.add("checked"):r.internals.states.delete("checked"),r.tabIndex=-1}}#v(){let t=this.renderRoot.querySelector('button[part~="option"]:not([hidden])'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};Zt([T()],rt.prototype,"options",void 0);Zt([T()],rt.prototype,"_dropdownOpen",void 0);Zt([R({context:yt,subscribe:!0}),p({attribute:!1})],rt.prototype,"configContext",void 0);Zt([p({type:String,attribute:"data-prompt"})],rt.prototype,"dataPrompt",void 0);Zt([p({type:String,attribute:"data-clear-label"})],rt.prototype,"dataClearLabel",void 0);Zt([N("dataPrompt",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleDataPromptChange",void 0);Zt([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],rt.prototype,"required",void 0);Zt([p({type:Number,attribute:"min-choices"})],rt.prototype,"minChoices",void 0);Zt([N(["required","minChoices"],{waitUntilFirstUpdate:!0})],rt.prototype,"_handleRequiredChange",void 0);Zt([p({attribute:"response",reflect:!1,noAccessor:!0})],rt.prototype,"response",null);var
|
|
7770
|
+
`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()} `}async connectedCallback(){super.connectedCallback(),this.#r(),this.#u(),await this.updateComplete,this.isConnected&&this.updateMenuWidth()}disconnectedCallback(){super.disconnectedCallback(),this.#b(),this._slotObserver?.disconnect(),this._slotObserver=null}willUpdate(t){t.has("configContext")&&this.#r()}updated(t){t.has("_dropdownOpen")&&this._dropdownOpen&&(this.#f(),this.#v()[0]?.focus()),(t.has("disabled")||t.has("readonly"))&&this.#f()}#t(){let t=this.options[0]?.content;return typeof t=="string"&&t.trim()===""}menuAutoSizeRows(){let t=super.menuAutoSizeRows();return this.#t()?t.filter(e=>!e.matches('button[part~="option-prompt"]')):t}#e(){return this.options.find(t=>t.selected)??this.options[0]}#r(){let t=Array.from(this.querySelectorAll("qti-inline-choice")),e=this.dataPrompt??this.configContext?.inlineChoicePrompt??"select",r=this._pendingResponse,i=r!==void 0?r??"":this.options.find(a=>a.selected)?.value??"",n=[{content:e,value:"",selected:i===""},...t.map(a=>{let c=a.getAttribute("identifier")??"";return{content:Array.from(a.childNodes).map(l=>l.cloneNode(!0)),value:c,selected:c!==""&&c===i}})],s=n.some(a=>a.selected);this.options=s?n:n.map((a,c)=>({...a,selected:c===0})),this._pendingResponse=void 0,this.#f(),this.updateMenuWidth()}shouldAutoSizeMenu(){return this.configContext?.inlineChoiceAutosize===!1?!1:!Array.from(this.classList).some(t=>t.startsWith("qti-input-width-"))}menuAutoSizeExtraWidth(){let t=this.renderRoot.querySelector('span[part~="icon"]');if(!t)return 0;let e=this.renderRoot.querySelector('button[part="trigger"]'),r=e&&parseFloat(getComputedStyle(e).columnGap)||0;return t.offsetWidth+r}validate(){let t=this.options.find(s=>s.selected),e=t?t.value!=="":!1,r=this.required||this.minChoices>=1,i=e||!r,n=this.dataset.minSelectionsMessage||this.dataset.minChoicesMessage||"Please select an option.";return this.setInteractionValidity(i,i?"":n,this,{suppressInline:!0,kind:"min"}),i}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this.#n(!1),this.options=this.options.map((t,e)=>({...t,selected:e===0})),this.#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}#i(t){this.options=this.options.map(e=>({...e,selected:e.value===t})),this.#f(),this.validate(),this.reportValidity({trigger:"change"}),this.saveResponse(t),this.#n(!1)}#n(t){let e=this.#h();if(e){if(t){e.matches(":popover-open")||e.showPopover();return}e.matches(":popover-open")&&e.hidePopover()}}#o;#s;#a;#c;#p(){this.renderRoot.querySelector('button[part="trigger"]')?.focus()}#l(){let t=document.activeElement;for(;t&&t instanceof HTMLElement&&t.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}#d(t){return t===this||this.contains(t)||this.renderRoot.contains(t)}#h(){return this.renderRoot.querySelector(`#${this._menuId}`)}#u(){this._slotObserver=new MutationObserver(()=>this.#r()),this._slotObserver.observe(this,{childList:!0,subtree:!0})}#g;#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(){this._internals.setFormValue(this.response),await this.updateComplete;let t=this.options.find(r=>r.selected)?.value??"",e=Array.from(this.querySelectorAll("qti-inline-choice"));for(let r of e){let n=(r.getAttribute("identifier")??"")===t;r.removeEventListener("click",this.#m),r.addEventListener("click",this.#m),r.disabled=this.disabled,r.readonly=this.readonly,r.internals.role="option",r.internals.ariaSelected=n?"true":"false",r.internals.ariaChecked=n?"true":"false",r.internals.ariaDisabled=this.disabled?"true":"false",r.internals.ariaReadOnly=this.readonly?"true":"false",n?r.internals.states.add("checked"):r.internals.states.delete("checked"),r.tabIndex=-1}}#v(){let t=this.renderRoot.querySelector('button[part~="option"]:not([hidden])'),e=Array.from(this.querySelectorAll("qti-inline-choice"));return[...t?[t]:[],...e]}};Zt([T()],rt.prototype,"options",void 0);Zt([T()],rt.prototype,"_dropdownOpen",void 0);Zt([R({context:yt,subscribe:!0}),p({attribute:!1})],rt.prototype,"configContext",void 0);Zt([p({type:String,attribute:"data-prompt"})],rt.prototype,"dataPrompt",void 0);Zt([p({type:String,attribute:"data-clear-label"})],rt.prototype,"dataClearLabel",void 0);Zt([N("dataPrompt",{waitUntilFirstUpdate:!0})],rt.prototype,"_handleDataPromptChange",void 0);Zt([p({type:Boolean,reflect:!0,converter:{fromAttribute:o=>o==="true"||o==="",toAttribute:o=>o?"true":null}})],rt.prototype,"required",void 0);Zt([p({type:Number,attribute:"min-choices"})],rt.prototype,"minChoices",void 0);Zt([N(["required","minChoices"],{waitUntilFirstUpdate:!0})],rt.prototype,"_handleRequiredChange",void 0);Zt([p({attribute:"response",reflect:!1,noAccessor:!0})],rt.prototype,"response",null);var rs=[{tag:"qti-inline-choice-interaction",ctor:rt}];var yp=[M,U,w`
|
|
7771
7771
|
/*
|
|
7772
7772
|
* A custom element is inline unless it says otherwise, and this one never did. Its shadow content
|
|
7773
7773
|
* is block-level, so block-in-inline generated the anonymous block boxes and it looked correct —
|
|
@@ -7873,7 +7873,7 @@ CES.load();
|
|
|
7873
7873
|
:host(:disabled:not(.qti-match-tabular)) ::slotted(qti-simple-match-set:first-of-type) {
|
|
7874
7874
|
display: none;
|
|
7875
7875
|
}
|
|
7876
|
-
`];var
|
|
7876
|
+
`];var qp=[M,w`
|
|
7877
7877
|
:host(.qti-match-tabular) slot:not([hidden]) {
|
|
7878
7878
|
display: contents;
|
|
7879
7879
|
}
|
|
@@ -7962,7 +7962,7 @@ CES.load();
|
|
|
7962
7962
|
justify-content: center;
|
|
7963
7963
|
flex-shrink: 0;
|
|
7964
7964
|
}
|
|
7965
|
-
`];var
|
|
7965
|
+
`];var is=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},te=class extends jt(Vt(D,"qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice","qti-simple-match-set:last-of-type > qti-simple-associable-choice","qti-simple-match-set:first-of-type"),'[data-draggable="true"]'){constructor(){super(...arguments),this.autoSizeDropzones=!1,this.maxAssociations=1,this.minAssociations=0,this.lastCheckedRadio=null,this.class="",this._response=[],this.responseIdentifier="",this.handleRadioClick=t=>{let e=t.target;this.lastCheckedRadio===e?(e.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(t)):this.lastCheckedRadio=e},this.handleRadioChange=t=>{let e=t.target,r=e.value,i=e.name,n=e.type;e.checked?(this.response?this.response.indexOf(r)===-1&&(n==="radio"&&(this.response=(this.response||[]).filter(s=>s.indexOf(i)===-1)),this.response=[...this.response,r]):this.response=[r],this.lastCheckedRadio=e):(this.response=(this.response||[]).filter(s=>s!==r),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}static{this.styles=[yp,qp]}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(t){this.classList.contains("qti-match-tabular")?this._response=t:super.response=t}isDragDropEnabled(){return!this.classList.contains("qti-match-tabular")}initiateDrag(...t){this.classList.contains("qti-match-tabular")||super.initiateDrag(...t)}afterCache(){this.classList.contains("qti-match-tabular")||super.afterCache()}async connectedCallback(){super.connectedCallback(),this.sourceChoices=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.targetChoices=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.syncTabularSlotting()}willUpdate(t){super.willUpdate?.(t),t.has("class")&&this.syncTabularSlotting()}syncTabularSlotting(){let t=this.classList.contains("qti-match-tabular"),e=this.querySelectorAll(":scope > qti-simple-match-set"),r=e[0],i=e[1],n=s=>{s.style.removeProperty("min-width"),s.style.removeProperty("min-height"),s.style.removeProperty("--qti-dropzone-min-height")};t?(r?.setAttribute("slot","match-rows"),i?.setAttribute("slot","match-cols"),this.sourceChoices?.forEach(s=>{n(s),s.setAttribute("role","rowheader"),s.tabIndex=-1}),this.targetChoices?.forEach(s=>{n(s),s.setAttribute("role","columnheader"),s.tabIndex=-1})):(r?.removeAttribute("slot"),i?.removeAttribute("slot"),this.sourceChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}),this.targetChoices?.forEach(s=>{s.removeAttribute("role"),s.tabIndex=s.disabled?-1:0}))}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getCellStateVariant(t,e){return""}render(){let t=this.class.split(" ").includes("qti-match-tabular");return v`
|
|
7966
7966
|
<slot name="prompt"></slot>
|
|
7967
7967
|
<slot ?hidden=${t}></slot>
|
|
7968
7968
|
|
|
@@ -8007,13 +8007,13 @@ CES.load();
|
|
|
8007
8007
|
`:P}
|
|
8008
8008
|
|
|
8009
8009
|
<div role="alert" part="message" id="validation-message"></div>
|
|
8010
|
-
`}};
|
|
8010
|
+
`}};is([p({type:String})],te.prototype,"class",void 0);is([p({type:String,attribute:"data-first-column-header"})],te.prototype,"dataFirstColumnHeader",void 0);is([T()],te.prototype,"_response",void 0);is([p({type:String,attribute:"response-identifier"})],te.prototype,"responseIdentifier",void 0);var ns=[{tag:"qti-match-interaction",ctor:te}];var xp=[M,w`
|
|
8011
8011
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
8012
8012
|
:host {
|
|
8013
8013
|
display: block;
|
|
8014
8014
|
}
|
|
8015
|
-
`];var
|
|
8016
|
-
<slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var
|
|
8015
|
+
`];var os=class extends D{static{this.styles=xp}#t=null;reset(){this.#t=null}validate(){return!0}get response(){return this.#t?this.#t.toString():null}set response(t){if(t)if(!isNaN(parseInt(t?.toString())))this.#t=parseInt(t.toString());else throw new Error(`Value must be a number ${t}`)}static get properties(){return{...D.properties,step:{type:Number,attribute:"step",default:10}}}render(){return v` <slot name="prompt"></slot>
|
|
8016
|
+
<slot></slot>`}constructor(){super()}connectedCallback(){super.connectedCallback();let t=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");t&&t.addEventListener("ended",()=>{this.#t++,this.saveResponse(this.value)})}};var ss=[{tag:"qti-media-interaction",ctor:os}];var wp=[M,U,Wt,w`
|
|
8017
8017
|
/* The box this element already had. See the note in qti-match-interaction.styles.ts. */
|
|
8018
8018
|
:host {
|
|
8019
8019
|
display: block;
|
|
@@ -8231,7 +8231,7 @@ CES.load();
|
|
|
8231
8231
|
:host([answer-key]) [part~='drags'] {
|
|
8232
8232
|
display: none;
|
|
8233
8233
|
}
|
|
8234
|
-
`];var
|
|
8234
|
+
`];var Cp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gf=Vt(D,"qti-simple-choice","[part~='drop']","slot[part~='drags']"),Ue=class extends jt(gf,'[data-draggable="true"]'){constructor(){super(...arguments),this.nrChoices=0}static{this.styles=wp}render(){let t=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<t.length&&(this.nrChoices=t.length),v` <slot name="prompt"> </slot>
|
|
8235
8235
|
<div part="container">
|
|
8236
8236
|
<slot part="bank drags"> </slot>
|
|
8237
8237
|
<div part="drops">
|
|
@@ -8240,7 +8240,7 @@ CES.load();
|
|
|
8240
8240
|
</div>`})}
|
|
8241
8241
|
</div>
|
|
8242
8242
|
<div id="validation-message" part="message" role="alert" style="display:none;"></div>
|
|
8243
|
-
</div>`}getValue(t){return t?.map((e,r)=>`${e} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};
|
|
8243
|
+
</div>`}getValue(t){return t?.map((e,r)=>`${e} droplist${r}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).map(e=>this.chipsIn(e).map(r=>r.getAttribute("identifier")).join(" "))}shouldTreatBlockedMaxAsInvalid(){return!1}async firstUpdated(){super.firstUpdated(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice"))}};Cp([T()],Ue.prototype,"nrChoices",void 0);Cp([p({type:String})],Ue.prototype,"orientation",void 0);var as=[{tag:"qti-order-interaction",ctor:Ue}];var kp=`@layer qti-base {
|
|
8244
8244
|
/* https://www.imsglobal.org/sites/default/files/spec/qti/v3/guide/img/qti3p0.css */
|
|
8245
8245
|
/* ============================
|
|
8246
8246
|
QTI 3 shared css
|
|
@@ -9796,7 +9796,7 @@ CES.load();
|
|
|
9796
9796
|
}
|
|
9797
9797
|
}
|
|
9798
9798
|
}
|
|
9799
|
-
`;var
|
|
9799
|
+
`;var Sp=[M,w`
|
|
9800
9800
|
:host {
|
|
9801
9801
|
display: block;
|
|
9802
9802
|
width: 100%;
|
|
@@ -9806,18 +9806,18 @@ CES.load();
|
|
|
9806
9806
|
::slotted(qti-interaction-markup) {
|
|
9807
9807
|
display: none;
|
|
9808
9808
|
}
|
|
9809
|
-
`];var
|
|
9809
|
+
`];var dn=o=>o==="file",cs=o=>typeof o=="object"&&o!==null&&typeof o.data=="string",hn=o=>o==null||o===""?null:typeof o=="string"?o:!cs(o)||o.data===""?null:o.data.startsWith("data:")?o.data:`data:${o.mime||"application/octet-stream"};base64,${o.data}`,pn=o=>{if(o==null||o==="")return null;if(typeof o=="object")return cs(o)?o:null;let t=String(o),e=/^data:([^;,]*)((?:;[^;,]*)*),([\s\S]*)$/.exec(t);if(!e)return{data:t,mime:"application/octet-stream"};let[,r,i,n]=e;if(i.split(";").includes("base64"))return{data:n,mime:r||"text/plain"};let s="";return new TextEncoder().encode(decodeURIComponent(n)).forEach(a=>s+=String.fromCharCode(a)),{data:btoa(s),mime:r||"text/plain"}};var bf=new Set(["point","pair","directedPair"]),ti=(o,t)=>{if(o==null)return o;if(dn(t))return pn(o);switch(t){case"integer":{if(typeof o=="number")return o;let e=parseInt(String(o),10);return Number.isNaN(e)?o:e}case"float":case"duration":{if(typeof o=="number")return o;let e=parseFloat(String(o));return Number.isNaN(e)?o:e}case"boolean":{if(typeof o=="boolean")return o;if(typeof o=="string"){let e=o.toLowerCase();if(e==="true")return!0;if(e==="false")return!1}return o}case"point":{let r=(Array.isArray(o)?o:String(o).trim().split(/[\s,]+/)).map(i=>typeof i=="number"?i:parseFloat(String(i)));return r.length===2&&r.every(Number.isFinite)?r:o}case"pair":case"directedPair":{let e=Array.isArray(o)?o:String(o).trim().split(/\s+/);return e.length===2?e.map(String):o}default:return String(o)}},vf=(o,t,e)=>{if(e)return Array.isArray(t)&&!bf.has(e)?{name:o,list:{[e]:t.map(r=>ti(r,e))}}:t==null?{name:o,base:null}:{name:o,base:{[e]:ti(t,e)}};if(Array.isArray(t)){let r=t.filter(i=>i!=null);if(r.length&&r.every(i=>typeof i=="boolean"))return{name:o,list:{boolean:r}};if(r.length&&r.every(i=>typeof i=="number")){let i=r,n=i.every(s=>Number.isInteger(s));return{name:o,list:{[n?"integer":"float"]:i}}}return{name:o,list:{string:t.map(i=>i==null?"":String(i))}}}if(typeof t=="boolean")return{name:o,base:{boolean:t}};if(typeof t=="number")return Number.isInteger(t)?{name:o,base:{integer:t}}:{name:o,base:{float:t}};if(t==null)return{name:o,base:{string:""}};if(typeof t=="object")try{return{name:o,base:{string:JSON.stringify(t)}}}catch{return{name:o,base:{string:String(t)}}}return{name:o,base:{string:String(t)}}},ls=(o,t={})=>{if(!ce(o))return{record:[]};let e=[];for(let[r,i]of Object.entries(o))e.push(vf(r,i,t[r]));return{record:e}},yf=(o,t={})=>{if(!ce(o))return{...t};let e={};for(let[r,i]of Object.entries(o))e[r]=t[r]??Kn(Array.isArray(i)?i[0]:i);return e},_p=(o,t={})=>ls(o,yf(o,t)),Ep=o=>{if(o==null)return null;if(Array.isArray(o))return o.map(String).join(" ");if(cs(o))return hn(o);if(typeof o=="object")try{return JSON.stringify(o)}catch{return String(o)}return String(o)},Ap=o=>{if(o)for(let t of Object.keys(o)){let e=o[t];if(e!=null)return e}},Tp=o=>{let t={};for(let e of o)if(!(!e||typeof e.name!="string"||!e.name))if(e.list){let r=Ap(e.list);t[e.name]=Array.isArray(r)?r.map(Ep).filter(i=>i!==null):[]}else t[e.name]=Ep(Ap(e.base));return t};var Rp=`/** vim: et:ts=4:sw=4:sts=4
|
|
9810
9810
|
* @license RequireJS 2.3.8 Copyright jQuery Foundation and other contributors.
|
|
9811
9811
|
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
|
|
9812
9812
|
*/var requirejs,require,define;(function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.8",commentRegExp=/\\/\\*[\\s\\S]*?\\*\\/|([^:"'=]|^)\\/\\/.*$/mg,cjsRequireRegExp=/[^.]\\s*require\\s*\\(\\s*["']([^'"\\s]+)["']\\s*\\)/g,jsSuffixRegExp=/\\.js$/,currDirRegExp=/^\\.\\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!!(typeof window<"u"&&typeof navigator<"u"&&window.document),isWebWorker=!isBrowser&&typeof importScripts<"u",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera<"u"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;function commentReplace(r,a){return a||""}function isFunction(r){return ostring.call(r)==="[object Function]"}function isArray(r){return ostring.call(r)==="[object Array]"}function each(r,a){if(r){var c;for(c=0;c<r.length&&!(r[c]&&a(r[c],c,r));c+=1);}}function eachReverse(r,a){if(r){var c;for(c=r.length-1;c>-1&&!(r[c]&&a(r[c],c,r));c-=1);}}function hasProp(r,a){return hasOwn.call(r,a)}function getOwn(r,a){return hasProp(r,a)&&r[a]}function eachProp(r,a){var c;for(c in r)if(hasProp(r,c)&&c!=="__proto__"&&c!=="constructor"&&a(r[c],c))break}function mixin(r,a,c,u){return a&&eachProp(a,function(h,q){(c||!hasProp(r,q))&&(u&&typeof h=="object"&&h&&!isArray(h)&&!isFunction(h)&&!(h instanceof RegExp)?(r[q]||(r[q]={}),mixin(r[q],h,c,u)):r[q]=h)}),r}function bind(r,a){return function(){return a.apply(r,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(r){throw r}function getGlobal(r){if(!r)return r;var a=global;return each(r.split("."),function(c){a=a[c]}),a}function makeError(r,a,c,u){var h=new Error(a+\`
|
|
9813
|
-
https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var At=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gf=o=>o.replace(/<\/(script)/gi,"<\\/$1"),bf=o=>o.replace(/<\/(style)/gi,"<\\/$1"),vf=["solution","review"];function yf(o){return o==null?!1:Array.isArray(o)?o.length>0:ce(o)?Object.keys(o).length>0:o!==""}var X=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#i=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#C(),this.#v(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let r=e?.params?.value,i=r&&typeof r=="object"?this.#d(r):null,n=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;n!==null&&(this.#o=n,n&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,c;if(a===void 0)c=void 0;else if(a===null)c=null;else if(typeof a=="string")c=a;else try{c=`__qti_json__::${JSON.stringify(a)}`}catch{c=null}if(i===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,c);break}let l=i;this.response=l,this.validate(),this.saveResponse(l,c);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#w=null}#t;static{this.styles=[xp,w`
|
|
9813
|
+
https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireModules=u,c&&(h.originalError=c),h}if(typeof define<"u")return;if(typeof requirejs<"u"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}typeof require<"u"&&!isFunction(require)&&(cfg=require,require=void 0);function newContext(r){var a,c,u,h,q,g={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},v={},B={},I={},M=[],w={},D={},L={},H=1,K=1;function X(e){var i,n;for(i=0;i<e.length;i++)if(n=e[i],n===".")e.splice(i,1),i-=1;else if(n===".."){if(i===0||i===1&&e[2]===".."||e[i-1]==="..")continue;i>0&&(e.splice(i-1,2),i-=2)}}function P(e,i,n){var o,t,f,d,l,p,b,E,m,x,R,A,O=i&&i.split("/"),k=g.map,j=k&&k["*"];if(e&&(e=e.split("/"),b=e.length-1,g.nodeIdCompat&&jsSuffixRegExp.test(e[b])&&(e[b]=e[b].replace(jsSuffixRegExp,"")),e[0].charAt(0)==="."&&O&&(A=O.slice(0,O.length-1),e=A.concat(e)),X(e),e=e.join("/")),n&&k&&(O||j)){f=e.split("/");e:for(d=f.length;d>0;d-=1){if(p=f.slice(0,d).join("/"),O){for(l=O.length;l>0;l-=1)if(t=getOwn(k,O.slice(0,l).join("/")),t&&(t=getOwn(t,p),t)){E=t,m=d;break e}}!x&&j&&getOwn(j,p)&&(x=getOwn(j,p),R=d)}!E&&x&&(E=x,m=R),E&&(f.splice(0,m,E),e=f.join("/"))}return o=getOwn(g.pkgs,e),o||e}function W(e){isBrowser&&each(scripts(),function(i){if(i.getAttribute("data-requiremodule")===e&&i.getAttribute("data-requirecontext")===u.contextName)return i.parentNode.removeChild(i),!0})}function Q(e){var i=getOwn(g.paths,e);if(i&&isArray(i)&&i.length>1)return i.shift(),u.require.undef(e),u.makeRequire(null,{skipMap:!0})([e]),!0}function G(e){var i,n=e?e.indexOf("!"):-1;return n>-1&&(i=e.substring(0,n),e=e.substring(n+1,e.length)),[i,e]}function S(e,i,n,o){var t,f,d,l,p=null,b=i?i.name:null,E=e,m=!0,x="";return e||(m=!1,e="_@r"+(H+=1)),l=G(e),p=l[0],e=l[1],p&&(p=P(p,b,o),f=getOwn(w,p)),e&&(p?n?x=e:f&&f.normalize?x=f.normalize(e,function(R){return P(R,b,o)}):x=e.indexOf("!")===-1?P(e,b,o):e:(x=P(e,b,o),l=G(x),p=l[0],x=l[1],n=!0,t=u.nameToUrl(x))),d=p&&!f&&!n?"_unnormalized"+(K+=1):"",{prefix:p,name:x,parentMap:i,unnormalized:!!d,url:t,originalName:E,isDefine:m,id:(p?p+"!"+x:x)+d}}function T(e){var i=e.id,n=getOwn(v,i);return n||(n=v[i]=new u.Module(e)),n}function C(e,i,n){var o=e.id,t=getOwn(v,o);hasProp(w,o)&&(!t||t.defineEmitComplete)?i==="defined"&&n(w[o]):(t=T(e),t.error&&i==="error"?n(t.error):t.on(i,n))}function y(e,i){var n=e.requireModules,o=!1;i?i(e):(each(n,function(t){var f=getOwn(v,t);f&&(f.error=e,f.events.error&&(o=!0,f.emit("error",e)))}),o||req.onError(e))}function F(){globalDefQueue.length&&(each(globalDefQueue,function(e){var i=e[0];typeof i=="string"&&(u.defQueueMap[i]=!0),M.push(e)}),globalDefQueue=[])}h={require:function(e){return e.require?e.require:e.require=u.makeRequire(e.map)},exports:function(e){if(e.usingExports=!0,e.map.isDefine)return e.exports?w[e.map.id]=e.exports:e.exports=w[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){return getOwn(g.config,e.map.id)||{}},exports:e.exports||(e.exports={})}}};function U(e){delete v[e],delete B[e]}function $(e,i,n){var o=e.map.id;e.error?e.emit("error",e.error):(i[o]=!0,each(e.depMaps,function(t,f){var d=t.id,l=getOwn(v,d);l&&!e.depMatched[f]&&!n[d]&&(getOwn(i,d)?(e.defineDep(f,w[d]),e.check()):$(l,i,n))}),n[o]=!0)}function z(){var e,i,n=g.waitSeconds*1e3,o=n&&u.startTime+n<new Date().getTime(),t=[],f=[],d=!1,l=!0;if(!a){if(a=!0,eachProp(B,function(p){var b=p.map,E=b.id;if(p.enabled&&(b.isDefine||f.push(p),!p.error)){if(!p.inited&&o)Q(E)?(i=!0,d=!0):(t.push(E),W(E));else if(!p.inited&&p.fetched&&b.isDefine&&(d=!0,!b.prefix))return l=!1}}),o&&t.length)return e=makeError("timeout","Load timeout for modules: "+t,null,t),e.contextName=u.contextName,y(e);l&&each(f,function(p){$(p,{},{})}),(!o||i)&&d&&(isBrowser||isWebWorker)&&!q&&(q=setTimeout(function(){q=0,z()},50)),a=!1}}c=function(e){this.events=getOwn(I,e.id)||{},this.map=e,this.shim=getOwn(g.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},c.prototype={init:function(e,i,n,o){o=o||{},!this.inited&&(this.factory=i,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=o.ignore,o.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,i){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=i)},fetch:function(){if(!this.fetched){this.fetched=!0,u.startTime=new Date().getTime();var e=this.map;if(this.shim)u.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}));else return e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;D[e]||(D[e]=!0,u.load(this.map.id,e))},check:function(){if(!(!this.enabled||this.enabling)){var e,i,n=this.map.id,o=this.depExports,t=this.exports,f=this.factory;if(!this.inited)hasProp(u.defQueueMap,n)||this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(f)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{t=u.execCb(n,f,o,t)}catch(l){e=l}else t=u.execCb(n,f,o,t);if(this.map.isDefine&&t===void 0&&(i=this.module,i?t=i.exports:this.usingExports&&(t=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",y(this.error=e)}else t=f;if(this.exports=t,this.map.isDefine&&!this.ignore&&(w[n]=t,req.onResourceLoad)){var d=[];each(this.depMaps,function(l){d.push(l.normalizedMap||l)}),req.onResourceLoad(u,this.map,d)}U(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}},callPlugin:function(){var e=this.map,i=e.id,n=S(e.prefix);this.depMaps.push(n),C(n,"defined",bind(this,function(o){var t,f,d,l=getOwn(L,this.map.id),p=this.map.name,b=this.map.parentMap?this.map.parentMap.name:null,E=u.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){o.normalize&&(p=o.normalize(p,function(m){return P(m,b,!0)})||""),f=S(e.prefix+"!"+p,this.map.parentMap,!0),C(f,"defined",bind(this,function(m){this.map.normalizedMap=f,this.init([],function(){return m},null,{enabled:!0,ignore:!0})})),d=getOwn(v,f.id),d&&(this.depMaps.push(f),this.events.error&&d.on("error",bind(this,function(m){this.emit("error",m)})),d.enable());return}if(l){this.map.url=u.nameToUrl(l),this.load();return}t=bind(this,function(m){this.init([],function(){return m},null,{enabled:!0})}),t.error=bind(this,function(m){this.inited=!0,this.error=m,m.requireModules=[i],eachProp(v,function(x){x.map.id.indexOf(i+"_unnormalized")===0&&U(x.map.id)}),y(m)}),t.fromText=bind(this,function(m,x){var R=e.name,A=S(R),O=useInteractive;x&&(m=x),O&&(useInteractive=!1),T(A),hasProp(g.config,i)&&(g.config[R]=g.config[i]);try{req.exec(m)}catch(k){return y(makeError("fromtexteval","fromText eval for "+i+" failed: "+k,k,[i]))}O&&(useInteractive=!0),this.depMaps.push(A),u.completeLoad(R),E([R],t)}),o.load(e.name,E,t,g)})),u.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){B[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,i){var n,o,t;if(typeof e=="string"){if(e=S(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[i]=e,t=getOwn(h,e.id),t){this.depExports[i]=t(this);return}this.depCount+=1,C(e,"defined",bind(this,function(f){this.undefed||(this.defineDep(i,f),this.check())})),this.errback?C(e,"error",bind(this,this.errback)):this.events.error&&C(e,"error",bind(this,function(f){this.emit("error",f)}))}n=e.id,o=v[n],!hasProp(h,n)&&o&&!o.enabled&&u.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var i=getOwn(v,e.id);i&&!i.enabled&&u.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,i){var n=this.events[e];n||(n=this.events[e]=[]),n.push(i)},emit:function(e,i){each(this.events[e],function(n){n(i)}),e==="error"&&delete this.events[e]}};function _(e){hasProp(w,e[0])||T(S(e[0],null,!0)).init(e[1],e[2])}function J(e,i,n,o){e.detachEvent&&!isOpera?o&&e.detachEvent(o,i):e.removeEventListener(n,i,!1)}function V(e){var i=e.currentTarget||e.srcElement;return J(i,u.onScriptLoad,"load","onreadystatechange"),J(i,u.onScriptError,"error"),{node:i,id:i&&i.getAttribute("data-requiremodule")}}function Y(){var e;for(F();M.length;){if(e=M.shift(),e[0]===null)return y(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));_(e)}u.defQueueMap={}}return u={config:g,contextName:r,registry:v,defined:w,urlFetched:D,defQueue:M,defQueueMap:{},Module:c,makeModuleMap:S,nextTick:req.nextTick,onError:y,configure:function(e){if(e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/"),typeof e.urlArgs=="string"){var i=e.urlArgs;e.urlArgs=function(t,f){return(f.indexOf("?")===-1?"?":"&")+i}}var n=g.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(e,function(t,f){o[f]?(g[f]||(g[f]={}),mixin(g[f],t,!0,!0)):g[f]=t}),e.bundles&&eachProp(e.bundles,function(t,f){each(t,function(d){d!==f&&(L[d]=f)})}),e.shim&&(eachProp(e.shim,function(t,f){isArray(t)&&(t={deps:t}),(t.exports||t.init)&&!t.exportsFn&&(t.exportsFn=u.makeShimExports(t)),n[f]=t}),g.shim=n),e.packages&&each(e.packages,function(t){var f,d;t=typeof t=="string"?{name:t}:t,d=t.name,f=t.location,f&&(g.paths[d]=t.location),g.pkgs[d]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(v,function(t,f){!t.inited&&!t.map.unnormalized&&(t.map=S(f,null,!0))}),(e.deps||e.callback)&&u.require(e.deps||[],e.callback)},makeShimExports:function(e){function i(){var n;return e.init&&(n=e.init.apply(global,arguments)),n||e.exports&&getGlobal(e.exports)}return i},makeRequire:function(e,i){i=i||{};function n(o,t,f){var d,l,p;return i.enableBuildCallback&&t&&isFunction(t)&&(t.__requireJsBuild=!0),typeof o=="string"?isFunction(t)?y(makeError("requireargs","Invalid require call"),f):e&&hasProp(h,o)?h[o](v[e.id]):req.get?req.get(u,o,e,n):(l=S(o,e,!1,!0),d=l.id,hasProp(w,d)?w[d]:y(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+r+(e?"":". Use require([])")))):(Y(),u.nextTick(function(){Y(),p=T(S(null,e)),p.skipMap=i.skipMap,p.init(o,t,f,{enabled:!0}),z()}),n)}return mixin(n,{isBrowser,toUrl:function(o){var t,f=o.lastIndexOf("."),d=o.split("/")[0],l=d==="."||d==="..";return f!==-1&&(!l||f>1)&&(t=o.substring(f,o.length),o=o.substring(0,f)),u.nameToUrl(P(o,e&&e.id,!0),t,!0)},defined:function(o){return hasProp(w,S(o,e,!1,!0).id)},specified:function(o){return o=S(o,e,!1,!0).id,hasProp(w,o)||hasProp(v,o)}}),e||(n.undef=function(o){F();var t=S(o,e,!0),f=getOwn(v,o);f.undefed=!0,W(o),delete w[o],delete D[t.url],delete I[o],eachReverse(M,function(d,l){d[0]===o&&M.splice(l,1)}),delete u.defQueueMap[o],f&&(f.events.defined&&(I[o]=f.events),U(o))}),n},enable:function(e){var i=getOwn(v,e.id);i&&T(e).enable()},completeLoad:function(e){var i,n,o,t=getOwn(g.shim,e)||{},f=t.exports;for(F();M.length;){if(n=M.shift(),n[0]===null){if(n[0]=e,i)break;i=!0}else n[0]===e&&(i=!0);_(n)}if(u.defQueueMap={},o=getOwn(v,e),!i&&!hasProp(w,e)&&o&&!o.inited){if(g.enforceDefine&&(!f||!getGlobal(f)))return Q(e)?void 0:y(makeError("nodefine","No define call for "+e,null,[e]));_([e,t.deps||[],t.exportsFn])}z()},nameToUrl:function(e,i,n){var o,t,f,d,l,p,b,E=getOwn(g.pkgs,e);if(E&&(e=E),b=getOwn(L,e),b)return u.nameToUrl(b,i,n);if(req.jsExtRegExp.test(e))l=e+(i||"");else{for(o=g.paths,t=e.split("/"),f=t.length;f>0;f-=1)if(d=t.slice(0,f).join("/"),p=getOwn(o,d),p){isArray(p)&&(p=p[0]),t.splice(0,f,p);break}l=t.join("/"),l+=i||(/^data\\:|^blob\\:|\\?/.test(l)||n?"":".js"),l=(l.charAt(0)==="/"||l.match(/^[\\w\\+\\.\\-]+:/)?"":g.baseUrl)+l}return g.urlArgs&&!/^blob\\:/.test(l)?l+g.urlArgs(e,l):l},load:function(e,i){req.load(u,e,i)},execCb:function(e,i,n,o){return i.apply(o,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var i=V(e);u.completeLoad(i.id)}},onScriptError:function(e){var i=V(e);if(!Q(i.id)){var n=[];return eachProp(v,function(o,t){t.indexOf("_@r")!==0&&each(o.depMaps,function(f){if(f.id===i.id)return n.push(t),!0})}),y(makeError("scripterror",'Script error for "'+i.id+(n.length?'", needed by: '+n.join(", "):'"'),e,[i.id]))}}},u.require=u.makeRequire(),u}req=requirejs=function(r,a,c,u){var h,q,g=defContextName;return!isArray(r)&&typeof r!="string"&&(q=r,isArray(a)?(r=a,a=c,c=u):r=[]),q&&q.context&&(g=q.context),h=getOwn(contexts,g),h||(h=contexts[g]=req.s.newContext(g)),q&&h.configure(q),h.require(r,a,c)},req.config=function(r){return req(r)},req.nextTick=typeof setTimeout<"u"?function(r){setTimeout(r,4)}:function(r){r()},require||(require=req),req.version=version,req.jsExtRegExp=/^\\/|:|\\?|\\.js$/,req.isBrowser=isBrowser,s=req.s={contexts,newContext},req({}),each(["toUrl","undef","defined","specified"],function(r){req[r]=function(){var a=contexts[defContextName];return a.require[r].apply(a,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(r,a,c){var u=r.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return u.type=r.scriptType||"text/javascript",u.charset="utf-8",u.async=!0,u},req.load=function(r,a,c){var u=r&&r.config||{},h;if(isBrowser)return h=req.createNode(u,a,c),h.setAttribute("data-requirecontext",r.contextName),h.setAttribute("data-requiremodule",a),h.attachEvent&&!(h.attachEvent.toString&&h.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,h.attachEvent("onreadystatechange",r.onScriptLoad)):(h.addEventListener("load",r.onScriptLoad,!1),h.addEventListener("error",r.onScriptError,!1)),h.src=c,u.onNodeCreated&&u.onNodeCreated(h,u,a,c),currentlyAddingScript=h,baseElement?head.insertBefore(h,baseElement):head.appendChild(h),currentlyAddingScript=null,h;if(isWebWorker)try{setTimeout(function(){},0),importScripts(c),r.completeLoad(a)}catch(q){r.onError(makeError("importscripts","importScripts failed for "+a+" at "+c,q,[a]))}};function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"||eachReverse(scripts(),function(r){if(r.readyState==="interactive")return interactiveScript=r}),interactiveScript}isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(r){if(head||(head=r.parentNode),dataMain=r.getAttribute("data-main"),dataMain)return mainScript=dataMain,!cfg.baseUrl&&mainScript.indexOf("!")===-1&&(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(r,a,c){var u,h;typeof r!="string"&&(c=a,a=r,r=null),isArray(a)||(c=a,a=null),!a&&isFunction(c)&&(a=[],c.length&&(c.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(q,g){a.push(g)}),a=(c.length===1?["require"]:["require","exports","module"]).concat(a))),useInteractive&&(u=currentlyAddingScript||getInteractiveScript(),u&&(r||(r=u.getAttribute("data-requiremodule")),h=contexts[u.getAttribute("data-requirecontext")])),h?(h.defQueue.push([r,a,c]),h.defQueueMap[r]=!0):globalDefQueue.push([r,a,c])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this,typeof setTimeout>"u"?void 0:setTimeout);`;var At=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qf=o=>o.replace(/<\/(script)/gi,"<\\/$1"),xf=o=>o.replace(/<\/(style)/gi,"<\\/$1"),wf=["solution","review"];function Cf(o){return o==null?!1:Array.isArray(o)?o.length>0:ce(o)?Object.keys(o).length>0:o!==""}var X=class extends D{constructor(){super(...arguments),this._iframeLoaded=!1,this._interactionReady=!1,this._pendingMessages=[],this._iframeMessageOrigin=null,this.requirePathsJson="",this.requireShimJson="",this.requireJsUrl="",this.baseUrl="",this.useDefaultPaths=!1,this.status="interacting",this.#e=null,this._errorMessage=null,this.response=null,this.#i=null,this.#n=null,this.#o=null,this.#s="",this.handleIframeMessage=t=>{let{data:e}=t;if(!(!e||e.source!=="qti-pci-iframe")&&!(!this.iframe?.contentWindow||t.source!==this.iframe.contentWindow)&&!(e.responseIdentifier&&e.responseIdentifier!==this.responseIdentifier)){if(this._iframeMessageOrigin===null)this._iframeMessageOrigin=t.origin;else if(t.origin!==this._iframeMessageOrigin)return;switch(e.method){case"iframeReady":this._interactionReady=!0,this.#C(),this.#v(),this.dispatchEvent(new CustomEvent("qti-portable-custom-interaction-loaded",{bubbles:!0}));break;case"resize":typeof e.height=="number"&&this.iframe&&(this.iframe.style.height=`${e.height}px`);break;case"console":this.dispatchEvent(new CustomEvent("qti-pci-console",{detail:{level:e.level,args:e.args},bubbles:!0}));break;case"interactionChanged":{let r=e?.params?.value,i=r&&typeof r=="object"?this.#d(r):null,n=typeof e?.params?.valid=="boolean"?e.params.valid:null,s=typeof e?.params?.customValidity=="string"?e.params.customValidity:null;n!==null&&(this.#o=n,n&&s===null&&(this.#s="")),s!==null&&(this.#s=s);let a=e?.params?.state,c;if(a===void 0)c=void 0;else if(a===null)c=null;else if(typeof a=="string")c=a;else try{c=`__qti_json__::${JSON.stringify(a)}`}catch{c=null}if(i===null){let d=this.responseVariable?.cardinality,h=d==="record"?null:d==="single"?"":[];this.response=h,this.validate(),this.saveResponse(h,c);break}let l=i;this.response=l,this.validate(),this.saveResponse(l,c);break}case"error":this._errorMessage=e.params.message,console.error("Error from PCI iframe:",e.params.message);break}}},this.#w=null}#t;static{this.styles=[Sp,w`
|
|
9814
9814
|
:host {
|
|
9815
9815
|
display: block;
|
|
9816
9816
|
width: 100%;
|
|
9817
9817
|
min-height: 50px;
|
|
9818
9818
|
}
|
|
9819
|
-
`]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},r=t.correctResponse;return
|
|
9820
|
-
`);this.sendMessageToIframe("setStylesheets",i)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#C(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#p()),r=JSON.stringify(this.#l()),i=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",n=i?i.endsWith("/")?i:`${i}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=this.dataset.componentsCdnUrl,c=this.dataset.componentsCssUrl,l=this.requireJsUrl?`<script src="${this.requireJsUrl}"></script>`:`<script>${
|
|
9819
|
+
`]}#e;set responseDeclaration(t){this.#e=t}get responseDeclaration(){if(this.#e)return this.#e;let t=this.responseVariable;if(!t)return null;let e={baseType:t.baseType,cardinality:t.cardinality},r=t.correctResponse;return Cf(r)&&(e.correctResponse={value:r}),e}#r(){let t=this.responseDeclaration;if(!t?.correctResponse||wf.includes(this.status))return t;let{correctResponse:e,...r}=t;return r}#i;#n;#o;#s;#a(){if(this.#i===null&&this.requirePathsJson)try{let t=JSON.parse(this.requirePathsJson);if(Array.isArray(t)||!t||typeof t!="object")throw new Error("Require paths must be a JSON object.");this.#i=t}catch(t){console.error("Error parsing require paths JSON:",t),this._errorMessage=`Error parsing require paths JSON: ${t.message}`,this.#i={}}return this.#i||{}}#c(){if(this.#n===null&&this.requireShimJson)try{this.#n=JSON.parse(this.requireShimJson)}catch(t){console.error("Error parsing require shim JSON:",t),this._errorMessage=`Error parsing require shim JSON: ${t.message}`,this.#n={}}return this.#n||{}}#p(){return this.#a()}#l(){return this.#c()}#d(t){if(t&&Array.isArray(t.record)){let e=Tp(t.record);return Object.keys(e).length?e:null}for(let e in t)if(t.hasOwnProperty(e)){let r=t[e];if(r){for(let i in r)if(r.hasOwnProperty(i)){let n=r[i];if(i==="file"){if(Array.isArray(n))return n.map(hn).filter(a=>a!==null);let s=hn(n);if(s!==null)return s;continue}if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}getDirectChildrenByTag(t){let e=t.toLowerCase();return Array.from(this.children).filter(r=>r.tagName.toLowerCase()===e)}normalizeListValue(t){return t==null?[]:Array.isArray(t)?t:[t]}variableToQtiVariableJSON(t,e,r){if(e==="record"||r==="record")return ls(t);if(e!=="single"){let i=this.normalizeListValue(t).map(n=>ti(n,r));return{list:{[r]:i}}}return{base:{[r]:ti(t,r)}}}getQtiContextDefaultsFromItem(){let t=this.closest("qti-assessment-item");if(!t)return{};let e={};return t.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(i=>{let n=i.querySelector("qti-default-value");if(!n)return;let{value:s,baseTypes:a}=ji(n.querySelectorAll("qti-value"));for(let[c,l]of Object.entries(s))e[c]=ti(l,a[c]??"string")}),e}getQtiContextRecord(){let t=this.getQtiContextDefaultsFromItem(),e=this.qtiContext?.QTI_CONTEXT||{},r={...t,...e};if(!Object.keys(r).length)return null;let i={candidateIdentifier:r.candidateIdentifier??"",testIdentifier:r.testIdentifier??"",environmentIdentifier:r.environmentIdentifier??"",...r};return ls(i)}getTemplateVariables(){let t={},e=this.getDirectChildrenByTag("qti-template-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("template-identifier")||r.getAttribute("identifier")||"";if(!i)return;let n=this.context?.variables?.find(c=>c.identifier===i);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[i]=this.variableToQtiVariableJSON(n.value,s,a)}),t}getContextVariables(){let t={},e=this.getDirectChildrenByTag("qti-context-variable");return e.length&&e.forEach(r=>{let i=r.getAttribute("identifier")||"";if(!i)return;if(i==="QTI_CONTEXT"){let c=this.getQtiContextRecord();c&&(t[i]=c);return}let n=this.context?.variables?.find(c=>c.identifier===i);if(!n)return;let s=n.cardinality||"single",a=n.baseType||"string";t[i]=this.variableToQtiVariableJSON(n.value,s,a)}),t}#h(t){let e={...t};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let i=r.replace(/[A-Z]/g,n=>`-${n.toLowerCase()}`);e[i]=t[r]}return e}#u(t){let e={...t},r=(i,n,s)=>{let a=i;for(let c=0;c<n.length;c+=1){let l=n[c];if(c===n.length-1){a[l]=s;return}(!a[l]||typeof a[l]!="object"||Array.isArray(a[l]))&&(a[l]={}),a=a[l]}};for(let[i,n]of Object.entries(t)){if(!i.includes("__"))continue;let s=i.split("__").filter(Boolean);s.length<2||r(e,s,n)}return e}responseVariablesToQtiVariableJSON(t,e,r,i){if(e==="record")return _p(t,i);if(e!=="single"){let n={list:{}};return n.list[r]=dn(r)?this.normalizeListValue(t).map(pn).filter(Boolean):t,n}else{let n={base:{}};return n.base[r]=dn(r)?pn(t):t,n}}#g(){return this.response===null||this.response===void 0?!1:ce(this.response)?Object.values(this.response).some(t=>t!==""&&t!==null&&t!==void 0):Array.isArray(this.response)?this.response.length===0?!1:this.response.some(t=>t!==""&&t!==null&&t!==void 0):this.response!==""}#m(t,e){let r=this.dataset.invalidresponsemessage||"Invalid response.",i=t?"":e&&e.trim().length>0?e:r;this._internals.setValidity(t?{}:{customError:!0},i)}validate(){let t=typeof this.#o=="boolean"?this.#o:this.#g();return this.#m(t,this.#s),t}set value(t){t===null?this.#t=[]:this.#t=Array.isArray(t)?t:t.split(",")}get value(){return this.#t===null||this.#t===void 0?null:ce(this.#t)?JSON.stringify(this.#t):Array.isArray(this.#t)?this.#t.join(","):String(this.#t)}set boundTo(t){if(!t||!t[this.responseIdentifier])return;let e=this.#d(t[this.responseIdentifier]);this.#t=e,this.saveResponse(e)}get boundTo(){let t={},e=this.context?.variables?.find(r=>r.identifier===this.responseIdentifier);if(e){let r=e.cardinality||"single",i=e.baseType||"string",n=e.value||null,s=e.fieldBaseTypes,a=this.responseVariablesToQtiVariableJSON(n,r,i,s);t[this.responseIdentifier]=a}return t}#b(t){return t&&t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(///g,"/").replace(/`/g,"`").replace(/=/g,"=")}#f(t){let e={};for(let[r,i]of Object.entries(t))typeof i=="string"?e[r]=this.#b(i):e[r]=i;return e}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.handleIframeMessage)}sendMessageToIframe(t,e){let r=this.iframe?.contentWindow;if(!this._iframeLoaded||!r){this._pendingMessages.push({method:t,params:e});return}r.postMessage({source:"qti-portable-custom-interaction",responseIdentifier:this.responseIdentifier,method:t,params:e},"*")}#v(){this._pendingMessages.length&&(this._pendingMessages.forEach(t=>{this.sendMessageToIframe(t.method,t.params)}),this._pendingMessages=[])}createIframe(){this._interactionReady=!1,this.iframe=document.createElement("iframe"),this.iframe.id=`pci-iframe-${this.responseIdentifier}`,this.iframe.setAttribute("title","QTI PCI Iframe"),this.iframe.setAttribute("aria-label","QTI PCI Iframe"),this.iframe.setAttribute("aria-hidden","false"),this.iframe.setAttribute("role","application"),this.iframe.style.width="100%",this.iframe.style.border="none",this.iframe.style.display="block",this.iframe.onload=()=>{this._iframeLoaded=!0,this.#x(),this.#y()};let t=`qti-pci-${this.responseIdentifier}-${Date.now()}`;this.iframe.name=t;let{sandbox:e,allow:r}=this.configContext?.pciIframe??{};e!==void 0&&this.iframe.setAttribute("sandbox",e),r&&this.iframe.setAttribute("allow",r);let i=this.generateIframeContent();this.iframe.srcdoc=i,this.appendChild(this.iframe)}#y(){let t=this.#h(this.#u(this.#f({...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:Yn(`${window.location.origin}${this.baseUrl}`):window.location.origin,responseIdentifier:this.responseIdentifier,properties:t,contextVariables:this.getContextVariables(),templateVariables:this.getTemplateVariables(),dataAttributes:{...this.dataset},interactionModules:this.#q(),boundTo:r?null:this.boundTo,responseDeclaration:this.#r(),status:this.status,state:r};this.sendMessageToIframe("initialize",i)}#q(){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}#x(){let t=this.querySelector("qti-interaction-markup");t&&this.sendMessageToIframe("setMarkup",t.innerHTML);let e=Array.from(this.querySelectorAll("qti-stylesheet"));if(e.length){let i=e.map(n=>n.outerHTML).join(`
|
|
9820
|
+
`);this.sendMessageToIframe("setStylesheets",i)}let r=this.querySelector("properties");r&&this.sendMessageToIframe("setProperties",r.innerHTML)}#C(){}connectedCallback(){super.connectedCallback(),this.#o=null,this.#s="";let t=this.response;(Array.isArray(t)?t.length>0:t)||(this.response=this.responseVariable?.value??null),window.addEventListener("message",this.handleIframeMessage),this.createIframe()}generateIframeContent(){let t=window.getComputedStyle(document.body),e=JSON.stringify(this.#p()),r=JSON.stringify(this.#l()),i=this.dataset.baseUrl?this.dataset.baseUrl.startsWith("/")?`${window.location.origin}${this.dataset.baseUrl}`:this.dataset.baseUrl:"",n=i?i.endsWith("/")?i:`${i}/`:`${window.location.origin}/`,s=this.dataset.forwardConsole==="true",a=this.dataset.componentsCdnUrl,c=this.dataset.componentsCssUrl,l=this.requireJsUrl?`<script src="${this.requireJsUrl}"></script>`:`<script>${qf(Rp)}</script>`,d=`
|
|
9821
9821
|
font-family: ${t.getPropertyValue("font-family")};
|
|
9822
9822
|
font-size: ${t.getPropertyValue("font-size")};
|
|
9823
9823
|
line-height: ${t.getPropertyValue("line-height")};
|
|
@@ -9830,7 +9830,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
9830
9830
|
<title>QTI PCI Container</title>
|
|
9831
9831
|
<base href="${n}" />
|
|
9832
9832
|
${a?`<script type="module">import '${a}';</script>`:""}
|
|
9833
|
-
<style>${
|
|
9833
|
+
<style>${xf(kp)}</style>
|
|
9834
9834
|
<style>
|
|
9835
9835
|
body, html {
|
|
9836
9836
|
margin: 0;
|
|
@@ -10716,7 +10716,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
10716
10716
|
<h1>Error</h1>
|
|
10717
10717
|
${this._errorMessage}
|
|
10718
10718
|
</div>`:""}
|
|
10719
|
-
`}};At([p({type:String,attribute:"module"})],X.prototype,"module",void 0);At([p({type:String,attribute:"custom-interaction-type-identifier"})],X.prototype,"customInteractionTypeIdentifier",void 0);At([p({type:String,attribute:"data-require-paths"})],X.prototype,"requirePathsJson",void 0);At([p({type:String,attribute:"data-require-shim"})],X.prototype,"requireShimJson",void 0);At([p({type:String,attribute:"data-require-js-url"})],X.prototype,"requireJsUrl",void 0);At([p({type:String,attribute:"data-base-url"})],X.prototype,"baseUrl",void 0);At([p({type:Boolean,attribute:"data-use-default-paths"})],X.prototype,"useDefaultPaths",void 0);At([p({type:String,attribute:"data-status"})],X.prototype,"status",void 0);At([T()],X.prototype,"_errorMessage",void 0);At([R({context:j,subscribe:!0}),T()],X.prototype,"context",void 0);At([R({context:qt,subscribe:!0}),T()],X.prototype,"qtiContext",void 0);At([p({attribute:"response",reflect:!1,converter:Xt({emptyAs:null})})],X.prototype,"response",void 0);var
|
|
10719
|
+
`}};At([p({type:String,attribute:"module"})],X.prototype,"module",void 0);At([p({type:String,attribute:"custom-interaction-type-identifier"})],X.prototype,"customInteractionTypeIdentifier",void 0);At([p({type:String,attribute:"data-require-paths"})],X.prototype,"requirePathsJson",void 0);At([p({type:String,attribute:"data-require-shim"})],X.prototype,"requireShimJson",void 0);At([p({type:String,attribute:"data-require-js-url"})],X.prototype,"requireJsUrl",void 0);At([p({type:String,attribute:"data-base-url"})],X.prototype,"baseUrl",void 0);At([p({type:Boolean,attribute:"data-use-default-paths"})],X.prototype,"useDefaultPaths",void 0);At([p({type:String,attribute:"data-status"})],X.prototype,"status",void 0);At([T()],X.prototype,"_errorMessage",void 0);At([R({context:j,subscribe:!0}),T()],X.prototype,"context",void 0);At([R({context:qt,subscribe:!0}),T()],X.prototype,"qtiContext",void 0);At([p({attribute:"response",reflect:!1,converter:Xt({emptyAs:null})})],X.prototype,"response",void 0);var ds=class extends X{#t=!1;async waitForReady(t=5e3){this._interactionReady||await new Promise((e,r)=>{let i=()=>{window.clearTimeout(n),e()},n=window.setTimeout(()=>{this.removeEventListener("qti-portable-custom-interaction-loaded",i),r(new Error(`Portable custom interaction did not become ready within ${t}ms`))},t);this.addEventListener("qti-portable-custom-interaction-loaded",i,{once:!0})})}async getIFrameContent(){return new Promise(t=>{let e=`get-content-${Date.now()}`,r=i=>{let{data:n}=i;n?.source==="qti-pci-iframe"&&(!n?.responseIdentifier||n?.responseIdentifier===this.responseIdentifier)&&n?.method==="getContentResponse"&&n?.messageId===e&&(window.removeEventListener("message",r),t(n.content))};window.addEventListener("message",r),this.sendMessageToIframe("getContent",{messageId:e}),setTimeout(()=>{window.removeEventListener("message",r),t("")},5e3)})}setTestContext(t){this.context=t,this.updateComplete.then(()=>{this.value=t?.variables?.find(e=>e.identifier===this.responseIdentifier).value})}async recreateIframe(){this.#t=!0;try{this.iframe&&(this._iframeLoaded=!1,this.iframe.remove()),this._pendingMessages=[],this.createIframe(),await this.waitForReady()}finally{this.#t=!1}}disconnectedCallback(){this.#t||super.disconnectedCallback()}async iFrameMouseClick(t,e){return new Promise(r=>{let i=`click-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="clickResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r())};window.addEventListener("message",n),this.sendMessageToIframe("simulateClick",{x:t,y:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r()},5e3)})}async iFrameClickOnElement(t){return new Promise(e=>{let r=`click-selector-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameClickOnElementByText(t){return new Promise(e=>{let r=`click-text-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="clickTextResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("clickOnElementByText",{text:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}async iFrameSetValueElement(t,e){return new Promise(r=>{let i=`set-value-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElement",{selector:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r(!1)},5e3)})}async iFrameGetBoundingClientRect(t){return new Promise(e=>{let r=`get-bounding-rect-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="getBoundingRectResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.rect??null))};window.addEventListener("message",i),this.sendMessageToIframe("getBoundingRect",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(null)},5e3)})}async iFrameSetValueElementByText(t,e){return new Promise(r=>{let i=`set-value-text-${Date.now()}`,n=s=>{let{data:a}=s;a?.source==="qti-pci-iframe"&&(!a?.responseIdentifier||a?.responseIdentifier===this.responseIdentifier)&&a?.method==="setValueByTextResponse"&&a?.messageId===i&&(window.removeEventListener("message",n),r(a.success))};window.addEventListener("message",n),this.sendMessageToIframe("setValueElementByText",{text:t,value:e,messageId:i}),setTimeout(()=>{window.removeEventListener("message",n),r(!1)},5e3)})}async iFrameMousedownOnElement(t){return new Promise(e=>{let r=`mousedown-selector-${Date.now()}`,i=n=>{let{data:s}=n;s?.source==="qti-pci-iframe"&&(!s?.responseIdentifier||s?.responseIdentifier===this.responseIdentifier)&&s?.method==="mousedownSelectorResponse"&&s?.messageId===r&&(window.removeEventListener("message",i),e(s.success))};window.addEventListener("message",i),this.sendMessageToIframe("mousedownOnSelector",{selector:t,messageId:r}),setTimeout(()=>{window.removeEventListener("message",i),e(!1)},5e3)})}generateIframeContent(){let t=super.generateIframeContent(),e=`
|
|
10720
10720
|
// Test helper functions for QtiPortableCustomInteractionTest
|
|
10721
10721
|
// Base iframe implementation already provides PCIManager.getContent
|
|
10722
10722
|
|
|
@@ -10909,7 +10909,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
10909
10909
|
}
|
|
10910
10910
|
},
|
|
10911
10911
|
true
|
|
10912
|
-
);`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var
|
|
10912
|
+
);`,r=t.lastIndexOf("</script>");return t.substring(0,r)+e+t.substring(r)}};var hs=[{tag:"qti-portable-custom-interaction",ctor:X},{tag:"qti-portable-custom-interaction-test",ctor:ds}];var Ip="important",kf=" !"+Ip,qr=Ot(class extends Ae{constructor(o){if(super(o),o.type!==Hr.ATTRIBUTE||o.name!=="style"||o.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(o){return Object.keys(o).reduce((t,e)=>{let r=o[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(o,[t]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let i=t[r];if(i!=null){this.ft.add(r);let n=typeof i=="string"&&i.endsWith(kf);r.includes("-")||n?e.setProperty(r,n?i.slice(0,-11):i,n?Ip:""):e[r]=i}}return it}});var Mp=[M,U,w`
|
|
10913
10913
|
/* Not positioned on purpose: the placed copies are absolutely positioned against the stage
|
|
10914
10914
|
(qti-position-object-stage), so they land on its image wherever this tray sits. */
|
|
10915
10915
|
:host {
|
|
@@ -10944,7 +10944,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
10944
10944
|
[part~='point'][data-ghost] {
|
|
10945
10945
|
pointer-events: none;
|
|
10946
10946
|
}
|
|
10947
|
-
`];var He=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},
|
|
10947
|
+
`];var He=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Sf=4,_t=class extends D{constructor(){super(...arguments),this.maxChoices=1,this.minChoices=0,this.centerPoint=null,this.response=null,this._layout=0,this._drag=null,this._armed=!1,this.#t=null,this.#e=new ResizeObserver(()=>this._layout++),this._handleResponseChange=()=>{this._internals.setFormValue(er(this.response)||null),this.validate(),z(this._internals.states,"used",this.#n())},this.#g=t=>{if(!this._drag)return;let e={x:t.clientX,y:t.clientY},r=this._drag.moved||Math.hypot(e.x-this._drag.start.x,e.y-this._drag.start.y)>Sf;this._drag={...this._drag,client:e,moved:r}},this.#m=t=>{window.removeEventListener("pointermove",this.#g);let e=this._drag;if(this._drag=null,!e)return;if(!e.moved){e.index===-1&&(this._armed=!this._armed);return}let r=this.#p({x:t.clientX,y:t.clientY}),i=this.#r();e.index===-1?r&&this.#h(r):r?(i[e.index]=r,this.#i(i)):this.#i(i.filter((n,s)=>s!==e.index))},this.#b=t=>{if(!this._armed||this.#d)return;let e=this.#p({x:t.clientX,y:t.clientY});e&&(this._armed=!1,this.#h(e))}}static{this.styles=Mp}#t;#e;#r(){return(this.response??[]).map(t=>{let[e,r]=t.split(" ").map(Number);return{x:e,y:r}})}#i(t){this.response=t.map(e=>`${Math.round(e.x)} ${Math.round(e.y)}`),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})}#n(){return this.maxChoices>0&&(this.response?.length??0)>=this.maxChoices}validate(){let t=this.response?.length??0,e=this.maxChoices>0&&t>this.maxChoices,r=t<this.minChoices,i="other",n="";e?(i="max",n=this.dataset.maxSelectionsMessage||`Please place no more than ${this.maxChoices} ${this.maxChoices===1?"position":"positions"}.`):r&&(i="min",n=this.dataset.minSelectionsMessage||`Please place at least ${this.minChoices} ${this.minChoices===1?"position":"positions"}.`);let s=!e&&!r;return this.setInteractionValidity(s,n,this,{suppressInline:!0,kind:i}),s}reportValidity(t){return super.reportValidity(t)}reset(){this.resetValidityReport(),this._armed=!1,this.response=[],this._internals.setFormValue(null)}get#o(){return this.closest("qti-position-object-stage")}#s(){let t=this.#t;return t?{width:parseFloat(t.getAttribute("width")??"")||t.naturalWidth||t.clientWidth||1,height:parseFloat(t.getAttribute("height")??"")||t.naturalHeight||t.clientHeight||1}:{width:1,height:1}}#a(){let t=this.#t?.getBoundingClientRect();return!t||t.width===0?1:this.#s().width/t.width}#c(){let t=this.querySelector("img"),e=parseFloat(t?.getAttribute("width")??"")||t?.naturalWidth||30,r=parseFloat(t?.getAttribute("height")??"")||t?.naturalHeight||30,[i,n]=(this.centerPoint??"").split(/[\s,]+/).map(Number);return{width:e,height:r,centre:Number.isFinite(i)&&Number.isFinite(n)?{x:i,y:n}:{x:e/2,y:r/2}}}#p(t){let e=this.#t?.getBoundingClientRect();if(!e||t.x<e.left||t.x>e.right||t.y<e.top||t.y>e.bottom)return null;let r=this.#a();return{x:(t.x-e.left)*r,y:(t.y-e.top)*r}}#l(t){let e=this.#o?.getBoundingClientRect(),r=this.#t?.getBoundingClientRect();if(!e||!r)return{display:"none"};let i=this.#a(),n=this.#c();return{left:`${r.left-e.left+t.x/i-n.centre.x/i}px`,top:`${r.top-e.top+t.y/i-n.centre.y/i}px`,width:`${n.width/i}px`,height:`${n.height/i}px`}}get#d(){return this.disabled||this.readonly}#h(t){this.#n()||this.#i([...this.#r(),t])}#u(t,e){if(this.#d||t.button!==0||e===-1&&this.#n())return;t.preventDefault();let r={x:t.clientX,y:t.clientY};this._drag={index:e,client:r,start:r,moved:!1},window.addEventListener("pointermove",this.#g),window.addEventListener("pointerup",this.#m,{once:!0})}#g;#m;#b;#f(t){if(!this.#d)if(t.key==="Enter"||t.key===" "){if(t.preventDefault(),this.#n())return;let{width:e,height:r}=this.#s();this.#h({x:e/2,y:r/2}),this.updateComplete.then(()=>{let i=this.shadowRoot?.querySelectorAll('[part~="point"]');i?.[i.length-1]?.focus()})}else t.key==="Escape"&&(this._armed=!1)}#v(t,e){if(this.#d)return;let r=t.shiftKey?10:1,i={ArrowLeft:{x:-r,y:0},ArrowRight:{x:r,y:0},ArrowUp:{x:0,y:-r},ArrowDown:{x:0,y:r}},n=this.#r();if(i[t.key]){t.preventDefault();let{width:s,height:a}=this.#s(),c=n[e];n[e]={x:Math.min(s,Math.max(0,c.x+i[t.key].x)),y:Math.min(a,Math.max(0,c.y+i[t.key].y))},this.#i(n),this.updateComplete.then(()=>this.shadowRoot?.querySelectorAll('[part~="point"]')[e]?.focus())}else(t.key==="Delete"||t.key==="Backspace")&&(t.preventDefault(),this.#i(n.filter((s,a)=>a!==e)),this.updateComplete.then(()=>this.shadowRoot?.querySelector('[part~="object"]')?.focus()))}connectedCallback(){super.connectedCallback(),this.#t=this.#o?.querySelector(":scope > img, :scope > picture img")??null,this.#t&&(this.#e.observe(this.#t),this.#t.addEventListener("load",()=>this._layout++),this.#t.addEventListener("click",this.#b))}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect(),this.#t?.removeEventListener("click",this.#b),window.removeEventListener("pointermove",this.#g)}render(){this._layout;let t=this.querySelector("img")?.currentSrc||this.querySelector("img")?.src||"",e=this.querySelector("img")?.getAttribute("alt")||"object",r=this.#n(),i=["object",this._armed?"selected":"",r?"used":""].filter(Boolean).join(" "),n=this.#r(),s=this._drag,a=s&&s.moved&&this.#t?(()=>{let c=this.#t.getBoundingClientRect(),l=this.#a();return{x:(s.client.x-c.left)*l,y:(s.client.y-c.top)*l}})():null;return v`
|
|
10948
10948
|
<div
|
|
10949
10949
|
part=${i}
|
|
10950
10950
|
role="button"
|
|
@@ -10970,7 +10970,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
10970
10970
|
/>`})}
|
|
10971
10971
|
${s&&s.index===-1&&a?v`<img part="point" data-ghost src=${t} alt="" style=${qr(this.#l(a))} />`:P}
|
|
10972
10972
|
<div part="message" role="alert" id="validation-message" style="display:none;"></div>
|
|
10973
|
-
`}};He([p({type:Number,attribute:"max-choices"})],_t.prototype,"maxChoices",void 0);He([p({type:Number,attribute:"min-choices"})],_t.prototype,"minChoices",void 0);He([p({type:String,attribute:"center-point"})],_t.prototype,"centerPoint",void 0);He([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Vi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>er(o)}})],_t.prototype,"response",void 0);He([T()],_t.prototype,"_layout",void 0);He([T()],_t.prototype,"_drag",void 0);He([T()],_t.prototype,"_armed",void 0);He([N("response")],_t.prototype,"_handleResponseChange",void 0);var
|
|
10973
|
+
`}};He([p({type:Number,attribute:"max-choices"})],_t.prototype,"maxChoices",void 0);He([p({type:Number,attribute:"min-choices"})],_t.prototype,"minChoices",void 0);He([p({type:String,attribute:"center-point"})],_t.prototype,"centerPoint",void 0);He([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Vi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>er(o)}})],_t.prototype,"response",void 0);He([T()],_t.prototype,"_layout",void 0);He([T()],_t.prototype,"_drag",void 0);He([T()],_t.prototype,"_armed",void 0);He([N("response")],_t.prototype,"_handleResponseChange",void 0);var Pp=[M,w`
|
|
10974
10974
|
/* The containing block of every placed copy. */
|
|
10975
10975
|
:host {
|
|
10976
10976
|
display: inline-block;
|
|
@@ -10983,7 +10983,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
10983
10983
|
height: auto;
|
|
10984
10984
|
user-select: none;
|
|
10985
10985
|
}
|
|
10986
|
-
`];var
|
|
10986
|
+
`];var ps=class extends S{static{this.styles=Pp}render(){return v`<slot></slot>`}};var us=[{tag:"qti-position-object-interaction",ctor:_t},{tag:"qti-position-object-stage",ctor:ps}];var Op=[M,w`
|
|
10987
10987
|
:host {
|
|
10988
10988
|
display: block;
|
|
10989
10989
|
--qti-select-point-marker-size: 1.5rem;
|
|
@@ -11047,7 +11047,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11047
11047
|
-webkit-mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
11048
11048
|
mask: var(--qti-select-point-icon) no-repeat center / contain;
|
|
11049
11049
|
}
|
|
11050
|
-
`];var xr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleResponseChange=()=>{this._internals.setFormValue(er(this.response)||null),this.validate()},this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#r=1,this.#i=1,this.#n=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#c();let e=this.#e.getBoundingClientRect(),r=(t.clientX-e.left)*this.#r,i=(t.clientY-e.top)*this.#i,n=`${r.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[n]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],n]),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})},this.#a=()=>{this.#c()}}static{this.styles=
|
|
11050
|
+
`];var xr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},lt=class extends D{constructor(){super(...arguments),this.maxChoices=1/0,this.minChoices=0,this.response=null,this.areaMappings=null,this._areaEntries=[],this._handleResponseChange=()=>{this._internals.setFormValue(er(this.response)||null),this.validate()},this._handleAreaMappingsChange=()=>{this.#t()},this.#e=null,this.#r=1,this.#i=1,this.#n=0,this.#o=0,this.#s=t=>{if(this.disabled)return;if(!this.#e){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.#c();let e=this.#e.getBoundingClientRect(),r=(t.clientX-e.left)*this.#r,i=(t.clientY-e.top)*this.#i,n=`${r.toFixed()} ${i.toFixed()}`;this.maxChoices===1?this.response=[n]:(this.maxChoices===0||(this.response||[]).length<this.maxChoices)&&(this.response=[...this.response||[],n]),this.saveResponse(this.response),this.validate(),this.reportValidity({trigger:"change"})},this.#a=()=>{this.#c()}}static{this.styles=Op}#t(){try{let t=JSON.parse(this.areaMappings||"[]");if(!Array.isArray(t)){this._areaEntries=[];return}this._areaEntries=t.filter(e=>e&&(e.shape==="circle"||e.shape==="rect")&&typeof e.coords=="string").map(e=>({shape:e.shape,coords:String(e.coords),mappedValue:Number(e.mappedValue??1),defaultValue:Number(e.defaultValue??0)}))}catch{this._areaEntries=[]}}get _effectiveAreaEntries(){let t=this.responseVariable?.areaMapping?.areaMapEntries;return t?.length?t:this._areaEntries}#e;#r;#i;#n;#o;#s;connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.#a)}#a;get responsePoints(){let t=this.response;return(Array.isArray(t)?t:t?[t]:[]).filter(r=>r).map(r=>{let[i,n]=r.split(" ").map(Number);return{x:i,y:n}})}pointPart(t,e){return"point"}renderSupplementalLayer(){return P}positionOverlayElements(t){let e=this.#e;if(e){this.#c();for(let r of t){let i=r.dataset.coord,n=r.dataset.shape;!i||!n||Kt(n,i.split(",").map(s=>+s),e,r)}}}render(){let t=this.response,e=Array.isArray(t)?t:t?[t]:[];return v` <slot name="prompt"></slot>
|
|
11051
11051
|
<point-container>
|
|
11052
11052
|
${H(e.filter(r=>r),r=>r,(r,i)=>{let[n,s]=r.split(" ").map(Number),a=n/(this.#n||1)*100,c=s/(this.#o||1)*100;return v`
|
|
11053
11053
|
<button
|
|
@@ -11061,7 +11061,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11061
11061
|
${this.renderSupplementalLayer()}
|
|
11062
11062
|
<slot></slot>
|
|
11063
11063
|
</point-container>
|
|
11064
|
-
<div part="message" role="alert" id="validation-message" style="display:none;"></div>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,i=!0,n="",s="other";return e?(i=!1,s="max",n=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(i=!1,s="min",n=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(i,n,this.#e??this,{suppressInline:!0,kind:s}),i}reportValidity(t){return super.reportValidity(t)}#c(){this.#n=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#r=t.width===0?1:this.#n/t.width,this.#i=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#c(),this.requestUpdate(),this.#e.addEventListener("click",this.#s)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#a),this.#e&&this.#e.removeEventListener("click",this.#s)}};xr([p({type:Number,attribute:"max-choices"})],lt.prototype,"maxChoices",void 0);xr([p({type:Number,attribute:"min-choices"})],lt.prototype,"minChoices",void 0);xr([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Vi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>er(o)}})],lt.prototype,"response",void 0);xr([p({attribute:"area-mappings"})],lt.prototype,"areaMappings",void 0);xr([T()],lt.prototype,"_areaEntries",void 0);xr([N("response")],lt.prototype,"_handleResponseChange",void 0);xr([N("areaMappings")],lt.prototype,"_handleAreaMappingsChange",void 0);var
|
|
11064
|
+
<div part="message" role="alert" id="validation-message" style="display:none;"></div>`}validate(){let t=this.response?.length??0,e=this.maxChoices!==0&&Number.isFinite(this.maxChoices)&&t>this.maxChoices,r=t<this.minChoices,i=!0,n="",s="other";return e?(i=!1,s="max",n=this.dataset.maxSelectionsMessage||`Please select no more than ${this.maxChoices} ${this.maxChoices===1?"point":"points"}.`):r&&(i=!1,s="min",n=this.dataset.minSelectionsMessage||`Please select at least ${this.minChoices} ${this.minChoices===1?"point":"points"}.`),this.setInteractionValidity(i,n,this.#e??this,{suppressInline:!0,kind:s}),i}reportValidity(t){return super.reportValidity(t)}#c(){this.#n=this.#e.getAttribute("width")?parseFloat(this.#e.getAttribute("width")):this.#e.naturalWidth,this.#o=this.#e.getAttribute("height")?parseFloat(this.#e.getAttribute("height")):this.#e.naturalHeight;let t=this.#e.getBoundingClientRect();this.#r=t.width===0?1:this.#n/t.width,this.#i=t.height===0?1:this.#o/t.height}firstUpdated(){super.firstUpdated(),this.#e=this.querySelector("img"),this.#e?(this.#c(),this.requestUpdate(),this.#e.addEventListener("click",this.#s)):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.#a),this.#e&&this.#e.removeEventListener("click",this.#s)}};xr([p({type:Number,attribute:"max-choices"})],lt.prototype,"maxChoices",void 0);xr([p({type:Number,attribute:"min-choices"})],lt.prototype,"minChoices",void 0);xr([p({attribute:"response",reflect:!1,converter:{fromAttribute:o=>{let t=Vi(o);return t===null?null:Array.isArray(t)?t:[t]},toAttribute:o=>er(o)}})],lt.prototype,"response",void 0);xr([p({attribute:"area-mappings"})],lt.prototype,"areaMappings",void 0);xr([T()],lt.prototype,"_areaEntries",void 0);xr([N("response")],lt.prototype,"_handleResponseChange",void 0);xr([N("areaMappings")],lt.prototype,"_handleAreaMappingsChange",void 0);var ms=[{tag:"qti-select-point-interaction",ctor:lt}];var Dp=[M,w`
|
|
11065
11065
|
:host {
|
|
11066
11066
|
display: block;
|
|
11067
11067
|
--show-bounds: true;
|
|
@@ -11129,7 +11129,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11129
11129
|
text-align: center;
|
|
11130
11130
|
color: #6b7280; /* text-gray-500 */
|
|
11131
11131
|
}
|
|
11132
|
-
`];var
|
|
11132
|
+
`];var un=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Tt=class extends D{constructor(){super(...arguments),this.#t=null,this.min=0,this.max=100,this.step=1}static{this.styles=Dp}#t;validate(){return!0}connectedCallback(){super.connectedCallback(),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}willUpdate(t){super.willUpdate(t),this._internals.ariaValueMin=String(this.min),this._internals.ariaValueMax=String(this.max)}get response(){return this.#t===null?null:this.#t.toString()}set response(t){if(t==null||t===""){this.#e(null);return}let e=parseFloat(t);isNaN(e)||this.#e(e)}renderRailSupplement(){return P}#e(t){let e=this.#t;if(this.#t=t===null?null:Math.min(this.max,Math.max(this.min,t)),this.#t===e)return!1;if(this.#t===null)this.style.removeProperty("--value-percentage"),this._internals.setFormValue(null),this._internals.ariaValueNow=null;else{let r=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${r}%`),this._internals.setFormValue(this.value),this._internals.ariaValueNow=String(this.#t)}return this.requestUpdate(),!0}#r(t){this.#e(t)&&this.saveResponse(this.response)}render(){return v`
|
|
11133
11133
|
<slot name="prompt"></slot>
|
|
11134
11134
|
<div id="slider" part="slider">
|
|
11135
11135
|
<div id="bounds" part="bounds">
|
|
@@ -11147,7 +11147,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11147
11147
|
${this.renderRailSupplement()}
|
|
11148
11148
|
</div>
|
|
11149
11149
|
</div>
|
|
11150
|
-
`}#i(t){this.#o(t.pageX);let e=i=>this.#s(i.pageX),r=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",r)}#n(t){this.#o(t.touches[0].pageX);let e=i=>this.#s(i.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),r=t-e.left,i=Math.min(1,Math.max(0,r/e.width)),n=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#r(n)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};
|
|
11150
|
+
`}#i(t){this.#o(t.pageX);let e=i=>this.#s(i.pageX),r=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",r),this.#a()};document.addEventListener("mousemove",e),document.addEventListener("mouseup",r)}#n(t){this.#o(t.touches[0].pageX);let e=i=>this.#s(i.touches[0].pageX),r=()=>{document.removeEventListener("touchmove",e),document.removeEventListener("touchend",r),this.#a()};document.addEventListener("touchmove",e,{passive:!1}),document.addEventListener("touchend",r)}#o(t){this.#s(t)}#s(t){let e=this._rail.getBoundingClientRect(),r=t-e.left,i=Math.min(1,Math.max(0,r/e.width)),n=this.min+Math.round(i*(this.max-this.min)/this.step)*this.step;this.#r(n)}#a(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};un([_r("#rail")],Tt.prototype,"_rail",void 0);un([p({type:Number,attribute:"lower-bound"})],Tt.prototype,"min",void 0);un([p({type:Number,attribute:"upper-bound"})],Tt.prototype,"max",void 0);un([p({type:Number,attribute:"step"})],Tt.prototype,"step",void 0);un([p({attribute:"response",reflect:!1,noAccessor:!0})],Tt.prototype,"response",null);var fs=[{tag:"qti-slider-interaction",ctor:Tt}];var $p=()=>new Mc,Mc=class{},Ic=new WeakMap,yO=Ot(class extends Te{render(o){return P}update(o,[t]){let e=t!==this.G;return e&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=o.options?.host,this.rt(this.ct=o.element)),P}rt(o){if(this.G!==void 0)if(this.isConnected||(o=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=Ic.get(t);e===void 0&&(e=new WeakMap,Ic.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,o),o!==void 0&&this.G.call(this.ht,o)}else this.G.value=o}get lt(){return typeof this.G=="function"?Ic.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 Np=[M,w`
|
|
11151
11151
|
:host {
|
|
11152
11152
|
display: inline-flex;
|
|
11153
11153
|
align-items: center;
|
|
@@ -11236,7 +11236,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11236
11236
|
:host(.qti-input-width-72) {
|
|
11237
11237
|
--qti-input-width: 72;
|
|
11238
11238
|
}
|
|
11239
|
-
`];var wr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},dt=class extends D{constructor(){super(...arguments),this.inputRef
|
|
11239
|
+
`];var wr=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},dt=class extends D{constructor(){super(...arguments),this.inputRef=$p(),this.response=null,this._handleValueChange=()=>{this._internals.setFormValue(this.value),this.validate()}}static{this.styles=Np}get value(){return this.response||null}set value(t){this.response=t||null}get isInline(){return!0}validate(){if(!this._input)return!1;let t="",e=!1;this.patternMask&&this.dataPatternmaskMessage?(this._input.setCustomValidity(""),e=this._input.checkValidity(),e||(t=this.dataPatternmaskMessage,this._input.setCustomValidity(this.dataPatternmaskMessage))):e=this._input.checkValidity();let r="other";return e&&this.response===""&&(e=!1,r="min"),!e&&!t&&(t=this._input.validationMessage||"Invalid value."),this.setInteractionValidity(e,t,this._input,{suppressInline:!0,kind:r}),e}renderAnswer(){return v`<div part="answer-key answer" aria-hidden="true"></div>`}renderInput(){return v`<input
|
|
11240
11240
|
part="input"
|
|
11241
11241
|
name="${this.responseIdentifier}"
|
|
11242
11242
|
spellcheck="false"
|
|
@@ -11252,7 +11252,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11252
11252
|
maxlength=${1e3}
|
|
11253
11253
|
?disabled="${this.disabled}"
|
|
11254
11254
|
?readonly="${this.readonly}"
|
|
11255
|
-
/>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(t){return this.validate(),super.reportValidity(t)}reset(){this.response=""}};wr([p({type:Number,attribute:"expected-length"})],dt.prototype,"expectedLength",void 0);wr([p({type:String,attribute:"pattern-mask"})],dt.prototype,"patternMask",void 0);wr([p({type:String,attribute:"placeholder-text"})],dt.prototype,"placeholderText",void 0);wr([p({type:String,attribute:"data-patternmask-message"})],dt.prototype,"dataPatternmaskMessage",void 0);wr([p({type:String,attribute:"response",reflect:!1})],dt.prototype,"response",void 0);wr([_r("input")],dt.prototype,"_input",void 0);wr([N("response",{waitUntilFirstUpdate:!0})],dt.prototype,"_handleValueChange",void 0);var
|
|
11255
|
+
/>`}renderValidationMessage(){return v`<div id="validation-message" part="message" role="alert" style="display:none;"></div>`}render(){return v` ${this.renderAnswer()} ${this.renderInput()} ${this.renderValidationMessage()} `}textChanged(t){if(this.disabled||this.readonly)return;let e=t.target;this.response!==e.value&&(this.value=e.value,this.saveResponse(e.value))}reportValidity(t){return this.validate(),super.reportValidity(t)}reset(){this.response=""}};wr([p({type:Number,attribute:"expected-length"})],dt.prototype,"expectedLength",void 0);wr([p({type:String,attribute:"pattern-mask"})],dt.prototype,"patternMask",void 0);wr([p({type:String,attribute:"placeholder-text"})],dt.prototype,"placeholderText",void 0);wr([p({type:String,attribute:"data-patternmask-message"})],dt.prototype,"dataPatternmaskMessage",void 0);wr([p({type:String,attribute:"response",reflect:!1})],dt.prototype,"response",void 0);wr([_r("input")],dt.prototype,"_input",void 0);wr([N("response",{waitUntilFirstUpdate:!0})],dt.prototype,"_handleValueChange",void 0);var gs=[{tag:"qti-text-entry-interaction",ctor:dt}];var Lp=[M,w`
|
|
11256
11256
|
:host {
|
|
11257
11257
|
display: block;
|
|
11258
11258
|
margin: 1em 0;
|
|
@@ -11261,7 +11261,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11261
11261
|
display: block;
|
|
11262
11262
|
margin-top: 0.5em;
|
|
11263
11263
|
}
|
|
11264
|
-
`];var
|
|
11264
|
+
`];var bs=class extends D{static{this.styles=Lp}#t=null;#e=null;reset(){this.resetValidityReport(),this.#t=null,this.#e=null,this._internals.setFormValue(null),this.saveResponse(null)}validate(){return this.#e!==null}get response(){return this.#e}set response(t){if(typeof t=="string")this.#e=t,this._internals.setFormValue(t),this.saveResponse(t);else if(t===null)this.reset();else throw new Error("Value must be a Base64-encoded string or null")}static get properties(){return{...D.properties}}render(){return v`
|
|
11265
11265
|
<div>
|
|
11266
11266
|
<slot name="prompt"></slot>
|
|
11267
11267
|
<input
|
|
@@ -11272,7 +11272,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11272
11272
|
?readonly="${this.readonly}"
|
|
11273
11273
|
/>
|
|
11274
11274
|
</div>
|
|
11275
|
-
`}async#r(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#i(this.#t),this._internals.setFormValue(this.#e),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#i(t){return new Promise((e,r)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(t)})}};var ms=[{tag:"qti-upload-interaction",ctor:us}];var Dp=[...Fo,...zo,...Bo,...Uo,...Ho,...Wo,...Xo,...Go,...Jo,...Yo,...Ko,...Zo,...es,...is,...ns,...as,...ls,...ds,...hs,...ps,...ms,...Th];for(let{tag:o,ctor:t}of Dp)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Fo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of zo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Bo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Uo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ho)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Wo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Xo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Go)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Jo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Yo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ko)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Zo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of is)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ns)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of as)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ls)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ds)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of hs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ps)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ms)customElements.get(o)||customElements.define(o,t);var z$=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await qd().load(`${o}`).then(a=>a.assessmentTest()),r=await Fr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Fr().load(`${t}/${e.href}`).then(a=>a.items()),n=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:n,items:i,testIdentifier:e.identifier}},B$=async o=>Gt().load(o).then(t=>t.htmlDoc().firstElementChild);var fs=class extends wf(Qt){calculate(){return this.calculateChildren(Array.from(this.children))}};function wf(o){return class extends o{calculateChildren(e){return e.map(i=>{let n=i;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=n.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var $p=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ei=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}};$p([p({type:Number})],ei.prototype,"min",void 0);$p([p({type:Number})],ei.prototype,"max",void 0);var Cf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},hn=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Cf([p({type:String,attribute:"base-type"})],hn.prototype,"baseType",void 0);var gs=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var bs=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let i=this.#t(t.value),n=this.#t(e.value);return n.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(i,n,r):this.#r(i,n,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return Y.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let i=[...t];return e.every(n=>{let s=i.findIndex(a=>this.#e(a,n,r));return s===-1?!1:(i.splice(s,1),!0)})}#i(t,e,r){for(let i=0;i+e.length<=t.length;i++)if(e.every((n,s)=>this.#e(t[i+s],n,r)))return!0;return!1}};var vs=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==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var Tc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Cr=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 n=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!n)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(n=>n.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Tc([p({type:String})],Cr.prototype,"identifier",void 0);Tc([R({context:j,subscribe:!0}),T()],Cr.prototype,"context",void 0);Tc([T(),R({context:nt,subscribe:!0})],Cr.prototype,"_testContext",void 0);var ys=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(n=>!e.value.includes(n))}return null}};var qs=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var xs=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-gte requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-gte requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-gte requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-gte requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var ws=class extends E{getResult(){let t=this.#t();return t?t[0]<t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-lt requires exactly 2 duration expressions"),null;let e=t.map(r=>this.#e(r));return e.some(r=>r===null)?null:e}#e(t){if(t.cardinality!=="single"||Array.isArray(t.value))return console.error("qti-duration-lt requires single cardinality"),null;if(t.baseType!=="duration")return console.error("qti-duration-lt requires duration base-type"),null;if(t.value===null||t.value===void 0)return null;let e=Number.parseFloat(t.value.toString());return Number.isNaN(e)?(console.error(`qti-duration-lt requires duration values expressed in seconds, got "${t.value.toString()}"`),null):e}};var kf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},pn=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),n=parseFloat(r.value);if(!isNaN(i)&&!isNaN(n))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};kf([p({type:String,attribute:"rounding-mode"})],pn.prototype,"roundingMode",void 0);var Np=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ri=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?Y.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(c=>parseFloat(c));if(r.length===0||r.some(c=>Number.isNaN(c)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[i,n=i]=r,[s,a]=this.toleranceMode==="absolute"?[e-i,e+n]:[e*(1-i/100),e*(1+n/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};Np([p({type:String,attribute:"tolerance-mode"})],ri.prototype,"toleranceMode",void 0);Np([p({type:String})],ri.prototype,"tolerance",void 0);var G=class extends S{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var Cs=class extends G{process(){throw new Mr}};var ks=class extends G{process(){throw new Pr}};var Ss=class extends E{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],r=e?.cardinality==="record"||e?.baseType==="record";if(r&&(e.value===null||e.value===void 0))return null;if(!e||!r||!ce(e.value))return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i==null?null:(this.#t=e.fieldBaseTypes?.[t]??Gn(Array.isArray(i)?i[0]:i),i)}};var Es=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 n=parseInt(i,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let r=1;r<t.length&&(e=this.#e(e,Math.abs(t[r])),e!==1);r++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let r=e;e=t%e,t=r}return t}};var Rt=o=>o==null||o==="";var As=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Rt(e?.value)||Rt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var _s=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Rt(e?.value)||Rt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var Sf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},un=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)}};Sf([p({type:String})],un.prototype,"n",void 0);var Lp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ii=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(n=>n.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,n]=e;return(t.x-r)**2+(t.y-i)**2<=n**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,n,s]=e,a=Math.min(r,n),c=Math.max(r,n),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,n,s]=e;return n===0||s===0?!1:(t.x-r)**2/n**2+(t.y-i)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,n=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],c=e[n],l=e[n+1];a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a||Number.EPSILON)+s&&(r=!r),n=i}return r}};Lp([p({type:String})],ii.prototype,"shape",void 0);Lp([p({type:String})],ii.prototype,"coords",void 0);var Ts=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let 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 Rs=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let 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 Is=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var Ms=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var Ps=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 n=Number.parseInt(i,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n)}}return e}#e(t,e){let r=Math.abs(t),i=Math.abs(e);for(;i!==0;){let n=r%i;r=i,i=n}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var Vp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ni=class extends G{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(n=>n.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let r=parseFloat(this.childExpression.calculate()),i;return e.matchTable?.size?i=e.matchTable.get(r):e.interpolationTable&&(i=this.#t(r,e.interpolationTable)),i==null?(console.warn(`lookupOutcomeValue: no table entry matches ${r} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Mt(i)}})),i)}#t(t,e){if(!Number.isNaN(t))return e.find(r=>r.includeBoundary?t>=r.sourceValue:t>r.sourceValue)?.targetValue}};Vp([p({type:String})],ni.prototype,"identifier",void 0);Vp([R({context:j,subscribe:!0}),T()],ni.prototype,"context",void 0);var Os=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Rt(e?.value)||Rt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var Ds=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Rt(e?.value)||Rt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var Ef=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},mn=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]).filter(s=>typeof s=="string"&&s.length>0);if(r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,n=new Set;for(let s of r)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;if(Y.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){i+=a.mappedValue??0,n.add(a.coords);break}}return n.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Ef([p({type:String})],mn.prototype,"identifier",void 0);var Af=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fn=class extends E{getResult(){let t=this.context.variables.find(n=>n.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let n of r){let s=e.mapEntries.filter(c=>t.baseType==="string"&&!c.caseSensitive?Y.compareSingleValues(c.mapKey.toLowerCase(),n.toLowerCase(),t.baseType):Y.compareSingleValues(c.mapKey,n,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}};Af([p({type:String})],fn.prototype,"identifier",void 0);var $s=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):Y.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!Y.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let n=null,s=[...t.value];for(let a of s)if(Y.compareSingleValues(i,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var _f=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};_f([p({type:String})],gn.prototype,"name",void 0);var Tf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let i=parseFloat(r.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],i=e[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(e.length!==2)return null;let r=e[0],i=e[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};Tf([p({type:String})],bn.prototype,"name",void 0);var Ns=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=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Ls=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 Vs=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=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var js=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var Fs=class extends E{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var zs=class extends E{getResult(){return null}};var Bs=class extends Qt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),n=!1;if(typeof i=="string")if(i==="true")n=!0;else if(i==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(n=i);return n}).some(e=>typeof e=="boolean"&&e)}};var Us=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 Hs=class extends S{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},oi=class extends Hs{shouldProcess(){return!0}getSubRules(){return[...this.children]}},si=class extends Hs{shouldProcess(){let e=this.firstElementChild.calculate();return e===!0||e==="true"}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},ai=class extends G{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var Ws=class extends ai{};var ci=class extends si{};var Qs=class extends ci{};var Xs=class extends oi{};var Rf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vn=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=this.#t();return r?r.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};Rf([p({type:String})],vn.prototype,"pattern",void 0);var Gs=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),n=parseFloat(r.value);if(isNaN(i)||isNaN(n))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&n<=0||i<0&&!Number.isInteger(n))return null;let s;try{s=Math.pow(i,n)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),c=Math.max(0,14-a),l=Math.pow(10,c);s=Math.round(s*l)/l}return s}};var If=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function Mf(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function yn(o,t){return Mf(t===void 0?o.toExponential():o.toExponential(t))}function jp(o){let[t,e]=o.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,i=e===void 0?"":`e${e}`;return`${r}${i}`}function Fp(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?jp(yn(o,e-1)):jp(o.toFixed(Math.max(0,e-1-r)))}function Pf(o,t,e,r){if(o==="s"||o==="c"){let l=o==="c"?r.slice(0,1):r;return e===void 0?l:l.slice(0,e)}let i=Number(r);if(r.trim()===""||!Number.isFinite(i))return r;let n=Math.abs(i),s,a=i<0;switch(o){case"d":case"i":s=String(Math.trunc(n));break;case"u":s=String(Math.trunc(n)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(n).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(n).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(n).toString(16).toUpperCase()}`;break;case"f":case"F":s=n.toFixed(e??6);break;case"e":s=yn(n,e??6);break;case"E":s=yn(n,e??6).toUpperCase();break;case"g":s=Fp(n,e??6);break;case"G":s=Fp(n,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function Of(o,t,e){if(o.length>=e)return o;let r=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(r)}`;if(t.includes("0")){let[,i,n]=/^([-+ ]?)(.*)$/.exec(o);return`${i}${"0".repeat(r)}${n}`}return`${" ".repeat(r)}${o}`}function zp(o,t){return o.replace(If,(e,r,i,n,s,a)=>r?"%":Of(Pf(a,i??"",s===void 0?void 0:Number(s),t),i??"",n===void 0?0:Number(n)))}var ve=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vt=class extends S{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:v`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let r=e[this.index-1];return r==null?null:this.#e(r,t.baseType)}return e.map(r=>this.#e(r,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let r=e;if(this.field!==void 0){let n=r[this.field];return n==null?null:this.#e(n,t.baseType)}let i=Object.entries(r).filter(([,n])=>n!=null);return i.length===0?null:i.map(([n,s])=>`${n}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let r=Array.isArray(t)?t.join(" "):String(t);if(this.format)return zp(this.format,r);if(e==="integer"&&this.base!==10){let i=Number.parseInt(r,10);if(Number.isFinite(i))return i.toString(this.base)}if(this.powerForm){let i=Number(r);if(r.trim()!==""&&Number.isFinite(i))return yn(i)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};ve([p({type:String})],vt.prototype,"identifier",void 0);ve([p({type:String})],vt.prototype,"format",void 0);ve([p({type:Number})],vt.prototype,"base",void 0);ve([p({type:Number})],vt.prototype,"index",void 0);ve([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);ve([p({type:String})],vt.prototype,"field",void 0);ve([p({type:String})],vt.prototype,"delimiter",void 0);ve([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);ve([R({context:j,subscribe:!0}),T()],vt.prototype,"context",void 0);var Js=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 Rc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},kr=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)]}};Rc([p({type:Number})],kr.prototype,"min",void 0);Rc([p({type:Number})],kr.prototype,"max",void 0);Rc([p({type:Number})],kr.prototype,"step",void 0);var Ys=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 Df=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Ic=1e3,qn=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 n=e.calculate(),s=this.#r(n);s&&r.push(s)}return r}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,n=parseInt(i?.toString()??"",10);return Number.isNaN(n)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(n)}#e(t){return t>Ic?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${Ic} limit, truncating`),Ic):t}#r(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};Df([p({type:String,attribute:"number-repeats"})],qn.prototype,"numberRepeats",void 0);var Ks=class extends ai{};var li=class extends si{};var Zs=class extends li{};var ta=class extends oi{};var ea=class extends G{process(){for(let t of[...this.children])t.process()}};var Bp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},di=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),i=Math.pow(10,e-r-1);return Math.round(t*i)/i}};Bp([p({type:String,attribute:"rounding-mode"})],di.prototype,"roundingMode",void 0);Bp([p({type:Number})],di.prototype,"figures",void 0);var ra=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var ia=class extends G{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 Mc(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Mc=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 na=class extends G{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 Pc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(Mt):t!==null?Mt(t):null}},Pc=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 oa=class extends G{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 Oc(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Oc=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 $f=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},xn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#i(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#r(t,t.length);case"popsd":return Math.sqrt(this.#r(t,t.length));case"samplevariance":return t.length<2?null:this.#r(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#r(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,r)=>e+r,0)/t.length}#e(t){let e=[...t].sort((i,n)=>i-n),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}#r(t,e){let r=this.#t(t);return t.reduce((i,n)=>i+Math.pow(n-r,2),0)/e}#i(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};$f([p({type:String})],xn.prototype,"name",void 0);var Nf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},wn=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(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return Y.compareSingleValues(i,n,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Nf([p({type:String,attribute:"case-sensitive"})],wn.prototype,"caseSensitive",void 0);var Lf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Cn=class extends 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(),n=r.value.toString();return this.caseSensitive!=="true"?n.toLowerCase().includes(i.toLowerCase()):n.includes(i)}};Lf([p({type:String,attribute:"case-sensitive"})],Cn.prototype,"caseSensitive",void 0);var sa=class extends Vf(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function Vf(o){return class extends o{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=i.calculate();return Number.isNaN(n)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(n)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var aa=class extends E{getResult(){return new Dc(Array.from(this.children)).calculate()}},Dc=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 ca=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var la=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var Up=[{tag:"qti-and",ctor:fs},{tag:"qti-any-n",ctor:ei},{tag:"qti-base-value",ctor:hn},{tag:"qti-container-size",ctor:gs},{tag:"qti-contains",ctor:bs},{tag:"qti-correct",ctor:vs},{tag:"qti-default",ctor:Cr},{tag:"qti-delete",ctor:ys},{tag:"qti-divide",ctor:qs},{tag:"qti-duration-gte",ctor:xs},{tag:"qti-duration-lt",ctor:ws},{tag:"qti-equal",ctor:ri},{tag:"qti-equal-rounded",ctor:pn},{tag:"qti-exit-response",ctor:Cs},{tag:"qti-exit-test",ctor:ks},{tag:"qti-field-value",ctor:Ss},{tag:"qti-gcd",ctor:Es},{tag:"qti-gt",ctor:As},{tag:"qti-gte",ctor:_s},{tag:"qti-index",ctor:un},{tag:"qti-inside",ctor:ii},{tag:"qti-integer-divide",ctor:Ts},{tag:"qti-integer-modulus",ctor:Rs},{tag:"qti-integer-to-float",ctor:Is},{tag:"qti-is-null",ctor:Ms},{tag:"qti-lcm",ctor:Ps},{tag:"qti-lookup-outcome-value",ctor:ni},{tag:"qti-lt",ctor:Os},{tag:"qti-lte",ctor:Ds},{tag:"qti-map-response",ctor:fn},{tag:"qti-map-response-point",ctor:mn},{tag:"qti-match",ctor:$s},{tag:"qti-math-constant",ctor:gn},{tag:"qti-math-operator",ctor:bn},{tag:"qti-max",ctor:Ns},{tag:"qti-member",ctor:Ls},{tag:"qti-min",ctor:Vs},{tag:"qti-multiple",ctor:js},{tag:"qti-not",ctor:Fs},{tag:"qti-null",ctor:zs},{tag:"qti-or",ctor:Bs},{tag:"qti-ordered",ctor:Us},{tag:"qti-outcome-condition",ctor:Ws},{tag:"qti-outcome-else",ctor:Xs},{tag:"qti-outcome-else-if",ctor:Qs},{tag:"qti-outcome-if",ctor:ci},{tag:"qti-pattern-match",ctor:vn},{tag:"qti-power",ctor:Gs},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:Js},{tag:"qti-random",ctor:Ys},{tag:"qti-random-integer",ctor:kr},{tag:"qti-repeat",ctor:qn},{tag:"qti-response-condition",ctor:Ks},{tag:"qti-response-else",ctor:ta},{tag:"qti-response-else-if",ctor:Zs},{tag:"qti-response-if",ctor:li},{tag:"qti-response-processing-fragment",ctor:ea},{tag:"qti-round",ctor:ra},{tag:"qti-round-to",ctor:di},{tag:"qti-rule",ctor:G},{tag:"qti-set-correct-response",ctor:ia},{tag:"qti-set-outcome-value",ctor:na},{tag:"qti-set-template-value",ctor:oa},{tag:"qti-stats-operator",ctor:xn},{tag:"qti-string-match",ctor:wn},{tag:"qti-substring",ctor:Cn},{tag:"qti-subtract",ctor:sa},{tag:"qti-sum",ctor:aa},{tag:"qti-truncate",ctor:ca},{tag:"qti-variable",ctor:la}];for(let{tag:o,ctor:t}of Up)customElements.get(o)||customElements.define(o,t);var ye=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Z;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(Z||(Z={}));var $c=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,i)=>{this.toggleCandidateCorrection(i)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""),z(this._internals.states,"answer-key",!0,[]))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let i=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",i)}get correctness(){let r=this.correctResponse;if(!r)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let n=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let c=a.filter(d=>n.includes(d)).length,l=a.filter(d=>!n.includes(d)).length;return c===n.length&&l===0&&a.length===n.length?Z.Correct:c>0&&(c<n.length||l>0)?Z.PartiallyCorrect:Z.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let i=this.nextSibling,n=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==Z.Correct))){if(!n)return;this.parentElement?.removeChild(i);return}if(n)return;let 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){z(this._internals.states,"answer-key-shown",!!(r&&this.correctResponse),["show-correct-response"])}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return ye([p({attribute:"correct-response",reflect:!0,converter:Xt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),ye([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),ye([N("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),ye([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),ye([N("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),ye([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),ye([N("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),ye([T()],t.prototype,"_isFullCorrectResponse",void 0),ye([T()],t.prototype,"_correctResponse",void 0),t};var st=w`
|
|
11275
|
+
`}async#r(t){let e=t.target;e.files&&e.files.length>0&&(this.#t=e.files[0],this.#e=await this.#i(this.#t),this._internals.setFormValue(this.#e),this.saveResponse(this.#e),this.dispatchEvent(new CustomEvent("qti-interaction-response",{detail:{response:this.#e}})))}#i(t){return new Promise((e,r)=>{let i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>r(i.error),i.readAsDataURL(t)})}};var vs=[{tag:"qti-upload-interaction",ctor:bs}];var Vp=[...Uo,...Ho,...Wo,...Qo,...Xo,...Go,...Yo,...Ko,...Zo,...ts,...es,...rs,...ns,...ss,...as,...hs,...us,...ms,...fs,...gs,...vs,...Ph];for(let{tag:o,ctor:t}of Vp)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Uo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ho)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Wo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Qo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Xo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Go)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Yo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Ko)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of Zo)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ts)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of es)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of rs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ns)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ss)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of as)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of hs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of us)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of ms)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of fs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of gs)customElements.get(o)||customElements.define(o,t);for(let{tag:o,ctor:t}of vs)customElements.get(o)||customElements.define(o,t);var G$=async o=>{let t=o.substring(0,o.lastIndexOf("/")),e=await kd().load(`${o}`).then(a=>a.assessmentTest()),r=await Fr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await Fr().load(`${t}/${e.href}`).then(a=>a.items()),n=`${t}/${e.href}`,s=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:s,testURL:n,items:i,testIdentifier:e.identifier}},J$=async o=>Gt().load(o).then(t=>t.htmlDoc().firstElementChild);var ys=class extends Ef(Qt){calculate(){return this.calculateChildren(Array.from(this.children))}};function Ef(o){return class extends o{calculateChildren(e){return e.map(i=>{let n=i;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=n.calculate(),a=!1;if(typeof s=="string")if(s==="true")a=!0;else if(s==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof s=="boolean"&&(a=s);return a}).every(i=>typeof i=="boolean"&&i)}}}var jp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ei=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}};jp([p({type:Number})],ei.prototype,"min",void 0);jp([p({type:Number})],ei.prototype,"max",void 0);var Af=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},mn=class extends E{constructor(){super(...arguments),this.baseType="string"}getResult(){return this.textContent.trim()}};Af([p({type:String,attribute:"base-type"})],mn.prototype,"baseType",void 0);var qs=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children?.length!==1)return console.error("qti-container-size must have exactly one child expression"),0;let t=this.getVariables();if(!t||t?.length===0)return 0;let e=t[0];return e.value===null||e.value===void 0?0:e.cardinality!=="multiple"&&e.cardinality!=="ordered"?(console.error("qti-container-size requires multiple or ordered cardinality"),0):Array.isArray(e.value)?e.value.length:(console.error("qti-container-size: expected array value for multiple/ordered cardinality"),0)}};var xs=class extends E{getResult(){if(this.children.length!==2)return console.error("qti-contains takes two sub-expressions"),null;let[t,e]=this.getVariables();if(!t||!e||t.value===null||t.value===void 0||e.value===null||e.value===void 0)return null;t.baseType!==e.baseType&&console.warn("qti-contains: both sub-expressions should have the same base-type");let r=t.baseType??e.baseType;if(t.cardinality==="single"&&e.cardinality!=="single")return console.warn("qti-contains: first sub-expression is single; treating it as a membership test"),this.#t(e.value).some(s=>this.#e(s,t.value,r));let i=this.#t(t.value),n=this.#t(e.value);return n.length===0?!0:t.cardinality==="ordered"&&e.cardinality==="ordered"?this.#i(i,n,r):this.#r(i,n,r)}#t(t){return Array.isArray(t)?[...t]:[t]}#e(t,e,r){return Y.compareSingleValues(t,e,r)||t===e}#r(t,e,r){let i=[...t];return e.every(n=>{let s=i.findIndex(a=>this.#e(a,n,r));return s===-1?!1:(i.splice(s,1),!0)})}#i(t,e,r){for(let i=0;i+e.length<=t.length;i++)if(e.every((n,s)=>this.#e(t[i+s],n,r)))return!0;return!1}};var ws=class extends E{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality==="record"?e.correctResponse??null:e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};var Pc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Cr=class extends E{constructor(){super(...arguments),this.identifier=""}getResult(){if(!this.identifier)return console.error("qti-default requires an identifier attribute"),null;let t=this.identifier.split("."),e=null,r;if(t.length===2)e=t[0],r=t[1];else if(t.length===1)r=t[0];else return console.error("qti-default: invalid identifier format"),null;if(e){let n=this._testContext.items.find(a=>a.identifier===e);if(!this._testContext||!n)return console.warn(`qti-default: item "${e}" not found in test context`),null;let s=this._testContext.items.find(a=>a.identifier===e)?.variables.find(a=>a.identifier===r);return s?s.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item "${e}"`),null)}if(!this.context?.variables)return console.warn("qti-default: no variables found in item context"),null;let i=this.context.variables.find(n=>n.identifier===r);return i?i.defaultValue||null:(console.warn(`qti-default: variable "${r}" not found in item context`),null)}};Pc([p({type:String})],Cr.prototype,"identifier",void 0);Pc([R({context:j,subscribe:!0}),T()],Cr.prototype,"context",void 0);Pc([T(),R({context:nt,subscribe:!0})],Cr.prototype,"_testContext",void 0);var Cs=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(n=>!e.value.includes(n))}return null}};var ks=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.warn("qti-divide: expected exactly 2 numeric values"),null):t[1]===0?(console.warn("qti-divide: division by zero"),null):t[0]/t[1]}#t(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-divide: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Ss=class extends E{getResult(){let t=this.#t();return t?t[0]>=t[1]:null}#t(){let t=this.getVariables();if(t.length!==2)return console.error("qti-duration-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 Es=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 _f=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fn=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),n=parseFloat(r.value);if(!isNaN(i)&&!isNaN(n))return this.roundingMode==="significantFigures"?i.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(i*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${i}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};_f([p({type:String,attribute:"rounding-mode"})],fn.prototype,"roundingMode",void 0);var Fp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ri=class extends E{constructor(){super(...arguments),this.toleranceMode="exact",this.tolerance=""}get includeLowerBound(){return this.getAttribute("include-lower-bound")!=="false"}get includeUpperBound(){return this.getAttribute("include-upper-bound")!=="false"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return!e||!r?null:e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):e.value===null||r.value===null||e.value===void 0||r.value===void 0?null:this.toleranceMode==="exact"?Y.compareSingleValues(e.value,r.value,e.baseType):this.#t(parseFloat(e.value),parseFloat(r.value))}return console.error("unexpected number of children in qti-equal"),null}#t(t,e){if(Number.isNaN(t)||Number.isNaN(e))return console.error("qti-equal with a tolerance needs numeric values"),null;let r=this.tolerance.split(/\s+/).filter(Boolean).map(c=>parseFloat(c));if(r.length===0||r.some(c=>Number.isNaN(c)))return console.error(`qti-equal with tolerance-mode="${this.toleranceMode}" needs a numeric tolerance`),null;let[i,n=i]=r,[s,a]=this.toleranceMode==="absolute"?[e-i,e+n]:[e*(1-i/100),e*(1+n/100)];return(this.includeLowerBound?t>=s:t>s)&&(this.includeUpperBound?t<=a:t<a)}};Fp([p({type:String,attribute:"tolerance-mode"})],ri.prototype,"toleranceMode",void 0);Fp([p({type:String})],ri.prototype,"tolerance",void 0);var G=class extends S{render(){return v`<slot></slot>`}process(){throw new Error("Not implemented")}};var As=class extends G{process(){throw new Mr}};var _s=class extends G{process(){throw new Pr}};var Ts=class extends E{#t;get resultBaseType(){return this.#t}getResult(){this.#t=void 0;let t=this.getAttribute("field-identifier");if(!t)return console.error("qti-field-value requires a field-identifier attribute"),null;if(this.children.length!==1)return console.error("qti-field-value must have exactly one child expression"),null;let e=this.getVariables()[0],r=e?.cardinality==="record"||e?.baseType==="record";if(r&&(e.value===null||e.value===void 0))return null;if(!e||!r||!ce(e.value))return console.warn("qti-field-value child expression must return a record"),null;let i=e.value[t];return i==null?null:(this.#t=e.fieldBaseTypes?.[t]??Kn(Array.isArray(i)?i[0]:i),i)}};var Rs=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 n=parseInt(i,10);if(isNaN(n))return console.error("qti-gcd non-numerical value"),null;e.push(n)}}else return console.error("qti-gcd unsupported cardinality"),null}return e.length===0?null:this.#t(e)}#t(t){if(t.length===0)return 0;if(t.length===1)return Math.abs(t[0]);let e=Math.abs(t[0]);for(let r=1;r<t.length&&(e=this.#e(e,Math.abs(t[r])),e!==1);r++);return e}#e(t,e){if(t===0&&e===0)return 0;if(t===0)return e;if(e===0)return t;for(;e!==0;){let r=e;e=t%e,t=r}return t}};var Rt=o=>o==null||o==="";var Is=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Rt(e?.value)||Rt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};var Ms=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Rt(e?.value)||Rt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.error("unexpected number of children in qti gte"),null}};var Tf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},gn=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)}};Tf([p({type:String})],gn.prototype,"n",void 0);var zp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ii=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(n=>n.trim()).filter(Boolean);if(e.length!==2)return console.error('qti-inside requires a point value formatted as "x y" or "x,y"'),null;let r=Number.parseFloat(e[0]),i=Number.parseFloat(e[1]);return Number.isNaN(r)||Number.isNaN(i)?(console.error("qti-inside requires numeric point coordinates"),null):{x:r,y:i}}#e(t){let e=t.split(",").map(r=>r.trim()).filter(Boolean).map(r=>Number.parseFloat(r));return e.some(r=>Number.isNaN(r))?(console.error("qti-inside requires numeric coords"),[]):e}#r(t,e){if(e.length!==3)return console.error("qti-inside circle requires x,y,r"),null;let[r,i,n]=e;return(t.x-r)**2+(t.y-i)**2<=n**2}#i(t,e){if(e.length!==4)return console.error("qti-inside rect requires left,top,right,bottom"),null;let[r,i,n,s]=e,a=Math.min(r,n),c=Math.max(r,n),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,n,s]=e;return n===0||s===0?!1:(t.x-r)**2/n**2+(t.y-i)**2/s**2<=1}#o(t,e){if(e.length<6||e.length%2!==0)return console.error("qti-inside polygon requires at least 3 coordinate pairs"),null;let r=!1;for(let i=0,n=e.length-2;i<e.length;i+=2){let s=e[i],a=e[i+1],c=e[n],l=e[n+1];a>t.y!=l>t.y&&t.x<(c-s)*(t.y-a)/(l-a||Number.EPSILON)+s&&(r=!r),n=i}return r}};zp([p({type:String})],ii.prototype,"shape",void 0);zp([p({type:String})],ii.prototype,"coords",void 0);var Ps=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-divide requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-divide: division by zero"),null):Math.floor(t[0]/t[1])}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-divide requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-divide requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let 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{get resultBaseType(){return"integer"}getResult(){let t=this.#t(this.getVariables());return t.length!==2?(console.error("qti-integer-modulus requires exactly 2 integer values"),null):t[1]===0?(console.error("qti-integer-modulus: division by zero"),null):t[0]-Math.floor(t[0]/t[1])*t[1]}#t(t){let e=[];for(let r of t){if(r.baseType!=="integer")return console.error("qti-integer-modulus requires integer base-type"),[];if(r.cardinality!=="single"||Array.isArray(r.value))return console.error("qti-integer-modulus requires single cardinality"),[];if(r.value===null||r.value===void 0)return[];let i=Number.parseInt(r.value,10);if(Number.isNaN(i))return console.error("qti-integer-modulus requires integer values"),[];e.push(i)}return e}};var Ds=class extends E{get resultBaseType(){return"float"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-integer-to-float requires exactly one child expression"),null;let e=t[0];if(e.baseType!=="integer")return console.error("qti-integer-to-float requires integer base-type"),null;if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-integer-to-float requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseInt(e.value,10);return Number.isNaN(r)?(console.error("qti-integer-to-float requires an integer value"),null):r}};var $s=class extends E{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t?.length)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};var Ns=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 n=Number.parseInt(i,10);if(Number.isNaN(n))return console.error("qti-lcm requires integer values"),[];e.push(n)}}return e}#e(t,e){let r=Math.abs(t),i=Math.abs(e);for(;i!==0;){let n=r%i;r=i,i=n}return r}#r(t,e){return t===0||e===0?0:Math.abs(t*e/this.#e(t,e))}};var Bp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ni=class extends G{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.context?.variables.find(n=>n.identifier===t)||null;if(!e)return console.warn(`lookupOutcomeValue: no outcome declaration for "${t}"`),null;let r=parseFloat(this.childExpression.calculate()),i;return e.matchTable?.size?i=e.matchTable.get(r):e.interpolationTable&&(i=this.#t(r,e.interpolationTable)),i==null?(console.warn(`lookupOutcomeValue: no table entry matches ${r} for "${t}"`),null):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Mt(i)}})),i)}#t(t,e){if(!Number.isNaN(t))return e.find(r=>r.includeBoundary?t>=r.sourceValue:t>r.sourceValue)?.targetValue}};Bp([p({type:String})],ni.prototype,"identifier",void 0);Bp([R({context:j,subscribe:!0}),T()],ni.prototype,"context",void 0);var Ls=class extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(Rt(e?.value)||Rt(r?.value))return null;if((e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};var Vs=class extends Qt{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return Rt(e?.value)||Rt(r?.value)?null:(e.baseType==="integer"||e.baseType==="float")&&(r.baseType==="integer"||r.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.error("unexpected number of children in qti lte"),null}};var Rf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},bn=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]).filter(s=>typeof s=="string"&&s.length>0);if(r.length===0)return console.warn(`No candidate responses for response ${this.identifier}`),null;let i=0,n=new Set;for(let s of r)for(let a of e.areaMapEntries){if(n.has(a.coords))continue;if(Y.isPointInArea(s,`${a.shape},${a.coords}`,t.baseType)){i+=a.mappedValue??0,n.add(a.coords);break}}return n.size<r.length&&(i+=e.defaultValue),e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};Rf([p({type:String})],bn.prototype,"identifier",void 0);var If=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vn=class extends E{getResult(){let t=this.context.variables.find(n=>n.identifier===this.identifier);if(!t||!t.mapping)return console.error(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],i=0;for(let n of r){let s=e.mapEntries.filter(c=>t.baseType==="string"&&!c.caseSensitive?Y.compareSingleValues(c.mapKey.toLowerCase(),n.toLowerCase(),t.baseType):Y.compareSingleValues(c.mapKey,n,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}};If([p({type:String})],vn.prototype,"identifier",void 0);var js=class o extends E{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return o.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){if(t.value===null)return!1;switch(e.cardinality){case"single":return Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):Y.compareSingleValues(t.value?.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let r=0;r<t.value.length;r++)if(!Y.compareSingleValues(e.value[r],t.value[r],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let r=0;for(let i of e.value){let n=null,s=[...t.value];for(let a of s)if(Y.compareSingleValues(i,a,e.baseType)){n=a;break}if(n!==null)s.splice(s.indexOf(n),1);else return!1;r++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};var Mf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},yn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){switch(this.name.toLowerCase()){case"pi":return Math.PI;case"e":return Math.E;default:return console.error(`qti-math-constant: unknown constant "${this.name}"`),null}}};Mf([p({type:String})],yn.prototype,"name",void 0);var Pf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},qn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return["floor","ceil","signum"].includes(this.name?.toLowerCase())?"integer":"float"}getResult(){if(!this.name)return console.error("qti-math-operator requires a name attribute"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=[];for(let r of t){if(r.cardinality!=="single")return console.error("qti-math-operator requires single cardinality"),null;if(Array.isArray(r.value))return console.error("qti-math-operator unexpected array value for single cardinality"),null;if(r.value===null||r.value===void 0)return null;if(r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-math-operator requires numerical base-type"),null;let i=parseFloat(r.value);if(isNaN(i))return console.error("qti-math-operator non-numerical value"),null;e.push(i)}return this.#e(this.name,e)}#t(t){return Number.isFinite(t)?t:null}#e(t,e){try{switch(t.toLowerCase()){case"sin":return e.length!==1?null:Math.sin(e[0]);case"cos":return e.length!==1?null:Math.cos(e[0]);case"tan":return e.length!==1?null:Math.tan(e[0]);case"asin":return e.length!==1||e[0]<-1||e[0]>1?null:Math.asin(e[0]);case"acos":return e.length!==1||e[0]<-1||e[0]>1?null:Math.acos(e[0]);case"atan":return e.length!==1?null:Math.atan(e[0]);case"sinh":return e.length!==1?null:Math.sinh(e[0]);case"cosh":return e.length!==1?null:Math.cosh(e[0]);case"tanh":return e.length!==1?null:Math.tanh(e[0]);case"secant":case"sec":return e.length!==1?null:this.#t(1/Math.cos(e[0]));case"cosecant":case"csc":return e.length!==1?null:this.#t(1/Math.sin(e[0]));case"cotangent":case"cot":return e.length!==1?null:this.#t(Math.cos(e[0])/Math.sin(e[0]));case"todegrees":return e.length!==1?null:e[0]*180/Math.PI;case"toradians":return e.length!==1?null:e[0]*Math.PI/180;case"log":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"ln":return e.length!==1||e[0]<=0?null:Math.log(e[0]);case"log10":return e.length!==1||e[0]<=0?null:Math.log10(e[0]);case"exp":return e.length!==1?null:Math.exp(e[0]);case"abs":return e.length!==1?null:Math.abs(e[0]);case"sqrt":return e.length!==1||e[0]<0?null:Math.sqrt(e[0]);case"signum":return e.length!==1?null:Math.sign(e[0]);case"floor":return e.length!==1?null:Math.floor(e[0]);case"ceil":return e.length!==1?null:Math.ceil(e[0]);case"round":return e.length!==1?null:Math.round(e[0]);case"atan2":return e.length!==2?null:Math.atan2(e[0],e[1]);case"pow":{if(e.length!==2)return null;let r=e[0],i=e[1];return r===0&&i<=0||r<0&&!Number.isInteger(i)?null:Math.pow(r,i)}case"log_base":{if(e.length!==2)return null;let r=e[0],i=e[1];return r<=0||i<=0||i===1?null:Math.log(r)/Math.log(i)}case"mod":return e.length!==2||e[1]===0?null:e[0]%e[1];case"max":return e.length<1?null:Math.max(...e);case"min":return e.length<1?null:Math.min(...e);default:return console.error(`qti-math-operator: unknown operation "${t}"`),null}}catch(r){return console.error(`qti-math-operator: error performing operation "${t}":`,r),null}}};Pf([p({type:String})],qn.prototype,"name",void 0);var Fs=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=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-max: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var zs=class extends E{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType===r.baseType||e.baseType==="integer"&&r.baseType==="float"||e.baseType==="float"&&r.baseType==="integer"||console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let i=e.value;return r.value.includes(i)}};var Bs=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=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-min: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};var Us=class extends E{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};var Hs=class extends E{render(){return v`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};var Ws=class extends E{getResult(){return null}};var Qs=class extends Qt{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),n=!1;if(typeof i=="string")if(i==="true")n=!0;else if(i==="false")n=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(n=i);return n}).some(e=>typeof e=="boolean"&&e)}};var Xs=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 Gs=class extends S{render(){return v`<slot></slot>`}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}},oi=class extends Gs{shouldProcess(){return!0}getSubRules(){return[...this.children]}},si=class extends Gs{shouldProcess(){let e=this.firstElementChild.calculate();return e===!0||e==="true"}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}},ai=class extends G{render(){return v`<slot></slot>`}process(){let t=[...this.children];for(let e of t)if(e.shouldProcess()){e.process();return}}};var Js=class extends ai{};var ci=class extends si{};var Ys=class extends ci{};var Ks=class extends oi{};var Of=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},xn=class extends E{constructor(){super(...arguments),this.pattern=""}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-pattern-match requires exactly one child expression"),null;if(!this.pattern)return console.error("qti-pattern-match requires a pattern attribute"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-pattern-match requires single cardinality"),null;if(e.value===null||e.value===void 0)return null;let r=this.#t();return r?r.test(e.value.toString()):null}#t(){let t=`^(?:${this.pattern})$`;try{return new RegExp(t,"u")}catch{try{return new RegExp(t)}catch(e){return console.error("qti-pattern-match requires a valid regular expression",e),null}}}};Of([p({type:String})],xn.prototype,"pattern",void 0);var Zs=class extends E{get resultBaseType(){return"float"}getResult(){if(this.children.length!==2)return console.error("qti-power must have exactly two child expressions"),null;let t=this.getVariables();if(!t||t.length!==2)return null;let[e,r]=t;if(e.cardinality!=="single"||r.cardinality!=="single")return console.error("qti-power requires single cardinality for both expressions"),null;if(Array.isArray(e.value)||Array.isArray(r.value))return console.error("qti-power unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0||r.value===null||r.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float"||r.baseType!=="integer"&&r.baseType!=="float")return console.error("qti-power requires numerical base-types"),null;let i=parseFloat(e.value),n=parseFloat(r.value);if(isNaN(i)||isNaN(n))return console.error("qti-power: non-numerical values encountered"),null;if(i===0&&n<=0||i<0&&!Number.isInteger(n))return null;let s;try{s=Math.pow(i,n)}catch(a){return console.error("qti-power: error calculating power:",a),null}if(isNaN(s))return null;if(s===1/0||s===-1/0)return s;if(!isFinite(s)||Math.abs(s)>Number.MAX_VALUE||s!==0&&Math.abs(s)<Number.MIN_VALUE)return null;if(isFinite(s)&&s!==0){let a=Math.floor(Math.log10(Math.abs(s))),c=Math.max(0,14-a),l=Math.pow(10,c);s=Math.round(s*l)/l}return s}};var Df=/%(?:(%)|([-+ 0#]*)(\d+)?(?:\.(\d+))?([diuoxXfFeEgGsc]))/g;function $f(o){return o.replace(/e([+-])(\d)$/,"e$10$2")}function wn(o,t){return $f(t===void 0?o.toExponential():o.toExponential(t))}function Up(o){let[t,e]=o.split(/e/i),r=t.includes(".")?t.replace(/\.?0+$/,""):t,i=e===void 0?"":`e${e}`;return`${r}${i}`}function Hp(o,t){let e=t===0?1:t,r=o===0?0:Math.floor(Math.log10(o));return r<-4||r>=e?Up(wn(o,e-1)):Up(o.toFixed(Math.max(0,e-1-r)))}function Nf(o,t,e,r){if(o==="s"||o==="c"){let l=o==="c"?r.slice(0,1):r;return e===void 0?l:l.slice(0,e)}let i=Number(r);if(r.trim()===""||!Number.isFinite(i))return r;let n=Math.abs(i),s,a=i<0;switch(o){case"d":case"i":s=String(Math.trunc(n));break;case"u":s=String(Math.trunc(n)),a=!1;break;case"o":s=`${t.includes("#")?"0":""}${Math.trunc(n).toString(8)}`;break;case"x":s=`${t.includes("#")?"0x":""}${Math.trunc(n).toString(16)}`;break;case"X":s=`${t.includes("#")?"0X":""}${Math.trunc(n).toString(16).toUpperCase()}`;break;case"f":case"F":s=n.toFixed(e??6);break;case"e":s=wn(n,e??6);break;case"E":s=wn(n,e??6).toUpperCase();break;case"g":s=Hp(n,e??6);break;case"G":s=Hp(n,e??6).toUpperCase();break;default:return r}return`${a?"-":t.includes("+")?"+":t.includes(" ")?" ":""}${s}`}function Lf(o,t,e){if(o.length>=e)return o;let r=e-o.length;if(t.includes("-"))return`${o}${" ".repeat(r)}`;if(t.includes("0")){let[,i,n]=/^([-+ ]?)(.*)$/.exec(o);return`${i}${"0".repeat(r)}${n}`}return`${" ".repeat(r)}${o}`}function Wp(o,t){return o.replace(Df,(e,r,i,n,s,a)=>r?"%":Lf(Nf(a,i??"",s===void 0?void 0:Number(s),t),i??"",n===void 0?0:Number(n)))}var ve=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},vt=class extends S{constructor(){super(...arguments),this.base=10,this.powerForm=!1,this.delimiter=";",this.mappingIndicator="="}render(){let t=this.context?.variables.find(r=>r.identifier===this.identifier),e=t?this.#t(t):null;return e===null?P:v`${e}`}#t(t){let e=t.value;if(e==null)return null;if(Array.isArray(e)){if(e.length===0)return null;if(this.index!==void 0){let r=e[this.index-1];return r==null?null:this.#e(r,t.baseType)}return e.map(r=>this.#e(r,t.baseType)).join(this.delimiter)}if(typeof e=="object"){let r=e;if(this.field!==void 0){let n=r[this.field];return n==null?null:this.#e(n,t.baseType)}let i=Object.entries(r).filter(([,n])=>n!=null);return i.length===0?null:i.map(([n,s])=>`${n}${this.mappingIndicator}${this.#e(s,t.baseType)}`).join(this.delimiter)}return this.#e(e,t.baseType)}#e(t,e){let r=Array.isArray(t)?t.join(" "):String(t);if(this.format)return Wp(this.format,r);if(e==="integer"&&this.base!==10){let i=Number.parseInt(r,10);if(Number.isFinite(i))return i.toString(this.base)}if(this.powerForm){let i=Number(r);if(r.trim()!==""&&Number.isFinite(i))return wn(i)}return r}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};ve([p({type:String})],vt.prototype,"identifier",void 0);ve([p({type:String})],vt.prototype,"format",void 0);ve([p({type:Number})],vt.prototype,"base",void 0);ve([p({type:Number})],vt.prototype,"index",void 0);ve([p({type:Boolean,attribute:"power-form"})],vt.prototype,"powerForm",void 0);ve([p({type:String})],vt.prototype,"field",void 0);ve([p({type:String})],vt.prototype,"delimiter",void 0);ve([p({type:String,attribute:"mapping-indicator"})],vt.prototype,"mappingIndicator",void 0);ve([R({context:j,subscribe:!0}),T()],vt.prototype,"context",void 0);var ta=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 Oc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},kr=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)]}};Oc([p({type:Number})],kr.prototype,"min",void 0);Oc([p({type:Number})],kr.prototype,"max",void 0);Oc([p({type:Number})],kr.prototype,"step",void 0);var ea=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 Vf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Dc=1e3,Cn=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 n=e.calculate(),s=this.#r(n);s&&r.push(s)}return r}#t(){if(!this.numberRepeats)return console.warn("qti-repeat: missing number-repeats attribute"),0;let t=parseInt(this.numberRepeats,10);if(!Number.isNaN(t))return this.#e(t);let e=this.numberRepeats,r=this.context?.variables?.find(s=>s.identifier===e);if(!r)return console.warn(`qti-repeat: unknown identifier "${e}"`),0;let i=Array.isArray(r.value)?r.value[0]:r.value,n=parseInt(i?.toString()??"",10);return Number.isNaN(n)?(console.warn(`qti-repeat: invalid repeat count from "${e}"`),0):this.#e(n)}#e(t){return t>Dc?(console.warn(`qti-repeat: number-repeats ${t} exceeds the ${Dc} limit, truncating`),Dc):t}#r(t){if(t==null)return null;if(typeof t=="number")return{identifier:"",cardinality:"single",baseType:Number.isInteger(t)?"integer":"float",value:t.toString(),type:"response"};if(typeof t=="string"){let e=parseFloat(t);if(!Number.isNaN(e))return{identifier:"",cardinality:"single",baseType:Number.isInteger(e)?"integer":"float",value:t.toString(),type:"response"}}if(t&&typeof t=="object"&&"value"in t){let e=t.value;return{identifier:"",cardinality:"single",baseType:t.baseType??"string",value:e!=null?e.toString():null,type:"response"}}return{identifier:"",cardinality:"single",baseType:"string",value:t.toString(),type:"response"}}};Vf([p({type:String,attribute:"number-repeats"})],Cn.prototype,"numberRepeats",void 0);var ra=class extends ai{};var li=class extends si{};var ia=class extends li{};var na=class extends oi{};var oa=class extends G{process(){for(let t of[...this.children])t.process()}};var Qp=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},di=class extends E{constructor(){super(...arguments),this.roundingMode="significantFigures",this.figures=3}get resultBaseType(){return"float"}getResult(){if(this.children.length!==1)return console.error("qti-round-to must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round-to requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round-to unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round-to requires numerical base-type"),null;let r=parseFloat(e.value);return isNaN(r)?null:isFinite(r)?this.figures<0?(console.error("qti-round-to: figures must be non-negative"),null):this.roundingMode==="significantFigures"&&this.figures<1?(console.error("qti-round-to: figures must be at least 1 for significantFigures mode"),null):this.roundingMode==="decimalPlaces"?this.#t(r,this.figures):this.#e(r,this.figures):r===1/0?1/0:r===-1/0?-1/0:null}#t(t,e){if(t===0)return 0;let r=Math.pow(10,e);return Math.round(t*r)/r}#e(t,e){if(t===0)return 0;let r=Math.floor(Math.log10(Math.abs(t))),i=Math.pow(10,e-r-1);return Math.round(t*i)/i}};Qp([p({type:String,attribute:"rounding-mode"})],di.prototype,"roundingMode",void 0);Qp([p({type:Number})],di.prototype,"figures",void 0);var sa=class extends E{get resultBaseType(){return"integer"}getResult(){if(this.children.length!==1)return console.error("qti-round must have exactly one child expression"),null;let t=this.getVariables();if(!t||t.length===0)return null;let e=t[0];if(e.cardinality!=="single")return console.error("qti-round requires single cardinality"),null;if(Array.isArray(e.value))return console.error("qti-round unexpected array value for single cardinality"),null;if(e.value===null||e.value===void 0)return null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-round requires numerical base-type (integer or float)"),null;let r=parseFloat(e.value);return isNaN(r)?(console.warn("qti-round: NaN input results in NULL"),null):isFinite(r)?Math.floor(r+.5):r===1/0?1/0:r===-1/0?-1/0:null}};var aa=class extends G{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 $c(e).process();this.dispatchEvent(new CustomEvent("qti-set-correct-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},$c=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 ca=class extends G{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 Nc(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:this.#t(i)}}))}#t(t){return Array.isArray(t)?t.map(Mt):t!==null?Mt(t):null}},Nc=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 la=class extends G{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 Lc(e).process();this.dispatchEvent(new CustomEvent("qti-set-template-value",{bubbles:!0,composed:!0,detail:{templateIdentifier:t,value:this.#t(i)}}))}#t(t){return t==null?null:Array.isArray(t)?t.map(e=>Mt(this.#e(e))):Mt(this.#e(t))}#e(t){if(t&&typeof t=="object"&&"value"in t){let e=t.value;return e!=null?e.toString():""}return t?.toString()??""}},Lc=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 jf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},kn=class extends E{constructor(){super(...arguments),this.name=""}get resultBaseType(){return"float"}getResult(){if(!this.name)return console.warn("qti-stats-operator: missing name attribute"),null;let t=this.#i(this.getVariables());if(t.length===0)return console.warn("qti-stats-operator: no numeric values provided"),null;switch(this.name.toLowerCase()){case"mean":return this.#t(t);case"median":return this.#e(t);case"popvariance":return this.#r(t,t.length);case"popsd":return Math.sqrt(this.#r(t,t.length));case"samplevariance":return t.length<2?null:this.#r(t,t.length-1);case"samplesd":return t.length<2?null:Math.sqrt(this.#r(t,t.length-1));default:return console.warn(`qti-stats-operator: unsupported operator "${this.name}"`),null}}#t(t){return t.reduce((e,r)=>e+r,0)/t.length}#e(t){let e=[...t].sort((i,n)=>i-n),r=Math.floor(e.length/2);return e.length%2===0?(e[r-1]+e[r])/2:e[r]}#r(t,e){let r=this.#t(t);return t.reduce((i,n)=>i+Math.pow(n-r,2),0)/e}#i(t){let e=[];for(let r of t){if(!r)continue;let i=n=>{if(n==null)return;let s=parseFloat(n.toString());if(Number.isNaN(s)){console.warn("qti-stats-operator: non-numeric value encountered");return}e.push(s)};if(Array.isArray(r.value)){r.value.forEach(n=>i(n));continue}i(r.value)}return e}};jf([p({type:String})],kn.prototype,"name",void 0);var Ff=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Sn=class extends E{constructor(){super(...arguments),this.caseSensitive="true"}getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(e.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let i=this.caseSensitive==="true"?e.value:e.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return Y.compareSingleValues(i,n,e.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};Ff([p({type:String,attribute:"case-sensitive"})],Sn.prototype,"caseSensitive",void 0);var zf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},En=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(),n=r.value.toString();return this.caseSensitive!=="true"?n.toLowerCase().includes(i.toLowerCase()):n.includes(i)}};zf([p({type:String,attribute:"case-sensitive"})],En.prototype,"caseSensitive",void 0);var da=class extends Bf(E){getResult(){return this.calculateChildren(Array.from(this.children))}};function Bf(o){return class extends o{calculateChildren(e){let r=e.map(i=>{if(!i.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=i.calculate();return Number.isNaN(n)?(console.error("Unexpected value in qti-subtract, expected number"),null):Number(n)});return r.some(i=>i===null)?(console.error("One or more child expressions returned invalid values"),0):r[0]-r[1]}}}var ha=class extends E{getResult(){return new Vc(Array.from(this.children)).calculate()}},Vc=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 pa=class extends E{get resultBaseType(){return"integer"}getResult(){let t=this.getVariables();if(t.length!==1)return console.error("qti-truncate requires exactly one child expression"),null;let e=t[0];if(e.cardinality!=="single"||Array.isArray(e.value))return console.error("qti-truncate requires single cardinality"),null;if(e.baseType!=="integer"&&e.baseType!=="float")return console.error("qti-truncate requires numerical base-type"),null;if(e.value===null||e.value===void 0)return null;let r=Number.parseFloat(e.value);return Number.isNaN(r)?(console.error("qti-truncate requires a numerical value"),null):Math.trunc(r)}};var ua=class extends E{getResult(){let t=this.getAttribute("identifier")||"";return this.resolveVariable(t)?.value??null}};var Xp=[{tag:"qti-and",ctor:ys},{tag:"qti-any-n",ctor:ei},{tag:"qti-base-value",ctor:mn},{tag:"qti-container-size",ctor:qs},{tag:"qti-contains",ctor:xs},{tag:"qti-correct",ctor:ws},{tag:"qti-default",ctor:Cr},{tag:"qti-delete",ctor:Cs},{tag:"qti-divide",ctor:ks},{tag:"qti-duration-gte",ctor:Ss},{tag:"qti-duration-lt",ctor:Es},{tag:"qti-equal",ctor:ri},{tag:"qti-equal-rounded",ctor:fn},{tag:"qti-exit-response",ctor:As},{tag:"qti-exit-test",ctor:_s},{tag:"qti-field-value",ctor:Ts},{tag:"qti-gcd",ctor:Rs},{tag:"qti-gt",ctor:Is},{tag:"qti-gte",ctor:Ms},{tag:"qti-index",ctor:gn},{tag:"qti-inside",ctor:ii},{tag:"qti-integer-divide",ctor:Ps},{tag:"qti-integer-modulus",ctor:Os},{tag:"qti-integer-to-float",ctor:Ds},{tag:"qti-is-null",ctor:$s},{tag:"qti-lcm",ctor:Ns},{tag:"qti-lookup-outcome-value",ctor:ni},{tag:"qti-lt",ctor:Ls},{tag:"qti-lte",ctor:Vs},{tag:"qti-map-response",ctor:vn},{tag:"qti-map-response-point",ctor:bn},{tag:"qti-match",ctor:js},{tag:"qti-math-constant",ctor:yn},{tag:"qti-math-operator",ctor:qn},{tag:"qti-max",ctor:Fs},{tag:"qti-member",ctor:zs},{tag:"qti-min",ctor:Bs},{tag:"qti-multiple",ctor:Us},{tag:"qti-not",ctor:Hs},{tag:"qti-null",ctor:Ws},{tag:"qti-or",ctor:Qs},{tag:"qti-ordered",ctor:Xs},{tag:"qti-outcome-condition",ctor:Js},{tag:"qti-outcome-else",ctor:Ks},{tag:"qti-outcome-else-if",ctor:Ys},{tag:"qti-outcome-if",ctor:ci},{tag:"qti-pattern-match",ctor:xn},{tag:"qti-power",ctor:Zs},{tag:"qti-printed-variable",ctor:vt},{tag:"qti-product",ctor:ta},{tag:"qti-random",ctor:ea},{tag:"qti-random-integer",ctor:kr},{tag:"qti-repeat",ctor:Cn},{tag:"qti-response-condition",ctor:ra},{tag:"qti-response-else",ctor:na},{tag:"qti-response-else-if",ctor:ia},{tag:"qti-response-if",ctor:li},{tag:"qti-response-processing-fragment",ctor:oa},{tag:"qti-round",ctor:sa},{tag:"qti-round-to",ctor:di},{tag:"qti-rule",ctor:G},{tag:"qti-set-correct-response",ctor:aa},{tag:"qti-set-outcome-value",ctor:ca},{tag:"qti-set-template-value",ctor:la},{tag:"qti-stats-operator",ctor:kn},{tag:"qti-string-match",ctor:Sn},{tag:"qti-substring",ctor:En},{tag:"qti-subtract",ctor:da},{tag:"qti-sum",ctor:ha},{tag:"qti-truncate",ctor:pa},{tag:"qti-variable",ctor:ua}];for(let{tag:o,ctor:t}of Xp)customElements.get(o)||customElements.define(o,t);var ye=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},Z;(function(o){o.Correct="correct",o.PartiallyCorrect="partially-correct",o.Incorrect="incorrect"})(Z||(Z={}));var jc=o=>{class t extends o{constructor(){super(...arguments),this.showCorrectResponse=!1,this._handleShowCorrectResponseChange=(r,i)=>{this.toggleInternalCorrectResponse(i)},this.showFullCorrectResponse=!1,this._handleShowFullCorrectResponseChange=(r,i)=>{this.toggleFullCorrectResponse(i)},this.showCandidateCorrection=!1,this._handleShowCandidateCorrectionChange=(r,i)=>{this.toggleCandidateCorrection(i)},this._correctResponse=null}set correctResponseAttr(r){this._correctResponse=r}get correctResponseAttr(){return this._correctResponse}get isFullCorrectResponse(){return this._isFullCorrectResponse}get registersWithItem(){return!this.isFullCorrectResponse&&super.registersWithItem}set isFullCorrectResponse(r){this._isFullCorrectResponse=r,r&&(this.setAttribute("inert",""),this.setAttribute("response-identifier",this.responseIdentifier+"_cr"),this.setAttribute("answer-key",""),z(this._internals.states,"answer-key",!0,[]))}get correctResponse(){let r=this.responseVariable;return r?.correctResponse?r.correctResponse:this._correctResponse}set correctResponse(r){let i=this._correctResponse;this._correctResponse=r,r==null?this.removeAttribute("correct-response"):this.setAttribute("correct-response",Array.isArray(r)?r.join(","):r),this.requestUpdate("_correctResponse",i)}get correctness(){let r=this.correctResponse;if(!r)return null;let i=this.response;if(i==null||i===""||Array.isArray(i)&&i.length===0)return null;let n=Array.isArray(r)?r:[r],a=(Array.isArray(i)?i:[i]).filter(d=>d!=="");if(a.length===0)return null;let c=a.filter(d=>n.includes(d)).length,l=a.filter(d=>!n.includes(d)).length;return c===n.length&&l===0&&a.length===n.length?Z.Correct:c>0&&(c<n.length||l>0)?Z.PartiallyCorrect:Z.Incorrect}get correctionPart(){return"correction"}toggleCorrectResponse(r){(this.configContext?.correctResponseMode||"internal")==="full"?this.toggleFullCorrectResponse(r):this.toggleInternalCorrectResponse(r)}get withholdsFullCorrectResponseWhenCorrect(){return this.configContext?.fullCorrectResponseOnlyWhenIncorrect!==!1}async toggleFullCorrectResponse(r){let i=this.nextSibling,n=i instanceof HTMLDivElement&&i?.classList.contains("full-correct-response"),s=this.correctResponse;if(!s)return;if(!(r&&(!this.withholdsFullCorrectResponseWhenCorrect||this.correctness!==Z.Correct))){if(!n)return;this.parentElement?.removeChild(i);return}if(n)return;let 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){z(this._internals.states,"answer-key-shown",!!(r&&this.correctResponse),["show-correct-response"])}toggleCandidateCorrection(r){}firstUpdated(){super.firstUpdated(),!this.isFullCorrectResponse&&(this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0))}}return ye([p({attribute:"correct-response",reflect:!0,converter:Xt({emptyAs:null})})],t.prototype,"correctResponseAttr",null),ye([p({type:Boolean,attribute:"show-correct-response",reflect:!0})],t.prototype,"showCorrectResponse",void 0),ye([N("showCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCorrectResponseChange",void 0),ye([p({type:Boolean,attribute:"show-full-correct-response",reflect:!0})],t.prototype,"showFullCorrectResponse",void 0),ye([N("showFullCorrectResponse",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowFullCorrectResponseChange",void 0),ye([p({type:Boolean,attribute:"show-candidate-correction",reflect:!0})],t.prototype,"showCandidateCorrection",void 0),ye([N("showCandidateCorrection",{waitUntilFirstUpdate:!0})],t.prototype,"_handleShowCandidateCorrectionChange",void 0),ye([T()],t.prototype,"_isFullCorrectResponse",void 0),ye([T()],t.prototype,"_correctResponse",void 0),t};var st=w`
|
|
11276
11276
|
/* Nothing at all until the item judges this element. */
|
|
11277
11277
|
[part~='correction'] {
|
|
11278
11278
|
display: none;
|
|
@@ -11305,21 +11305,21 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11305
11305
|
|
|
11306
11306
|
pointer-events: none;
|
|
11307
11307
|
}
|
|
11308
|
-
`;var
|
|
11308
|
+
`;var Gp=o=>o==="partially-correct"?"candidate-partial":`candidate-${o}`,Uf=["candidate-correct","candidate-incorrect","candidate-partial"],Fc=o=>o?`correction ${Gp(o)} correction-${o}`:"correction",zc=(o,t)=>{for(let e of Uf)z(o,e,!1);t&&z(o,Gp(t),!0)},It=o=>{class t extends o{#t=null;get candidateCorrection(){return this.#t}set candidateCorrection(r){if(this.#t===r)return;let i=this.#t;this.#t=r,zc(this.internals.states,r),this.requestUpdate("candidateCorrection",i)}get correctionPart(){return Fc(this.#t)}}return t};var Hf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},K=o=>{class t extends jc(o){constructor(){super(...arguments),this._candidateCorrection=null}get correctionPart(){return Fc(this._candidateCorrection)}toggleCandidateCorrection(r){this.showCandidateCorrection!==r&&(this.showCandidateCorrection=r),super.toggleCandidateCorrection(r);let i=this._internals,n=null;r&&(this.correctness===Z.Correct&&(n="correct"),this.correctness===Z.PartiallyCorrect&&(n="partially-correct"),this.correctness===Z.Incorrect&&(n="incorrect")),zc(i.states,n),this._candidateCorrection!==n&&(this._candidateCorrection=n)}connectedCallback(){super.connectedCallback?.(),queueMicrotask(()=>{!this.isConnected||this.isFullCorrectResponse||this.showCandidateCorrection&&this.toggleCandidateCorrection(!0)})}}return Hf([T()],t.prototype,"_candidateCorrection",void 0),t};var Sr=o=>{class t extends K(o){toggleInternalCorrectResponse(r){super.toggleInternalCorrectResponse(r);let i=this.correctResponse,n=i?Array.isArray(i)?i:[i]:[];for(let s of this._choiceElements){let a=r&&n.includes(s.identifier);z(s.internals.states,"answer-key",a,["correct-response"])}}toggleCandidateCorrection(r){super.toggleCandidateCorrection(r);for(let s of this._choiceElements)s.candidateCorrection=null;if(!r||!this.correctResponse)return;let i=Array.isArray(this.correctResponse)?this.correctResponse:[this.correctResponse],n=Array.isArray(this.response)?this.response:this.response?[this.response]:[];for(let s of this._choiceElements)n.includes(s.identifier)&&(s.candidateCorrection=i.includes(s.identifier)?"correct":"incorrect")}}return t};var Bc=class extends It($e){static{this.styles=[$e.styles,st]}render(){return v`<div part="control"></div>
|
|
11309
11309
|
<slot part="label"></slot>
|
|
11310
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
11310
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Wf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},ma=class extends It(hr){constructor(){super(...arguments),this.orderCorrect=null}updated(t){super.updated(t),t.has("orderCorrect")&&(this.orderCorrect==null?this.removeAttribute("data-order-correct"):this.setAttribute("data-order-correct",String(this.orderCorrect)))}};Wf([p({attribute:"aria-ordercorrectvalue",type:Number,reflect:!0})],ma.prototype,"orderCorrect",void 0);var Uc=class extends It(pr){static{this.styles=[pr.styles,st]}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
11311
11311
|
<slot part="label"></slot>
|
|
11312
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
11312
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Hc=class extends It(Nt){static{this.styles=[Nt.styles,st]}render(){return v`
|
|
11313
11313
|
<div part="control"></div>
|
|
11314
11314
|
<slot part="label"></slot>
|
|
11315
11315
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
11316
11316
|
<div part="drop">
|
|
11317
11317
|
${H(this.drags,t=>t.getAttribute("identifier"),t=>t)}
|
|
11318
11318
|
</div>
|
|
11319
|
-
`}};var
|
|
11319
|
+
`}};var Wc=class extends It(Lt){static{this.styles=[Lt.styles,st]}render(){return v`<div part="control"><div part="control-mark"></div></div>
|
|
11320
11320
|
${this.marker?v`<div id="label" part="marker">${this.marker}</div>`:P}
|
|
11321
11321
|
<slot part="label"></slot>
|
|
11322
|
-
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var
|
|
11322
|
+
<span part=${this.correctionPart} aria-hidden="true"></span>`}};var Jp=class extends ut{showCorrectResponse(t){for(let e of this.interactionElements)e.toggleCorrectResponse?.(t);this.updateControlState("item-show-correct-response",t)}showCandidateCorrection(t){for(let e of this.interactionElements)e.toggleCandidateCorrection?.(t);this.updateControlState("item-show-candidate-correction",t)}afterResponseVariableUpdated(){this.showCandidateCorrection(!1)}updateControlState(t,e){let r=this.getRootNode();for(;;){if(r.querySelectorAll(t).forEach(i=>i.shown=e),!(r instanceof ShadowRoot))return;r=r.host.getRootNode()}}};var Yp=class extends fe{#t=t=>{let e=t.detail;this.assessmentItem?.showCorrectResponse?.(e),this.updateControlState("item-show-correct-response",e)};#e=t=>{let e=t.detail;this.assessmentItem?.showCandidateCorrection?.(e),this.updateControlState("item-show-candidate-correction",e)};#r=t=>{this.assessmentItem?.showCorrectResponse?.(!1),this.configContext={...this.configContext,correctResponseMode:t.detail}};updateAssessmentItemView(t,e){t?.showCorrectResponse?.(e==="scorer"),this.updateControlState("item-show-correct-response",e==="scorer")}constructor(){super(),this.addEventListener("item-show-correct-response",this.#t),this.addEventListener("item-show-candidate-correction",this.#e),this.addEventListener("item-switch-correct-response-mode",this.#r)}updateControlState(t,e){this.querySelectorAll(t).forEach(r=>r.shown=e)}disconnectedCallback(){this.removeEventListener("item-show-correct-response",this.#t),this.removeEventListener("item-show-candidate-correction",this.#e),this.removeEventListener("item-switch-correct-response-mode",this.#r),super.disconnectedCallback()}};var Kp=class extends mt{#t=t=>{this.activeAssessmentItem?.showCorrectResponse?.(t.detail)};#e=t=>{this.activeAssessmentItem?.showCandidateCorrection?.(t.detail)};constructor(){super(),this.addEventListener("test-show-correct-response",this.#t),this.addEventListener("test-show-candidate-correction",this.#e)}disconnectedCallback(){this.removeEventListener("test-show-correct-response",this.#t),this.removeEventListener("test-show-candidate-correction",this.#e),super.disconnectedCallback()}afterAttemptEnded(t,e,r){if(!t||!e?.showSolution)return;let i=t;i.showCandidateCorrection?.(!0),i.showCorrectResponse?.(r)}},Zp=class extends Ie{updateAssessmentItemView(t,e){t.showCorrectResponse?.(e==="scorer")}};var Qc=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},An=class extends S{constructor(){super(...arguments),this.label="Correct response mode",this._options={internal:"Internal",full:"Full (copy)"}}#t(t){this.dispatchEvent(new CustomEvent("item-switch-correct-response-mode",{detail:t,bubbles:!0}))}render(){return v`
|
|
11323
11323
|
<label part="label" for="modeSelect">${this.label}</label>
|
|
11324
11324
|
<select
|
|
11325
11325
|
part="select"
|
|
@@ -11330,12 +11330,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11330
11330
|
${this._options[t]}
|
|
11331
11331
|
</option>`)}
|
|
11332
11332
|
</select>
|
|
11333
|
-
`}};
|
|
11333
|
+
`}};Qc([R({context:yt,subscribe:!0})],An.prototype,"itemContext",void 0);Qc([p({type:String})],An.prototype,"label",void 0);Qc([T()],An.prototype,"_options",void 0);var hi=w`
|
|
11334
11334
|
display: inline-flex;
|
|
11335
11335
|
cursor: pointer;
|
|
11336
11336
|
border-radius: 0.25rem;
|
|
11337
11337
|
user-select: none;
|
|
11338
|
-
`,
|
|
11338
|
+
`,tu=w`
|
|
11339
11339
|
display: flex;
|
|
11340
11340
|
flex: 1 1 auto;
|
|
11341
11341
|
align-items: center;
|
|
@@ -11345,12 +11345,12 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11345
11345
|
user-select: none;
|
|
11346
11346
|
`,pi=w`
|
|
11347
11347
|
background-color: lightgray;
|
|
11348
|
-
${
|
|
11348
|
+
${tu};
|
|
11349
11349
|
`,ui=w`
|
|
11350
11350
|
cursor: not-allowed;
|
|
11351
11351
|
opacity: 0.8;
|
|
11352
|
-
`,
|
|
11353
|
-
${
|
|
11352
|
+
`,wz=w`
|
|
11353
|
+
${tu};
|
|
11354
11354
|
border: 1px solid gray;
|
|
11355
11355
|
`;var mi=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},We=class extends S{static{this.styles=w`
|
|
11356
11356
|
:host {
|
|
@@ -11386,7 +11386,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11386
11386
|
:host([disabled]) {
|
|
11387
11387
|
${ui};
|
|
11388
11388
|
}
|
|
11389
|
-
`}#t;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=this.attachInternals(),this.#t.role="button",this.addEventListener("click",()=>this.#r()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#r())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=0)}#e;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(i=>i.items)).find(r=>r.active);if(this.#e!==e?.identifier&&(this.shown=!1,this.#e=e?.identifier),e){let r=!!e?.variables?.some(n=>n.correctResponse),i=!!e?.variables?.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!i}else this.disabled=!0;this.#t.ariaDisabled=String(this.disabled),this.#t.ariaPressed=String(this.shown)}#r(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v`<div part="button">${this.#i()}</div>`}};gi([R({context:ct,subscribe:!0})],Xe.prototype,"computedContext",void 0);gi([p({type:Boolean,reflect:!0})],Xe.prototype,"shown",void 0);gi([p({type:Boolean,reflect:!0})],Xe.prototype,"disabled",void 0);gi([p({type:String})],Xe.prototype,"showCorrectText",void 0);gi([p({type:String})],Xe.prototype,"hideCorrectText",void 0);gi([p({type:String})],Xe.prototype,"noCorrectResponseText",void 0);var ee=o=>{class t extends K(o){toggleInternalCorrectResponse(r){this.showFullCorrectResponse||this.toggleFullCorrectResponse(r)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var
|
|
11389
|
+
`}#t;constructor(){super(),this.shown=!1,this.disabled=!1,this.showCorrectText="Show correct response",this.hideCorrectText="Hide correct response",this.noCorrectResponseText="No correct response specified",this.#t=this.attachInternals(),this.#t.role="button",this.addEventListener("click",()=>this.#r()),this.addEventListener("keydown",t=>{t.key!=="Enter"&&t.key!==" "||(t.preventDefault(),this.#r())})}connectedCallback(){super.connectedCallback(),this.hasAttribute("tabindex")||(this.tabIndex=0)}#e;willUpdate(t){let e=this.computedContext?.testParts.flatMap(r=>r.sections.flatMap(i=>i.items)).find(r=>r.active);if(this.#e!==e?.identifier&&(this.shown=!1,this.#e=e?.identifier),e){let r=!!e?.variables?.some(n=>n.correctResponse),i=!!e?.variables?.some(n=>n.mapping?.mapEntries?.length>0||n.areaMapping?.areaMapEntries?.length>0);this.disabled=!r&&!i}else this.disabled=!0;this.#t.ariaDisabled=String(this.disabled),this.#t.ariaPressed=String(this.shown)}#r(){this.disabled||(this.shown=!this.shown,this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:this.shown,bubbles:!0})))}#i(){return this.disabled?this.noCorrectResponseText:this.shown?this.hideCorrectText:this.showCorrectText}render(){return v`<div part="button">${this.#i()}</div>`}};gi([R({context:ct,subscribe:!0})],Xe.prototype,"computedContext",void 0);gi([p({type:Boolean,reflect:!0})],Xe.prototype,"shown",void 0);gi([p({type:Boolean,reflect:!0})],Xe.prototype,"disabled",void 0);gi([p({type:String})],Xe.prototype,"showCorrectText",void 0);gi([p({type:String})],Xe.prototype,"hideCorrectText",void 0);gi([p({type:String})],Xe.prototype,"noCorrectResponseText",void 0);var ee=o=>{class t extends K(o){toggleInternalCorrectResponse(r){this.showFullCorrectResponse||this.toggleFullCorrectResponse(r)}afterCache(){super.afterCache(),this.showCorrectResponse&&this.toggleInternalCorrectResponse(!0),this.showCandidateCorrection&&this.toggleCandidateCorrection(!0),this.showFullCorrectResponse&&this.toggleFullCorrectResponse(!0)}}return t};var Gc=class extends ee(gr){};var Jc=class extends Sr(br){};var Qf=function(o,t,e,r){var i=arguments.length,n=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,t,e,r);else for(var a=o.length-1;a>=0;a--)(s=o[a])&&(n=(i<3?s(n):i>3?s(t,e,n):s(t,e))||n);return i>3&&n&&Object.defineProperty(t,e,n),n},fa=class extends It(Q){static{this.styles=[Q.styles,st,w`
|
|
11390
11390
|
/*
|
|
11391
11391
|
* Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split
|
|
11392
11392
|
* is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow
|
|
@@ -11450,7 +11450,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11450
11450
|
}
|
|
11451
11451
|
`]}render(){return v`${this.renderPrompt()}${this.renderTextarea()}
|
|
11452
11452
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
11453
|
-
${this.renderValidationMessage()}`}};
|
|
11453
|
+
${this.renderValidationMessage()}`}};Qf([p({attribute:"candidate-correction",reflect:!0,noAccessor:!0})],fa.prototype,"candidateCorrection",void 0);var ga=o=>o?(Array.isArray(o)?o:[o]).map(e=>{let[r,i]=e.split(" ");return{source:r,target:i}}):[];var Yc=class extends ee(Yr){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=ga(this.correctResponse);for(let r of this.querySelectorAll("qti-gap")){let i=r.getAttribute("identifier"),n=r.drags;for(let s of n)s.candidateCorrection=null,t&&e.some(a=>a.source===s.identifier&&a.target===i)?s.candidateCorrection="correct":t&&(s.candidateCorrection="incorrect")}}};var Kc=class extends K(bt){#t=[];toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=this.#t;this.#t=t&&e?Array.isArray(e)?[...e]:[e]:[],this.requestUpdate("correctLines",r)}renderSupplementalLines(){return H(this.#t,t=>t,t=>Ii`
|
|
11454
11454
|
<line
|
|
11455
11455
|
part="line answer-key correct-line"
|
|
11456
11456
|
x1=${parseInt(this.querySelector(`[identifier=${t.split(" ")[0]}]`).style.left)}
|
|
@@ -11461,7 +11461,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11461
11461
|
stroke-width="3"
|
|
11462
11462
|
stroke-dasharray="5,5"
|
|
11463
11463
|
/>
|
|
11464
|
-
`)}};var
|
|
11464
|
+
`)}};var Zc=class extends ee(yr){};var tl=class extends K(Be){resolvePinColor(t){let{internals:e}=t;return Ni(e.states,"candidate-incorrect")?"var(--qti-incorrect)":Ni(e.states,"candidate-correct")?"var(--qti-correct)":super.resolvePinColor(t)}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements){let n=r.indexOf(i.identifier);i.orderCorrect=t&&n>=0?n+1:null}this.refreshLocatorPins()}toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=this.correctResponse,r=e?Array.isArray(e)?e:[e]:[];for(let i of this._choiceElements)i.candidateCorrection=null,t&&i.order!=null&&(i.candidateCorrection=r[i.order-1]===i.identifier?"correct":"incorrect");this.refreshLocatorPins()}};var el=class extends Sr(Kr){};var rl=class extends Sr(Zr){};var il=class extends K(rt){static get styles(){return[rt.styles,st,w`
|
|
11465
11465
|
/*
|
|
11466
11466
|
* Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other
|
|
11467
11467
|
* badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on
|
|
@@ -11480,7 +11480,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11480
11480
|
`]}toggleInternalCorrectResponse(t){this.showFullCorrectResponse||this.toggleFullCorrectResponse(t)}get withholdsFullCorrectResponseWhenCorrect(){return!1}render(){return v`
|
|
11481
11481
|
${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}
|
|
11482
11482
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
11483
|
-
`}};var
|
|
11483
|
+
`}};var nl=class extends ee(te){#t=new Set;toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let e=ga(this.correctResponse);this.#t=t?new Set(e.map(r=>`${r.source} ${r.target}`)):new Set;for(let r of this.targetChoices){let i=r.getAttribute("identifier"),n=r.drags;for(let s of n)s.candidateCorrection=null,t&&(s.candidateCorrection=this.#t.has(`${s.identifier} ${i}`)?"correct":"incorrect")}this.requestUpdate()}getCellStateVariant(t,e){return!this.showCandidateCorrection||!e?"":this.#t.has(t)?"candidate-correct correct":"candidate-incorrect incorrect"}};function Xf(o){if(o.length===0)return new Set;let t=new Array(o.length).fill(1),e=new Array(o.length).fill(-1);for(let n=0;n<o.length;n++)for(let s=0;s<n;s++)o[s]<o[n]&&t[s]+1>t[n]&&(t[n]=t[s]+1,e[n]=s);let r=0;for(let n=1;n<o.length;n++)t[n]>t[r]&&(r=n);let i=new Set;for(let n=r;n!==-1;n=e[n])i.add(n);return i}function eu(o,t){let e=new Map(t.map((a,c)=>[a,c])),r=o.filter(a=>e.has(a)),i=r.map(a=>e.get(a)),n=Xf(i),s=new Set;return n.forEach(a=>s.add(r[a])),s}var ol=class extends ee(Ue){toggleCandidateCorrection(t){super.toggleCandidateCorrection(t);let r=Array.from(this.shadowRoot.querySelectorAll("[part~='drop']")).flatMap(l=>this.chipsIn(l));for(let l of r)l.candidateCorrection=null;if(!t)return;let i=this.correctResponse,s=(i?Array.isArray(i)?i:[i]:[]).map((l,d)=>{let[h,f]=l.split(" "),m=f?.startsWith("droplist")?parseInt(f.slice(8),10):d;return{identifier:h,dropIndex:Number.isNaN(m)?d:m}}).filter(l=>l.identifier).sort((l,d)=>l.dropIndex-d.dropIndex).map(l=>l.identifier);if(s.length===0)return;let a=r.map(l=>({choice:l,identifier:l.getAttribute("identifier")})).filter(l=>!!l.identifier),c=eu(a.map(l=>l.identifier),s);for(let{choice:l,identifier:d}of a)l.candidateCorrection=c.has(d)?"correct":"incorrect"}};var sl=class extends K(X){toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.responseVariable,r=e?.correctResponse??this.correctResponse;this.correctResponse=t?r:e?.cardinality==="single"?"":[];let i=`correct-response-container-${this.responseIdentifier}`;if(this.parentElement?.querySelectorAll(`#${i}`).forEach(f=>f.remove()),!t){this.enable();return}if(this.disable(),!this.correctResponse)return;let n=document.createElement("div");n.id=i,n.className="pci-correct-response-container",Object.assign(n.style,{position:"relative",marginTop:"20px",border:"2px solid green",padding:"16px",borderRadius:"4px",backgroundColor:"rgba(0, 128, 0, 0.05)"});let s=document.createElement("div");s.textContent="Correct Response:",Object.assign(s.style,{fontWeight:"bold",marginBottom:"10px",color:"green"}),n.append(s);let a=this.cloneNode(!1);a.removeAttribute("id"),a.removeAttribute("show-correct-response"),a.removeAttribute("show-full-correct-response"),a.removeAttribute("show-candidate-correction"),a.isFullCorrectResponse=!0;let c=this.responseIdentifier;a.responseIdentifier=`${c}-correct`;for(let f of Array.from(this.children))f.tagName.startsWith("QTI-")&&a.append(f.cloneNode(!0));let l=this.correctResponse,d=e?.cardinality??(Array.isArray(l)?"multiple":"single"),h=e?.baseType??"string";a.status="solution",a.responseDeclaration={baseType:h,cardinality:d,correctResponse:{value:l}},a.addEventListener("qti-portable-custom-interaction-loaded",()=>{let f=a.responseVariablesToQtiVariableJSON(l,d,h);a.sendMessageToIframe("setBoundTo",{[c]:f}),a.sendMessageToIframe("setState",{state:"review"})},{once:!0}),a.style.pointerEvents="none",n.append(a),this.after(n)}};var al=class extends K(lt){#t=[];#e=[];static{this.styles=[lt.styles,w`
|
|
11484
11484
|
[part~='candidate-correct'] {
|
|
11485
11485
|
--qti-select-point-marker-color: var(--qti-correct);
|
|
11486
11486
|
}
|
|
@@ -11493,7 +11493,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11493
11493
|
data-coord=${t.coords}
|
|
11494
11494
|
data-shape=${t.shape}
|
|
11495
11495
|
alt=${`correct-response-${e+1}`}
|
|
11496
|
-
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var
|
|
11496
|
+
></div>`)}updated(t){super.updated(t),t.has("correctAreas")&&this.positionOverlayElements(this.shadowRoot.querySelectorAll("[data-correction-area]"))}};var cl=class extends K(Tt){#t=null;static{this.styles=[Tt.styles,w`
|
|
11497
11497
|
[part~='knob'][part~='answer-key'] {
|
|
11498
11498
|
background-color: var(--qti-correct-light);
|
|
11499
11499
|
border: 2px solid var(--qti-correct);
|
|
@@ -11508,7 +11508,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11508
11508
|
}
|
|
11509
11509
|
`]}toggleInternalCorrectResponse(t){super.toggleInternalCorrectResponse(t);let e=this.correctResponse,r=Array.isArray(e)?e[0]:e,i=t&&r?parseFloat(r):NaN,n=this.#t;if(this.#t=Number.isFinite(i)?i:null,this.#t!==null){let s=(this.#t-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}else this.style.removeProperty("--value-percentage-correct");this.requestUpdate("correctResponseNumber",n)}renderRailSupplement(){return this.#t===null?P:v`<div id="knob-correct" part="knob answer-key knob-correct">
|
|
11510
11510
|
<div id="value" part="value">${this.#t}</div>
|
|
11511
|
-
</div>`}};var
|
|
11511
|
+
</div>`}};var ll=class extends K(dt){static{this.styles=[dt.styles,st,w`
|
|
11512
11512
|
/*
|
|
11513
11513
|
* The trailing inset only — size and leading gap come from the shared sheet.
|
|
11514
11514
|
*
|
|
@@ -11532,7 +11532,7 @@ https://requirejs.org/docs/errors.html#\`+r);return h.requireType=r,h.requireMod
|
|
|
11532
11532
|
${this.renderAnswer()} ${this.renderInput()}
|
|
11533
11533
|
<span part=${this.correctionPart} aria-hidden="true"></span>
|
|
11534
11534
|
${this.renderValidationMessage()}
|
|
11535
|
-
`}};export{K as CandidateCorrectionMixin,Sr as ChoiceCorrectionMixin
|
|
11535
|
+
`}};export{K as CandidateCorrectionMixin,Sr as ChoiceCorrectionMixin,jc as CorrectResponseMixin,Z as Correctness,za as CustomStateSetShim,Ba as INITIAL_SESSION_CONTEXT,Ua as INITIAL_TEST_CONTEXT,D as Interaction,Qa as IsNullOrUndefined,$t as ItemContainer,An as ItemCorrectResponseMode,tn as ItemPrintVariables,We as ItemShowCandidateCorrection,Qe as ItemShowCorrectResponse,ch as ItemViewMixin,sd as PUBLIC_ITEM_EVENTS,Co as QTI_TEST_STATE_VERSION,ys as QtiAnd,ei as QtiAnyN,ut as QtiAssessmentItem,Jp as QtiAssessmentItemCorrection,wt as QtiAssessmentItemRef,Ct as QtiAssessmentSection,io as QtiAssessmentStimulus,zr as QtiAssessmentStimulusRef,sc as QtiAssessmentStimulusRefConnectedEvent,rr as QtiAssessmentTest,Qr as QtiAssociableHotspot,gr as QtiAssociateInteraction,Gc as QtiAssociateInteractionCorrection,mn as QtiBaseValue,le as QtiBranchRule,br as QtiChoiceInteraction,Jc as QtiChoiceInteractionCorrection,co as QtiCompanionMaterialsInfo,Qt as QtiConditionExpression,qs as QtiContainerSize,xs as QtiContains,Ui as QtiContentBody,Br as QtiContextDeclaration,ws as QtiCorrect,ge as QtiCustomInteraction,Hi as QtiCustomOperator,Cr as QtiDefault,Cs as QtiDelete,ks as QtiDivide,Ss as QtiDurationGte,Es as QtiDurationLt,be as QtiEndAttemptInteraction,ri as QtiEqual,fn as QtiEqualRounded,As as QtiExitResponse,Mr as QtiExitResponseSignal,_s as QtiExitTest,Pr as QtiExitTestSignal,E as QtiExpression,Q as QtiExtendedTextInteraction,fa as QtiExtendedTextInteractionCorrection,pt as QtiFeedback,lo as QtiFeedbackBlock,ho as QtiFeedbackInline,Ts as QtiFieldValue,lr as QtiGap,en as QtiGapImg,Yr as QtiGapMatchInteraction,Yc as QtiGapMatchInteractionCorrection,$e as QtiGapText,Bc as QtiGapTextCorrection,Rs as QtiGcd,bt as QtiGraphicAssociateInteraction,Kc as QtiGraphicAssociateInteractionCorrection,yr as QtiGraphicGapMatchInteraction,Zc as QtiGraphicGapMatchInteractionCorrection,Be as QtiGraphicOrderInteraction,tl as QtiGraphicOrderInteractionCorrection,Is as QtiGt,Ms as QtiGte,hr as QtiHotspotChoice,ma as QtiHotspotChoiceCorrection,Kr as QtiHotspotInteraction,el as QtiHotspotInteractionCorrection,pr as QtiHottext,Uc as QtiHottextCorrection,Zr as QtiHottextInteraction,rl as QtiHottextInteractionCorrection,gn as QtiIndex,rn as QtiInlineChoice,rt as QtiInlineChoiceInteraction,il as QtiInlineChoiceInteractionCorrection,ii as QtiInside,Ps as QtiIntegerDivide,Os as QtiIntegerModulus,Ds as QtiIntegerToFloat,$s as QtiIsNull,fe as QtiItem,po as QtiItemBody,Yp as QtiItemCorrection,Pt as QtiItemSessionControl,Ns as QtiLcm,ni as QtiLookupOutcomeValue,Ls as QtiLt,Vs as QtiLte,vn as QtiMapResponse,bn as QtiMapResponsePoint,js as QtiMatch,te as QtiMatchInteraction,nl as QtiMatchInteractionCorrection,yn as QtiMathConstant,qn as QtiMathOperator,Fs as QtiMax,os as QtiMediaInteraction,zs as QtiMember,Bs as QtiMin,Ur as QtiModalFeedback,Us as QtiMultiple,Hs as QtiNot,Ws as QtiNull,Fi as QtiNumberPresented,to as QtiNumberSelected,Qs as QtiOr,Ue as QtiOrderInteraction,ol as QtiOrderInteractionCorrection,Xs as QtiOrdered,Js as QtiOutcomeCondition,he as QtiOutcomeDeclaration,Ks as QtiOutcomeElse,Ys as QtiOutcomeElseIf,ci as QtiOutcomeIf,ro as QtiOutcomeProcessing,ec as QtiOutcomeProcessingProcessor,xn as QtiPatternMatch,X as QtiPortableCustomInteraction,sl as QtiPortableCustomInteractionCorrection,_t as QtiPositionObjectInteraction,ps as QtiPositionObjectStage,Zs as QtiPower,eo as QtiPreCondition,vt as QtiPrintedVariable,ta as QtiProduct,Mo as QtiPrompt,ea as QtiRandom,kr as QtiRandomInteger,Cn as QtiRepeat,ra as QtiResponseCondition,Ee as QtiResponseDeclaration,na as QtiResponseElse,ia as QtiResponseElseIf,li as QtiResponseIf,mo as QtiResponseProcessing,oa as QtiResponseProcessingFragment,sa as QtiRound,di as QtiRoundTo,pe as QtiRubricBlock,rd as QtiRuleElement,lt as QtiSelectPointInteraction,al as QtiSelectPointInteractionCorrection,aa as QtiSetCorrectResponse,$c as QtiSetCorrectResponseRule,ca as QtiSetOutcomeValue,Nc as QtiSetOutcomeValueRule,la as QtiSetTemplateValue,Lc as QtiSetTemplateValueRule,Nt as QtiSimpleAssociableChoice,Hc as QtiSimpleAssociableChoiceCorrection,Lt as QtiSimpleChoice,Wc as QtiSimpleChoiceCorrection,Tt as QtiSliderInteraction,cl as QtiSliderInteractionCorrection,kn as QtiStatsOperator,Sn as QtiStringMatch,bo as QtiStylesheet,En as QtiSubstring,da as QtiSubtract,ha as QtiSum,Vc as QtiSumExpression,vo as QtiTemplateConstraint,ue as QtiTemplateDeclaration,yo as QtiTemplateProcessing,Ie as QtiTest,Zp as QtiTestCorrection,Ji as QtiTestFeedback,Re as QtiTestPart,Yi as QtiTestVariables,cc as QtiTestVariablesExpression,dt as QtiTextEntryInteraction,ll as QtiTextEntryInteractionCorrection,pa as QtiTruncate,bs as QtiUploadInteraction,ua as QtiVariable,Ir as QtiVariableDeclaration,Zl as STATE_ALIASES,Y as ScoringHelper,St as TestContainer,me as TestEndAttempt,mt as TestNavigation,Kp as TestNavigationCorrection,sr as TestNext,ar as TestPrev,Xe as TestShowCorrectResponse,Io as TestSubmit,Sv as asSeed,M as boxSizing,Lu as classifyCustomStateSupport,ct as computedContext,we as computedItemContext,yt as configContext,Mt as convertNumberToUniversalFormat,st as correctionPart,ry as decimalSeparator,Ja as dispatchDeclared,xt as dispatchPublic,Wt as dropRegion,id as getCustomOperator,J$ as getItemByUri,G$ as getManifestInfo,Ni as hasState,Kn as inferRecordFieldBaseType,qf as inlineScriptText,xf as inlineStyleText,Yl as installCustomStateSetFallback,Tr as interactionContext,ce as isRecordValue,ju as isSeed,j as itemContext,Kl as itemContextVariables,hy as iterResponseValues,Ya as listenDeclared,ad as listenPublic,py as parsePair,my as parsePoint,Vi as parseResponseAttribute,sh as pluginElements,KS as pluginState,Ef as qtiAndMixin,qt as qtiContext,Vp as qtiInteractionElements,Bf as qtiSubtractMixin,Gt as qtiTransformItem,kd as qtiTransformManifest,Fr as qtiTransformTest,ji as readRecordFieldValues,qy as registerCustomOperator,Yn as removeDoubleSlashes,Xt as responseAttributeConverter,uy as serializePair,fy as serializePoint,er as serializeResponseAttribute,Jn as sessionContext,z as setState,nt as testContext,xy as unregisterCustomOperator,U as validationMessage};
|
|
11536
11536
|
/*! Bundled license information:
|
|
11537
11537
|
|
|
11538
11538
|
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|