@citolab/qti-components 7.12.0 → 7.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cdn/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var rn=Object.defineProperty;var sn=Object.getOwnPropertyDescriptor;var c=(o,r,e,t)=>{for(var i=t>1?void 0:t?sn(r,e):r,s=o.length-1,n;s>=0;s--)(n=o[s])&&(i=(t?n(r,e,i):n(i))||i);return t&&i&&rn(r,e,i),i};var Se=class extends Event{constructor(r,e,t,i){super("context-request",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e,this.callback=t,this.subscribe=i??!1}};var st=class{constructor(r,e,t,i){if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(s,n)),this.unsubscribe=n},this.host=r,e.context!==void 0){let s=e;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??!1}else this.context=e,this.callback=t,this.subscribe=i??!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Se(this.context,this.host,this.t,this.subscribe))}};var Rr=class{get value(){return this.o}set value(r){this.setValue(r)}setValue(r,e=!1){let t=e||!Object.is(r,this.o);this.o=r,t&&this.updateObservers()}constructor(r){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t)},r!==void 0&&(this.value=r)}addCallback(r,e,t){if(!t)return void r(this.value);this.subscriptions.has(r)||this.subscriptions.set(r,{disposer:()=>{this.subscriptions.delete(r)},consumerHost:e});let{disposer:i}=this.subscriptions.get(r);r(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var vi=class extends Event{constructor(r,e){super("context-provider",{bubbles:!0,composed:!0}),this.context=r,this.contextTarget=e}},ot=class extends Rr{constructor(r,e,t){super(e.context!==void 0?e.initialValue:t),this.onContextRequest=i=>{if(i.context!==this.context)return;let s=i.contextTarget??i.composedPath()[0];s!==this.host&&(i.stopPropagation(),this.addCallback(i.callback,s,i.subscribe))},this.onProviderRequest=i=>{if(i.context!==this.context||(i.contextTarget??i.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new Se(this.context,a,n,!0)));i.stopPropagation()},this.host=r,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),this.host.addController?.(this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new vi(this.context,this.host))}};function X({context:o}){return(r,e)=>{let t=new WeakMap;if(typeof e=="object")return{get(){return r.get.call(this)},set(i){return t.get(this).setValue(i),r.set.call(this,i)},init(i){return t.set(this,new ot(this,{context:o,initialValue:i})),i}};{r.constructor.addInitializer((n=>{t.set(n,new ot(n,{context:o}))}));let i=Object.getOwnPropertyDescriptor(r,e),s;if(i===void 0){let n=new WeakMap;s={get(){return n.get(this)},set(a){t.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{let n=i.set;s={...i,set(a){t.get(this).setValue(a),n?.call(this,a)}}}return void Object.defineProperty(r,e,s)}}}function _({context:o,subscribe:r}){return(e,t)=>{typeof t=="object"?t.addInitializer((function(){new st(this,{context:o,callback:i=>{e.set.call(this,i)},subscribe:r})})):e.constructor.addInitializer((i=>{new st(i,{context:o,callback:s=>{i[t]=s},subscribe:r})}))}}var ks=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(r){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=r}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var ie=function(o,r,e,t,i){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof r=="function"?o!==r||!i:!r.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?i.call(o,e):i?i.value=e:r.set(o,e),e},D=function(o,r,e,t){if(e==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof r=="function"?o!==r||!t:!r.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?t:e==="a"?t.call(o):t?t.value:r.get(o)},nt,Sr,Mr,Mt,yi,It,Ir,je,Lt,Me,Lr,As,Rs=o=>typeof o=="boolean"?o:o?.capture??!1;var xi=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map}addEventListener(r,e,t){if(e==null)return;let i=Rs(t)?this.__captureEventListeners:this.__eventListeners,s=i.get(r);if(s===void 0)s=new Map,i.set(r,s);else if(s.has(e))return;let n=typeof t=="object"&&t?t:{};n.signal?.addEventListener("abort",()=>this.removeEventListener(r,e,t)),s.set(e,n??{})}removeEventListener(r,e,t){if(e==null)return;let i=Rs(t)?this.__captureEventListeners:this.__eventListeners,s=i.get(r);s!==void 0&&(s.delete(e),s.size||i.delete(r))}dispatchEvent(r){let e=[this],t=this.__eventTargetParent;if(r.composed)for(;t;)e.push(t),t=t.__eventTargetParent;else for(;t&&t!==this.__host;)e.push(t),t=t.__eventTargetParent;let i=!1,s=!1,n=0,a=null,l=null,p=null,d=r.stopPropagation,m=r.stopImmediatePropagation;Object.defineProperties(r,{target:{get(){return a??l},...L},srcElement:{get(){return r.target},...L},currentTarget:{get(){return p},...L},eventPhase:{get(){return n},...L},composedPath:{value:()=>e,...L},stopPropagation:{value:()=>{i=!0,d.call(r)},...L},stopImmediatePropagation:{value:()=>{s=!0,m.call(r)},...L}});let f=(q,T,M)=>{typeof q=="function"?q(r):typeof q?.handleEvent=="function"&&q.handleEvent(r),T.once&&M.delete(q)},b=()=>(p=null,n=0,!r.defaultPrevented),y=e.slice().reverse();a=!this.__host||!r.composed?this:null;let C=q=>{for(l=this;l.__host&&q.includes(l.__host);)l=l.__host};for(let q of y){!a&&(!l||l===q.__host)&&C(y.slice(y.indexOf(q))),p=q,n=q===r.target?2:1;let T=q.__captureEventListeners.get(r.type);if(T){for(let[M,N]of T)if(f(M,N,T),s)return b()}if(i)return b()}let R=r.bubbles?e:[this];l=null;for(let q of R){!a&&(!l||q===l.__host)&&C(R.slice(0,R.indexOf(q)+1)),p=q,n=q===r.target?2:3;let T=q.__eventListeners.get(r.type);if(T){for(let[M,N]of T)if(f(M,N,T),s)return b()}if(i)return b()}return b()}},qi=xi;var L={__proto__:null};L.enumerable=!0;Object.freeze(L);var Ei=(Me=class{constructor(r,e={}){if(nt.set(this,!1),Sr.set(this,!1),Mr.set(this,!1),Mt.set(this,!1),yi.set(this,Date.now()),It.set(this,!1),Ir.set(this,void 0),je.set(this,void 0),Lt.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof e!="object"||!e)throw new Error('The "options" argument must be an object');let{bubbles:t,cancelable:i,composed:s}=e;ie(this,nt,!!i,"f"),ie(this,Sr,!!t,"f"),ie(this,Mr,!!s,"f"),ie(this,Ir,`${r}`,"f"),ie(this,je,null,"f"),ie(this,Lt,!1,"f")}initEvent(r,e,t){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation()}preventDefault(){ie(this,Mt,!0,"f")}get target(){return D(this,je,"f")}get currentTarget(){return D(this,je,"f")}get srcElement(){return D(this,je,"f")}get type(){return D(this,Ir,"f")}get cancelable(){return D(this,nt,"f")}get defaultPrevented(){return D(this,nt,"f")&&D(this,Mt,"f")}get timeStamp(){return D(this,yi,"f")}composedPath(){return D(this,Lt,"f")?[D(this,je,"f")]:[]}get returnValue(){return!D(this,nt,"f")||!D(this,Mt,"f")}get bubbles(){return D(this,Sr,"f")}get composed(){return D(this,Mr,"f")}get eventPhase(){return D(this,Lt,"f")?Me.AT_TARGET:Me.NONE}get cancelBubble(){return D(this,It,"f")}set cancelBubble(r){r&&ie(this,It,!0,"f")}stopPropagation(){ie(this,It,!0,"f")}get isTrusted(){return!1}},nt=new WeakMap,Sr=new WeakMap,Mr=new WeakMap,Mt=new WeakMap,yi=new WeakMap,It=new WeakMap,Ir=new WeakMap,je=new WeakMap,Lt=new WeakMap,Me.NONE=0,Me.CAPTURING_PHASE=1,Me.AT_TARGET=2,Me.BUBBLING_PHASE=3,Me);Object.defineProperties(Ei.prototype,{initEvent:L,stopImmediatePropagation:L,preventDefault:L,target:L,currentTarget:L,srcElement:L,type:L,cancelable:L,defaultPrevented:L,timeStamp:L,composedPath:L,returnValue:L,bubbles:L,composed:L,eventPhase:L,cancelBubble:L,stopPropagation:L,isTrusted:L});var Ss=(As=class extends Ei{constructor(r,e={}){super(r,e),Lr.set(this,void 0),ie(this,Lr,e?.detail??null,"f")}initCustomEvent(r,e,t,i){throw new Error("Method not implemented.")}get detail(){return D(this,Lr,"f")}},Lr=new WeakMap,As);Object.defineProperties(Ss.prototype,{detail:L});var Ci=Ei,wi=Ss;globalThis.Event??=Ci;globalThis.CustomEvent??=wi;var Ms=new WeakMap,$t=o=>{let r=Ms.get(o);return r===void 0&&Ms.set(o,r=new Map),r},on=class extends qi{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from($t(this)).map(([r,e])=>({name:r,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(r,e){$t(this).set(r,String(e))}removeAttribute(r){$t(this).delete(r)}toggleAttribute(r,e){if(this.hasAttribute(r)){if(e===void 0||!e)return this.removeAttribute(r),!1}else return e===void 0||e?(this.setAttribute(r,""),!0):!1;return!0}hasAttribute(r){return $t(this).has(r)}attachShadow(r){let e={host:this};return this.__shadowRootMode=r.mode,r&&r.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let r=new ks(this);return this.__internals=r,r}getAttribute(r){return $t(this).get(r)??null}};var nn=class extends on{},Ti=nn;globalThis.litServerRoot??=Object.defineProperty(new Ti,"localName",{get(){return"lit-server-root"}});function an(){let o,r;return{promise:new Promise((t,i)=>{o=t,r=i}),resolve:o,reject:r}}var _i=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map}define(r,e){if(this.__definitions.has(r))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${r}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
2
- Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${r}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=r,this.__definitions.set(r,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,r),this.__pendingWhenDefineds.get(r)?.resolve(e),this.__pendingWhenDefineds.delete(r)}get(r){return this.__definitions.get(r)?.ctor}getName(r){return this.__reverseDefinitions.get(r)??null}upgrade(r){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(r){let e=this.__definitions.get(r);if(e)return e.ctor;let t=this.__pendingWhenDefineds.get(r);return t||(t=an(),this.__pendingWhenDefineds.set(r,t)),t.promise}},ln=_i;var Is=new ln;var Pt=globalThis,$r=Pt.ShadowRoot&&(Pt.ShadyCSS===void 0||Pt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ki=Symbol(),Ls=new WeakMap,Ot=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==ki)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if($r&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=Ls.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Ls.set(e,r))}return r}toString(){return this.cssText}},$s=o=>new Ot(typeof o=="string"?o:o+"",void 0,ki),x=(o,...r)=>{let e=o.length===1?o[0]:r.reduce(((t,i,s)=>t+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1]),o[0]);return new Ot(e,o,ki)},Ps=(o,r)=>{if($r)o.adoptedStyleSheets=r.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of r){let t=document.createElement("style"),i=Pt.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},Ai=$r||Pt.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return $s(e)})(o):o;var{is:cn,defineProperty:pn,getOwnPropertyDescriptor:dn,getOwnPropertyNames:un,getOwnPropertySymbols:mn,getPrototypeOf:hn}=Object,Dt=globalThis;Dt.customElements??=Is;var Os=Dt.trustedTypes,fn=Os?Os.emptyScript:"",gn=Dt.reactiveElementPolyfillSupport,Nt=(o,r)=>o,Vt={toAttribute(o,r){switch(r){case Boolean:o=o?fn:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,r){let e=o;switch(r){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},Pr=(o,r)=>!cn(o,r),Ns={attribute:!0,type:String,converter:Vt,reflect:!1,useDefault:!1,hasChanged:Pr};Symbol.metadata??=Symbol("metadata"),Dt.litPropertyMetadata??=new WeakMap;var be=class extends(globalThis.HTMLElement??Ti){static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Ns){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&pn(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:s}=dn(this.prototype,r)??{get(){return this[e]},set(n){this[e]=n}};return{get:i,set(n){let a=i?.call(this);s?.call(this,n),this.requestUpdate(r,a,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Ns}static _$Ei(){if(this.hasOwnProperty(Nt("elementProperties")))return;let r=hn(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(Nt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Nt("properties"))){let e=this.properties,t=[...un(e),...mn(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Ai(i))}else r!==void 0&&e.push(Ai(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((r=>this.enableUpdating=r)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((r=>r(this)))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ps(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((r=>r.hostConnected?.()))}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach((r=>r.hostDisconnected?.()))}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.constructor.elementProperties.get(r),i=this.constructor._$Eu(r,t);if(i!==void 0&&t.reflect===!0){let s=(t.converter?.toAttribute!==void 0?t.converter:Vt).toAttribute(e,t.type);this._$Em=r,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(r,e){let t=this.constructor,i=t._$Eh.get(r);if(i!==void 0&&this._$Em!==i){let s=t.getPropertyOptions(i),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Vt;this._$Em=i;let a=n.fromAttribute(e,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(r,e,t){if(r!==void 0){let i=this.constructor,s=this[r];if(t??=i.getPropertyOptions(r),!((t.hasChanged??Pr)(s,e)||t.useDefault&&t.reflect&&s===this._$Ej?.get(r)&&!this.hasAttribute(i._$Eu(r,t))))return;this.C(r,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(r,e,{useDefault:t,reflect:i,wrapped:s},n){t&&!(this._$Ej??=new Map).has(r)&&(this._$Ej.set(r,n??e??this[r]),s!==!0||n!==void 0)||(this._$AL.has(r)||(this.hasUpdated||t||(e=void 0),this._$AL.set(r,e)),i===!0&&this._$Em!==r&&(this._$Eq??=new Set).add(r))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let r=this.scheduleUpdate();return r!=null&&await r,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,s]of t){let{wrapped:n}=s,a=this[i];n!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let r=!1,e=this._$AL;try{r=this.shouldUpdate(e),r?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(t){throw r=!1,this._$EM(),t}r&&this._$AE(e)}willUpdate(r){}_$AE(r){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(r)),this.updated(r)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(r){return!0}update(r){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(r){}firstUpdated(r){}};be.elementStyles=[],be.shadowRootOptions={mode:"open"},be[Nt("elementProperties")]=new Map,be[Nt("finalized")]=new Map,gn?.({ReactiveElement:be}),(Dt.reactiveElementVersions??=[]).push("2.1.1");var Fr=globalThis,Or=Fr.trustedTypes,Vs=Or?Or.createPolicy("lit-html",{createHTML:o=>o}):void 0,Si="$lit$",ve=`lit$${Math.random().toFixed(9).slice(2)}$`,Mi="?"+ve,bn=`<${Mi}>`,Xe=Fr.document===void 0?{createTreeWalker:()=>({})}:document,zt=()=>Xe.createComment(""),Ft=o=>o===null||typeof o!="object"&&typeof o!="function",Ii=Array.isArray,js=o=>Ii(o)||typeof o?.[Symbol.iterator]=="function",Ri=`[
2
+ Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${r}" has already been used with this registry`);if(this.__reverseDefinitions.has(e))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(e)}`);e.__localName=r,this.__definitions.set(r,{ctor:e,observedAttributes:e.observedAttributes??[]}),this.__reverseDefinitions.set(e,r),this.__pendingWhenDefineds.get(r)?.resolve(e),this.__pendingWhenDefineds.delete(r)}get(r){return this.__definitions.get(r)?.ctor}getName(r){return this.__reverseDefinitions.get(r)??null}upgrade(r){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(r){let e=this.__definitions.get(r);if(e)return e.ctor;let t=this.__pendingWhenDefineds.get(r);return t||(t=an(),this.__pendingWhenDefineds.set(r,t)),t.promise}},ln=_i;var Is=new ln;var Ot=globalThis,$r=Ot.ShadowRoot&&(Ot.ShadyCSS===void 0||Ot.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ki=Symbol(),Ls=new WeakMap,Pt=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==ki)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o,e=this.t;if($r&&r===void 0){let t=e!==void 0&&e.length===1;t&&(r=Ls.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Ls.set(e,r))}return r}toString(){return this.cssText}},$s=o=>new Pt(typeof o=="string"?o:o+"",void 0,ki),x=(o,...r)=>{let e=o.length===1?o[0]:r.reduce(((t,i,s)=>t+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+o[s+1]),o[0]);return new Pt(e,o,ki)},Os=(o,r)=>{if($r)o.adoptedStyleSheets=r.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(let e of r){let t=document.createElement("style"),i=Ot.litNonce;i!==void 0&&t.setAttribute("nonce",i),t.textContent=e.cssText,o.appendChild(t)}},Ai=$r||Ot.CSSStyleSheet===void 0?o=>o:o=>o instanceof CSSStyleSheet?(r=>{let e="";for(let t of r.cssRules)e+=t.cssText;return $s(e)})(o):o;var{is:cn,defineProperty:pn,getOwnPropertyDescriptor:dn,getOwnPropertyNames:un,getOwnPropertySymbols:mn,getPrototypeOf:hn}=Object,Dt=globalThis;Dt.customElements??=Is;var Ps=Dt.trustedTypes,fn=Ps?Ps.emptyScript:"",gn=Dt.reactiveElementPolyfillSupport,Nt=(o,r)=>o,Vt={toAttribute(o,r){switch(r){case Boolean:o=o?fn:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o)}return o},fromAttribute(o,r){let e=o;switch(r){case Boolean:e=o!==null;break;case Number:e=o===null?null:Number(o);break;case Object:case Array:try{e=JSON.parse(o)}catch{e=null}}return e}},Or=(o,r)=>!cn(o,r),Ns={attribute:!0,type:String,converter:Vt,reflect:!1,useDefault:!1,hasChanged:Or};Symbol.metadata??=Symbol("metadata"),Dt.litPropertyMetadata??=new WeakMap;var ge=class extends(globalThis.HTMLElement??Ti){static addInitializer(r){this._$Ei(),(this.l??=[]).push(r)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(r,e=Ns){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(r)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(r,e),!e.noAccessor){let t=Symbol(),i=this.getPropertyDescriptor(r,t,e);i!==void 0&&pn(this.prototype,r,i)}}static getPropertyDescriptor(r,e,t){let{get:i,set:s}=dn(this.prototype,r)??{get(){return this[e]},set(n){this[e]=n}};return{get:i,set(n){let a=i?.call(this);s?.call(this,n),this.requestUpdate(r,a,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(r){return this.elementProperties.get(r)??Ns}static _$Ei(){if(this.hasOwnProperty(Nt("elementProperties")))return;let r=hn(this);r.finalize(),r.l!==void 0&&(this.l=[...r.l]),this.elementProperties=new Map(r.elementProperties)}static finalize(){if(this.hasOwnProperty(Nt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Nt("properties"))){let e=this.properties,t=[...un(e),...mn(e)];for(let i of t)this.createProperty(i,e[i])}let r=this[Symbol.metadata];if(r!==null){let e=litPropertyMetadata.get(r);if(e!==void 0)for(let[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let i=this._$Eu(e,t);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(r){let e=[];if(Array.isArray(r)){let t=new Set(r.flat(1/0).reverse());for(let i of t)e.unshift(Ai(i))}else r!==void 0&&e.push(Ai(r));return e}static _$Eu(r,e){let t=e.attribute;return t===!1?void 0:typeof t=="string"?t:typeof r=="string"?r.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((r=>this.enableUpdating=r)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((r=>r(this)))}addController(r){(this._$EO??=new Set).add(r),this.renderRoot!==void 0&&this.isConnected&&r.hostConnected?.()}removeController(r){this._$EO?.delete(r)}_$E_(){let r=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(r.set(t,this[t]),delete this[t]);r.size>0&&(this._$Ep=r)}createRenderRoot(){let r=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Os(r,this.constructor.elementStyles),r}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((r=>r.hostConnected?.()))}enableUpdating(r){}disconnectedCallback(){this._$EO?.forEach((r=>r.hostDisconnected?.()))}attributeChangedCallback(r,e,t){this._$AK(r,t)}_$ET(r,e){let t=this.constructor.elementProperties.get(r),i=this.constructor._$Eu(r,t);if(i!==void 0&&t.reflect===!0){let s=(t.converter?.toAttribute!==void 0?t.converter:Vt).toAttribute(e,t.type);this._$Em=r,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(r,e){let t=this.constructor,i=t._$Eh.get(r);if(i!==void 0&&this._$Em!==i){let s=t.getPropertyOptions(i),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Vt;this._$Em=i;let a=n.fromAttribute(e,s.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(r,e,t){if(r!==void 0){let i=this.constructor,s=this[r];if(t??=i.getPropertyOptions(r),!((t.hasChanged??Or)(s,e)||t.useDefault&&t.reflect&&s===this._$Ej?.get(r)&&!this.hasAttribute(i._$Eu(r,t))))return;this.C(r,e,t)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(r,e,{useDefault:t,reflect:i,wrapped:s},n){t&&!(this._$Ej??=new Map).has(r)&&(this._$Ej.set(r,n??e??this[r]),s!==!0||n!==void 0)||(this._$AL.has(r)||(this.hasUpdated||t||(e=void 0),this._$AL.set(r,e)),i===!0&&this._$Em!==r&&(this._$Eq??=new Set).add(r))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let r=this.scheduleUpdate();return r!=null&&await r,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}let t=this.constructor.elementProperties;if(t.size>0)for(let[i,s]of t){let{wrapped:n}=s,a=this[i];n!==!0||this._$AL.has(i)||a===void 0||this.C(i,void 0,s,a)}}let r=!1,e=this._$AL;try{r=this.shouldUpdate(e),r?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(t){throw r=!1,this._$EM(),t}r&&this._$AE(e)}willUpdate(r){}_$AE(r){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(r)),this.updated(r)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(r){return!0}update(r){this._$Eq&&=this._$Eq.forEach((e=>this._$ET(e,this[e]))),this._$EM()}updated(r){}firstUpdated(r){}};ge.elementStyles=[],ge.shadowRootOptions={mode:"open"},ge[Nt("elementProperties")]=new Map,ge[Nt("finalized")]=new Map,gn?.({ReactiveElement:ge}),(Dt.reactiveElementVersions??=[]).push("2.1.1");var Fr=globalThis,Pr=Fr.trustedTypes,Vs=Pr?Pr.createPolicy("lit-html",{createHTML:o=>o}):void 0,Si="$lit$",be=`lit$${Math.random().toFixed(9).slice(2)}$`,Mi="?"+be,bn=`<${Mi}>`,Xe=Fr.document===void 0?{createTreeWalker:()=>({})}:document,zt=()=>Xe.createComment(""),Ft=o=>o===null||typeof o!="object"&&typeof o!="function",Ii=Array.isArray,js=o=>Ii(o)||typeof o?.[Symbol.iterator]=="function",Ri=`[
3
3
  \f\r]`,Ht=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ds=/-->/g,Hs=/>/g,Be=RegExp(`>|${Ri}(?:([^\\s"'>=/]+)(${Ri}*=${Ri}*(?:[^
4
- \f\r"'\`<>=]|("|')|))|$)`,"g"),zs=/'/g,Fs=/"/g,Bs=/^(?:script|style|textarea|title)$/i,Li=o=>(r,...e)=>({_$litType$:o,strings:r,values:e}),h=Li(1),Ur=Li(2),Ba=Li(3),O=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),Us=new WeakMap,We=Xe.createTreeWalker(Xe,129);function Ws(o,r){if(!Ii(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Vs!==void 0?Vs.createHTML(r):r}var Xs=(o,r)=>{let e=o.length-1,t=[],i,s=r===2?"<svg>":r===3?"<math>":"",n=Ht;for(let a=0;a<e;a++){let l=o[a],p,d,m=-1,f=0;for(;f<l.length&&(n.lastIndex=f,d=n.exec(l),d!==null);)f=n.lastIndex,n===Ht?d[1]==="!--"?n=Ds:d[1]!==void 0?n=Hs:d[2]!==void 0?(Bs.test(d[2])&&(i=RegExp("</"+d[2],"g")),n=Be):d[3]!==void 0&&(n=Be):n===Be?d[0]===">"?(n=i??Ht,m=-1):d[1]===void 0?m=-2:(m=n.lastIndex-d[2].length,p=d[1],n=d[3]===void 0?Be:d[3]==='"'?Fs:zs):n===Fs||n===zs?n=Be:n===Ds||n===Hs?n=Ht:(n=Be,i=void 0);let b=n===Be&&o[a+1].startsWith("/>")?" ":"";s+=n===Ht?l+bn:m>=0?(t.push(p),l.slice(0,m)+Si+l.slice(m)+ve+b):l+ve+(m===-2?a:b)}return[Ws(o,s+(o[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Ut=class o{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let s=0,n=0,a=r.length-1,l=this.parts,[p,d]=Xs(r,e);if(this.el=o.createElement(p,t),We.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=We.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Si)){let f=d[n++],b=i.getAttribute(m).split(ve),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:s,name:y[2],strings:b,ctor:y[1]==="."?Vr:y[1]==="?"?Dr:y[1]==="@"?Hr:Ye}),i.removeAttribute(m)}else m.startsWith(ve)&&(l.push({type:6,index:s}),i.removeAttribute(m));if(Bs.test(i.tagName)){let m=i.textContent.split(ve),f=m.length-1;if(f>0){i.textContent=Or?Or.emptyScript:"";for(let b=0;b<f;b++)i.append(m[b],zt()),We.nextNode(),l.push({type:2,index:++s});i.append(m[f],zt())}}}else if(i.nodeType===8)if(i.data===Mi)l.push({type:2,index:s});else{let m=-1;for(;(m=i.data.indexOf(ve,m+1))!==-1;)l.push({type:7,index:s}),m+=ve.length-1}s++}}static createElement(r,e){let t=Xe.createElement("template");return t.innerHTML=r,t}};function Ge(o,r,e=o,t){if(r===O)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,s=Ft(r)?void 0:r._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Ge(o,i._$AS(o,r.values),i,t)),r}var Nr=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Xe).importNode(e,!0);We.currentNode=i;let s=We.nextNode(),n=0,a=0,l=t[0];for(;l!==void 0;){if(n===l.index){let p;l.type===2?p=new at(s,s.nextSibling,this,r):l.type===1?p=new l.ctor(s,l.name,l.strings,this,r):l.type===6&&(p=new zr(s,this,r)),this._$AV.push(p),l=t[++a]}n!==l?.index&&(s=We.nextNode(),n++)}return We.currentNode=Xe,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},at=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=S,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Ge(this,r,e),Ft(r)?r===S||r==null||r===""?(this._$AH!==S&&this._$AR(),this._$AH=S):r!==this._$AH&&r!==O&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):js(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==S&&Ft(this._$AH)?this._$AA.nextSibling.data=r:this.T(Xe.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Ut.createElement(Ws(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new Nr(i,this),n=s.u(this.options);s.p(e),this.T(n),this._$AH=s}}_$AC(r){let e=Us.get(r.strings);return e===void 0&&Us.set(r.strings,e=new Ut(r)),e}k(r){Ii(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let s of r)i===e.length?e.push(t=new o(this.O(zt()),this.O(zt()),this,this.options)):t=e[i],t._$AI(s),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=r.nextSibling;r.remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Ye=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,s){this.type=1,this._$AH=S,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=s,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=S}_$AI(r,e=this,t,i){let s=this.strings,n=!1;if(s===void 0)r=Ge(this,r,e,0),n=!Ft(r)||r!==this._$AH&&r!==O,n&&(this._$AH=r);else{let a=r,l,p;for(r=s[0],l=0;l<s.length-1;l++)p=Ge(this,a[t+l],e,l),p===O&&(p=this._$AH[l]),n||=!Ft(p)||p!==this._$AH[l],p===S?r=S:r!==S&&(r+=(p??"")+s[l+1]),this._$AH[l]=p}n&&!i&&this.j(r)}j(r){r===S?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,r??"")}},Vr=class extends Ye{constructor(){super(...arguments),this.type=3}j(r){this.element[this.name]=r===S?void 0:r}},Dr=class extends Ye{constructor(){super(...arguments),this.type=4}j(r){this.element.toggleAttribute(this.name,!!r&&r!==S)}},Hr=class extends Ye{constructor(r,e,t,i,s){super(r,e,t,i,s),this.type=5}_$AI(r,e=this){if((r=Ge(this,r,e,0)??S)===O)return;let t=this._$AH,i=r===S&&t!==S||r.capture!==t.capture||r.once!==t.once||r.passive!==t.passive,s=r!==S&&(t===S||i);i&&this.element.removeEventListener(this.name,this,t),s&&this.element.addEventListener(this.name,this,r),this._$AH=r}handleEvent(r){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,r):this._$AH.handleEvent(r)}},zr=class{constructor(r,e,t){this.element=r,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(r){Ge(this,r)}},H={M:Si,P:ve,A:Mi,C:1,L:Xs,R:Nr,D:js,V:Ge,I:at,H:Ye,N:Dr,U:Hr,B:Vr,F:zr},vn=Fr.litHtmlPolyfillSupport;vn?.(Ut,at),(Fr.litHtmlVersions??=[]).push("3.3.1");var $i=(o,r,e)=>{let t=e?.renderBefore??r,i=t._$litPart$;if(i===void 0){let s=e?.renderBefore??null;t._$litPart$=i=new at(r.insertBefore(zt(),s),s,void 0,e??{})}return i._$AI(o),i};var Pi=globalThis,v=class extends be{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let r=super.createRenderRoot();return this.renderOptions.renderBefore??=r.firstChild,r}update(r){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(r),this._$Do=$i(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return O}};v._$litElement$=!0,v.finalized=!0,Pi.litElementHydrateSupport?.({LitElement:v});var yn=Pi.litElementPolyfillSupport;yn?.({LitElement:v});(Pi.litElementVersions??=[]).push("4.2.1");var g=o=>(r,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(o,r)})):customElements.define(o,r)};var xn={attribute:!0,type:String,converter:Vt,reflect:!1,hasChanged:Pr},qn=(o=xn,r,e)=>{let{kind:t,metadata:i}=e,s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),t==="setter"&&((o=Object.create(o)).wrapped=!0),s.set(e.name,o),t==="accessor"){let{name:n}=e;return{set(a){let l=r.get.call(this);r.set.call(this,a),this.requestUpdate(n,l,o)},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(t==="setter"){let{name:n}=e;return function(a){let l=this[n];r.call(this,a),this.requestUpdate(n,l,o)}}throw Error("Unsupported decorator location: "+t)};function u(o){return(r,e)=>typeof e=="object"?qn(o,r,e):((t,i,s)=>{let n=i.hasOwnProperty(s);return i.constructor.createProperty(s,t),n?Object.getOwnPropertyDescriptor(i,s):void 0})(o,r,e)}function E(o){return u({...o,state:!0,attribute:!1})}var Ie=(o,r,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof r!="object"&&Object.defineProperty(o,r,e),e);function lt(o,r){return(e,t,i)=>{let s=n=>n.renderRoot?.querySelector(o)??null;if(r){let{get:n,set:a}=typeof t=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(p){this[l]=p}}})();return Ie(e,t,{get(){let l=n.call(this);return l===void 0&&(l=s(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return Ie(e,t,{get(){return s(this)}})}}function Gs(o){return(r,e)=>{let{slot:t,selector:i}=o??{},s="slot"+(t?`[name=${t}]`:":not([name])");return Ie(r,e,{get(){let n=this.renderRoot?.querySelector(s),a=n?.assignedElements(o)??[];return i===void 0?a:a.filter((l=>l.matches(i)))}})}}function jr(o,r){return(e,t)=>{let{connectedCallback:i,disconnectedCallback:s}=e;e.connectedCallback=function(){i.call(this);let n=this[t],a=m=>{let f=[],b=[];for(let q of m)q.type==="childList"&&(q.addedNodes.forEach(T=>{if(T.nodeType!==1)return;let M=T;M.matches?.(o)&&f.push(M),f.push(...M.querySelectorAll?.(o)??[])}),q.removedNodes.forEach(T=>{if(T.nodeType!==1)return;let M=T;M.matches?.(o)&&b.push(M),b.push(...M.querySelectorAll?.(o)??[])}));let y=q=>Array.from(new Set(q)),C=y(f),R=y(b);(C.length||R.length)&&n.call(this,C,R)},l=new MutationObserver(a);l.observe(this,{childList:!0,subtree:!0});let p=this.shadowRoot?new MutationObserver(a):null;p?.observe(this.shadowRoot,{childList:!0,subtree:!0}),this.__lqObservers=[l,p].filter(m=>!!m),(async()=>{r?.waitUntilFirstUpdate&&"updateComplete"in this&&await this.updateComplete;let m=[...this.querySelectorAll(o),...this.shadowRoot?.querySelectorAll(o)??[]];m.length&&n.call(this,m,[])})()},e.disconnectedCallback=function(){s.call(this),this.__lqObservers?.forEach(n=>n.disconnect()),this.__lqObservers=void 0}}}function I(o,r){let e={waitUntilFirstUpdate:!1,...r};return(t,i)=>{let{update:s}=t,n=Array.isArray(o)?o:[o];t.update=function(a){n.forEach(l=>{let p=l;if(a.has(p)){let d=a.get(p),m=this[p];d!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,m)}}),s.call(this,a)}}}var $=Symbol("item");var Ys=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var G=class extends v{constructor(){super(...arguments);this._templateProcessing=null;this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{this._interactionElements.forEach(i=>i.disabled=t)};this._handleReadonlyChange=(e,t)=>this._interactionElements.forEach(i=>i.readonly=t);this._context={variables:Ys};this._initialContext={...this._context,variables:this._context.variables};this._feedbackElements=[];this._interactionElements=[];this._handleRegisterVariable=e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},this._initialContext=this._context,e.stopPropagation()};this._handleRegisterFeedback=e=>{e.stopImmediatePropagation();let t=e.detail;this._feedbackElements.push(t),(Number(this._context.variables.find(s=>s.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)};this._handleRegisterInteraction=e=>{e.stopImmediatePropagation(),this._interactionElements.push(e.detail.interactionElement)};this._handleEndAttempt=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:i}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(i)};this._handleSetOutcomeValue=e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:i}=e.detail;this.updateOutcomeVariable(t,i),e.stopPropagation()};this._handleUpdateResponseVariable=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:i}=e.detail;this.updateResponseVariable(t,i),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}get title(){return this._itemTitle}set title(e){this._itemTitle=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let i=e.find(s=>s.identifier===t.identifier);return i?{...t,...i,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let i=this._interactionElements.find(s=>s.responseIdentifier===t.identifier);i&&(i.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&this._feedbackElements.forEach(i=>i.checkShowFeedback(t.identifier))})}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let s=this._interactionElements.find(n=>n.getAttribute("response-identifier")===t.responseIdentifier);s&&(s.response=t.response)}}render(){return h`<slot></slot>`}connectedCallback(){this._attachEventListeners(),super.connectedCallback(),this.updateComplete.then(()=>{this._processTemplates(),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this}))})}disconnectedCallback(){this._removeEventListeners(),super.disconnectedCallback()}_attachEventListeners(){this.addEventListener("qti-register-variable",this._handleRegisterVariable),this.addEventListener("qti-register-feedback",this._handleRegisterFeedback),this.addEventListener("qti-register-interaction",this._handleRegisterInteraction),this.addEventListener("end-attempt",this._handleEndAttempt),this.addEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.addEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}_removeEventListeners(){this.removeEventListener("qti-register-variable",this._handleRegisterVariable),this.removeEventListener("qti-register-feedback",this._handleRegisterFeedback),this.removeEventListener("qti-register-interaction",this._handleRegisterInteraction),this.removeEventListener("end-attempt",this._handleEndAttempt),this.removeEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.removeEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}showCorrectResponse(e){for(let t of this._interactionElements)t.toggleCorrectResponse(e);document.querySelectorAll("item-show-correct-response").forEach(t=>{t.shown=e})}showCandidateCorrection(e){for(let t of this._interactionElements)t.toggleCandidateCorrection(e);document.querySelectorAll("item-show-candidate-correction").forEach(t=>{t.shown=e})}_processTemplates(){this._templateProcessing=this.querySelector("qti-template-processing"),this._templateProcessing&&this._templateProcessing.process()}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(s=>s.identifier==="numAttempts")?.value+1).toString());let i=this.querySelector("qti-response-processing");return!i||!i.process?!1:(i.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:t})},this.showCandidateCorrection(!1),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(s=>s.identifier!==e?s:{...s,value:i.cardinality==="single"||Array.isArray(t)?t:[t]})},this._feedbackElements.forEach(s=>s.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(s=>s.identifier===e)?.value}}))}validate(e=!0){let t=this._interactionElements.every(i=>i.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of this._interactionElements)e.reportValidity()}_getCompletionStatus(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"}};c([u({type:String})],G.prototype,"identifier",2),c([u({type:String})],G.prototype,"adaptive",2),c([u({type:String})],G.prototype,"timeDependent",2),c([u({type:String})],G.prototype,"title",1),c([u({type:Boolean})],G.prototype,"disabled",2),c([I("disabled",{waitUntilFirstUpdate:!0})],G.prototype,"_handleDisabledChange",2),c([u({type:Boolean})],G.prototype,"readonly",2),c([I("readonly",{waitUntilFirstUpdate:!0})],G.prototype,"_handleReadonlyChange",2),c([X({context:$})],G.prototype,"_context",2),G=c([g("qti-assessment-item")],G);var En=String.raw,Cn=En`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),zs=/'/g,Fs=/"/g,Bs=/^(?:script|style|textarea|title)$/i,Li=o=>(r,...e)=>({_$litType$:o,strings:r,values:e}),h=Li(1),Ur=Li(2),Ba=Li(3),P=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),Us=new WeakMap,We=Xe.createTreeWalker(Xe,129);function Ws(o,r){if(!Ii(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return Vs!==void 0?Vs.createHTML(r):r}var Xs=(o,r)=>{let e=o.length-1,t=[],i,s=r===2?"<svg>":r===3?"<math>":"",n=Ht;for(let a=0;a<e;a++){let l=o[a],p,d,m=-1,f=0;for(;f<l.length&&(n.lastIndex=f,d=n.exec(l),d!==null);)f=n.lastIndex,n===Ht?d[1]==="!--"?n=Ds:d[1]!==void 0?n=Hs:d[2]!==void 0?(Bs.test(d[2])&&(i=RegExp("</"+d[2],"g")),n=Be):d[3]!==void 0&&(n=Be):n===Be?d[0]===">"?(n=i??Ht,m=-1):d[1]===void 0?m=-2:(m=n.lastIndex-d[2].length,p=d[1],n=d[3]===void 0?Be:d[3]==='"'?Fs:zs):n===Fs||n===zs?n=Be:n===Ds||n===Hs?n=Ht:(n=Be,i=void 0);let b=n===Be&&o[a+1].startsWith("/>")?" ":"";s+=n===Ht?l+bn:m>=0?(t.push(p),l.slice(0,m)+Si+l.slice(m)+be+b):l+be+(m===-2?a:b)}return[Ws(o,s+(o[e]||"<?>")+(r===2?"</svg>":r===3?"</math>":"")),t]},Ut=class o{constructor({strings:r,_$litType$:e},t){let i;this.parts=[];let s=0,n=0,a=r.length-1,l=this.parts,[p,d]=Xs(r,e);if(this.el=o.createElement(p,t),We.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=We.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(Si)){let f=d[n++],b=i.getAttribute(m).split(be),y=/([.?@])?(.*)/.exec(f);l.push({type:1,index:s,name:y[2],strings:b,ctor:y[1]==="."?Vr:y[1]==="?"?Dr:y[1]==="@"?Hr:Ye}),i.removeAttribute(m)}else m.startsWith(be)&&(l.push({type:6,index:s}),i.removeAttribute(m));if(Bs.test(i.tagName)){let m=i.textContent.split(be),f=m.length-1;if(f>0){i.textContent=Pr?Pr.emptyScript:"";for(let b=0;b<f;b++)i.append(m[b],zt()),We.nextNode(),l.push({type:2,index:++s});i.append(m[f],zt())}}}else if(i.nodeType===8)if(i.data===Mi)l.push({type:2,index:s});else{let m=-1;for(;(m=i.data.indexOf(be,m+1))!==-1;)l.push({type:7,index:s}),m+=be.length-1}s++}}static createElement(r,e){let t=Xe.createElement("template");return t.innerHTML=r,t}};function Ge(o,r,e=o,t){if(r===P)return r;let i=t!==void 0?e._$Co?.[t]:e._$Cl,s=Ft(r)?void 0:r._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(o),i._$AT(o,e,t)),t!==void 0?(e._$Co??=[])[t]=i:e._$Cl=i),i!==void 0&&(r=Ge(o,i._$AS(o,r.values),i,t)),r}var Nr=class{constructor(r,e){this._$AV=[],this._$AN=void 0,this._$AD=r,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(r){let{el:{content:e},parts:t}=this._$AD,i=(r?.creationScope??Xe).importNode(e,!0);We.currentNode=i;let s=We.nextNode(),n=0,a=0,l=t[0];for(;l!==void 0;){if(n===l.index){let p;l.type===2?p=new at(s,s.nextSibling,this,r):l.type===1?p=new l.ctor(s,l.name,l.strings,this,r):l.type===6&&(p=new zr(s,this,r)),this._$AV.push(p),l=t[++a]}n!==l?.index&&(s=We.nextNode(),n++)}return We.currentNode=Xe,i}p(r){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(r,t,e),e+=t.strings.length-2):t._$AI(r[e])),e++}},at=class o{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(r,e,t,i){this.type=2,this._$AH=S,this._$AN=void 0,this._$AA=r,this._$AB=e,this._$AM=t,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let r=this._$AA.parentNode,e=this._$AM;return e!==void 0&&r?.nodeType===11&&(r=e.parentNode),r}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(r,e=this){r=Ge(this,r,e),Ft(r)?r===S||r==null||r===""?(this._$AH!==S&&this._$AR(),this._$AH=S):r!==this._$AH&&r!==P&&this._(r):r._$litType$!==void 0?this.$(r):r.nodeType!==void 0?this.T(r):js(r)?this.k(r):this._(r)}O(r){return this._$AA.parentNode.insertBefore(r,this._$AB)}T(r){this._$AH!==r&&(this._$AR(),this._$AH=this.O(r))}_(r){this._$AH!==S&&Ft(this._$AH)?this._$AA.nextSibling.data=r:this.T(Xe.createTextNode(r)),this._$AH=r}$(r){let{values:e,_$litType$:t}=r,i=typeof t=="number"?this._$AC(r):(t.el===void 0&&(t.el=Ut.createElement(Ws(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===i)this._$AH.p(e);else{let s=new Nr(i,this),n=s.u(this.options);s.p(e),this.T(n),this._$AH=s}}_$AC(r){let e=Us.get(r.strings);return e===void 0&&Us.set(r.strings,e=new Ut(r)),e}k(r){Ii(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,i=0;for(let s of r)i===e.length?e.push(t=new o(this.O(zt()),this.O(zt()),this,this.options)):t=e[i],t._$AI(s),i++;i<e.length&&(this._$AR(t&&t._$AB.nextSibling,i),e.length=i)}_$AR(r=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);r!==this._$AB;){let t=r.nextSibling;r.remove(),r=t}}setConnected(r){this._$AM===void 0&&(this._$Cv=r,this._$AP?.(r))}},Ye=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(r,e,t,i,s){this.type=1,this._$AH=S,this._$AN=void 0,this.element=r,this.name=e,this._$AM=i,this.options=s,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=S}_$AI(r,e=this,t,i){let s=this.strings,n=!1;if(s===void 0)r=Ge(this,r,e,0),n=!Ft(r)||r!==this._$AH&&r!==P,n&&(this._$AH=r);else{let a=r,l,p;for(r=s[0],l=0;l<s.length-1;l++)p=Ge(this,a[t+l],e,l),p===P&&(p=this._$AH[l]),n||=!Ft(p)||p!==this._$AH[l],p===S?r=S:r!==S&&(r+=(p??"")+s[l+1]),this._$AH[l]=p}n&&!i&&this.j(r)}j(r){r===S?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,r??"")}},Vr=class extends Ye{constructor(){super(...arguments),this.type=3}j(r){this.element[this.name]=r===S?void 0:r}},Dr=class extends Ye{constructor(){super(...arguments),this.type=4}j(r){this.element.toggleAttribute(this.name,!!r&&r!==S)}},Hr=class extends Ye{constructor(r,e,t,i,s){super(r,e,t,i,s),this.type=5}_$AI(r,e=this){if((r=Ge(this,r,e,0)??S)===P)return;let t=this._$AH,i=r===S&&t!==S||r.capture!==t.capture||r.once!==t.once||r.passive!==t.passive,s=r!==S&&(t===S||i);i&&this.element.removeEventListener(this.name,this,t),s&&this.element.addEventListener(this.name,this,r),this._$AH=r}handleEvent(r){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,r):this._$AH.handleEvent(r)}},zr=class{constructor(r,e,t){this.element=r,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(r){Ge(this,r)}},H={M:Si,P:be,A:Mi,C:1,L:Xs,R:Nr,D:js,V:Ge,I:at,H:Ye,N:Dr,U:Hr,B:Vr,F:zr},vn=Fr.litHtmlPolyfillSupport;vn?.(Ut,at),(Fr.litHtmlVersions??=[]).push("3.3.1");var $i=(o,r,e)=>{let t=e?.renderBefore??r,i=t._$litPart$;if(i===void 0){let s=e?.renderBefore??null;t._$litPart$=i=new at(r.insertBefore(zt(),s),s,void 0,e??{})}return i._$AI(o),i};var Oi=globalThis,v=class extends ge{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let r=super.createRenderRoot();return this.renderOptions.renderBefore??=r.firstChild,r}update(r){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(r),this._$Do=$i(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return P}};v._$litElement$=!0,v.finalized=!0,Oi.litElementHydrateSupport?.({LitElement:v});var yn=Oi.litElementPolyfillSupport;yn?.({LitElement:v});(Oi.litElementVersions??=[]).push("4.2.1");var g=o=>(r,e)=>{e!==void 0?e.addInitializer((()=>{customElements.define(o,r)})):customElements.define(o,r)};var xn={attribute:!0,type:String,converter:Vt,reflect:!1,hasChanged:Or},qn=(o=xn,r,e)=>{let{kind:t,metadata:i}=e,s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),t==="setter"&&((o=Object.create(o)).wrapped=!0),s.set(e.name,o),t==="accessor"){let{name:n}=e;return{set(a){let l=r.get.call(this);r.set.call(this,a),this.requestUpdate(n,l,o)},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(t==="setter"){let{name:n}=e;return function(a){let l=this[n];r.call(this,a),this.requestUpdate(n,l,o)}}throw Error("Unsupported decorator location: "+t)};function u(o){return(r,e)=>typeof e=="object"?qn(o,r,e):((t,i,s)=>{let n=i.hasOwnProperty(s);return i.constructor.createProperty(s,t),n?Object.getOwnPropertyDescriptor(i,s):void 0})(o,r,e)}function E(o){return u({...o,state:!0,attribute:!1})}var Ie=(o,r,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof r!="object"&&Object.defineProperty(o,r,e),e);function lt(o,r){return(e,t,i)=>{let s=n=>n.renderRoot?.querySelector(o)??null;if(r){let{get:n,set:a}=typeof t=="object"?e:i??(()=>{let l=Symbol();return{get(){return this[l]},set(p){this[l]=p}}})();return Ie(e,t,{get(){let l=n.call(this);return l===void 0&&(l=s(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return Ie(e,t,{get(){return s(this)}})}}function Gs(o){return(r,e)=>{let{slot:t,selector:i}=o??{},s="slot"+(t?`[name=${t}]`:":not([name])");return Ie(r,e,{get(){let n=this.renderRoot?.querySelector(s),a=n?.assignedElements(o)??[];return i===void 0?a:a.filter((l=>l.matches(i)))}})}}function jr(o,r){return(e,t)=>{let{connectedCallback:i,disconnectedCallback:s}=e;e.connectedCallback=function(){i.call(this);let n=this[t],a=m=>{let f=[],b=[];for(let q of m)q.type==="childList"&&(q.addedNodes.forEach(T=>{if(T.nodeType!==1)return;let M=T;M.matches?.(o)&&f.push(M),f.push(...M.querySelectorAll?.(o)??[])}),q.removedNodes.forEach(T=>{if(T.nodeType!==1)return;let M=T;M.matches?.(o)&&b.push(M),b.push(...M.querySelectorAll?.(o)??[])}));let y=q=>Array.from(new Set(q)),C=y(f),R=y(b);(C.length||R.length)&&n.call(this,C,R)},l=new MutationObserver(a);l.observe(this,{childList:!0,subtree:!0});let p=this.shadowRoot?new MutationObserver(a):null;p?.observe(this.shadowRoot,{childList:!0,subtree:!0}),this.__lqObservers=[l,p].filter(m=>!!m),(async()=>{r?.waitUntilFirstUpdate&&"updateComplete"in this&&await this.updateComplete;let m=[...this.querySelectorAll(o),...this.shadowRoot?.querySelectorAll(o)??[]];m.length&&n.call(this,m,[])})()},e.disconnectedCallback=function(){s.call(this),this.__lqObservers?.forEach(n=>n.disconnect()),this.__lqObservers=void 0}}}function I(o,r){let e={waitUntilFirstUpdate:!1,...r};return(t,i)=>{let{update:s}=t,n=Array.isArray(o)?o:[o];t.update=function(a){n.forEach(l=>{let p=l;if(a.has(p)){let d=a.get(p),m=this[p];d!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](d,m)}}),s.call(this,a)}}}var $=Symbol("item");var Ys=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}];var G=class extends v{constructor(){super(...arguments);this._templateProcessing=null;this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,t)=>{this._interactionElements.forEach(i=>i.disabled=t)};this._handleReadonlyChange=(e,t)=>this._interactionElements.forEach(i=>i.readonly=t);this._context={variables:Ys};this._initialContext={...this._context,variables:this._context.variables};this._feedbackElements=[];this._interactionElements=[];this._handleRegisterVariable=e=>{e.stopImmediatePropagation(),this._context={...this._context,variables:[...this._context.variables,e.detail.variable]},this._initialContext=this._context,e.stopPropagation()};this._handleRegisterFeedback=e=>{e.stopImmediatePropagation();let t=e.detail;this._feedbackElements.push(t),(Number(this._context.variables.find(s=>s.identifier==="numAttempts")?.value)||0)>0&&t.checkShowFeedback(t.outcomeIdentifier)};this._handleRegisterInteraction=e=>{e.stopImmediatePropagation(),this._interactionElements.push(e.detail.interactionElement)};this._handleEndAttempt=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,countAttempt:i}=e.detail;this.validate(),this.updateResponseVariable(t,"true"),this.processResponse(i)};this._handleSetOutcomeValue=e=>{e.stopImmediatePropagation();let{outcomeIdentifier:t,value:i}=e.detail;this.updateOutcomeVariable(t,i),e.stopPropagation()};this._handleUpdateResponseVariable=e=>{e.stopImmediatePropagation();let{responseIdentifier:t,response:i}=e.detail;this.updateResponseVariable(t,i),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}}get title(){return this._itemTitle}set title(e){this._itemTitle=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}set assessmentItemRefId(e){this._context={...this._context,identifier:e}}get assessmentItemRefId(){return this._context.identifier}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type,...e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context={...this._context,variables:this._context.variables.map(t=>{let i=e.find(s=>s.identifier===t.identifier);return i?{...t,...i,interpolationTable:t.interpolationTable}:t})},this._context.variables.forEach(t=>{if(t.type==="response"){let i=this._interactionElements.find(s=>s.responseIdentifier===t.identifier);i&&(i.response=t.value)}}),this.variables.forEach(t=>{t.type==="outcome"&&this._feedbackElements.forEach(i=>i.checkShowFeedback(t.identifier))})}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let s=this._interactionElements.find(n=>n.getAttribute("response-identifier")===t.responseIdentifier);s&&(s.response=t.response)}}render(){return h`<slot></slot>`}connectedCallback(){this._attachEventListeners(),super.connectedCallback(),this.updateComplete.then(()=>{this._processTemplates(),this.dispatchEvent(new CustomEvent("qti-assessment-item-connected",{bubbles:!0,composed:!0,detail:this}))})}disconnectedCallback(){this._removeEventListeners(),super.disconnectedCallback()}_attachEventListeners(){this.addEventListener("qti-register-variable",this._handleRegisterVariable),this.addEventListener("qti-register-feedback",this._handleRegisterFeedback),this.addEventListener("qti-register-interaction",this._handleRegisterInteraction),this.addEventListener("end-attempt",this._handleEndAttempt),this.addEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.addEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}_removeEventListeners(){this.removeEventListener("qti-register-variable",this._handleRegisterVariable),this.removeEventListener("qti-register-feedback",this._handleRegisterFeedback),this.removeEventListener("qti-register-interaction",this._handleRegisterInteraction),this.removeEventListener("end-attempt",this._handleEndAttempt),this.removeEventListener("qti-set-outcome-value",this._handleSetOutcomeValue),this.removeEventListener("qti-interaction-response",this._handleUpdateResponseVariable)}showCorrectResponse(e){for(let t of this._interactionElements)t.toggleCorrectResponse(e);document.querySelectorAll("item-show-correct-response").forEach(t=>{t.shown=e})}showCandidateCorrection(e){for(let t of this._interactionElements)t.toggleCandidateCorrection(e);document.querySelectorAll("item-show-candidate-correction").forEach(t=>{t.shown=e})}_processTemplates(){this._templateProcessing=this.querySelector("qti-template-processing"),this._templateProcessing&&this._templateProcessing.process()}processResponse(e=!0,t=!0){this.validate(t),e&&this.updateOutcomeVariable("numAttempts",(+this._context.variables.find(s=>s.identifier==="numAttempts")?.value+1).toString());let i=this.querySelector("qti-response-processing");return!i||!i.process?!1:(i.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}})),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(t=>t.identifier===e)||null}updateResponseVariable(e,t){this._context={...this._context,variables:this._context.variables.map(i=>i.identifier!==e?i:{...i,value:t})},this.showCandidateCorrection(!1),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,responseIdentifier:e,response:Array.isArray(t)?[...t]:t}})),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}setOutcomeVariable(e,t){this.updateOutcomeVariable(e,t),this.dispatchEvent(new CustomEvent("qti-item-context-updated",{bubbles:!0,composed:!0,detail:{itemContext:this._context}}))}updateOutcomeVariable(e,t){let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context={...this._context,variables:this._context.variables.map(s=>s.identifier!==e?s:{...s,value:i.cardinality==="single"||Array.isArray(t)?t:[t]})},this._feedbackElements.forEach(s=>s.checkShowFeedback(e)),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:this._context.variables.find(s=>s.identifier===e)?.value}}))}validate(e=!0){let t=this._interactionElements.every(i=>i.validate());return e&&this.reportValidity(),t}reportValidity(){for(let e of this._interactionElements)e.reportValidity()}_getCompletionStatus(){let e=this.validate(!1);return e===!0?"completed":e===!1?"incomplete":"not_attempted"}};c([u({type:String})],G.prototype,"identifier",2),c([u({type:String})],G.prototype,"adaptive",2),c([u({type:String})],G.prototype,"timeDependent",2),c([u({type:String})],G.prototype,"title",1),c([u({type:Boolean})],G.prototype,"disabled",2),c([I("disabled",{waitUntilFirstUpdate:!0})],G.prototype,"_handleDisabledChange",2),c([u({type:Boolean})],G.prototype,"readonly",2),c([I("readonly",{waitUntilFirstUpdate:!0})],G.prototype,"_handleReadonlyChange",2),c([X({context:$})],G.prototype,"_context",2),G=c([g("qti-assessment-item")],G);var En=String.raw,Cn=En`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
5
  <xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
6
6
  <xsl:template match="@*|node()">
7
7
  <xsl:copy>
@@ -23,7 +23,7 @@ Make sure to test your application with a production build as repeat registratio
23
23
  <xsl:apply-templates/>
24
24
  </xsl:element>
25
25
  </xsl:template>
26
- </xsl:stylesheet>`;function Js(o,r,e){o.querySelectorAll(r).forEach(t=>{let i=`${r}-${e}`,s=Zs(t,i);t.replaceWith(s)})}function Ks(o,r){o.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let s=i.slice(`${r}:`.length),n=`${e.nodeName}-${s}`,a=Zs(e,n);e.replaceWith(a)}})})}function Zs(o,r){let e=document.createElement(r);for(let t of o.attributes)e.setAttribute(t.name,t.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function Qs(o){let r=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),s=e.getAttribute("category");r.push({identifier:t,href:i,category:s})}),r}function jt(o){let r=new XMLHttpRequest;return{promise:new Promise((t,i)=>{r.open("GET",o,!0),r.responseType="document",r.onload=()=>{r.status>=200&&r.status<300?t(r.responseXML):i(r.statusText)},r.onerror=()=>{i(r.statusText)},r.send()}),xhr:r}}function Bt(o){return new DOMParser().parseFromString(o,"text/xml")}function ct(o){let r=new XSLTProcessor,e=new DOMParser().parseFromString(Cn,"text/xml");return r.importStylesheet(e),r.transformToFragment(o,document)}function pt(o,r){r.endsWith("/")||(r+="/"),o.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let t="";e.getAttribute("src")&&(t="src"),e.getAttribute("href")&&(t="href"),e.getAttribute("primary-path")&&(t="primary-path");let i=e.getAttribute(t)?.trim();if(!/^(data:|https?:|blob:)/.test(i)){let s=r+encodeURI(i);e.setAttribute(t,s)}})}function eo(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function to(o){o.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function ro(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:}}var Je=(o=!1)=>{let r,e="",t={load(i){e=i;let s=encodeURI(i);if(o&&sessionStorage.getItem(s))return{promise:Promise.resolve(t.parse(sessionStorage.getItem(s))),request:null};let{promise:n,xhr:a}=jt(i);return{promise:new Promise(p=>{n.then(d=>(r=d,t.shuffleInteractions(),o&&sessionStorage.setItem(s,new XMLSerializer().serializeToString(r)),p(t)))}),request:a}},parse(i){return r=Bt(i),t},path:i=>(pt(r,i),e=null,t),fn(i){return i(r),t},pciHooks(i){let s=["hook","module"],n=i.substring(0,i.lastIndexOf("/"));for(let a of s)r.querySelectorAll("["+a+"]").forEach(p=>{let d=p.getAttribute(a);!d.startsWith("data:")&&!d.startsWith("http")&&(p.setAttribute("base-url",i),p.setAttribute("module",n+"/"+encodeURI(d+(d.endsWith(".js")?"":".js"))))});return t},async configurePci(i,s,n="qti-portable-custom-interaction"){let a=[],l=r.querySelectorAll(n),p=await s(i,"/modules/module_resolution.js"),d=await s(i,"/modules/fallback_module_resolution.js");if(l.length>0)for(let m of Array.from(l)){m.setAttribute("data-base-url",i);let f=m.getAttribute("custom-interaction-type-identifier");f&&a.includes(f)&&(f=f+a.length,m.setAttribute("custom-interaction-type-identifier",f),a.push(f)),f&&a.push(f);let b=m.querySelector("qti-interaction-modules");if(b&&b.getAttribute("primary-configuration")){let y=b.getAttribute("primary-configuration");if(y)try{let C=await s(i,`/${y}`),R=Array.from(b.querySelectorAll("qti-interaction-module"));for(let q of R){let T=q.getAttribute("id");if(T&&C.paths&&C.paths[T]){let M=C.paths[T],N=Array.isArray(M)?M[0]:M;if(q.setAttribute("primary-path",N),d&&d.paths&&d.paths[T]){let V=d.paths[T];Array.isArray(V)?q.setAttribute("fallback-path",V[0]):q.setAttribute("fallback-path",V)}}}if(C.paths){for(let q in C.paths)if(!b.querySelector(`qti-interaction-module[id="${q}"]`)){let M=r.createElement("qti-interaction-module");M.setAttribute("id",q);let N=Array.isArray(C.paths[q])?C.paths[q][0]:C.paths[q];if(M.setAttribute("primary-path",N),d&&d.paths&&d.paths[q]){let V=d.paths[q];Array.isArray(V)?M.setAttribute("fallback-path",V[0]):M.setAttribute("fallback-path",V)}b.appendChild(M)}}C.urlArgs&&b.setAttribute("url-args",C.urlArgs)}catch(C){console.warn(`Failed to load primary configuration: ${y}`,C)}}else if(p){m.querySelector("qti-interaction-modules")===null?(b=r.createElement("qti-interaction-modules"),m.appendChild(b)):b=m.querySelector("qti-interaction-modules");for(let y in p.paths){let C=p.paths[y],R="";d&&d.paths&&d.paths[y]&&(R=d.paths[y]);let q=Array.isArray(C)?C:[C],T=Array.isArray(R)?R:[R],M=q.map((N,V)=>{let tn=T.length>V?T[V]:"";return{primaryPath:N,fallbackPath:tn}});for(let N of T)M.some(V=>V.fallbackPath===N)||M.push({primaryPath:q.length>0?q[0]:N,fallbackPath:N});for(let N of M){let V=r.createElement("qti-interaction-module");N.fallbackPath&&V.setAttribute("fallback-path",N.fallbackPath),V.setAttribute("id",y),V.setAttribute("primary-path",N.primaryPath),b&&b.appendChild(V)}}}}return t},shuffleInteractions(){let i=r.querySelectorAll('[shuffle="true"]'),s=Array.from(i).filter(n=>n.tagName?.toLowerCase().endsWith("-interaction"));for(let n of s){let a=ro(n.tagName.toLowerCase()),l=Array.isArray(a)?a:[a];for(let p of l){let d=Array.from(n.querySelectorAll(p)),m=d.map((q,T)=>({element:q,fixed:q.hasAttribute("fixed")&&q.getAttribute("fixed")==="true",originalOrder:T})).filter(q=>q.fixed),f=d.filter(q=>!q.hasAttribute("fixed")||q.getAttribute("fixed")!=="true");if(f.length<=1)return console.warn("Shuffling is not possible with fewer than 2 non-fixed elements."),t;let b=[...f],y=!1,C=0;for(;!y&&C<20;){C++;for(let q=f.length-1;q>0;q--){let T=Math.floor(Math.random()*(q+1));[f[q],f[T]]=[f[T],f[q]]}y=!f.every((q,T)=>q===b[T])}if(!y)return console.warn("Failed to shuffle the choices after multiple attempts."),null;n.removeAttribute("shuffle");let R=0;for(let q of f)q.parentElement.insertBefore(q,m[R]?.element),R++;for(let q of m)q.element.parentElement.insertBefore(q.element,f[q.originalOrder])}}return t},extendElementName:(i,s)=>(Js(r,i,s),t),extendElementsWithClass:(i="extend")=>(Ks(r,i),t),customInteraction(i,s){let n=r.querySelector("qti-custom-interaction"),a=n.querySelector("object");return n.setAttribute("data-base-ref",i),n.setAttribute("data-base-item",i+s),n.setAttribute("data",a.getAttribute("data")),n.setAttribute("width",a.getAttribute("width")),n.setAttribute("height",a.getAttribute("height")),n.removeChild(a),t},convertCDATAtoComment(){return eo(r),t},stripStyleSheets(){return to(r),t},html(){return e!==null&&pt(r,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(ct(r))},xml(){return new XMLSerializer().serializeToString(r)},htmlDoc(){return e!==null&&pt(r,e.substring(0,e.lastIndexOf("/"))),ct(r)},xmlDoc(){return r}};return t};var Oi=()=>{let o,r={async load(e){return new Promise((t,i)=>{jt(e).promise.then(s=>(o=s,r.path(e.substring(0,e.lastIndexOf("/"))),t(r)))})},parse(e){return o=Bt(e),r},path:e=>(pt(o,e),r),fn(e){return e(o),r},items(){return Qs(o)},html(){return new XMLSerializer().serializeToString(ct(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(){return ct(o)},xmlDoc(){return o}};return r};var dt=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let e=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0,composed:!0});if(this.dispatchEvent(e)){let s=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);s?await this.updateStimulusRef(s):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async updateStimulusRef(e){let t=await Je().load(this.href).promise.then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};c([u({type:String})],dt.prototype,"identifier",2),c([u({type:String})],dt.prototype,"href",2),dt=c([g("qti-assessment-stimulus-ref")],dt);var Br=class extends v{};Br=c([g("qti-companion-materials-info")],Br);var Wt=class extends v{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let r=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",r?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let r={variable:t=>this._context?.variables.find(i=>i.identifier===t)?.value??"",correct:t=>this._context?.variables.find(i=>i.identifier===t)?.correctResponse??""},e={getVariable:t=>this._context?.variables.find(i=>i.identifier===t),updateOutcomeVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:i}}))},updateResponseVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,response:i}}))}};return this.operatorFunction(this._context,r,e)}};c([_({context:$,subscribe:!0}),E()],Wt.prototype,"_context",2),Wt=c([g("qti-custom-operator")],Wt);var wn=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Xt=o=>{if(typeof o=="string")return o;let r=wn();return r==="."?o.toLocaleString():o.toString().replace(".","").replace(r,".")};function Ni(o){return o==null}function Ke(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Y=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(r){let e=this._context.variables.find(i=>i.identifier===r)||null;if(this.outcomeIdentifier!==r||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!Ni(this.identifier)&&!Ni(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(r){this.showStatus=r&&this.showHide==="show"||!r&&this.showHide==="hide"?"on":"off"}};c([u({type:String,attribute:"show-hide"})],Y.prototype,"showHide",2),c([u({type:String,attribute:"outcome-identifier"})],Y.prototype,"outcomeIdentifier",2),c([u({type:String})],Y.prototype,"identifier",2),c([u({type:String,attribute:!1})],Y.prototype,"showStatus",2),c([_({context:$,subscribe:!0}),E()],Y.prototype,"_context",2);var Gt=class extends Y{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Gt.styles=x`
26
+ </xsl:stylesheet>`;function Js(o,r,e){o.querySelectorAll(r).forEach(t=>{let i=`${r}-${e}`,s=Zs(t,i);t.replaceWith(s)})}function Ks(o,r){o.querySelectorAll("*").forEach(e=>{let t=e.classList;t&&t.forEach(i=>{if(i.startsWith(`${r}:`)){let s=i.slice(`${r}:`.length),n=`${e.nodeName}-${s}`,a=Zs(e,n);e.replaceWith(a)}})})}function Zs(o,r){let e=document.createElement(r);for(let t of o.attributes)e.setAttribute(t.name,t.value);for(;o.firstChild;)e.appendChild(o.firstChild);return e}function Qs(o){let r=[];return o.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let t=e.getAttribute("identifier"),i=e.getAttribute("href"),s=e.getAttribute("category");r.push({identifier:t,href:i,category:s})}),r}function jt(o){let r=new XMLHttpRequest;return{promise:new Promise((t,i)=>{r.open("GET",o,!0),r.responseType="document",r.onload=()=>{r.status>=200&&r.status<300?t(r.responseXML):i(r.statusText)},r.onerror=()=>{i(r.statusText)},r.send()}),xhr:r}}function Bt(o){return new DOMParser().parseFromString(o,"text/xml")}function ct(o){let r=new XSLTProcessor,e=new DOMParser().parseFromString(Cn,"text/xml");return r.importStylesheet(e),r.transformToFragment(o,document)}function pt(o,r){r.endsWith("/")||(r+="/"),o.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{let t="";e.getAttribute("src")&&(t="src"),e.getAttribute("href")&&(t="href"),e.getAttribute("primary-path")&&(t="primary-path");let i=e.getAttribute(t)?.trim();if(!/^(data:|https?:|blob:)/.test(i)){let s=r+encodeURI(i);e.setAttribute(t,s)}})}function eo(o){o.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let t=document.createComment(e.textContent);e.replaceChild(t,e.firstChild)})}function to(o){o.querySelectorAll("qti-stylesheet").forEach(r=>r.remove())}function ro(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:}}var Je=(o=!1)=>{let r,e="",t={load(i){e=i;let s=encodeURI(i);if(o&&sessionStorage.getItem(s))return{promise:Promise.resolve(t.parse(sessionStorage.getItem(s))),request:null};let{promise:n,xhr:a}=jt(i);return{promise:new Promise(p=>{n.then(d=>(r=d,t.shuffleInteractions(),o&&sessionStorage.setItem(s,new XMLSerializer().serializeToString(r)),p(t)))}),request:a}},parse(i){return r=Bt(i),t},path:i=>(pt(r,i),e=null,t),fn(i){return i(r),t},pciHooks(i){let s=["hook","module"],n=i.substring(0,i.lastIndexOf("/"));for(let a of s)r.querySelectorAll("["+a+"]").forEach(p=>{let d=p.getAttribute(a);!d.startsWith("data:")&&!d.startsWith("http")&&(p.setAttribute("base-url",i),p.setAttribute("module",n+"/"+encodeURI(d+(d.endsWith(".js")?"":".js"))))});return t},async configurePci(i,s,n="qti-portable-custom-interaction"){let a=[],l=r.querySelectorAll(n),p=await s(i,"/modules/module_resolution.js"),d=await s(i,"/modules/fallback_module_resolution.js");if(l.length>0)for(let m of Array.from(l)){m.setAttribute("data-base-url",i);let f=m.getAttribute("custom-interaction-type-identifier");f&&a.includes(f)&&(f=f+a.length,m.setAttribute("custom-interaction-type-identifier",f),a.push(f)),f&&a.push(f);let b=m.querySelector("qti-interaction-modules");if(b&&b.getAttribute("primary-configuration")){let y=b.getAttribute("primary-configuration");if(y)try{let C=await s(i,`/${y}`),R=Array.from(b.querySelectorAll("qti-interaction-module"));for(let q of R){let T=q.getAttribute("id");if(T&&C.paths&&C.paths[T]){let M=C.paths[T],N=Array.isArray(M)?M[0]:M;if(q.setAttribute("primary-path",N),d&&d.paths&&d.paths[T]){let V=d.paths[T];Array.isArray(V)?q.setAttribute("fallback-path",V[0]):q.setAttribute("fallback-path",V)}}}if(C.paths){for(let q in C.paths)if(!b.querySelector(`qti-interaction-module[id="${q}"]`)){let M=r.createElement("qti-interaction-module");M.setAttribute("id",q);let N=Array.isArray(C.paths[q])?C.paths[q][0]:C.paths[q];if(M.setAttribute("primary-path",N),d&&d.paths&&d.paths[q]){let V=d.paths[q];Array.isArray(V)?M.setAttribute("fallback-path",V[0]):M.setAttribute("fallback-path",V)}b.appendChild(M)}}C.urlArgs&&b.setAttribute("url-args",C.urlArgs)}catch(C){console.warn(`Failed to load primary configuration: ${y}`,C)}}else if(p){m.querySelector("qti-interaction-modules")===null?(b=r.createElement("qti-interaction-modules"),m.appendChild(b)):b=m.querySelector("qti-interaction-modules");for(let y in p.paths){let C=p.paths[y],R="";d&&d.paths&&d.paths[y]&&(R=d.paths[y]);let q=Array.isArray(C)?C:[C],T=Array.isArray(R)?R:[R],M=q.map((N,V)=>{let tn=T.length>V?T[V]:"";return{primaryPath:N,fallbackPath:tn}});for(let N of T)M.some(V=>V.fallbackPath===N)||M.push({primaryPath:q.length>0?q[0]:N,fallbackPath:N});for(let N of M){let V=r.createElement("qti-interaction-module");N.fallbackPath&&V.setAttribute("fallback-path",N.fallbackPath),V.setAttribute("id",y),V.setAttribute("primary-path",N.primaryPath),b&&b.appendChild(V)}}}}return t},shuffleInteractions(){let i=r.querySelectorAll('[shuffle="true"]'),s=Array.from(i).filter(n=>n.tagName?.toLowerCase().endsWith("-interaction"));for(let n of s){let a=ro(n.tagName.toLowerCase()),l=Array.isArray(a)?a:[a];for(let p of l){let d=Array.from(n.querySelectorAll(p)),m=d.map((q,T)=>({element:q,fixed:q.hasAttribute("fixed")&&q.getAttribute("fixed")==="true",originalOrder:T})).filter(q=>q.fixed),f=d.filter(q=>!q.hasAttribute("fixed")||q.getAttribute("fixed")!=="true");if(f.length<=1)return console.warn("Shuffling is not possible with fewer than 2 non-fixed elements."),t;let b=[...f],y=!1,C=0;for(;!y&&C<20;){C++;for(let q=f.length-1;q>0;q--){let T=Math.floor(Math.random()*(q+1));[f[q],f[T]]=[f[T],f[q]]}y=!f.every((q,T)=>q===b[T])}if(!y)return console.warn("Failed to shuffle the choices after multiple attempts."),null;n.removeAttribute("shuffle");let R=0;for(let q of f)q.parentElement.insertBefore(q,m[R]?.element),R++;for(let q of m)q.element.parentElement.insertBefore(q.element,f[q.originalOrder])}}return t},extendElementName:(i,s)=>(Js(r,i,s),t),extendElementsWithClass:(i="extend")=>(Ks(r,i),t),customInteraction(i,s){let n=r.querySelector("qti-custom-interaction"),a=n.querySelector("object");return n.setAttribute("data-base-ref",i),n.setAttribute("data-base-item",i+s),n.setAttribute("data",a.getAttribute("data")),n.setAttribute("width",a.getAttribute("width")),n.setAttribute("height",a.getAttribute("height")),n.removeChild(a),t},convertCDATAtoComment(){return eo(r),t},stripStyleSheets(){return to(r),t},html(){return e!==null&&pt(r,e.substring(0,e.lastIndexOf("/"))),new XMLSerializer().serializeToString(ct(r))},xml(){return new XMLSerializer().serializeToString(r)},htmlDoc(){return e!==null&&pt(r,e.substring(0,e.lastIndexOf("/"))),ct(r)},xmlDoc(){return r}};return t};var Pi=()=>{let o,r={async load(e){return new Promise((t,i)=>{jt(e).promise.then(s=>(o=s,r.path(e.substring(0,e.lastIndexOf("/"))),t(r)))})},parse(e){return o=Bt(e),r},path:e=>(pt(o,e),r),fn(e){return e(o),r},items(){return Qs(o)},html(){return new XMLSerializer().serializeToString(ct(o))},xml(){return new XMLSerializer().serializeToString(o)},htmlDoc(){return ct(o)},xmlDoc(){return o}};return r};var dt=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let e=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0,composed:!0});if(this.dispatchEvent(e)){let s=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);s?await this.updateStimulusRef(s):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async updateStimulusRef(e){let t=await Je().load(this.href).promise.then(i=>i.htmlDoc());if(t){let i=t.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...i)}}};c([u({type:String})],dt.prototype,"identifier",2),c([u({type:String})],dt.prototype,"href",2),dt=c([g("qti-assessment-stimulus-ref")],dt);var Br=class extends v{};Br=c([g("qti-companion-materials-info")],Br);var Wt=class extends v{render(){return h`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(){let r=Array.from(this.firstElementChild?.childNodes??[]).find(e=>e.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",r?.textContent??"")}catch(e){console.error("custom-operator contains invalid javascript code",e)}}calculate(){let r={variable:t=>this._context?.variables.find(i=>i.identifier===t)?.value??"",correct:t=>this._context?.variables.find(i=>i.identifier===t)?.correctResponse??""},e={getVariable:t=>this._context?.variables.find(i=>i.identifier===t),updateOutcomeVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:i}}))},updateResponseVariable:(t,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:t,response:i}}))}};return this.operatorFunction(this._context,r,e)}};c([_({context:$,subscribe:!0}),E()],Wt.prototype,"_context",2),Wt=c([g("qti-custom-operator")],Wt);var wn=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Xt=o=>{if(typeof o=="string")return o;let r=wn();return r==="."?o.toLocaleString():o.toString().replace(".","").replace(r,".")};function Ni(o){return o==null}function Ke(o){return o.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var Y=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(r){let e=this._context.variables.find(i=>i.identifier===r)||null;if(this.outcomeIdentifier!==r||!e)return;let t=!1;Array.isArray(e.value)?t=e.value.includes(this.identifier):t=!Ni(this.identifier)&&!Ni(e?.value)&&this.identifier===e.value||!1,this.showFeedback(t)}showFeedback(r){this.showStatus=r&&this.showHide==="show"||!r&&this.showHide==="hide"?"on":"off"}};c([u({type:String,attribute:"show-hide"})],Y.prototype,"showHide",2),c([u({type:String,attribute:"outcome-identifier"})],Y.prototype,"outcomeIdentifier",2),c([u({type:String})],Y.prototype,"identifier",2),c([u({type:String,attribute:!1})],Y.prototype,"showStatus",2),c([_({context:$,subscribe:!0}),E()],Y.prototype,"_context",2);var Gt=class extends Y{render(){return h` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}connectedCallback(){super.connectedCallback(),this.checkShowFeedback(this.outcomeIdentifier)}};Gt.styles=x`
27
27
  :host {
28
28
  display: block;
29
29
  }
@@ -209,7 +209,7 @@ Make sure to test your application with a production build as repeat registratio
209
209
  <slot part="prompt" name="prompt"></slot>
210
210
  <slot part="slot" @slotchange=${this._handleSlotChange}></slot>
211
211
  <div part="message" role="alert" id="validation-message"></div>
212
- `}};mt.styles=no,c([u({type:String})],mt.prototype,"orientation",2),mt=c([g("qti-choice-interaction")],mt);var ye=class extends A{constructor(){super();this.rawResponse="";this._errorMessage=null;this.handlePostMessage=this.handlePostMessage.bind(this)}connectedCallback(){super.connectedCallback();let e=this.data.startsWith("http")||this.data.startsWith("blob")?this.data:Ke(this.baseItemUrl+"/"+this.data);fetch(e).then(t=>t.json()).then(t=>{this.manifest=t,this.setupCES()}).catch(t=>{this._errorMessage=t})}setupCES(){let t=this.shadowRoot.querySelector("#pciContainer").contentDocument;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 i=this.manifest.style[0],s=i.startsWith("http")||i.startsWith("blob")?i:Ke(`${this.baseRefUrl}/${i}`),n=this.manifest.script[0],a=n.startsWith("http")||n.startsWith("blob")?n:Ke(`${this.baseRefUrl}/${n}`);window.addEventListener("message",this.handlePostMessage),t.open(),t.write(`
212
+ `}};mt.styles=no,c([u({type:String})],mt.prototype,"orientation",2),mt=c([g("qti-choice-interaction")],mt);var ve=class extends A{constructor(){super();this.rawResponse="";this._errorMessage=null;this.handlePostMessage=this.handlePostMessage.bind(this)}connectedCallback(){super.connectedCallback();let e=this.data.startsWith("http")||this.data.startsWith("blob")?this.data:Ke(this.baseItemUrl+"/"+this.data);fetch(e).then(t=>t.json()).then(t=>{this.manifest=t,this.setupCES()}).catch(t=>{this._errorMessage=t})}setupCES(){let t=this.shadowRoot.querySelector("#pciContainer").contentDocument;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 i=this.manifest.style[0],s=i.startsWith("http")||i.startsWith("blob")?i:Ke(`${this.baseRefUrl}/${i}`),n=this.manifest.script[0],a=n.startsWith("http")||n.startsWith("blob")?n:Ke(`${this.baseRefUrl}/${n}`);window.addEventListener("message",this.handlePostMessage),t.open(),t.write(`
213
213
  <html>
214
214
  <head>
215
215
  <link href='${s}' rel="stylesheet" />
@@ -228,7 +228,7 @@ Make sure to test your application with a production build as repeat registratio
228
228
  ${this._errorMessage&&h`<div style="color:red">
229
229
  <h1>Error</h1>
230
230
  ${this._errorMessage}
231
- </div>`}`}};c([u({type:String,attribute:"data"})],ye.prototype,"data",2),c([u({type:String,attribute:"data-base-item"})],ye.prototype,"baseItemUrl",2),c([u({type:String,attribute:"data-base-ref"})],ye.prototype,"baseRefUrl",2),c([u({type:String,attribute:"id"})],ye.prototype,"id",2),c([E()],ye.prototype,"_errorMessage",2),ye=c([g("qti-custom-interaction")],ye);var $e=class extends v{constructor(){super(...arguments);this.disabled=!1;this.countAttempt=null;this.title="end attempt"}render(){return h`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};c([u({type:String,attribute:"response-identifier"})],$e.prototype,"responseIdentifier",2),c([u({reflect:!0,type:Boolean})],$e.prototype,"disabled",2),c([u({type:String,attribute:"count-attempt"})],$e.prototype,"countAttempt",2),c([u({type:String})],$e.prototype,"title",2),$e=c([g("qti-end-attempt-interaction")],$e);var ao=x`
231
+ </div>`}`}};c([u({type:String,attribute:"data"})],ve.prototype,"data",2),c([u({type:String,attribute:"data-base-item"})],ve.prototype,"baseItemUrl",2),c([u({type:String,attribute:"data-base-ref"})],ve.prototype,"baseRefUrl",2),c([u({type:String,attribute:"id"})],ve.prototype,"id",2),c([E()],ve.prototype,"_errorMessage",2),ve=c([g("qti-custom-interaction")],ve);var $e=class extends v{constructor(){super(...arguments);this.disabled=!1;this.countAttempt=null;this.title="end attempt"}render(){return h`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};c([u({type:String,attribute:"response-identifier"})],$e.prototype,"responseIdentifier",2),c([u({reflect:!0,type:Boolean})],$e.prototype,"disabled",2),c([u({type:String,attribute:"count-attempt"})],$e.prototype,"countAttempt",2),c([u({type:String})],$e.prototype,"title",2),$e=c([g("qti-end-attempt-interaction")],$e);var ao=x`
232
232
  /* PK: display host as block, else design will be collapsed */
233
233
  :host {
234
234
  display: block;
@@ -307,7 +307,7 @@ Make sure to test your application with a production build as repeat registratio
307
307
  display: flex;
308
308
  user-select: none;
309
309
  }
310
- `,c([u({type:Number,reflect:!0})],gt.prototype,"tabindex",2),gt=c([g("qti-gap")],gt);var Pe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ee=o=>(...r)=>({_$litDirective$:o,values:r}),le=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var{I:_n}=H,uo=o=>o===null||typeof o!="object"&&typeof o!="function";var mo=o=>o.strings===void 0,po=()=>document.createComment(""),bt=(o,r,e)=>{let t=o._$AA.parentNode,i=r===void 0?o._$AB:r._$AA;if(e===void 0){let s=t.insertBefore(po(),i),n=t.insertBefore(po(),i);e=new _n(s,n,o,o.options)}else{let s=e._$AB.nextSibling,n=e._$AM,a=n!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==n._$AU&&e._$AP(l)}if(s!==i||a){let l=e._$AA;for(;l!==s;){let p=l.nextSibling;t.insertBefore(l,i),l=p}}}return e},Oe=(o,r,e=o)=>(o._$AI(r,e),o),Tn={},ho=(o,r=Tn)=>o._$AH=r,fo=o=>o._$AH,Wr=o=>{o._$AR(),o._$AA.remove()};var go=(o,r,e)=>{let t=new Map;for(let i=r;i<=e;i++)t.set(o[i],i);return t},vt=ee(class extends le{constructor(o){if(super(o),o.type!==Pe.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,r,e){let t;e===void 0?e=r:r!==void 0&&(t=r);let i=[],s=[],n=0;for(let a of o)i[n]=t?t(a,n):n,s[n]=e(a,n),n++;return{values:s,keys:i}}render(o,r,e){return this.dt(o,r,e).values}update(o,[r,e,t]){let i=fo(o),{values:s,keys:n}=this.dt(r,e,t);if(!Array.isArray(i))return this.ut=n,s;let a=this.ut??=[],l=[],p,d,m=0,f=i.length-1,b=0,y=s.length-1;for(;m<=f&&b<=y;)if(i[m]===null)m++;else if(i[f]===null)f--;else if(a[m]===n[b])l[b]=Oe(i[m],s[b]),m++,b++;else if(a[f]===n[y])l[y]=Oe(i[f],s[y]),f--,y--;else if(a[m]===n[y])l[y]=Oe(i[m],s[y]),bt(o,l[y+1],i[m]),m++,y--;else if(a[f]===n[b])l[b]=Oe(i[f],s[b]),bt(o,i[m],i[f]),f--,b++;else if(p===void 0&&(p=go(n,b,y),d=go(a,m,f)),p.has(a[m]))if(p.has(a[f])){let C=d.get(n[b]),R=C!==void 0?i[C]:null;if(R===null){let q=bt(o,i[m]);Oe(q,s[b]),l[b]=q}else l[b]=Oe(R,s[b]),bt(o,i[m],R),i[C]=null;b++}else Wr(i[f]),f--;else Wr(i[m]),m++;for(;b<=y;){let C=bt(o,l[y+1]);Oe(C,s[b]),l[b++]=C}for(;m<=f;){let C=i[m++];C!==null&&Wr(C)}return this.ut=n,ho(o,l),O}});function Ne(o,r,e,t){let i=e.getAttribute("width")?parseFloat(e.getAttribute("width")):e.naturalWidth,s=e.getAttribute("height")?parseFloat(e.getAttribute("height")):e.naturalHeight;switch(o){case"circle":{if(r.length!==3){console.error("Invalid circle coordinates:",r);return}let[n,a,l]=r,p=n/i*100,d=a/s*100,m=l/i*100,f=l/s*100;t.style.left=p-m+"%",t.style.top=d-f+"%",t.style.width=2*m+"%",t.style.height=2*f+"%",t.style.borderRadius="50%"}break;case"rect":{if(r.length!==4){console.error("Invalid rectangle coordinates:",r);return}let[n,a,l,p]=r,d=n/i*100,m=a/s*100,f=l/i*100,b=p/s*100;t.style.left=d+"%",t.style.top=m+"%",t.style.width=f-d+"%",t.style.height=b-m+"%"}break;case"ellipse":{if(r.length!==4){console.error("Invalid ellipse coordinates:",r);return}let[n,a,l,p]=r,d=n/i*100,m=a/s*100,f=l/i*100,b=p/s*100;t.style.left=d-f+"%",t.style.top=m-b+"%",t.style.width=2*f+"%",t.style.height=2*b+"%",t.style.borderRadius="50%"}break;case"poly":{if(r.length<6||r.length%2!==0){console.error("Invalid polygon coordinates:",r);return}let n=[];for(let q=0;q<r.length;q+=2)n.push({x:r[q],y:r[q+1]});let a=Math.min(...n.map(q=>q.x)),l=Math.max(...n.map(q=>q.x)),p=Math.min(...n.map(q=>q.y)),d=Math.max(...n.map(q=>q.y)),m=a/i*100,f=p/s*100,b=l/i*100,y=d/s*100;t.style.left=m+"%",t.style.top=f+"%",t.style.width=b-m+"%",t.style.height=y-f+"%";let R=n.map(q=>({x:(q.x-a)/(l-a)*100,y:(q.y-p)/(d-p)*100})).map(q=>`${q.x}% ${q.y}%`).join(",");t.style.clipPath=`polygon(${R})`}break;default:console.error(`Unsupported shape: ${o}`);break}}var bo=x`
310
+ `,c([u({type:Number,reflect:!0})],gt.prototype,"tabindex",2),gt=c([g("qti-gap")],gt);var Oe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ee=o=>(...r)=>({_$litDirective$:o,values:r}),le=class{constructor(r){}get _$AU(){return this._$AM._$AU}_$AT(r,e,t){this._$Ct=r,this._$AM=e,this._$Ci=t}_$AS(r,e){return this.update(r,e)}update(r,e){return this.render(...e)}};var{I:_n}=H,uo=o=>o===null||typeof o!="object"&&typeof o!="function";var mo=o=>o.strings===void 0,po=()=>document.createComment(""),bt=(o,r,e)=>{let t=o._$AA.parentNode,i=r===void 0?o._$AB:r._$AA;if(e===void 0){let s=t.insertBefore(po(),i),n=t.insertBefore(po(),i);e=new _n(s,n,o,o.options)}else{let s=e._$AB.nextSibling,n=e._$AM,a=n!==o;if(a){let l;e._$AQ?.(o),e._$AM=o,e._$AP!==void 0&&(l=o._$AU)!==n._$AU&&e._$AP(l)}if(s!==i||a){let l=e._$AA;for(;l!==s;){let p=l.nextSibling;t.insertBefore(l,i),l=p}}}return e},Pe=(o,r,e=o)=>(o._$AI(r,e),o),Tn={},ho=(o,r=Tn)=>o._$AH=r,fo=o=>o._$AH,Wr=o=>{o._$AR(),o._$AA.remove()};var go=(o,r,e)=>{let t=new Map;for(let i=r;i<=e;i++)t.set(o[i],i);return t},vt=ee(class extends le{constructor(o){if(super(o),o.type!==Oe.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,r,e){let t;e===void 0?e=r:r!==void 0&&(t=r);let i=[],s=[],n=0;for(let a of o)i[n]=t?t(a,n):n,s[n]=e(a,n),n++;return{values:s,keys:i}}render(o,r,e){return this.dt(o,r,e).values}update(o,[r,e,t]){let i=fo(o),{values:s,keys:n}=this.dt(r,e,t);if(!Array.isArray(i))return this.ut=n,s;let a=this.ut??=[],l=[],p,d,m=0,f=i.length-1,b=0,y=s.length-1;for(;m<=f&&b<=y;)if(i[m]===null)m++;else if(i[f]===null)f--;else if(a[m]===n[b])l[b]=Pe(i[m],s[b]),m++,b++;else if(a[f]===n[y])l[y]=Pe(i[f],s[y]),f--,y--;else if(a[m]===n[y])l[y]=Pe(i[m],s[y]),bt(o,l[y+1],i[m]),m++,y--;else if(a[f]===n[b])l[b]=Pe(i[f],s[b]),bt(o,i[m],i[f]),f--,b++;else if(p===void 0&&(p=go(n,b,y),d=go(a,m,f)),p.has(a[m]))if(p.has(a[f])){let C=d.get(n[b]),R=C!==void 0?i[C]:null;if(R===null){let q=bt(o,i[m]);Pe(q,s[b]),l[b]=q}else l[b]=Pe(R,s[b]),bt(o,i[m],R),i[C]=null;b++}else Wr(i[f]),f--;else Wr(i[m]),m++;for(;b<=y;){let C=bt(o,l[y+1]);Pe(C,s[b]),l[b++]=C}for(;m<=f;){let C=i[m++];C!==null&&Wr(C)}return this.ut=n,ho(o,l),P}});function Ne(o,r,e,t){let i=e.getAttribute("width")?parseFloat(e.getAttribute("width")):e.naturalWidth,s=e.getAttribute("height")?parseFloat(e.getAttribute("height")):e.naturalHeight;switch(o){case"circle":{if(r.length!==3){console.error("Invalid circle coordinates:",r);return}let[n,a,l]=r,p=n/i*100,d=a/s*100,m=l/i*100,f=l/s*100;t.style.left=p-m+"%",t.style.top=d-f+"%",t.style.width=2*m+"%",t.style.height=2*f+"%",t.style.borderRadius="50%"}break;case"rect":{if(r.length!==4){console.error("Invalid rectangle coordinates:",r);return}let[n,a,l,p]=r,d=n/i*100,m=a/s*100,f=l/i*100,b=p/s*100;t.style.left=d+"%",t.style.top=m+"%",t.style.width=f-d+"%",t.style.height=b-m+"%"}break;case"ellipse":{if(r.length!==4){console.error("Invalid ellipse coordinates:",r);return}let[n,a,l,p]=r,d=n/i*100,m=a/s*100,f=l/i*100,b=p/s*100;t.style.left=d-f+"%",t.style.top=m-b+"%",t.style.width=2*f+"%",t.style.height=2*b+"%",t.style.borderRadius="50%"}break;case"poly":{if(r.length<6||r.length%2!==0){console.error("Invalid polygon coordinates:",r);return}let n=[];for(let q=0;q<r.length;q+=2)n.push({x:r[q],y:r[q+1]});let a=Math.min(...n.map(q=>q.x)),l=Math.max(...n.map(q=>q.x)),p=Math.min(...n.map(q=>q.y)),d=Math.max(...n.map(q=>q.y)),m=a/i*100,f=p/s*100,b=l/i*100,y=d/s*100;t.style.left=m+"%",t.style.top=f+"%",t.style.width=b-m+"%",t.style.height=y-f+"%";let R=n.map(q=>({x:(q.x-a)/(l-a)*100,y:(q.y-p)/(d-p)*100})).map(q=>`${q.x}% ${q.y}%`).join(",");t.style.clipPath=`polygon(${R})`}break;default:console.error(`Unsupported shape: ${o}`);break}}var bo=x`
311
311
  slot:not([name='prompt']) {
312
312
  // position: relative; /* qti-hotspot-choice relative to the slot */
313
313
  display: block;
@@ -476,7 +476,7 @@ Make sure to test your application with a production build as repeat registratio
476
476
  display: flex;
477
477
  user-select: none;
478
478
  }
479
- `,rr=c([g("qti-hottext")],rr);var ir=class extends le{constructor(r){if(super(r),this.it=S,r.type!==Pe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===S||r==null)return this._t=void 0,this.it=r;if(r===O)return r;if(typeof r!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;let e=[r];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};ir.directiveName="unsafeHTML",ir.resultType=1;var yt=ee(ir);var xe=class extends A{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt=""}get isInline(){return!0}static get styles(){return[x`
479
+ `,rr=c([g("qti-hottext")],rr);var ir=class extends le{constructor(r){if(super(r),this.it=S,r.type!==Oe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(r){if(r===S||r==null)return this._t=void 0,this.it=r;if(r===P)return r;if(typeof r!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(r===this.it)return this._t;this.it=r;let e=[r];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};ir.directiveName="unsafeHTML",ir.resultType=1;var yt=ee(ir);var ye=class extends A{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt=""}get isInline(){return!0}static get styles(){return[x`
480
480
  :host {
481
481
  display: inline-block;
482
482
  }
@@ -506,7 +506,7 @@ Make sure to test your application with a production build as repeat registratio
506
506
  </select>
507
507
 
508
508
  ${yt(this.correctOption)}
509
- `}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("on-dropdown-selected",this.choiceSelected)}willUpdate(e){(e.has("configContext")||e.has("dataPrompt"))&&this._updateOptions()}_updateOptions(){let e=Array.from(this.querySelectorAll("qti-inline-choice")),t=this.dataPrompt||this.configContext?.inlineChoicePrompt||"select";!this.options||this.options.length===0?this.options=[{textContent:t,value:"",selected:!1},...e.map(i=>({textContent:i.innerHTML,value:i.getAttribute("identifier"),selected:!1}))]:this.options=this.options.map(i=>i.value===""?{...i,textContent:t}:i)}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>({...e,selected:t===0}))}set response(e){this.options=this.options.map(t=>(e&&e===t.value&&(t.selected=!0),t))}get response(){return this.options.find(e=>e.selected)?.value||null}toggleInternalCorrectResponse(e){if(this.correctResponse=e&&this.responseVariable?.correctResponse?.toString(),!this.correctResponse){this.correctOption="";return}this.correctOption=`<span part="correct-option" style="border:1px solid var(--qti-correct); border-radius:4px; padding: 2px 4px; margin: 4px; display:inline-block">${this.options.find(t=>this.correctResponse===t.value).textContent}</span>`}choiceSelected(e){let t=e.target.value;this.options=this.options.map(i=>({...i,selected:i.value===t})),this.saveResponse(t)}};xe.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],c([E()],xe.prototype,"options",2),c([E()],xe.prototype,"correctOption",2),c([u({attribute:"data-prompt",type:String})],xe.prototype,"dataPrompt",2),c([_({context:ne,subscribe:!0}),u({attribute:!1})],xe.prototype,"configContext",2),xe=c([g("qti-inline-choice-interaction")],xe);var sr=class extends v{static get styles(){return[x`
509
+ `}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("on-dropdown-selected",this.choiceSelected)}willUpdate(e){(e.has("configContext")||e.has("dataPrompt"))&&this._updateOptions()}_updateOptions(){let e=Array.from(this.querySelectorAll("qti-inline-choice")),t=this.dataPrompt||this.configContext?.inlineChoicePrompt||"select";!this.options||this.options.length===0?this.options=[{textContent:t,value:"",selected:!1},...e.map(i=>({textContent:i.innerHTML,value:i.getAttribute("identifier"),selected:!1}))]:this.options=this.options.map(i=>i.value===""?{...i,textContent:t}:i)}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>({...e,selected:t===0}))}set response(e){this.options=this.options.map(t=>(e&&e===t.value&&(t.selected=!0),t))}get response(){return this.options.find(e=>e.selected)?.value||null}toggleInternalCorrectResponse(e){if(this.correctResponse=e&&this.responseVariable?.correctResponse?.toString(),!this.correctResponse){this.correctOption="";return}this.correctOption=`<span part="correct-option" style="border:1px solid var(--qti-correct); border-radius:4px; padding: 2px 4px; margin: 4px; display:inline-block">${this.options.find(t=>this.correctResponse===t.value).textContent}</span>`}choiceSelected(e){let t=e.target.value;this.options=this.options.map(i=>({...i,selected:i.value===t})),this.saveResponse(t)}};ye.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"],c([E()],ye.prototype,"options",2),c([E()],ye.prototype,"correctOption",2),c([u({attribute:"data-prompt",type:String})],ye.prototype,"dataPrompt",2),c([_({context:ne,subscribe:!0}),u({attribute:!1})],ye.prototype,"configContext",2),ye=c([g("qti-inline-choice-interaction")],ye);var sr=class extends v{static get styles(){return[x`
510
510
  :host {
511
511
  display: block;
512
512
  cursor: pointer;
@@ -552,7 +552,7 @@ Make sure to test your application with a production build as repeat registratio
552
552
  /* Make sure the drag and drop container slots have the same width */
553
553
  flex: 1;
554
554
  }
555
- `;var qe=class extends oe(A,"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"){constructor(){super(...arguments);this.lastCheckedRadio=null;this.class="";this._response=[];this.responseIdentifier="";this.correctOptions=null;this.handleRadioClick=e=>{let t=e.target;this.lastCheckedRadio===t?(t.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=t};this.handleRadioChange=e=>{let t=e.target,i=t.value,s=t.name,n=t.type;t.checked?(this.response?this.response.indexOf(i)===-1&&(n==="radio"&&(this.response=(this.response||[]).filter(a=>a.indexOf(s)===-1)),this.response=[...this.response,i]):this.response=[i],this.lastCheckedRadio=t):(this.response=(this.response||[]).filter(a=>a!==i),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}}))}}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(e){this.classList.contains("qti-match-tabular")?this._response=e:super.response=e}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.response=[]}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getMatches(e){if(!e.correctResponse)return[];let t=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse],i=[];return t&&t.forEach(s=>{let n=s.split(" ");i.push({source:n[0],target:n[1]})}),i}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(!t?.correctResponse){this.querySelectorAll(".correct-option").forEach(s=>s.remove());return}let i=this.getMatches(t);this.class.split(" ").includes("qti-match-tabular")?e?this.correctOptions=i||[]:this.correctOptions=null:e?(this.querySelectorAll(".correct-option").forEach(s=>s.remove()),this.targetChoices.forEach(s=>{let n=s.getAttribute("identifier"),a=i.find(l=>l.target===n);if(a?.source){let p=this.querySelector(`qti-simple-associable-choice[identifier="${a.source}"]`)?.textContent?.trim();if(p&&!s.previousElementSibling?.classList.contains("correct-option")){let d=document.createElement("span");d.classList.add("correct-option"),d.textContent=p,d.style.border="1px solid var(--qti-correct)",d.style.borderRadius="4px",d.style.padding="2px 4px",d.style.display="inline-block",s.insertAdjacentElement("beforebegin",d)}}})):this.correctOptions=null}toggleCandidateCorrection(e){let t=this.responseVariable;if(!t?.correctResponse)return;let i=this.getMatches(t);this.targetChoices.forEach(s=>{let n=s.getAttribute("identifier"),a=i.filter(p=>p.target===n);s.querySelectorAll("qti-simple-associable-choice").forEach(p=>{if(p.internals.states.delete("candidate-correct"),p.internals.states.delete("candidate-incorrect"),!e)return;a.find(m=>m.source===p.identifier)?.source!==void 0?p.internals.states.add("candidate-correct"):p.internals.states.add("candidate-incorrect")})})}render(){let e=this.class.split(" ").includes("qti-match-tabular"),t=this.correctOptions!==null;return h`
555
+ `;var xe=class extends oe(A,"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"){constructor(){super(...arguments);this.lastCheckedRadio=null;this.class="";this._response=[];this.responseIdentifier="";this.correctOptions=null;this.handleRadioClick=e=>{let t=e.target;this.lastCheckedRadio===t?(t.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=t};this.handleRadioChange=e=>{let t=e.target,i=t.value,s=t.name,n=t.type;t.checked?(this.response?this.response.indexOf(i)===-1&&(n==="radio"&&(this.response=(this.response||[]).filter(a=>a.indexOf(s)===-1)),this.response=[...this.response,i]):this.response=[i],this.lastCheckedRadio=t):(this.response=(this.response||[]).filter(a=>a!==i),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}}))}}get response(){return this.classList.contains("qti-match-tabular")?this._response:super.response}set response(e){this.classList.contains("qti-match-tabular")?this._response=e:super.response=e}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.response=[]}validate(){return this.class.split(" ").includes("qti-match-tabular")?this.response?.length===this.sourceChoices.length:super.validate()}getMatches(e){if(!e.correctResponse)return[];let t=Array.isArray(e.correctResponse)?e.correctResponse:[e.correctResponse],i=[];return t&&t.forEach(s=>{let n=s.split(" ");i.push({source:n[0],target:n[1]})}),i}toggleInternalCorrectResponse(e){let t=this.responseVariable;if(!t?.correctResponse){this.querySelectorAll(".correct-option").forEach(s=>s.remove());return}let i=this.getMatches(t);this.class.split(" ").includes("qti-match-tabular")?e?this.correctOptions=i||[]:this.correctOptions=null:e?(this.querySelectorAll(".correct-option").forEach(s=>s.remove()),this.targetChoices.forEach(s=>{let n=s.getAttribute("identifier"),a=i.find(l=>l.target===n);if(a?.source){let p=this.querySelector(`qti-simple-associable-choice[identifier="${a.source}"]`)?.textContent?.trim();if(p&&!s.previousElementSibling?.classList.contains("correct-option")){let d=document.createElement("span");d.classList.add("correct-option"),d.textContent=p,d.style.border="1px solid var(--qti-correct)",d.style.borderRadius="4px",d.style.padding="2px 4px",d.style.display="inline-block",s.insertAdjacentElement("beforebegin",d)}}})):this.correctOptions=null}toggleCandidateCorrection(e){let t=this.responseVariable;if(!t?.correctResponse)return;let i=this.getMatches(t);this.targetChoices.forEach(s=>{let n=s.getAttribute("identifier"),a=i.filter(p=>p.target===n);s.querySelectorAll("qti-simple-associable-choice").forEach(p=>{if(p.internals.states.delete("candidate-correct"),p.internals.states.delete("candidate-incorrect"),!e)return;a.find(m=>m.source===p.identifier)?.source!==void 0?p.internals.states.add("candidate-correct"):p.internals.states.add("candidate-incorrect")})})}render(){let e=this.class.split(" ").includes("qti-match-tabular"),t=this.correctOptions!==null;return h`
556
556
  <slot name="prompt"></slot>
557
557
  <slot ?hidden=${e}></slot>
558
558
 
@@ -595,7 +595,7 @@ Make sure to test your application with a production build as repeat registratio
595
595
  `:S}
596
596
 
597
597
  <div role="alert" part="message" id="validation-message"></div>
598
- `}};qe.styles=qo,c([u({type:String})],qe.prototype,"class",2),c([E()],qe.prototype,"_response",2),c([u({type:String,attribute:"response-identifier"})],qe.prototype,"responseIdentifier",2),c([E()],qe.prototype,"correctOptions",2),qe=c([g("qti-match-interaction")],qe);var or=class extends A{constructor(){super();this._value=null}reset(){}validate(){return!0}get response(){return this._value?this._value.toString():null}set response(e){if(e)if(!isNaN(parseInt(e?.toString())))this._value=parseInt(e.toString());else throw new Error(`Value must be a number ${e}`)}static get properties(){return{...A.properties,step:{type:Number,attribute:"step",default:10}}}render(){return h` <slot name="prompt"></slot>
598
+ `}};xe.styles=qo,c([u({type:String})],xe.prototype,"class",2),c([E()],xe.prototype,"_response",2),c([u({type:String,attribute:"response-identifier"})],xe.prototype,"responseIdentifier",2),c([E()],xe.prototype,"correctOptions",2),xe=c([g("qti-match-interaction")],xe);var or=class extends A{constructor(){super();this._value=null}reset(){}validate(){return!0}get response(){return this._value?this._value.toString():null}set response(e){if(e)if(!isNaN(parseInt(e?.toString())))this._value=parseInt(e.toString());else throw new Error(`Value must be a number ${e}`)}static get properties(){return{...A.properties,step:{type:Number,attribute:"step",default:10}}}render(){return h` <slot name="prompt"></slot>
599
599
  <slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this._value++,this.saveResponse(this.value)})}};or.styles=[x``],or=c([g("qti-media-interaction")],or);var Eo=x`
600
600
  [part='drags'] {
601
601
  display: flex;
@@ -654,13 +654,13 @@ Make sure to test your application with a production build as repeat registratio
654
654
  :host(.qti-choices-right) [part='container'] {
655
655
  flex-direction: row-reverse;
656
656
  }
657
- `;var Ee=class extends oe(A,"qti-simple-choice","drop-list","slot[part='drags']"){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),h` <slot name="prompt"> </slot>
657
+ `;var qe=class extends oe(A,"qti-simple-choice","drop-list","slot[part='drags']"){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),h` <slot name="prompt"> </slot>
658
658
  <div part="container">
659
659
  <slot part="drags"> </slot>
660
660
  <div part="drops">
661
661
  ${[...Array(this.nrChoices)].map((t,i)=>h`<drop-list role="region" part="drop-list" identifier="droplist${i}"></drop-list>`)}
662
662
  </div>
663
- </div>`}toggleCorrectResponse(e){let t=this.responseVariable;if(this.shadowRoot.querySelectorAll(".correct-option").forEach(i=>i.remove()),e&&t?.correctResponse){let s=(Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse]).map(l=>l.split(" ")[0]),n=new Set;this.querySelectorAll("qti-simple-choice").forEach((l,p)=>{let d=l.getAttribute("identifier");if(!d||!s.includes(d)||n.has(d))return;n.add(d);let m=l.textContent?.trim();if(!m)return;let f=this.shadowRoot.querySelector(`drop-list[identifier="droplist${p}"]`);if(!f)return;let b=document.createElement("span");b.classList.add("correct-option"),b.textContent=m,b.style.border="1px solid var(--qti-correct)",b.style.borderRadius="4px",b.style.padding="2px 4px",b.style.display="inline-block",b.style.marginTop="4px",f.insertAdjacentElement("afterend",b)})}}getValue(e){return e?.map((t,i)=>`${t} droplist${i}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(i=>{let s=i.querySelectorAll('[qti-draggable="true"]');return[...Array.from(s).map(a=>a.getAttribute("identifier"))].join(" ")})}async firstUpdated(e){super.firstUpdated(e),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(t=>t.setAttribute("part","qti-simple-choice"))}};Ee.styles=Eo,c([E()],Ee.prototype,"nrChoices",2),c([E()],Ee.prototype,"correctResponses",2),c([E()],Ee.prototype,"showCorrectResponses",2),c([u({type:String})],Ee.prototype,"orientation",2),Ee=c([g("qti-order-interaction")],Ee);var Co=x`
663
+ </div>`}toggleCorrectResponse(e){let t=this.responseVariable;if(this.shadowRoot.querySelectorAll(".correct-option").forEach(i=>i.remove()),e&&t?.correctResponse){let s=(Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse]).map(l=>l.split(" ")[0]),n=new Set;this.querySelectorAll("qti-simple-choice").forEach((l,p)=>{let d=l.getAttribute("identifier");if(!d||!s.includes(d)||n.has(d))return;n.add(d);let m=l.textContent?.trim();if(!m)return;let f=this.shadowRoot.querySelector(`drop-list[identifier="droplist${p}"]`);if(!f)return;let b=document.createElement("span");b.classList.add("correct-option"),b.textContent=m,b.style.border="1px solid var(--qti-correct)",b.style.borderRadius="4px",b.style.padding="2px 4px",b.style.display="inline-block",b.style.marginTop="4px",f.insertAdjacentElement("afterend",b)})}}getValue(e){return e?.map((t,i)=>`${t} droplist${i}`)||[]}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(i=>{let s=i.querySelectorAll('[qti-draggable="true"]');return[...Array.from(s).map(a=>a.getAttribute("identifier"))].join(" ")})}async firstUpdated(e){super.firstUpdated(e),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(t=>t.setAttribute("part","qti-simple-choice"))}};qe.styles=Eo,c([E()],qe.prototype,"nrChoices",2),c([E()],qe.prototype,"correctResponses",2),c([E()],qe.prototype,"showCorrectResponses",2),c([u({type:String})],qe.prototype,"orientation",2),qe=c([g("qti-order-interaction")],qe);var Co=x`
664
664
  ::slotted(qti-interaction-markup) {
665
665
  display: none;
666
666
  }
@@ -1118,7 +1118,7 @@ Make sure to test your application with a production build as repeat registratio
1118
1118
  display: inline-block;
1119
1119
  position: relative;
1120
1120
  }
1121
- `],nr=c([g("qti-position-object-stage")],nr);var wo="important",kn=" !"+wo,Di=ee(class extends le{constructor(o){if(super(o),o.type!==Pe.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(((r,e)=>{let t=o[e];return t==null?r:r+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`}),"")}update(o,[r]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(r)),this.render(r);for(let t of this.ft)r[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in r){let i=r[t];if(i!=null){this.ft.add(t);let s=typeof i=="string"&&i.endsWith(kn);t.includes("-")||s?e.setProperty(t,s?i.slice(0,-11):i,s?wo:""):e[t]=i}}return O}});var F=class{static isPointInArea(r,e,t){if(t!=="point")return console.warn(`Base type ${t} is not supported for point area mapping.`),!1;let[i,s]=r.split(" ").map(Number),[n,...a]=e.split(","),l=a.map(Number);switch(n.toLowerCase()){case"circle":case"default":{let[p,d,m]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-p)**2+(s-d)**2)<=m}case"rect":{let[p,d,m,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=p&&i<=m&&s>=d&&s<=f}case"ellipse":{let[p,d,m,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let b=(i-p)**2/m**2,y=(s-d)**2/f**2;return b+y<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let p=[];for(let d=0;d<l.length;d+=2)p.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:i,y:s},p)}default:return console.warn(`Unsupported shape type: ${n}`),!1}}static isPointInPolygon(r,e){let t=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let n=e[i].x,a=e[i].y,l=e[s].x,p=e[s].y;a>r.y!=p>r.y&&r.x<(l-n)*(r.y-a)/(p-a)+n&&(t=!t)}return t}static compareSingleValues(r,e,t){switch(t){case"identifier":case"string":return r===e;case"integer":{let i=parseInt(r,10),s=parseInt(e,10);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`Cannot convert ${r} and/or ${e} to int.`);break}case"float":{let i=parseFloat(r),s=parseFloat(e);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`couldn't convert ${r} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=r.split(" ").sort(),s=e.split(" ").sort();if(i.length===2&&s.length===2)return t==="pair"&&(i.sort(),s.sort()),i.join(" ")===s.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${r} 2: ${e}`);break}}return!1}};var pe=class extends A{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this.response=null;this._correctAreas=[];this._responseCorrection=[];this._imgElement=null;this._scaleX=1;this._scaleY=1;this._imageWidthOriginal=0;this._imageHeightOriginal=0;this._onImageClick=e=>{if(this.disabled)return;if(!this._imgElement){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.calculateScale();let t=this._imgElement.getBoundingClientRect(),i=(e.clientX-t.left)*this._scaleX,s=(e.clientY-t.top)*this._scaleY,n=`${i.toFixed()} ${s.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._onResize=()=>{this.calculateScale()}}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onResize)}get responsePoints(){return(this.response||[]).filter(e=>e).map(e=>{let[t,i]=e.split(" ").map(Number);return{x:t,y:i}})}toggleCandidateCorrection(e){this._responseCorrection=[],e&&this.responsePoints.forEach(t=>{let i=this.responseVariable.areaMapping.areaMapEntries.some(s=>F.isPointInArea(`${t.x} ${t.y}`,`${s.shape},${s.coords}`,this.responseVariable.baseType));this._responseCorrection.push(i)})}toggleCorrectResponse(e){let t=this.responseVariable;if(!e||!t){this._correctAreas=[];return}let i=t.areaMapping,s=[];if(!i||i.areaMapEntries.length===0)if(t.correctResponse){let n=Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse];if(n.length===0||n.find(a=>a.split(" ").length<2))return console.error("No valid correct responses found for the response variable."),null;console.warn("No area mapping found for the response variable. Using the correct responses to display the correct response but it probably won't score correct."),s=n.map(a=>({shape:"circle",coords:a.split(" ").join(",").concat(",10"),defaultValue:1,mappedValue:1}))}else{console.error("No area mapping found for the response variable.");return}else s=i.areaMapEntries;this._correctAreas=s.map(n=>({coords:n.coords,shape:n.shape}))}updated(e){super.updated(e);let t=this._imgElement;t&&e.has("_correctAreas")&&this._correctAreas.length>0&&(this.calculateScale(),this.shadowRoot.querySelectorAll("div").forEach(i=>{let s=i.dataset.coord,n=i.dataset.shape;s&&n&&Ne(n,s.split(",").map(a=>+a),t,i)}))}render(){return h` <slot name="prompt"></slot>
1121
+ `],nr=c([g("qti-position-object-stage")],nr);var wo="important",kn=" !"+wo,Di=ee(class extends le{constructor(o){if(super(o),o.type!==Oe.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(((r,e)=>{let t=o[e];return t==null?r:r+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`}),"")}update(o,[r]){let{style:e}=o.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(r)),this.render(r);for(let t of this.ft)r[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in r){let i=r[t];if(i!=null){this.ft.add(t);let s=typeof i=="string"&&i.endsWith(kn);t.includes("-")||s?e.setProperty(t,s?i.slice(0,-11):i,s?wo:""):e[t]=i}}return P}});var F=class{static isPointInArea(r,e,t){if(t!=="point")return console.warn(`Base type ${t} is not supported for point area mapping.`),!1;let[i,s]=r.split(" ").map(Number),[n,...a]=e.split(","),l=a.map(Number);switch(n.toLowerCase()){case"circle":case"default":{let[p,d,m]=l;return l.length!==3?(console.warn(`Invalid circle definition: ${e}`),!1):Math.sqrt((i-p)**2+(s-d)**2)<=m}case"rect":{let[p,d,m,f]=l;return l.length!==4?(console.warn(`Invalid rectangle definition: ${e}`),!1):i>=p&&i<=m&&s>=d&&s<=f}case"ellipse":{let[p,d,m,f]=l;if(l.length!==4)return console.warn(`Invalid ellipse definition: ${e}`),!1;let b=(i-p)**2/m**2,y=(s-d)**2/f**2;return b+y<=1}case"poly":{if(l.length<6||l.length%2!==0)return console.warn(`Invalid polygon definition: ${e}`),!1;let p=[];for(let d=0;d<l.length;d+=2)p.push({x:l[d],y:l[d+1]});return this.isPointInPolygon({x:i,y:s},p)}default:return console.warn(`Unsupported shape type: ${n}`),!1}}static isPointInPolygon(r,e){let t=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let n=e[i].x,a=e[i].y,l=e[s].x,p=e[s].y;a>r.y!=p>r.y&&r.x<(l-n)*(r.y-a)/(p-a)+n&&(t=!t)}return t}static compareSingleValues(r,e,t){switch(t){case"identifier":case"string":return r===e;case"integer":{let i=parseInt(r,10),s=parseInt(e,10);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`Cannot convert ${r} and/or ${e} to int.`);break}case"float":{let i=parseFloat(r),s=parseFloat(e);if(!isNaN(i)&&!isNaN(s))return i===s;console.error(`couldn't convert ${r} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=r.split(" ").sort(),s=e.split(" ").sort();if(i.length===2&&s.length===2)return t==="pair"&&(i.sort(),s.sort()),i.join(" ")===s.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${r} 2: ${e}`);break}}return!1}};var pe=class extends A{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this.response=null;this._correctAreas=[];this._responseCorrection=[];this._imgElement=null;this._scaleX=1;this._scaleY=1;this._imageWidthOriginal=0;this._imageHeightOriginal=0;this._onImageClick=e=>{if(this.disabled)return;if(!this._imgElement){console.warn("No <img> element found in <qti-select-point-interaction>");return}this.calculateScale();let t=this._imgElement.getBoundingClientRect(),i=(e.clientX-t.left)*this._scaleX,s=(e.clientY-t.top)*this._scaleY,n=`${i.toFixed()} ${s.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._onResize=()=>{this.calculateScale()}}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onResize)}get responsePoints(){return(this.response||[]).filter(e=>e).map(e=>{let[t,i]=e.split(" ").map(Number);return{x:t,y:i}})}toggleCandidateCorrection(e){this._responseCorrection=[],e&&this.responsePoints.forEach(t=>{let i=this.responseVariable.areaMapping.areaMapEntries.some(s=>F.isPointInArea(`${t.x} ${t.y}`,`${s.shape},${s.coords}`,this.responseVariable.baseType));this._responseCorrection.push(i)})}toggleCorrectResponse(e){let t=this.responseVariable;if(!e||!t){this._correctAreas=[];return}let i=t.areaMapping,s=[];if(!i||i.areaMapEntries.length===0)if(t.correctResponse){let n=Array.isArray(t.correctResponse)?t.correctResponse:[t.correctResponse];if(n.length===0||n.find(a=>a.split(" ").length<2))return console.error("No valid correct responses found for the response variable."),null;console.warn("No area mapping found for the response variable. Using the correct responses to display the correct response but it probably won't score correct."),s=n.map(a=>({shape:"circle",coords:a.split(" ").join(",").concat(",10"),defaultValue:1,mappedValue:1}))}else{console.error("No area mapping found for the response variable.");return}else s=i.areaMapEntries;this._correctAreas=s.map(n=>({coords:n.coords,shape:n.shape}))}updated(e){super.updated(e);let t=this._imgElement;t&&e.has("_correctAreas")&&this._correctAreas.length>0&&(this.calculateScale(),this.shadowRoot.querySelectorAll("div").forEach(i=>{let s=i.dataset.coord,n=i.dataset.shape;s&&n&&Ne(n,s.split(",").map(a=>+a),t,i)}))}render(){return h` <slot name="prompt"></slot>
1122
1122
  <point-container>
1123
1123
  ${vt((this.response||[]).filter(e=>e),e=>e,(e,t)=>{let[i,s]=e.split(" ").map(Number),n=i/(this._imageWidthOriginal||1)*100,a=s/(this._imageHeightOriginal||1)*100,l=16,p=l/(this._imageWidthOriginal||1)*100,d=l/(this._imageHeightOriginal||1)*100,m="";return this._responseCorrection[t]===!0?m=" correct":this._responseCorrection[t]===!1&&(m=" incorrect"),h`
1124
1124
  <button
@@ -1151,11 +1151,11 @@ Make sure to test your application with a production build as repeat registratio
1151
1151
  height: auto;
1152
1152
  display: block;
1153
1153
  }
1154
- `],c([u({type:Number,attribute:"max-choices"})],pe.prototype,"maxChoices",2),c([u({type:Number,attribute:"min-choices"})],pe.prototype,"minChoices",2),c([E()],pe.prototype,"response",2),c([E()],pe.prototype,"_correctAreas",2),c([E()],pe.prototype,"_responseCorrection",2),pe=c([g("qti-select-point-interaction")],pe);var Ce=class extends ae(v,"qti-simple-choice"){constructor(){super(...arguments);this.templateIdentifier=null;this.showHide="show";this.fixed=!1}get checked(){return this.internals.states.has("--checked")}render(){return h`<div part="ch">
1154
+ `],c([u({type:Number,attribute:"max-choices"})],pe.prototype,"maxChoices",2),c([u({type:Number,attribute:"min-choices"})],pe.prototype,"minChoices",2),c([E()],pe.prototype,"response",2),c([E()],pe.prototype,"_correctAreas",2),c([E()],pe.prototype,"_responseCorrection",2),pe=c([g("qti-select-point-interaction")],pe);var Ee=class extends ae(v,"qti-simple-choice"){constructor(){super(...arguments);this.templateIdentifier=null;this.showHide="show";this.fixed=!1}get checked(){return this.internals.states.has("--checked")}render(){return h`<div part="ch">
1155
1155
  <div part="cha"></div>
1156
1156
  </div>
1157
1157
  ${this.marker?h`<div id="label">${this.marker}</div>`:S}
1158
- <slot part="slot"></slot>`}};Ce.styles=x`
1158
+ <slot part="slot"></slot>`}};Ee.styles=x`
1159
1159
  :host {
1160
1160
  display: flex;
1161
1161
  align-items: center;
@@ -1172,7 +1172,7 @@ Make sure to test your application with a production build as repeat registratio
1172
1172
  align-items: center;
1173
1173
  justify-content: center;
1174
1174
  }
1175
- `,c([u({type:String,attribute:"template-identifier"})],Ce.prototype,"templateIdentifier",2),c([u({type:String,attribute:"show-hide"})],Ce.prototype,"showHide",2),c([u({type:Boolean,converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],Ce.prototype,"fixed",2),c([u({type:String,attribute:!1})],Ce.prototype,"marker",2),Ce=c([g("qti-simple-choice")],Ce);var _o=x`
1175
+ `,c([u({type:String,attribute:"template-identifier"})],Ee.prototype,"templateIdentifier",2),c([u({type:String,attribute:"show-hide"})],Ee.prototype,"showHide",2),c([u({type:Boolean,converter:{fromAttribute:e=>e==="true",toAttribute:e=>String(e)}})],Ee.prototype,"fixed",2),c([u({type:String,attribute:!1})],Ee.prototype,"marker",2),Ee=c([g("qti-simple-choice")],Ee);var _o=x`
1176
1176
  :host {
1177
1177
  display: block;
1178
1178
  --show-bounds: true;
@@ -1252,7 +1252,7 @@ Make sure to test your application with a production build as repeat registratio
1252
1252
  text-align: center;
1253
1253
  color: #6b7280; /* text-gray-500 */
1254
1254
  }
1255
- `;var we=class extends A{constructor(){super(...arguments);this._value=0;this._correctResponseNumber=null;this.min=0;this.max=100;this.step=1}validate(){return!0}connectedCallback(){super.connectedCallback(),this._updateValue(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get response(){return this._value.toString()}set response(e){let t=parseInt(e,10);isNaN(t)||this._updateValue(t)}toggleCorrectResponse(e){let t=this.responseVariable;if(t?.correctResponse){if(e){this._correctResponse=t.correctResponse.toString();let i=parseFloat(t.correctResponse.toString());if(isNaN(i))this._correctResponseNumber=null;else{this._correctResponseNumber=i;let s=(this._correctResponseNumber-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}}else this._correctResponseNumber=null;this.requestUpdate()}}_updateValue(e){let t=this._value;if(this._value=Math.min(this.max,Math.max(this.min,e)),this._value===t)return;let i=(this._value-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${i}%`),this._internals.setFormValue(this.value),this.saveResponse(this.response),this.requestUpdate()}render(){return h`
1255
+ `;var Ce=class extends A{constructor(){super(...arguments);this._value=0;this._correctResponseNumber=null;this.min=0;this.max=100;this.step=1}validate(){return!0}connectedCallback(){super.connectedCallback(),this._updateValue(this.min),this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}get response(){return this._value.toString()}set response(e){let t=parseInt(e,10);isNaN(t)||this._updateValue(t)}toggleCorrectResponse(e){let t=this.responseVariable;if(t?.correctResponse){if(e){this._correctResponse=t.correctResponse.toString();let i=parseFloat(t.correctResponse.toString());if(isNaN(i))this._correctResponseNumber=null;else{this._correctResponseNumber=i;let s=(this._correctResponseNumber-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage-correct",`${s}%`)}}else this._correctResponseNumber=null;this.requestUpdate()}}_updateValue(e){let t=this._value;if(this._value=Math.min(this.max,Math.max(this.min,e)),this._value===t)return;let i=(this._value-this.min)/(this.max-this.min)*100;this.style.setProperty("--value-percentage",`${i}%`),this._internals.setFormValue(this.value),this.saveResponse(this.response),this.requestUpdate()}render(){return h`
1256
1256
  <slot name="prompt"></slot>
1257
1257
  <div id="slider" part="slider">
1258
1258
  <div id="bounds" part="bounds">
@@ -1274,7 +1274,7 @@ Make sure to test your application with a production build as repeat registratio
1274
1274
  `:null}
1275
1275
  </div>
1276
1276
  </div>
1277
- `}_onMouseDown(e){this._startDrag(e.pageX);let t=s=>this._onDrag(s.pageX),i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),this._onDragEnd()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i)}_onTouchStart(e){this._startDrag(e.touches[0].pageX);let t=s=>this._onDrag(s.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",i),this._onDragEnd()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",i)}_startDrag(e){this._onDrag(e)}_onDrag(e){let t=this._rail.getBoundingClientRect(),i=e-t.left,s=Math.min(1,Math.max(0,i/t.width)),n=this.min+Math.round(s*(this.max-this.min)/this.step)*this.step;this._updateValue(n)}_onDragEnd(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};we.styles=_o,c([lt("#rail")],we.prototype,"_rail",2),c([u({type:Number,attribute:"lower-bound"})],we.prototype,"min",2),c([u({type:Number,attribute:"upper-bound"})],we.prototype,"max",2),c([u({type:Number,attribute:"step"})],we.prototype,"step",2),we=c([g("qti-slider-interaction")],we);var ar=(o,r)=>{let e=o._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(r,!1),ar(t,r);return!0},Xr=o=>{let r,e;do{if((r=o._$AM)===void 0)break;e=r._$AN,e.delete(o),o=r}while(e?.size===0)},To=o=>{for(let r;r=o._$AM;o=r){let e=r._$AN;if(e===void 0)r._$AN=e=new Set;else if(e.has(o))break;e.add(o),Sn(r)}};function An(o){this._$AN!==void 0?(Xr(this),this._$AM=o,To(this)):this._$AM=o}function Rn(o,r=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(r)if(Array.isArray(t))for(let s=e;s<t.length;s++)ar(t[s],!1),Xr(t[s]);else t!=null&&(ar(t,!1),Xr(t));else ar(this,o)}var Sn=o=>{o.type==Pe.CHILD&&(o._$AP??=Rn,o._$AQ??=An)},xt=class extends le{constructor(){super(...arguments),this._$AN=void 0}_$AT(r,e,t){super._$AT(r,e,t),To(this),this.isConnected=r._$AU}_$AO(r,e=!0){r!==this.isConnected&&(this.isConnected=r,r?this.reconnected?.():this.disconnected?.()),e&&(ar(this,r),Xr(this))}setValue(r){if(mo(this._$Ct))this._$Ct._$AI(r,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=r,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ko=()=>new zi,zi=class{},Hi=new WeakMap,Wh=ee(class extends xt{render(o){return S}update(o,[r]){let e=r!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=r,this.ht=o.options?.host,this.rt(this.ct=o.element)),S}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let r=this.ht??globalThis,e=Hi.get(r);e===void 0&&(e=new WeakMap,Hi.set(r,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"?Hi.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 Ao=x`
1277
+ `}_onMouseDown(e){this._startDrag(e.pageX);let t=s=>this._onDrag(s.pageX),i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),this._onDragEnd()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i)}_onTouchStart(e){this._startDrag(e.touches[0].pageX);let t=s=>this._onDrag(s.touches[0].pageX),i=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",i),this._onDragEnd()};document.addEventListener("touchmove",t,{passive:!1}),document.addEventListener("touchend",i)}_startDrag(e){this._onDrag(e)}_onDrag(e){let t=this._rail.getBoundingClientRect(),i=e-t.left,s=Math.min(1,Math.max(0,i/t.width)),n=this.min+Math.round(s*(this.max-this.min)/this.step)*this.step;this._updateValue(n)}_onDragEnd(){this.dispatchEvent(new Event("change",{bubbles:!0}))}};Ce.styles=_o,c([lt("#rail")],Ce.prototype,"_rail",2),c([u({type:Number,attribute:"lower-bound"})],Ce.prototype,"min",2),c([u({type:Number,attribute:"upper-bound"})],Ce.prototype,"max",2),c([u({type:Number,attribute:"step"})],Ce.prototype,"step",2),Ce=c([g("qti-slider-interaction")],Ce);var ar=(o,r)=>{let e=o._$AN;if(e===void 0)return!1;for(let t of e)t._$AO?.(r,!1),ar(t,r);return!0},Xr=o=>{let r,e;do{if((r=o._$AM)===void 0)break;e=r._$AN,e.delete(o),o=r}while(e?.size===0)},To=o=>{for(let r;r=o._$AM;o=r){let e=r._$AN;if(e===void 0)r._$AN=e=new Set;else if(e.has(o))break;e.add(o),Sn(r)}};function An(o){this._$AN!==void 0?(Xr(this),this._$AM=o,To(this)):this._$AM=o}function Rn(o,r=!1,e=0){let t=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(r)if(Array.isArray(t))for(let s=e;s<t.length;s++)ar(t[s],!1),Xr(t[s]);else t!=null&&(ar(t,!1),Xr(t));else ar(this,o)}var Sn=o=>{o.type==Oe.CHILD&&(o._$AP??=Rn,o._$AQ??=An)},xt=class extends le{constructor(){super(...arguments),this._$AN=void 0}_$AT(r,e,t){super._$AT(r,e,t),To(this),this.isConnected=r._$AU}_$AO(r,e=!0){r!==this.isConnected&&(this.isConnected=r,r?this.reconnected?.():this.disconnected?.()),e&&(ar(this,r),Xr(this))}setValue(r){if(mo(this._$Ct))this._$Ct._$AI(r,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=r,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ko=()=>new zi,zi=class{},Hi=new WeakMap,Wh=ee(class extends xt{render(o){return S}update(o,[r]){let e=r!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=r,this.ht=o.options?.host,this.rt(this.ct=o.element)),S}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let r=this.ht??globalThis,e=Hi.get(r);e===void 0&&(e=new WeakMap,Hi.set(r,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"?Hi.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 Ao=x`
1278
1278
  :host {
1279
1279
  display: inline-block;
1280
1280
  }
@@ -1489,16 +1489,16 @@ Make sure to test your application with a production build as repeat registratio
1489
1489
  :host {
1490
1490
  display: none;
1491
1491
  }
1492
- `],c([u({type:String,attribute:"base-type"})],he.prototype,"baseType",2),c([u({type:String,attribute:"external-scored"})],he.prototype,"externalScored",2),c([u({type:String})],he.prototype,"identifier",2),c([u({type:String})],he.prototype,"cardinality",2),c([_({context:$,subscribe:!0}),E()],he.prototype,"itemContext",2),he=c([g("qti-outcome-declaration")],he);var _e=class extends De{render(){let r=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return h`${JSON.stringify(r,null,2)}`}connectedCallback(){super.connectedCallback();let r=this.defaultValues(this.cardinality),e={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,defaultValue:r,areaMapping:this.areaMapping,value:null,type:"response",candidateResponse:null};e.value=r,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get correctResponse(){let r,e=this.querySelector("qti-correct-response");if(e){let t=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&t.length>0)r=t[0].textContent.trim(),t[0].remove();else if(this.cardinality!=="single"){r=[];for(let i=0;i<t.length;i++)r.push(t[i].textContent.trim()),t[i].remove()}}return r}get mapping(){let r=this.querySelector("qti-mapping"),e=parseFloat(r?.getAttribute("lower-bound")),t=parseFloat(r?.getAttribute("upper-bound"));return{defaultValue:Number(r?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(t)?null:t,mapEntries:Array.from(r?.querySelectorAll("qti-map-entry")||[]).map(s=>({mapKey:s.getAttribute("map-key")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,caseSensitive:s.hasAttribute("case-sensitive")?s.getAttribute("case-sensitive")!=="false":!1}))}}get areaMapping(){let r=this.querySelector("qti-area-mapping"),e=Number(r?.getAttribute("default-value"))||0,t=parseFloat(r?.getAttribute("lower-bound")),i=parseFloat(r?.getAttribute("upper-bound")),s=Array.from(r?.querySelectorAll("qti-area-map-entry")||[]).map(n=>({shape:n.getAttribute("shape")||"default",coords:n.getAttribute("coords")||"",mappedValue:Number(n.getAttribute("mapped-value"))||0,defaultValue:Number(n.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(t)?null:t,upperBound:isNaN(i)?null:i,areaMapEntries:s}}};_e.styles=[x`
1492
+ `],c([u({type:String,attribute:"base-type"})],he.prototype,"baseType",2),c([u({type:String,attribute:"external-scored"})],he.prototype,"externalScored",2),c([u({type:String})],he.prototype,"identifier",2),c([u({type:String})],he.prototype,"cardinality",2),c([_({context:$,subscribe:!0}),E()],he.prototype,"itemContext",2),he=c([g("qti-outcome-declaration")],he);var we=class extends De{render(){let r=this.itemContext?.variables.find(e=>e.identifier===this.identifier)?.value;return h`${JSON.stringify(r,null,2)}`}connectedCallback(){super.connectedCallback();let r=this.defaultValues(this.cardinality),e={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,defaultValue:r,areaMapping:this.areaMapping,value:null,type:"response",candidateResponse:null};e.value=r,this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get correctResponse(){let r,e=this.querySelector("qti-correct-response");if(e){let t=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&t.length>0)r=t[0].textContent.trim(),t[0].remove();else if(this.cardinality!=="single"){r=[];for(let i=0;i<t.length;i++)r.push(t[i].textContent.trim()),t[i].remove()}}return r}get mapping(){let r=this.querySelector("qti-mapping"),e=parseFloat(r?.getAttribute("lower-bound")),t=parseFloat(r?.getAttribute("upper-bound"));return{defaultValue:Number(r?.getAttribute("default-value"))||0,lowerBound:isNaN(e)?null:e,upperBound:isNaN(t)?null:t,mapEntries:Array.from(r?.querySelectorAll("qti-map-entry")||[]).map(s=>({mapKey:s.getAttribute("map-key")||"",mappedValue:Number(s.getAttribute("mapped-value"))||0,caseSensitive:s.hasAttribute("case-sensitive")?s.getAttribute("case-sensitive")!=="false":!1}))}}get areaMapping(){let r=this.querySelector("qti-area-mapping"),e=Number(r?.getAttribute("default-value"))||0,t=parseFloat(r?.getAttribute("lower-bound")),i=parseFloat(r?.getAttribute("upper-bound")),s=Array.from(r?.querySelectorAll("qti-area-map-entry")||[]).map(n=>({shape:n.getAttribute("shape")||"default",coords:n.getAttribute("coords")||"",mappedValue:Number(n.getAttribute("mapped-value"))||0,defaultValue:Number(n.getAttribute("default-value"))||0}));return{defaultValue:e,lowerBound:isNaN(t)?null:t,upperBound:isNaN(i)?null:i,areaMapEntries:s}}};we.styles=[x`
1493
1493
  :host {
1494
1494
  display: none;
1495
1495
  }
1496
- `],c([u({type:String,attribute:"base-type"})],_e.prototype,"baseType",2),c([u({type:String})],_e.prototype,"identifier",2),c([u({type:String})],_e.prototype,"cardinality",2),c([_({context:$,subscribe:!0}),E()],_e.prototype,"itemContext",2),_e=c([g("qti-response-declaration")],_e);var Lo=(s=>(s.ITEM_NOT_FOUND="item-not-found",s.SECTION_NOT_FOUND="section-not-found",s.LOAD_ERROR="load-error",s.NETWORK_ERROR="network-error",s.TIMEOUT_ERROR="timeout-error",s))(Lo||{}),$o=o=>{class r extends o{constructor(...i){super(...i);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.showLoadingIndicators=!0;this.postLoadTransformCallback=null;this.postLoadTestTransformCallback=null;this._navigationInProgress=!1;this._activeRequests=[];this._lastError=null;this._lastNavigationRequestId=null;this._targetNavigation=null;this.addEventListener("qti-request-navigation",async({detail:s})=>{if(!s?.id)return;let n=`nav_${Date.now()}_${Math.random()}`;this._lastNavigationRequestId=n;try{if(this._navigationInProgress=!0,this._lastError=null,this._dispatchStatusEvent({loading:!0,type:s.type,id:s.id}),this._cancelActiveRequests(),this._targetNavigation={type:s.type,id:s.id},s.type==="item"?await this._navigateToItem(s.id):s.type==="section"&&await this._navigateToSection(s.id),this._lastNavigationRequestId!==n){console.log("Navigation was superseded by a newer request");return}}catch(a){if(this._lastNavigationRequestId===n){let l=this._normalizeError(a,s.type,s.id);this._lastError=l,this._dispatchErrorEvent(l),console.error(`Navigation error (${l.type}):`,l.message,l.details)}}finally{this._lastNavigationRequestId===n&&(this._navigationInProgress=!1,this._dispatchStatusEvent({loading:!1,type:s.type,id:s.id}))}}),this.addEventListener("qti-assessment-test-connected",s=>{this._testElement=s.detail,this._initializeNavigation()})}_initializeNavigation(){let i;this.navigate==="section"&&(i=this._testElement.querySelector("qti-assessment-section")?.identifier),this.navigate==="item"&&(i=this.sessionContext.navItemRefId??this._testElement.querySelector("qti-assessment-item-ref")?.identifier),i&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:this.navigate==="section"?"section":"item",id:i},bubbles:!0,composed:!0}))}navigateTo(i,s){s||(i==="section"&&(s=this._testElement?.querySelector("qti-assessment-section")?.identifier),i==="item"&&(s=this._testElement?.querySelector("qti-assessment-item-ref")?.identifier)),this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}async _navigateToItem(i){let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)throw{type:"item-not-found",message:`Item with identifier "${i}" not found.`,itemId:i};let n=s.closest("qti-test-part")?.identifier,a=s.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:a,navItemRefId:i,navItemLoading:!0};try{await this._loadItems([i])}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}async _navigateToSection(i){let s=this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`);if(!s)throw{type:"section-not-found",message:`Section with identifier "${i}" not found.`,sectionId:i};let n=s.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:i,navItemRefId:null,navItemLoading:!0};try{let a=this._getSectionItemIds(i);await this._loadItems(a)}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}_normalizeError(i,s,n){return i&&i.type&&Object.values(Lo).includes(i.type)?i:i instanceof DOMException&&i.name==="AbortError"?{type:"network-error",message:"Navigation was cancelled because a new navigation was requested.",details:i}:i.name==="TimeoutError"||i.message&&i.message.includes("timeout")?{type:"timeout-error",message:"Request timed out. Please check your network connection.",details:i}:i instanceof TypeError&&i.message.includes("network")?{type:"network-error",message:"A network error occurred. Please check your connection.",details:i}:{type:"load-error",message:`Failed to load ${s}: ${n}`,details:i,itemId:s==="item"?n:void 0,sectionId:s==="section"?n:void 0}}_dispatchErrorEvent(i){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:i,bubbles:!0,composed:!0}))}_dispatchStatusEvent(i){this.showLoadingIndicators&&this.dispatchEvent(new CustomEvent("qti-navigation-status",{detail:i,bubbles:!0,composed:!0}))}_cancelActiveRequests(){this._activeRequests.length>0&&(console.info(`Cancelling ${this._activeRequests.length} pending requests`),this._activeRequests.forEach(i=>{i&&i.readyState!==4&&i.abort()}),this._activeRequests=[])}async _loadItems(i){if(!this._testElement||i.length===0)return;let s=i.map(l=>this._testElement.querySelector(`qti-assessment-item-ref[identifier="${l}"]`)),n=s.reduce((l,p,d)=>(p||l.push(i[d]),l),[]);if(n.length>0)throw{type:"item-not-found",message:`One or more items not found: ${n.join(", ")}`,details:{missingItems:n}};this._clearLoadedItems();let a=s.map(async l=>{if(!l)return null;let p=new Promise((d,m)=>{setTimeout(()=>{m({name:"TimeoutError",message:`Request for item ${l.identifier} timed out after ${this.requestTimeout}ms`})},this.requestTimeout)});try{let{promise:d,request:m}=Je(this.cacheTransform).load(l.href);m instanceof XMLHttpRequest&&this._activeRequests.push(m);let f=await Promise.race([d,p]),b=f;return this.postLoadTransformCallback&&(b=await this.postLoadTransformCallback(f,l)),{itemRef:l,doc:b.htmlDoc(),request:m}}catch(d){if(d instanceof DOMException&&d.name==="AbortError"||d&&d.name==="TimeoutError")return console.log(`Request for item ${l.identifier} was ${d.name==="TimeoutError"?"timed out":"aborted"}`),null;throw d.itemId=l.identifier,d}});try{let p=(await Promise.all(a)).filter(d=>d!==null);if(p.forEach(({itemRef:d,doc:m})=>{d&&m&&(d.xmlDoc=m)}),this._activeRequests=[],requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:p.map(({itemRef:d})=>({identifier:d?.identifier,element:d})),bubbles:!0,composed:!0}))}),p.length===0&&i.length>0)throw{type:"load-error",message:"All item requests failed to load",details:{itemIds:i}};return p}catch(l){throw console.error("Error loading items:",l),l}}_getSectionItemIds(i){if(!this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`))throw{type:"section-not-found",message:`Section with identifier "${i}" not found.`,sectionId:i};return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(n=>n.identifier)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(i||[]).forEach(s=>{s.xmlDoc=null})}retryNavigation(){if(this._lastError){let i=this._lastError.itemId?"item":"section",s=this._lastError.itemId||this._lastError.sectionId;s&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}else this._targetNavigation&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:this._targetNavigation,bubbles:!0,composed:!0}))}}return c([u({type:String})],r.prototype,"navigate",2),c([u({type:Boolean,attribute:"cache-transform"})],r.prototype,"cacheTransform",2),c([u({type:Number})],r.prototype,"requestTimeout",2),c([u({type:Boolean})],r.prototype,"showLoadingIndicators",2),c([u({type:Function})],r.prototype,"postLoadTransformCallback",2),c([u({type:Function,hasChanged:(i,s)=>i!==s})],r.prototype,"postLoadTestTransformCallback",2),r};var Po=o=>{class r extends o{constructor(...t){super(...t),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(t){super.willUpdate(t),t.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(n=>{n.classList.toggle("show",n.getAttribute("view")===this.sessionContext.view)});let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;s&&s.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(t){t.showCorrectResponse(this.sessionContext.view==="scorer")}}return r};var ys={view:"candidate"},He=Symbol("testContext");var Ct=class extends v{constructor(){super();this.testContext=Ji;this.sessionContext=ys;this._updateItemInTestContext=e=>{let t=e._context,i=t.identifier,s=t.variables,n=this.testContext.items.find(a=>a?.identifier===i);if(!n){console.warn(`Item IDs between assessment.xml and item.xml should match: ${i} is not found!`);return}if(n.variables?.length===1)this._updateItemVariablesInTestContext(i,s);else{let a=[...e.variables];for(let l of n.variables){let p=a.find(d=>d.identifier===l.identifier);p?p.value=l.value:a.push(l)}e.variables=a}};this.addEventListener("qti-assessment-test-connected",e=>{if(this.testContext=Ji,this.sessionContext=ys,this.testContext&&this.testContext.items.length>0)return;this._testElement=e.detail;let t=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(i=>({href:i.href,identifier:i.identifier,category:i.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:t}}),this.addEventListener("qti-assessment-item-connected",e=>{let t=e.detail,i=t.closest("qti-assessment-item-ref")?.identifier;i&&(t.assessmentItemRefId=i),this._updateItemInTestContext(e.detail)}),this.addEventListener("qti-item-context-updated",e=>{this._updateItemVariablesInTestContext(e.detail.itemContext.identifier,e.detail.itemContext.variables)})}updateItemVariables(e,t){let i=this.testContext.items.find(n=>n.identifier===e);i&&(i.variables=i.variables.map(n=>{let a=t.find(l=>l.identifier===n.identifier);return a?{...n,...a}:n}));let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${e}"]`);s&&s.assessmentItem&&(s.assessmentItem.variables=t)}_updateItemVariablesInTestContext(e,t){this.testContext={...this.testContext,items:this.testContext.items.map(i=>i.identifier!==e?i:{...i,variables:t.map(s=>{let n=i.variables.find(a=>a.identifier===s.identifier);return n?{...n,...s}:s})})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}};c([u({attribute:!1,type:Object}),X({context:ue})],Ct.prototype,"testContext",2),c([u({attribute:!1,type:Object}),X({context:He})],Ct.prototype,"sessionContext",2);var Oo=o=>{class r extends o{constructor(...t){super(...t),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:s,value:n}=i.detail;this.updateOutcomeVariable(s,n),i.stopPropagation()})}outcomeProcessing(){let t=this.querySelector("qti-outcome-processing");return t?(t?.process(),!0):!1}updateOutcomeVariable(t,i){let s=this.getOutcome(t);if(!s){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>n.identifier!==t?n:{...n,value:s.cardinality==="single"?i:[...n.value,i]})}}getOutcome(t){return this.getVariable(t)}getVariable(t){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===t)||null}}return r};var ai=class extends $o(Po(Oo(Ct))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return h`<slot></slot>`}};ai=c([g("qti-test")],ai);var li=["this"],No=["+","-","!"],Vo=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],xs={"!":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},ci=13;var Ln=["==","!=","<=",">=","||","&&","??","|>"],$n=["===","!=="],k;(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"})(k||(k={}));var fe=(o,r,e=0)=>({kind:o,value:r,precedence:e}),Pn=o=>o===9||o===10||o===13||o===32,Do=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),On=o=>Do(o)||vr(o),Nn=o=>li.indexOf(o)!==-1,Vn=o=>o===34||o===39,vr=o=>48<=o&&o<=57,Dn=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,Hn=o=>o===40||o===41||o===91||o===93||o===123||o===125,zn=o=>o.replace(/\\(.)/g,(r,e)=>{switch(e){case"n":return`
1497
- `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),pi=class{#s;#n=-1;#i=0;#t;constructor(r){this.#s=r,this.#e()}nextToken(){for(;Pn(this.#t);)this.#e(!0);if(Vn(this.#t))return this.#l();if(Do(this.#t))return this.#p();if(vr(this.#t))return this.#d();if(this.#t===46)return this.#a();if(this.#t===44)return this.#u();if(this.#t===58)return this.#c();if(Dn(this.#t))return this.#h();if(Hn(this.#t))return this.#f();if(this.#e(),this.#t!==void 0)throw new Error(`Expected end of input, got ${this.#t}`)}#e(r){this.#n++,this.#n<this.#s.length?(this.#t=this.#s.charCodeAt(this.#n),r===!0&&(this.#i=this.#n)):this.#t=void 0}#r(r=0){let e=this.#s.substring(this.#i,this.#n+r);return r===0&&this.#o(),e}#o(){this.#i=this.#n}#l(){let r="unterminated string",e=this.#t;for(this.#e(!0);this.#t!==e;){if(this.#t===void 0)throw new Error(r);if(this.#t===92&&(this.#e(),this.#t===void 0))throw new Error(r);this.#e()}let t=fe(k.STRING,zn(this.#r()));return this.#e(),t}#p(){do this.#e();while(On(this.#t));let r=this.#r(),e=Nn(r)?k.KEYWORD:k.IDENTIFIER;return fe(e,r)}#d(){do this.#e();while(vr(this.#t));return this.#t===46?this.#a():fe(k.INTEGER,this.#r())}#a(){return this.#e(),vr(this.#t)?this.#m():(this.#o(),fe(k.DOT,".",ci))}#u(){return this.#e(!0),fe(k.COMMA,",")}#c(){return this.#e(!0),fe(k.COLON,":")}#m(){do this.#e();while(vr(this.#t));return fe(k.DECIMAL,this.#r())}#h(){this.#e();let r=this.#r(2);if($n.indexOf(r)!==-1)this.#e(),this.#e();else{if(r=this.#r(1),r==="=>")return this.#e(),fe(k.ARROW,r);Ln.indexOf(r)!==-1&&this.#e()}return r=this.#r(),fe(k.OPERATOR,r,xs[r])}#f(){let r=String.fromCharCode(this.#t),e=fe(k.GROUPER,r,xs[r]);return this.#e(!0),e}};var qs=(o,r)=>new yr(o,r).parse(),yr=class{#s;#n;#i;#t;#e;constructor(r,e){this.#n=new pi(r),this.#i=e}parse(){return this.#r(),this.#o()}#r(r,e){if(!this._matches(r,e))throw new Error(`Expected kind ${r} (${e}), was ${this.#t?.kind} (${this.#t?.value})`);let t=this.#n.nextToken();this.#t=t,this.#s=t?.kind,this.#e=t?.value}_matches(r,e){return!(r&&this.#s!==r||e&&this.#e!==e)}#o(){if(!this.#t)return this.#i.empty();let r=this.#a();return r===void 0?void 0:this.#l(r,0)}#l(r,e){if(r===void 0)throw new Error("Expected left to be defined.");for(;this.#t;)if(this._matches(k.GROUPER,"(")){let t=this.#g();r=this.#i.invoke(r,void 0,t)}else if(this._matches(k.GROUPER,"[")){let t=this.#x();r=this.#i.index(r,t)}else if(this._matches(k.DOT)){this.#r();let t=this.#a();r=this.#p(r,t)}else{if(this._matches(k.KEYWORD))break;if(this._matches(k.OPERATOR)&&this.#t.precedence>=e)r=this.#e==="?"?this.#u(r):this.#d(r,this.#t);else break}return r}#p(r,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#i.getter(r,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let t=e.receiver;return this.#i.invoke(r,t.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#d(r,e){if(Vo.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#r();let t=this.#a();for(;(this.#s===k.OPERATOR||this.#s===k.DOT||this.#s===k.GROUPER)&&this.#t.precedence>e.precedence;)t=this.#l(t,this.#t.precedence);return this.#i.binary(r,e.value,t)}#a(){if(this._matches(k.OPERATOR)){let r=this.#e;if(this.#r(),r==="+"||r==="-"){if(this._matches(k.INTEGER))return this.#b(r);if(this._matches(k.DECIMAL))return this.#v(r)}if(No.indexOf(r)===-1)throw new Error(`unexpected token: ${r}`);let e=this.#l(this.#c(),ci);return this.#i.unary(r,e)}return this.#c()}#u(r){this.#r(k.OPERATOR,"?");let e=this.#o();this.#r(k.COLON);let t=this.#o();return this.#i.ternary(r,e,t)}#c(){switch(this.#s){case k.KEYWORD:let r=this.#e;if(r==="this")return this.#r(),this.#i.id(r);throw li.indexOf(r)!==-1?new Error(`unexpected keyword: ${r}`):new Error(`unrecognized keyword: ${r}`);case k.IDENTIFIER:return this.#f();case k.STRING:return this.#E();case k.INTEGER:return this.#b();case k.DECIMAL:return this.#v();case k.GROUPER:return this.#e==="("?this.#q():this.#e==="{"?this.#h():this.#e==="["?this.#m():void 0;case k.COLON:throw new Error('unexpected token ":"');default:return}}#m(){let r=[];do{if(this.#r(),this._matches(k.GROUPER,"]"))break;r.push(this.#o())}while(this._matches(k.COMMA));return this.#r(k.GROUPER,"]"),this.#i.list(r)}#h(){let r={};do{if(this.#r(),this._matches(k.GROUPER,"}"))break;let e=this.#e;(this._matches(k.STRING)||this._matches(k.IDENTIFIER))&&this.#r(),this.#r(k.COLON),r[e]=this.#o()}while(this._matches(k.COMMA));return this.#r(k.GROUPER,"}"),this.#i.map(r)}#f(){let r=this.#e;if(r==="true")return this.#r(),this.#i.literal(!0);if(r==="false")return this.#r(),this.#i.literal(!1);if(r==="null")return this.#r(),this.#i.literal(null);if(r==="undefined")return this.#r(),this.#i.literal(void 0);let e=this.#y(),t=this.#g();return t?this.#i.invoke(e,void 0,t):e}#y(){if(!this._matches(k.IDENTIFIER))throw new Error(`expected identifier: ${this.#e}`);let r=this.#e;return this.#r(),this.#i.id(r)}#g(){if(!this._matches(k.GROUPER,"("))return;let r=[];do{if(this.#r(),this._matches(k.GROUPER,")"))break;let e=this.#o();r.push(e)}while(this._matches(k.COMMA));return this.#r(k.GROUPER,")"),r}#x(){this.#r();let r=this.#o();return this.#r(k.GROUPER,"]"),r}#q(){let r=this.#g();if(this._matches(k.ARROW)){this.#r();let e=this.#o(),t=r?.map(i=>i.value)??[];return this.#i.arrowFunction(t,e)}else return this.#i.paren(r[0])}#E(){let r=this.#i.literal(this.#e);return this.#r(),r}#b(r=""){let e=this.#i.literal(parseInt(`${r}${this.#e}`,10));return this.#r(),e}#v(r=""){let e=this.#i.literal(parseFloat(`${r}${this.#e}`));return this.#r(),e}};var{hasOwn:Ho,fromEntries:Fn}=Object,Un={"+":(o,r)=>o+r,"-":(o,r)=>o-r,"*":(o,r)=>o*r,"/":(o,r)=>o/r,"%":(o,r)=>o%r,"==":(o,r)=>o==r,"!=":(o,r)=>o!=r,"===":(o,r)=>o===r,"!==":(o,r)=>o!==r,">":(o,r)=>o>r,">=":(o,r)=>o>=r,"<":(o,r)=>o<r,"<=":(o,r)=>o<=r,"||":(o,r)=>o||r,"&&":(o,r)=>o&&r,"??":(o,r)=>o??r,"|":(o,r)=>r(o),"|>":(o,r)=>r(o)},jn={"+":o=>o,"-":o=>-o,"!":o=>!o},di=class{empty(){return{type:"Empty",evaluate(r){return r},getIds(r){return r}}}literal(r){return{type:"Literal",value:r,evaluate(e){return this.value},getIds(e){return e}}}id(r){return{type:"ID",value:r,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(r,e){let t=jn[r];return{type:"Unary",operator:r,child:e,evaluate(i){return t(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(r,e,t){let i=Un[e];return{type:"Binary",operator:e,left:r,right:t,evaluate(s){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let n=this.right.evaluate(s),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(s),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(s),l=this.left.argument.evaluate(s)):this.left.type==="ID"&&(a=s,l=this.left.value),a===void 0?void 0:a[l]=n}return i(this.left.evaluate(s),this.right.evaluate(s))},getIds(s){return this.left.getIds(s),this.right.getIds(s),s}}}getter(r,e){return{type:"Getter",receiver:r,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(r,e,t){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:r,method:e,arguments:t,evaluate(i){let s=this.receiver.evaluate(i),n=this.method?s:i?.this??i,a=this.method?s?.[e]:s,p=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(n,p)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(s=>s?.getIds(i)),i}}}paren(r){return r}index(r,e){return{type:"Index",receiver:r,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(r,e,t){return{type:"Ternary",condition:r,trueExpr:e,falseExpr:t,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(r){return{type:"Map",entries:r,evaluate(e){let t={};if(r&&this.entries)for(let i in r){let s=this.entries[i];s&&(t[i]=s.evaluate(e))}return t},getIds(e){if(r&&this.entries)for(let t in r){let i=this.entries[t];i&&i.getIds(e)}return e}}}list(r){return{type:"List",items:r,evaluate(e){return this.items?.map(t=>t?.evaluate(e))},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(r,e){return{type:"ArrowFunction",params:r,body:e,evaluate(t){let i=this.params,s=this.body;return function(...n){let a=Fn(i.map((p,d)=>[p,n[d]])),l=new Proxy(t??{},{set(p,d,m){return Ho(a,d)&&(a[d]=m),p[d]=m},get(p,d){return Ho(a,d)?a[d]:p[d]}});return s.evaluate(l)}},getIds(t){return this.body.getIds(t).filter(i=>!this.params.includes(i))}}}};var Es=null,zo={boundAttributeSuffix:H.M,marker:H.P,markerMatch:H.A,HTML_RESULT:H.C,getTemplateHtml:H.L,overrideDirectiveResolve:(o,r)=>class extends o{_$AS(e,t){return r(this,t)}},patchDirectiveResolve:(o,r)=>{if(o.prototype._$AS.name!==r.name){Es??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Es))return void(e[Es]=r);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,r){o._$litDirective$=r},getAttributePartCommittedValue:(o,r,e)=>{let t=O;return o.j=i=>t=i,o._$AI(r,o,e),t},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:H.V,AttributePart:H.H,PropertyPart:H.B,BooleanAttributePart:H.N,EventPart:H.U,ElementPart:H.F,TemplateInstance:H.R,isIterable:H.D,ChildPart:H.I};var{AttributePart:Bn,PropertyPart:Wn,BooleanAttributePart:Xn,EventPart:Gn}=zo,ws=new di,Cs=new Map,Fo=o=>o.replace(/-(-|\w)/g,(r,e)=>e.toUpperCase()),ui=(o,r)=>{let e=Cs.get(o);if(e===void 0){if(Cs.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let t=o.substring(2,o.length-2).trim();e=new yr(t,ws).parse(),Cs.set(o,e)}}return e?.evaluate(r)},Yn=(o,r,e,t)=>{let i=o.getAttribute("if");if(i!==null&&ui(i,r))return mi(o,r,e,t)},Uo=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,jo=o=>/(?:\\{{)|(?:\\}})/g.test(o),xr=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Jn=(o,r,e,t)=>{let i=o.getAttribute("repeat");if(i!==null){let s=ui(i,r);if(!s[Symbol.iterator])return S;let n=qr(o),a=-1,l=[];for(let p of s){a++;let d=Object.create(r);d.item=p,d.index=a,d.this=r.this??r;let m=[];for(let b of n.parts){let y=b.update(d,e,t);b.type===1?m.push(...y):m.push(y)}let f={_$litType$:n,values:m};l.push(f)}return l}},Wo={if:Yn,repeat:Jn},Z=(o,r=Wo,e={},t)=>{let s=qr(o).renderers;if(t){let a=qr(t).renderers,l=s.super;l!==void 0?e={...s,...e,super:(p,d,m)=>(m={...a,...m,super:(f,b,y)=>mi(t,f,b,y)},l(p,d,m))}:(e={...a,...s,...e},o=t)}else e={...s,...e};return n=>mi(o,n,r,e)};var mi=(o,r,e=Wo,t={})=>{let i=qr(o),s=[];for(let a of i.parts){let l=a.update(r,e,t);a.type===1?s.push(...l):s.push(l)}return{_$litType$:i,values:s}},Bo=new Map,qr=o=>{let r=Bo.get(o);return r===void 0&&Bo.set(o,r=Kn(o)),r},Kn=o=>{let r={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(r.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),t=e.currentNode,i=-1,s=[];for(;(t=e.nextNode())!==null;)if(t.nodeType===Node.COMMENT_NODE)i++;else if(t.nodeType===Node.ELEMENT_NODE){i++;let n=t;if(n.tagName==="TEMPLATE"){let l=n.getAttribute("type"),p=n.getAttribute("name"),d=n.getAttribute("call");if(d!==null||l!==null||p!==null){n.parentNode.insertBefore(document.createComment(""),n),s.push(n);let m;if(d!==null){let f=d.trim(),b=f.startsWith("{{")&&f.endsWith("}}");m=(y,C,R)=>{let q=n.getAttribute("data"),T=q===null?void 0:ui(q,y);return(b?ui(f,y):R[d])?.(T,C,R)}}else l!==null?m=(f,b,y)=>{let C=b[l];return C?.(n,f,b,y)}:(p==="super"?r.renderers.super=(f,b,y)=>{let C=y.super,R=qr(n);return y={...y,...R.renderers},C(f,b,y)}:r.renderers[p]=(f,b,y)=>mi(n,f,b,y),m=(f,b,y)=>{let C=y[p];return C?.(f,b,y)});r.parts.push({type:2,index:i,update:m});continue}}let a=n.getAttributeNames();for(let l of a){let p=n.getAttribute(l),d=p.split(Uo);if(d.length===1){jo(p)&&n.setAttribute(l,xr(p));continue}n.removeAttribute(l);let m=l,f=Bn,b=l[0];b==="."?(m=Fo(l.substring(1)),f=Wn):b==="?"?(m=l.substring(1),f=Xn):b==="@"&&(m=Fo(l.substring(1)),f=Gn);let y=[xr(d[0])],C=[];for(let R=1;R<d.length;R+=2){let q=d[R];C.push(qs(q,ws)),y.push(xr(d[R+1]))}r.parts.push({type:1,index:i,name:m,strings:y,ctor:f,update:(R,q,T)=>C.map(M=>M.evaluate(R))})}}else if(t.nodeType===Node.TEXT_NODE){let n=t,a=n.textContent,l=a.split(Uo);l.length>1?n.textContent=xr(l[0]):jo(a)&&(n.textContent=xr(a));for(let p=1;p<l.length;p+=2){let d=l[p],m=qs(d,ws);r.parts.push({type:2,index:++i,update:(b,y)=>m.evaluate(b)});let f=new Text(l[p+1].replace("\\{{","{{"));n.parentNode.insertBefore(f,n.nextSibling),n.parentNode.insertBefore(document.createComment(""),n.nextSibling),n=f,e.currentNode=f}}for(let n of s)n.remove();return r};var Xo={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Te=class extends v{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback();let e=this.getRootNode().host.closest("qti-test").querySelector("template[item-ref]");e&&(this.myTemplate=Z(e)),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};c([u({type:String})],Te.prototype,"category",2),c([u({type:String})],Te.prototype,"identifier",2),c([u({type:Boolean,converter:Xo})],Te.prototype,"required",2),c([u({type:Boolean,converter:Xo})],Te.prototype,"fixed",2),c([u({type:String})],Te.prototype,"href",2),c([u({type:Object,attribute:!1})],Te.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",Te);var _s={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},ke=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){this._title=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};c([u({type:String})],ke.prototype,"identifier",2),c([u({type:String})],ke.prototype,"required",2),c([u({type:Boolean,converter:_s})],ke.prototype,"fixed",2),c([u({type:Boolean,converter:_s})],ke.prototype,"visible",2),c([u({type:Boolean,converter:_s,attribute:"keep-together"})],ke.prototype,"keepTogether",2),c([_({context:ue,subscribe:!0})],ke.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",ke);var et=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};c([u({type:String})],et.prototype,"identifier",2),c([u({type:String})],et.prototype,"title",1),c([_({context:ue,subscribe:!0})],et.prototype,"_testContext",2),et=c([g("qti-assessment-test")],et);var Ae=class extends v{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};c([u({type:String})],Ae.prototype,"identifier",2),c([u({type:String})],Ae.prototype,"class",2),c([u({type:String,attribute:"navigation-mode"})],Ae.prototype,"navigationMode",2),c([u({type:String,attribute:"submission-mode"})],Ae.prototype,"submissionMode",2),Ae=c([g("qti-test-part")],Ae);customElements.get("qti-test-part")||customElements.define("qti-test-part",Ae);var Er=class extends Ze{render(){return h``}};Er.styles=x`
1496
+ `],c([u({type:String,attribute:"base-type"})],we.prototype,"baseType",2),c([u({type:String})],we.prototype,"identifier",2),c([u({type:String})],we.prototype,"cardinality",2),c([_({context:$,subscribe:!0}),E()],we.prototype,"itemContext",2),we=c([g("qti-response-declaration")],we);var Lo=(s=>(s.ITEM_NOT_FOUND="item-not-found",s.SECTION_NOT_FOUND="section-not-found",s.LOAD_ERROR="load-error",s.NETWORK_ERROR="network-error",s.TIMEOUT_ERROR="timeout-error",s))(Lo||{}),$o=o=>{class r extends o{constructor(...i){super(...i);this.navigate=null;this.cacheTransform=!1;this.requestTimeout=3e4;this.showLoadingIndicators=!0;this.postLoadTransformCallback=null;this.postLoadTestTransformCallback=null;this._navigationInProgress=!1;this._activeRequests=[];this._lastError=null;this._lastNavigationRequestId=null;this._targetNavigation=null;this.addEventListener("qti-request-navigation",async({detail:s})=>{if(!s?.id)return;let n=`nav_${Date.now()}_${Math.random()}`;this._lastNavigationRequestId=n;try{if(this._navigationInProgress=!0,this._lastError=null,this._dispatchStatusEvent({loading:!0,type:s.type,id:s.id}),this._cancelActiveRequests(),this._targetNavigation={type:s.type,id:s.id},s.type==="item"?await this._navigateToItem(s.id):s.type==="section"&&await this._navigateToSection(s.id),this._lastNavigationRequestId!==n){console.log("Navigation was superseded by a newer request");return}}catch(a){if(this._lastNavigationRequestId===n){let l=this._normalizeError(a,s.type,s.id);this._lastError=l,this._dispatchErrorEvent(l),console.error(`Navigation error (${l.type}):`,l.message,l.details)}}finally{this._lastNavigationRequestId===n&&(this._navigationInProgress=!1,this._dispatchStatusEvent({loading:!1,type:s.type,id:s.id}))}}),this.addEventListener("qti-assessment-test-connected",s=>{this._testElement=s.detail,this._initializeNavigation()})}_initializeNavigation(){let i;this.navigate==="section"&&(i=this._testElement.querySelector("qti-assessment-section")?.identifier),this.navigate==="item"&&(i=this.sessionContext.navItemRefId??this._testElement.querySelector("qti-assessment-item-ref")?.identifier),i&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:this.navigate==="section"?"section":"item",id:i},bubbles:!0,composed:!0}))}navigateTo(i,s){s||(i==="section"&&(s=this._testElement?.querySelector("qti-assessment-section")?.identifier),i==="item"&&(s=this._testElement?.querySelector("qti-assessment-item-ref")?.identifier)),this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}async _navigateToItem(i){let s=this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${i}"]`);if(!s)throw{type:"item-not-found",message:`Item with identifier "${i}" not found.`,itemId:i};let n=s.closest("qti-test-part")?.identifier,a=s.closest("qti-assessment-section")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:a,navItemRefId:i,navItemLoading:!0};try{await this._loadItems([i])}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}async _navigateToSection(i){let s=this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`);if(!s)throw{type:"section-not-found",message:`Section with identifier "${i}" not found.`,sectionId:i};let n=s.closest("qti-test-part")?.identifier;this.sessionContext={...this.sessionContext,navPartId:n,navSectionId:i,navItemRefId:null,navItemLoading:!0};try{let a=this._getSectionItemIds(i);await this._loadItems(a)}finally{this.sessionContext={...this.sessionContext,navItemLoading:!1}}}_normalizeError(i,s,n){return i&&i.type&&Object.values(Lo).includes(i.type)?i:i instanceof DOMException&&i.name==="AbortError"?{type:"network-error",message:"Navigation was cancelled because a new navigation was requested.",details:i}:i.name==="TimeoutError"||i.message&&i.message.includes("timeout")?{type:"timeout-error",message:"Request timed out. Please check your network connection.",details:i}:i instanceof TypeError&&i.message.includes("network")?{type:"network-error",message:"A network error occurred. Please check your connection.",details:i}:{type:"load-error",message:`Failed to load ${s}: ${n}`,details:i,itemId:s==="item"?n:void 0,sectionId:s==="section"?n:void 0}}_dispatchErrorEvent(i){this.dispatchEvent(new CustomEvent("qti-navigation-error",{detail:i,bubbles:!0,composed:!0}))}_dispatchStatusEvent(i){this.showLoadingIndicators&&this.dispatchEvent(new CustomEvent("qti-navigation-status",{detail:i,bubbles:!0,composed:!0}))}_cancelActiveRequests(){this._activeRequests.length>0&&(console.info(`Cancelling ${this._activeRequests.length} pending requests`),this._activeRequests.forEach(i=>{i&&i.readyState!==4&&i.abort()}),this._activeRequests=[])}async _loadItems(i){if(!this._testElement||i.length===0)return;let s=i.map(l=>this._testElement.querySelector(`qti-assessment-item-ref[identifier="${l}"]`)),n=s.reduce((l,p,d)=>(p||l.push(i[d]),l),[]);if(n.length>0)throw{type:"item-not-found",message:`One or more items not found: ${n.join(", ")}`,details:{missingItems:n}};this._clearLoadedItems();let a=s.map(async l=>{if(!l)return null;let p=new Promise((d,m)=>{setTimeout(()=>{m({name:"TimeoutError",message:`Request for item ${l.identifier} timed out after ${this.requestTimeout}ms`})},this.requestTimeout)});try{let{promise:d,request:m}=Je(this.cacheTransform).load(l.href);m instanceof XMLHttpRequest&&this._activeRequests.push(m);let f=await Promise.race([d,p]),b=f;return this.postLoadTransformCallback&&(b=await this.postLoadTransformCallback(f,l)),{itemRef:l,doc:b.htmlDoc(),request:m}}catch(d){if(d instanceof DOMException&&d.name==="AbortError"||d&&d.name==="TimeoutError")return console.log(`Request for item ${l.identifier} was ${d.name==="TimeoutError"?"timed out":"aborted"}`),null;throw d.itemId=l.identifier,d}});try{let p=(await Promise.all(a)).filter(d=>d!==null);if(p.forEach(({itemRef:d,doc:m})=>{d&&m&&(d.xmlDoc=m)}),this._activeRequests=[],requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("qti-test-loaded",{detail:p.map(({itemRef:d})=>({identifier:d?.identifier,element:d})),bubbles:!0,composed:!0}))}),p.length===0&&i.length>0)throw{type:"load-error",message:"All item requests failed to load",details:{itemIds:i}};return p}catch(l){throw console.error("Error loading items:",l),l}}_getSectionItemIds(i){if(!this._testElement?.querySelector(`qti-assessment-section[identifier="${i}"]`))throw{type:"section-not-found",message:`Section with identifier "${i}" not found.`,sectionId:i};return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${i}"] > qti-assessment-item-ref`)).map(n=>n.identifier)}_clearLoadedItems(){let i=this._testElement?.querySelectorAll("qti-assessment-test qti-assessment-item-ref");Array.from(i||[]).forEach(s=>{s.xmlDoc=null})}retryNavigation(){if(this._lastError){let i=this._lastError.itemId?"item":"section",s=this._lastError.itemId||this._lastError.sectionId;s&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:{type:i,id:s},bubbles:!0,composed:!0}))}else this._targetNavigation&&this.dispatchEvent(new CustomEvent("qti-request-navigation",{detail:this._targetNavigation,bubbles:!0,composed:!0}))}}return c([u({type:String})],r.prototype,"navigate",2),c([u({type:Boolean,attribute:"cache-transform"})],r.prototype,"cacheTransform",2),c([u({type:Number})],r.prototype,"requestTimeout",2),c([u({type:Boolean})],r.prototype,"showLoadingIndicators",2),c([u({type:Function})],r.prototype,"postLoadTransformCallback",2),c([u({type:Function,hasChanged:(i,s)=>i!==s})],r.prototype,"postLoadTestTransformCallback",2),r};var Oo=o=>{class r extends o{constructor(...t){super(...t),this.sessionContext={...this.sessionContext,view:"candidate"},this.addEventListener("on-test-switch-view",i=>{this.sessionContext={...this.sessionContext,view:i.detail},this._updateElementView()}),this.addEventListener("qti-assessment-test-connected",()=>{this._updateElementView()}),this.addEventListener("qti-assessment-item-connected",i=>{this._updateElementView(),this._setCorrectResponseVisibility(i.detail)})}willUpdate(t){super.willUpdate(t),t.has("sessionContext")&&this._updateElementView()}_updateElementView(){if(this._testElement){Array.from(this._testElement.querySelectorAll("[view]")).forEach(n=>{n.classList.toggle("show",n.getAttribute("view")===this.sessionContext.view)});let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`)?.assessmentItem;s&&s.showCorrectResponse(this.sessionContext.view==="scorer")}}_setCorrectResponseVisibility(t){t.showCorrectResponse(this.sessionContext.view==="scorer")}}return r};var ys={view:"candidate"},He=Symbol("testContext");var Ct=class extends v{constructor(){super();this.testContext=Ji;this.sessionContext=ys;this._updateItemInTestContext=e=>{let t=e._context,i=t.identifier,s=t.variables,n=this.testContext.items.find(a=>a?.identifier===i);if(!n){console.warn(`Item IDs between assessment.xml and item.xml should match: ${i} is not found!`);return}if(n.variables?.length===1)this._updateItemVariablesInTestContext(i,s);else{let a=[...e.variables];for(let l of n.variables){let p=a.find(d=>d.identifier===l.identifier);p?p.value=l.value:a.push(l)}e.variables=a}};this.addEventListener("qti-assessment-test-connected",e=>{if(this.testContext=Ji,this.sessionContext=ys,this.testContext&&this.testContext.items.length>0)return;this._testElement=e.detail;let t=Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map(i=>({href:i.href,identifier:i.identifier,category:i.category,variables:[{identifier:"completionStatus",value:"not_attempted",type:"outcome"}]}));this.testContext={...this.testContext,items:t}}),this.addEventListener("qti-assessment-item-connected",e=>{let t=e.detail,i=t.closest("qti-assessment-item-ref")?.identifier;i&&(t.assessmentItemRefId=i),this._updateItemInTestContext(e.detail)}),this.addEventListener("qti-item-context-updated",e=>{this._updateItemVariablesInTestContext(e.detail.itemContext.identifier,e.detail.itemContext.variables)})}updateItemVariables(e,t){let i=this.testContext.items.find(n=>n.identifier===e);i&&(i.variables=i.variables.map(n=>{let a=t.find(l=>l.identifier===n.identifier);return a?{...n,...a}:n}));let s=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${e}"]`);s&&s.assessmentItem&&(s.assessmentItem.variables=t)}_updateItemVariablesInTestContext(e,t){this.testContext={...this.testContext,items:this.testContext.items.map(i=>i.identifier!==e?i:{...i,variables:t.map(s=>{let n=i.variables.find(a=>a.identifier===s.identifier);return n?{...n,...s}:s})})},this.dispatchEvent(new CustomEvent("qti-test-context-updated",{detail:this.testContext,bubbles:!1,composed:!1}))}};c([u({attribute:!1,type:Object}),X({context:ue})],Ct.prototype,"testContext",2),c([u({attribute:!1,type:Object}),X({context:He})],Ct.prototype,"sessionContext",2);var Po=o=>{class r extends o{constructor(...t){super(...t),this.addEventListener("qti-register-variable",i=>{this.testContext={...this.testContext,testOutcomeVariables:[...this.testContext.testOutcomeVariables||[],i.detail.variable]},i.stopPropagation()}),this.addEventListener("qti-set-outcome-value",i=>{let{outcomeIdentifier:s,value:n}=i.detail;this.updateOutcomeVariable(s,n),i.stopPropagation()})}outcomeProcessing(){let t=this.querySelector("qti-outcome-processing");return t?(t?.process(),!0):!1}updateOutcomeVariable(t,i){let s=this.getOutcome(t);if(!s){console.warn(`Can not set qti-outcome-identifier: ${t}, it is not available`);return}this.testContext={...this.testContext,testOutcomeVariables:this.testContext.testOutcomeVariables?.map(n=>n.identifier!==t?n:{...n,value:s.cardinality==="single"?i:[...n.value,i]})}}getOutcome(t){return this.getVariable(t)}getVariable(t){return this.testContext.testOutcomeVariables?.find(i=>i.identifier===t)||null}}return r};var ai=class extends $o(Oo(Po(Ct))){async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-test-connected",{detail:this}))}render(){return h`<slot></slot>`}};ai=c([g("qti-test")],ai);var li=["this"],No=["+","-","!"],Vo=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],xs={"!":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},ci=13;var Ln=["==","!=","<=",">=","||","&&","??","|>"],$n=["===","!=="],k;(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"})(k||(k={}));var fe=(o,r,e=0)=>({kind:o,value:r,precedence:e}),On=o=>o===9||o===10||o===13||o===32,Do=o=>o===95||o===36||(o&=-33,65<=o&&o<=90),Pn=o=>Do(o)||vr(o),Nn=o=>li.indexOf(o)!==-1,Vn=o=>o===34||o===39,vr=o=>48<=o&&o<=57,Dn=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,Hn=o=>o===40||o===41||o===91||o===93||o===123||o===125,zn=o=>o.replace(/\\(.)/g,(r,e)=>{switch(e){case"n":return`
1497
+ `;case"r":return"\r";case"t":return" ";case"b":return"\b";case"f":return"\f";default:return e}}),pi=class{#s;#n=-1;#i=0;#t;constructor(r){this.#s=r,this.#e()}nextToken(){for(;On(this.#t);)this.#e(!0);if(Vn(this.#t))return this.#l();if(Do(this.#t))return this.#p();if(vr(this.#t))return this.#d();if(this.#t===46)return this.#a();if(this.#t===44)return this.#u();if(this.#t===58)return this.#c();if(Dn(this.#t))return this.#h();if(Hn(this.#t))return this.#f();if(this.#e(),this.#t!==void 0)throw new Error(`Expected end of input, got ${this.#t}`)}#e(r){this.#n++,this.#n<this.#s.length?(this.#t=this.#s.charCodeAt(this.#n),r===!0&&(this.#i=this.#n)):this.#t=void 0}#r(r=0){let e=this.#s.substring(this.#i,this.#n+r);return r===0&&this.#o(),e}#o(){this.#i=this.#n}#l(){let r="unterminated string",e=this.#t;for(this.#e(!0);this.#t!==e;){if(this.#t===void 0)throw new Error(r);if(this.#t===92&&(this.#e(),this.#t===void 0))throw new Error(r);this.#e()}let t=fe(k.STRING,zn(this.#r()));return this.#e(),t}#p(){do this.#e();while(Pn(this.#t));let r=this.#r(),e=Nn(r)?k.KEYWORD:k.IDENTIFIER;return fe(e,r)}#d(){do this.#e();while(vr(this.#t));return this.#t===46?this.#a():fe(k.INTEGER,this.#r())}#a(){return this.#e(),vr(this.#t)?this.#m():(this.#o(),fe(k.DOT,".",ci))}#u(){return this.#e(!0),fe(k.COMMA,",")}#c(){return this.#e(!0),fe(k.COLON,":")}#m(){do this.#e();while(vr(this.#t));return fe(k.DECIMAL,this.#r())}#h(){this.#e();let r=this.#r(2);if($n.indexOf(r)!==-1)this.#e(),this.#e();else{if(r=this.#r(1),r==="=>")return this.#e(),fe(k.ARROW,r);Ln.indexOf(r)!==-1&&this.#e()}return r=this.#r(),fe(k.OPERATOR,r,xs[r])}#f(){let r=String.fromCharCode(this.#t),e=fe(k.GROUPER,r,xs[r]);return this.#e(!0),e}};var qs=(o,r)=>new yr(o,r).parse(),yr=class{#s;#n;#i;#t;#e;constructor(r,e){this.#n=new pi(r),this.#i=e}parse(){return this.#r(),this.#o()}#r(r,e){if(!this._matches(r,e))throw new Error(`Expected kind ${r} (${e}), was ${this.#t?.kind} (${this.#t?.value})`);let t=this.#n.nextToken();this.#t=t,this.#s=t?.kind,this.#e=t?.value}_matches(r,e){return!(r&&this.#s!==r||e&&this.#e!==e)}#o(){if(!this.#t)return this.#i.empty();let r=this.#a();return r===void 0?void 0:this.#l(r,0)}#l(r,e){if(r===void 0)throw new Error("Expected left to be defined.");for(;this.#t;)if(this._matches(k.GROUPER,"(")){let t=this.#g();r=this.#i.invoke(r,void 0,t)}else if(this._matches(k.GROUPER,"[")){let t=this.#x();r=this.#i.index(r,t)}else if(this._matches(k.DOT)){this.#r();let t=this.#a();r=this.#p(r,t)}else{if(this._matches(k.KEYWORD))break;if(this._matches(k.OPERATOR)&&this.#t.precedence>=e)r=this.#e==="?"?this.#u(r):this.#d(r,this.#t);else break}return r}#p(r,e){if(e===void 0)throw new Error("expected identifier");if(e.type==="ID")return this.#i.getter(r,e.value);if(e.type==="Invoke"&&e.receiver.type==="ID"){let t=e.receiver;return this.#i.invoke(r,t.value,e.arguments)}else throw new Error(`expected identifier: ${e}`)}#d(r,e){if(Vo.indexOf(e.value)===-1)throw new Error(`unknown operator: ${e.value}`);this.#r();let t=this.#a();for(;(this.#s===k.OPERATOR||this.#s===k.DOT||this.#s===k.GROUPER)&&this.#t.precedence>e.precedence;)t=this.#l(t,this.#t.precedence);return this.#i.binary(r,e.value,t)}#a(){if(this._matches(k.OPERATOR)){let r=this.#e;if(this.#r(),r==="+"||r==="-"){if(this._matches(k.INTEGER))return this.#b(r);if(this._matches(k.DECIMAL))return this.#v(r)}if(No.indexOf(r)===-1)throw new Error(`unexpected token: ${r}`);let e=this.#l(this.#c(),ci);return this.#i.unary(r,e)}return this.#c()}#u(r){this.#r(k.OPERATOR,"?");let e=this.#o();this.#r(k.COLON);let t=this.#o();return this.#i.ternary(r,e,t)}#c(){switch(this.#s){case k.KEYWORD:let r=this.#e;if(r==="this")return this.#r(),this.#i.id(r);throw li.indexOf(r)!==-1?new Error(`unexpected keyword: ${r}`):new Error(`unrecognized keyword: ${r}`);case k.IDENTIFIER:return this.#f();case k.STRING:return this.#E();case k.INTEGER:return this.#b();case k.DECIMAL:return this.#v();case k.GROUPER:return this.#e==="("?this.#q():this.#e==="{"?this.#h():this.#e==="["?this.#m():void 0;case k.COLON:throw new Error('unexpected token ":"');default:return}}#m(){let r=[];do{if(this.#r(),this._matches(k.GROUPER,"]"))break;r.push(this.#o())}while(this._matches(k.COMMA));return this.#r(k.GROUPER,"]"),this.#i.list(r)}#h(){let r={};do{if(this.#r(),this._matches(k.GROUPER,"}"))break;let e=this.#e;(this._matches(k.STRING)||this._matches(k.IDENTIFIER))&&this.#r(),this.#r(k.COLON),r[e]=this.#o()}while(this._matches(k.COMMA));return this.#r(k.GROUPER,"}"),this.#i.map(r)}#f(){let r=this.#e;if(r==="true")return this.#r(),this.#i.literal(!0);if(r==="false")return this.#r(),this.#i.literal(!1);if(r==="null")return this.#r(),this.#i.literal(null);if(r==="undefined")return this.#r(),this.#i.literal(void 0);let e=this.#y(),t=this.#g();return t?this.#i.invoke(e,void 0,t):e}#y(){if(!this._matches(k.IDENTIFIER))throw new Error(`expected identifier: ${this.#e}`);let r=this.#e;return this.#r(),this.#i.id(r)}#g(){if(!this._matches(k.GROUPER,"("))return;let r=[];do{if(this.#r(),this._matches(k.GROUPER,")"))break;let e=this.#o();r.push(e)}while(this._matches(k.COMMA));return this.#r(k.GROUPER,")"),r}#x(){this.#r();let r=this.#o();return this.#r(k.GROUPER,"]"),r}#q(){let r=this.#g();if(this._matches(k.ARROW)){this.#r();let e=this.#o(),t=r?.map(i=>i.value)??[];return this.#i.arrowFunction(t,e)}else return this.#i.paren(r[0])}#E(){let r=this.#i.literal(this.#e);return this.#r(),r}#b(r=""){let e=this.#i.literal(parseInt(`${r}${this.#e}`,10));return this.#r(),e}#v(r=""){let e=this.#i.literal(parseFloat(`${r}${this.#e}`));return this.#r(),e}};var{hasOwn:Ho,fromEntries:Fn}=Object,Un={"+":(o,r)=>o+r,"-":(o,r)=>o-r,"*":(o,r)=>o*r,"/":(o,r)=>o/r,"%":(o,r)=>o%r,"==":(o,r)=>o==r,"!=":(o,r)=>o!=r,"===":(o,r)=>o===r,"!==":(o,r)=>o!==r,">":(o,r)=>o>r,">=":(o,r)=>o>=r,"<":(o,r)=>o<r,"<=":(o,r)=>o<=r,"||":(o,r)=>o||r,"&&":(o,r)=>o&&r,"??":(o,r)=>o??r,"|":(o,r)=>r(o),"|>":(o,r)=>r(o)},jn={"+":o=>o,"-":o=>-o,"!":o=>!o},di=class{empty(){return{type:"Empty",evaluate(r){return r},getIds(r){return r}}}literal(r){return{type:"Literal",value:r,evaluate(e){return this.value},getIds(e){return e}}}id(r){return{type:"ID",value:r,evaluate(e){return this.value==="this"?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(r,e){let t=jn[r];return{type:"Unary",operator:r,child:e,evaluate(i){return t(this.child.evaluate(i))},getIds(i){return this.child.getIds(i)}}}binary(r,e,t){let i=Un[e];return{type:"Binary",operator:e,left:r,right:t,evaluate(s){if(this.operator==="="){if(this.left.type!=="ID"&&this.left.type!=="Getter"&&this.left.type!=="Index")throw new Error(`Invalid assignment target: ${this.left}`);let n=this.right.evaluate(s),a,l;return this.left.type==="Getter"?(a=this.left.receiver.evaluate(s),l=this.left.name):this.left.type==="Index"?(a=this.left.receiver.evaluate(s),l=this.left.argument.evaluate(s)):this.left.type==="ID"&&(a=s,l=this.left.value),a===void 0?void 0:a[l]=n}return i(this.left.evaluate(s),this.right.evaluate(s))},getIds(s){return this.left.getIds(s),this.right.getIds(s),s}}}getter(r,e){return{type:"Getter",receiver:r,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(r,e,t){if(e!=null&&typeof e!="string")throw new Error("method not a string");return{type:"Invoke",receiver:r,method:e,arguments:t,evaluate(i){let s=this.receiver.evaluate(i),n=this.method?s:i?.this??i,a=this.method?s?.[e]:s,p=(this.arguments??[]).map(d=>d?.evaluate(i));return a?.apply?.(n,p)},getIds(i){return this.receiver.getIds(i),this.arguments?.forEach(s=>s?.getIds(i)),i}}}paren(r){return r}index(r,e){return{type:"Index",receiver:r,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(r,e,t){return{type:"Ternary",condition:r,trueExpr:e,falseExpr:t,evaluate(i){return this.condition.evaluate(i)?this.trueExpr.evaluate(i):this.falseExpr.evaluate(i)},getIds(i){return this.condition.getIds(i),this.trueExpr.getIds(i),this.falseExpr.getIds(i),i}}}map(r){return{type:"Map",entries:r,evaluate(e){let t={};if(r&&this.entries)for(let i in r){let s=this.entries[i];s&&(t[i]=s.evaluate(e))}return t},getIds(e){if(r&&this.entries)for(let t in r){let i=this.entries[t];i&&i.getIds(e)}return e}}}list(r){return{type:"List",items:r,evaluate(e){return this.items?.map(t=>t?.evaluate(e))},getIds(e){return this.items?.forEach(t=>t?.getIds(e)),e}}}arrowFunction(r,e){return{type:"ArrowFunction",params:r,body:e,evaluate(t){let i=this.params,s=this.body;return function(...n){let a=Fn(i.map((p,d)=>[p,n[d]])),l=new Proxy(t??{},{set(p,d,m){return Ho(a,d)&&(a[d]=m),p[d]=m},get(p,d){return Ho(a,d)?a[d]:p[d]}});return s.evaluate(l)}},getIds(t){return this.body.getIds(t).filter(i=>!this.params.includes(i))}}}};var Es=null,zo={boundAttributeSuffix:H.M,marker:H.P,markerMatch:H.A,HTML_RESULT:H.C,getTemplateHtml:H.L,overrideDirectiveResolve:(o,r)=>class extends o{_$AS(e,t){return r(this,t)}},patchDirectiveResolve:(o,r)=>{if(o.prototype._$AS.name!==r.name){Es??=o.prototype._$AS.name;for(let e=o.prototype;e!==Object.prototype;e=Object.getPrototypeOf(e))if(e.hasOwnProperty(Es))return void(e[Es]=r);throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527")}},setDirectiveClass(o,r){o._$litDirective$=r},getAttributePartCommittedValue:(o,r,e)=>{let t=P;return o.j=i=>t=i,o._$AI(r,o,e),t},connectedDisconnectable:o=>({...o,_$AU:!0}),resolveDirective:H.V,AttributePart:H.H,PropertyPart:H.B,BooleanAttributePart:H.N,EventPart:H.U,ElementPart:H.F,TemplateInstance:H.R,isIterable:H.D,ChildPart:H.I};var{AttributePart:Bn,PropertyPart:Wn,BooleanAttributePart:Xn,EventPart:Gn}=zo,ws=new di,Cs=new Map,Fo=o=>o.replace(/-(-|\w)/g,(r,e)=>e.toUpperCase()),ui=(o,r)=>{let e=Cs.get(o);if(e===void 0){if(Cs.has(o))return;if(o=o.trim(),o.startsWith("{{")&&o.endsWith("}}")){let t=o.substring(2,o.length-2).trim();e=new yr(t,ws).parse(),Cs.set(o,e)}}return e?.evaluate(r)},Yn=(o,r,e,t)=>{let i=o.getAttribute("if");if(i!==null&&ui(i,r))return mi(o,r,e,t)},Uo=/(?<!\\){{(.*?)(?:(?<!\\)}})/g,jo=o=>/(?:\\{{)|(?:\\}})/g.test(o),xr=o=>o.replaceAll(/\\{{/g,"{{").replace(/\\}}/g,"}}"),Jn=(o,r,e,t)=>{let i=o.getAttribute("repeat");if(i!==null){let s=ui(i,r);if(!s[Symbol.iterator])return S;let n=qr(o),a=-1,l=[];for(let p of s){a++;let d=Object.create(r);d.item=p,d.index=a,d.this=r.this??r;let m=[];for(let b of n.parts){let y=b.update(d,e,t);b.type===1?m.push(...y):m.push(y)}let f={_$litType$:n,values:m};l.push(f)}return l}},Wo={if:Yn,repeat:Jn},Z=(o,r=Wo,e={},t)=>{let s=qr(o).renderers;if(t){let a=qr(t).renderers,l=s.super;l!==void 0?e={...s,...e,super:(p,d,m)=>(m={...a,...m,super:(f,b,y)=>mi(t,f,b,y)},l(p,d,m))}:(e={...a,...s,...e},o=t)}else e={...s,...e};return n=>mi(o,n,r,e)};var mi=(o,r,e=Wo,t={})=>{let i=qr(o),s=[];for(let a of i.parts){let l=a.update(r,e,t);a.type===1?s.push(...l):s.push(l)}return{_$litType$:i,values:s}},Bo=new Map,qr=o=>{let r=Bo.get(o);return r===void 0&&Bo.set(o,r=Kn(o)),r},Kn=o=>{let r={h:void 0,el:o.cloneNode(!0),parts:[],renderers:{}},e=document.createTreeWalker(r.el.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT|NodeFilter.SHOW_COMMENT),t=e.currentNode,i=-1,s=[];for(;(t=e.nextNode())!==null;)if(t.nodeType===Node.COMMENT_NODE)i++;else if(t.nodeType===Node.ELEMENT_NODE){i++;let n=t;if(n.tagName==="TEMPLATE"){let l=n.getAttribute("type"),p=n.getAttribute("name"),d=n.getAttribute("call");if(d!==null||l!==null||p!==null){n.parentNode.insertBefore(document.createComment(""),n),s.push(n);let m;if(d!==null){let f=d.trim(),b=f.startsWith("{{")&&f.endsWith("}}");m=(y,C,R)=>{let q=n.getAttribute("data"),T=q===null?void 0:ui(q,y);return(b?ui(f,y):R[d])?.(T,C,R)}}else l!==null?m=(f,b,y)=>{let C=b[l];return C?.(n,f,b,y)}:(p==="super"?r.renderers.super=(f,b,y)=>{let C=y.super,R=qr(n);return y={...y,...R.renderers},C(f,b,y)}:r.renderers[p]=(f,b,y)=>mi(n,f,b,y),m=(f,b,y)=>{let C=y[p];return C?.(f,b,y)});r.parts.push({type:2,index:i,update:m});continue}}let a=n.getAttributeNames();for(let l of a){let p=n.getAttribute(l),d=p.split(Uo);if(d.length===1){jo(p)&&n.setAttribute(l,xr(p));continue}n.removeAttribute(l);let m=l,f=Bn,b=l[0];b==="."?(m=Fo(l.substring(1)),f=Wn):b==="?"?(m=l.substring(1),f=Xn):b==="@"&&(m=Fo(l.substring(1)),f=Gn);let y=[xr(d[0])],C=[];for(let R=1;R<d.length;R+=2){let q=d[R];C.push(qs(q,ws)),y.push(xr(d[R+1]))}r.parts.push({type:1,index:i,name:m,strings:y,ctor:f,update:(R,q,T)=>C.map(M=>M.evaluate(R))})}}else if(t.nodeType===Node.TEXT_NODE){let n=t,a=n.textContent,l=a.split(Uo);l.length>1?n.textContent=xr(l[0]):jo(a)&&(n.textContent=xr(a));for(let p=1;p<l.length;p+=2){let d=l[p],m=qs(d,ws);r.parts.push({type:2,index:++i,update:(b,y)=>m.evaluate(b)});let f=new Text(l[p+1].replace("\\{{","{{"));n.parentNode.insertBefore(f,n.nextSibling),n.parentNode.insertBefore(document.createComment(""),n.nextSibling),n=f,e.currentNode=f}}for(let n of s)n.remove();return r};var Xo={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},_e=class extends v{constructor(){super(...arguments);this.weigths=new Map}createRenderRoot(){return this}get assessmentItem(){return this.renderRoot?.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback();let e=this.getRootNode().host.closest("qti-test").querySelector("template[item-ref]");e&&(this.myTemplate=Z(e)),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href,category:this.category}}))}render(){return this.myTemplate?this.myTemplate({xmlDoc:this.xmlDoc}):this.xmlDoc}};c([u({type:String})],_e.prototype,"category",2),c([u({type:String})],_e.prototype,"identifier",2),c([u({type:Boolean,converter:Xo})],_e.prototype,"required",2),c([u({type:Boolean,converter:Xo})],_e.prototype,"fixed",2),c([u({type:String})],_e.prototype,"href",2),c([u({type:Object,attribute:!1})],_e.prototype,"xmlDoc",2);customElements.get("qti-assessment-item-ref")||customElements.define("qti-assessment-item-ref",_e);var _s={fromAttribute(o){return o==="true"},toAttribute(o){return o?"true":"false"}},Te=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){this._title=this.getAttribute("title")||"",super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-assessment-section-connected",{bubbles:!0,composed:!0}))}render(){return h`<slot name="qti-rubric-block"></slot><slot></slot>`}};c([u({type:String})],Te.prototype,"identifier",2),c([u({type:String})],Te.prototype,"required",2),c([u({type:Boolean,converter:_s})],Te.prototype,"fixed",2),c([u({type:Boolean,converter:_s})],Te.prototype,"visible",2),c([u({type:Boolean,converter:_s,attribute:"keep-together"})],Te.prototype,"keepTogether",2),c([_({context:ue,subscribe:!0})],Te.prototype,"_testContext",2);customElements.get("qti-assessment-section")||customElements.define("qti-assessment-section",Te);var et=class extends v{constructor(){super(...arguments);this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-assessment-test-connected",{detail:this,bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};c([u({type:String})],et.prototype,"identifier",2),c([u({type:String})],et.prototype,"title",1),c([_({context:ue,subscribe:!0})],et.prototype,"_testContext",2),et=c([g("qti-assessment-test")],et);var ke=class extends v{constructor(){super(...arguments);this.identifier="";this.class="";this.navigationMode="nonlinear";this.submissionMode="individual";this._title=""}get title(){return this._title}set title(e){this._title=e,this.removeAttribute("title"),this.setAttribute("data-title",e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new Event("qti-test-part-connected",{bubbles:!0,composed:!0}))}render(){return h` <slot></slot>`}};c([u({type:String})],ke.prototype,"identifier",2),c([u({type:String})],ke.prototype,"class",2),c([u({type:String,attribute:"navigation-mode"})],ke.prototype,"navigationMode",2),c([u({type:String,attribute:"submission-mode"})],ke.prototype,"submissionMode",2),ke=c([g("qti-test-part")],ke);customElements.get("qti-test-part")||customElements.define("qti-test-part",ke);var Er=class extends Ze{render(){return h``}};Er.styles=x`
1498
1498
  :host {
1499
1499
  color: gray;
1500
1500
  }
1501
- `,Er=c([g("qti-test-feedback")],Er);var P=Symbol("computedContext");var Q=class extends v{constructor(){super();this.identifier=void 0;this.initContext=[];this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}};this.configContext={};this.autoScoreItems=!1;this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-interaction-changed",this._handleInteractionChanged.bind(this)),this.addEventListener("test-end-attempt",this._handleTestEndAttempt.bind(this)),this.addEventListener("test-show-correct-response",this._handleTestShowCorrectResponse.bind(this)),this.addEventListener("test-show-candidate-correction",this._handleTestShowCandidateCorrection.bind(this)),this.addEventListener("test-update-outcome-variable",this._handleTestUpdateOutcomeVariable.bind(this))}_handleTestEndAttempt(e){let i=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem,s=this.configContext?.reportValidityAfterScoring===!0;i.processResponse(!0,s)}_handleTestShowCorrectResponse(e){let i=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem;i&&i.showCorrectResponse(e.detail)}_handleTestShowCandidateCorrection(e){this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem.showCandidateCorrection(e.detail)}_handleTestUpdateOutcomeVariable(e){this._testElement.querySelector(`qti-assessment-item-ref[identifier="${e.detail.assessmentItemRefId}"]`).assessmentItem.setOutcomeVariable(e.detail.outcomeVariableId,e.detail.value)}_handleInteractionChanged(e){if(this.autoScoreItems){let t=e.composedPath()[0].closest("qti-assessment-item"),i=t.variables.find(s=>s.identifier==="SCORE");if(i&&i.externalScored===null&&t.adaptive==="false"){let s=this.configContext?.reportValidityAfterScoring===!0;t.processResponse(!0,s)}}}render(){return h`<slot></slot>`}_handleTestConnected(e){if(this._testElement=e.detail,!this.qtiContext.QTI_CONTEXT?.testIdentifier){let s=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.qtiContext={QTI_CONTEXT:{...s,testIdentifier:this._testElement.identifier,environmentIdentifier:s.environmentIdentifier||"default"}}}this._testElement.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(s=>{let n=this._extractDefaultValues(s);Object.keys(n).length>0&&(this.qtiContext={QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let i=Array.from(this._testElement?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:this._testElement.identifier,title:this._testElement.title,view:this._sessionContext?.view,testParts:i.map(s=>{let n=[...s.querySelectorAll("qti-assessment-section")];return{active:!1,identifier:s.identifier,navigationMode:s.navigationMode,submissionMode:s.submissionMode,sections:n.map(a=>{let l=[...a.querySelectorAll("qti-assessment-item-ref")];return{active:!1,identifier:a.identifier,title:a.title,items:l.map(p=>({...this.initContext?.find(d=>d.identifier===p.identifier),active:!1,identifier:p.identifier,categories:p.category?p.category?.split(" "):[],href:p.href,variables:[]}))}})}})}}_extractDefaultValues(e){let t={},i=e.querySelector("qti-default-value");return i&&i.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let a=n.getAttribute("field-identifier"),l=n.getAttribute("base-type")||"string",p=n.textContent?.trim()||"";if(a){let d=p;switch(l){case"integer":d=parseInt(p,10);break;case"float":case"duration":d=parseFloat(p);break;case"boolean":d=p.toLowerCase()==="true";break;case"string":default:d=p;break}t[a]=d}}),t}_handleItemConnected(e){let t=e.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(i=>({...i,sections:i.sections.map(s=>({...s,items:s.items.map(n=>{if(n.identifier!==t.parentElement.getAttribute("identifier"))return n;let l=t.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),p=t.querySelectorAll("qti-response-declaration"),d=Array.from(p).some(y=>y.querySelector("qti-correct-response")),m=Array.from(p).some(y=>{let C=y.querySelector("qti-mapping"),R=y.querySelector("qti-area-mapping");return C?.querySelector("qti-map-entry")||R?.querySelector("qti-area-map-entry")}),f=d||m,b=!!t.querySelector("qti-response-processing");return{...n,assessmentItemIdentifier:t.getAttribute("identifier"),label:t.getAttribute("label"),title:t.title,externalScored:l,adaptive:t.adaptive=="true"||!1,timeDependent:t.timeDependent=="true"||!1,variables:t.variables,hasCorrectResponse:f,hasResponseProcessing:b}})}))}))}}willUpdate(e){if(!this.computedContext)return;let t=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,testParts:this.computedContext.testParts.map(i=>({...i,active:this._sessionContext?.navPartId===i.identifier||!1,sections:i.sections.map(s=>({...s,active:this._sessionContext?.navSectionId===s.identifier||!1,completed:s.items.every(n=>this._testContext.items.find(a=>a.identifier===n.identifier)?.variables.find(a=>a.identifier==="completionStatus").value==="completed"),items:s.items.map(n=>{let a=this._testContext?.items.find(T=>T.identifier===n.identifier),l={...n,...a,...this.initContext?.find(T=>T.identifier===n.identifier)},p=l.variables?.find(T=>T.identifier=="SCORE")?.value,d=p==null?null:parseFloat(p?.toString()),m=l.variables?.find(T=>T.identifier==="completionStatus")?.value,f=l.variables?.find(T=>T.identifier==="RESPONSE")?.value||"",b=l.variables?.find(T=>T.identifier==="numAttempts")?.value||0,y=this._sessionContext?.navItemRefId===l.identifier||!1,C=n.categories.includes(this.configContext?.infoItemCategory)?null:t++,R=n.variables?.find(T=>T.identifier=="MAXSCORE")?.value,q=R==null?null:parseFloat(R?.toString());return{...l,completionStatus:m,numAttempts:b,score:d,response:f,index:C,active:y,maxScore:q}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}};c([u({type:String})],Q.prototype,"identifier",2),c([E()],Q.prototype,"initContext",2),c([E(),X({context:Yr})],Q.prototype,"qtiContext",2),c([E(),X({context:ne})],Q.prototype,"configContext",2),c([E(),_({context:ue,subscribe:!0})],Q.prototype,"_testContext",2),c([E(),_({context:He,subscribe:!0})],Q.prototype,"_sessionContext",2),c([E(),X({context:P})],Q.prototype,"computedContext",2),c([u({type:Boolean,attribute:"auto-score-items"})],Q.prototype,"autoScoreItems",2),Q=c([g("test-navigation")],Q);var Go=x`
1501
+ `,Er=c([g("qti-test-feedback")],Er);var O=Symbol("computedContext");var Q=class extends v{constructor(){super();this.identifier=void 0;this.initContext=[];this.qtiContext={QTI_CONTEXT:{testIdentifier:"",candidateIdentifier:"",environmentIdentifier:"default"}};this.configContext={};this.autoScoreItems=!1;this.addEventListener("qti-assessment-test-connected",this._handleTestConnected.bind(this)),this.addEventListener("qti-assessment-item-connected",this._handleItemConnected.bind(this)),this.addEventListener("qti-interaction-changed",this._handleInteractionChanged.bind(this)),this.addEventListener("test-end-attempt",this._handleTestEndAttempt.bind(this)),this.addEventListener("test-show-correct-response",this._handleTestShowCorrectResponse.bind(this)),this.addEventListener("test-show-candidate-correction",this._handleTestShowCandidateCorrection.bind(this)),this.addEventListener("test-update-outcome-variable",this._handleTestUpdateOutcomeVariable.bind(this))}_handleTestEndAttempt(e){let i=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem,s=this.configContext?.reportValidityAfterScoring===!0;i.processResponse(!0,s)}_handleTestShowCorrectResponse(e){let i=this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem;i&&i.showCorrectResponse(e.detail)}_handleTestShowCandidateCorrection(e){this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`).assessmentItem.showCandidateCorrection(e.detail)}_handleTestUpdateOutcomeVariable(e){this._testElement.querySelector(`qti-assessment-item-ref[identifier="${e.detail.assessmentItemRefId}"]`).assessmentItem.setOutcomeVariable(e.detail.outcomeVariableId,e.detail.value)}_handleInteractionChanged(e){if(this.autoScoreItems){let t=e.composedPath()[0].closest("qti-assessment-item"),i=t.variables.find(s=>s.identifier==="SCORE");if(i&&i.externalScored===null&&t.adaptive==="false"){let s=this.configContext?.reportValidityAfterScoring===!0;t.processResponse(!0,s)}}}render(){return h`<slot></slot>`}_handleTestConnected(e){if(this._testElement=e.detail,!this.qtiContext.QTI_CONTEXT?.testIdentifier){let s=this.qtiContext.QTI_CONTEXT||{testIdentifier:"",candidateIdentifier:"not set",environmentIdentifier:"default"};this.qtiContext={QTI_CONTEXT:{...s,testIdentifier:this._testElement.identifier,environmentIdentifier:s.environmentIdentifier||"default"}}}this._testElement.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]').forEach(s=>{let n=this._extractDefaultValues(s);Object.keys(n).length>0&&(this.qtiContext={QTI_CONTEXT:{...n,...this.qtiContext.QTI_CONTEXT}})});let i=Array.from(this._testElement?.querySelectorAll("qti-test-part")||[]);this.computedContext={identifier:this._testElement.identifier,title:this._testElement.title,view:this._sessionContext?.view,testParts:i.map(s=>{let n=[...s.querySelectorAll("qti-assessment-section")];return{active:!1,identifier:s.identifier,navigationMode:s.navigationMode,submissionMode:s.submissionMode,sections:n.map(a=>{let l=[...a.querySelectorAll("qti-assessment-item-ref")];return{active:!1,identifier:a.identifier,title:a.title,items:l.map(p=>({...this.initContext?.find(d=>d.identifier===p.identifier),active:!1,identifier:p.identifier,categories:p.category?p.category?.split(" "):[],href:p.href,variables:[]}))}})}})}}_extractDefaultValues(e){let t={},i=e.querySelector("qti-default-value");return i&&i.querySelectorAll("qti-value[field-identifier]").forEach(n=>{let a=n.getAttribute("field-identifier"),l=n.getAttribute("base-type")||"string",p=n.textContent?.trim()||"";if(a){let d=p;switch(l){case"integer":d=parseInt(p,10);break;case"float":case"duration":d=parseFloat(p);break;case"boolean":d=p.toLowerCase()==="true";break;case"string":default:d=p;break}t[a]=d}}),t}_handleItemConnected(e){let t=e.detail;this.computedContext={...this.computedContext,testParts:this.computedContext.testParts.map(i=>({...i,sections:i.sections.map(s=>({...s,items:s.items.map(n=>{if(n.identifier!==t.parentElement.getAttribute("identifier"))return n;let l=t.querySelector("qti-outcome-declaration[identifier='SCORE']")?.getAttribute("externalScored"),p=t.querySelectorAll("qti-response-declaration"),d=Array.from(p).some(y=>y.querySelector("qti-correct-response")),m=Array.from(p).some(y=>{let C=y.querySelector("qti-mapping"),R=y.querySelector("qti-area-mapping");return C?.querySelector("qti-map-entry")||R?.querySelector("qti-area-map-entry")}),f=d||m,b=!!t.querySelector("qti-response-processing");return{...n,assessmentItemIdentifier:t.getAttribute("identifier"),label:t.getAttribute("label"),title:t.title,externalScored:l,adaptive:t.adaptive=="true"||!1,timeDependent:t.timeDependent=="true"||!1,variables:t.variables,hasCorrectResponse:f,hasResponseProcessing:b}})}))}))}}willUpdate(e){if(!this.computedContext)return;let t=1;this.computedContext={...this.computedContext,view:this._sessionContext?.view,testParts:this.computedContext.testParts.map(i=>({...i,active:this._sessionContext?.navPartId===i.identifier||!1,sections:i.sections.map(s=>({...s,active:this._sessionContext?.navSectionId===s.identifier||!1,completed:s.items.every(n=>this._testContext.items.find(a=>a.identifier===n.identifier)?.variables.find(a=>a.identifier==="completionStatus").value==="completed"),items:s.items.map(n=>{let a=this._testContext?.items.find(T=>T.identifier===n.identifier),l={...n,...a,...this.initContext?.find(T=>T.identifier===n.identifier)},p=l.variables?.find(T=>T.identifier=="SCORE")?.value,d=p==null?null:parseFloat(p?.toString()),m=l.variables?.find(T=>T.identifier==="completionStatus")?.value,f=l.variables?.find(T=>T.identifier==="RESPONSE")?.value||"",b=l.variables?.find(T=>T.identifier==="numAttempts")?.value||0,y=this._sessionContext?.navItemRefId===l.identifier||!1,C=n.categories.includes(this.configContext?.infoItemCategory)?null:t++,R=n.variables?.find(T=>T.identifier=="MAXSCORE")?.value,q=R==null?null:parseFloat(R?.toString());return{...l,completionStatus:m,numAttempts:b,score:d,response:f,index:C,active:y,maxScore:q}})}))}))},this.dispatchEvent(new CustomEvent("qti-computed-context-updated",{detail:this.computedContext,bubbles:!0}))}};c([u({type:String})],Q.prototype,"identifier",2),c([E()],Q.prototype,"initContext",2),c([E(),X({context:Yr})],Q.prototype,"qtiContext",2),c([E(),X({context:ne})],Q.prototype,"configContext",2),c([E(),_({context:ue,subscribe:!0})],Q.prototype,"_testContext",2),c([E(),_({context:He,subscribe:!0})],Q.prototype,"_sessionContext",2),c([E(),X({context:O})],Q.prototype,"computedContext",2),c([u({type:Boolean,attribute:"auto-score-items"})],Q.prototype,"autoScoreItems",2),Q=c([g("test-navigation")],Q);var Go=x`
1502
1502
  display: inline-flex;
