@citolab/qti-components 6.9.1-1 → 6.9.1-10
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/custom-elements.json +76 -76
- package/dist/index.js +54 -54
- package/dist/qti-components/index.d.ts +12 -1
- package/dist/qti-components/index.js +80 -80
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnPropertyDescriptor,Ms=Object.getOwnPropertyDescriptors;var Rr=Object.getOwnPropertySymbols;var Ls=Object.prototype.hasOwnProperty,Ns=Object.prototype.propertyIsEnumerable;var kr=(i,t,e)=>t in i?Mr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_=(i,t)=>{for(var e in t||(t={}))Ls.call(t,e)&&kr(i,e,t[e]);if(Rr)for(var e of Rr(t))Ns.call(t,e)&&kr(i,e,t[e]);return i},T=(i,t)=>Rs(i,Ms(t));var a=(i,t,e,r)=>{for(var s=r>1?void 0:r?ks(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&&Mr(t,e,s),s};var te=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 ye=class{constructor(t,e,r,s){var n;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,l)=>{this.unsubscribe&&(this.unsubscribe!==l&&(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,l)),this.unsubscribe=l},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 te(this.context,this.t,this.subscribe))}};var ht=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 Xt=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},xe=class extends ht{constructor(t,e,r){var s,n;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{let l=o.composedPath()[0];o.context===this.context&&l!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,l,o.subscribe))},this.onProviderRequest=o=>{let l=o.composedPath()[0];if(o.context!==this.context||l===this.host)return;let c=new Set;for(let[u,{consumerHost:m}]of this.subscriptions)c.has(u)||(c.add(u),m.dispatchEvent(new te(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 Xt(this.context))}};function Yt({context:i}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new xe(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 xe(o,{context:i}))});let s=Object.getOwnPropertyDescriptor(t,e),n;if(s===void 0){let o=new WeakMap;n={get(){return o.get(this)},set(l){r.get(this).setValue(l),o.set(this,l)},configurable:!0,enumerable:!0}}else{let o=s.set;n=T(_({},s),{set(l){r.get(this).setValue(l),o==null||o.call(this,l)}})}return void Object.defineProperty(t,e,n)}}}function J({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new ye(this,{context:i,callback:s=>{e.set.call(this,s)},subscribe:t})}):e.constructor.addInitializer(s=>{new ye(s,{context:i,callback:n=>{s[r]=n},subscribe:t})})}}var Lr=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 Nr=new WeakMap,Le=i=>{let t=Nr.get(i);return t===void 0&&Nr.set(i,t=new Map),t},Ps=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Le(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}setAttribute(t,e){Le(this).set(t,String(e))}removeAttribute(t){Le(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return Le(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 Lr(this);return this.__internals=t,t}getAttribute(t){let e=Le(this).get(t);return e!=null?e:null}};var Vs=class extends Ps{},Hr=Vs;var Ds=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}},Os=Ds;var Pr=new Os;var Ne=globalThis,mt=Ne.ShadowRoot&&(Ne.ShadyCSS===void 0||Ne.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,zt=Symbol(),Vr=new WeakMap,He=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==zt)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(mt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Vr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Vr.set(e,t))}return t}toString(){return this.cssText}},Dr=i=>new He(typeof i=="string"?i:i+"",void 0,zt),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 He(e,i,zt)},Wt=(i,t)=>{if(mt)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),s=Ne.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},ft=mt||Ne.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Dr(e)})(i):i;var{is:Us,defineProperty:Is,getOwnPropertyDescriptor:Fs,getOwnPropertyNames:Bs,getOwnPropertySymbols:js,getPrototypeOf:Xs}=Object,O=globalThis,Ir;(Ir=O.customElements)!=null||(O.customElements=Pr);var Or=O.trustedTypes,Ys=Or?Or.emptyScript:"",Kt=O.reactiveElementPolyfillSupport,Pe=(i,t)=>i,Ve={toAttribute(i,t){switch(t){case Boolean:i=i?Ys: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}},gt=(i,t)=>!Us(i,t),Ur={attribute:!0,type:String,converter:Ve,reflect:!1,hasChanged:gt},Fr,Br;(Fr=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Br=O.litPropertyMetadata)!=null||(O.litPropertyMetadata=new WeakMap);var jr,Z=class extends((jr=globalThis.HTMLElement)!=null?jr:Hr){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=Ur){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&&Is(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){var o;let{get:s,set:n}=(o=Fs(this.prototype,t))!=null?o:{get(){return this[e]},set(l){this[e]=l}};return{get(){return s==null?void 0:s.call(this)},set(l){let c=s==null?void 0:s.call(this);n.call(this,l),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:Ur}static _$Ei(){if(this.hasOwnProperty(Pe("elementProperties")))return;let t=Xs(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Pe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Pe("properties"))){let e=this.properties,r=[...Bs(e),...js(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(ft(s))}else t!==void 0&&e.push(ft(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._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,r;((e=this._$EO)!=null?e:this._$EO=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return Wt(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(r=>{var s;return(s=r.hostConnected)==null?void 0:s.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(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:Ve).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),l=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Ve;this._$Em=s,this[s]=l.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r){var s;if(t!==void 0){if(r!=null||(r=this.constructor.getPropertyOptions(t)),!((s=r.hasChanged)!=null?s:gt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(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 _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,l]of this._$Ep)this[o]=l;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,l]of n)l.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],l)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(n=>{var o;return(o=n.hostUpdate)==null?void 0:o.call(n)}),this.update(e)):this._$EU()}catch(n){throw t=!1,this._$EU(),n}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==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)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}},Xr;Z.elementStyles=[],Z.shadowRootOptions={mode:"open"},Z[Pe("elementProperties")]=new Map,Z[Pe("finalized")]=new Map,Kt==null||Kt({ReactiveElement:Z}),((Xr=O.reactiveElementVersions)!=null?Xr:O.reactiveElementVersions=[]).push("2.0.4");var Ee=globalThis,bt=Ee.trustedTypes,Yr=bt?bt.createPolicy("lit-html",{createHTML:i=>i}):void 0,Gt="$lit$",G=`lit$${Math.random().toFixed(9).slice(2)}$`,Qt="?"+G,zs=`<${Qt}>`,de=Ee.document===void 0?{createTreeWalker:()=>({})}:document,Oe=()=>de.createComment(""),Ue=i=>i===null||typeof i!="object"&&typeof i!="function",Qr=Array.isArray,es=i=>Qr(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",Jt=`[
|
|
2
|
-
\f\r]`,De=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zr=/-->/g,Wr=/>/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Kr=/'/g,Jr=/"/g,ts=/^(?:script|style|textarea|title)$/i,rs=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),d=rs(1),er=rs(2),L=Symbol.for("lit-noChange"),C=Symbol.for("lit-nothing"),Zr=new WeakMap,pe=de.createTreeWalker(de,129);function ss(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Yr!==void 0?Yr.createHTML(t):t}var is=(i,t)=>{let e=i.length-1,r=[],s,n=t===2?"<svg>":"",o=De;for(let l=0;l<e;l++){let c=i[l],u,m,f=-1,y=0;for(;y<c.length&&(o.lastIndex=y,m=o.exec(c),m!==null);)y=o.lastIndex,o===De?m[1]==="!--"?o=zr:m[1]!==void 0?o=Wr:m[2]!==void 0?(ts.test(m[2])&&(s=RegExp("</"+m[2],"g")),o=ce):m[3]!==void 0&&(o=ce):o===ce?m[0]===">"?(o=s!=null?s:De,f=-1):m[1]===void 0?f=-2:(f=o.lastIndex-m[2].length,u=m[1],o=m[3]===void 0?ce:m[3]==='"'?Jr:Kr):o===Jr||o===Kr?o=ce:o===zr||o===Wr?o=De:(o=ce,s=void 0);let v=o===ce&&i[l+1].startsWith("/>")?" ":"";n+=o===De?c+zs:f>=0?(r.push(u),c.slice(0,f)+Gt+c.slice(f)+G+v):c+G+(f===-2?l:v)}return[ss(i,n+(i[e]||"<?>")+(t===2?"</svg>":"")),r]},Ie=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let n=0,o=0,l=t.length-1,c=this.parts,[u,m]=is(t,e);if(this.el=i.createElement(u,r),pe.currentNode=this.el.content,e===2){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(s=pe.nextNode())!==null&&c.length<l;){if(s.nodeType===1){if(s.hasAttributes())for(let f of s.getAttributeNames())if(f.endsWith(Gt)){let y=m[o++],v=s.getAttribute(f).split(G),w=/([.?@])?(.*)/.exec(y);c.push({type:1,index:n,name:w[2],strings:v,ctor:w[1]==="."?yt:w[1]==="?"?xt:w[1]==="@"?Et:he}),s.removeAttribute(f)}else f.startsWith(G)&&(c.push({type:6,index:n}),s.removeAttribute(f));if(ts.test(s.tagName)){let f=s.textContent.split(G),y=f.length-1;if(y>0){s.textContent=bt?bt.emptyScript:"";for(let v=0;v<y;v++)s.append(f[v],Oe()),pe.nextNode(),c.push({type:2,index:++n});s.append(f[y],Oe())}}}else if(s.nodeType===8)if(s.data===Qt)c.push({type:2,index:n});else{let f=-1;for(;(f=s.data.indexOf(G,f+1))!==-1;)c.push({type:7,index:n}),f+=G.length-1}n++}}static createElement(t,e){let r=de.createElement("template");return r.innerHTML=t,r}};function ue(i,t,e=i,r){var o,l,c;if(t===L)return t;let s=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl,n=Ue(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((l=s==null?void 0:s._$AO)==null||l.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=ue(i,s._$AS(i,t.values),s,r)),t}var vt=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:de).importNode(e,!0);pe.currentNode=s;let n=pe.nextNode(),o=0,l=0,c=r[0];for(;c!==void 0;){if(o===c.index){let m;c.type===2?m=new _e(n,n.nextSibling,this,t):c.type===1?m=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(m=new _t(n,this,t)),this._$AV.push(m),c=r[++l]}o!==(c==null?void 0:c.index)&&(n=pe.nextNode(),o++)}return pe.currentNode=de,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++}},_e=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=C,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=ue(this,t,e),Ue(t)?t===C||t==null||t===""?(this._$AH!==C&&this._$AR(),this._$AH=C):t!==this._$AH&&t!==L&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):es(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==C&&Ue(this._$AH)?this._$AA.nextSibling.data=t:this.T(de.createTextNode(t)),this._$AH=t}$(t){var n;let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ie.createElement(ss(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 vt(s,this),l=o.u(this.options);o.p(e),this.T(l),this._$AH=o}}_$AC(t){let e=Zr.get(t.strings);return e===void 0&&Zr.set(t.strings,e=new Ie(t)),e}k(t){Qr(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.S(Oe()),this.S(Oe()),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))}},he=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,n){this.type=1,this._$AH=C,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=C}_$AI(t,e=this,r,s){let n=this.strings,o=!1;if(n===void 0)t=ue(this,t,e,0),o=!Ue(t)||t!==this._$AH&&t!==L,o&&(this._$AH=t);else{let l=t,c,u;for(t=n[0],c=0;c<n.length-1;c++)u=ue(this,l[r+c],e,c),u===L&&(u=this._$AH[c]),o||(o=!Ue(u)||u!==this._$AH[c]),u===C?t=C:t!==C&&(t+=(u!=null?u:"")+n[c+1]),this._$AH[c]=u}o&&!s&&this.j(t)}j(t){t===C?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},yt=class extends he{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===C?void 0:t}},xt=class extends he{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==C)}},Et=class extends he{constructor(t,e,r,s,n){super(t,e,r,s,n),this.type=5}_$AI(t,e=this){var o;if((t=(o=ue(this,t,e,0))!=null?o:C)===L)return;let r=this._$AH,s=t===C&&r!==C||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==C&&(r===C||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)}},_t=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){ue(this,t)}},os={P:Gt,A:G,C:Qt,M:1,L:is,R:vt,D:es,V:ue,I:_e,H:he,N:xt,U:Et,B:yt,F:_t},Zt=Ee.litHtmlPolyfillSupport,Gr;Zt==null||Zt(Ie,_e),((Gr=Ee.litHtmlVersions)!=null?Gr:Ee.litHtmlVersions=[]).push("3.1.4");var ns=(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 l=(o=e==null?void 0:e.renderBefore)!=null?o:null;r._$litPart$=s=new _e(t.insertBefore(Oe(),l),l,void 0,e!=null?e:{})}return s._$AI(i),s};var g=class extends Z{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=ns(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 L}},as;g._$litElement$=!0,g.finalized=!0,(as=globalThis.litElementHydrateSupport)==null||as.call(globalThis,{LitElement:g});var tr=globalThis.litElementPolyfillSupport;tr==null||tr({LitElement:g});var ls;((ls=globalThis.litElementVersions)!=null?ls:globalThis.litElementVersions=[]).push("4.0.6");var h=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Ws={attribute:!0,type:String,converter:Ve,reflect:!1,hasChanged:gt},Ks=(i=Ws,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(l){let c=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,c,i)},init(l){return l!==void 0&&this.P(o,void 0,i),l}}}if(r==="setter"){let{name:o}=e;return function(l){let c=this[o];t.call(this,l),this.requestUpdate(o,c,i)}}throw Error("Unsupported decorator location: "+r)};function p(i){return(t,e)=>typeof e=="object"?Ks(i,t,e):((r,s,n)=>{let o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?T(_({},r),{wrapped:!0}):r),o?Object.getOwnPropertyDescriptor(s,n):void 0})(i,t,e)}function E(i){return p(T(_({},i),{state:!0,attribute:!1}))}var re=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function Fe(i,t){return(e,r,s)=>{let n=o=>{var l,c;return(c=(l=o.renderRoot)==null?void 0:l.querySelector(i))!=null?c:null};if(t){let{get:o,set:l}=typeof r=="object"?e:s!=null?s:(()=>{let c=Symbol();return{get(){return this[c]},set(u){this[c]=u}}})();return re(e,r,{get(){let c=o.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&l.call(this,c)),c}})}return re(e,r,{get(){return n(this)}})}}function cs(i){return(t,e)=>{let{slot:r,selector:s}=i!=null?i:{},n="slot"+(r?`[name=${r}]`:":not([name])");return re(t,e,{get(){var c,u;let o=(c=this.renderRoot)==null?void 0:c.querySelector(n),l=(u=o==null?void 0:o.assignedElements(i))!=null?u:[];return s===void 0?l:l.filter(m=>m.matches(s))}})}}function $(i,t){let e=_({waitUntilFirstUpdate:!1},t);return(r,s)=>{let{update:n}=r,o=Array.isArray(i)?i:[i];r.update=function(l){o.forEach(c=>{let u=c;if(l.has(u)){let m=l.get(u),f=this[u];m!==f&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[s](m,f)}}),n.call(this,l)}}}var ps=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],U="item";var N=class extends g{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:ps};this._initialContext=T(_({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",e=>{this._context=T(_({},this._context),{variables:[...this._context.variables,e.detail.variable]}),this._initialContext=this._context,e.stopPropagation()}),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),e.stopPropagation()}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}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=T(_({},this._context),{variables:this._context.variables.map(r=>{let s=e.find(n=>n.identifier===r.identifier);return s?_(_({},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))})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this._emit("qti-assessment-item-connected",this)}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 d`<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(l=>l.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=T(_({},this._context),{variables:this._context.variables.map(s=>s.identifier!==e?s:T(_({},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=T(_({},this._context),{variables:this._context.variables.map(o=>o.identifier!==e?o:T(_({},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}))}};a([p({type:String})],N.prototype,"title",2),a([p({type:String})],N.prototype,"identifier",2),a([p({type:String})],N.prototype,"adaptive",2),a([p({type:String})],N.prototype,"timeDependent",2),a([p({type:Boolean})],N.prototype,"disabled",2),a([$("disabled",{waitUntilFirstUpdate:!0})],N.prototype,"_handleDisabledChange",2),a([p({type:Boolean})],N.prototype,"readonly",2),a([$("readonly",{waitUntilFirstUpdate:!0})],N.prototype,"_handleReadonlyChange",2),a([Yt({context:U})],N.prototype,"_context",2),N=a([h("qti-assessment-item")],N);var Js=String.raw,ds=()=>{let i,t={async load(e,r=!1){return new Promise((s,n)=>{sr(e,r).then(o=>(i=o,s(t)))})},parse(e){return i=ir(e),t},path:e=>(Qs(i,e),t),fn(e){return e(i),t},pciHooks(e){let r=["hook","module"],s=e.substring(0,e.lastIndexOf("/"));for(let n of r)i.querySelectorAll("["+n+"]").forEach(l=>{let c=l.getAttribute(n);!c.startsWith("data:")&&!c.startsWith("http")&&(l.setAttribute("base-url",e),l.setAttribute("module",s+"/"+encodeURIComponent(c+(c.endsWith(".js")?"":".js"))))});return t},customInteraction(e,r){let s=i.querySelector("qti-custom-interaction"),n=s.querySelector("object");return s.setAttribute("data-base-ref",e),s.setAttribute("data-base-item",e+r),s.setAttribute("data",n.getAttribute("data")),s.setAttribute("width",n.getAttribute("width")),s.setAttribute("height",n.getAttribute("height")),s.removeChild(n),t},convertCDATAtoComment(){return ei(i),t},stripStyleSheets(){return ti(i),t},html(){return new XMLSerializer().serializeToString(Ct(i))},xml(){return new XMLSerializer().serializeToString(i)},htmldoc(){return Ct(i)},xmldoc(){return i}};return t},ln=()=>{let i,t={async load(e){return new Promise((r,s)=>{sr(e).then(n=>(i=n,r(t)))})},parse(e){i=ir(e)},assessmentTest(){let e=i.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t},cn=()=>{let i,t={async load(e){return new Promise((r,s)=>{sr(e).then(n=>(i=n,r(t)))})},parse(e){return i=ir(e),t},fn(e){return e(i),t},items(){return Gs(i)},html(){return new XMLSerializer().serializeToString(Ct(i))},xml(){return new XMLSerializer().serializeToString(i)},htmldoc(){return Ct(i)},xmldoc(){return i}};return t},Zs=Js`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
1
|
+
var Mr=Object.defineProperty,$s=Object.defineProperties,ks=Object.getOwnPropertyDescriptor,Ms=Object.getOwnPropertyDescriptors;var $r=Object.getOwnPropertySymbols;var Ls=Object.prototype.hasOwnProperty,Hs=Object.prototype.propertyIsEnumerable;var kr=(i,t,e)=>t in i?Mr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_=(i,t)=>{for(var e in t||(t={}))Ls.call(t,e)&&kr(i,e,t[e]);if($r)for(var e of $r(t))Hs.call(t,e)&&kr(i,e,t[e]);return i},T=(i,t)=>$s(i,Ms(t));var a=(i,t,e,r)=>{for(var s=r>1?void 0:r?ks(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&&Mr(t,e,s),s};var re=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 xe=class{constructor(t,e,r,s){var n;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,l)=>{this.unsubscribe&&(this.unsubscribe!==l&&(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,l)),this.unsubscribe=l},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 re(this.context,this.t,this.subscribe))}};var ht=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 Xt=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},Ee=class extends ht{constructor(t,e,r){var s,n;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{let l=o.composedPath()[0];o.context===this.context&&l!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,l,o.subscribe))},this.onProviderRequest=o=>{let l=o.composedPath()[0];if(o.context!==this.context||l===this.host)return;let c=new Set;for(let[u,{consumerHost:m}]of this.subscriptions)c.has(u)||(c.add(u),m.dispatchEvent(new re(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 Xt(this.context))}};function Yt({context:i}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new Ee(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 Ee(o,{context:i}))});let s=Object.getOwnPropertyDescriptor(t,e),n;if(s===void 0){let o=new WeakMap;n={get(){return o.get(this)},set(l){r.get(this).setValue(l),o.set(this,l)},configurable:!0,enumerable:!0}}else{let o=s.set;n=T(_({},s),{set(l){r.get(this).setValue(l),o==null||o.call(this,l)}})}return void Object.defineProperty(t,e,n)}}}function Z({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new xe(this,{context:i,callback:s=>{e.set.call(this,s)},subscribe:t})}):e.constructor.addInitializer(s=>{new xe(s,{context:i,callback:n=>{s[r]=n},subscribe:t})})}}var Lr=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 Hr=new WeakMap,Le=i=>{let t=Hr.get(i);return t===void 0&&Hr.set(i,t=new Map),t},Ps=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Le(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}setAttribute(t,e){Le(this).set(t,String(e))}removeAttribute(t){Le(this).delete(t)}toggleAttribute(t,e){if(this.hasAttribute(t)){if(e===void 0||!e)return this.removeAttribute(t),!1}else return e===void 0||e?(this.setAttribute(t,""),!0):!1;return!0}hasAttribute(t){return Le(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 Lr(this);return this.__internals=t,t}getAttribute(t){let e=Le(this).get(t);return e!=null?e:null}};var Vs=class extends Ps{},Nr=Vs;var Ds=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}},Os=Ds;var Pr=new Os;var He=globalThis,mt=He.ShadowRoot&&(He.ShadyCSS===void 0||He.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,zt=Symbol(),Vr=new WeakMap,Ne=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==zt)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(mt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Vr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Vr.set(e,t))}return t}toString(){return this.cssText}},Dr=i=>new Ne(typeof i=="string"?i:i+"",void 0,zt),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 Ne(e,i,zt)},Wt=(i,t)=>{if(mt)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),s=He.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},ft=mt||He.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Dr(e)})(i):i;var{is:Us,defineProperty:Is,getOwnPropertyDescriptor:Fs,getOwnPropertyNames:Bs,getOwnPropertySymbols:js,getPrototypeOf:Xs}=Object,O=globalThis,Ir;(Ir=O.customElements)!=null||(O.customElements=Pr);var Or=O.trustedTypes,Ys=Or?Or.emptyScript:"",Kt=O.reactiveElementPolyfillSupport,Pe=(i,t)=>i,Ve={toAttribute(i,t){switch(t){case Boolean:i=i?Ys: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}},gt=(i,t)=>!Us(i,t),Ur={attribute:!0,type:String,converter:Ve,reflect:!1,hasChanged:gt},Fr,Br;(Fr=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Br=O.litPropertyMetadata)!=null||(O.litPropertyMetadata=new WeakMap);var jr,G=class extends((jr=globalThis.HTMLElement)!=null?jr:Nr){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=Ur){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&&Is(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){var o;let{get:s,set:n}=(o=Fs(this.prototype,t))!=null?o:{get(){return this[e]},set(l){this[e]=l}};return{get(){return s==null?void 0:s.call(this)},set(l){let c=s==null?void 0:s.call(this);n.call(this,l),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:Ur}static _$Ei(){if(this.hasOwnProperty(Pe("elementProperties")))return;let t=Xs(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Pe("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Pe("properties"))){let e=this.properties,r=[...Bs(e),...js(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(ft(s))}else t!==void 0&&e.push(ft(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._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,r;((e=this._$EO)!=null?e:this._$EO=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var e;(e=this._$EO)==null||e.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return Wt(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(r=>{var s;return(s=r.hostConnected)==null?void 0:s.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$EO)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(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:Ve).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),l=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Ve;this._$Em=s,this[s]=l.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r){var s;if(t!==void 0){if(r!=null||(r=this.constructor.getPropertyOptions(t)),!((s=r.hasChanged)!=null?s:gt)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(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 _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,l]of this._$Ep)this[o]=l;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,l]of n)l.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.P(o,this[o],l)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$EO)==null||s.forEach(n=>{var o;return(o=n.hostUpdate)==null?void 0:o.call(n)}),this.update(e)):this._$EU()}catch(n){throw t=!1,this._$EU(),n}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==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)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}},Xr;G.elementStyles=[],G.shadowRootOptions={mode:"open"},G[Pe("elementProperties")]=new Map,G[Pe("finalized")]=new Map,Kt==null||Kt({ReactiveElement:G}),((Xr=O.reactiveElementVersions)!=null?Xr:O.reactiveElementVersions=[]).push("2.0.4");var _e=globalThis,bt=_e.trustedTypes,Yr=bt?bt.createPolicy("lit-html",{createHTML:i=>i}):void 0,Gt="$lit$",Q=`lit$${Math.random().toFixed(9).slice(2)}$`,Qt="?"+Q,zs=`<${Qt}>`,me=_e.document===void 0?{createTreeWalker:()=>({})}:document,Oe=()=>me.createComment(""),Ue=i=>i===null||typeof i!="object"&&typeof i!="function",Qr=Array.isArray,es=i=>Qr(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",Jt=`[
|
|
2
|
+
\f\r]`,De=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zr=/-->/g,Wr=/>/g,ue=RegExp(`>|${Jt}(?:([^\\s"'>=/]+)(${Jt}*=${Jt}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Kr=/'/g,Jr=/"/g,ts=/^(?:script|style|textarea|title)$/i,rs=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),d=rs(1),er=rs(2),L=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),Zr=new WeakMap,he=me.createTreeWalker(me,129);function ss(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Yr!==void 0?Yr.createHTML(t):t}var is=(i,t)=>{let e=i.length-1,r=[],s,n=t===2?"<svg>":"",o=De;for(let l=0;l<e;l++){let c=i[l],u,m,f=-1,y=0;for(;y<c.length&&(o.lastIndex=y,m=o.exec(c),m!==null);)y=o.lastIndex,o===De?m[1]==="!--"?o=zr:m[1]!==void 0?o=Wr:m[2]!==void 0?(ts.test(m[2])&&(s=RegExp("</"+m[2],"g")),o=ue):m[3]!==void 0&&(o=ue):o===ue?m[0]===">"?(o=s!=null?s:De,f=-1):m[1]===void 0?f=-2:(f=o.lastIndex-m[2].length,u=m[1],o=m[3]===void 0?ue:m[3]==='"'?Jr:Kr):o===Jr||o===Kr?o=ue:o===zr||o===Wr?o=De:(o=ue,s=void 0);let v=o===ue&&i[l+1].startsWith("/>")?" ":"";n+=o===De?c+zs:f>=0?(r.push(u),c.slice(0,f)+Gt+c.slice(f)+Q+v):c+Q+(f===-2?l:v)}return[ss(i,n+(i[e]||"<?>")+(t===2?"</svg>":"")),r]},Ie=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let n=0,o=0,l=t.length-1,c=this.parts,[u,m]=is(t,e);if(this.el=i.createElement(u,r),he.currentNode=this.el.content,e===2){let f=this.el.content.firstChild;f.replaceWith(...f.childNodes)}for(;(s=he.nextNode())!==null&&c.length<l;){if(s.nodeType===1){if(s.hasAttributes())for(let f of s.getAttributeNames())if(f.endsWith(Gt)){let y=m[o++],v=s.getAttribute(f).split(Q),C=/([.?@])?(.*)/.exec(y);c.push({type:1,index:n,name:C[2],strings:v,ctor:C[1]==="."?yt:C[1]==="?"?xt:C[1]==="@"?Et:ge}),s.removeAttribute(f)}else f.startsWith(Q)&&(c.push({type:6,index:n}),s.removeAttribute(f));if(ts.test(s.tagName)){let f=s.textContent.split(Q),y=f.length-1;if(y>0){s.textContent=bt?bt.emptyScript:"";for(let v=0;v<y;v++)s.append(f[v],Oe()),he.nextNode(),c.push({type:2,index:++n});s.append(f[y],Oe())}}}else if(s.nodeType===8)if(s.data===Qt)c.push({type:2,index:n});else{let f=-1;for(;(f=s.data.indexOf(Q,f+1))!==-1;)c.push({type:7,index:n}),f+=Q.length-1}n++}}static createElement(t,e){let r=me.createElement("template");return r.innerHTML=t,r}};function fe(i,t,e=i,r){var o,l,c;if(t===L)return t;let s=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl,n=Ue(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((l=s==null?void 0:s._$AO)==null||l.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=fe(i,s._$AS(i,t.values),s,r)),t}var vt=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:me).importNode(e,!0);he.currentNode=s;let n=he.nextNode(),o=0,l=0,c=r[0];for(;c!==void 0;){if(o===c.index){let m;c.type===2?m=new Ce(n,n.nextSibling,this,t):c.type===1?m=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(m=new _t(n,this,t)),this._$AV.push(m),c=r[++l]}o!==(c==null?void 0:c.index)&&(n=he.nextNode(),o++)}return he.currentNode=me,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++}},Ce=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=A,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=fe(this,t,e),Ue(t)?t===A||t==null||t===""?(this._$AH!==A&&this._$AR(),this._$AH=A):t!==this._$AH&&t!==L&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):es(t)?this.k(t):this._(t)}S(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.S(t))}_(t){this._$AH!==A&&Ue(this._$AH)?this._$AA.nextSibling.data=t:this.T(me.createTextNode(t)),this._$AH=t}$(t){var n;let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ie.createElement(ss(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 vt(s,this),l=o.u(this.options);o.p(e),this.T(l),this._$AH=o}}_$AC(t){let e=Zr.get(t.strings);return e===void 0&&Zr.set(t.strings,e=new Ie(t)),e}k(t){Qr(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.S(Oe()),this.S(Oe()),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))}},ge=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,n){this.type=1,this._$AH=A,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=A}_$AI(t,e=this,r,s){let n=this.strings,o=!1;if(n===void 0)t=fe(this,t,e,0),o=!Ue(t)||t!==this._$AH&&t!==L,o&&(this._$AH=t);else{let l=t,c,u;for(t=n[0],c=0;c<n.length-1;c++)u=fe(this,l[r+c],e,c),u===L&&(u=this._$AH[c]),o||(o=!Ue(u)||u!==this._$AH[c]),u===A?t=A:t!==A&&(t+=(u!=null?u:"")+n[c+1]),this._$AH[c]=u}o&&!s&&this.j(t)}j(t){t===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},yt=class extends ge{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===A?void 0:t}},xt=class extends ge{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==A)}},Et=class extends ge{constructor(t,e,r,s,n){super(t,e,r,s,n),this.type=5}_$AI(t,e=this){var o;if((t=(o=fe(this,t,e,0))!=null?o:A)===L)return;let r=this._$AH,s=t===A&&r!==A||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==A&&(r===A||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)}},_t=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){fe(this,t)}},os={P:Gt,A:Q,C:Qt,M:1,L:is,R:vt,D:es,V:fe,I:Ce,H:ge,N:xt,U:Et,B:yt,F:_t},Zt=_e.litHtmlPolyfillSupport,Gr;Zt==null||Zt(Ie,Ce),((Gr=_e.litHtmlVersions)!=null?Gr:_e.litHtmlVersions=[]).push("3.1.4");var ns=(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 l=(o=e==null?void 0:e.renderBefore)!=null?o:null;r._$litPart$=s=new Ce(t.insertBefore(Oe(),l),l,void 0,e!=null?e:{})}return s._$AI(i),s};var g=class extends G{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=ns(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 L}},as;g._$litElement$=!0,g.finalized=!0,(as=globalThis.litElementHydrateSupport)==null||as.call(globalThis,{LitElement:g});var tr=globalThis.litElementPolyfillSupport;tr==null||tr({LitElement:g});var ls;((ls=globalThis.litElementVersions)!=null?ls:globalThis.litElementVersions=[]).push("4.0.6");var h=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Ws={attribute:!0,type:String,converter:Ve,reflect:!1,hasChanged:gt},Ks=(i=Ws,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(l){let c=t.get.call(this);t.set.call(this,l),this.requestUpdate(o,c,i)},init(l){return l!==void 0&&this.P(o,void 0,i),l}}}if(r==="setter"){let{name:o}=e;return function(l){let c=this[o];t.call(this,l),this.requestUpdate(o,c,i)}}throw Error("Unsupported decorator location: "+r)};function p(i){return(t,e)=>typeof e=="object"?Ks(i,t,e):((r,s,n)=>{let o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?T(_({},r),{wrapped:!0}):r),o?Object.getOwnPropertyDescriptor(s,n):void 0})(i,t,e)}function E(i){return p(T(_({},i),{state:!0,attribute:!1}))}var se=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function Fe(i,t){return(e,r,s)=>{let n=o=>{var l,c;return(c=(l=o.renderRoot)==null?void 0:l.querySelector(i))!=null?c:null};if(t){let{get:o,set:l}=typeof r=="object"?e:s!=null?s:(()=>{let c=Symbol();return{get(){return this[c]},set(u){this[c]=u}}})();return se(e,r,{get(){let c=o.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&l.call(this,c)),c}})}return se(e,r,{get(){return n(this)}})}}function cs(i){return(t,e)=>{let{slot:r,selector:s}=i!=null?i:{},n="slot"+(r?`[name=${r}]`:":not([name])");return se(t,e,{get(){var c,u;let o=(c=this.renderRoot)==null?void 0:c.querySelector(n),l=(u=o==null?void 0:o.assignedElements(i))!=null?u:[];return s===void 0?l:l.filter(m=>m.matches(s))}})}}function S(i,t){let e=_({waitUntilFirstUpdate:!1},t);return(r,s)=>{let{update:n}=r,o=Array.isArray(i)?i:[i];r.update=function(l){o.forEach(c=>{let u=c;if(l.has(u)){let m=l.get(u),f=this[u];m!==f&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[s](m,f)}}),n.call(this,l)}}}var ps=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],U="item";var H=class extends g{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:ps};this._initialContext=T(_({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",e=>{this._context=T(_({},this._context),{variables:[...this._context.variables,e.detail.variable]}),this._initialContext=this._context,e.stopPropagation()}),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),e.stopPropagation()}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}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=T(_({},this._context),{variables:this._context.variables.map(r=>{let s=e.find(n=>n.identifier===r.identifier);return s?_(_({},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))})}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this._emit("qti-assessment-item-connected",this)}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 d`<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(l=>l.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=T(_({},this._context),{variables:this._context.variables.map(s=>s.identifier!==e?s:T(_({},s),{value:r}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:Array.isArray(r)?[...r]: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=T(_({},this._context),{variables:this._context.variables.map(o=>o.identifier!==e?o:T(_({},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}))}};a([p({type:String})],H.prototype,"title",2),a([p({type:String})],H.prototype,"identifier",2),a([p({type:String})],H.prototype,"adaptive",2),a([p({type:String})],H.prototype,"timeDependent",2),a([p({type:Boolean})],H.prototype,"disabled",2),a([S("disabled",{waitUntilFirstUpdate:!0})],H.prototype,"_handleDisabledChange",2),a([p({type:Boolean})],H.prototype,"readonly",2),a([S("readonly",{waitUntilFirstUpdate:!0})],H.prototype,"_handleReadonlyChange",2),a([Yt({context:U})],H.prototype,"_context",2),H=a([h("qti-assessment-item")],H);var Js=String.raw,ds=()=>{let i,t={async load(e,r=!1){return new Promise((s,n)=>{sr(e,r).then(o=>(i=o,s(t)))})},parse(e){return i=ir(e),t},path:e=>(Qs(i,e),t),fn(e){return e(i),t},pciHooks(e){let r=["hook","module"],s=e.substring(0,e.lastIndexOf("/"));for(let n of r)i.querySelectorAll("["+n+"]").forEach(l=>{let c=l.getAttribute(n);!c.startsWith("data:")&&!c.startsWith("http")&&(l.setAttribute("base-url",e),l.setAttribute("module",s+"/"+encodeURIComponent(c+(c.endsWith(".js")?"":".js"))))});return t},customInteraction(e,r){let s=i.querySelector("qti-custom-interaction"),n=s.querySelector("object");return s.setAttribute("data-base-ref",e),s.setAttribute("data-base-item",e+r),s.setAttribute("data",n.getAttribute("data")),s.setAttribute("width",n.getAttribute("width")),s.setAttribute("height",n.getAttribute("height")),s.removeChild(n),t},convertCDATAtoComment(){return ei(i),t},stripStyleSheets(){return ti(i),t},html(){return new XMLSerializer().serializeToString(Ct(i))},xml(){return new XMLSerializer().serializeToString(i)},htmldoc(){return Ct(i)},xmldoc(){return i}};return t},ln=()=>{let i,t={async load(e){return new Promise((r,s)=>{sr(e).then(n=>(i=n,r(t)))})},parse(e){i=ir(e)},assessmentTest(){let e=i.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t},cn=()=>{let i,t={async load(e){return new Promise((r,s)=>{sr(e).then(n=>(i=n,r(t)))})},parse(e){return i=ir(e),t},fn(e){return e(i),t},items(){return Gs(i)},html(){return new XMLSerializer().serializeToString(Ct(i))},xml(){return new XMLSerializer().serializeToString(i)},htmldoc(){return Ct(i)},xmldoc(){return i}};return t},Zs=Js`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
4
4
|
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
|
|
5
5
|
<xsl:template match="@*|node()">
|
|
6
6
|
<xsl:copy>
|
|
@@ -22,23 +22,23 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
22
22
|
<xsl:apply-templates/>
|
|
23
23
|
</xsl:element>
|
|
24
24
|
</xsl:template>
|
|
25
|
-
</xsl:stylesheet>`;function Gs(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}var rr=null;function sr(i,t=!0){return t&&rr!==null&&rr.abort(),new Promise((e,r)=>{let s=new XMLHttpRequest;rr=s,s.open("GET",i,!0),s.responseType="document",s.onload=()=>{s.status>=200&&s.status<300?e(s.responseXML):r(s.statusText)},s.onerror=()=>{r(s.statusText)},s.send()})}function ir(i){return new DOMParser().parseFromString(i,"text/xml")}function Ct(i){let t=new XSLTProcessor,e=new DOMParser().parseFromString(Zs,"text/xml");return t.importStylesheet(e),t.transformToFragment(i,document)}function Qs(i,t){t.endsWith("/")||(t+="/"),i.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{var n;let r="";e.getAttribute("src")&&(r="src"),e.getAttribute("href")&&(r="href"),e.getAttribute("primary-path")&&(r="primary-path");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)}})}function ei(i){i.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}function ti(i){i.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var
|
|
25
|
+
</xsl:stylesheet>`;function Gs(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}var rr=null;function sr(i,t=!0){return t&&rr!==null&&rr.abort(),new Promise((e,r)=>{let s=new XMLHttpRequest;rr=s,s.open("GET",i,!0),s.responseType="document",s.onload=()=>{s.status>=200&&s.status<300?e(s.responseXML):r(s.statusText)},s.onerror=()=>{r(s.statusText)},s.send()})}function ir(i){return new DOMParser().parseFromString(i,"text/xml")}function Ct(i){let t=new XSLTProcessor,e=new DOMParser().parseFromString(Zs,"text/xml");return t.importStylesheet(e),t.transformToFragment(i,document)}function Qs(i,t){t.endsWith("/")||(t+="/"),i.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{var n;let r="";e.getAttribute("src")&&(r="src"),e.getAttribute("href")&&(r="href"),e.getAttribute("primary-path")&&(r="primary-path");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)}})}function ei(i){i.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}function ti(i){i.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var Ae=class extends g{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let e=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0});if(this.dispatchEvent(e)){let n=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);n?await this.loadAndAppendStimulus(n):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async loadAndAppendStimulus(e){let r=this.href.substring(0,this.href.lastIndexOf("/")),s=await ds().load(this.href).then(n=>n.path(r).htmldoc());if(s){let n=s.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.append(...n)}}};a([p({type:String})],Ae.prototype,"identifier",2),a([p({type:String})],Ae.prototype,"href",2),Ae=a([h("qti-assessment-stimulus-ref")],Ae);var ri={SPACE:32},M=class extends g{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 ri.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"),d` <slot></slot> `}};a([p({type:String})],M.prototype,"identifier",2),a([p({type:Number,reflect:!0})],M.prototype,"tabindex",2),a([p({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:e=>e}})],M.prototype,"disabled",2),a([p({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:e=>e}})],M.prototype,"readonly",2),a([p({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>e}})],M.prototype,"checked",2),a([S("disabled",{waitUntilFirstUpdate:!0})],M.prototype,"handleDisabledChange",1);var us=b`
|
|
26
26
|
:host {
|
|
27
27
|
display: block;
|
|
28
28
|
}
|
|
29
|
-
`;var qe=class extends g{render(){return d`<slot name="qti-rubric-block"></slot><slot></slot>`}};qe.styles=us,qe=a([h("qti-item-body")],qe);var
|
|
29
|
+
`;var qe=class extends g{render(){return d`<slot name="qti-rubric-block"></slot><slot></slot>`}};qe.styles=us,qe=a([h("qti-item-body")],qe);var At=class extends g{render(){return d`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};At=a([h("qti-prompt")],At);var qt=class extends g{firstUpdated(t){super.firstUpdated(t);let e=this,r=this.getAttribute("href");if(r!==null){let s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.media="screen",s.href=r,e.appendChild(s),this.styleLink=s}if(this.textContent!==null){let s=document.createElement("style");s.media="screen",s.textContent=this.textContent,e.appendChild(s),this.styleLink=s}}disconnectedCallback(){if(this.styleLink)try{this.styleLink.remove()}catch(t){console.log("could not remove stylesheet")}}};qt=a([h("qti-stylesheet")],qt);var ie=class extends g{render(){return d`<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]}};ie=a([h("qti-variabledeclaration")],ie);var I=class extends ie{render(){var e,r;let t=(r=(e=this.itemContext)==null?void 0:e.variables.find(s=>s.identifier===this.identifier))==null?void 0:r.value;return d`${JSON.stringify(t,null,2)}`}get interpolationTable(){let t=this.querySelector("qti-interpolation-table");if(t){let e=new Map;for(let r of t.querySelectorAll("qti-interpolation-table-entry")){!r.getAttribute("source-value")&&r.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let s=parseInt(r.getAttribute("source-value")),n=parseInt(r.getAttribute("target-value"));(isNaN(s)||isNaN(n))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),e.set(s,n)}return e}return null}connectedCallback(){super.connectedCallback();let t={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,type:"outcome",value:null,interpolationTable:this.interpolationTable};t.value=this.defaultValues(t),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}};I.styles=[b`
|
|
30
30
|
:host {
|
|
31
31
|
display: none;
|
|
32
32
|
}
|
|
33
|
-
`],a([p({type:String,attribute:"base-type"})],I.prototype,"baseType",2),a([p({type:String,attribute:"external-scored"})],I.prototype,"externalScored",2),a([p({type:String})],I.prototype,"identifier",2),a([p({type:String})],I.prototype,"cardinality",2),a([
|
|
33
|
+
`],a([p({type:String,attribute:"base-type"})],I.prototype,"baseType",2),a([p({type:String,attribute:"external-scored"})],I.prototype,"externalScored",2),a([p({type:String})],I.prototype,"identifier",2),a([p({type:String})],I.prototype,"cardinality",2),a([Z({context:U,subscribe:!0}),E()],I.prototype,"itemContext",2),I=a([h("qti-outcome-declaration")],I);var ee=class extends ie{render(){var e,r;let t=(r=(e=this.itemContext)==null?void 0:e.variables.find(s=>s.identifier===this.identifier))==null?void 0:r.value;return d`${JSON.stringify(t,null,2)}`}connectedCallback(){super.connectedCallback();let t={baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping,value:null,type:"response",candidateResponse:null};t.value=this.defaultValues(t),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:t}}))}get correctResponse(){let t,e=this.querySelector("qti-correct-response");if(e){let r=e.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)t=r[0].textContent,r[0].remove();else if(this.cardinality!=="single"){t=[];for(let s=0;s<r.length;s++)t.push(r[s].textContent),r[s].remove()}}return t}get mapping(){return this.querySelector("qti-mapping")}};ee.styles=[b`
|
|
34
34
|
:host {
|
|
35
35
|
display: none;
|
|
36
36
|
}
|
|
37
|
-
`],a([p({type:String,attribute:"base-type"})],
|
|
37
|
+
`],a([p({type:String,attribute:"base-type"})],ee.prototype,"baseType",2),a([p({type:String})],ee.prototype,"identifier",2),a([p({type:String})],ee.prototype,"cardinality",2),a([Z({context:U,subscribe:!0}),E()],ee.prototype,"itemContext",2),ee=a([h("qti-response-declaration")],ee);var wt=class extends g{};wt=a([h("qti-companion-materials-info")],wt);var Tt=class extends g{render(){return d`<slot></slot>`}};Tt=a([h("qti-content-body")],Tt);var F=class extends g{handleclassNamesChange(t,e){this.classNames.split(" ").forEach(s=>{switch(s){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return d`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};F.styles=b`
|
|
38
38
|
:host {
|
|
39
39
|
display: block;
|
|
40
40
|
}
|
|
41
|
-
`,a([p({type:String})],F.prototype,"id",2),a([p({type:String})],F.prototype,"use",2),a([p({type:String})],F.prototype,"view",2),a([p({type:String,attribute:"class"})],F.prototype,"classNames",2),a([
|
|
41
|
+
`,a([p({type:String})],F.prototype,"id",2),a([p({type:String})],F.prototype,"use",2),a([p({type:String})],F.prototype,"view",2),a([p({type:String,attribute:"class"})],F.prototype,"classNames",2),a([S("classNames",{waitUntilFirstUpdate:!0})],F.prototype,"handleclassNamesChange",1),F=a([h("qti-rubric-block")],F);var si=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Be=i=>{if(typeof i=="string")return i;let t=si();return t==="."?i.toLocaleString():i.toString().replace(".","").replace(t,".")};function or(i){return i==null}function je(i){return i.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var N=class extends g{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(t){let e=this.closest("qti-assessment-item").getOutcome(t);if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!or(this.identifier)&&!or(e==null?void 0:e.value)&&this.identifier===e.value||!1,this.showFeedback(r)}showFeedback(t){this.showStatus=t&&this.showHide==="show"||!t&&this.showHide==="hide"?"on":"off"}};a([p({type:String,attribute:"show-hide"})],N.prototype,"showHide",2),a([p({type:String,attribute:"outcome-identifier"})],N.prototype,"outcomeIdentifier",2),a([p({type:String})],N.prototype,"identifier",2),a([p({type:String,attribute:!1})],N.prototype,"showStatus",2);var Xe=class extends N{render(){return d` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}firstUpdated(t){this.checkShowFeedback(this.outcomeIdentifier)}};Xe.styles=b`
|
|
42
42
|
:host {
|
|
43
43
|
display: block;
|
|
44
44
|
}
|
|
@@ -48,21 +48,21 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
48
48
|
.off {
|
|
49
49
|
display: none;
|
|
50
50
|
}
|
|
51
|
-
`,Xe=a([h("qti-feedback-block")],Xe);var Ye=class extends
|
|
51
|
+
`,Xe=a([h("qti-feedback-block")],Xe);var Ye=class extends N{constructor(){super(...arguments);this.render=()=>d` <slot part="feedback" class="${this.showStatus}"></slot> `}};Ye.styles=b`
|
|
52
52
|
.on {
|
|
53
53
|
display: inline-block;
|
|
54
54
|
}
|
|
55
55
|
.off {
|
|
56
56
|
display: none;
|
|
57
57
|
}
|
|
58
|
-
`,Ye=a([h("qti-feedback-inline")],Ye);var ze=class extends
|
|
58
|
+
`,Ye=a([h("qti-feedback-inline")],Ye);var ze=class extends N{constructor(){super(...arguments);this.render=()=>d` <slot part="feedback" class="${this.showStatus}"></slot> `}};ze.styles=b`
|
|
59
59
|
.on {
|
|
60
60
|
display: inline-block;
|
|
61
61
|
}
|
|
62
62
|
.off {
|
|
63
63
|
display: none;
|
|
64
64
|
}
|
|
65
|
-
`,ze=a([h("qti-modal-feedback")],ze);var B=i=>i!=null?i:
|
|
65
|
+
`,ze=a([h("qti-modal-feedback")],ze);var B=i=>i!=null?i:A;var q=class extends g{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:Array.isArray(e)?[...e]:e}}))}};a([p({attribute:"response-identifier"})],q.prototype,"responseIdentifier",2),a([p({reflect:!0,type:Boolean})],q.prototype,"disabled",2),a([p({reflect:!0,type:Boolean})],q.prototype,"readonly",2);var{I:ii}=os;var ms=i=>i.strings===void 0,hs=()=>document.createComment(""),we=(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(hs(),s),l=r.insertBefore(hs(),s);e=new ii(o,l,i,i.options)}else{let o=e._$AB.nextSibling,l=e._$AM,c=l!==i;if(c){let u;(n=e._$AQ)==null||n.call(e,i),e._$AM=i,e._$AP!==void 0&&(u=i._$AU)!==l._$AU&&e._$AP(u)}if(o!==s||c){let u=e._$AA;for(;u!==o;){let m=u.nextSibling;r.insertBefore(u,s),u=m}}}return e},oe=(i,t,e=i)=>(i._$AI(t,e),i),oi={},fs=(i,t=oi)=>i._$AH=t,gs=i=>i._$AH,St=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 ne={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},te=i=>(...t)=>({_$litDirective$:i,values:t}),j=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 We=(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),We(s,t);return!0},Rt=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)},bs=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),li(t)}};function ni(i){this._$AN!==void 0?(Rt(this),this._$AM=i,bs(this)):this._$AM=i}function ai(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++)We(r[n],!1),Rt(r[n]);else r!=null&&(We(r,!1),Rt(r));else We(this,i)}var li=i=>{var t,e;i.type==ne.CHILD&&((t=i._$AP)!=null||(i._$AP=ai),(e=i._$AQ)!=null||(i._$AQ=ni))},$t=class extends j{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),bs(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&&(We(this,t),Rt(this))}setValue(t){if(ms(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 kt=()=>new ar,ar=class{},nr=new WeakMap,vs=te(class extends $t{render(i){return A}update(i,[t]){var r;let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=(r=i.options)==null?void 0:r.host,this.rt(this.ct=i.element)),A}rt(i){var t;if(this.isConnected||(i=void 0),typeof this.Y=="function"){let e=(t=this.ht)!=null?t:globalThis,r=nr.get(e);r===void 0&&(r=new WeakMap,nr.set(e,r)),r.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),r.set(this.Y,i),i!==void 0&&this.Y.call(this.ht,i)}else this.Y.value=i}get lt(){var i,t,e;return typeof this.Y=="function"?(t=nr.get((i=this.ht)!=null?i:globalThis))==null?void 0:t.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var X=class extends q{constructor(){super(...arguments);this.textareaRef=kt();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`
|
|
66
66
|
/* PK: display host as block, else design will be collapsed */
|
|
67
67
|
:host {
|
|
68
68
|
display: block;
|
|
@@ -88,13 +88,12 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
88
88
|
?disabled="${this.disabled}"
|
|
89
89
|
?readonly="${this.readonly}"
|
|
90
90
|
.value=${this._value}
|
|
91
|
-
></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")}};a([p({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",2),a([p({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",2),a([p({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",2),a([E()],X.prototype,"_value",2),a([p({type:String,attribute:"class"})],X.prototype,"classNames",2),a([
|
|
91
|
+
></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")}};a([p({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",2),a([p({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",2),a([p({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",2),a([E()],X.prototype,"_value",2),a([p({type:String,attribute:"class"})],X.prototype,"classNames",2),a([S("classNames",{waitUntilFirstUpdate:!0})],X.prototype,"handleclassNamesChange",1),X=a([h("qti-extended-text-interaction")],X);function ys(i,t){let e,r=_({},t);return(s,n)=>{let{connectedCallback:o,disconnectedCallback:l}=s;s.connectedCallback=function(){var m;o.call(this);let c=f=>{let y=Array.from(this.querySelectorAll(i));for(let v of f){let C=Array.from(v.addedNodes).map(R=>R),w=Array.from(v.addedNodes).map(R=>R);v.type==="childList"&&C.find(R=>y.includes(R))&&this[n](C,w)}};e=new MutationObserver(c),e.observe(this,{childList:!0,subtree:!0});let u=(m=this.querySelectorAll(i))!=null?m:[];this[n](Array.from(u),[])},s.disconnectedCallback=function(){l.call(this),e.disconnect()}}}var P=class extends q{constructor(){super(...arguments);this._value="";this._correctValue="";this._size=5;this.inputRef=kt()}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`
|
|
92
92
|
[part='correct'] {
|
|
93
93
|
position: absolute;
|
|
94
94
|
width: 100%;
|
|
95
95
|
}
|
|
96
|
-
`]}set correctResponse(e){this._correctValue=e}render(){return d`
|
|
97
|
-
<div part="correct">${this._correctValue}</div>
|
|
96
|
+
`]}set correctResponse(e){this._correctValue=e}render(){return d`
|
|
98
97
|
<input
|
|
99
98
|
part="input"
|
|
100
99
|
spellcheck="false"
|
|
@@ -110,25 +109,26 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
110
109
|
?disabled="${this.disabled}"
|
|
111
110
|
?readonly="${this.readonly}"
|
|
112
111
|
/>
|
|
113
|
-
|
|
112
|
+
<div part="correct">${this._correctValue}</div>
|
|
113
|
+
`}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")}};a([p({type:Number,attribute:"expected-length"})],P.prototype,"expectedLength",2),a([p({type:String,attribute:"pattern-mask"})],P.prototype,"patternMask",2),a([p({type:String,attribute:"placeholder-text"})],P.prototype,"placeholderText",2),a([E()],P.prototype,"_value",2),a([E()],P.prototype,"_correctValue",2),a([E()],P.prototype,"_size",2),a([p({type:String,attribute:"class"})],P.prototype,"classNames",2),a([S("classNames")],P.prototype,"handleclassNamesChange",1),P=a([h("qti-text-entry-interaction")],P);var $=class extends q{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)}};a([p({type:Number,attribute:"min-choices"})],$.prototype,"minChoices",2),a([p({type:Number,attribute:"max-choices"})],$.prototype,"maxChoices",2),a([S("disabled",{waitUntilFirstUpdate:!0})],$.prototype,"_handleDisabledChange",2),a([S("readonly",{waitUntilFirstUpdate:!0})],$.prototype,"_handleReadonlyChange",2),a([S("maxChoices",{waitUntilFirstUpdate:!0})],$.prototype,"_handleMaxChoicesChange",2);var Mt=class extends ${constructor(){super(...arguments);this.render=()=>d`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};Mt=a([h("qti-hottext-interaction")],Mt);var Ke=class extends j{constructor(t){if(super(t),this.it=A,t.type!==ne.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===A||t==null)return this._t=void 0,this.it=t;if(t===L)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Ke.directiveName="unsafeHTML",Ke.resultType=1;var ae=te(Ke);var le=class extends q{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[b`
|
|
114
114
|
:host {
|
|
115
115
|
display: inline-block;
|
|
116
116
|
}
|
|
117
117
|
`]}render(){return d`
|
|
118
118
|
<select part="select" @change="${this.choiceSelected}" ?disabled="${this.disabled}" ?readonly="${this.readonly}">
|
|
119
119
|
${this.options.map(e=>d`
|
|
120
|
-
<option value="${e.value}" ?selected="${e.selected}">${
|
|
120
|
+
<option value="${e.value}" ?selected="${e.selected}">${ae(e.textContent)}</option>
|
|
121
121
|
`)}
|
|
122
122
|
</select>
|
|
123
123
|
|
|
124
|
-
${
|
|
125
|
-
`}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)=>T(_({},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=>T(_({},s),{selected:s.value===r})),this.saveResponse(r)}};
|
|
124
|
+
${ae(this.correctOption)}
|
|
125
|
+
`}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)=>T(_({},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=>T(_({},s),{selected:s.value===r})),this.saveResponse(r)}};le.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"],a([E()],le.prototype,"options",2),a([E()],le.prototype,"correctOption",2),a([p({attribute:"data-prompt",type:String})],le.prototype,"dataPrompt",2),le=a([h("qti-inline-choice-interaction")],le);var xs=b`
|
|
126
126
|
:host {
|
|
127
127
|
display: flex;
|
|
128
128
|
flex-direction: column;
|
|
129
129
|
// align-items: flex-start;
|
|
130
130
|
}
|
|
131
|
-
`;var Te=class extends
|
|
131
|
+
`;var Te=class extends ${render(){return d` <slot name="prompt"></slot><slot part="slot"></slot>`}};Te.styles=xs,a([p({type:String})],Te.prototype,"orientation",2),Te=a([h("qti-choice-interaction")],Te);var Je=class extends g{render(){return d`<slot></slot>`}process(){let t=new lr,e=[...this.children];t.process(e)}};Je.styles=[b`
|
|
132
132
|
:host {
|
|
133
133
|
display: none;
|
|
134
134
|
}
|
|
@@ -181,24 +181,24 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
181
181
|
</qti-set-outcome-value>
|
|
182
182
|
</qti-response-else>
|
|
183
183
|
</qti-response-condition>
|
|
184
|
-
</qti-response-processing>`;var
|
|
184
|
+
</qti-response-processing>`;var be=class extends g{render(){return d`<slot></slot>`}process(){let t=[...this.children];for(let e of t)e.process()}firstUpdated(t){if(this.getAttribute("template")){let e=this.getAttribute("template").split("/"),r=e[e.length-1].replace(".xml","");switch(this.innerHTML="",r){case"map_response":{this.appendChild(this.fragmentFromString(_s).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(this.fragmentFromString(Cs).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(this.fragmentFromString(Es).firstElementChild.firstElementChild);break}}}fragmentFromString(t){return document.createRange().createContextualFragment(t)}};be.styles=[b`
|
|
185
185
|
:host {
|
|
186
186
|
display: none;
|
|
187
187
|
}
|
|
188
|
-
`],
|
|
188
|
+
`],be=a([h("qti-response-processing")],be);var Y=class extends g{render(){return d`<slot></slot>`}process(){throw new Error("Not implemented")}};Y=a([h("qti-rule")],Y);var Lt=class extends Y{get childExpression(){return this.firstElementChild}process(){let t=this.getAttribute("identifier"),e=this.closest("qti-assessment-item").getVariable(t),r;return e.interpolationTable&&(r=e.interpolationTable.get(parseInt(this.childExpression.calculate()))),r==null?(console.warn("lookupOutcomeValue: value is null or undefined"),0):(this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:this.identifier,value:Be(r)}})),r)}};a([p({type:String})],Lt.prototype,"identifier",2);customElements.define("qti-lookup-outcome-value",Lt);var cr=class extends Y{render(){return d`<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",cr);var pr=class extends Y{process(){let t=this.getAttribute("identifier"),e=this.firstElementChild,s=new dr(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:Array.isArray(s)?s.map(n=>Be(n)):Be(s)}}))}},dr=class{constructor(t){this.expression=t}process(){let t=this.expression?this.expression.calculate():null;if(t==null){console.warn("setOutcomeValue: value is null or undefined");return}return t}};customElements.define("qti-set-outcome-value",pr);var Ze=class extends g{render(){return d`<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",Ze);var Ge=class extends Ze{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",Ge);var ur=class extends Ge{render(){return d`${super.render()}`}};customElements.define("qti-response-else-if",ur);var x=class extends g{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 d`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
189
189
|
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}get assessmentItem(){return this.closest("qti-assessment-item")}};x.styles=b`
|
|
190
190
|
slot {
|
|
191
191
|
display: none;
|
|
192
192
|
}
|
|
193
|
-
`,a([E()],x.prototype,"result",2);var V=class extends x{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Nt=class extends ci(V){calculate(){return this.calculateChildren(Array.from(this.children))}};function ci(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",Nt);var Ht=class extends x{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent}};a([p({type:String,attribute:"base-type"})],Ht.prototype,"baseType",2);customElements.define("qti-base-value",Ht);var hr=class extends V{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",hr);var mr=class extends x{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",mr);var Pt=class extends x{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}};a([p({type:String})],Pt.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Pt);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 x{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}};a([p({type:String})],Vt.prototype,"toleranceMode",2);customElements.define("qti-equal",Vt);var fr=class extends x{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",fr);var gr=class extends V{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",gr);var br=class extends x{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",br);var vr=class extends x{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",vr);var yr=class extends V{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",yr);var Dt=class extends x{getResult(){let t=this.assessmentItem.getResponse(this.identifier);if(!t)return console.warn(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],s=0;for(let n of r){let o=e.mapEntries.find(l=>D.compareSingleValues(l.mapKey,n,t.baseType));o==null||o.mappedValue==null?s+=e.defaultValue:s+=o.mappedValue}return e.lowerBound!=null&&(s=Math.max(e.lowerBound,s)),e.upperBound!=null&&(s=Math.min(e.upperBound,s)),s}};a([p({type:String})],Dt.prototype,"identifier",2);customElements.define("qti-map-response",Dt);var $e=class extends g{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")}))}};a([p({attribute:"default-value",type:Number})],$e.prototype,"defaultValue",2),a([p({attribute:"lower-bound",type:Number})],$e.prototype,"lowerBound",2),a([p({attribute:"upper-bound",type:Number})],$e.prototype,"upperBound",2);customElements.define("qti-mapping",$e);var xr=class i extends x{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 l of t.value)if(D.compareSingleValues(n,l,e.baseType)){o=l;break}if(o!==null)t.value.splice(t.value.indexOf(o),1);else return!1}s++}return!0}}};customElements.define("qti-match",xr);var Er=class extends x{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",Er);var _r=class extends x{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",_r);var Cr=class extends x{render(){return d`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",Cr);var qr=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();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",qr);var Ar=class extends x{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",Ar);var Qe=class extends g{render(){var e,r;let t=(r=(e=this.itemContext)==null?void 0:e.variables.find(s=>s.identifier===this.identifier))==null?void 0:r.value;return d`${JSON.stringify(t,null,2)}`}calculate(){let t=this.closest("qti-assessment-item"),e=this.identifier;return t.getVariable(e).value}};a([p({type:String})],Qe.prototype,"identifier",2),a([J({context:U,subscribe:!0}),E()],Qe.prototype,"itemContext",2);customElements.define("qti-printed-variable",Qe);var wr=class extends x{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",wr);var Ot=class extends x{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}};a([p({type:String,attribute:"case-sensitive"})],Ot.prototype,"caseSensitive",2);customElements.define("qti-string-match",Ot);var Tr=class extends x{constructor(){super(),this._expression=new $r(Array.from(this.children))}getResult(){return this._expression.calculate()}},$r=class{constructor(t){this.expressions=t}calculate(){return this.expressions.map(e=>{if(!e.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=e.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((e,r)=>e+r,0)}};customElements.define("qti-sum",Tr);var Sr=class extends x{getResult(){let t=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(t).value}};customElements.define("qti-variable",Sr);var ae=class extends q{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async(e,r)=>{e=this.removeDoubleSlashes(e);try{let s=await fetch(e);if(s.ok){let o=await s.json();for(let l in o.paths)r&&(o.paths[l]=this.getResolvablePath(o.paths[l],r));return o}}catch(s){}return null};this.getResolvablePath=(e,r)=>e!=null&&e.toLocaleLowerCase().startsWith("http")||!r?e:this.removeDoubleSlashes(`${r}/${e}`);this.mergeConfigs=async(e,r,s)=>{var n;for(let o in r==null?void 0:r.paths)if(!e.paths[o]){let l=!1;try{let c=(n=r.paths[o])!=null&&n.toLocaleLowerCase().endsWith(".js")?r.paths[o]:r.paths[o]+".js";(await fetch(c)).ok?e.paths[o]=r.paths[o].replace(/\.js$/,""):l=!0}catch(c){l=!0}if(l&&s)if(typeof s=="string")try{let c=await this.loadConfig(s);c!=null&&c.paths[o]&&(e.paths[o]=c.paths[o].replace(/\.js$/,""))}catch(c){}else typeof s=="object"&&s!=null&&s.paths[o]&&(e.paths[o]=s.paths[o].replace(/\.js$/,""));else l&&console.error("Failed to resolve module: "+o)}}}convertQtiVariableJSON(e){for(let r in e)if(e.hasOwnProperty(r)){let s=e[r];if(s){for(let n in s)if(s.hasOwnProperty(n)){let o=s[n];if(Array.isArray(o))return o.map(String);if(o!=null)return String(o)}}}return null}startChecking(){this.intervalId=setInterval(()=>{let e=this.pci.getResponse(),r=this.pci.getResponse(),s=JSON.stringify(e);if(s!==this.rawResponse){this.rawResponse=s;let n=this.convertQtiVariableJSON(r);this.response=n,this.saveResponse(n)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set response(e){}getTAOConfig(e){let r=e.querySelectorAll("properties"),s={},n=l=>{let c={},u=l.getAttribute("key");if(u){let m=Array.from(l.children),f=m.map(v=>v.getAttribute("key"));f.length>0&&!f.find(v=>!Number.isInteger(+v))?c[u]=m.map(v=>o(v)):c[u]=l.textContent}return c},o=l=>{if(l){let c={};for(let u of l.children)c=_(_({},c),n(u));return c}};for(let l of r)return l.getAttribute("key")||(s=_(_({},s),o(l))),s;return console.log("Can not find qti-custom-interaction config"),null}register(e){this.pci=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,onready:()=>{console.log("onready")}}: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(l=>l.getAttribute("href")).forEach(l=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=l,s.appendChild(c)}),this.startChecking()}connectedCallback(){super.connectedCallback();let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:{}};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}this.registerModules(e).then(()=>{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})})}disconnectedCallback(){super.disconnectedCallback(),this.stopChecking()}async registerModules(e){let r=this.getAttribute("data-base-url");if(r){let n=`${r}/modules/module_resolution.js`,o=`${r}/modules/module_resolution_fallback.js`;if(n){let l=await this.loadConfig(n,r);await this.mergeConfigs(e,l,o)}}let s=this.querySelector("qti-interaction-modules");if(s){let n=s.querySelectorAll("qti-interaction-module");for(let o of n){let l=o.getAttribute("id"),c=o.getAttribute("primary-path"),u=o.getAttribute("fallback-path"),m=c?{paths:T(_({},e.paths),{[l]:this.getResolvablePath(c,r)})}:null,f=u?{paths:T(_({},e.paths),{[l]:this.getResolvablePath(u,r)})}:null;l&&m&&await this.mergeConfigs(e,m,f)}}}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return d`<slot></slot>${this._errorMessage&&d`<div style="color:red">
|
|
193
|
+
`,a([E()],x.prototype,"result",2);var V=class extends x{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var Ht=class extends ci(V){calculate(){return this.calculateChildren(Array.from(this.children))}};function ci(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",Ht);var Nt=class extends x{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent}};a([p({type:String,attribute:"base-type"})],Nt.prototype,"baseType",2);customElements.define("qti-base-value",Nt);var hr=class extends V{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",hr);var mr=class extends x{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",mr);var Pt=class extends x{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}};a([p({type:String})],Pt.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Pt);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 x{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}};a([p({type:String})],Vt.prototype,"toleranceMode",2);customElements.define("qti-equal",Vt);var fr=class extends x{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",fr);var gr=class extends V{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",gr);var br=class extends x{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",br);var vr=class extends x{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",vr);var yr=class extends V{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",yr);var Dt=class extends x{getResult(){let t=this.assessmentItem.getResponse(this.identifier);if(!t)return console.warn(`Response ${this.identifier} can not be found`),null;let e=t.mapping,r=Array.isArray(t.value)?t.value:[t.value],s=0;for(let n of r){let o=e.mapEntries.find(l=>D.compareSingleValues(l.mapKey,n,t.baseType));o==null||o.mappedValue==null?s+=e.defaultValue:s+=o.mappedValue}return e.lowerBound!=null&&(s=Math.max(e.lowerBound,s)),e.upperBound!=null&&(s=Math.min(e.upperBound,s)),s}};a([p({type:String})],Dt.prototype,"identifier",2);customElements.define("qti-map-response",Dt);var Se=class extends g{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")}))}};a([p({attribute:"default-value",type:Number})],Se.prototype,"defaultValue",2),a([p({attribute:"lower-bound",type:Number})],Se.prototype,"lowerBound",2),a([p({attribute:"upper-bound",type:Number})],Se.prototype,"upperBound",2);customElements.define("qti-mapping",Se);var xr=class i extends x{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,l=[...t.value];for(let c of l)if(D.compareSingleValues(n,c,e.baseType)){o=c;break}if(o!==null)l.splice(l.indexOf(o),1);else return!1}s++}return!0}}};customElements.define("qti-match",xr);var Er=class extends x{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",Er);var _r=class extends x{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",_r);var Cr=class extends x{render(){return d`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",Cr);var Ar=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();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",Ar);var qr=class extends x{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",qr);var Qe=class extends g{render(){var e,r;let t=(r=(e=this.itemContext)==null?void 0:e.variables.find(s=>s.identifier===this.identifier))==null?void 0:r.value;return d`${JSON.stringify(t,null,2)}`}calculate(){let t=this.closest("qti-assessment-item"),e=this.identifier;return t.getVariable(e).value}};a([p({type:String})],Qe.prototype,"identifier",2),a([Z({context:U,subscribe:!0}),E()],Qe.prototype,"itemContext",2);customElements.define("qti-printed-variable",Qe);var wr=class extends x{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",wr);var Ot=class extends x{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}};a([p({type:String,attribute:"case-sensitive"})],Ot.prototype,"caseSensitive",2);customElements.define("qti-string-match",Ot);var Tr=class extends x{constructor(){super(),this._expression=new Sr(Array.from(this.children))}getResult(){return this._expression.calculate()}},Sr=class{constructor(t){this.expressions=t}calculate(){return this.expressions.map(e=>{if(!e.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=e.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((e,r)=>e+r,0)}};customElements.define("qti-sum",Tr);var Rr=class extends x{getResult(){let t=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(t).value}};customElements.define("qti-variable",Rr);var ce=class extends q{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async(e,r)=>{e=this.removeDoubleSlashes(e);try{let s=await fetch(e);if(s.ok){let o=await s.json();for(let l in o.paths)r&&(o.paths[l]=this.getResolvablePath(o.paths[l],r));return o}}catch(s){}return null};this.getResolvablePath=(e,r)=>e!=null&&e.toLocaleLowerCase().startsWith("http")||!r?e:this.removeDoubleSlashes(`${r}/${e}`);this.mergeConfigs=async(e,r,s)=>{var n;for(let o in r==null?void 0:r.paths)if(!e.paths[o]){let l=!1;try{let c=(n=r.paths[o])!=null&&n.toLocaleLowerCase().endsWith(".js")?r.paths[o]:r.paths[o]+".js";(await fetch(c)).ok?e.paths[o]=r.paths[o].replace(/\.js$/,""):l=!0}catch(c){l=!0}if(l&&s)if(typeof s=="string")try{let c=await this.loadConfig(s);c!=null&&c.paths[o]&&(e.paths[o]=c.paths[o].replace(/\.js$/,""))}catch(c){}else typeof s=="object"&&s!=null&&s.paths[o]&&(e.paths[o]=s.paths[o].replace(/\.js$/,""));else l&&console.error("Failed to resolve module: "+o)}}}convertQtiVariableJSON(e){for(let r in e)if(e.hasOwnProperty(r)){let s=e[r];if(s){for(let n in s)if(s.hasOwnProperty(n)){let o=s[n];if(Array.isArray(o))return o.map(String);if(o!=null)return String(o)}}}return null}startChecking(){this.intervalId=setInterval(()=>{let e=this.pci.getResponse(),r=this.pci.getResponse(),s=JSON.stringify(e);if(s!==this.rawResponse){this.rawResponse=s;let n=this.convertQtiVariableJSON(r);this.response=n,this.saveResponse(n)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set response(e){}getTAOConfig(e){let r=e.querySelectorAll("properties"),s={},n=l=>{let c={},u=l.getAttribute("key");if(u){let m=Array.from(l.children),f=m.map(v=>v.getAttribute("key"));f.length>0&&!f.find(v=>!Number.isInteger(+v))?c[u]=m.map(v=>o(v)):c[u]=l.textContent}return c},o=l=>{if(l){let c={};for(let u of l.children)c=_(_({},c),n(u));return c}};for(let l of r)return l.getAttribute("key")||(s=_(_({},s),o(l))),s;return console.log("Can not find qti-custom-interaction config"),null}register(e){this.pci=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,onready:()=>{console.log("onready")}}: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(l=>l.getAttribute("href")).forEach(l=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=l,s.appendChild(c)}),this.startChecking()}connectedCallback(){super.connectedCallback();let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:{}};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}this.registerModules(e).then(()=>{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})})}disconnectedCallback(){super.disconnectedCallback(),this.stopChecking()}async registerModules(e){let r=this.getAttribute("data-base-url");if(r){let n=`${r}/modules/module_resolution.js`,o=`${r}/modules/module_resolution_fallback.js`;if(n){let l=await this.loadConfig(n,r);await this.mergeConfigs(e,l,o)}}let s=this.querySelector("qti-interaction-modules");if(s){let n=s.querySelectorAll("qti-interaction-module");for(let o of n){let l=o.getAttribute("id"),c=o.getAttribute("primary-path"),u=o.getAttribute("fallback-path"),m=c?{paths:T(_({},e.paths),{[l]:this.getResolvablePath(c,r)})}:null,f=u?{paths:T(_({},e.paths),{[l]:this.getResolvablePath(u,r)})}:null;l&&m&&await this.mergeConfigs(e,m,f)}}}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return d`<slot></slot>${this._errorMessage&&d`<div style="color:red">
|
|
194
194
|
<h1>Error</h1>
|
|
195
195
|
${this._errorMessage}
|
|
196
|
-
</div>`}`}};a([p({type:String,attribute:"response-identifier"})],ae.prototype,"responseIdentifier",2),a([p({type:String,attribute:"module"})],ae.prototype,"module",2),a([p({type:String,attribute:"custom-interaction-type-identifier"})],ae.prototype,"customInteractionTypeIdentifier",2),a([E()],ae.prototype,"_errorMessage",2),ae=a([h("qti-portable-custom-interaction")],ae);var Ut=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 qs=(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 l=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),l.forEach(c=>{c.setAttribute("dropzone","move"),c.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(c)});for(let c of l)this.observer=new MutationObserver(u=>{u.forEach(m=>{if(m.type==="attributes")switch(m.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 l=o.currentTarget,c=this.querySelector(`[identifier=${o.dataTransfer.getData("text")}`),u=c||this.shadowRoot.querySelector(`[identifier=${o.dataTransfer.getData("text")}`);return l?u.parentElement.getAttribute("identifier")!==l.getAttribute("identifier")&&l.appendChild(u):console.error(`cannot find droppable, target: ${o.target?JSON.stringify(o.target):"null"}`),l.removeAttribute("active"),!1}dragleaveHandler(o){return o.preventDefault(),o.currentTarget.removeAttribute("active"),o.dataTransfer.dropEffect="none",!1}}return a([p({type:Boolean,reflect:!0})],r.prototype,"disabled",2),r};var As=(i,t,e)=>{class r extends i{}return r};var z=(i,t,e,r)=>{class s extends As(qs(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(l,c){if(this.classList.contains("qti-match-tabular"))return;l.filter(m=>!this.draggables||!this.draggables.get(m)).length>0&&(this.dragDropApi.addDraggables(l),l.forEach(m=>{this.draggables.set(m,{parent:m.parentElement,index:Array.from(m.parentNode.children).indexOf(m)}),m.setAttribute("qti-draggable","true"),m.addEventListener("dragstart",f=>{f.dataTransfer.setData("text",f.currentTarget.getAttribute("identifier")),m.setAttribute("dragging","")}),m.addEventListener("dragend",f=>{if(f.preventDefault(),m.removeAttribute("over"),m.removeAttribute("dragging"),(f.dataTransfer.dropEffect==="none"||f.dataTransfer.dropEffect===void 0)&&this.configuration.dragCanBePlacedBack){let y=f.currentTarget,v=this.draggables.get(y),w=v.index<v.parent.children.length?v.index:v.parent.children.length-1,A=v.parent,S=v.parent.children[w];A.insertBefore(y,S),this.saveResponse(),this.checkMaxMatchAssociations()}f.dataTransfer.dropEffect==="move"&&(this.saveResponse(),this.checkMaxMatchAssociations())})}))}handleDragOptionsChanged(l,c){this.dragDropApi.copyStylesDragClone=c.copyStylesDragClone,this.dragDropApi.dragOnClick=c.dragOnClick}handleDisabledChange(l,c){this.draggables.forEach((u,m)=>{c?m.setAttribute("disabled",""):m.removeAttribute("disabled"),c?m.removeAttribute("qti-draggable"):m.setAttribute("qti-draggable","true")})}handleReadonlyChange(l,c){this.draggables.forEach((u,m)=>{c?m.setAttribute("readonly",""):m.removeAttribute("readonly"),c?m.removeAttribute("qti-draggable"):m.setAttribute("qti-draggable","true")})}firstUpdated(l){super.firstUpdated(l),this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(r):this.querySelectorAll(r))}connectedCallback(){super.connectedCallback(),this.dragDropApi=new Ut,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}reset(l=!0){this.draggables.forEach((c,u)=>{let m=c.parent.children,f=c.index<m.length?c.index:m.length;c.parent.insertBefore(u,m[f])}),l&&this.saveResponse()}checkMaxMatchAssociations(){this.droppables.forEach(l=>{let u=+(l.getAttribute("match-max")||1)<=(l.children.length||0);u?l.setAttribute("disabled",""):l.removeAttribute("disabled"),u?l.removeAttribute("dropzone"):l.setAttribute("dropzone","move")})}set response(l){this.classList.contains("qti-match-tabular")||(this.reset(!1),l!==null&&Array.isArray(l)&&l.forEach(c=>{let[u,...m]=c.split(" ").reverse();if(u){let f=this.droppables.find(y=>y.getAttribute("identifier")===u);m.forEach(y=>{let v=this.querySelector(`[identifier=${y}]`);f?v?(f.appendChild(v),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 l=this.droppables.map(c=>{var m;let u="";return((m=c.children)==null?void 0:m.length)>0&&(u+=Array.from(c.children).map(f=>f.getAttribute("identifier")).join(" ")+" "),u+=c.getAttribute("identifier"),u});this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:l}}))}}return a([ys(t)],s.prototype,"reInitDragAndDrop",1),a([p({type:String,attribute:"response-identifier"})],s.prototype,"responseIdentifier",2),a([p({attribute:!1,type:Object})],s.prototype,"configuration",2),a([$("configuration")],s.prototype,"handleDragOptionsChanged",1),a([p({type:Boolean,reflect:!0})],s.prototype,"disabled",2),a([$("disabled",{waitUntilFirstUpdate:!0})],s.prototype,"handleDisabledChange",1),a([p({type:Boolean,reflect:!0})],s.prototype,"readonly",2),a([$("readonly",{waitUntilFirstUpdate:!0})],s.prototype,"handleReadonlyChange",1),a([p({type:Number,reflect:!0,attribute:"min-associations"})],s.prototype,"minAssociations",2),a([p({type:Number,reflect:!0,attribute:"max-associations"})],s.prototype,"maxAssociations",2),s};var Se=class extends z(g,"qti-simple-associable-choice",!0,".dl"){render(){return d` <slot name="prompt"></slot>
|
|
196
|
+
</div>`}`}};a([p({type:String,attribute:"response-identifier"})],ce.prototype,"responseIdentifier",2),a([p({type:String,attribute:"module"})],ce.prototype,"module",2),a([p({type:String,attribute:"custom-interaction-type-identifier"})],ce.prototype,"customInteractionTypeIdentifier",2),a([E()],ce.prototype,"_errorMessage",2),ce=a([h("qti-portable-custom-interaction")],ce);var Ut=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 As=(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 l=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),l.forEach(c=>{c.setAttribute("dropzone","move"),c.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(c)});for(let c of l)this.observer=new MutationObserver(u=>{u.forEach(m=>{if(m.type==="attributes")switch(m.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 l=o.currentTarget,c=this.querySelector(`[identifier=${o.dataTransfer.getData("text")}`),u=c||this.shadowRoot.querySelector(`[identifier=${o.dataTransfer.getData("text")}`);return l?u.parentElement.getAttribute("identifier")!==l.getAttribute("identifier")&&l.appendChild(u):console.error(`cannot find droppable, target: ${o.target?JSON.stringify(o.target):"null"}`),l.removeAttribute("active"),!1}dragleaveHandler(o){return o.preventDefault(),o.currentTarget.removeAttribute("active"),o.dataTransfer.dropEffect="none",!1}}return a([p({type:Boolean,reflect:!0})],r.prototype,"disabled",2),r};var qs=(i,t,e)=>{class r extends i{}return r};var z=(i,t,e,r)=>{class s extends qs(As(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(l,c){if(this.classList.contains("qti-match-tabular"))return;l.filter(m=>!this.draggables||!this.draggables.get(m)).length>0&&(this.dragDropApi.addDraggables(l),l.forEach(m=>{this.draggables.set(m,{parent:m.parentElement,index:Array.from(m.parentNode.children).indexOf(m)}),m.setAttribute("qti-draggable","true"),m.addEventListener("dragstart",f=>{f.dataTransfer.setData("text",f.currentTarget.getAttribute("identifier")),m.setAttribute("dragging","")}),m.addEventListener("dragend",f=>{if(f.preventDefault(),m.removeAttribute("over"),m.removeAttribute("dragging"),(f.dataTransfer.dropEffect==="none"||f.dataTransfer.dropEffect===void 0)&&this.configuration.dragCanBePlacedBack){let y=f.currentTarget,v=this.draggables.get(y),C=v.index<v.parent.children.length?v.index:v.parent.children.length-1,w=v.parent,R=v.parent.children[C];w.insertBefore(y,R),this.saveResponse(),this.checkMaxMatchAssociations()}f.dataTransfer.dropEffect==="move"&&(this.saveResponse(),this.checkMaxMatchAssociations())})}))}handleDragOptionsChanged(l,c){this.dragDropApi.copyStylesDragClone=c.copyStylesDragClone,this.dragDropApi.dragOnClick=c.dragOnClick}handleDisabledChange(l,c){this.draggables.forEach((u,m)=>{c?m.setAttribute("disabled",""):m.removeAttribute("disabled"),c?m.removeAttribute("qti-draggable"):m.setAttribute("qti-draggable","true")})}handleReadonlyChange(l,c){this.draggables.forEach((u,m)=>{c?m.setAttribute("readonly",""):m.removeAttribute("readonly"),c?m.removeAttribute("qti-draggable"):m.setAttribute("qti-draggable","true")})}firstUpdated(l){super.firstUpdated(l),this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(r):this.querySelectorAll(r))}connectedCallback(){super.connectedCallback(),this.dragDropApi=new Ut,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}reset(l=!0){this.draggables.forEach((c,u)=>{let m=c.parent.children,f=c.index<m.length?c.index:m.length;c.parent.insertBefore(u,m[f])}),l&&this.saveResponse()}checkMaxMatchAssociations(){this.droppables.forEach(l=>{let u=+(l.getAttribute("match-max")||1)<=(l.children.length||0);u?l.setAttribute("disabled",""):l.removeAttribute("disabled"),u?l.removeAttribute("dropzone"):l.setAttribute("dropzone","move")})}set response(l){this.classList.contains("qti-match-tabular")||(this.reset(!1),l!==null&&Array.isArray(l)&&l.forEach(c=>{let[u,...m]=c.split(" ").reverse();if(u){let f=this.droppables.find(y=>y.getAttribute("identifier")===u);m.forEach(y=>{let v=this.querySelector(`[identifier=${y}]`);f?v?(f.appendChild(v),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 l=this.droppables.map(c=>{var m;let u="";return((m=c.children)==null?void 0:m.length)>0&&(u+=Array.from(c.children).map(f=>f.getAttribute("identifier")).join(" ")+" "),u+=c.getAttribute("identifier"),u});this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:l}}))}}return a([ys(t)],s.prototype,"reInitDragAndDrop",1),a([p({type:String,attribute:"response-identifier"})],s.prototype,"responseIdentifier",2),a([p({attribute:!1,type:Object})],s.prototype,"configuration",2),a([S("configuration")],s.prototype,"handleDragOptionsChanged",1),a([p({type:Boolean,reflect:!0})],s.prototype,"disabled",2),a([S("disabled",{waitUntilFirstUpdate:!0})],s.prototype,"handleDisabledChange",1),a([p({type:Boolean,reflect:!0})],s.prototype,"readonly",2),a([S("readonly",{waitUntilFirstUpdate:!0})],s.prototype,"handleReadonlyChange",1),a([p({type:Number,reflect:!0,attribute:"min-associations"})],s.prototype,"minAssociations",2),a([p({type:Number,reflect:!0,attribute:"max-associations"})],s.prototype,"maxAssociations",2),s};var Re=class extends z(g,"qti-simple-associable-choice",!0,".dl"){render(){return d` <slot name="prompt"></slot>
|
|
197
197
|
<slot name="qti-simple-associable-choice"></slot>
|
|
198
198
|
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((t,e)=>d`<div part="associables-container">
|
|
199
199
|
<div name="left${e}" part="drop-list" class="dl" identifier="droplist${e}_left"></div>
|
|
200
200
|
<div name="right${e}" part="drop-list" class="dl" identifier="droplist${e}_right"></div>
|
|
201
|
-
</div>`)}`}connectedCallback(){super.connectedCallback(),this._childrenMap=Array.from(this.querySelectorAll("qti-simple-associable-choice"))}};
|
|
201
|
+
</div>`)}`}connectedCallback(){super.connectedCallback(),this._childrenMap=Array.from(this.querySelectorAll("qti-simple-associable-choice"))}};Re.styles=b`
|
|
202
202
|
:host {
|
|
203
203
|
display: block; /* necessary to calculate scaling position */
|
|
204
204
|
}
|
|
@@ -207,7 +207,7 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
207
207
|
flex-wrap: wrap;
|
|
208
208
|
gap: 0.5rem;
|
|
209
209
|
}
|
|
210
|
-
`,a([E()],
|
|
210
|
+
`,a([E()],Re.prototype,"_childrenMap",2),Re=a([h("qti-associate-interaction")],Re);var W=class extends q{constructor(){super();this._errorMessage=null;this.handlePostMessage=this.handlePostMessage.bind(this)}connectedCallback(){super.connectedCallback();let e=this.data.startsWith("http")?this.data:je(this.baseItemUrl+"/"+this.data);fetch(e).then(r=>r.json()).then(r=>{this.manifest=r,this.setupCES()}).catch(r=>{this._errorMessage=r})}setupCES(){let e=this.shadowRoot.querySelector("#pciContainer"),r=e.contentWindow||e,s=e.contentDocument;window.addEventListener("message",this.handlePostMessage),s.open(),s.write(`
|
|
211
211
|
<html>
|
|
212
212
|
<head>
|
|
213
213
|
<link href='${je(`${this.baseRefUrl}/${this.manifest.style[0]}`)}' rel="stylesheet" />
|
|
@@ -215,7 +215,7 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
215
215
|
</head>
|
|
216
216
|
<body></body>
|
|
217
217
|
</html>
|
|
218
|
-
`),s.close()}validate(){return this.rawResponse!==""}set response(e){this.rawResponse=e}disconnectedCallback(){this.
|
|
218
|
+
`),s.close()}getIFrames(){let e=this.shadowRoot.querySelectorAll("iframe"),r=this.querySelectorAll("iframe"),s=[...e,...r];for(let n of s){let o=n.src;if(new URL(o,window.location.href).origin===window.location.origin)try{let c=n.contentDocument||n.contentWindow.document;c&&this.getInnerIFrames(c,s)}catch(c){console.error("Error accessing nested iframe:",c)}}return s.forEach((n,o)=>{s.indexOf(n)!==o&&s.splice(o,1)}),s}getInnerIFrames(e,r=[]){return e.querySelectorAll("iframe").forEach(n=>{r.push(n);let o=n.src;if(new URL(o,window.location.href).origin===window.location.origin)try{let c=n.contentDocument||n.contentWindow.document;this.getInnerIFrames(c,r)}catch(c){console.error("Error accessing nested iframe:",c)}else console.warn("Skipped cross-origin iframe:",o)}),r}postToWindowAndIframes(e,r){window.postMessage({type:e,data:r},"*");let s=this.getIFrames();for(let n of s)n.contentWindow&&n.contentWindow.postMessage({type:e,data:r},"*")}handlePostMessage(e){let{type:r,data:s}=e.data;switch(r){case"setResponse":this.rawResponse=s,this.saveResponse(s);break;case"getResponse":{this.postToWindowAndIframes("responseData",this.rawResponse);break}case"getMedia":{let n=this.manifest.media.map(o=>o.startsWith("http")?o:je(this.baseRefUrl+"/"+o));this.postToWindowAndIframes("mediaData",n);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){return this.rawResponse!==""}set response(e){this.rawResponse=e}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return d`<iframe
|
|
219
219
|
width=${this.getAttribute("width")}
|
|
220
220
|
height=${this.getAttribute("height")}
|
|
221
221
|
frameborder="0"
|
|
@@ -226,8 +226,8 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
226
226
|
${this._errorMessage&&d`<div style="color:red">
|
|
227
227
|
<h1>Error</h1>
|
|
228
228
|
${this._errorMessage}
|
|
229
|
-
</div>`}`}};a([p({type:String,attribute:"response-identifier"})],W.prototype,"responseIdentifier",2),a([p({type:String,attribute:"data"})],W.prototype,"data",2),a([p({type:String,attribute:"data-base-item"})],W.prototype,"baseItemUrl",2),a([p({type:String,attribute:"data-base-ref"})],W.prototype,"baseRefUrl",2),a([p({type:String,attribute:"id"})],W.prototype,"id",2),a([E()],W.prototype,"_errorMessage",2),W=a([h("qti-custom-interaction")],W);var
|
|
230
|
-
<slot part="drops"></slot>`}};et.styles=[b`
|
|
229
|
+
</div>`}`}};a([p({type:String,attribute:"response-identifier"})],W.prototype,"responseIdentifier",2),a([p({type:String,attribute:"data"})],W.prototype,"data",2),a([p({type:String,attribute:"data-base-item"})],W.prototype,"baseItemUrl",2),a([p({type:String,attribute:"data-base-ref"})],W.prototype,"baseRefUrl",2),a([p({type:String,attribute:"id"})],W.prototype,"id",2),a([E()],W.prototype,"_errorMessage",2),W=a([h("qti-custom-interaction")],W);var $e=class extends q{constructor(){super(...arguments);this.countAttempt="true"}validate(){return!0}set response(e){}render(){return d`<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"}}))}};a([p({type:String,attribute:"count-attempt"})],$e.prototype,"countAttempt",2),a([p({type:String})],$e.prototype,"title",2),$e=a([h("qti-end-attempt-interaction")],$e);var et=class extends z(g,"qti-gap-text",!1,"qti-gap"){render(){return d` <slot part="drags" name="qti-gap-text"></slot>
|
|
230
|
+
<slot part="drops"></slot>`}set correctResponse(t){let e=[],r=Array.isArray(t)?t:[t];r&&(e=r.map(n=>{let o=n.split(" ");return{text:o[0],gap:o[1]}})),this.querySelectorAll("qti-gap").forEach((n,o)=>{var m,f,y,v;let l=n.getAttribute("identifier"),c=(m=e.find(C=>C.gap===l))==null?void 0:m.text,u=(f=this.querySelector(`qti-gap-text[identifier="${c}"]`))==null?void 0:f.textContent.trim();if(c&&u){if(!((y=n.nextElementSibling)!=null&&y.classList.contains("correct-option"))){let C=document.createElement("span");C.classList.add("correct-option"),C.textContent=u,n.insertAdjacentElement("afterend",C)}}else(v=n.nextElementSibling)!=null&&v.classList.contains("correct-option")&&n.nextElementSibling.remove()})}};et.styles=[b`
|
|
231
231
|
:host {
|
|
232
232
|
display: flex;
|
|
233
233
|
align-items: flex-start;
|
|
@@ -253,7 +253,7 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
253
253
|
flex: 1;
|
|
254
254
|
gap: 0.5rem;
|
|
255
255
|
}
|
|
256
|
-
`],et=a([h("qti-gap-match-interaction")],et);var ws=(i,t,e)=>{let r=new Map;for(let s=t;s<=e;s++)r.set(i[s],s);return r},It=
|
|
256
|
+
`],et=a([h("qti-gap-match-interaction")],et);var ws=(i,t,e)=>{let r=new Map;for(let s=t;s<=e;s++)r.set(i[s],s);return r},It=te(class extends j{constructor(i){if(super(i),i.type!==ne.CHILD)throw Error("repeat() can only be used in text expressions")}dt(i,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let s=[],n=[],o=0;for(let l of i)s[o]=r?r(l,o):o,n[o]=e(l,o),o++;return{values:n,keys:s}}render(i,t,e){return this.dt(i,t,e).values}update(i,[t,e,r]){var w;let s=gs(i),{values:n,keys:o}=this.dt(t,e,r);if(!Array.isArray(s))return this.ut=o,n;let l=(w=this.ut)!=null?w:this.ut=[],c=[],u,m,f=0,y=s.length-1,v=0,C=n.length-1;for(;f<=y&&v<=C;)if(s[f]===null)f++;else if(s[y]===null)y--;else if(l[f]===o[v])c[v]=oe(s[f],n[v]),f++,v++;else if(l[y]===o[C])c[C]=oe(s[y],n[C]),y--,C--;else if(l[f]===o[C])c[C]=oe(s[f],n[C]),we(i,c[C+1],s[f]),f++,C--;else if(l[y]===o[v])c[v]=oe(s[y],n[v]),we(i,s[f],s[y]),y--,v++;else if(u===void 0&&(u=ws(o,v,C),m=ws(l,f,y)),u.has(l[f]))if(u.has(l[y])){let R=m.get(o[v]),ye=R!==void 0?s[R]:null;if(ye===null){let ut=we(i,s[f]);oe(ut,n[v]),c[v]=ut}else c[v]=oe(ye,n[v]),we(i,s[f],ye),s[R]=null;v++}else St(s[y]),y--;else St(s[f]),f++;for(;v<=C;){let R=we(i,c[C+1]);oe(R,n[v]),c[v++]=R}for(;f<=y;){let R=s[f++];R!==null&&St(R)}return this.ut=o,fs(i,c),L}});function ke(i,t,e,r){switch(i){case"circle":{let[s,n,o]=t,l=s/e.width*100,c=n/e.height*100,u=o/e.width*100;r.style.left=l-u+"%",r.style.top=c-u+"%",r.style.width=r.style.height=4*u+"px",r.style.borderRadius="9999px"}break;case"rect":{let[s,n,o,l]=t,c=s/e.width*100,u=n/e.height*100,m=o/e.width*100,f=l/e.height*100;r.style.left=c+"%",r.style.top=u+"%",r.style.width=m-c+"%",r.style.height=f-u+"%"}break;case"poly":{let s=t.reduce((w,R,ye,ut)=>{if(ye%2===1){let Rs=w.pop();w[w.length]={x:Rs,y:ut[ye]}}else w.push(R);return w},[]),n=Math.min(...s.map(w=>w.x)),o=Math.max(...s.map(w=>w.x)),l=Math.min(...s.map(w=>w.y)),c=Math.max(...s.map(w=>w.y)),u=n/e.width*100,m=l/e.height*100,f=o/e.width*100,y=c/e.height*100;r.style.left=n/e.width*100+"%",r.style.top=l/e.height*100+"%",r.style.width=f-u+"%",r.style.height=y-m+"%";let C=s.map(w=>({x:(w.x-n)/(o-n)*100,y:(w.y-l)/(c-l)*100})).map(w=>Math.round(w.x)+"% "+Math.round(w.y)+"%").join(",");r.style.clipPath=`polygon(${C})`}break;default:break}}var K=class extends q{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 d`<slot name="prompt"></slot>
|
|
257
257
|
<line-container>
|
|
258
258
|
<svg
|
|
259
259
|
width=${B((e=this.grImage[0])==null?void 0:e.width)}
|
|
@@ -316,7 +316,7 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
316
316
|
display: flex;
|
|
317
317
|
gap: 1rem;
|
|
318
318
|
}
|
|
319
|
-
`,tt=a([h("qti-graphic-gap-match-interaction")],tt);var rt=class extends
|
|
319
|
+
`,tt=a([h("qti-graphic-gap-match-interaction")],tt);var rt=class extends ${render(){return d`
|
|
320
320
|
<slot name="prompt"></slot>
|
|
321
321
|
<!-- slot for the prompt -->
|
|
322
322
|
<slot></slot>
|
|
@@ -332,7 +332,7 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
332
332
|
pointer-events: none;
|
|
333
333
|
user-select: none;
|
|
334
334
|
}
|
|
335
|
-
`],rt=a([h("qti-graphic-order-interaction")],rt);var st=class extends
|
|
335
|
+
`],rt=a([h("qti-graphic-order-interaction")],rt);var st=class extends ${render(){return d`
|
|
336
336
|
<slot name="prompt"></slot>
|
|
337
337
|
<!-- slot for the prompt -->
|
|
338
338
|
<slot></slot>
|
|
@@ -349,41 +349,41 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
349
349
|
user-select: none;
|
|
350
350
|
/* width:100%; */
|
|
351
351
|
}
|
|
352
|
-
`],st=a([h("qti-hotspot-interaction")],st);var
|
|
352
|
+
`],st=a([h("qti-hotspot-interaction")],st);var ve=class extends g{constructor(){super(...arguments);this.matchMin=0;this.matchMax=1;this.fixed=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return d`
|
|
353
353
|
<slot></slot>
|
|
354
354
|
<slot name="qti-simple-associable-choice"></slot>
|
|
355
|
-
`}};a([p({type:Number,attribute:"match-min"})],
|
|
355
|
+
`}};a([p({type:Number,attribute:"match-min"})],ve.prototype,"matchMin",2),a([p({type:Number,attribute:"match-max"})],ve.prototype,"matchMax",2),a([p({type:Boolean,attribute:"fixed"})],ve.prototype,"fixed",2),ve=a([h("qti-simple-associable-choice")],ve);var pe=class extends z(g,"qti-simple-match-set:first-of-type qti-simple-associable-choice",!1,"qti-simple-match-set:last-of-type qti-simple-associable-choice"){constructor(){super(...arguments);this.lastCheckedRadio=null;this.response=[];this.correctOptions=[];this.responseIdentifier="";this.handleRadioClick=e=>{let r=e.target;this.lastCheckedRadio===r?(r.checked=!1,this.lastCheckedRadio=null,this.handleRadioChange(e)):this.lastCheckedRadio=r};this.handleRadioChange=e=>{let r=e.target,s=r.value,n=r.name,o=r.type;r.checked?(this.response?this.response.indexOf(s)===-1&&(o==="radio"&&(this.response=this.response.filter(l=>l.indexOf(n)===-1)),this.response=[...this.response,s]):this.response=[s],this.lastCheckedRadio=r):(this.response=this.response.filter(l=>l!==s),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.response)?[...this.response]:this.response}}))}}connectedCallback(){super.connectedCallback(),this.rows=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.cols=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.response=[]}set correctResponse(e){if(e===""){this.correctOptions=[];return}else Array.isArray(e)&&(this.correctOptions=e)}render(){return this.classList.contains("qti-match-tabular")?d`
|
|
356
356
|
<slot name="prompt"></slot>
|
|
357
357
|
<table>
|
|
358
358
|
<tr>
|
|
359
359
|
<td></td>
|
|
360
|
-
${this.cols.map((e,r)=>d`<th part="r-header">${
|
|
360
|
+
${this.cols.map((e,r)=>d`<th part="r-header">${ae(e.innerHTML)}</th>`)}
|
|
361
361
|
</tr>
|
|
362
362
|
|
|
363
363
|
${this.rows.map((e,r)=>d`<tr>
|
|
364
|
-
<td part="c-header">${
|
|
365
|
-
${this.cols.map((s,n)=>{let o=e.getAttribute("identifier"),l=s.getAttribute("identifier"),c=`${o} ${l}`,u=this.response.filter(
|
|
364
|
+
<td part="c-header">${ae(e.innerHTML)}</td>
|
|
365
|
+
${this.cols.map((s,n)=>{let o=e.getAttribute("identifier"),l=s.getAttribute("identifier"),c=`${o} ${l}`,u=this.response.filter(v=>v.split(" ")[0]===o).length||0,m=this.response.includes(c),f=`rb ${m?"rb-checked":""} ${this.correctOptions.includes(c)?"rb-correct":""}`,y=this.correctOptions.length>0?!0:e.matchMax===1?!1:u>=e.matchMax&&!m;return d`<td>
|
|
366
366
|
<input
|
|
367
367
|
type=${e.matchMax===1?"radio":"checkbox"}
|
|
368
368
|
role="id"
|
|
369
|
+
part=${f}
|
|
369
370
|
name=${o}
|
|
370
371
|
value=${c}
|
|
371
|
-
.disabled=${
|
|
372
|
-
|
|
373
|
-
@
|
|
374
|
-
@click=${y=>e.matchMax===1?this.handleRadioClick(y):null}
|
|
372
|
+
.disabled=${y}
|
|
373
|
+
@change=${v=>this.handleRadioChange(v)}
|
|
374
|
+
@click=${v=>e.matchMax===1?this.handleRadioClick(v):null}
|
|
375
375
|
/>
|
|
376
376
|
</td>`})}
|
|
377
377
|
</tr>`)}
|
|
378
378
|
</table>
|
|
379
|
-
`:d`<slot name="prompt"></slot> <slot></slot>`}};
|
|
380
|
-
<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())})}};it.styles=[b``],it=a([h("qti-media-interaction")],it);var
|
|
379
|
+
`:d`<slot name="prompt"></slot> <slot></slot>`}};pe.styles=[],a([E()],pe.prototype,"response",2),a([E()],pe.prototype,"correctOptions",2),a([p({type:String,attribute:"response-identifier"})],pe.prototype,"responseIdentifier",2),pe=a([h("qti-match-interaction")],pe);var it=class extends q{constructor(){super();this.value=0}reset(){}validate(){return!0}set response(e){}static get properties(){return T(_({},q.properties),{step:{type:Number,attribute:"step",default:10}})}render(){return d` <slot name="prompt"></slot>
|
|
380
|
+
<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())})}};it.styles=[b``],it=a([h("qti-media-interaction")],it);var J=class extends z(g,"qti-simple-choice",!0,"drop-list"){constructor(){super(...arguments);this.nrChoices=0;this.correctResponses=[];this.showCorrectResponses=!1}render(){let e=Array.from(this.querySelectorAll("qti-simple-choice"));return this.nrChoices<e.length&&(this.nrChoices=e.length),d` <slot name="prompt"> </slot>
|
|
381
381
|
<div part="container">
|
|
382
382
|
<slot part="drags"> </slot>
|
|
383
383
|
<div part="drops">
|
|
384
|
-
${Array.from(this.
|
|
384
|
+
${Array.from(Array(this.nrChoices)).map((r,s)=>d`<drop-list part="drop-list" identifier="droplist${s}"></drop-list>${this.showCorrectResponses&&this.correctResponses.length>s?ae(`<span part='correct-response'>${this.correctResponses[s]}</span>`):""}`)}
|
|
385
385
|
</div>
|
|
386
|
-
</div>`}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(
|
|
386
|
+
</div>`}set correctResponse(e){if(e===""){this.showCorrectResponses=!1;return}this.correctResponses.length===0&&(Array.isArray(e)?e:[e]).forEach((s,n)=>{let o=this.querySelector(`qti-simple-choice[identifier="${s}"]`);o||(o=this.shadowRoot.querySelector(`qti-simple-choice[identifier="${s}"]`));let l=o==null?void 0:o.textContent.trim();this.correctResponses=[...this.correctResponses,l]}),this.showCorrectResponses=!0}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(e=>e.setAttribute("part","qti-simple-choice"))}};J.layoutClass=["qti-choices-top","qti-choices-bottom","qti-choices-left","qti-choices-right"],J.styles=[b`
|
|
387
387
|
[part='drags'] {
|
|
388
388
|
display: flex;
|
|
389
389
|
align-items: flex-start;
|
|
@@ -431,7 +431,7 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
431
431
|
:host(.qti-choices-right) [part='container'] {
|
|
432
432
|
flex-direction: row-reverse;
|
|
433
433
|
}
|
|
434
|
-
`],a([p({type:String})],
|
|
434
|
+
`],a([E()],J.prototype,"nrChoices",2),a([E()],J.prototype,"correctResponses",2),a([E()],J.prototype,"showCorrectResponses",2),a([p({type:String})],J.prototype,"orientation",2),J=a([h("qti-order-interaction")],J);var Ft=class extends g{render(){return d`<slot></slot>`}};Ft.styles=[b`
|
|
435
435
|
:host {
|
|
436
436
|
display: block;
|
|
437
437
|
}
|
|
@@ -447,18 +447,18 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
447
447
|
display: inline-block;
|
|
448
448
|
position: relative;
|
|
449
449
|
}
|
|
450
|
-
`],ot=a([h("qti-position-object-stage")],ot);var Ts="important",pi=" !"+Ts
|
|
450
|
+
`],ot=a([h("qti-position-object-stage")],ot);var Ts="important",pi=" !"+Ts,Ss=te(class extends j{constructor(i){var t;if(super(i),i.type!==ne.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.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let s=t[r];if(s!=null){this.ft.add(r);let n=typeof s=="string"&&s.endsWith(pi);r.includes("-")||n?e.setProperty(r,n?s.slice(0,-11):s,n?Ts:""):e[r]=s}}return L}});var de=class extends q{constructor(){super(...arguments);this.maxChoices=0;this.minChoices=0;this._points=[]}render(){return d` <slot name="prompt"></slot>
|
|
451
451
|
<point-container>
|
|
452
452
|
${It(this._points,e=>e,(e,r)=>d`
|
|
453
453
|
<button
|
|
454
454
|
part="point"
|
|
455
|
-
style=${
|
|
455
|
+
style=${Ss({position:"absolute",transform:"translate(-50%, -50%)",left:`${e.split(" ")[0]}px`,top:`${e.split(" ")[1]}px`})}
|
|
456
456
|
aria-label="Remove point at ${e}"
|
|
457
457
|
@click=${s=>{s.stopPropagation(),this._points=this._points.filter((n,o)=>o!==r),this.saveResponse(this._points)}}
|
|
458
458
|
></button>
|
|
459
459
|
`)}
|
|
460
460
|
<slot></slot>
|
|
461
|
-
</point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set response(e){this._points=Array.isArray(e)?e:[e]}connectedCallback(){super.connectedCallback(),this.querySelector("img").addEventListener("click",r=>{let s=r.offsetX,n=r.offsetY;this._points=[...this._points,s+" "+n],this.saveResponse(this._points)})}disconnectedCallback(){super.disconnectedCallback()}};
|
|
461
|
+
</point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set response(e){this._points=Array.isArray(e)?e:[e]}connectedCallback(){super.connectedCallback(),this.querySelector("img").addEventListener("click",r=>{let s=r.offsetX,n=r.offsetY;this._points=[...this._points,s+" "+n],this.saveResponse(this._points)})}disconnectedCallback(){super.disconnectedCallback()}};de.styles=[b`
|
|
462
462
|
:host {
|
|
463
463
|
display: block;
|
|
464
464
|
}
|
|
@@ -466,19 +466,19 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
466
466
|
display: block;
|
|
467
467
|
position: relative;
|
|
468
468
|
}
|
|
469
|
-
`],a([p({type:Number,attribute:"max-choices"})],
|
|
469
|
+
`],a([p({type:Number,attribute:"max-choices"})],de.prototype,"maxChoices",2),a([p({type:Number,attribute:"min-choices"})],de.prototype,"minChoices",2),a([E()],de.prototype,"_points",2),de=a([h("qti-select-point-interaction")],de);var k=class extends q{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()),d`<slot name="prompt"></slot>
|
|
470
470
|
<div id="slider" part="slider">
|
|
471
471
|
${this.csLive.getPropertyValue("--show-bounds")=="true"?d`<div id="bounds" part="bounds">
|
|
472
472
|
<div>${this._min}</div>
|
|
473
473
|
<div>${this._max}</div>
|
|
474
|
-
</div>`:
|
|
475
|
-
${this.csLive.getPropertyValue("--show-ticks")=="true"?d`<div id="ticks" part="ticks"></div>`:
|
|
474
|
+
</div>`:A}
|
|
475
|
+
${this.csLive.getPropertyValue("--show-ticks")=="true"?d`<div id="ticks" part="ticks"></div>`:A}
|
|
476
476
|
<div id="rail" part="rail" @mousedown=${this._onMouseDown} @touchstart=${this._onTouchMove}>
|
|
477
477
|
<div id="knob" part="knob">
|
|
478
|
-
${this.csLive.getPropertyValue("--show-value")=="true"?d`<div id="value" part="value">${this.value}</div>`:
|
|
478
|
+
${this.csLive.getPropertyValue("--show-value")=="true"?d`<div id="value" part="value">${this.value}</div>`:A}
|
|
479
479
|
</div>
|
|
480
480
|
</div>
|
|
481
|
-
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=l=>{let{x:c}=this.getPositionFromEvent(l),u=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(u),l.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 l=o.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),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}};k.styles=[b``],a([Fe("#knob")],k.prototype,"_knob",2),a([Fe("#rail")],k.prototype,"_rail",2),a([p({type:Number})],k.prototype,"value",2),a([p({type:Boolean,attribute:"step-label"})],k.prototype,"stepLabel",2),a([p({type:Boolean})],k.prototype,"reverse",2),a([p({type:Number,attribute:"lower-bound"})],k.prototype,"min",1),a([p({type:Number,attribute:"upper-bound"})],k.prototype,"max",1),a([p({type:Number,attribute:"step"})],k.prototype,"step",1),a([
|
|
481
|
+
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=l=>{let{x:c}=this.getPositionFromEvent(l),u=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(u),l.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 l=o.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),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}};k.styles=[b``],a([Fe("#knob")],k.prototype,"_knob",2),a([Fe("#rail")],k.prototype,"_rail",2),a([p({type:Number})],k.prototype,"value",2),a([p({type:Boolean,attribute:"step-label"})],k.prototype,"stepLabel",2),a([p({type:Boolean})],k.prototype,"reverse",2),a([p({type:Number,attribute:"lower-bound"})],k.prototype,"min",1),a([p({type:Number,attribute:"upper-bound"})],k.prototype,"max",1),a([p({type:Number,attribute:"step"})],k.prototype,"step",1),a([S("disabled",{waitUntilFirstUpdate:!0})],k.prototype,"_handleDisabledChange",2),a([S("readonly",{waitUntilFirstUpdate:!0})],k.prototype,"_handleReadonlyChange",2),k=a([h("qti-slider-interaction")],k);var nt=class extends g{render(){return d`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(t){var r,s,n;let e=Array.from((s=(r=this.firstElementChild)==null?void 0:r.childNodes)!=null?s:[]).find(o=>o.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",(n=e.textContent)!=null?n:"")}catch(o){console.error("custom-operator contains invalid javascript code",o)}}calculate(){let t={variable:r=>{var s,n,o;return(o=(n=(s=this._context)==null?void 0:s.variables.find(l=>l.identifier===r))==null?void 0:n.value)!=null?o:""},correct:r=>{var s,n,o;return(o=(n=(s=this._context)==null?void 0:s.variables.find(l=>l.identifier===r))==null?void 0:n.correctResponse)!=null?o:""}},e={getVariable:r=>{var s;return(s=this._context)==null?void 0:s.variables.find(n=>n.identifier===r)},updateOutcomeVariable:(r,s)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:s}}))}};return this.operatorFunction(this._context,t,e)}};a([Z({context:U,subscribe:!0}),E()],nt.prototype,"_context",2),nt=a([h("qti-custom-operator")],nt);var at=class extends g{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return d` <slot name="qti-gap-img"></slot> `}};at.styles=b`
|
|
482
482
|
:host {
|
|
483
483
|
position: absolute;
|
|
484
484
|
}
|
|
@@ -496,7 +496,7 @@ var Mr=Object.defineProperty,Rs=Object.defineProperties,ks=Object.getOwnProperty
|
|
|
496
496
|
width: 100%;
|
|
497
497
|
display: block;
|
|
498
498
|
}
|
|
499
|
-
`,dt=a([h("qti-simple-choice")],dt);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");export{q as Interaction,Qe as QtPrintedVariable,
|
|
499
|
+
`,dt=a([h("qti-simple-choice")],dt);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");export{q as Interaction,Qe as QtPrintedVariable,Ht as QtiAnd,H as QtiAssessmentItem,Ae as QtiAssessmentStimulusRef,at as QtiAssociableHotspot,Re as QtiAssociateInteraction,Nt as QtiBaseValue,M as QtiChoice,Te as QtiChoiceInteraction,wt as QtiCompanionMaterialsInfo,V as QtiConditionExpression,hr as QtiContains,Tt as QtiContentBody,mr as QtiCorrect,W as QtiCustomInteraction,nt as QtiCustomOperator,$e as QtiEndAttemptInteraction,Vt as QtiEqual,Pt as QtiEqualRounded,x as QtiExpression,X as QtiExtendedTextInteraction,Xe as QtiFeedbackBlock,Ye as QtiFeedbackInline,lt as QtiGap,ct as QtiGapImg,et as QtiGapMatchInteraction,pt as QtiGapText,K as QtiGraphicAssociateInteraction,tt as QtiGraphicGapMatchInteraction,rt as QtiGraphicOrderInteraction,fr as QtiGt,gr as QtiGte,Me as QtiHotspotChoice,st as QtiHotspotInteraction,Bt as QtiHottext,Mt as QtiHottextInteraction,jt as QtiInlineChoice,le as QtiInlineChoiceInteraction,br as QtiIsNull,Lt as QtiLookupOutcomeValue,vr as QtiLt,yr as QtiLte,Dt as QtiMapResponse,Se as QtiMapping,xr as QtiMatch,pe as QtiMatchInteraction,it as QtiMediaInteraction,Er as QtiMember,ze as QtiModalFeedback,_r as QtiMultiple,Cr as QtiNot,Ar as QtiOr,J as QtiOrderInteraction,qr as QtiOrdered,I as QtiOutcomeDeclaration,Je as QtiOutcomeProcessing,lr as QtiOutcomeProcessingProcessor,ce as QtiPortableCustomInteraction,ot as QtiPositionObjectStage,wr as QtiProduct,At as QtiPrompt,cr as QtiResponseCondition,ee as QtiResponseDeclaration,Ze as QtiResponseElse,ur as QtiResponseElseIf,Ge as QtiResponseIf,be as QtiResponseProcessing,F as QtiRubricBlock,Y as QtiRule,Ft as QtiSPositionObjectInteraction,de as QtiSelectPointInteraction,pr as QtiSetOutcomeValue,dr as QtiSetOutcomeValueRule,ve as QtiSimpleAssociableChoice,dt as QtiSimpleChoice,k as QtiSliderInteraction,Ot as QtiStringMatch,qt as QtiStylesheet,Tr as QtiSum,Sr as QtiSumExpression,P as QtiTextEntryInteraction,Rr as QtiVariable,U as itemContext,ps as itemContextVariables,ci as qtiAndMixin,ds as qtiTransformItem,ln as qtiTransformManifest,cn as qtiTransformTest};
|
|
500
500
|
/*! Bundled license information:
|
|
501
501
|
|
|
502
502
|
@lit/context/lib/context-request-event.js:
|