@citolab/qti-components 6.7.1-10 → 6.7.1-11
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/dist/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnPropertyDescriptor,_s=Object.getOwnPropertyDescriptors;var xr=Object.getOwnPropertySymbols;var Cs=Object.prototype.hasOwnProperty,As=Object.prototype.propertyIsEnumerable;var Er=(i,t,e)=>t in i?_r(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,x=(i,t)=>{for(var e in t||(t={}))Cs.call(t,e)&&Er(i,e,t[e]);if(xr)for(var e of xr(t))As.call(t,e)&&Er(i,e,t[e]);return i},R=(i,t)=>xs(i,_s(t));var l=(i,t,e,r)=>{for(var s=r>1?void 0:r?Es(t,e):t,n=i.length-1,o;n>=0;n--)(o=i[n])&&(s=(r?o(t,e,s):o(s))||s);return r&&s&&_r(t,e,s),s};var Q=class extends Event{constructor(t,e,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=r!=null?r:!1}};var me=class{constructor(t,e,r,s){var n;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,a)=>{this.unsubscribe&&(this.unsubscribe!==a&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,a)),this.unsubscribe=a},this.host=t,e.context!==void 0){let o=e;this.context=o.context,this.callback=o.callback,this.subscribe=(n=o.subscribe)!=null?n:!1}else this.context=e,this.callback=r,this.subscribe=s!=null?s:!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Q(this.context,this.t,this.subscribe))}};var Ke=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}};var Ht=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},fe=class extends Ke{constructor(t,e,r){var s,n;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{let a=o.composedPath()[0];o.context===this.context&&a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{let a=o.composedPath()[0];if(o.context!==this.context||a===this.host)return;let c=new Set;for(let[u,{consumerHost:h}]of this.subscriptions)c.has(u)||(c.add(u),h.dispatchEvent(new Q(this.context,u,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(n=(s=this.host).addController)==null||n.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Ht(this.context))}};function Nt({context:i}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new fe(this,{context:i}))}),{get(){return t.get.call(this)},set(s){var n;return(n=r.get(this))==null||n.setValue(s),t.set.call(this,s)},init(s){var n;return(n=r.get(this))==null||n.setValue(s),s}};{t.constructor.addInitializer(o=>{r.set(o,new fe(o,{context:i}))});let s=Object.getOwnPropertyDescriptor(t,e),n;if(s===void 0){let o=new WeakMap;n={get:function(){return o.get(this)},set:function(a){r.get(this).setValue(a),o.set(this,a)},configurable:!0,enumerable:!0}}else{let o=s.set;n=R(x({},s),{set:function(a){r.get(this).setValue(a),o==null||o.call(this,a)}})}return void Object.defineProperty(t,e,n)}}}function Y({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new me(this,{context:i,callback:s=>{this[r.name]=s},subscribe:t})}):e.constructor.addInitializer(s=>{new me(s,{context:i,callback:n=>{s[r]=n},subscribe:t})})}}var Cr=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBraileLabel="",this.ariaBraileRoleDescription="",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=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Ar=new WeakMap,$e=i=>{let t=Ar.get(i);return t===void 0&&Ar.set(i,t=new Map),t},ws=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from($e(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}setAttribute(t,e){$e(this).set(t,String(e))}removeAttribute(t){$e(this).delete(t)}hasAttribute(t){return $e(this).has(t)}attachShadow(t){let e={host:this};return this.__shadowRootMode=t.mode,t&&t.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new Cr(this);return this.__internals=t,t}getAttribute(t){let e=$e(this).get(t);return e!=null?e:null}};var $s=class extends ws{},qr=$s;var Ss=class{constructor(){this.__definitions=new Map}define(t,e){var r;if(this.__definitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);this.__definitions.set(t,{ctor:e,observedAttributes:(r=e.observedAttributes)!=null?r:[]})}get(t){let e=this.__definitions.get(t);return e==null?void 0:e.ctor}},Rs=Ss;var wr=new Rs;var Se=globalThis,We=Se.ShadowRoot&&(Se.ShadyCSS===void 0||Se.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Dt=Symbol(),$r=new WeakMap,Re=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Dt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(We&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=$r.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&$r.set(e,t))}return t}toString(){return this.cssText}},Sr=i=>new Re(typeof i=="string"?i:i+"",void 0,Dt),b=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,s,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[n+1],i[0]);return new Re(e,i,Dt)},Ot=(i,t)=>{if(We)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),s=Se.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},Je=We||Se.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Sr(e)})(i):i;var{is:ks,defineProperty:Ts,getOwnPropertyDescriptor:Ls,getOwnPropertyNames:Ms,getOwnPropertySymbols:Ps,getPrototypeOf:Vs}=Object,O=globalThis,Tr;(Tr=O.customElements)!=null||(O.customElements=wr);var Rr=O.trustedTypes,Hs=Rr?Rr.emptyScript:"",Ut=O.reactiveElementPolyfillSupport,ke=(i,t)=>i,Te={toAttribute(i,t){switch(t){case Boolean:i=i?Hs:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch(r){e=null}}return e}},Ge=(i,t)=>!ks(i,t),kr={attribute:!0,type:String,converter:Te,reflect:!1,hasChanged:Ge},Lr,Mr;(Lr=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Mr=O.litPropertyMetadata)!=null||(O.litPropertyMetadata=new WeakMap);var Pr,K=class extends((Pr=globalThis.HTMLElement)!=null?Pr:qr){static addInitializer(t){var e;this._$Ei(),((e=this.l)!=null?e:this.l=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=kr){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),s=this.getPropertyDescriptor(t,r,e);s!==void 0&&Ts(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){var o;let{get:s,set:n}=(o=Ls(this.prototype,t))!=null?o:{get(){return this[e]},set(a){this[e]=a}};return{get(){return s==null?void 0:s.call(this)},set(a){let c=s==null?void 0:s.call(this);n.call(this,a),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:kr}static _$Ei(){if(this.hasOwnProperty(ke("elementProperties")))return;let t=Vs(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ke("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ke("properties"))){let e=this.properties,r=[...Ms(e),...Ps(e)];for(let s of r)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,s]of e)this.elementProperties.set(r,s)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let s=this._$Eu(e,r);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let s of r)e.unshift(Je(s))}else t!==void 0&&e.push(Je(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$ES(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,r;((e=this._$E_)!=null?e:this._$E_=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var e;(e=this._$E_)==null||e.delete(t)}_$ES(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return Ot(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(r=>{var s;return(s=r.hostConnected)==null?void 0:s.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$E_)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EO(t,e){var n;let r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){let o=(((n=r.converter)==null?void 0:n.toAttribute)!==void 0?r.converter:Te).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){var n;let r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let o=r.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Te;this._$Em=s,this[s]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r,s=!1,n){var o;if(t!==void 0){if(r!=null||(r=this.constructor.getPropertyOptions(t)),!((o=r.hasChanged)!=null?o:Ge)(s?n:this[t],e))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,r){var s;this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&((s=this._$Ej)!=null?s:this._$Ej=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,a]of n)a.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.C(o,this[o],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$E_)==null||s.forEach(n=>{var o;return(o=n.hostUpdate)==null?void 0:o.call(n)}),this.update(e)):this._$ET()}catch(n){throw t=!1,this._$ET(),n}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$E_)==null||e.forEach(r=>{var s;return(s=r.hostUpdated)==null?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}},Vr;K.elementStyles=[],K.shadowRootOptions={mode:"open"},K[ke("elementProperties")]=new Map,K[ke("finalized")]=new Map,Ut==null||Ut({ReactiveElement:K}),((Vr=O.reactiveElementVersions)!=null?Vr:O.reactiveElementVersions=[]).push("2.0.2");var be=globalThis,Ze=be.trustedTypes,Hr=Ze?Ze.createPolicy("lit-html",{createHTML:i=>i}):void 0,Xt="$lit$",W=`lit$${(Math.random()+"").slice(9)}$`,Bt="?"+W,Ns=`<${Bt}>`,ne=be.document===void 0?{createTreeWalker:()=>({})}:document,Me=()=>ne.createComment(""),Pe=i=>i===null||typeof i!="object"&&typeof i!="function",Xr=Array.isArray,Br=i=>Xr(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",It=`[
|
|
1
|
+
var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnPropertyDescriptor,_s=Object.getOwnPropertyDescriptors;var xr=Object.getOwnPropertySymbols;var Cs=Object.prototype.hasOwnProperty,As=Object.prototype.propertyIsEnumerable;var Er=(i,t,e)=>t in i?_r(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,x=(i,t)=>{for(var e in t||(t={}))Cs.call(t,e)&&Er(i,e,t[e]);if(xr)for(var e of xr(t))As.call(t,e)&&Er(i,e,t[e]);return i},R=(i,t)=>xs(i,_s(t));var c=(i,t,e,r)=>{for(var s=r>1?void 0:r?Es(t,e):t,n=i.length-1,o;n>=0;n--)(o=i[n])&&(s=(r?o(t,e,s):o(s))||s);return r&&s&&_r(t,e,s),s};var Q=class extends Event{constructor(t,e,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=r!=null?r:!1}};var me=class{constructor(t,e,r,s){var n;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,a)=>{this.unsubscribe&&(this.unsubscribe!==a&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,a)),this.unsubscribe=a},this.host=t,e.context!==void 0){let o=e;this.context=o.context,this.callback=o.callback,this.subscribe=(n=o.subscribe)!=null?n:!1}else this.context=e,this.callback=r,this.subscribe=s!=null?s:!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Q(this.context,this.t,this.subscribe))}};var We=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}};var Ht=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},fe=class extends We{constructor(t,e,r){var s,n;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{let a=o.composedPath()[0];o.context===this.context&&a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{let a=o.composedPath()[0];if(o.context!==this.context||a===this.host)return;let l=new Set;for(let[u,{consumerHost:h}]of this.subscriptions)l.has(u)||(l.add(u),h.dispatchEvent(new Q(this.context,u,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(n=(s=this.host).addController)==null||n.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Ht(this.context))}};function Nt({context:i}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new fe(this,{context:i}))}),{get(){return t.get.call(this)},set(s){var n;return(n=r.get(this))==null||n.setValue(s),t.set.call(this,s)},init(s){var n;return(n=r.get(this))==null||n.setValue(s),s}};{t.constructor.addInitializer(o=>{r.set(o,new fe(o,{context:i}))});let s=Object.getOwnPropertyDescriptor(t,e),n;if(s===void 0){let o=new WeakMap;n={get:function(){return o.get(this)},set:function(a){r.get(this).setValue(a),o.set(this,a)},configurable:!0,enumerable:!0}}else{let o=s.set;n=R(x({},s),{set:function(a){r.get(this).setValue(a),o==null||o.call(this,a)}})}return void Object.defineProperty(t,e,n)}}}function Y({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new me(this,{context:i,callback:s=>{this[r.name]=s},subscribe:t})}):e.constructor.addInitializer(s=>{new me(s,{context:i,callback:n=>{s[r]=n},subscribe:t})})}}var Cr=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBraileLabel="",this.ariaBraileRoleDescription="",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=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Ar=new WeakMap,$e=i=>{let t=Ar.get(i);return t===void 0&&Ar.set(i,t=new Map),t},ws=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from($e(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}setAttribute(t,e){$e(this).set(t,String(e))}removeAttribute(t){$e(this).delete(t)}hasAttribute(t){return $e(this).has(t)}attachShadow(t){let e={host:this};return this.__shadowRootMode=t.mode,t&&t.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new Cr(this);return this.__internals=t,t}getAttribute(t){let e=$e(this).get(t);return e!=null?e:null}};var $s=class extends ws{},qr=$s;var Ss=class{constructor(){this.__definitions=new Map}define(t,e){var r;if(this.__definitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);this.__definitions.set(t,{ctor:e,observedAttributes:(r=e.observedAttributes)!=null?r:[]})}get(t){let e=this.__definitions.get(t);return e==null?void 0:e.ctor}},Rs=Ss;var wr=new Rs;var Se=globalThis,Ke=Se.ShadowRoot&&(Se.ShadyCSS===void 0||Se.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Dt=Symbol(),$r=new WeakMap,Re=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Dt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Ke&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=$r.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&$r.set(e,t))}return t}toString(){return this.cssText}},Sr=i=>new Re(typeof i=="string"?i:i+"",void 0,Dt),b=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,s,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[n+1],i[0]);return new Re(e,i,Dt)},Ot=(i,t)=>{if(Ke)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),s=Se.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},Je=Ke||Se.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Sr(e)})(i):i;var{is:ks,defineProperty:Ts,getOwnPropertyDescriptor:Ls,getOwnPropertyNames:Ms,getOwnPropertySymbols:Ps,getPrototypeOf:Vs}=Object,O=globalThis,Tr;(Tr=O.customElements)!=null||(O.customElements=wr);var Rr=O.trustedTypes,Hs=Rr?Rr.emptyScript:"",Ut=O.reactiveElementPolyfillSupport,ke=(i,t)=>i,Te={toAttribute(i,t){switch(t){case Boolean:i=i?Hs:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch(r){e=null}}return e}},Ge=(i,t)=>!ks(i,t),kr={attribute:!0,type:String,converter:Te,reflect:!1,hasChanged:Ge},Lr,Mr;(Lr=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Mr=O.litPropertyMetadata)!=null||(O.litPropertyMetadata=new WeakMap);var Pr,W=class extends((Pr=globalThis.HTMLElement)!=null?Pr:qr){static addInitializer(t){var e;this._$Ei(),((e=this.l)!=null?e:this.l=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=kr){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),s=this.getPropertyDescriptor(t,r,e);s!==void 0&&Ts(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){var o;let{get:s,set:n}=(o=Ls(this.prototype,t))!=null?o:{get(){return this[e]},set(a){this[e]=a}};return{get(){return s==null?void 0:s.call(this)},set(a){let l=s==null?void 0:s.call(this);n.call(this,a),this.requestUpdate(t,l,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:kr}static _$Ei(){if(this.hasOwnProperty(ke("elementProperties")))return;let t=Vs(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ke("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ke("properties"))){let e=this.properties,r=[...Ms(e),...Ps(e)];for(let s of r)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,s]of e)this.elementProperties.set(r,s)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let s=this._$Eu(e,r);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let s of r)e.unshift(Je(s))}else t!==void 0&&e.push(Je(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$ES(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,r;((e=this._$E_)!=null?e:this._$E_=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var e;(e=this._$E_)==null||e.delete(t)}_$ES(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return Ot(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(r=>{var s;return(s=r.hostConnected)==null?void 0:s.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$E_)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EO(t,e){var n;let r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){let o=(((n=r.converter)==null?void 0:n.toAttribute)!==void 0?r.converter:Te).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){var n;let r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let o=r.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Te;this._$Em=s,this[s]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r,s=!1,n){var o;if(t!==void 0){if(r!=null||(r=this.constructor.getPropertyOptions(t)),!((o=r.hasChanged)!=null?o:Ge)(s?n:this[t],e))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,r){var s;this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&((s=this._$Ej)!=null?s:this._$Ej=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,a]of n)a.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.C(o,this[o],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$E_)==null||s.forEach(n=>{var o;return(o=n.hostUpdate)==null?void 0:o.call(n)}),this.update(e)):this._$ET()}catch(n){throw t=!1,this._$ET(),n}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$E_)==null||e.forEach(r=>{var s;return(s=r.hostUpdated)==null?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}},Vr;W.elementStyles=[],W.shadowRootOptions={mode:"open"},W[ke("elementProperties")]=new Map,W[ke("finalized")]=new Map,Ut==null||Ut({ReactiveElement:W}),((Vr=O.reactiveElementVersions)!=null?Vr:O.reactiveElementVersions=[]).push("2.0.2");var be=globalThis,Ze=be.trustedTypes,Hr=Ze?Ze.createPolicy("lit-html",{createHTML:i=>i}):void 0,Xt="$lit$",K=`lit$${(Math.random()+"").slice(9)}$`,Bt="?"+K,Ns=`<${Bt}>`,ne=be.document===void 0?{createTreeWalker:()=>({})}:document,Me=()=>ne.createComment(""),Pe=i=>i===null||typeof i!="object"&&typeof i!="function",Xr=Array.isArray,Br=i=>Xr(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",It=`[
|
|
2
2
|
\f\r]`,Le=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Nr=/-->/g,Dr=/>/g,ie=RegExp(`>|${It}(?:([^\\s"'>=/]+)(${It}*=${It}*(?:[^
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Or=/'/g,Ur=/"/g,zr=/^(?:script|style|textarea|title)$/i,jr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),p=jr(1),zt=jr(2),M=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),Ir=new WeakMap,oe=ne.createTreeWalker(ne,129);function Yr(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Hr!==void 0?Hr.createHTML(t):t}var Kr=(i,t)=>{let e=i.length-1,r=[],s,n=t===2?"<svg>":"",o=Le;for(let a=0;a<e;a++){let c=i[a],u,h,m=-1,y=0;for(;y<c.length&&(o.lastIndex=y,h=o.exec(c),h!==null);)y=o.lastIndex,o===Le?h[1]==="!--"?o=Nr:h[1]!==void 0?o=Dr:h[2]!==void 0?(zr.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=ie):h[3]!==void 0&&(o=ie):o===ie?h[0]===">"?(o=s!=null?s:Le,m=-1):h[1]===void 0?m=-2:(m=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?ie:h[3]==='"'?Ur:Or):o===Ur||o===Or?o=ie:o===Nr||o===Dr?o=Le:(o=ie,s=void 0);let g=o===ie&&i[a+1].startsWith("/>")?" ":"";n+=o===Le?c+Ns:m>=0?(r.push(u),c.slice(0,m)+Xt+c.slice(m)+W+g):c+W+(m===-2?a:g)}return[Yr(i,n+(i[e]||"<?>")+(t===2?"</svg>":"")),r]},Ve=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let n=0,o=0,a=t.length-1,c=this.parts,[u,h]=Kr(t,e);if(this.el=i.createElement(u,r),oe.currentNode=this.el.content,e===2){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(s=oe.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let m of s.getAttributeNames())if(m.endsWith(Xt)){let y=h[o++],g=s.getAttribute(m).split(W),q=/([.?@])?(.*)/.exec(y);c.push({type:1,index:n,name:q[2],strings:g,ctor:q[1]==="."?et:q[1]==="?"?tt:q[1]==="@"?rt:le}),s.removeAttribute(m)}else m.startsWith(W)&&(c.push({type:6,index:n}),s.removeAttribute(m));if(zr.test(s.tagName)){let m=s.textContent.split(W),y=m.length-1;if(y>0){s.textContent=Ze?Ze.emptyScript:"";for(let g=0;g<y;g++)s.append(m[g],Me()),oe.nextNode(),c.push({type:2,index:++n});s.append(m[y],Me())}}}else if(s.nodeType===8)if(s.data===Bt)c.push({type:2,index:n});else{let m=-1;for(;(m=s.data.indexOf(W,m+1))!==-1;)c.push({type:7,index:n}),m+=W.length-1}n++}}static createElement(t,e){let r=ne.createElement("template");return r.innerHTML=t,r}};function ae(i,t,e=i,r){var o,a,c;if(t===M)return t;let s=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl,n=Pe(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),n===void 0?s=void 0:(s=new n(i),s._$AT(i,e,r)),r!==void 0?((c=e._$Co)!=null?c:e._$Co=[])[r]=s:e._$Cl=s),s!==void 0&&(t=ae(i,s._$AS(i,t.values),s,r)),t}var Qe=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var u;let{el:{content:e},parts:r}=this._$AD,s=((u=t==null?void 0:t.creationScope)!=null?u:ne).importNode(e,!0);oe.currentNode=s;let n=oe.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new ge(n,n.nextSibling,this,t):c.type===1?h=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(h=new st(n,this,t)),this._$AV.push(h),c=r[++a]}o!==(c==null?void 0:c.index)&&(n=oe.nextNode(),o++)}return oe.currentNode=ne,s}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},ge=class i{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,r,s){var n;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=(n=s==null?void 0:s.isConnected)!=null?n:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ae(this,t,e),Pe(t)?t===E||t==null||t===""?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==M&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Br(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==E&&Pe(this._$AH)?this._$AA.nextSibling.data=t:this.$(ne.createTextNode(t)),this._$AH=t}g(t){var n;let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ve.createElement(Yr(r.h,r.h[0]),this.options)),r);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{let o=new Qe(s,this),a=o.u(this.options);o.p(e),this.$(a),this._$AH=o}}_$AC(t){let e=Ir.get(t.strings);return e===void 0&&Ir.set(t.strings,e=new Ve(t)),e}T(t){Xr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,s=0;for(let n of t)s===e.length?e.push(r=new i(this.k(Me()),this.k(Me()),this,this.options)):r=e[s],r._$AI(n),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,n){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=E}_$AI(t,e=this,r,s){let n=this.strings,o=!1;if(n===void 0)t=ae(this,t,e,0),o=!Pe(t)||t!==this._$AH&&t!==M,o&&(this._$AH=t);else{let a=t,c,u;for(t=n[0],c=0;c<n.length-1;c++)u=ae(this,a[r+c],e,c),u===M&&(u=this._$AH[c]),o||(o=!Pe(u)||u!==this._$AH[c]),u===E?t=E:t!==E&&(t+=(u!=null?u:"")+n[c+1]),this._$AH[c]=u}o&&!s&&this.O(t)}O(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},et=class extends le{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===E?void 0:t}},tt=class extends le{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==E)}},rt=class extends le{constructor(t,e,r,s,n){super(t,e,r,s,n),this.type=5}_$AI(t,e=this){var o;if((t=(o=ae(this,t,e,0))!=null?o:E)===M)return;let r=this._$AH,s=t===E&&r!==E||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==E&&(r===E||s);s&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;typeof this._$AH=="function"?this._$AH.call((r=(e=this.options)==null?void 0:e.host)!=null?r:this.element,t):this._$AH.handleEvent(t)}},st=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){ae(this,t)}},Wr={j:Xt,P:W,A:Bt,C:1,M:Kr,L:Qe,R:Br,V:ae,D:ge,I:le,H:tt,N:rt,U:et,B:st},Ft=be.litHtmlPolyfillSupport,Fr;Ft==null||Ft(Ve,ge),((Fr=be.litHtmlVersions)!=null?Fr:be.litHtmlVersions=[]).push("3.1.0");var Jr=(i,t,e)=>{var n,o;let r=(n=e==null?void 0:e.renderBefore)!=null?n:t,s=r._$litPart$;if(s===void 0){let a=(o=e==null?void 0:e.renderBefore)!=null?o:null;r._$litPart$=s=new ge(t.insertBefore(Me(),a),a,void 0,e!=null?e:{})}return s._$AI(i),s};var f=class extends K{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let t=super.createRenderRoot();return(r=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Jr(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return M}},Gr;f._$litElement$=!0,f.finalized=!0,(Gr=globalThis.litElementHydrateSupport)==null||Gr.call(globalThis,{LitElement:f});var jt=globalThis.litElementPolyfillSupport;jt==null||jt({LitElement:f});var Zr;((Zr=globalThis.litElementVersions)!=null?Zr:globalThis.litElementVersions=[]).push("4.0.2");var _=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Ds={attribute:!0,type:String,converter:Te,reflect:!1,hasChanged:Ge},Os=(i=Ds,t,e)=>{let{kind:r,metadata:s}=e,n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(e.name,i),r==="accessor"){let{name:o}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,i)},init(a){return a!==void 0&&this.C(o,void 0,i),a}}}if(r==="setter"){let{name:o}=e;return function(a){let c=this[o];t.call(this,a),this.requestUpdate(o,c,i)}}throw Error("Unsupported decorator location: "+r)};function d(i){return(t,e)=>typeof e=="object"?Os(i,t,e):((r,s,n)=>{let o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?R(x({},r),{wrapped:!0}):r),o?Object.getOwnPropertyDescriptor(s,n):void 0})(i,t,e)}function C(i){return d(R(x({},i),{state:!0,attribute:!1}))}var ee=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function He(i,t){return(e,r,s)=>{let n=o=>{var a,c;return(c=(a=o.renderRoot)==null?void 0:a.querySelector(i))!=null?c:null};if(t){let{get:o,set:a}=typeof r=="object"?e:s!=null?s:(()=>{let c=Symbol();return{get(){return this[c]},set(u){this[c]=u}}})();return ee(e,r,{get(){let c=o.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return ee(e,r,{get(){return n(this)}})}}function Qr(i){return(t,e)=>{let{slot:r,selector:s}=i!=null?i:{},n="slot"+(r?`[name=${r}]`:":not([name])");return ee(t,e,{get(){var c,u;let o=(c=this.renderRoot)==null?void 0:c.querySelector(n),a=(u=o==null?void 0:o.assignedElements(i))!=null?u:[];return s===void 0?a:a.filter(h=>h.matches(s))}})}}function $(i,t){let e=x({waitUntilFirstUpdate:!1},t);return(r,s)=>{let{update:n}=r,o=Array.isArray(i)?i:[i];r.update=function(a){o.forEach(c=>{let u=c;if(a.has(u)){let h=a.get(u),m=this[u];h!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[s](h,m)}}),n.call(this,a)}}}var es=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],I="item";var P=class extends f{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent="false";this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(s=>s.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(s=>s.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:es};this._state="item-created";this._initialContext=R(x({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.state="item-created",this.addEventListener("qti-register-variable",({detail:e})=>{this._context=R(x({},this._context),{variables:[...this._context.variables,e.variable]}),this._initialContext=this._context}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let r=e.detail;this._feedbackElements.push(r),r.checkShowFeedback(r.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:r,countAttempt:s}=e.detail;this.updateResponseVariable(r,"true"),this.processResponse(s)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:s}=e.detail;this.updateOutcomeVariable(r,s)}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}set state(e){this._state=e}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type}))}set variables(e){if(!Array.isArray(e)||e.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=R(x({},this._context),{variables:this._context.variables.map(r=>{let s=e.find(n=>n.identifier===r.identifier);return s?x(x({},r),s):r})}),this._context.variables.forEach(r=>{if(r.type==="response"){let s=this._interactionElements.find(n=>n.responseIdentifier===r.identifier);s&&(s.response=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(s=>s.checkShowFeedback(r.identifier))})}firstUpdated(e){this.state="first-updated",requestAnimationFrame(()=>{this._emit("qti-assessment-item-first-updated",this)})}connectedCallback(){super.connectedCallback(),this.state="item-connected"}set responses(e){if(e)for(let r of e){this.getResponse(r.responseIdentifier)&&this.updateResponseVariable(r.responseIdentifier,r.response);let n=this._interactionElements.find(o=>o.getAttribute("response-identifier")===r.responseIdentifier);n&&(n.response=r.response)}}render(){return p`<slot></slot>`}showCorrectResponse(e){let s=this._context.variables.filter(n=>"correctResponse"in n&&n.correctResponse).map(n=>({responseIdentifier:n.identifier,response:n.correctResponse}));for(let n of s){let o=this._interactionElements.find(a=>a.getAttribute("response-identifier")===n.responseIdentifier);o&&(o.correctResponse=e?n.response:"")}}processResponse(e=!0){var s;let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((s=this._context.variables.find(n=>n.identifier==="numAttempts"))==null?void 0:s.value)+1).toString()),this._emit("qti-response-processed"),!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(r=>r.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:r,response:s}=e.detail;this.updateResponseVariable(r,s)}updateResponseVariable(e,r){this._context=R(x({},this._context),{variables:this._context.variables.map(s=>s.identifier!==e?s:R(x({},s),{value:r}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,r){var n;let s=this.getOutcome(e);if(!s){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=R(x({},this._context),{variables:this._context.variables.map(o=>o.identifier!==e?o:R(x({},o),{value:s.cardinality==="single"?r:[...o.value,r]}))}),this._feedbackElements.forEach(o=>o.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:(n=this._context.variables.find(o=>o.identifier===e))==null?void 0:n.value})}_getCompletionStatus(){return this._interactionElements.every(e=>e.validate())?"completed":this._interactionElements.some(e=>e.validate())?"incomplete":"not_attempted"}_emit(e,r=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:r}))}};l([d({type:String})],P.prototype,"title",2),l([d({type:String})],P.prototype,"identifier",2),l([d({type:String})],P.prototype,"adaptive",2),l([d({type:String})],P.prototype,"timeDependent",2),l([d({type:Boolean})],P.prototype,"disabled",2),l([$("disabled",{waitUntilFirstUpdate:!0})],P.prototype,"_handleDisabledChange",2),l([d({type:Boolean})],P.prototype,"readonly",2),l([$("readonly",{waitUntilFirstUpdate:!0})],P.prototype,"_handleReadonlyChange",2),l([Nt({context:I})],P.prototype,"_context",2),P=l([_("qti-assessment-item")],P);var Us={SPACE:32},T=class extends f{constructor(){super(...arguments);this.tabindex=0;this.disabled=!1;this.readonly=!1;this.checked=!1}handleDisabledChange(e,r){r?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-register-choice",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-loose-choice",{bubbles:!0,cancelable:!1,composed:!0}))}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case Us.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("qti-choice-element-selected",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier,checked:this.checked}})))}validateAllProps(){return!!this.getAttribute("identifier")}render(){return this.validateAllProps()||console.warn(`Invalid props for ${this.outerHTML}`,"missing identifier"),p` <slot></slot> `}};l([d({type:String})],T.prototype,"identifier",2),l([d({type:Number,reflect:!0})],T.prototype,"tabindex",2),l([d({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:e=>e}})],T.prototype,"disabled",2),l([d({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:e=>e}})],T.prototype,"readonly",2),l([d({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>e}})],T.prototype,"checked",2),l([$("disabled",{waitUntilFirstUpdate:!0})],T.prototype,"handleDisabledChange",1);var ts=b`
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Or=/'/g,Ur=/"/g,zr=/^(?:script|style|textarea|title)$/i,jr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),p=jr(1),zt=jr(2),M=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),Ir=new WeakMap,oe=ne.createTreeWalker(ne,129);function Yr(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Hr!==void 0?Hr.createHTML(t):t}var Wr=(i,t)=>{let e=i.length-1,r=[],s,n=t===2?"<svg>":"",o=Le;for(let a=0;a<e;a++){let l=i[a],u,h,m=-1,y=0;for(;y<l.length&&(o.lastIndex=y,h=o.exec(l),h!==null);)y=o.lastIndex,o===Le?h[1]==="!--"?o=Nr:h[1]!==void 0?o=Dr:h[2]!==void 0?(zr.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=ie):h[3]!==void 0&&(o=ie):o===ie?h[0]===">"?(o=s!=null?s:Le,m=-1):h[1]===void 0?m=-2:(m=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?ie:h[3]==='"'?Ur:Or):o===Ur||o===Or?o=ie:o===Nr||o===Dr?o=Le:(o=ie,s=void 0);let g=o===ie&&i[a+1].startsWith("/>")?" ":"";n+=o===Le?l+Ns:m>=0?(r.push(u),l.slice(0,m)+Xt+l.slice(m)+K+g):l+K+(m===-2?a:g)}return[Yr(i,n+(i[e]||"<?>")+(t===2?"</svg>":"")),r]},Ve=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let n=0,o=0,a=t.length-1,l=this.parts,[u,h]=Wr(t,e);if(this.el=i.createElement(u,r),oe.currentNode=this.el.content,e===2){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(s=oe.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let m of s.getAttributeNames())if(m.endsWith(Xt)){let y=h[o++],g=s.getAttribute(m).split(K),q=/([.?@])?(.*)/.exec(y);l.push({type:1,index:n,name:q[2],strings:g,ctor:q[1]==="."?et:q[1]==="?"?tt:q[1]==="@"?rt:le}),s.removeAttribute(m)}else m.startsWith(K)&&(l.push({type:6,index:n}),s.removeAttribute(m));if(zr.test(s.tagName)){let m=s.textContent.split(K),y=m.length-1;if(y>0){s.textContent=Ze?Ze.emptyScript:"";for(let g=0;g<y;g++)s.append(m[g],Me()),oe.nextNode(),l.push({type:2,index:++n});s.append(m[y],Me())}}}else if(s.nodeType===8)if(s.data===Bt)l.push({type:2,index:n});else{let m=-1;for(;(m=s.data.indexOf(K,m+1))!==-1;)l.push({type:7,index:n}),m+=K.length-1}n++}}static createElement(t,e){let r=ne.createElement("template");return r.innerHTML=t,r}};function ae(i,t,e=i,r){var o,a,l;if(t===M)return t;let s=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl,n=Pe(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),n===void 0?s=void 0:(s=new n(i),s._$AT(i,e,r)),r!==void 0?((l=e._$Co)!=null?l:e._$Co=[])[r]=s:e._$Cl=s),s!==void 0&&(t=ae(i,s._$AS(i,t.values),s,r)),t}var Qe=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var u;let{el:{content:e},parts:r}=this._$AD,s=((u=t==null?void 0:t.creationScope)!=null?u:ne).importNode(e,!0);oe.currentNode=s;let n=oe.nextNode(),o=0,a=0,l=r[0];for(;l!==void 0;){if(o===l.index){let h;l.type===2?h=new ge(n,n.nextSibling,this,t):l.type===1?h=new l.ctor(n,l.name,l.strings,this,t):l.type===6&&(h=new st(n,this,t)),this._$AV.push(h),l=r[++a]}o!==(l==null?void 0:l.index)&&(n=oe.nextNode(),o++)}return oe.currentNode=ne,s}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},ge=class i{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,r,s){var n;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=(n=s==null?void 0:s.isConnected)!=null?n:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ae(this,t,e),Pe(t)?t===E||t==null||t===""?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==M&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Br(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==E&&Pe(this._$AH)?this._$AA.nextSibling.data=t:this.$(ne.createTextNode(t)),this._$AH=t}g(t){var n;let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ve.createElement(Yr(r.h,r.h[0]),this.options)),r);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{let o=new Qe(s,this),a=o.u(this.options);o.p(e),this.$(a),this._$AH=o}}_$AC(t){let e=Ir.get(t.strings);return e===void 0&&Ir.set(t.strings,e=new Ve(t)),e}T(t){Xr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,s=0;for(let n of t)s===e.length?e.push(r=new i(this.k(Me()),this.k(Me()),this,this.options)):r=e[s],r._$AI(n),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,n){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=E}_$AI(t,e=this,r,s){let n=this.strings,o=!1;if(n===void 0)t=ae(this,t,e,0),o=!Pe(t)||t!==this._$AH&&t!==M,o&&(this._$AH=t);else{let a=t,l,u;for(t=n[0],l=0;l<n.length-1;l++)u=ae(this,a[r+l],e,l),u===M&&(u=this._$AH[l]),o||(o=!Pe(u)||u!==this._$AH[l]),u===E?t=E:t!==E&&(t+=(u!=null?u:"")+n[l+1]),this._$AH[l]=u}o&&!s&&this.O(t)}O(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},et=class extends le{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===E?void 0:t}},tt=class extends le{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==E)}},rt=class extends le{constructor(t,e,r,s,n){super(t,e,r,s,n),this.type=5}_$AI(t,e=this){var o;if((t=(o=ae(this,t,e,0))!=null?o:E)===M)return;let r=this._$AH,s=t===E&&r!==E||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==E&&(r===E||s);s&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;typeof this._$AH=="function"?this._$AH.call((r=(e=this.options)==null?void 0:e.host)!=null?r:this.element,t):this._$AH.handleEvent(t)}},st=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){ae(this,t)}},Kr={j:Xt,P:K,A:Bt,C:1,M:Wr,L:Qe,R:Br,V:ae,D:ge,I:le,H:tt,N:rt,U:et,B:st},Ft=be.litHtmlPolyfillSupport,Fr;Ft==null||Ft(Ve,ge),((Fr=be.litHtmlVersions)!=null?Fr:be.litHtmlVersions=[]).push("3.1.0");var Jr=(i,t,e)=>{var n,o;let r=(n=e==null?void 0:e.renderBefore)!=null?n:t,s=r._$litPart$;if(s===void 0){let a=(o=e==null?void 0:e.renderBefore)!=null?o:null;r._$litPart$=s=new ge(t.insertBefore(Me(),a),a,void 0,e!=null?e:{})}return s._$AI(i),s};var f=class extends W{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let t=super.createRenderRoot();return(r=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Jr(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return M}},Gr;f._$litElement$=!0,f.finalized=!0,(Gr=globalThis.litElementHydrateSupport)==null||Gr.call(globalThis,{LitElement:f});var jt=globalThis.litElementPolyfillSupport;jt==null||jt({LitElement:f});var Zr;((Zr=globalThis.litElementVersions)!=null?Zr:globalThis.litElementVersions=[]).push("4.0.2");var _=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Ds={attribute:!0,type:String,converter:Te,reflect:!1,hasChanged:Ge},Os=(i=Ds,t,e)=>{let{kind:r,metadata:s}=e,n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(e.name,i),r==="accessor"){let{name:o}=e;return{set(a){let l=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,l,i)},init(a){return a!==void 0&&this.C(o,void 0,i),a}}}if(r==="setter"){let{name:o}=e;return function(a){let l=this[o];t.call(this,a),this.requestUpdate(o,l,i)}}throw Error("Unsupported decorator location: "+r)};function d(i){return(t,e)=>typeof e=="object"?Os(i,t,e):((r,s,n)=>{let o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?R(x({},r),{wrapped:!0}):r),o?Object.getOwnPropertyDescriptor(s,n):void 0})(i,t,e)}function C(i){return d(R(x({},i),{state:!0,attribute:!1}))}var ee=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function He(i,t){return(e,r,s)=>{let n=o=>{var a,l;return(l=(a=o.renderRoot)==null?void 0:a.querySelector(i))!=null?l:null};if(t){let{get:o,set:a}=typeof r=="object"?e:s!=null?s:(()=>{let l=Symbol();return{get(){return this[l]},set(u){this[l]=u}}})();return ee(e,r,{get(){let l=o.call(this);return l===void 0&&(l=n(this),(l!==null||this.hasUpdated)&&a.call(this,l)),l}})}return ee(e,r,{get(){return n(this)}})}}function Qr(i){return(t,e)=>{let{slot:r,selector:s}=i!=null?i:{},n="slot"+(r?`[name=${r}]`:":not([name])");return ee(t,e,{get(){var l,u;let o=(l=this.renderRoot)==null?void 0:l.querySelector(n),a=(u=o==null?void 0:o.assignedElements(i))!=null?u:[];return s===void 0?a:a.filter(h=>h.matches(s))}})}}function $(i,t){let e=x({waitUntilFirstUpdate:!1},t);return(r,s)=>{let{update:n}=r,o=Array.isArray(i)?i:[i];r.update=function(a){o.forEach(l=>{let u=l;if(a.has(u)){let h=a.get(u),m=this[u];h!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[s](h,m)}}),n.call(this,a)}}}var es=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],I="item";var P=class extends f{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent="false";this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(s=>s.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(s=>s.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:es};this._state="item-created";this._initialContext=R(x({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.state="item-created",this.addEventListener("qti-register-variable",({detail:e})=>{this._context=R(x({},this._context),{variables:[...this._context.variables,e.variable]}),this._initialContext=this._context}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let r=e.detail;this._feedbackElements.push(r),r.checkShowFeedback(r.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:r,countAttempt:s}=e.detail;this.updateResponseVariable(r,"true"),this.processResponse(s)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:s}=e.detail;this.updateOutcomeVariable(r,s)}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}set state(e){this._state=e}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type}))}set variables(e){if(!Array.isArray(e)||e.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=R(x({},this._context),{variables:this._context.variables.map(r=>{let s=e.find(n=>n.identifier===r.identifier);return s?x(x({},r),s):r})}),this._context.variables.forEach(r=>{if(r.type==="response"){let s=this._interactionElements.find(n=>n.responseIdentifier===r.identifier);s&&(s.response=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(s=>s.checkShowFeedback(r.identifier))})}firstUpdated(e){this.state="first-updated",requestAnimationFrame(()=>{this._emit("qti-assessment-item-first-updated",this)})}connectedCallback(){super.connectedCallback(),this.state="item-connected"}set responses(e){if(e)for(let r of e){this.getResponse(r.responseIdentifier)&&this.updateResponseVariable(r.responseIdentifier,r.response);let n=this._interactionElements.find(o=>o.getAttribute("response-identifier")===r.responseIdentifier);n&&(n.response=r.response)}}render(){return p`<slot></slot>`}showCorrectResponse(e){let s=this._context.variables.filter(n=>"correctResponse"in n&&n.correctResponse).map(n=>({responseIdentifier:n.identifier,response:n.correctResponse}));for(let n of s){let o=this._interactionElements.find(a=>a.getAttribute("response-identifier")===n.responseIdentifier);o&&(o.correctResponse=e?n.response:"")}}processResponse(e=!0){var s;let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((s=this._context.variables.find(n=>n.identifier==="numAttempts"))==null?void 0:s.value)+1).toString()),this._emit("qti-response-processed"),!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(r=>r.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:r,response:s}=e.detail;this.updateResponseVariable(r,s)}updateResponseVariable(e,r){this._context=R(x({},this._context),{variables:this._context.variables.map(s=>s.identifier!==e?s:R(x({},s),{value:r}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,r){var n;let s=this.getOutcome(e);if(!s){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=R(x({},this._context),{variables:this._context.variables.map(o=>o.identifier!==e?o:R(x({},o),{value:s.cardinality==="single"?r:[...o.value,r]}))}),this._feedbackElements.forEach(o=>o.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:(n=this._context.variables.find(o=>o.identifier===e))==null?void 0:n.value})}_getCompletionStatus(){return this._interactionElements.every(e=>e.validate())?"completed":this._interactionElements.some(e=>e.validate())?"incomplete":"not_attempted"}_emit(e,r=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:r}))}};c([d({type:String})],P.prototype,"title",2),c([d({type:String})],P.prototype,"identifier",2),c([d({type:String})],P.prototype,"adaptive",2),c([d({type:String})],P.prototype,"timeDependent",2),c([d({type:Boolean})],P.prototype,"disabled",2),c([$("disabled",{waitUntilFirstUpdate:!0})],P.prototype,"_handleDisabledChange",2),c([d({type:Boolean})],P.prototype,"readonly",2),c([$("readonly",{waitUntilFirstUpdate:!0})],P.prototype,"_handleReadonlyChange",2),c([Nt({context:I})],P.prototype,"_context",2),P=c([_("qti-assessment-item")],P);var Us={SPACE:32},T=class extends f{constructor(){super(...arguments);this.tabindex=0;this.disabled=!1;this.readonly=!1;this.checked=!1}handleDisabledChange(e,r){r?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-register-choice",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-loose-choice",{bubbles:!0,cancelable:!1,composed:!0}))}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case Us.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("qti-choice-element-selected",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier,checked:this.checked}})))}validateAllProps(){return!!this.getAttribute("identifier")}render(){return this.validateAllProps()||console.warn(`Invalid props for ${this.outerHTML}`,"missing identifier"),p` <slot></slot> `}};c([d({type:String})],T.prototype,"identifier",2),c([d({type:Number,reflect:!0})],T.prototype,"tabindex",2),c([d({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:e=>e}})],T.prototype,"disabled",2),c([d({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:e=>e}})],T.prototype,"readonly",2),c([d({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>e}})],T.prototype,"checked",2),c([$("disabled",{waitUntilFirstUpdate:!0})],T.prototype,"handleDisabledChange",1);var ts=b`
|
|
4
4
|
:host {
|
|
5
5
|
display: block;
|
|
6
6
|
}
|
|
7
|
-
`;var ve=class extends f{render(){return p`<slot name="qti-rubric-block"></slot><slot></slot>`}};ve.styles=ts,ve=
|
|
7
|
+
`;var ve=class extends f{render(){return p`<slot name="qti-rubric-block"></slot><slot></slot>`}};ve.styles=ts,ve=c([_("qti-item-body")],ve);var it=class extends f{render(){return p`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};it=c([_("qti-prompt")],it);var Yt=class extends f{constructor(){super()}firstUpdated(e){super.firstUpdated(e);let r=this.closest("qti-assessment-item"),s=this.getAttribute("href");if(s!==null){let n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.media="screen",n.href=s,r.appendChild(n),this.styleLink=n}if(this.textContent!==null){let n=document.createElement("style");n.media="screen",n.textContent=this.textContent,r.appendChild(n),this.styleLink=n}}disconnectedCallback(){let e=this.closest("qti-assessment-item");if(this.styleLink&&this.styleLink.parentElement===this)try{e.removeChild(this.styleLink)}catch(r){console.log("could not remove stylesheet")}}};customElements.define("qti-stylesheet",Yt);var ce=class extends f{render(){return p`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(s=>s.innerHTML);return r.length>1||t.cardinality==="multiple"||t.cardinality==="ordered"?r:r[0]}};customElements.define("qti-variabledeclaration",ce);var te=class extends ce{render(){var r,s;let e=(s=(r=this.itemContext)==null?void 0:r.variables.find(n=>n.identifier===this.identifier))==null?void 0:s.value;return p`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let r=new Map;for(let s of e.querySelectorAll("qti-interpolation-table-entry")){!s.getAttribute("source-value")&&s.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let n=parseInt(s.getAttribute("source-value")),o=parseInt(s.getAttribute("target-value"));(isNaN(n)||isNaN(o))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),r.set(n,o)}return r}return null}connectedCallback(){super.connectedCallback();let e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,type:"outcome",value:null,interpolationTable:this.interpolationTable};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};te.styles=[b`
|
|
8
8
|
:host {
|
|
9
9
|
display: none;
|
|
10
10
|
}
|
|
11
|
-
`],
|
|
11
|
+
`],c([d({type:String,attribute:"base-type"})],te.prototype,"baseType",2),c([d({type:String})],te.prototype,"identifier",2),c([d({type:String})],te.prototype,"cardinality",2),c([Y({context:I,subscribe:!0}),C()],te.prototype,"itemContext",2);customElements.define("qti-outcome-declaration",te);var re=class extends ce{render(){var r,s;let e=(s=(r=this.itemContext)==null?void 0:r.variables.find(n=>n.identifier===this.identifier))==null?void 0:s.value;return p`${JSON.stringify(e,null,2)}`}connectedCallback(){super.connectedCallback();let e={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,value:null,type:"response",candidateResponse:null};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get correctResponse(){let e,r=this.querySelector("qti-correct-response");if(r){let s=r.querySelectorAll("qti-value");if(this.cardinality==="single"&&s.length>0)e=s[0].textContent,s[0].remove();else if(this.cardinality!=="single"){e=[];for(let n=0;n<s.length;n++)e.push(s[n].textContent),s[n].remove()}}return e}get mapping(){return this.querySelector("qti-mapping")}};re.styles=[b`
|
|
12
12
|
:host {
|
|
13
13
|
display: none;
|
|
14
14
|
}
|
|
15
|
-
`],
|
|
15
|
+
`],c([d({type:String,attribute:"base-type"})],re.prototype,"baseType",2),c([d({type:String})],re.prototype,"identifier",2),c([d({type:String})],re.prototype,"cardinality",2),c([Y({context:I,subscribe:!0}),C()],re.prototype,"itemContext",2);customElements.define("qti-response-declaration",re);var ot=class extends f{};ot=c([_("qti-companion-materials-info")],ot);var nt=class extends f{render(){return p`<slot></slot>`}};nt=c([_("qti-content-body")],nt);var F=class extends f{handleclassNamesChange(e,r){this.classNames.split(" ").forEach(n=>{switch(n){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return p`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};F.styles=b`
|
|
16
16
|
:host {
|
|
17
17
|
display: block;
|
|
18
18
|
}
|
|
19
|
-
`,
|
|
19
|
+
`,c([d({type:String})],F.prototype,"id",2),c([d({type:String})],F.prototype,"use",2),c([d({type:String})],F.prototype,"view",2),c([d({type:String,attribute:"class"})],F.prototype,"classNames",2),c([$("classNames",{waitUntilFirstUpdate:!0})],F.prototype,"handleclassNamesChange",1),F=c([_("qti-rubric-block")],F);var Is=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Ne=i=>{if(typeof i=="string")return i;let t=Is();return t==="."?i.toLocaleString():i.toString().replace(".","").replace(t,".")};function Wt(i){return i==null}var V=class extends f{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e){let r=this.closest("qti-assessment-item").getOutcome(e);if(this.outcomeIdentifier!==e||!r)return;let s=!1;Array.isArray(r.value)?s=r.value.includes(this.identifier):s=!Wt(this.identifier)&&!Wt(r==null?void 0:r.value)&&this.identifier===r.value||!1,this.showFeedback(s)}showFeedback(e){this.showStatus=e&&this.showHide==="show"||!e&&this.showHide==="hide"?"on":"off"}};c([d({type:String,attribute:"show-hide"})],V.prototype,"showHide",2),c([d({type:String,attribute:"outcome-identifier"})],V.prototype,"outcomeIdentifier",2),c([d({type:String})],V.prototype,"identifier",2),c([d({type:String,attribute:!1})],V.prototype,"showStatus",2);var at=class extends V{render(){return p` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}firstUpdated(t){this.checkShowFeedback(this.outcomeIdentifier)}};at.styles=b`
|
|
20
20
|
:host {
|
|
21
21
|
display: block;
|
|
22
22
|
}
|
|
@@ -40,7 +40,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
40
40
|
.off {
|
|
41
41
|
display: none;
|
|
42
42
|
}
|
|
43
|
-
`;customElements.define("qti-modal-feedback",ct);var X=i=>i!=null?i:E;var w=class extends f{constructor(){super(...arguments);this.responseIdentifier="";this.disabled=!1;this.readonly=!1}set correctResponse(e){console.warn("correctResponse is not implemented")}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,cancelable:!1,composed:!0}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,cancelable:!1,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:e}}))}};
|
|
43
|
+
`;customElements.define("qti-modal-feedback",ct);var X=i=>i!=null?i:E;var w=class extends f{constructor(){super(...arguments);this.responseIdentifier="";this.disabled=!1;this.readonly=!1}set correctResponse(e){console.warn("correctResponse is not implemented")}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,cancelable:!1,composed:!0}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,cancelable:!1,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:e}}))}};c([d({attribute:"response-identifier"})],w.prototype,"responseIdentifier",2),c([d({reflect:!0,type:Boolean})],w.prototype,"disabled",2),c([d({reflect:!0,type:Boolean})],w.prototype,"readonly",2);var{D:Fs}=Kr;var ss=i=>i.strings===void 0,rs=()=>document.createComment(""),ye=(i,t,e)=>{var n;let r=i._$AA.parentNode,s=t===void 0?i._$AB:t._$AA;if(e===void 0){let o=r.insertBefore(rs(),s),a=r.insertBefore(rs(),s);e=new Fs(o,a,i,i.options)}else{let o=e._$AB.nextSibling,a=e._$AM,l=a!==i;if(l){let u;(n=e._$AQ)==null||n.call(e,i),e._$AM=i,e._$AP!==void 0&&(u=i._$AU)!==a._$AU&&e._$AP(u)}if(o!==s||l){let u=e._$AA;for(;u!==o;){let h=u.nextSibling;r.insertBefore(u,s),u=h}}}return e},se=(i,t,e=i)=>(i._$AI(t,e),i),Xs={},is=(i,t=Xs)=>i._$AH=t,os=i=>i._$AH,pt=i=>{var r;(r=i._$AP)==null||r.call(i,!1,!0);let t=i._$AA,e=i._$AB.nextSibling;for(;t!==e;){let s=t.nextSibling;t.remove(),t=s}};var J={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},G=i=>(...t)=>({_$litDirective$:i,values:t}),U=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var De=(i,t)=>{var r;let e=i._$AN;if(e===void 0)return!1;for(let s of e)(r=s._$AO)==null||r.call(s,t,!1),De(s,t);return!0},dt=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while((e==null?void 0:e.size)===0)},ns=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),js(t)}};function Bs(i){this._$AN!==void 0?(dt(this),this._$AM=i,ns(this)):this._$AM=i}function zs(i,t=!1,e=0){let r=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(t)if(Array.isArray(r))for(let n=e;n<r.length;n++)De(r[n],!1),dt(r[n]);else r!=null&&(De(r,!1),dt(r));else De(this,i)}var js=i=>{var t,e;i.type==J.CHILD&&((t=i._$AP)!=null||(i._$AP=zs),(e=i._$AQ)!=null||(i._$AQ=Bs))},ut=class extends U{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),ns(this),this.isConnected=t._$AU}_$AO(t,e=!0){var r,s;t!==this.isConnected&&(this.isConnected=t,t?(r=this.reconnected)==null||r.call(this):(s=this.disconnected)==null||s.call(this)),e&&(De(this,t),dt(this))}setValue(t){if(ss(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ht=()=>new Jt,Jt=class{},Kt=new WeakMap,as=G(class extends ut{render(i){return E}update(i,[t]){var r;let e=t!==this.G;return e&&this.G!==void 0&&this.ot(void 0),(e||this.rt!==this.lt)&&(this.G=t,this.ct=(r=i.options)==null?void 0:r.host,this.ot(this.lt=i.element)),E}ot(i){var t;if(typeof this.G=="function"){let e=(t=this.ct)!=null?t:globalThis,r=Kt.get(e);r===void 0&&(r=new WeakMap,Kt.set(e,r)),r.get(this.G)!==void 0&&this.G.call(this.ct,void 0),r.set(this.G,i),i!==void 0&&this.G.call(this.ct,i)}else this.G.value=i}get rt(){var i,t,e;return typeof this.G=="function"?(t=Kt.get((i=this.ct)!=null?i:globalThis))==null?void 0:t.get(this.G):(e=this.G)==null?void 0:e.value}disconnected(){this.rt===this.lt&&this.ot(void 0)}reconnected(){this.ot(this.lt)}});var B=class extends w{constructor(){super(...arguments);this.textareaRef=ht();this._value=""}handleclassNamesChange(e,r){this.classNames.split(" ").forEach(n=>{if(n.startsWith("qti-height-lines")){let o=n.replace("qti-height-lines-","");this.textareaRef&&(this.textareaRef.value.rows=parseInt(o))}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[b`
|
|
44
44
|
/* PK: display host as block, else design will be collapsed */
|
|
45
45
|
:host {
|
|
46
46
|
display: block;
|
|
@@ -65,7 +65,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
65
65
|
?disabled="${this.disabled}"
|
|
66
66
|
?readonly="${this.readonly}"
|
|
67
67
|
.value=${this._value}
|
|
68
|
-
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};
|
|
68
|
+
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};c([d({type:Number,attribute:"expected-length"})],B.prototype,"expectedLength",2),c([d({type:String,attribute:"pattern-mask"})],B.prototype,"patternMask",2),c([d({type:String,attribute:"placeholder-text"})],B.prototype,"placeholderText",2),c([C()],B.prototype,"_value",2),c([d({type:String,attribute:"class"})],B.prototype,"classNames",2),c([$("classNames",{waitUntilFirstUpdate:!0})],B.prototype,"handleclassNamesChange",1),B=c([_("qti-extended-text-interaction")],B);function ls(i,t){let e,r=x({},t);return(s,n)=>{let{connectedCallback:o,disconnectedCallback:a}=s;s.connectedCallback=function(){var h;o.call(this);let l=m=>{let y=Array.from(this.querySelectorAll(i));for(let g of m){let q=Array.from(g.addedNodes).map(S=>S),A=Array.from(g.addedNodes).map(S=>S);g.type==="childList"&&q.find(S=>y.includes(S))&&this[n](q,A)}};e=new MutationObserver(l),e.observe(this,{childList:!0,subtree:!0});let u=(h=this.querySelectorAll(i))!=null?h:[];this[n](Array.from(u),[])},s.disconnectedCallback=function(){a.call(this),e.disconnect()}}}var H=class extends w{constructor(){super(...arguments);this._value="";this._correctValue="";this._size=5;this.inputRef=ht()}handleclassNamesChange(e,r){r.split(" ").forEach(n=>{if(n.startsWith("qti-input-width")){let o=n.replace("qti-input-width-","");this._size=parseInt(o)}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[b`
|
|
69
69
|
:host {
|
|
70
70
|
display: inline-flex;
|
|
71
71
|
display: flex;
|
|
@@ -94,7 +94,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
94
94
|
?disabled="${this.disabled}"
|
|
95
95
|
?readonly="${this.readonly}"
|
|
96
96
|
/>
|
|
97
|
-
`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};
|
|
97
|
+
`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;this.setEmptyAttribute(r.value),this._value!==r.value&&(this._value=r.value,this.saveResponse(r.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};c([d({type:Number,attribute:"expected-length"})],H.prototype,"expectedLength",2),c([d({type:String,attribute:"pattern-mask"})],H.prototype,"patternMask",2),c([d({type:String,attribute:"placeholder-text"})],H.prototype,"placeholderText",2),c([C()],H.prototype,"_value",2),c([C()],H.prototype,"_correctValue",2),c([C()],H.prototype,"_size",2),c([d({type:String,attribute:"class"})],H.prototype,"classNames",2),c([$("classNames")],H.prototype,"handleclassNamesChange",1),H=c([_("qti-text-entry-interaction")],H);var k=class extends w{constructor(){super();this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(e,r)=>this._choiceElements.forEach(s=>s.disabled=r);this._handleReadonlyChange=(e,r)=>this._choiceElements.forEach(s=>s.readonly=r);this._handleMaxChoicesChange=()=>this._determineInputType();this.addEventListener("qti-register-choice",this._registerChoiceElement),this.addEventListener("qti-loose-choice",this._looseChoiceElement)}validate(){return this._choiceElements.reduce((r,s)=>r+(s.checked?1:0),0)>=this.minChoices}set response(e){let r=Array.isArray(e)?e:[e];this._choiceElements.forEach(s=>{s.checked=!!r.find(n=>n===s.identifier)})}set correctResponse(e){let r=Array.isArray(e)?e:[e];if(e==""){this._choiceElements.forEach(s=>{s.removeAttribute("data-correct-response")});return}this._choiceElements.forEach(s=>{s.setAttribute("data-correct-response",r.find(n=>n===s.identifier)?"true":"false")})}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler),this.removeEventListener("qti-register-choice",this._registerChoiceElement)}_registerChoiceElement(e){e.stopPropagation();let r=e.target;this._choiceElements.push(r),this._setInputType(r)}_looseChoiceElement(e){e.stopPropagation();let r=e.target;this._choiceElements.push(r),this._choiceElements=this._choiceElements.filter(s=>s!==r)}_determineInputType(){this._choiceElements.forEach(e=>{this._setInputType(e)})}_setInputType(e){this.maxChoices===1?e.setAttribute("role","radio"):e.setAttribute("role","checkbox")}_choiceElementSelectedHandler(e){this.maxChoices===1&&this._choiceElements.filter(r=>r.identifier!==e.detail.identifier).forEach(r=>{r.checked=!1}),this._choiceElementSelected()}_choiceElementSelected(){let e=this._choiceElements.filter(s=>s.checked).map(s=>s.identifier);this.maxChoices>1&&(this.maxChoices===e.length?this._choiceElements.forEach(s=>s.disabled=!s.checked):this._choiceElements.forEach(s=>s.disabled=!1));let r;this.maxChoices===1?r=e.length>0?e[0]:void 0:r=e,this.saveResponse(r)}};c([d({type:Number,attribute:"min-choices"})],k.prototype,"minChoices",2),c([d({type:Number,attribute:"max-choices"})],k.prototype,"maxChoices",2),c([$("disabled",{waitUntilFirstUpdate:!0})],k.prototype,"_handleDisabledChange",2),c([$("readonly",{waitUntilFirstUpdate:!0})],k.prototype,"_handleReadonlyChange",2),c([$("maxChoices",{waitUntilFirstUpdate:!0})],k.prototype,"_handleMaxChoicesChange",2);var Gt=class extends k{constructor(){super(...arguments);this.render=()=>p`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};customElements.define("qti-hottext-interaction",Gt);var Oe=class extends U{constructor(t){if(super(t),this.et=E,t.type!==J.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===E||t==null)return this.vt=void 0,this.et=t;if(t===M)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.vt;this.et=t;let e=[t];return e.raw=e,this.vt={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Oe.directiveName="unsafeHTML",Oe.resultType=1;var xe=G(Oe);var pe=class extends w{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[b`
|
|
98
98
|
:host {
|
|
99
99
|
display: inline-block;
|
|
100
100
|
}
|
|
@@ -106,13 +106,13 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
106
106
|
</select>
|
|
107
107
|
|
|
108
108
|
${xe(this.correctOption)}
|
|
109
|
-
`}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected);let e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...e.map(r=>({textContent:r.innerHTML,value:r.getAttribute("identifier"),selected:!1}))]}disconnectedCallback(){this.removeEventListener("on-dropdown-selected",this.choiceSelected)}validate(){let e=this.options.find(r=>r.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,r)=>R(x({},e),{selected:r===0}))}set response(e){this.options=this.options.map(r=>(e===r.value&&(r.selected=!0),r))}set correctResponse(e){if(e===""){this.correctOption="";return}this.correctOption=`<span part="correct-option">${this.options.find(r=>e===r.value).textContent}</span>`}choiceSelected(e){let r=e.target.value;this.options=this.options.map(s=>R(x({},s),{selected:s.value===r})),this.saveResponse(r)}};pe.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"],
|
|
109
|
+
`}connectedCallback(){super.connectedCallback(),this.addEventListener("on-dropdown-selected",this.choiceSelected);let e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:this.dataPrompt,value:"",selected:!1},...e.map(r=>({textContent:r.innerHTML,value:r.getAttribute("identifier"),selected:!1}))]}disconnectedCallback(){this.removeEventListener("on-dropdown-selected",this.choiceSelected)}validate(){let e=this.options.find(r=>r.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,r)=>R(x({},e),{selected:r===0}))}set response(e){this.options=this.options.map(r=>(e===r.value&&(r.selected=!0),r))}set correctResponse(e){if(e===""){this.correctOption="";return}this.correctOption=`<span part="correct-option">${this.options.find(r=>e===r.value).textContent}</span>`}choiceSelected(e){let r=e.target.value;this.options=this.options.map(s=>R(x({},s),{selected:s.value===r})),this.saveResponse(r)}};pe.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([C()],pe.prototype,"options",2),c([C()],pe.prototype,"correctOption",2),c([d({attribute:"data-prompt",type:String})],pe.prototype,"dataPrompt",2);customElements.define("qti-inline-choice-interaction",pe);var cs=b`
|
|
110
110
|
:host {
|
|
111
111
|
display: flex;
|
|
112
112
|
flex-direction: column;
|
|
113
113
|
// align-items: flex-start;
|
|
114
114
|
}
|
|
115
|
-
`;var Ee=class extends k{render(){return p` <slot name="prompt"></slot><slot part="slot"></slot>`}};Ee.styles=cs,
|
|
115
|
+
`;var Ee=class extends k{render(){return p` <slot name="prompt"></slot><slot part="slot"></slot>`}};Ee.styles=cs,c([d({type:String})],Ee.prototype,"orientation",2),Ee=c([_("qti-choice-interaction")],Ee);var ps=`<qti-response-processing>
|
|
116
116
|
<qti-response-condition>
|
|
117
117
|
<qti-response-if>
|
|
118
118
|
<qti-match>
|
|
@@ -165,15 +165,15 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
165
165
|
:host {
|
|
166
166
|
display: none;
|
|
167
167
|
}
|
|
168
|
-
`],de=
|
|
168
|
+
`],de=c([_("qti-response-processing")],de);var z=class extends f{render(){return p`<slot></slot>`}process(){throw new Error("Not implemented")}};z=c([_("qti-rule")],z);var mt=class extends z{get childExpression(){return this.firstElementChild}process(){let e=this.getAttribute("identifier"),r=this.closest("qti-assessment-item").getVariable(e),s;return r.interpolationTable&&(s=r.interpolationTable.get(parseInt(this.childExpression.calculate()))),s==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Ne(s)}})),s)}};c([d({type:String})],mt.prototype,"identifier",2);customElements.define("qti-lookup-outcome-value",mt);var Zt=class extends z{render(){return p`<slot></slot>`}process(){let t=[...this.children];for(let e=0;e<t.length;e++){let r=t[e];if(r.calculate()){r.process();return}}}};customElements.define("qti-response-condition",Zt);var Qt=class extends z{process(){let t=this.getAttribute("identifier"),e=this.firstElementChild,r=e?e.calculate():null;if(r==null){console.warn("setOutcomeValue: value is null or undefined");return}this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:Array.isArray(r)?r.map(s=>Ne(s)):Ne(r)}}))}};customElements.define("qti-set-outcome-value",Qt);var Ue=class extends f{render(){return p`<slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let t=this.getSubRules();for(let e=0;e<t.length;e++)t[e].process()}};customElements.define("qti-response-else",Ue);var Ie=class extends Ue{calculate(){return this.firstElementChild.calculate()}getSubRules(){let t=[];for(let e=1;e<this.children.length;e++)t.push(this.children[e]);return t}};customElements.define("qti-response-if",Ie);var er=class extends Ie{render(){return p`${super.render()}`}};customElements.define("qti-response-else-if",er);var v=class extends f{constructor(){super(...arguments);this.getVariables=()=>Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent,cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return this.assessmentItem.getVariable(r)}case"qti-multiple":{let s=e.getResult();return s.length>0?{identifier:"",baseType:s[0].baseType,value:s.map(n=>n.value),cardinality:"multiple",type:"response"}:null}case"qti-correct":{let r=e.getAttribute("identifier")||"",s=this.assessmentItem.getResponse(r);return{baseType:s.baseType,value:s.correctResponse,cardinality:s.cardinality}}default:{try{return{baseType:"integer",value:e.getResult().toString(),cardinality:"single"}}catch(r){console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}render(){return p`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
169
169
|
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get assessmentItem(){return this.closest("qti-assessment-item")}};v.styles=b`
|
|
170
170
|
slot {
|
|
171
171
|
display: none;
|
|
172
172
|
}
|
|
173
|
-
`,l([C()],v.prototype,"result",2);var N=class extends v{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var ft=class extends Ys(N){calculate(){return this.calculateChildren(Array.from(this.children))}};function Ys(i){return class extends i{calculateChildren(e){return e.map(s=>{let n=s;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=n.calculate();if(typeof o=="string")if(o==="true")o=!0;else if(o==="false")o=!1;else return console.error("unexpected value in qti-and, expected boolean"),null;return o}).every(s=>typeof s=="boolean"&&s)}}}customElements.define("qti-and",ft);var bt=class extends v{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent}};l([d({type:String,attribute:"base-type"})],bt.prototype,"baseType",2);customElements.define("qti-base-value",bt);var tr=class extends N{getResult(){let t=this.getVariables();if(this.children.length===2){let e=t[0],r=t[1];if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="multiple"){let s=e.value,n=r.value;return s.filter(c=>n.includes(c)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let s=e.value;return r.value.includes(s)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",tr);var rr=class extends v{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.closest("qti-assessment-item").getResponse(t);return e.correctResponse,e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",rr);var gt=class extends v{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let r=parseInt(this.getAttribute("figures")||"0");return isNaN(r)?(console.error("figures attribute is not a number"),null):r<0?(console.error("figures attribute is negative"),null):r<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):r}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];if(this.roundingMode===null)return null;if(r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let n=parseFloat(r.value),o=parseFloat(s.value);if(!isNaN(n)&&!isNaN(o))return this.roundingMode==="significantFigures"?n.toPrecision(this.figures)===o.toPrecision(this.figures):Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${n}, ${o}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};l([d({type:String})],gt.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",gt);var D=class{static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let s=parseInt(t,10),n=parseInt(e,10);if(!isNaN(s)&&!isNaN(n))return s===n;console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let s=parseFloat(t),n=parseFloat(e);if(!isNaN(s)&&!isNaN(n))return s===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let s=t.split(" ").sort(),n=e.split(" ").sort();if(s.length===2&&n.length===2)return r==="pair"&&(s.sort(),n.sort()),s.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var vt=class extends v{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value)?(console.error("unexpected cardinality in qti equal"),!1):D.compareSingleValues(r.value,s.value,r.baseType)}return console.error("unexpected number of children in qti-equal"),null}};l([d({type:String})],vt.prototype,"toleranceMode",2);customElements.define("qti-equal",vt);var sr=class extends v{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",sr);var ir=class extends N{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",ir);var or=class extends v{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",or);var nr=class extends v{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",nr);var ar=class extends N{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",ar);var yt=class extends v{getResult(){let e=this.assessmentItem.getResponse(this.identifier);if(!e)return console.warn(`Response ${this.identifier} can not be found`),null;let r=e.mapping,s=Array.isArray(e.value)?e.value:[e.value],n=0;for(let o of s){let a=r.mapEntries.find(c=>D.compareSingleValues(c.mapKey,o,e.baseType));a==null||a.mappedValue==null?n+=r.defaultValue:n+=a.mappedValue}return r.lowerBound!=null&&(n=Math.max(r.lowerBound,n)),r.upperBound!=null&&(n=Math.min(r.upperBound,n)),n}};l([d({type:String})],yt.prototype,"identifier",2);customElements.define("qti-map-response",yt);var _e=class extends f{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};l([d({attribute:"default-value",type:Number})],_e.prototype,"defaultValue",2),l([d({attribute:"lower-bound",type:Number})],_e.prototype,"lowerBound",2),l([d({attribute:"upper-bound",type:Number})],_e.prototype,"upperBound",2);customElements.define("qti-mapping",_e);var lr=class i extends v{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return i.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){var r;if(e.cardinality==="single")return t.value===null?!1:Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):D.compareSingleValues((r=t.value)==null?void 0:r.toString(),e.value.toString(),e.baseType);{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let s=0;for(let n of e.value){if(e.cardinality==="ordered"){let o=t[s];if(!D.compareSingleValues(n,o,e.baseType))return!1}else{let o=null;for(let a of t.value)if(D.compareSingleValues(n,a,e.baseType)){o=a;break}if(o!==null)t.value.splice(t.value.indexOf(o),1);else return!1}s++}return!0}}};customElements.define("qti-match",lr);var cr=class extends v{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType!==r.baseType&&console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let s=e.value;return r.value.includes(s)}};customElements.define("qti-member",cr);var pr=class extends v{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};customElements.define("qti-multiple",pr);var dr=class extends v{render(){return p`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",dr);var ur=class extends N{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=r.calculate();if(typeof s=="string")if(s==="true")s=!0;else if(s==="false")s=!1;else return console.error("unexpected value in qti-or, expected boolean"),null;return s}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",ur);var hr=class extends v{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};customElements.define("qti-ordered",hr);var Fe=class extends f{render(){var r,s;let e=(s=(r=this.itemContext)==null?void 0:r.variables.find(n=>n.identifier===this.identifier))==null?void 0:s.value;return p`${JSON.stringify(e,null,2)}`}calculate(){let e=this.closest("qti-assessment-item"),r=this.identifier;return e.getVariable(r).value}};l([d({type:String})],Fe.prototype,"identifier",2),l([Y({context:I,subscribe:!0}),C()],Fe.prototype,"itemContext",2);customElements.define("qti-printed-variable",Fe);var mr=class extends v{getResult(){return this.getVariables().reduce((r,s)=>{if(s.baseType=="float"||s.baseType=="integer")try{return r*parseInt(s.value.toString())}catch(n){console.warn("can not convert to number")}else console.warn(`has another baseType ${s.baseType}`);return r},1)}};customElements.define("qti-product",mr);var xt=class extends v{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];if(r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value))return console.error("unexpected cardinality in qti string-match"),!1;let n=this.caseSensitive==="true"?r.value:r.value.toLowerCase(),o=this.caseSensitive==="true"?s.value:s.value.toLowerCase();return D.compareSingleValues(n,o,r.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};l([d({type:String,attribute:"case-sensitive"})],xt.prototype,"caseSensitive",2);customElements.define("qti-string-match",xt);var fr=class extends v{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=r.calculate();return Number.isNaN(s)?(console.error("unexpected value in qti-sum, expected number"),null):Number(s)}).reduce((e,r)=>e+r,0)}};customElements.define("qti-sum",fr);var br=class extends v{getResult(){let t=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(t).value}};customElements.define("qti-variable",br);var gr=class extends f{constructor(){super(...arguments);this._errorMessage=null}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},baseUrl:{type:String,attribute:"base-url"},_errorMessage:{type:String,state:!0}}}getTAOConfig(e){let r=e.querySelectorAll("properties"),s={},n=a=>{let c={},u=a.getAttribute("key");if(u){let h=Array.from(a.children),m=h.map(g=>g.getAttribute("key"));m.length>0&&!m.find(g=>!Number.isInteger(+g))?c[u]=h.map(g=>o(g)):c[u]=a.textContent}return c},o=a=>{if(a){let c={};for(let u of a.children)c=x(x({},c),n(u));return c}};for(let a of r)return a.getAttribute("key")||(s=x(x({},s),o(a))),s;console.log("Can not find qti-custom-interaction config")}register(e){let r=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",s=r=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");s.classList.add("qti-customInteraction"),r=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let n=r=="IMS"?{properties:this.dataset}:this.getTAOConfig(this);r=="IMS"?e.getInstance(s,n,void 0):e.initialize(this.customInteractionTypeIdentifier,s.firstElementChild,n),r=="TAO"&&Array.from(this.querySelectorAll("link")).map(a=>a.getAttribute("href")).forEach(a=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=a,s.appendChild(c)})}connectedCallback(){super.connectedCallback();let e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};if(window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim),!globalThis.require){this._errorMessage="requirejs not found, load with cdn: https://cdnjs.com/libraries/require.js";return}requirejs.config(e)(["require"],s=>{!s.defined("qtiCustomInteractionContext")&&define("qtiCustomInteractionContext",()=>({register:o=>{this.register(o)},notifyReady:()=>{}}));let n=s.defined(this.module);s([this.module],o=>{n&&this.register(o)},o=>{this._errorMessage=o})},s=>{this._errorMessage=s})}render(){return p`<slot></slot>${this._errorMessage&&p`<div style="color:red">
|
|
173
|
+
`,c([C()],v.prototype,"result",2);var N=class extends v{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var ft=class extends Ys(N){calculate(){return this.calculateChildren(Array.from(this.children))}};function Ys(i){return class extends i{calculateChildren(e){return e.map(s=>{let n=s;if(!n.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let o=n.calculate();if(typeof o=="string")if(o==="true")o=!0;else if(o==="false")o=!1;else return console.error("unexpected value in qti-and, expected boolean"),null;return o}).every(s=>typeof s=="boolean"&&s)}}}customElements.define("qti-and",ft);var bt=class extends v{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent}};c([d({type:String,attribute:"base-type"})],bt.prototype,"baseType",2);customElements.define("qti-base-value",bt);var tr=class extends N{getResult(){let t=this.getVariables();if(this.children.length===2){let e=t[0],r=t[1];if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="multiple"){let s=e.value,n=r.value;return s.filter(l=>n.includes(l)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let s=e.value;return r.value.includes(s)}else console.error("unsupported baseType or cardinality in qti contains, only baseType: directedPair and cardinality: multiple is supported")}else console.error("unexpected number of children in qti contains");return!1}};customElements.define("qti-contains",tr);var rr=class extends v{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.closest("qti-assessment-item").getResponse(t);return e.correctResponse,e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",rr);var gt=class extends v{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let r=parseInt(this.getAttribute("figures")||"0");return isNaN(r)?(console.error("figures attribute is not a number"),null):r<0?(console.error("figures attribute is negative"),null):r<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):r}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];if(this.roundingMode===null)return null;if(r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let n=parseFloat(r.value),o=parseFloat(s.value);if(!isNaN(n)&&!isNaN(o))return this.roundingMode==="significantFigures"?n.toPrecision(this.figures)===o.toPrecision(this.figures):Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${n}, ${o}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};c([d({type:String})],gt.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",gt);var D=class{static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let s=parseInt(t,10),n=parseInt(e,10);if(!isNaN(s)&&!isNaN(n))return s===n;console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let s=parseFloat(t),n=parseFloat(e);if(!isNaN(s)&&!isNaN(n))return s===n;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let s=t.split(" ").sort(),n=e.split(" ").sort();if(s.length===2&&n.length===2)return r==="pair"&&(s.sort(),n.sort()),s.join(" ")===n.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var vt=class extends v{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value)?(console.error("unexpected cardinality in qti equal"),!1):D.compareSingleValues(r.value,s.value,r.baseType)}return console.error("unexpected number of children in qti-equal"),null}};c([d({type:String})],vt.prototype,"toleranceMode",2);customElements.define("qti-equal",vt);var sr=class extends v{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value>+r.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",sr);var ir=class extends N{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",ir);var or=class extends v{getResult(){if(this.children.length===1){let t=this.getVariables();if(!t)return!0;let e=t[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",or);var nr=class extends v{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];if(e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value<+r.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",nr);var ar=class extends N{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",ar);var yt=class extends v{getResult(){let e=this.assessmentItem.getResponse(this.identifier);if(!e)return console.warn(`Response ${this.identifier} can not be found`),null;let r=e.mapping,s=Array.isArray(e.value)?e.value:[e.value],n=0;for(let o of s){let a=r.mapEntries.find(l=>D.compareSingleValues(l.mapKey,o,e.baseType));a==null||a.mappedValue==null?n+=r.defaultValue:n+=a.mappedValue}return r.lowerBound!=null&&(n=Math.max(r.lowerBound,n)),r.upperBound!=null&&(n=Math.min(r.upperBound,n)),n}};c([d({type:String})],yt.prototype,"identifier",2);customElements.define("qti-map-response",yt);var _e=class extends f{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};c([d({attribute:"default-value",type:Number})],_e.prototype,"defaultValue",2),c([d({attribute:"lower-bound",type:Number})],_e.prototype,"lowerBound",2),c([d({attribute:"upper-bound",type:Number})],_e.prototype,"upperBound",2);customElements.define("qti-mapping",_e);var lr=class i extends v{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return i.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){var r;if(e.cardinality==="single")return t.value===null?!1:Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):D.compareSingleValues((r=t.value)==null?void 0:r.toString(),e.value.toString(),e.baseType);{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let s=0;for(let n of e.value){if(e.cardinality==="ordered"){let o=t[s];if(!D.compareSingleValues(n,o,e.baseType))return!1}else{let o=null;for(let a of t.value)if(D.compareSingleValues(n,a,e.baseType)){o=a;break}if(o!==null)t.value.splice(t.value.indexOf(o),1);else return!1}s++}return!0}}};customElements.define("qti-match",lr);var cr=class extends v{getResult(){let t=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,r]=t;if(e.baseType!==r.baseType&&console.warn("Which must both have the same base-type"),r.cardinality==="multiple"||r.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||r.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||r.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||r.value===null)return null;let s=e.value;return r.value.includes(s)}};customElements.define("qti-member",cr);var pr=class extends v{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return t}};customElements.define("qti-multiple",pr);var dr=class extends v{render(){return p`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",dr);var ur=class extends N{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=r.calculate();if(typeof s=="string")if(s==="true")s=!0;else if(s==="false")s=!1;else return console.error("unexpected value in qti-or, expected boolean"),null;return s}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",ur);var hr=class extends v{getResult(){let t=this.getVariables();if(t.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of t)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return t}};customElements.define("qti-ordered",hr);var Fe=class extends f{render(){var r,s;let e=(s=(r=this.itemContext)==null?void 0:r.variables.find(n=>n.identifier===this.identifier))==null?void 0:s.value;return p`${JSON.stringify(e,null,2)}`}calculate(){let e=this.closest("qti-assessment-item"),r=this.identifier;return e.getVariable(r).value}};c([d({type:String})],Fe.prototype,"identifier",2),c([Y({context:I,subscribe:!0}),C()],Fe.prototype,"itemContext",2);customElements.define("qti-printed-variable",Fe);var mr=class extends v{getResult(){return this.getVariables().reduce((r,s)=>{if(s.baseType=="float"||s.baseType=="integer")try{return r*parseInt(s.value.toString())}catch(n){console.warn("can not convert to number")}else console.warn(`has another baseType ${s.baseType}`);return r},1)}};customElements.define("qti-product",mr);var xt=class extends v{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],s=e[1];if(r.cardinality!=="single"||s.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(s.value))return console.error("unexpected cardinality in qti string-match"),!1;let n=this.caseSensitive==="true"?r.value:r.value.toLowerCase(),o=this.caseSensitive==="true"?s.value:s.value.toLowerCase();return D.compareSingleValues(n,o,r.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};c([d({type:String,attribute:"case-sensitive"})],xt.prototype,"caseSensitive",2);customElements.define("qti-string-match",xt);var fr=class extends v{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let s=r.calculate();return Number.isNaN(s)?(console.error("unexpected value in qti-sum, expected number"),null):Number(s)}).reduce((e,r)=>e+r,0)}};customElements.define("qti-sum",fr);var br=class extends v{getResult(){let t=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(t).value}};customElements.define("qti-variable",br);var gr=class extends f{constructor(){super(...arguments);this._errorMessage=null}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},baseUrl:{type:String,attribute:"base-url"},_errorMessage:{type:String,state:!0}}}getTAOConfig(e){let r=e.querySelectorAll("properties"),s={},n=a=>{let l={},u=a.getAttribute("key");if(u){let h=Array.from(a.children),m=h.map(g=>g.getAttribute("key"));m.length>0&&!m.find(g=>!Number.isInteger(+g))?l[u]=h.map(g=>o(g)):l[u]=a.textContent}return l},o=a=>{if(a){let l={};for(let u of a.children)l=x(x({},l),n(u));return l}};for(let a of r)return a.getAttribute("key")||(s=x(x({},s),o(a))),s;console.log("Can not find qti-custom-interaction config")}register(e){let r=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",s=r=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");s.classList.add("qti-customInteraction"),r=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let n=r=="IMS"?{properties:this.dataset}:this.getTAOConfig(this);r=="IMS"?e.getInstance(s,n,void 0):e.initialize(this.customInteractionTypeIdentifier,s.firstElementChild,n),r=="TAO"&&Array.from(this.querySelectorAll("link")).map(a=>a.getAttribute("href")).forEach(a=>{let l=document.createElement("link");l.rel="stylesheet",l.type="text/css",l.media="screen",l.href=a,s.appendChild(l)})}connectedCallback(){super.connectedCallback();let e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};if(window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim),!globalThis.require){this._errorMessage="requirejs not found, load with cdn: https://cdnjs.com/libraries/require.js";return}requirejs.config(e)(["require"],s=>{!s.defined("qtiCustomInteractionContext")&&define("qtiCustomInteractionContext",()=>({register:o=>{this.register(o)},notifyReady:()=>{}}));let n=s.defined(this.module);s([this.module],o=>{n&&this.register(o)},o=>{this._errorMessage=o})},s=>{this._errorMessage=s})}render(){return p`<slot></slot>${this._errorMessage&&p`<div style="color:red">
|
|
174
174
|
<h1>Error</h1>
|
|
175
175
|
${this._errorMessage}
|
|
176
|
-
</div>`}`}};customElements.define("qti-portable-custom-interaction",gr);var Et=class i{constructor(){this._touchBegin=0;this._touchDown=null;this._lastClick=0;this._canDrag=!1;this._dragSrc=null;this._dragCopy=null;this._touchEndCalled=!1;this._dragRunning=!1;this._dataTransfer={data:{},setData:function(t,e){this.data[t]=e},getData:function(t){return this.data[t]},effectAllowed:"move"};this._copyOffset={x:0,y:0};this._lastTarget=null;this._currentDropContainer=null;this._handleClick=!0;this._DBLCLICKDELAY=500;this._CONTEXTMENUDELAY=1e3;this._DRAGDELTA=5;this._COPYOPACITY=.7;this.copyStylesDragClone=!0;this.dragOnClick=!1;this._createDragCopy=(t,e)=>{if(this._dragCopy===null&&this._dragRunning){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);let r=window.getComputedStyle(this._dragSrc);if(this._dragCopy.style="",this._dragCopy.setAttribute("dragclone",""),this.copyStylesDragClone)for(let s of r)this._dragCopy.style[s]=r.getPropertyValue(s);this._calculateDragCopyPosition(e),this._dragCopy.style.top=e.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=e.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="fixed",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._dragRunning){let r=this;requestAnimationFrame(function(){r._touchEndCalled||r._dragCopy===null||(r._dragCopy.style.top=e.clientY-r._copyOffset.y+"px",r._dragCopy.style.left=e.clientX-r._copyOffset.x+"px")});let s=this._findDroppable(t);s!=this._lastTarget&&(this._dispatchEvent(s,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=s),this._currentDropContainer=s,this._currentDropContainer&&this._dispatchEvent(s,"dragover")}};return i._instance?i._instance:(i._instance=this,document.addEventListener("touchmove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("mousemove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchend",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("mouseup",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchcancel",this._touchCancel.bind(this),{passive:!1,capture:!1}),this)}addDraggables(t){t.forEach(e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})}_touchStart(t){this._touchBegin=Date.now();let{x:e,y:r}=this._getPoint(t);if(this._touchDown={x:e,y:r},this._dragSrc=t.currentTarget,this._canDrag=!0,this.dragOnClick){let s={clientX:e,clientY:r};this._dragRunning=!0,this._createDragCopy(t,s)}t.preventDefault()}_touchMove(t){if(this._canDrag&&this._dragSrc){let{x:e,y:r}=this._getPoint(t),s={clientX:e,clientY:r};this._getDelta(s)>=this._DRAGDELTA&&(this._dragRunning=!0),this._createDragCopy(t,s),t.preventDefault()}}_touchEnd(t){var e;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else if(this._dragRunning){let r=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});r.dataTransfer={dropEffect:"none"},(e=this._dragSrc)==null||e.dispatchEvent(r)}this._reset()}_touchCancel(t){this._reset()}_findDroppable(t){let e=this._getPoint(t);return this.elementFromPoint(e.x,e.y)}elementFromPoint(t,e){let r=document.elementFromPoint(t,e);if(r){for(;r.shadowRoot;){let s=r.shadowRoot.elementFromPoint(t,e);if(s===null||s===r)break;r=s}return r}return null}_getPoint(t,e){return t&&t.touches&&(t=t.touches[0]),{x:e?t.pageX:t.clientX,y:e?t.pageY:t.clientY}}_calculateDragCopyPosition(t){let e=this._dragSrc.getBoundingClientRect();this._copyOffset.x=t.clientX-e.left,this._copyOffset.y=t.clientY-e.top}_getDelta(t){let e=Math.abs(t.clientX-this._touchDown.x),r=Math.abs(t.clientY-this._touchDown.y);return e+r}_dispatchEvent(t,e,r=!0){if(!t)return!1;let s=new CustomEvent(e,{bubbles:r,cancelable:!0});return s.dataTransfer=this._dataTransfer,t.dispatchEvent(s),s.defaultPrevented}_reset(){this._dragRunning&&(this._dragSrc.style.opacity="1.0",this._dragCopy.parentElement.removeChild(this._dragCopy)),this._dragRunning=!1,this._dragSrc=null,this._dragCopy=null,this._canDrag=!1,this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._touchEndCalled=!1,this._dataTransfer={data:{},setData:function(t,e){this.data[t]=e},getData:function(t){return this.data[t]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}};var hs=(i,t,e)=>{class r extends i{constructor(){super(...arguments);this.disabled=!1}firstUpdated(o){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(o);let a=Array.from(t?this.shadowRoot.querySelectorAll(e):this.querySelectorAll(e));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),a.forEach(c=>{c.setAttribute("dropzone","move"),c.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(c)});for(let c of a)this.observer=new MutationObserver(u=>{u.forEach(h=>{if(h.type==="attributes")switch(h.attributeName){case"disabled":{c.hasAttribute("disabled")?this.removeHandler(c):this.attachHandler(c);break}}})}),this.observer.observe(c,{attributes:!0})}attachHandler(o){o.addEventListener("dragover",this.dragoverHandler),o.addEventListener("dragenter",this.dragenterHandler),o.addEventListener("drop",this.dropHandler)}removeHandler(o){o.removeEventListener("dragover",this.dragoverHandler),o.removeEventListener("dragenter",this.dragenterHandler),o.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var o;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),(o=this.observer)==null||o.disconnect())}dragenterHandler(o){o.preventDefault()}dragoverHandler(o){return o.preventDefault(),o.currentTarget.setAttribute("active",""),o.dataTransfer.dropEffect="move",!1}dropHandler(o){o.preventDefault();let a=o.currentTarget,c=this.querySelector(`[identifier=${o.dataTransfer.getData("text")}`),u=c||this.shadowRoot.querySelector(`[identifier=${o.dataTransfer.getData("text")}`);return a?u.parentElement.getAttribute("identifier")!==a.getAttribute("identifier")&&a.appendChild(u):console.error(`cannot find droppable, target: ${o.target?JSON.stringify(o.target):"null"}`),a.removeAttribute("active"),!1}dragleaveHandler(o){return o.preventDefault(),o.currentTarget.removeAttribute("active"),o.dataTransfer.dropEffect="none",!1}}return l([d({type:Boolean,reflect:!0})],r.prototype,"disabled",2),r};var ms=(i,t,e)=>{class r extends i{}return r};var j=(i,t,e,r)=>{class s extends ms(hs(i,e,r),r,t){constructor(){super(...arguments);this.draggables=new Map;this.responseIdentifier="";this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.disabled=!1;this.readonly=!1;this.minAssociations=1;this.maxAssociations=1}reInitDragAndDrop(a,c){if(this.classList.contains("qti-match-tabular"))return;a.filter(h=>!this.draggables||!this.draggables.get(h)).length>0&&(this.dragDropApi.addDraggables(a),a.forEach(h=>{this.draggables.set(h,{parent:h.parentElement,index:Array.from(h.parentNode.children).indexOf(h)}),h.setAttribute("qti-draggable","true"),h.addEventListener("dragstart",m=>{m.dataTransfer.setData("text",m.currentTarget.getAttribute("identifier")),h.setAttribute("dragging","")}),h.addEventListener("dragend",m=>{if(m.preventDefault(),h.removeAttribute("over"),h.removeAttribute("dragging"),(m.dataTransfer.dropEffect==="none"||m.dataTransfer.dropEffect===void 0)&&this.configuration.dragCanBePlacedBack){let y=m.currentTarget,g=this.draggables.get(y),q=g.index<g.parent.children.length?g.index:g.parent.children.length-1,A=g.parent,S=g.parent.children[q];A.insertBefore(y,S),this.saveResponse(),this.checkMaxMatchAssociations()}m.dataTransfer.dropEffect==="move"&&(this.saveResponse(),this.checkMaxMatchAssociations())})}))}handleDragOptionsChanged(a,c){this.dragDropApi.copyStylesDragClone=c.copyStylesDragClone,this.dragDropApi.dragOnClick=c.dragOnClick}handleDisabledChange(a,c){this.draggables.forEach((u,h)=>{c?h.setAttribute("disabled",""):h.removeAttribute("disabled"),c?h.removeAttribute("qti-draggable"):h.setAttribute("qti-draggable","true")})}handleReadonlyChange(a,c){this.draggables.forEach((u,h)=>{c?h.setAttribute("readonly",""):h.removeAttribute("readonly"),c?h.removeAttribute("qti-draggable"):h.setAttribute("qti-draggable","true")})}firstUpdated(a){super.firstUpdated(a),this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(r):this.querySelectorAll(r))}connectedCallback(){super.connectedCallback(),this.dragDropApi=new Et,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}reset(a=!0){this.draggables.forEach((c,u)=>{let h=c.parent.children,m=c.index<h.length?c.index:h.length;c.parent.insertBefore(u,h[m])}),a&&this.saveResponse()}checkMaxMatchAssociations(){this.droppables.forEach(a=>{let u=+(a.getAttribute("match-max")||1)<=(a.children.length||0);u?a.setAttribute("disabled",""):a.removeAttribute("disabled"),u?a.removeAttribute("dropzone"):a.setAttribute("dropzone","move")})}set response(a){this.classList.contains("qti-match-tabular")||(this.reset(!1),a!==null&&Array.isArray(a)&&a.forEach(c=>{let[u,...h]=c.split(" ").reverse();if(u){let m=this.droppables.find(y=>y.getAttribute("identifier")===u);h.forEach(y=>{let g=this.querySelector(`[identifier=${y}]`);m?g?(m.appendChild(g),this.checkMaxMatchAssociations()):console.error(`cannot find draggable with identifier: ${y}`):console.error(`cannot find droppable with identifier: ${u}`)})}}))}validate(){let c=(e?Array.from(this.shadowRoot.querySelectorAll(r)):Array.from(this.querySelectorAll(r))).filter(u=>u.childElementCount>0).length;return this.minAssociations<=0||this.minAssociations<=c}saveResponse(){let a=this.droppables.map(c=>{var h;let u="";return((h=c.children)==null?void 0:h.length)>0&&(u+=Array.from(c.children).map(m=>m.getAttribute("identifier")).join(" ")+" "),u+=c.getAttribute("identifier"),u});this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:a}}))}}return l([ls(t)],s.prototype,"reInitDragAndDrop",1),l([d({type:String,attribute:"response-identifier"})],s.prototype,"responseIdentifier",2),l([d({attribute:!1,type:Object})],s.prototype,"configuration",2),l([$("configuration")],s.prototype,"handleDragOptionsChanged",1),l([d({type:Boolean,reflect:!0})],s.prototype,"disabled",2),l([$("disabled",{waitUntilFirstUpdate:!0})],s.prototype,"handleDisabledChange",1),l([d({type:Boolean,reflect:!0})],s.prototype,"readonly",2),l([$("readonly",{waitUntilFirstUpdate:!0})],s.prototype,"handleReadonlyChange",1),l([d({type:Number,reflect:!0,attribute:"min-associations"})],s.prototype,"minAssociations",2),l([d({type:Number,reflect:!0,attribute:"max-associations"})],s.prototype,"maxAssociations",2),s};var Xe=class extends j(f,"qti-simple-associable-choice",!0,".dl"){render(){return p` <slot name="prompt"></slot>
|
|
176
|
+
</div>`}`}};customElements.define("qti-portable-custom-interaction",gr);var Et=class i{constructor(){this._touchBegin=0;this._touchDown=null;this._lastClick=0;this._canDrag=!1;this._dragSrc=null;this._dragCopy=null;this._touchEndCalled=!1;this._dragRunning=!1;this._dataTransfer={data:{},setData:function(t,e){this.data[t]=e},getData:function(t){return this.data[t]},effectAllowed:"move"};this._copyOffset={x:0,y:0};this._lastTarget=null;this._currentDropContainer=null;this._handleClick=!0;this._DBLCLICKDELAY=500;this._CONTEXTMENUDELAY=1e3;this._DRAGDELTA=5;this._COPYOPACITY=.7;this.copyStylesDragClone=!0;this.dragOnClick=!1;this._createDragCopy=(t,e)=>{if(this._dragCopy===null&&this._dragRunning){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);let r=window.getComputedStyle(this._dragSrc);if(this._dragCopy.style="",this._dragCopy.setAttribute("dragclone",""),this.copyStylesDragClone)for(let s of r)this._dragCopy.style[s]=r.getPropertyValue(s);this._calculateDragCopyPosition(e),this._dragCopy.style.top=e.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=e.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="fixed",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._dragRunning){let r=this;requestAnimationFrame(function(){r._touchEndCalled||r._dragCopy===null||(r._dragCopy.style.top=e.clientY-r._copyOffset.y+"px",r._dragCopy.style.left=e.clientX-r._copyOffset.x+"px")});let s=this._findDroppable(t);s!=this._lastTarget&&(this._dispatchEvent(s,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=s),this._currentDropContainer=s,this._currentDropContainer&&this._dispatchEvent(s,"dragover")}};return i._instance?i._instance:(i._instance=this,document.addEventListener("touchmove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("mousemove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchend",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("mouseup",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchcancel",this._touchCancel.bind(this),{passive:!1,capture:!1}),this)}addDraggables(t){t.forEach(e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})}_touchStart(t){this._touchBegin=Date.now();let{x:e,y:r}=this._getPoint(t);if(this._touchDown={x:e,y:r},this._dragSrc=t.currentTarget,this._canDrag=!0,this.dragOnClick){let s={clientX:e,clientY:r};this._dragRunning=!0,this._createDragCopy(t,s)}t.preventDefault()}_touchMove(t){if(this._canDrag&&this._dragSrc){let{x:e,y:r}=this._getPoint(t),s={clientX:e,clientY:r};this._getDelta(s)>=this._DRAGDELTA&&(this._dragRunning=!0),this._createDragCopy(t,s),t.preventDefault()}}_touchEnd(t){var e;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else if(this._dragRunning){let r=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});r.dataTransfer={dropEffect:"none"},(e=this._dragSrc)==null||e.dispatchEvent(r)}this._reset()}_touchCancel(t){this._reset()}_findDroppable(t){let e=this._getPoint(t);return this.elementFromPoint(e.x,e.y)}elementFromPoint(t,e){let r=document.elementFromPoint(t,e);if(r){for(;r.shadowRoot;){let s=r.shadowRoot.elementFromPoint(t,e);if(s===null||s===r)break;r=s}return r}return null}_getPoint(t,e){return t&&t.touches&&(t=t.touches[0]),{x:e?t.pageX:t.clientX,y:e?t.pageY:t.clientY}}_calculateDragCopyPosition(t){let e=this._dragSrc.getBoundingClientRect();this._copyOffset.x=t.clientX-e.left,this._copyOffset.y=t.clientY-e.top}_getDelta(t){let e=Math.abs(t.clientX-this._touchDown.x),r=Math.abs(t.clientY-this._touchDown.y);return e+r}_dispatchEvent(t,e,r=!0){if(!t)return!1;let s=new CustomEvent(e,{bubbles:r,cancelable:!0});return s.dataTransfer=this._dataTransfer,t.dispatchEvent(s),s.defaultPrevented}_reset(){this._dragRunning&&(this._dragSrc.style.opacity="1.0",this._dragCopy.parentElement.removeChild(this._dragCopy)),this._dragRunning=!1,this._dragSrc=null,this._dragCopy=null,this._canDrag=!1,this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._touchEndCalled=!1,this._dataTransfer={data:{},setData:function(t,e){this.data[t]=e},getData:function(t){return this.data[t]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}};var hs=(i,t,e)=>{class r extends i{constructor(){super(...arguments);this.disabled=!1}firstUpdated(o){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(o);let a=Array.from(t?this.shadowRoot.querySelectorAll(e):this.querySelectorAll(e));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),a.forEach(l=>{l.setAttribute("dropzone","move"),l.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(l)});for(let l of a)this.observer=new MutationObserver(u=>{u.forEach(h=>{if(h.type==="attributes")switch(h.attributeName){case"disabled":{l.hasAttribute("disabled")?this.removeHandler(l):this.attachHandler(l);break}}})}),this.observer.observe(l,{attributes:!0})}attachHandler(o){o.addEventListener("dragover",this.dragoverHandler),o.addEventListener("dragenter",this.dragenterHandler),o.addEventListener("drop",this.dropHandler)}removeHandler(o){o.removeEventListener("dragover",this.dragoverHandler),o.removeEventListener("dragenter",this.dragenterHandler),o.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var o;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),(o=this.observer)==null||o.disconnect())}dragenterHandler(o){o.preventDefault()}dragoverHandler(o){return o.preventDefault(),o.currentTarget.setAttribute("active",""),o.dataTransfer.dropEffect="move",!1}dropHandler(o){o.preventDefault();let a=o.currentTarget,l=this.querySelector(`[identifier=${o.dataTransfer.getData("text")}`),u=l||this.shadowRoot.querySelector(`[identifier=${o.dataTransfer.getData("text")}`);return a?u.parentElement.getAttribute("identifier")!==a.getAttribute("identifier")&&a.appendChild(u):console.error(`cannot find droppable, target: ${o.target?JSON.stringify(o.target):"null"}`),a.removeAttribute("active"),!1}dragleaveHandler(o){return o.preventDefault(),o.currentTarget.removeAttribute("active"),o.dataTransfer.dropEffect="none",!1}}return c([d({type:Boolean,reflect:!0})],r.prototype,"disabled",2),r};var ms=(i,t,e)=>{class r extends i{}return r};var j=(i,t,e,r)=>{class s extends ms(hs(i,e,r),r,t){constructor(){super(...arguments);this.draggables=new Map;this.responseIdentifier="";this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.disabled=!1;this.readonly=!1;this.minAssociations=1;this.maxAssociations=1}reInitDragAndDrop(a,l){if(this.classList.contains("qti-match-tabular"))return;a.filter(h=>!this.draggables||!this.draggables.get(h)).length>0&&(this.dragDropApi.addDraggables(a),a.forEach(h=>{this.draggables.set(h,{parent:h.parentElement,index:Array.from(h.parentNode.children).indexOf(h)}),h.setAttribute("qti-draggable","true"),h.addEventListener("dragstart",m=>{m.dataTransfer.setData("text",m.currentTarget.getAttribute("identifier")),h.setAttribute("dragging","")}),h.addEventListener("dragend",m=>{if(m.preventDefault(),h.removeAttribute("over"),h.removeAttribute("dragging"),(m.dataTransfer.dropEffect==="none"||m.dataTransfer.dropEffect===void 0)&&this.configuration.dragCanBePlacedBack){let y=m.currentTarget,g=this.draggables.get(y),q=g.index<g.parent.children.length?g.index:g.parent.children.length-1,A=g.parent,S=g.parent.children[q];A.insertBefore(y,S),this.saveResponse(),this.checkMaxMatchAssociations()}m.dataTransfer.dropEffect==="move"&&(this.saveResponse(),this.checkMaxMatchAssociations())})}))}handleDragOptionsChanged(a,l){this.dragDropApi.copyStylesDragClone=l.copyStylesDragClone,this.dragDropApi.dragOnClick=l.dragOnClick}handleDisabledChange(a,l){this.draggables.forEach((u,h)=>{l?h.setAttribute("disabled",""):h.removeAttribute("disabled"),l?h.removeAttribute("qti-draggable"):h.setAttribute("qti-draggable","true")})}handleReadonlyChange(a,l){this.draggables.forEach((u,h)=>{l?h.setAttribute("readonly",""):h.removeAttribute("readonly"),l?h.removeAttribute("qti-draggable"):h.setAttribute("qti-draggable","true")})}firstUpdated(a){super.firstUpdated(a),this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(r):this.querySelectorAll(r))}connectedCallback(){super.connectedCallback(),this.dragDropApi=new Et,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}reset(a=!0){this.draggables.forEach((l,u)=>{let h=l.parent.children,m=l.index<h.length?l.index:h.length;l.parent.insertBefore(u,h[m])}),a&&this.saveResponse()}checkMaxMatchAssociations(){this.droppables.forEach(a=>{let u=+(a.getAttribute("match-max")||1)<=(a.children.length||0);u?a.setAttribute("disabled",""):a.removeAttribute("disabled"),u?a.removeAttribute("dropzone"):a.setAttribute("dropzone","move")})}set response(a){this.classList.contains("qti-match-tabular")||(this.reset(!1),a!==null&&Array.isArray(a)&&a.forEach(l=>{let[u,...h]=l.split(" ").reverse();if(u){let m=this.droppables.find(y=>y.getAttribute("identifier")===u);h.forEach(y=>{let g=this.querySelector(`[identifier=${y}]`);m?g?(m.appendChild(g),this.checkMaxMatchAssociations()):console.error(`cannot find draggable with identifier: ${y}`):console.error(`cannot find droppable with identifier: ${u}`)})}}))}validate(){let l=(e?Array.from(this.shadowRoot.querySelectorAll(r)):Array.from(this.querySelectorAll(r))).filter(u=>u.childElementCount>0).length;return this.minAssociations<=0||this.minAssociations<=l}saveResponse(){let a=this.droppables.map(l=>{var h;let u="";return((h=l.children)==null?void 0:h.length)>0&&(u+=Array.from(l.children).map(m=>m.getAttribute("identifier")).join(" ")+" "),u+=l.getAttribute("identifier"),u});this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:a}}))}}return c([ls(t)],s.prototype,"reInitDragAndDrop",1),c([d({type:String,attribute:"response-identifier"})],s.prototype,"responseIdentifier",2),c([d({attribute:!1,type:Object})],s.prototype,"configuration",2),c([$("configuration")],s.prototype,"handleDragOptionsChanged",1),c([d({type:Boolean,reflect:!0})],s.prototype,"disabled",2),c([$("disabled",{waitUntilFirstUpdate:!0})],s.prototype,"handleDisabledChange",1),c([d({type:Boolean,reflect:!0})],s.prototype,"readonly",2),c([$("readonly",{waitUntilFirstUpdate:!0})],s.prototype,"handleReadonlyChange",1),c([d({type:Number,reflect:!0,attribute:"min-associations"})],s.prototype,"minAssociations",2),c([d({type:Number,reflect:!0,attribute:"max-associations"})],s.prototype,"maxAssociations",2),s};var Xe=class extends j(f,"qti-simple-associable-choice",!0,".dl"){render(){return p` <slot name="prompt"></slot>
|
|
177
177
|
<slot name="qti-simple-associable-choice"></slot>
|
|
178
178
|
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,r)=>p`<div part="associables-container">
|
|
179
179
|
<div name="left${r}" part="drop-list" class="dl" identifier="droplist${r}_left"></div>
|
|
@@ -187,7 +187,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
187
187
|
flex-wrap: wrap;
|
|
188
188
|
gap: 0.5rem;
|
|
189
189
|
}
|
|
190
|
-
`,
|
|
190
|
+
`,c([C()],Xe.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",Xe);var Ce=class extends w{constructor(){super(...arguments);this.countAttempt="true"}validate(){return!0}set response(e){}render(){return p`<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([d({type:String,attribute:"count-attempt"})],Ce.prototype,"countAttempt",2),c([d({type:String})],Ce.prototype,"title",2),Ce=c([_("qti-end-attempt-interaction")],Ce);var _t=class extends j(f,"qti-gap-text",!1,"qti-gap"){render(){return p` <slot part="drags" name="qti-gap-text"></slot>
|
|
191
191
|
<slot part="drops"></slot>`}};_t.styles=[b`
|
|
192
192
|
:host {
|
|
193
193
|
display: flex;
|
|
@@ -211,7 +211,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
211
211
|
align-items: flex-start;
|
|
212
212
|
flex: 1;
|
|
213
213
|
}
|
|
214
|
-
`];customElements.define("qti-gap-match-interaction",_t);function Ae(i,t,e,r){switch(i){case"circle":{let[s,n,o]=t,a=s/e.width*100,
|
|
214
|
+
`];customElements.define("qti-gap-match-interaction",_t);function Ae(i,t,e,r){switch(i){case"circle":{let[s,n,o]=t,a=s/e.width*100,l=n/e.height*100,u=o/e.width*100;r.style.left=a-u+"%",r.style.top=l-u+"%",r.style.width=r.style.height=4*u+"px",r.style.borderRadius="9999px"}break;case"rect":{let[s,n,o,a]=t,l=s/e.width*100,u=n/e.height*100,h=o/e.width*100,m=a/e.height*100;r.style.left=l+"%",r.style.top=u+"%",r.style.width=h-l+"%",r.style.height=m-u+"%"}break;case"poly":{let s=t.reduce((A,S,he,Ye)=>{if(he%2===1){let ys=A.pop();A[A.length]={x:ys,y:Ye[he]}}else A.push(S);return A},[]),n=Math.min(...s.map(A=>A.x)),o=Math.max(...s.map(A=>A.x)),a=Math.min(...s.map(A=>A.y)),l=Math.max(...s.map(A=>A.y)),u=n/e.width*100,h=a/e.height*100,m=o/e.width*100,y=l/e.height*100;r.style.left=n/e.width*100+"%",r.style.top=a/e.height*100+"%",r.style.width=m-u+"%",r.style.height=y-h+"%";let q=s.map(A=>({x:(A.x-n)/(o-n)*100,y:(A.y-a)/(l-a)*100})).map(A=>Math.round(A.x)+"% "+Math.round(A.y)+"%").join(",");r.style.clipPath=`polygon(${q})`}break;default:break}}var fs=(i,t,e)=>{let r=new Map;for(let s=t;s<=e;s++)r.set(i[s],s);return r},Ct=G(class extends U{constructor(i){if(super(i),i.type!==J.CHILD)throw Error("repeat() can only be used in text expressions")}ht(i,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let s=[],n=[],o=0;for(let a of i)s[o]=r?r(a,o):o,n[o]=e(a,o),o++;return{values:n,keys:s}}render(i,t,e){return this.ht(i,t,e).values}update(i,[t,e,r]){var A;let s=os(i),{values:n,keys:o}=this.ht(t,e,r);if(!Array.isArray(s))return this.dt=o,n;let a=(A=this.dt)!=null?A:this.dt=[],l=[],u,h,m=0,y=s.length-1,g=0,q=n.length-1;for(;m<=y&&g<=q;)if(s[m]===null)m++;else if(s[y]===null)y--;else if(a[m]===o[g])l[g]=se(s[m],n[g]),m++,g++;else if(a[y]===o[q])l[q]=se(s[y],n[q]),y--,q--;else if(a[m]===o[q])l[q]=se(s[m],n[q]),ye(i,l[q+1],s[m]),m++,q--;else if(a[y]===o[g])l[g]=se(s[y],n[g]),ye(i,s[m],s[y]),y--,g++;else if(u===void 0&&(u=fs(o,g,q),h=fs(a,m,y)),u.has(a[m]))if(u.has(a[y])){let S=h.get(o[g]),he=S!==void 0?s[S]:null;if(he===null){let Ye=ye(i,s[m]);se(Ye,n[g]),l[g]=Ye}else l[g]=se(he,n[g]),ye(i,s[m],he),s[S]=null;g++}else pt(s[y]),y--;else pt(s[m]),m++;for(;g<=q;){let S=ye(i,l[q+1]);se(S,n[g]),l[g++]=S}for(;m<=y;){let S=s[m++];S!==null&&pt(S)}return this.dt=o,is(i,l),M}});var Z=class extends w{constructor(){super();this.startPoint=null;this.endPoint=null;this._lines=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._lines=[]}validate(){return this._lines.length>0}set response(e){Array.isArray(e)&&(this._lines=e)}render(){var e,r,s,n;return p`<slot name="prompt"></slot>
|
|
215
215
|
<line-container>
|
|
216
216
|
<svg
|
|
217
217
|
width=${X((e=this.grImage[0])==null?void 0:e.width)}
|
|
@@ -227,7 +227,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
227
227
|
y2=${parseInt(this.querySelector("[identifier="+o.split(" ")[1]+"]").style.top)}
|
|
228
228
|
stroke="red"
|
|
229
229
|
stroke-width="3"
|
|
230
|
-
@click=${
|
|
230
|
+
@click=${l=>{l.stopPropagation(),this._lines=this._lines.filter((u,h)=>h!==a),this.saveResponse(this._lines)}}
|
|
231
231
|
/>
|
|
232
232
|
`)}
|
|
233
233
|
${this.startPoint&&zt`<line
|
|
@@ -241,7 +241,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
241
241
|
/>`}
|
|
242
242
|
</svg>
|
|
243
243
|
<slot></slot>
|
|
244
|
-
</line-container>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),a=n.split(",").map(
|
|
244
|
+
</line-container>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),a=n.split(",").map(l=>parseInt(l));Ae(o,a,r,s)}firstUpdated(e){super.firstUpdated(e),this.hotspots=this.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",r=>{this.mouseCoord={x:r.clientX-this.grImage[0].getBoundingClientRect().left,y:r.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(r=>{r.style.left=r.getAttribute("coords").split(",")[0]+"px",r.style.top=r.getAttribute("coords").split(",")[1]+"px",r.addEventListener("click",s=>{this.startPoint?this.endPoint||(this.endPoint=s.target,this._lines=[...this._lines,this.startPoint.getAttribute("identifier")+" "+this.endPoint.getAttribute("identifier")],this.saveResponse(this._lines),this.startPoint=null,this.endPoint=null):(this.startPoint=s.target,this.startCoord={x:this.startPoint.getAttribute("coords").split(",")[0],y:this.startPoint.getAttribute("coords").split(",")[1]})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};Z.styles=[b`
|
|
245
245
|
slot:not([name='prompt']) {
|
|
246
246
|
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
247
247
|
display: block;
|
|
@@ -264,8 +264,8 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
264
264
|
top: 0px;
|
|
265
265
|
left: 0px;
|
|
266
266
|
}
|
|
267
|
-
`],
|
|
268
|
-
<slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,s=r.getAttribute("coords"),n=r.getAttribute("shape"),o=s.split(",").map(a=>parseInt(a));switch(n){case"circle":{let[a,
|
|
267
|
+
`],c([C()],Z.prototype,"_lines",2),c([C()],Z.prototype,"startCoord",2),c([C()],Z.prototype,"mouseCoord",2),c([He("svg")],Z.prototype,"svgContainer",2),c([Qr({selector:"img"})],Z.prototype,"grImage",2);customElements.define("qti-graphic-associate-interaction",Z);var At=class extends j(f,"qti-gap-img",!1,"qti-associable-hotspot"){render(){return p` <slot></slot>
|
|
268
|
+
<slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,s=r.getAttribute("coords"),n=r.getAttribute("shape"),o=s.split(",").map(a=>parseInt(a));switch(n){case"circle":{let[a,l,u]=o;r.style.left=a-u+"px",r.style.top=l-u+"px",r.style.width=r.style.height=2*u+"px"}break;case"rect":{let[a,l,u,h]=o;r.style.left=a+"px",r.style.top=l+"px",r.style.width=u-a+"px",r.style.height=h-l+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};At.styles=b`
|
|
269
269
|
:host {
|
|
270
270
|
display: inline-block;
|
|
271
271
|
position: relative;
|
|
@@ -279,7 +279,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
279
279
|
<!-- slot for the prompt -->
|
|
280
280
|
<slot></slot>
|
|
281
281
|
<!-- slot for the image and hotspots -->
|
|
282
|
-
`}setHotspotOrder(e){let{identifier:r}=e.detail,s=this._choiceElements.find(o=>o.getAttribute("identifier")===r),n=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,s.order==null){if(this._choiceElements.filter(o=>o.order>0).length>=n){this.choiceOrdering=!1;return}s.order=this._choiceElements.filter(o=>!!o.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(o=>(o.order>o.order&&o.order--,o)),s.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),a=n.split(",").map(
|
|
282
|
+
`}setHotspotOrder(e){let{identifier:r}=e.detail,s=this._choiceElements.find(o=>o.getAttribute("identifier")===r),n=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,s.order==null){if(this._choiceElements.filter(o=>o.order>0).length>=n){this.choiceOrdering=!1;return}s.order=this._choiceElements.filter(o=>!!o.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(o=>(o.order>o.order&&o.order--,o)),s.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),a=n.split(",").map(l=>parseInt(l));Ae(o,a,r,s)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this.setHotspotOrder),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this.setHotspotOrder),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};qt.styles=[b`
|
|
283
283
|
slot:not([name='prompt']) {
|
|
284
284
|
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
285
285
|
display: block;
|
|
@@ -329,7 +329,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
329
329
|
</td>`})}
|
|
330
330
|
</tr>`)}
|
|
331
331
|
</table>
|
|
332
|
-
`:p`<slot name="prompt"></slot> <slot></slot>`}};qe.styles=[],
|
|
332
|
+
`:p`<slot name="prompt"></slot> <slot></slot>`}};qe.styles=[],c([C()],qe.prototype,"response",2),c([d({type:String,attribute:"response-identifier"})],qe.prototype,"responseIdentifier",2);customElements.define("qti-match-interaction",qe);var $t=class extends w{constructor(){super();this.value=0}reset(){}validate(){return!0}set response(e){}static get properties(){return R(x({},w.properties),{step:{type:Number,attribute:"step",default:10}})}render(){return p` <slot name="prompt"></slot>
|
|
333
333
|
<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.toString())})}};$t.styles=[b``];customElements.define("qti-media-interaction",$t);var we=class extends j(f,"qti-simple-choice",!0,"drop-list"){render(){return p` <slot name="prompt"> </slot>
|
|
334
334
|
<div part="container">
|
|
335
335
|
<slot part="drags"> </slot>
|
|
@@ -384,7 +384,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
384
384
|
:host(.qti-choices-right) [part='container'] {
|
|
385
385
|
flex-direction: row-reverse;
|
|
386
386
|
}
|
|
387
|
-
`],
|
|
387
|
+
`],c([d({type:String})],we.prototype,"orientation",2);customElements.define("qti-order-interaction",we);var St=class extends f{render(){return p`<slot></slot>`}};St.styles=[b`
|
|
388
388
|
:host {
|
|
389
389
|
display: block;
|
|
390
390
|
}
|
|
@@ -400,7 +400,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
400
400
|
display: inline-block;
|
|
401
401
|
position: relative;
|
|
402
402
|
}
|
|
403
|
-
`];customElements.define("qti-position-object-stage",Rt);var bs="important",
|
|
403
|
+
`];customElements.define("qti-position-object-stage",Rt);var bs="important",Ws=" !"+bs,gs=G(class extends U{constructor(i){var t;if(super(i),i.type!==J.ATTRIBUTE||i.name!=="style"||((t=i.strings)==null?void 0:t.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(i){return Object.keys(i).reduce((t,e)=>{let r=i[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(i,[t]){let{style:e}=i.element;if(this.ut===void 0)return this.ut=new Set(Object.keys(t)),this.render(t);for(let r of this.ut)t[r]==null&&(this.ut.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let s=t[r];if(s!=null){this.ut.add(r);let n=typeof s=="string"&&s.endsWith(Ws);r.includes("-")||n?e.setProperty(r,n?s.slice(0,-11):s,n?bs:""):e[r]=s}}return M}});var ue=class extends w{constructor(){super(...arguments);this.maxChoices=0;this.minChoices=0;this._points=[]}render(){return p` <slot name="prompt"></slot>
|
|
404
404
|
<point-container>
|
|
405
405
|
${Ct(this._points,e=>e,(e,r)=>p`
|
|
406
406
|
<button
|
|
@@ -419,7 +419,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
419
419
|
display: block;
|
|
420
420
|
position: relative;
|
|
421
421
|
}
|
|
422
|
-
`],
|
|
422
|
+
`],c([d({type:Number,attribute:"max-choices"})],ue.prototype,"maxChoices",2),c([d({type:Number,attribute:"min-choices"})],ue.prototype,"minChoices",2),c([C()],ue.prototype,"_points",2);customElements.define("qti-select-point-interaction",ue);var L=class extends w{constructor(){super();this.stepLabel=!1;this.reverse=!1;this._handleDisabledChange=(e,r)=>{};this._handleReadonlyChange=(e,r)=>{};this.csLive=getComputedStyle(this)}set min(e){this._min=e,this.value=e,this.style.setProperty("--min",`${this._min}`)}get min(){return this._min}set max(e){this._max=e,this.style.setProperty("--max",`${this._max}`)}get max(){return this._max}set step(e){this._step=e,this.style.setProperty("--step",`${this._step}`)}get step(){return this._step}reset(){}validate(){return!0}set response(e){if(Array.isArray(e)){console.error("QtiSliderInteraction: response is an array, but should be a single value");return}let r=parseInt(e);if(Number.isNaN(r)){console.error("QtiSliderInteraction: response is not a number");return}this.value=r}render(){this.value<this.min&&(this.value=this.min),this.value>this.max&&(this.value=this.max);let e=(this.value-this.min)/(this.max-this.min)*100;return this.style.setProperty("--value-percentage",`${e}%`),this.setAttribute("aria-valuenow",this.value.toString()),p`<slot name="prompt"></slot>
|
|
423
423
|
<div id="slider" part="slider">
|
|
424
424
|
${this.csLive.getPropertyValue("--show-bounds")=="true"?p`<div id="bounds" part="bounds">
|
|
425
425
|
<div>${this._min}</div>
|
|
@@ -431,16 +431,16 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
431
431
|
${this.csLive.getPropertyValue("--show-value")=="true"?p`<div id="value" part="value">${this.value}</div>`:E}
|
|
432
432
|
</div>
|
|
433
433
|
</div>
|
|
434
|
-
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=a=>{let{x:
|
|
434
|
+
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=a=>{let{x:l}=this.getPositionFromEvent(a),u=l-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(u),a.stopPropagation()},s=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",s),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",s);let{x:n}=this.getPositionFromEvent(e),o=n-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.stopPropagation()}_onMouseDown(e){let r=o=>{let a=o.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(a),o.preventDefault(),o.stopPropagation()},s=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",s);let n=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.preventDefault(),e.stopPropagation()}calculateValue(e){let r=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,s=this.min+Math.round((r-this.min)/this._step)*this._step;this.value=s}getPositionFromEvent(e){let r;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let s=typeof e.originalEvent=="undefined"?e:e.originalEvent,n=s.touches[0]||s.changedTouches[0];r={x:n.pageX,y:n.pageY}}else(e.type=="mousedown"||e.type=="mouseup"||e.type=="mousemove"||e.type=="mouseover"||e.type=="mouseout"||e.type=="mouseenter"||e.type=="mouseleave")&&(r={x:e.clientX,y:e.clientY});return r}};L.styles=[b``],c([He("#knob")],L.prototype,"_knob",2),c([He("#rail")],L.prototype,"_rail",2),c([d({type:Number})],L.prototype,"value",2),c([d({type:Boolean,attribute:"step-label"})],L.prototype,"stepLabel",2),c([d({type:Boolean})],L.prototype,"reverse",2),c([d({type:Number,attribute:"lower-bound"})],L.prototype,"min",1),c([d({type:Number,attribute:"upper-bound"})],L.prototype,"max",1),c([d({type:Number,attribute:"step"})],L.prototype,"step",1),c([$("disabled",{waitUntilFirstUpdate:!0})],L.prototype,"_handleDisabledChange",2),c([$("readonly",{waitUntilFirstUpdate:!0})],L.prototype,"_handleReadonlyChange",2);customElements.define("qti-slider-interaction",L);var Be=class extends f{render(){return p`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(e){var s,n,o;let r=Array.from((n=(s=this.firstElementChild)==null?void 0:s.childNodes)!=null?n:[]).find(a=>a.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",(o=r.textContent)!=null?o:"")}catch(a){console.error("custom-operator contains invalid javascript code",a)}}calculate(){let e={variable:s=>{var n,o,a;return(a=(o=(n=this._context)==null?void 0:n.variables.find(l=>l.identifier===s))==null?void 0:o.value)!=null?a:""},correct:s=>{var n,o,a;return(a=(o=(n=this._context)==null?void 0:n.variables.find(l=>l.identifier===s))==null?void 0:o.correctResponse)!=null?a:""}},r={getVariable:s=>{var n;return(n=this._context)==null?void 0:n.variables.find(o=>o.identifier===s)},updateOutcomeVariable:(s,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:s,value:n}}))}};return this.operatorFunction(this._context,e,r)}};c([Y({context:I,subscribe:!0}),C()],Be.prototype,"_context",2),Be=c([_("qti-custom-operator")],Be);var kt=class extends f{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return p` <slot name="qti-gap-img"></slot> `}};kt.styles=b`
|
|
435
435
|
:host {
|
|
436
436
|
position: absolute;
|
|
437
437
|
}
|
|
438
|
-
`;customElements.define("qti-associable-hotspot",kt);var Tt=class extends f{constructor(){super(...arguments);this.tabindex=0}render(){return p` <slot name="qti-gap-text"></slot>`}};
|
|
438
|
+
`;customElements.define("qti-associable-hotspot",kt);var Tt=class extends f{constructor(){super(...arguments);this.tabindex=0}render(){return p` <slot name="qti-gap-text"></slot>`}};c([d({type:Number,reflect:!0})],Tt.prototype,"tabindex",2);customElements.define("qti-gap",Tt);var Lt=class extends f{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","qti-gap-img")}};c([d({type:Number,reflect:!0})],Lt.prototype,"tabindex",2);customElements.define("qti-gap-img",Lt);var Mt=class extends f{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-gap-text")}render(){return p`<slot></slot>`}};c([d({type:Number,reflect:!0})],Mt.prototype,"tabindex",2);customElements.define("qti-gap-text",Mt);var ze=class extends T{};ze.styles=b`
|
|
439
439
|
:host {
|
|
440
440
|
position: absolute;
|
|
441
441
|
}
|
|
442
|
-
`,
|
|
443
|
-
<slot></slot> `}};Pt=
|
|
442
|
+
`,c([d({attribute:"aria-ordervalue",type:Number,reflect:!0})],ze.prototype,"order",2);customElements.define("qti-hotspot-choice",ze);var Pt=class extends T{render(){return p`<div part="ch"><div part="cha"></div></div>
|
|
443
|
+
<slot></slot> `}};Pt=c([_("qti-hottext")],Pt);var yr=class extends f{};customElements.define("qti-inline-choice",yr);var je=class extends T{render(){return p`<div part="ch"><div part="cha"></div></div>
|
|
444
444
|
<slot part="slot"></slot> `}};je.styles=b`
|
|
445
445
|
:host {
|
|
446
446
|
display: flex;
|
|
@@ -449,7 +449,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
449
449
|
width: 100%;
|
|
450
450
|
display: block;
|
|
451
451
|
}
|
|
452
|
-
`,je=
|
|
452
|
+
`,je=c([_("qti-simple-choice")],je);console.log("%cC\xBFTO%cLab%c: qti-components loaded","font-weight:bold; color:green",'font-family: "PT Sans", font-weight:bold; color:green; font-size: smaller;vertical-align: sub',"font-weight:unset");var Ym=()=>{let i,t={async load(e){return new Promise((r,s)=>{vs(e).then(n=>(i=n,r(t)))})},parse(e){return i=Gs(e),t},path:e=>(Zs(i,e),t),pciHooks(e){let r=["hook","module"],s=e.substring(0,e.lastIndexOf("/"));for(let n of r)i.querySelectorAll("["+n+"]").forEach(a=>{let l=a.getAttribute(n);!l.startsWith("data:")&&!l.startsWith("http")&&(a.setAttribute("base-url",e),a.setAttribute("module",s+"/"+encodeURIComponent(l+(l.endsWith(".js")?"":".js"))))});return t},html(){return new XMLSerializer().serializeToString(Vt(i))},xml(){return new XMLSerializer().serializeToString(i)},htmldoc(){return Vt(i)},xmldoc(){return i}};return t},Wm=()=>{let i,t={async load(e){return new Promise((r,s)=>{vs(e).then(n=>(i=n,r(t)))})},items(){return Js(i)},html(){return new XMLSerializer().serializeToString(Vt(i))},xml(){return new XMLSerializer().serializeToString(i)},htmldoc(){return Vt(i)},xmldoc(){return i}};return t},Ks=`
|
|
453
453
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
454
454
|
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
|
|
455
455
|
<xsl:template match="@*|node()">
|
|
@@ -484,7 +484,7 @@ var _r=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
484
484
|
<xsl:apply-templates/>
|
|
485
485
|
</xsl:element>
|
|
486
486
|
</xsl:template>
|
|
487
|
-
</xsl:stylesheet>`;function Js(i){let t=[];return i.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),s=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:s,category:n})}),t}function vs(i){return new Promise((t,e)=>{let r=new XMLHttpRequest;r.open("GET",i,!0),r.responseType="document",r.onload=()=>r.status>=200&&r.status<300?t(r.responseXML):(e(r.statusText),null),r.onerror=function(){e(r.statusText)},r.send()})}function Gs(i){return new DOMParser().parseFromString(i,"text/xml")}function Vt(i){let t=new XSLTProcessor,e=new DOMParser().parseFromString(
|
|
487
|
+
</xsl:stylesheet>`;function Js(i){let t=[];return i.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),s=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:s,category:n})}),t}function vs(i){return new Promise((t,e)=>{let r=new XMLHttpRequest;r.open("GET",i,!0),r.responseType="document",r.onload=()=>r.status>=200&&r.status<300?t(r.responseXML):(e(r.statusText),null),r.onerror=function(){e(r.statusText)},r.send()})}function Gs(i){return new DOMParser().parseFromString(i,"text/xml")}function Vt(i){let t=new XSLTProcessor,e=new DOMParser().parseFromString(Ks,"text/xml");return t.importStylesheet(e),t.transformToFragment(i,document)}function Zs(i,t){i.querySelectorAll("[src],[href]").forEach(e=>{var n;let r="";e.getAttribute("src")&&(r="src"),e.getAttribute("href")&&(r="href");let s=(n=e.getAttribute(r))==null?void 0:n.trim();if(!s.startsWith("data:")&&!s.startsWith("http")){let o=t+encodeURI(s);e.setAttribute(r,o)}})}export{w as Interaction,Fe as QtPrintedVariable,ft as QtiAnd,P as QtiAssessmentItem,kt as QtiAssociableHotspot,Xe as QtiAssociateInteraction,bt as QtiBaseValue,T as QtiChoice,Ee as QtiChoiceInteraction,ot as QtiCompanionMaterialsInfo,N as QtiConditionExpression,tr as QtiContains,nt as QtiContentBody,rr as QtiCorrect,Be as QtiCustomOperator,Ce as QtiEndAttemptInteraction,vt as QtiEqual,gt as QtiEqualRounded,v as QtiExpression,B as QtiExtendedTextInteraction,at as QtiFeedbackBlock,lt as QtiFeedbackInline,Tt as QtiGap,Lt as QtiGapImg,_t as QtiGapMatchInteraction,Mt as QtiGapText,Z as QtiGraphicAssociateInteraction,At as QtiGraphicGapMatchInteraction,qt as QtiGraphicOrderInteraction,sr as QtiGt,ir as QtiGte,ze as QtiHotspotChoice,wt as QtiHotspotInteraction,Pt as QtiHottext,Gt as QtiHottextInteraction,yr as QtiInlineChoice,pe as QtiInlineChoiceInteraction,or as QtiIsNull,mt as QtiLookupOutcomeValue,nr as QtiLt,ar as QtiLte,yt as QtiMapResponse,_e as QtiMapping,lr as QtiMatch,qe as QtiMatchInteraction,$t as QtiMediaInteraction,cr as QtiMember,ct as QtiModalFeedback,pr as QtiMultiple,dr as QtiNot,ur as QtiOr,we as QtiOrderInteraction,hr as QtiOrdered,te as QtiOutcomeDeclaration,gr as QtiPortableCustomInteraction,Rt as QtiPositionObjectStage,mr as QtiProduct,it as QtiPrompt,Zt as QtiResponseCondition,re as QtiResponseDeclaration,Ue as QtiResponseElse,er as QtiResponseElseIf,Ie as QtiResponseIf,de as QtiResponseProcessing,F as QtiRubricBlock,z as QtiRule,St as QtiSPositionObjectInteraction,ue as QtiSelectPointInteraction,Qt as QtiSetOutcomeValue,vr as QtiSimpleAssociableChoice,je as QtiSimpleChoice,L as QtiSliderInteraction,xt as QtiStringMatch,Yt as QtiStylesheet,fr as QtiSum,H as QtiTextEntryInteraction,br as QtiVariable,I as itemContext,es as itemContextVariables,Ys as qtiAndMixin,Ym as qtiTransformItem,Wm as qtiTransformTest};
|
|
488
488
|
/*! Bundled license information:
|
|
489
489
|
|
|
490
490
|
@lit/context/lib/context-request-event.js:
|
|
@@ -18,6 +18,7 @@ declare const qtiTransformItem: () => {
|
|
|
18
18
|
load(uri: string): Promise<any>;
|
|
19
19
|
parse(xmlString: string): any;
|
|
20
20
|
path: (location: string) => any;
|
|
21
|
+
pciHooks(uri: string): any;
|
|
21
22
|
html(): string;
|
|
22
23
|
xml(): string;
|
|
23
24
|
htmldoc(): DocumentFragment;
|
|
@@ -27,6 +28,7 @@ declare const qtiTransformItem: () => {
|
|
|
27
28
|
load(uri: string): Promise<any>;
|
|
28
29
|
parse(xmlString: string): any;
|
|
29
30
|
path: (location: string) => any;
|
|
31
|
+
pciHooks(uri: string): any;
|
|
30
32
|
html(): string;
|
|
31
33
|
xml(): string;
|
|
32
34
|
htmldoc(): DocumentFragment;
|
|
@@ -36,6 +38,7 @@ declare const qtiTransformItem: () => {
|
|
|
36
38
|
load(uri: string): Promise<any>;
|
|
37
39
|
parse(xmlString: string): any;
|
|
38
40
|
path: (location: string) => any;
|
|
41
|
+
pciHooks(uri: string): any;
|
|
39
42
|
html(): string;
|
|
40
43
|
xml(): string;
|
|
41
44
|
htmldoc(): DocumentFragment;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"../chunk-JILF7TI5.js";var
|
|
1
|
+
import"../chunk-JILF7TI5.js";var f=()=>{let e,n={async load(t){return new Promise((r,o)=>{c(t).then(s=>(e=s,r(n)))})},parse(t){return e=g(t),n},path:t=>(x(e,t),n),pciHooks(t){let r=["hook","module"],o=t.substring(0,t.lastIndexOf("/"));for(let s of r)e.querySelectorAll("["+s+"]").forEach(a=>{let i=a.getAttribute(s);!i.startsWith("data:")&&!i.startsWith("http")&&(a.setAttribute("base-url",t),a.setAttribute("module",o+"/"+encodeURIComponent(i+(i.endsWith(".js")?"":".js"))))});return n},html(){return new XMLSerializer().serializeToString(m(e))},xml(){return new XMLSerializer().serializeToString(e)},htmldoc(){return m(e)},xmldoc(){return e}};return n},h=()=>{let e,n={async load(t){return new Promise((r,o)=>{c(t).then(s=>(e=s,r(n)))})},items(){return p(e)},html(){return new XMLSerializer().serializeToString(m(e))},xml(){return new XMLSerializer().serializeToString(e)},htmldoc(){return m(e)},xmldoc(){return e}};return n},u=`
|
|
2
2
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
3
3
|
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
|
|
4
4
|
<xsl:template match="@*|node()">
|
|
@@ -33,5 +33,5 @@ import"../chunk-JILF7TI5.js";var x=()=>{let t,n={async load(e){return new Promis
|
|
|
33
33
|
<xsl:apply-templates/>
|
|
34
34
|
</xsl:element>
|
|
35
35
|
</xsl:template>
|
|
36
|
-
</xsl:stylesheet>`;function
|
|
37
|
-
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2xpYi9xdGktdHJhbnNmb3JtZXJzL3F0aS10cmFuc2Zvcm1lcnMudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQnJvd3NlciBiYXNlZCBRVEktWE1MIHRvIEhUTUwgdHJhbnNmb3JtZXIuXG4gKiBSZXR1cm5zIGFuIG9iamVjdCB3aXRoIG1ldGhvZHMgdG8gbG9hZCwgcGFyc2UsIHRyYW5zZm9ybSBhbmQgc2VyaWFsaXplIFFUSSBYTUwgaXRlbXMuXG4gKiBAcmV0dXJucyBBbiBvYmplY3Qgd2l0aCBt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Wx1ZSIsICJuZXdTcmNWYWx1ZSJdCn0K
|
|
36
|
+
</xsl:stylesheet>`;function p(e){let n=[];return e.querySelectorAll("qti-assessment-item-ref").forEach(t=>{let r=t.getAttribute("identifier"),o=t.getAttribute("href"),s=t.getAttribute("category");n.push({identifier:r,href:o,category:s})}),n}function c(e){return new Promise((n,t)=>{let r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="document",r.onload=()=>r.status>=200&&r.status<300?n(r.responseXML):(t(r.statusText),null),r.onerror=function(){t(r.statusText)},r.send()})}function g(e){return new DOMParser().parseFromString(e,"text/xml")}function m(e){let n=new XSLTProcessor,t=new DOMParser().parseFromString(u,"text/xml");return n.importStylesheet(t),n.transformToFragment(e,document)}function x(e,n){e.querySelectorAll("[src],[href]").forEach(t=>{var s;let r="";t.getAttribute("src")&&(r="src"),t.getAttribute("href")&&(r="href");let o=(s=t.getAttribute(r))==null?void 0:s.trim();if(!o.startsWith("data:")&&!o.startsWith("http")){let l=n+encodeURI(o);t.setAttribute(r,l)}})}export{f as qtiTransformItem,h as qtiTransformTest};
|
|
37
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vLi4vc3JjL2xpYi9xdGktdHJhbnNmb3JtZXJzL3F0aS10cmFuc2Zvcm1lcnMudHMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbIi8qKlxuICogQnJvd3NlciBiYXNlZCBRVEktWE1MIHRvIEhUTUwgdHJhbnNmb3JtZXIuXG4gKiBSZXR1cm5zIGFuIG9iamVjdCB3aXRoIG1ldGhvZHMgdG8gbG9hZCwgcGFyc2UsIHRyYW5zZm9ybSBhbmQgc2VyaWFsaXplIFFUSSBYTUwgaXRlbXMuXG4gKiBAcmV0dXJucyBBbiBvYmplY3Qgd2l0aCBtZXRob2RzIHRvIGxvYWQsIHBhcnNlLCB0cmFuc2Zvcm0gYW5kIHNlcmlhbGl6ZSBRVEkgWE1MIGl0ZW1zLlxuIC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