1503
1503
  align-items: center;
1504
1504
  cursor: pointer;
@@ -1511,7 +1511,7 @@ Make sure to test your application with a production build as repeat registratio
1511
1511
  `,B=x`
1512
1512
  cursor: not-allowed;
1513
1513
  opacity: 0.8;
1514
- `,OE=x`
1514
+ `,PE=x`
1515
1515
  ${Go};
1516
1516
  border: 1px solid gray;
1517
1517
  `;var ze=class extends v{constructor(){super();this._internalDisabled=!0;this._internals=this.attachInternals(),this._internals.role="button",this._internals.ariaLabel="Next item",this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex+1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}connectedCallback(){super.connectedCallback(),this.checkDisabled()}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex<0||this.itemIndex>=this.sectionItems?.length-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return h`<slot></slot>`}};ze.styles=x`
@@ -1521,14 +1521,14 @@ Make sure to test your application with a production build as repeat registratio
1521
1521
  :host([disabled]) {
1522
1522
  ${B};
1523
1523
  }
1524
- `,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],ze.prototype,"_internalDisabled",2),c([_({context:P,subscribe:!0})],ze.prototype,"computedContext",2),c([I("computedContext")],ze.prototype,"_handleTestElementChange",1),ze=c([g("test-next")],ze);var Fe=class extends v{constructor(){super();this._internalDisabled=!0;this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return h`<slot></slot>`}};Fe.styles=x`
1524
+ `,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],ze.prototype,"_internalDisabled",2),c([_({context:O,subscribe:!0})],ze.prototype,"computedContext",2),c([I("computedContext")],ze.prototype,"_handleTestElementChange",1),ze=c([g("test-next")],ze);var Fe=class extends v{constructor(){super();this._internalDisabled=!0;this.addEventListener("click",e=>{e.preventDefault(),this._internalDisabled||this._requestItem(this.sectionItems[this.itemIndex-1].identifier)})}_handleTestElementChange(e,t){t&&(this._internalDisabled=!1)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext?.testParts.find(i=>i.active);t&&(this.sectionItems=t.sections.flatMap(i=>i.items),this.itemIndex=this.sectionItems.findIndex(i=>i.active),this.checkDisabled())}checkDisabled(){this._internalDisabled=!this.computedContext||this.itemIndex===0||this.itemIndex===-1}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"item",id:e}}))}render(){return h`<slot></slot>`}};Fe.styles=x`
1525
1525
  :host {
1526
1526
  ${j};
1527
1527
  }
1528
1528
  :host([disabled]) {
1529
1529
  ${B};
1530
1530
  }
1531
- `,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],Fe.prototype,"_internalDisabled",2),c([_({context:P,subscribe:!0})],Fe.prototype,"computedContext",2),c([I("computedContext")],Fe.prototype,"_handleTestElementChange",1),Fe=c([g("test-prev")],Fe);var W=class extends v{constructor(){super(...arguments);this.label="view";this._handleViewOptionsChange=()=>{this.updateViewOptions()};this._viewOptions=W.DEFAULT_VIEW_OPTIONS}connectedCallback(){super.connectedCallback(),this.updateViewOptions()}updateViewOptions(){if(this.viewOptions){let e=this.viewOptions.split(",").map(t=>t.trim());this._viewOptions=e.filter(t=>W.DEFAULT_VIEW_OPTIONS.includes(t))}else this._viewOptions=W.DEFAULT_VIEW_OPTIONS}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}render(){return h`
1531
+ `,c([u({type:Boolean,reflect:!0,attribute:"disabled"})],Fe.prototype,"_internalDisabled",2),c([_({context:O,subscribe:!0})],Fe.prototype,"computedContext",2),c([I("computedContext")],Fe.prototype,"_handleTestElementChange",1),Fe=c([g("test-prev")],Fe);var W=class extends v{constructor(){super(...arguments);this.label="view";this._handleViewOptionsChange=()=>{this.updateViewOptions()};this._viewOptions=W.DEFAULT_VIEW_OPTIONS}connectedCallback(){super.connectedCallback(),this.updateViewOptions()}updateViewOptions(){if(this.viewOptions){let e=this.viewOptions.split(",").map(t=>t.trim());this._viewOptions=e.filter(t=>W.DEFAULT_VIEW_OPTIONS.includes(t))}else this._viewOptions=W.DEFAULT_VIEW_OPTIONS}_switchView(e){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:e}))}render(){return h`
1532
1532
  <label part="label" for="viewSelect">${this.label}</label>
1533
1533
  <select
1534
1534
  part="select"
@@ -1558,7 +1558,7 @@ Make sure to test your application with a production build as repeat registratio
1558
1558
  :host([disabled]) {
1559
1559
  ${B};
1560
1560
  }
1561
- `,c([_({context:P,subscribe:!0})],te.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],te.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],te.prototype,"disabled",2),c([u({type:String})],te.prototype,"showCorrectText",2),c([u({type:String})],te.prototype,"hideCorrectText",2),c([u({type:String})],te.prototype,"noCorrectResponseText",2),te=c([g("test-show-correct-response")],te);var wr=class extends v{createRenderRoot(){return this}constructor(){super(),this._internals=this.attachInternals(),this._internals.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");this.myTemplate=Z(r)}render(){if(!this.computedContext)return h``;let r=this.computedContext.testParts.flatMap(e=>e.sections.flatMap(t=>t.items));return h` ${r.map(e=>this.myTemplate({item:e,view:this.computedContext.view}))} `}};c([_({context:P,subscribe:!0})],wr.prototype,"computedContext",2),wr=c([g("test-paging-buttons-stamp")],wr);var hi=class{constructor(r){this.G=r}disconnect(){this.G=void 0}reconnect(r){this.G=r}deref(){return this.G}},fi=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise((r=>this.Z=r))}resume(){this.Z?.(),this.Y=this.Z=void 0}};var Yo=o=>!uo(o)&&typeof o.then=="function",Jo=1073741823,Ts=class extends xt{constructor(){super(...arguments),this._$Cwt=Jo,this._$Cbt=[],this._$CK=new hi(this),this._$CX=new fi}render(...r){return r.find((e=>!Yo(e)))??O}update(r,e){let t=this._$Cbt,i=t.length;this._$Cbt=e;let s=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!Yo(l))return this._$Cwt=a,l;a<i&&l===t[a]||(this._$Cwt=Jo,i=0,Promise.resolve(l).then((async p=>{for(;n.get();)await n.get();let d=s.deref();if(d!==void 0){let m=d._$Cbt.indexOf(l);m>-1&&m<d._$Cwt&&(d._$Cwt=m,d.setValue(p))}})))}return O}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},gi=ee(Ts);var bi=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
1561
+ `,c([_({context:O,subscribe:!0})],te.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],te.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],te.prototype,"disabled",2),c([u({type:String})],te.prototype,"showCorrectText",2),c([u({type:String})],te.prototype,"hideCorrectText",2),c([u({type:String})],te.prototype,"noCorrectResponseText",2),te=c([g("test-show-correct-response")],te);var wr=class extends v{createRenderRoot(){return this}constructor(){super(),this._internals=this.attachInternals(),this._internals.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");this.myTemplate=Z(r)}render(){if(!this.computedContext)return h``;let r=this.computedContext.testParts.flatMap(e=>e.sections.flatMap(t=>t.items));return h` ${r.map(e=>this.myTemplate({item:e,view:this.computedContext.view}))} `}};c([_({context:O,subscribe:!0})],wr.prototype,"computedContext",2),wr=c([g("test-paging-buttons-stamp")],wr);var hi=class{constructor(r){this.G=r}disconnect(){this.G=void 0}reconnect(r){this.G=r}deref(){return this.G}},fi=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise((r=>this.Z=r))}resume(){this.Z?.(),this.Y=this.Z=void 0}};var Yo=o=>!uo(o)&&typeof o.then=="function",Jo=1073741823,Ts=class extends xt{constructor(){super(...arguments),this._$Cwt=Jo,this._$Cbt=[],this._$CK=new hi(this),this._$CX=new fi}render(...r){return r.find((e=>!Yo(e)))??P}update(r,e){let t=this._$Cbt,i=t.length;this._$Cbt=e;let s=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<e.length&&!(a>this._$Cwt);a++){let l=e[a];if(!Yo(l))return this._$Cwt=a,l;a<i&&l===t[a]||(this._$Cwt=Jo,i=0,Promise.resolve(l).then((async p=>{for(;n.get();)await n.get();let d=s.deref();if(d!==void 0){let m=d._$Cbt.indexOf(l);m>-1&&m<d._$Cwt&&(d._$Cwt=m,d.setValue(p))}})))}return P}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},gi=ee(Ts);var bi=`@layer qti-base, qti-components, qti-utilities, qti-variants, qti-extended;
1562
1562
 
1563
1563
  :root,
1564
1564
  :host {
@@ -5292,11 +5292,11 @@ div.full-correct-response-inline {
5292
5292
  margin-right: var(--qti-padding-horizontal);
5293
5293
  padding: 0.2rem;
5294
5294
  }
5295
- `;var ge=class extends v{constructor(){super(...arguments);this.testURL=null;this.testDoc=null;this.testXML=null;this.templateContent=null;this.postLoadTestTransformCallback=null}async handleTestURLChange(){if(this.testURL)try{let e=await Oi().load(this.testURL);if(this.postLoadTestTransformCallback){let i=e.htmlDoc().querySelector("qti-assessment-test");i&&(e=await this.postLoadTestTransformCallback(e,i))}this.testDoc=e.htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleTestXMLChange(){if(this.testXML)try{this.testDoc=Oi().parse(this.testXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),this.initializeTemplateContent(),this.applyStyles(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}initializeTemplateContent(){let e=this.querySelector("template");this.templateContent=e?e.content:h``}applyStyles(){let e=new CSSStyleSheet;e.replaceSync(bi),this.shadowRoot.adoptedStyleSheets=[e]}render(){return h`
5295
+ `;var Ae=class extends v{constructor(){super(...arguments);this.testURL=null;this.testDoc=null;this.testXML=null;this.templateContent=null}async handleTestURLChange(){if(this.testURL)try{let e=await Pi().load(this.testURL),t=this.closest("qti-test");if(t.postLoadTestTransformCallback){let s=e.htmlDoc().querySelector("qti-assessment-test");s&&(e=await t.postLoadTestTransformCallback(e,s))}this.testDoc=e.htmlDoc()}catch(e){console.error("Error loading or parsing XML:",e)}}handleTestXMLChange(){if(this.testXML)try{this.testDoc=Pi().parse(this.testXML).htmlDoc()}catch(e){console.error("Error parsing XML:",e)}}async connectedCallback(){super.connectedCallback(),this.initializeTemplateContent(),this.applyStyles(),this.testURL&&this.handleTestURLChange(),this.testXML&&this.handleTestXMLChange()}initializeTemplateContent(){let e=this.querySelector("template");this.templateContent=e?e.content:h``}applyStyles(){let e=new CSSStyleSheet;e.replaceSync(bi),this.shadowRoot.adoptedStyleSheets=[e]}render(){return h`
5296
5296
  ${this.templateContent}
5297
5297
  <slot></slot>
5298
5298
  ${gi(this.testDoc,h`<span>Loading...</span>`)}
5299
- `}};c([u({type:String,attribute:"test-url"})],ge.prototype,"testURL",2),c([E()],ge.prototype,"testDoc",2),c([E()],ge.prototype,"testXML",2),c([u({type:Function})],ge.prototype,"postLoadTestTransformCallback",2),c([I("testURL",{waitUntilFirstUpdate:!0})],ge.prototype,"handleTestURLChange",1),c([I("testXML",{waitUntilFirstUpdate:!0})],ge.prototype,"handleTestXMLChange",1),ge=c([g("test-container")],ge);var _t=class extends v{render(){let r=this.computedContext?.testParts.flatMap(s=>s.sections.flatMap(n=>n.items)).find(s=>s.active);if(!r||!r.variables)return h``;let e=r.variables.filter(s=>s.type==="response"),t=r.variables.filter(s=>s.type==="outcome"),i=(s,n)=>h`
5299
+ `}};c([u({type:String,attribute:"test-url"})],Ae.prototype,"testURL",2),c([E()],Ae.prototype,"testDoc",2),c([E()],Ae.prototype,"testXML",2),c([I("testURL",{waitUntilFirstUpdate:!0})],Ae.prototype,"handleTestURLChange",1),c([I("testXML",{waitUntilFirstUpdate:!0})],Ae.prototype,"handleTestXMLChange",1),Ae=c([g("test-container")],Ae);var _t=class extends v{render(){let r=this.computedContext?.testParts.flatMap(s=>s.sections.flatMap(n=>n.items)).find(s=>s.active);if(!r||!r.variables)return h``;let e=r.variables.filter(s=>s.type==="response"),t=r.variables.filter(s=>s.type==="outcome"),i=(s,n)=>h`
5300
5300
  <h3>${n}</h3>
5301
5301
  <table>
5302
5302
  <thead>
@@ -5343,15 +5343,15 @@ div.full-correct-response-inline {
5343
5343
  margin-top: 20px;
5344
5344
  font-size: 16px;
5345
5345
  }
5346
- `,c([_({context:P,subscribe:!0})],_t.prototype,"computedContext",2),_t=c([g("test-print-item-variables")],_t);var _r=class extends v{createRenderRoot(){return this}constructor(){super(),this._internals=this.attachInternals(),this._internals.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");this.myTemplate=Z(r)}render(){if(!this.computedContext)return h``;let r=this.computedContext.testParts.flatMap(e=>e.sections);return h` ${r.map(e=>this.myTemplate({item:e}))} `}};c([_({context:P,subscribe:!0})],_r.prototype,"computedContext",2),_r=c([g("test-section-buttons-stamp")],_r);var Tt=class extends v{constructor(){super();this.sectionId=null;this.addEventListener("click",()=>this._requestItem(this.sectionId))}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"section",id:e}}))}render(){return h` <slot></slot> `}};Tt.styles=x`
5346
+ `,c([_({context:O,subscribe:!0})],_t.prototype,"computedContext",2),_t=c([g("test-print-item-variables")],_t);var _r=class extends v{createRenderRoot(){return this}constructor(){super(),this._internals=this.attachInternals(),this._internals.ariaLabel="pagination"}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");this.myTemplate=Z(r)}render(){if(!this.computedContext)return h``;let r=this.computedContext.testParts.flatMap(e=>e.sections);return h` ${r.map(e=>this.myTemplate({item:e}))} `}};c([_({context:O,subscribe:!0})],_r.prototype,"computedContext",2),_r=c([g("test-section-buttons-stamp")],_r);var Tt=class extends v{constructor(){super();this.sectionId=null;this.addEventListener("click",()=>this._requestItem(this.sectionId))}_requestItem(e){this.dispatchEvent(new CustomEvent("qti-request-navigation",{composed:!0,bubbles:!0,detail:{type:"section",id:e}}))}render(){return h` <slot></slot> `}};Tt.styles=x`
5347
5347
  :host {
5348
5348
  ${j};
5349
5349
  }
5350
5350
  :host([disabled]) {
5351
5351
  ${B};
5352
5352
  }
5353
- `,c([u({type:String,attribute:"section-id"})],Tt.prototype,"sectionId",2),Tt=c([g("test-section-link")],Tt);var Tr=class extends v{render(){return h` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};c([E(),_({context:P,subscribe:!0})],Tr.prototype,"computedContext",2),Tr=c([g("test-print-context")],Tr);var rt=class extends v{constructor(){super(...arguments);this.debug=!1;this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Z(e)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext.testParts.find(f=>f.active),i=t?.sections.find(f=>f.active),s=i?.items.find(f=>f.active),{variables:n,...a}=s||{};if(!t||!i||!s)return;let l={...t,items:t.sections.flatMap(f=>f.items.map(({variables:b,...y})=>y)),sections:t.sections.map(f=>({...f,items:f.items.map(({variables:b,...y})=>y)}))},p={...i,items:i.items.map(({variables:f,...b})=>b)},{testParts:d,...m}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:a,activeSection:p,activeTestpart:l,test:m},this.dispatchEvent(new CustomEvent("qti-stamp-context-updated",{detail:this.stampContext,bubbles:!0}))}render(){return h` ${this.debug?h`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:S}
5354
- ${this.myTemplate?this.myTemplate(this.stampContext):S}`}};c([u({type:Boolean,reflect:!0})],rt.prototype,"debug",2),c([E(),_({context:P,subscribe:!0})],rt.prototype,"computedContext",2),c([E()],rt.prototype,"stampContext",2),rt=c([g("test-stamp")],rt);var it=class extends v{constructor(){super();this.view="";this.disabled=!1;this.myTemplate=null;this.addEventListener("click",e=>{let t=e.target,i=parseFloat(t.value);t.tagName==="INPUT"&&this._changeOutcomeScore(i)})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Z(e)}_changeOutcomeScore(e){let s=(this.computedContext?.testParts.find(n=>n.active)).sections.flatMap(n=>n.items).find(n=>n.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:s,outcomeVariableId:"SCORE",value:e},bubbles:!0}))}render(){let e=this.computedContext?.testParts.flatMap(l=>l.sections.flatMap(p=>p.items)).find(l=>l.active);if(!e||!e.variables)return h``;let t=e.variables.find(l=>l.identifier=="MAXSCORE")?.value,i=e.variables.find(l=>l.identifier=="SCORE"),s=i?.value,n=i?.externalScored!=="human";if(!t||!i)return S;let a=[...Array(Number(t)+1).keys()];return h`${this.myTemplate?this.myTemplate({scores:a,score:s,disabled:n}):S}`}};c([u({type:String,attribute:"view"})],it.prototype,"view",2),c([u({type:Boolean})],it.prototype,"disabled",2),c([_({context:P,subscribe:!0})],it.prototype,"computedContext",2),it=c([g("test-scoring-buttons")],it);var kr=class extends v{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");if(!r){this.myTemplate=null;return}this.myTemplate=Z(r)}_switchView(r){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:r}))}firstUpdated(r){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return h`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):S}`}};c([_({context:He,subscribe:!0})],kr.prototype,"sessionContext",2),kr=c([g("test-view-toggle")],kr);var kt=class extends v{constructor(){super(...arguments);this.view=null}render(){let e=this.computedContext?.testParts.flatMap(l=>l.sections.flatMap(p=>p.items)).find(l=>l.active);if(!e||!e.variables)return h``;if(e.category==="dep-informational")return h`<div>${this.dataset.informational}</div>`;let t=e?.variables.find(l=>l.identifier==="completionStatus")?.value,i=e?.variables.find(l=>l.identifier=="SCORE"),s=parseFloat(i?.value),n=e.externalScored;return h`<div>${t!=="completed"?this.dataset.textNoResponse:!n&&s!==void 0&&!Number.isNaN(s)?s>0?this.dataset.textCorrect:this.dataset.textIncorrect:n==="externalMachine"?Number.isNaN(s)||s===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${s===0?"geen punten":s==1?"\xE9\xE9n punt":`${s} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:n==="human"?Number.isNaN(s)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};c([_({context:P,subscribe:!0})],kt.prototype,"computedContext",2),c([u({type:String,attribute:"view"})],kt.prototype,"view",2),kt=c([g("test-scoring-feedback")],kt);var Ar=class extends v{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0})),this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}));let e=this.closest("qti-test").querySelector("test-container");Array.from(e.shadowRoot.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",!0)})})}render(){return h` <slot></slot> `}};Ar.styles=x`
5353
+ `,c([u({type:String,attribute:"section-id"})],Tt.prototype,"sectionId",2),Tt=c([g("test-section-link")],Tt);var Tr=class extends v{render(){return h` <small><pre>${JSON.stringify(this.computedContext,null,2)}</pre></small> `}};c([E(),_({context:O,subscribe:!0})],Tr.prototype,"computedContext",2),Tr=c([g("test-print-context")],Tr);var rt=class extends v{constructor(){super(...arguments);this.debug=!1;this.stampContext={view:"candidate",activeItem:{},activeSection:{items:[]},activeTestpart:{items:[],sections:[]},test:{}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Z(e)}willUpdate(e){if(!this.computedContext)return;let t=this.computedContext.testParts.find(f=>f.active),i=t?.sections.find(f=>f.active),s=i?.items.find(f=>f.active),{variables:n,...a}=s||{};if(!t||!i||!s)return;let l={...t,items:t.sections.flatMap(f=>f.items.map(({variables:b,...y})=>y)),sections:t.sections.map(f=>({...f,items:f.items.map(({variables:b,...y})=>y)}))},p={...i,items:i.items.map(({variables:f,...b})=>b)},{testParts:d,...m}=this.computedContext;this.stampContext={view:this.computedContext.view,activeItem:a,activeSection:p,activeTestpart:l,test:m},this.dispatchEvent(new CustomEvent("qti-stamp-context-updated",{detail:this.stampContext,bubbles:!0}))}render(){return h` ${this.debug?h`<small><pre>${JSON.stringify(this.stampContext,null,2)}</pre></small>`:S}
5354
+ ${this.myTemplate?this.myTemplate(this.stampContext):S}`}};c([u({type:Boolean,reflect:!0})],rt.prototype,"debug",2),c([E(),_({context:O,subscribe:!0})],rt.prototype,"computedContext",2),c([E()],rt.prototype,"stampContext",2),rt=c([g("test-stamp")],rt);var it=class extends v{constructor(){super();this.view="";this.disabled=!1;this.myTemplate=null;this.addEventListener("click",e=>{let t=e.target,i=parseFloat(t.value);t.tagName==="INPUT"&&this._changeOutcomeScore(i)})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let e=this.querySelector("template");if(!e){this.myTemplate=null;return}this.myTemplate=Z(e)}_changeOutcomeScore(e){let s=(this.computedContext?.testParts.find(n=>n.active)).sections.flatMap(n=>n.items).find(n=>n.active)?.identifier;this.dispatchEvent(new CustomEvent("test-update-outcome-variable",{detail:{assessmentItemRefId:s,outcomeVariableId:"SCORE",value:e},bubbles:!0}))}render(){let e=this.computedContext?.testParts.flatMap(l=>l.sections.flatMap(p=>p.items)).find(l=>l.active);if(!e||!e.variables)return h``;let t=e.variables.find(l=>l.identifier=="MAXSCORE")?.value,i=e.variables.find(l=>l.identifier=="SCORE"),s=i?.value,n=i?.externalScored!=="human";if(!t||!i)return S;let a=[...Array(Number(t)+1).keys()];return h`${this.myTemplate?this.myTemplate({scores:a,score:s,disabled:n}):S}`}};c([u({type:String,attribute:"view"})],it.prototype,"view",2),c([u({type:Boolean})],it.prototype,"disabled",2),c([_({context:O,subscribe:!0})],it.prototype,"computedContext",2),it=c([g("test-scoring-buttons")],it);var kr=class extends v{createRenderRoot(){return this}connectedCallback(){super.connectedCallback();let r=this.querySelector("template");if(!r){this.myTemplate=null;return}this.myTemplate=Z(r)}_switchView(r){this.dispatchEvent(new CustomEvent("on-test-switch-view",{composed:!0,bubbles:!0,detail:r}))}firstUpdated(r){this.addEventListener("click",()=>{this.sessionContext?.view==="scorer"?this._switchView("candidate"):this._switchView("scorer")})}render(){return h`${this.myTemplate?this.myTemplate({view:this.sessionContext?.view}):S}`}};c([_({context:He,subscribe:!0})],kr.prototype,"sessionContext",2),kr=c([g("test-view-toggle")],kr);var kt=class extends v{constructor(){super(...arguments);this.view=null}render(){let e=this.computedContext?.testParts.flatMap(l=>l.sections.flatMap(p=>p.items)).find(l=>l.active);if(!e||!e.variables)return h``;if(e.category==="dep-informational")return h`<div>${this.dataset.informational}</div>`;let t=e?.variables.find(l=>l.identifier==="completionStatus")?.value,i=e?.variables.find(l=>l.identifier=="SCORE"),s=parseFloat(i?.value),n=e.externalScored;return h`<div>${t!=="completed"?this.dataset.textNoResponse:!n&&s!==void 0&&!Number.isNaN(s)?s>0?this.dataset.textCorrect:this.dataset.textIncorrect:n==="externalMachine"?Number.isNaN(s)||s===void 0?this.dataset.scoreUnknown:`We hebben je antwoord ${s===0?"geen punten":s==1?"\xE9\xE9n punt":`${s} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`:n==="human"?Number.isNaN(s)?"":"Deze score heb je zelf toegekend.":this.dataset.inProgress}</div>`}};c([_({context:O,subscribe:!0})],kt.prototype,"computedContext",2),c([u({type:String,attribute:"view"})],kt.prototype,"view",2),kt=c([g("test-scoring-feedback")],kt);var Ar=class extends v{constructor(){super(),this.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("test-end-attempt",{bubbles:!0})),this.dispatchEvent(new CustomEvent("test-show-correct-response",{detail:!0,bubbles:!0}));let e=this.closest("qti-test").querySelector("test-container");Array.from(e.shadowRoot.querySelectorAll("[view]")).forEach(i=>{i.classList.toggle("show",!0)})})}render(){return h` <slot></slot> `}};Ar.styles=x`
5355
5355
  :host {
5356
5356
  ${j};
5357
5357
  }
@@ -5432,7 +5432,7 @@ div.full-correct-response-inline {
5432
5432
  :host([disabled]) {
5433
5433
  ${Qo};
5434
5434
  }
5435
- `,c([_({context:At,subscribe:!0})],re.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],re.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],re.prototype,"disabled",2),c([u({type:String})],re.prototype,"showCorrectText",2),c([u({type:String})],re.prototype,"hideCorrectText",2),c([u({type:String})],re.prototype,"noCorrectResponseText",2),re=c([g("item-show-correct-response")],re);var St=class extends v{constructor(){super();this.configContext={};this._onItemContextChanged=this._handleItemContextChanged.bind(this);this._onAssessmentItemConnected=this._handleAssessmentItemConnected.bind(this);this._onHandleShowCorrectResponse=this._handleShowCorrectResponse.bind(this);this._onHandleShowCandidateCorrection=this._handleShowCandidateCorrection.bind(this);this._onHandleSwitchCorrectResponseMode=this._handleSwitchCorrectResponseMode.bind(this);this.addEventListener("qti-item-context-updated",this._onItemContextChanged),this.addEventListener("qti-assessment-item-connected",this._onAssessmentItemConnected),this.addEventListener("item-show-correct-response",this._onHandleShowCorrectResponse),this.addEventListener("item-show-candidate-correction",this._onHandleShowCandidateCorrection),this.addEventListener("item-switch-correct-response-mode",this._onHandleSwitchCorrectResponseMode)}_handleItemContextChanged(e){this._updateItemVariablesInTestContext(e.detail.itemContext.identifier,e.detail?.itemContext?.variables||[])}_handleAssessmentItemConnected(e){let t=e.detail._context.variables;this._qtiAssessmentItem=e.detail,this.computedContext=this.computedContext?.identifier===this._qtiAssessmentItem.identifier?{...this.computedContext,title:this._qtiAssessmentItem.title}:{identifier:this._qtiAssessmentItem.identifier,title:this._qtiAssessmentItem.title,adaptive:this._qtiAssessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:t,correctResponseMode:"internal"},this._updateItemVariablesInTestContext(this._qtiAssessmentItem.identifier,t||[])}_handleShowCorrectResponse(e){this._qtiAssessmentItem&&this._qtiAssessmentItem.showCorrectResponse(e.detail)}_handleShowCandidateCorrection(e){this._qtiAssessmentItem&&this._qtiAssessmentItem.showCandidateCorrection(e.detail)}_handleSwitchCorrectResponseMode(e){this._handleShowCorrectResponse(new CustomEvent("item-show-correct-response",{detail:!1,bubbles:!0})),this.configContext={...this.configContext,correctResponseMode:e.detail}}_updateItemVariablesInTestContext(e,t){let i=t?.find(d=>d.identifier=="SCORE")?.value,s=parseFloat(i?.toString()),n=t?.find(d=>d.identifier==="completionStatus")?.value,a=s!==void 0&&!isNaN(s)&&s>0,l=s!==void 0&&!isNaN(s)&&s<=0,p=n==="completed";this.computedContext={...this.computedContext,identifier:e,correct:a,incorrect:l,completed:p,variables:t}}render(){return h`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this._onItemContextChanged),this.removeEventListener("qti-assessment-item-connected",this._onAssessmentItemConnected)}};c([E(),X({context:At})],St.prototype,"computedContext",2),c([E(),X({context:ne})],St.prototype,"configContext",2),St=c([g("qti-item")],St);var en={name:"@citolab/qti-components",repository:{type:"git",url:"git+https://github.com/Citolab/qti-components.git"},description:"QTI webcomponents",author:{name:"Patrick de Klein"},contributors:[{name:"Sander Looise"},{name:"Marcel Hoekstra"}],license:"GPLv3",private:!1,engines:{node:">=22.0.0"},version:"7.12.0",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",sideEffects:!0,exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./exports/*":{import:"./dist/exports/*"},"./qti-components":{types:"./dist/qti-components/index.d.ts",import:"./dist/qti-components/index.js"},"./qti-item":{types:"./dist/qti-item/index.d.ts",import:"./dist/qti-item/index.js"},"./qti-test":{types:"./dist/qti-test/index.d.ts",import:"./dist/qti-test/index.js"},"./qti-loader":{types:"./dist/qti-loader/index.d.ts",import:"./dist/qti-loader/index.js"},"./qti-transformers":{types:"./dist/qti-transformers/index.d.ts",import:"./dist/qti-transformers/index.js"},"./customElements":"./custom-elements.json","./react":"./dist/qti-components-jsx.d.ts","./item.css":"./dist/item.css","./cdn/*":"./cdn/*","./package.json":"./package.json"},files:["dist","cdn","custom-elements.json"],scripts:{storybook:"run-p storybook:dev cem:watch",watch:'nodemon --watch src --ext ts,css --exec "run-s tsup cem css && yalc push"',"-----------------------cmds--":"-","pre-commit":"run-s lint stylelint madge","commit-msg":"commitlint --edit","build-storybook":"npm run cem && storybook build","-----------------------scripts--":"-",build:"run-p cem css tsup","storybook:dev":"storybook dev -p 6006",cem:"cem analyze","cem:watch":"cem analyze --watch",css:"postcss src/item.css -d dist -m",ci:"npm ci",tsup:"tsup",publint:"publint",lint:"eslint src/**/*.ts",stylelint:'stylelint "src/**/*.css"',test:"vitest run",attw:"attw --profile esm-only --pack --exclude-entrypoints ./item.css ./react",chromatic:"node chromatic-runner.cjs",clean:"rm -rf dist cdn",madge:"madge --circular --extensions ts src",commitlint:"commitlint --edit","-----------------------npm--":"-",prepare:"husky"},peerDependencies:{"@heximal/templates":"^0.1.5","@lit/context":"^1.1.3",lit:"^3.2.1"},devDependencies:{"@arethetypeswrong/cli":"^0.18.2","@chromatic-com/storybook":"^4.1.1","@commitlint/cli":"^19.8.1","@commitlint/config-conventional":"^19.8.1","@custom-elements-manifest/analyzer":"^0.10.4","@eslint/js":"^9.29.0","@heximal/templates":"0.1.5","@lit/context":"^1.1.5","@open-wc/lit-helpers":"^0.7.0","@storybook/addon-a11y":"^9.1.5","@storybook/addon-docs":"^9.1.5","@storybook/addon-links":"^9.1.5","@storybook/addon-themes":"^9.1.5","@storybook/addon-vitest":"^9.1.5","@storybook/web-components-vite":"^9.1.5","@swc/core":"^1.12.1","@testing-library/dom":"^10.4.0","@types/dom-view-transitions":"^1.0.6","@types/node":"^24.0.3","@vitest/browser":"^3.2.4","@vitest/coverage-v8":"^3.2.4","@vitest/ui":"^3.2.4","@wc-toolkit/cem-inheritance":"^1.1.0","@wc-toolkit/cem-sorter":"^1.0.1","@wc-toolkit/cem-utilities":"^1.3.0","@wc-toolkit/changelog":"^1.0.1","@wc-toolkit/jsx-types":"^1.2.2","@wc-toolkit/storybook-helpers":"^9.0.0","@wc-toolkit/type-parser":"^1.1.0",autoprefixer:"^10.4.21",chromatic:"^13.0.0","custom-element-vs-code-integration":"^1.5.0","custom-elements-manifest-deprecator":"^1.2.0",dotenv:"^16.5.0",eslint:"^9.29.0","eslint-import-resolver-typescript":"^4.4.3","eslint-plugin-import":"^2.31.0","eslint-plugin-lit":"^2.1.1","eslint-plugin-lit-a11y":"^5.0.1","eslint-plugin-react":"^7.37.5","eslint-plugin-sort-imports-es6-autofix":"^0.6.0","eslint-plugin-storybook":"^9.1.5","eslint-plugin-wc":"^3.0.1","fast-xml-parser":"^5.2.5",globals:"^16.2.0",globby:"^14.1.0",husky:"^9.1.7",lit:"^3.3.0",madge:"^8.0.0",nodemon:"^3.1.10","npm-run-all":"^4.1.5","path-browserify":"^1.0.1","pkg-pr-new":"^0.0.51",playwright:"^1.53.0",postcss:"^8.5.6","postcss-class-apply":"^4.0.1","postcss-cli":"^11.0.1","postcss-import":"^16.1.1","postcss-nesting":"^13.0.2",prettier:"3.5.3","prettier-v2":"npm:prettier@2.8.8",publint:"^0.3.12","remark-gfm":"^4.0.1","shadow-dom-testing-library":"^1.12.0",storybook:"^9.1.5","storybook-addon-tag-badges":"^2.0.1",stylelint:"^16.20.0","stylelint-config-standard":"^38.0.0","stylelint-prettier":"^5.0.3",tsup:"^8.5.0",typescript:"^5.8.3","typescript-eslint":"^8.34.1",vite:"^6.3.5","vite-tsconfig-paths":"^5.1.4",vitest:"^3.2.4",yalc:"^1.0.0-pre.53"},optionalDependencies:{"@rollup/rollup-linux-x64-gnu":"^4.43.0"},customElements:"custom-elements.json",bugs:{url:"https://github.com/Citolab/qti-components/issues"},homepage:"https://github.com/Citolab/qti-components#readme",overrides:{storybook:"$storybook"}};console.info("%cC\xBFTO%cLab%c: qti-components v%c%s%c loaded",'font-family: "PT Sans", font-weight:bold; color:green; font-size: smaller;vertical-align: sub',"font-weight:bold; color:green","font-weight:unset","font-weight:bold; color:#2563eb",en.version,"font-weight:unset");export{Ji as INITIAL_TEST_CONTEXT,Re as ItemContainer,re as ItemShowCorrectResponse,Rt as PrintItemVariables,Jr as QtiAnd,G as QtiAssessmentItem,Te as QtiAssessmentItemRef,ke as QtiAssessmentSection,dt as QtiAssessmentStimulusRef,et as QtiAssessmentTest,Jt as QtiAssociableHotspot,ut as QtiAssociateInteraction,Kr as QtiBaseValue,mt as QtiChoiceInteraction,Br as QtiCompanionMaterialsInfo,Xi as QtiContainerSize,Gi as QtiContains,oi as QtiContentBody,Yi as QtiCorrect,ye as QtiCustomInteraction,Wt as QtiCustomOperator,qt as QtiDefault,vs as QtiDelete,$e as QtiEndAttemptInteraction,Qr as QtiEqual,Zr as QtiEqualRounded,U as QtiExtendedTextInteraction,Gt as QtiFeedbackBlock,Yt as QtiFeedbackInline,is as QtiFieldValue,gt as QtiGap,ht as QtiGapImg,Kt as QtiGapMatchInteraction,ft as QtiGapText,Zi as QtiGcd,ce as QtiGraphicAssociateInteraction,Zt as QtiGraphicGapMatchInteraction,Qt as QtiGraphicOrderInteraction,Qi as QtiGt,es as QtiGte,Qe as QtiHotspotChoice,er as QtiHotspotInteraction,rr as QtiHottext,tr as QtiHottextInteraction,br as QtiIndex,sr as QtiInlineChoice,xe as QtiInlineChoiceInteraction,rs as QtiIsNull,St as QtiItem,cr as QtiItemBody,ur as QtiLookupOutcomeValue,ss as QtiLt,os as QtiLte,ei as QtiMapResponse,ti as QtiMapResponsePoint,ns as QtiMatch,qe as QtiMatchInteraction,ri as QtiMathOperator,or as QtiMediaInteraction,as as QtiMember,Ze as QtiModalFeedback,ls as QtiMultiple,cs as QtiNot,ts as QtiNull,ps as QtiOr,Ee as QtiOrderInteraction,ds as QtiOrdered,he as QtiOutcomeDeclaration,pr as QtiOutcomeProcessing,Fi as QtiOutcomeProcessingProcessor,z as QtiPortableCustomInteraction,Vi as QtiPositionObjectInteraction,nr as QtiPositionObjectStage,us as QtiPower,gr as QtiPrintedVariable,ms as QtiProduct,Gr as QtiPrompt,bs as QtiRandom,Et as QtiRandomInteger,Ui as QtiResponseCondition,_e as QtiResponseDeclaration,mr as QtiResponseElse,Wi as QtiResponseElseIf,hr as QtiResponseIf,dr as QtiResponseProcessing,Ki as QtiRound,fr as QtiRoundTo,me as QtiRubricBlock,de as QtiRule,pe as QtiSelectPointInteraction,ji as QtiSetOutcomeValue,Bi as QtiSetOutcomeValueRule,Ve as QtiSimpleAssociableChoice,Ce as QtiSimpleChoice,we as QtiSliderInteraction,si as QtiStringMatch,ni as QtiStylesheet,ii as QtiSubtract,hs as QtiSum,fs as QtiSumExpression,ai as QtiTest,Er as QtiTestFeedback,Ae as QtiTestPart,J as QtiTextEntryInteraction,lr as QtiUploadInteraction,gs as QtiVariable,Ar as TestCheckItem,ge as TestContainer,Cr as TestEndAttempt,wt as TestItemLink,Q as TestNavigation,ze as TestNext,wr as TestPagingButtonsStamp,Fe as TestPrev,Tr as TestPrintContext,_t as TestPrintVariables,it as TestScoringButtons,kt as TestScoringFeedback,_r as TestSectionButtonsStamp,Tt as TestSectionLink,te as TestShowCorrectResponse,rt as TestStamp,W as TestView,kr as TestViewToggle,Mn as qtiAndMixin,In as qtiSubtractMixin,ue as testContext};
5435
+ `,c([_({context:At,subscribe:!0})],re.prototype,"computedContext",2),c([u({type:Boolean,reflect:!0})],re.prototype,"shown",2),c([u({type:Boolean,reflect:!0})],re.prototype,"disabled",2),c([u({type:String})],re.prototype,"showCorrectText",2),c([u({type:String})],re.prototype,"hideCorrectText",2),c([u({type:String})],re.prototype,"noCorrectResponseText",2),re=c([g("item-show-correct-response")],re);var St=class extends v{constructor(){super();this.configContext={};this._onItemContextChanged=this._handleItemContextChanged.bind(this);this._onAssessmentItemConnected=this._handleAssessmentItemConnected.bind(this);this._onHandleShowCorrectResponse=this._handleShowCorrectResponse.bind(this);this._onHandleShowCandidateCorrection=this._handleShowCandidateCorrection.bind(this);this._onHandleSwitchCorrectResponseMode=this._handleSwitchCorrectResponseMode.bind(this);this.addEventListener("qti-item-context-updated",this._onItemContextChanged),this.addEventListener("qti-assessment-item-connected",this._onAssessmentItemConnected),this.addEventListener("item-show-correct-response",this._onHandleShowCorrectResponse),this.addEventListener("item-show-candidate-correction",this._onHandleShowCandidateCorrection),this.addEventListener("item-switch-correct-response-mode",this._onHandleSwitchCorrectResponseMode)}_handleItemContextChanged(e){this._updateItemVariablesInTestContext(e.detail.itemContext.identifier,e.detail?.itemContext?.variables||[])}_handleAssessmentItemConnected(e){let t=e.detail._context.variables;this._qtiAssessmentItem=e.detail,this.computedContext=this.computedContext?.identifier===this._qtiAssessmentItem.identifier?{...this.computedContext,title:this._qtiAssessmentItem.title}:{identifier:this._qtiAssessmentItem.identifier,title:this._qtiAssessmentItem.title,adaptive:this._qtiAssessmentItem.getAttribute("adaptive")?.toLowerCase()==="true"||!1,variables:t,correctResponseMode:"internal"},this._updateItemVariablesInTestContext(this._qtiAssessmentItem.identifier,t||[])}_handleShowCorrectResponse(e){this._qtiAssessmentItem&&this._qtiAssessmentItem.showCorrectResponse(e.detail)}_handleShowCandidateCorrection(e){this._qtiAssessmentItem&&this._qtiAssessmentItem.showCandidateCorrection(e.detail)}_handleSwitchCorrectResponseMode(e){this._handleShowCorrectResponse(new CustomEvent("item-show-correct-response",{detail:!1,bubbles:!0})),this.configContext={...this.configContext,correctResponseMode:e.detail}}_updateItemVariablesInTestContext(e,t){let i=t?.find(d=>d.identifier=="SCORE")?.value,s=parseFloat(i?.toString()),n=t?.find(d=>d.identifier==="completionStatus")?.value,a=s!==void 0&&!isNaN(s)&&s>0,l=s!==void 0&&!isNaN(s)&&s<=0,p=n==="completed";this.computedContext={...this.computedContext,identifier:e,correct:a,incorrect:l,completed:p,variables:t}}render(){return h`<slot></slot>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-item-context-changed",this._onItemContextChanged),this.removeEventListener("qti-assessment-item-connected",this._onAssessmentItemConnected)}};c([E(),X({context:At})],St.prototype,"computedContext",2),c([E(),X({context:ne})],St.prototype,"configContext",2),St=c([g("qti-item")],St);var en={name:"@citolab/qti-components",repository:{type:"git",url:"git+https://github.com/Citolab/qti-components.git"},description:"QTI webcomponents",author:{name:"Patrick de Klein"},contributors:[{name:"Sander Looise"},{name:"Marcel Hoekstra"}],license:"GPLv3",private:!1,engines:{node:">=22.0.0"},version:"7.13.0",type:"module",main:"./dist/index.js",types:"./dist/index.d.ts",sideEffects:!0,exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./exports/*":{import:"./dist/exports/*"},"./qti-components":{types:"./dist/qti-components/index.d.ts",import:"./dist/qti-components/index.js"},"./qti-item":{types:"./dist/qti-item/index.d.ts",import:"./dist/qti-item/index.js"},"./qti-test":{types:"./dist/qti-test/index.d.ts",import:"./dist/qti-test/index.js"},"./qti-loader":{types:"./dist/qti-loader/index.d.ts",import:"./dist/qti-loader/index.js"},"./qti-transformers":{types:"./dist/qti-transformers/index.d.ts",import:"./dist/qti-transformers/index.js"},"./customElements":"./custom-elements.json","./react":"./dist/qti-components-jsx.d.ts","./item.css":"./dist/item.css","./cdn/*":"./cdn/*","./package.json":"./package.json"},files:["dist","cdn","custom-elements.json"],scripts:{storybook:"run-p storybook:dev cem:watch",watch:'nodemon --watch src --ext ts,css --exec "run-s tsup cem css && yalc push"',"-----------------------cmds--":"-","pre-commit":"run-s lint stylelint madge","commit-msg":"commitlint --edit","build-storybook":"npm run cem && storybook build","-----------------------scripts--":"-",build:"run-p cem css tsup","storybook:dev":"storybook dev -p 6006",cem:"cem analyze","cem:watch":"cem analyze --watch",css:"postcss src/item.css -d dist -m",ci:"npm ci",tsup:"tsup",publint:"publint",lint:"eslint src/**/*.ts",stylelint:'stylelint "src/**/*.css"',test:"vitest run",attw:"attw --profile esm-only --pack --exclude-entrypoints ./item.css ./react",chromatic:"node chromatic-runner.cjs",clean:"rm -rf dist cdn",madge:"madge --circular --extensions ts src",commitlint:"commitlint --edit","-----------------------npm--":"-",prepare:"husky"},peerDependencies:{"@heximal/templates":"^0.1.5","@lit/context":"^1.1.3",lit:"^3.2.1"},devDependencies:{"@arethetypeswrong/cli":"^0.18.2","@chromatic-com/storybook":"^4.1.1","@commitlint/cli":"^19.8.1","@commitlint/config-conventional":"^19.8.1","@custom-elements-manifest/analyzer":"^0.10.4","@eslint/js":"^9.29.0","@heximal/templates":"0.1.5","@lit/context":"^1.1.5","@open-wc/lit-helpers":"^0.7.0","@storybook/addon-a11y":"^9.1.5","@storybook/addon-docs":"^9.1.5","@storybook/addon-links":"^9.1.5","@storybook/addon-themes":"^9.1.5","@storybook/addon-vitest":"^9.1.5","@storybook/web-components-vite":"^9.1.5","@swc/core":"^1.12.1","@testing-library/dom":"^10.4.0","@types/dom-view-transitions":"^1.0.6","@types/node":"^24.0.3","@vitest/browser":"^3.2.4","@vitest/coverage-v8":"^3.2.4","@vitest/ui":"^3.2.4","@wc-toolkit/cem-inheritance":"^1.1.0","@wc-toolkit/cem-sorter":"^1.0.1","@wc-toolkit/cem-utilities":"^1.3.0","@wc-toolkit/changelog":"^1.0.1","@wc-toolkit/jsx-types":"^1.2.2","@wc-toolkit/storybook-helpers":"^9.0.0","@wc-toolkit/type-parser":"^1.1.0",autoprefixer:"^10.4.21",chromatic:"^13.0.0","custom-element-vs-code-integration":"^1.5.0","custom-elements-manifest-deprecator":"^1.2.0",dotenv:"^16.5.0",eslint:"^9.29.0","eslint-import-resolver-typescript":"^4.4.3","eslint-plugin-import":"^2.31.0","eslint-plugin-lit":"^2.1.1","eslint-plugin-lit-a11y":"^5.0.1","eslint-plugin-react":"^7.37.5","eslint-plugin-sort-imports-es6-autofix":"^0.6.0","eslint-plugin-storybook":"^9.1.5","eslint-plugin-wc":"^3.0.1","fast-xml-parser":"^5.2.5",globals:"^16.2.0",globby:"^14.1.0",husky:"^9.1.7",lit:"^3.3.0",madge:"^8.0.0",nodemon:"^3.1.10","npm-run-all":"^4.1.5","path-browserify":"^1.0.1","pkg-pr-new":"^0.0.51",playwright:"^1.53.0",postcss:"^8.5.6","postcss-class-apply":"^4.0.1","postcss-cli":"^11.0.1","postcss-import":"^16.1.1","postcss-nesting":"^13.0.2",prettier:"3.5.3","prettier-v2":"npm:prettier@2.8.8",publint:"^0.3.12","remark-gfm":"^4.0.1","shadow-dom-testing-library":"^1.12.0",storybook:"^9.1.5","storybook-addon-tag-badges":"^2.0.1",stylelint:"^16.20.0","stylelint-config-standard":"^38.0.0","stylelint-prettier":"^5.0.3",tsup:"^8.5.0",typescript:"^5.8.3","typescript-eslint":"^8.34.1",vite:"^6.3.5","vite-tsconfig-paths":"^5.1.4",vitest:"^3.2.4",yalc:"^1.0.0-pre.53"},optionalDependencies:{"@rollup/rollup-linux-x64-gnu":"^4.43.0"},customElements:"custom-elements.json",bugs:{url:"https://github.com/Citolab/qti-components/issues"},homepage:"https://github.com/Citolab/qti-components#readme",overrides:{storybook:"$storybook"}};console.info("%cC\xBFTO%cLab%c: qti-components v%c%s%c loaded",'font-family: "PT Sans", font-weight:bold; color:green; font-size: smaller;vertical-align: sub',"font-weight:bold; color:green","font-weight:unset","font-weight:bold; color:#2563eb",en.version,"font-weight:unset");export{Ji as INITIAL_TEST_CONTEXT,Re as ItemContainer,re as ItemShowCorrectResponse,Rt as PrintItemVariables,Jr as QtiAnd,G as QtiAssessmentItem,_e as QtiAssessmentItemRef,Te as QtiAssessmentSection,dt as QtiAssessmentStimulusRef,et as QtiAssessmentTest,Jt as QtiAssociableHotspot,ut as QtiAssociateInteraction,Kr as QtiBaseValue,mt as QtiChoiceInteraction,Br as QtiCompanionMaterialsInfo,Xi as QtiContainerSize,Gi as QtiContains,oi as QtiContentBody,Yi as QtiCorrect,ve as QtiCustomInteraction,Wt as QtiCustomOperator,qt as QtiDefault,vs as QtiDelete,$e as QtiEndAttemptInteraction,Qr as QtiEqual,Zr as QtiEqualRounded,U as QtiExtendedTextInteraction,Gt as QtiFeedbackBlock,Yt as QtiFeedbackInline,is as QtiFieldValue,gt as QtiGap,ht as QtiGapImg,Kt as QtiGapMatchInteraction,ft as QtiGapText,Zi as QtiGcd,ce as QtiGraphicAssociateInteraction,Zt as QtiGraphicGapMatchInteraction,Qt as QtiGraphicOrderInteraction,Qi as QtiGt,es as QtiGte,Qe as QtiHotspotChoice,er as QtiHotspotInteraction,rr as QtiHottext,tr as QtiHottextInteraction,br as QtiIndex,sr as QtiInlineChoice,ye as QtiInlineChoiceInteraction,rs as QtiIsNull,St as QtiItem,cr as QtiItemBody,ur as QtiLookupOutcomeValue,ss as QtiLt,os as QtiLte,ei as QtiMapResponse,ti as QtiMapResponsePoint,ns as QtiMatch,xe as QtiMatchInteraction,ri as QtiMathOperator,or as QtiMediaInteraction,as as QtiMember,Ze as QtiModalFeedback,ls as QtiMultiple,cs as QtiNot,ts as QtiNull,ps as QtiOr,qe as QtiOrderInteraction,ds as QtiOrdered,he as QtiOutcomeDeclaration,pr as QtiOutcomeProcessing,Fi as QtiOutcomeProcessingProcessor,z as QtiPortableCustomInteraction,Vi as QtiPositionObjectInteraction,nr as QtiPositionObjectStage,us as QtiPower,gr as QtiPrintedVariable,ms as QtiProduct,Gr as QtiPrompt,bs as QtiRandom,Et as QtiRandomInteger,Ui as QtiResponseCondition,we as QtiResponseDeclaration,mr as QtiResponseElse,Wi as QtiResponseElseIf,hr as QtiResponseIf,dr as QtiResponseProcessing,Ki as QtiRound,fr as QtiRoundTo,me as QtiRubricBlock,de as QtiRule,pe as QtiSelectPointInteraction,ji as QtiSetOutcomeValue,Bi as QtiSetOutcomeValueRule,Ve as QtiSimpleAssociableChoice,Ee as QtiSimpleChoice,Ce as QtiSliderInteraction,si as QtiStringMatch,ni as QtiStylesheet,ii as QtiSubtract,hs as QtiSum,fs as QtiSumExpression,ai as QtiTest,Er as QtiTestFeedback,ke as QtiTestPart,J as QtiTextEntryInteraction,lr as QtiUploadInteraction,gs as QtiVariable,Ar as TestCheckItem,Ae as TestContainer,Cr as TestEndAttempt,wt as TestItemLink,Q as TestNavigation,ze as TestNext,wr as TestPagingButtonsStamp,Fe as TestPrev,Tr as TestPrintContext,_t as TestPrintVariables,it as TestScoringButtons,kt as TestScoringFeedback,_r as TestSectionButtonsStamp,Tt as TestSectionLink,te as TestShowCorrectResponse,rt as TestStamp,W as TestView,kr as TestViewToggle,Mn as qtiAndMixin,In as qtiSubtractMixin,ue as testContext};
5436
5436
  /*! Bundled license information:
5437
5437
 
5438
5438
  @lit/context/lib/context-request-event.js: