@citolab/qti-components 6.7.1-5 → 6.7.1-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/qti-components/index.js +14 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnPropertyDescriptor,_s=Object.getOwnPropertyDescriptors;var yr=Object.getOwnPropertySymbols;var Cs=Object.prototype.hasOwnProperty,As=Object.prototype.propertyIsEnumerable;var xr=(i,t,e)=>t in i?Er(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,x=(i,t)=>{for(var e in t||(t={}))Cs.call(t,e)&&xr(i,e,t[e]);if(yr)for(var e of yr(t))As.call(t,e)&&xr(i,e,t[e]);return i},R=(i,t)=>xs(i,_s(t));var l=(i,t,e,r)=>{for(var s=r>1?void 0:r?Es(t,e):t,n=i.length-1,o;n>=0;n--)(o=i[n])&&(s=(r?o(t,e,s):o(s))||s);return r&&s&&Er(t,e,s),s};var Q=class extends Event{constructor(t,e,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=r!=null?r:!1}};var me=class{constructor(t,e,r,s){var n;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,a)=>{this.unsubscribe&&(this.unsubscribe!==a&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,a)),this.unsubscribe=a},this.host=t,e.context!==void 0){let o=e;this.context=o.context,this.callback=o.callback,this.subscribe=(n=o.subscribe)!=null?n:!1}else this.context=e,this.callback=r,this.subscribe=s!=null?s:!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Q(this.context,this.t,this.subscribe))}};var Ke=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}};var Vt=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},fe=class extends Ke{constructor(t,e,r){var s,n;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{let a=o.composedPath()[0];o.context===this.context&&a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{let a=o.composedPath()[0];if(o.context!==this.context||a===this.host)return;let c=new Set;for(let[u,{consumerHost:h}]of this.subscriptions)c.has(u)||(c.add(u),h.dispatchEvent(new Q(this.context,u,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(n=(s=this.host).addController)==null||n.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Vt(this.context))}};function Ht({context:i}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new fe(this,{context:i}))}),{get(){return t.get.call(this)},set(s){var n;return(n=r.get(this))==null||n.setValue(s),t.set.call(this,s)},init(s){var n;return(n=r.get(this))==null||n.setValue(s),s}};{t.constructor.addInitializer(o=>{r.set(o,new fe(o,{context:i}))});let s=Object.getOwnPropertyDescriptor(t,e),n;if(s===void 0){let o=new WeakMap;n={get:function(){return o.get(this)},set:function(a){r.get(this).setValue(a),o.set(this,a)},configurable:!0,enumerable:!0}}else{let o=s.set;n=R(x({},s),{set:function(a){r.get(this).setValue(a),o==null||o.call(this,a)}})}return void Object.defineProperty(t,e,n)}}}function Y({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new me(this,{context:i,callback:s=>{this[r.name]=s},subscribe:t})}):e.constructor.addInitializer(s=>{new me(s,{context:i,callback:n=>{s[r]=n},subscribe:t})})}}var _r=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 Cr=new WeakMap,$e=i=>{let t=Cr.get(i);return t===void 0&&Cr.set(i,t=new Map),t},ws=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from($e(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}setAttribute(t,e){$e(this).set(t,String(e))}removeAttribute(t){$e(this).delete(t)}hasAttribute(t){return $e(this).has(t)}attachShadow(t){let e={host:this};return this.__shadowRootMode=t.mode,t&&t.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new _r(this);return this.__internals=t,t}getAttribute(t){let e=$e(this).get(t);return e!=null?e:null}};var $s=class extends ws{},Ar=$s;var Ss=class{constructor(){this.__definitions=new Map}define(t,e){var r;if(this.__definitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);this.__definitions.set(t,{ctor:e,observedAttributes:(r=e.observedAttributes)!=null?r:[]})}get(t){let e=this.__definitions.get(t);return e==null?void 0:e.ctor}},Rs=Ss;var qr=new Rs;var Se=globalThis,We=Se.ShadowRoot&&(Se.ShadyCSS===void 0||Se.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Nt=Symbol(),wr=new WeakMap,Re=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Nt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(We&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=wr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&wr.set(e,t))}return t}toString(){return this.cssText}},$r=i=>new Re(typeof i=="string"?i:i+"",void 0,Nt),b=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,s,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[n+1],i[0]);return new Re(e,i,Nt)},Dt=(i,t)=>{if(We)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),s=Se.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},Je=We||Se.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return $r(e)})(i):i;var{is:ks,defineProperty:Ts,getOwnPropertyDescriptor:Ls,getOwnPropertyNames:Ms,getOwnPropertySymbols:Ps,getPrototypeOf:Vs}=Object,O=globalThis,kr;(kr=O.customElements)!=null||(O.customElements=qr);var Sr=O.trustedTypes,Hs=Sr?Sr.emptyScript:"",Ot=O.reactiveElementPolyfillSupport,ke=(i,t)=>i,Te={toAttribute(i,t){switch(t){case Boolean:i=i?Hs:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch(r){e=null}}return e}},Ge=(i,t)=>!ks(i,t),Rr={attribute:!0,type:String,converter:Te,reflect:!1,hasChanged:Ge},Tr,Lr;(Tr=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Lr=O.litPropertyMetadata)!=null||(O.litPropertyMetadata=new WeakMap);var Mr,K=class extends((Mr=globalThis.HTMLElement)!=null?Mr:Ar){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=Rr){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),s=this.getPropertyDescriptor(t,r,e);s!==void 0&&Ts(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){var o;let{get:s,set:n}=(o=Ls(this.prototype,t))!=null?o:{get(){return this[e]},set(a){this[e]=a}};return{get(){return s==null?void 0:s.call(this)},set(a){let c=s==null?void 0:s.call(this);n.call(this,a),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:Rr}static _$Ei(){if(this.hasOwnProperty(ke("elementProperties")))return;let t=Vs(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ke("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ke("properties"))){let e=this.properties,r=[...Ms(e),...Ps(e)];for(let s of r)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,s]of e)this.elementProperties.set(r,s)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let s=this._$Eu(e,r);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let s of r)e.unshift(Je(s))}else t!==void 0&&e.push(Je(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$ES(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,r;((e=this._$E_)!=null?e:this._$E_=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var e;(e=this._$E_)==null||e.delete(t)}_$ES(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return Dt(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(r=>{var s;return(s=r.hostConnected)==null?void 0:s.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$E_)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EO(t,e){var n;let r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){let o=(((n=r.converter)==null?void 0:n.toAttribute)!==void 0?r.converter:Te).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){var n;let r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let o=r.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Te;this._$Em=s,this[s]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r,s=!1,n){var o;if(t!==void 0){if(r!=null||(r=this.constructor.getPropertyOptions(t)),!((o=r.hasChanged)!=null?o:Ge)(s?n:this[t],e))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,r){var s;this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&((s=this._$Ej)!=null?s:this._$Ej=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,a]of n)a.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.C(o,this[o],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$E_)==null||s.forEach(n=>{var o;return(o=n.hostUpdate)==null?void 0:o.call(n)}),this.update(e)):this._$ET()}catch(n){throw t=!1,this._$ET(),n}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$E_)==null||e.forEach(r=>{var s;return(s=r.hostUpdated)==null?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}},Pr;K.elementStyles=[],K.shadowRootOptions={mode:"open"},K[ke("elementProperties")]=new Map,K[ke("finalized")]=new Map,Ot==null||Ot({ReactiveElement:K}),((Pr=O.reactiveElementVersions)!=null?Pr:O.reactiveElementVersions=[]).push("2.0.2");var be=globalThis,Ze=be.trustedTypes,Vr=Ze?Ze.createPolicy("lit-html",{createHTML:i=>i}):void 0,Ft="$lit$",W=`lit$${(Math.random()+"").slice(9)}$`,Bt="?"+W,Ns=`<${Bt}>`,ne=be.document===void 0?{createTreeWalker:()=>({})}:document,Me=()=>ne.createComment(""),Pe=i=>i===null||typeof i!="object"&&typeof i!="function",Fr=Array.isArray,Br=i=>Fr(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",Ut=`[
|
|
2
2
|
\f\r]`,Le=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hr=/-->/g,Nr=/>/g,ie=RegExp(`>|${Ut}(?:([^\\s"'>=/]+)(${Ut}*=${Ut}*(?:[^
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dr=/'/g,Or=/"/g,Xr=/^(?:script|style|textarea|title)$/i,zr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),p=zr(1),Xt=zr(2),M=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),Ur=new WeakMap,oe=ne.createTreeWalker(ne,129);function jr(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Vr!==void 0?Vr.createHTML(t):t}var Yr=(i,t)=>{let e=i.length-1,r=[],s,n=t===2?"<svg>":"",o=Le;for(let a=0;a<e;a++){let c=i[a],u,h,m=-1,y=0;for(;y<c.length&&(o.lastIndex=y,h=o.exec(c),h!==null);)y=o.lastIndex,o===Le?h[1]==="!--"?o=Hr:h[1]!==void 0?o=Nr:h[2]!==void 0?(Xr.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=ie):h[3]!==void 0&&(o=ie):o===ie?h[0]===">"?(o=s!=null?s:Le,m=-1):h[1]===void 0?m=-2:(m=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?ie:h[3]==='"'?Or:Dr):o===Or||o===Dr?o=ie:o===Hr||o===Nr?o=Le:(o=ie,s=void 0);let g=o===ie&&i[a+1].startsWith("/>")?" ":"";n+=o===Le?c+Ns:m>=0?(r.push(u),c.slice(0,m)+Ft+c.slice(m)+W+g):c+W+(m===-2?a:g)}return[jr(i,n+(i[e]||"<?>")+(t===2?"</svg>":"")),r]},Ve=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let n=0,o=0,a=t.length-1,c=this.parts,[u,h]=Yr(t,e);if(this.el=i.createElement(u,r),oe.currentNode=this.el.content,e===2){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(s=oe.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let m of s.getAttributeNames())if(m.endsWith(Ft)){let y=h[o++],g=s.getAttribute(m).split(W),q=/([.?@])?(.*)/.exec(y);c.push({type:1,index:n,name:q[2],strings:g,ctor:q[1]==="."?et:q[1]==="?"?tt:q[1]==="@"?rt:le}),s.removeAttribute(m)}else m.startsWith(W)&&(c.push({type:6,index:n}),s.removeAttribute(m));if(Xr.test(s.tagName)){let m=s.textContent.split(W),y=m.length-1;if(y>0){s.textContent=Ze?Ze.emptyScript:"";for(let g=0;g<y;g++)s.append(m[g],Me()),oe.nextNode(),c.push({type:2,index:++n});s.append(m[y],Me())}}}else if(s.nodeType===8)if(s.data===Bt)c.push({type:2,index:n});else{let m=-1;for(;(m=s.data.indexOf(W,m+1))!==-1;)c.push({type:7,index:n}),m+=W.length-1}n++}}static createElement(t,e){let r=ne.createElement("template");return r.innerHTML=t,r}};function ae(i,t,e=i,r){var o,a,c;if(t===M)return t;let s=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl,n=Pe(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),n===void 0?s=void 0:(s=new n(i),s._$AT(i,e,r)),r!==void 0?((c=e._$Co)!=null?c:e._$Co=[])[r]=s:e._$Cl=s),s!==void 0&&(t=ae(i,s._$AS(i,t.values),s,r)),t}var Qe=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var u;let{el:{content:e},parts:r}=this._$AD,s=((u=t==null?void 0:t.creationScope)!=null?u:ne).importNode(e,!0);oe.currentNode=s;let n=oe.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new ge(n,n.nextSibling,this,t):c.type===1?h=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(h=new st(n,this,t)),this._$AV.push(h),c=r[++a]}o!==(c==null?void 0:c.index)&&(n=oe.nextNode(),o++)}return oe.currentNode=ne,s}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},ge=class i{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,r,s){var n;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=(n=s==null?void 0:s.isConnected)!=null?n:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ae(this,t,e),Pe(t)?t===E||t==null||t===""?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==M&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Br(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==E&&Pe(this._$AH)?this._$AA.nextSibling.data=t:this.$(ne.createTextNode(t)),this._$AH=t}g(t){var n;let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ve.createElement(jr(r.h,r.h[0]),this.options)),r);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{let o=new Qe(s,this),a=o.u(this.options);o.p(e),this.$(a),this._$AH=o}}_$AC(t){let e=Ur.get(t.strings);return e===void 0&&Ur.set(t.strings,e=new Ve(t)),e}T(t){Fr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,s=0;for(let n of t)s===e.length?e.push(r=new i(this.k(Me()),this.k(Me()),this,this.options)):r=e[s],r._$AI(n),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,n){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=E}_$AI(t,e=this,r,s){let n=this.strings,o=!1;if(n===void 0)t=ae(this,t,e,0),o=!Pe(t)||t!==this._$AH&&t!==M,o&&(this._$AH=t);else{let a=t,c,u;for(t=n[0],c=0;c<n.length-1;c++)u=ae(this,a[r+c],e,c),u===M&&(u=this._$AH[c]),o||(o=!Pe(u)||u!==this._$AH[c]),u===E?t=E:t!==E&&(t+=(u!=null?u:"")+n[c+1]),this._$AH[c]=u}o&&!s&&this.O(t)}O(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},et=class extends le{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===E?void 0:t}},tt=class extends le{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==E)}},rt=class extends le{constructor(t,e,r,s,n){super(t,e,r,s,n),this.type=5}_$AI(t,e=this){var o;if((t=(o=ae(this,t,e,0))!=null?o:E)===M)return;let r=this._$AH,s=t===E&&r!==E||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==E&&(r===E||s);s&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;typeof this._$AH=="function"?this._$AH.call((r=(e=this.options)==null?void 0:e.host)!=null?r:this.element,t):this._$AH.handleEvent(t)}},st=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){ae(this,t)}},Kr={j:Ft,P:W,A:Bt,C:1,M:Yr,L:Qe,R:Br,V:ae,D:ge,I:le,H:tt,N:rt,U:et,B:st},It=be.litHtmlPolyfillSupport,Ir;It==null||It(Ve,ge),((Ir=be.litHtmlVersions)!=null?Ir:be.litHtmlVersions=[]).push("3.1.0");var Wr=(i,t,e)=>{var n,o;let r=(n=e==null?void 0:e.renderBefore)!=null?n:t,s=r._$litPart$;if(s===void 0){let a=(o=e==null?void 0:e.renderBefore)!=null?o:null;r._$litPart$=s=new ge(t.insertBefore(Me(),a),a,void 0,e!=null?e:{})}return s._$AI(i),s};var f=class extends K{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let t=super.createRenderRoot();return(r=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Wr(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return M}},Jr;f._$litElement$=!0,f.finalized=!0,(Jr=globalThis.litElementHydrateSupport)==null||Jr.call(globalThis,{LitElement:f});var zt=globalThis.litElementPolyfillSupport;zt==null||zt({LitElement:f});var Gr;((Gr=globalThis.litElementVersions)!=null?Gr:globalThis.litElementVersions=[]).push("4.0.2");var _=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Ds={attribute:!0,type:String,converter:Te,reflect:!1,hasChanged:Ge},Os=(i=Ds,t,e)=>{let{kind:r,metadata:s}=e,n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(e.name,i),r==="accessor"){let{name:o}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,i)},init(a){return a!==void 0&&this.C(o,void 0,i),a}}}if(r==="setter"){let{name:o}=e;return function(a){let c=this[o];t.call(this,a),this.requestUpdate(o,c,i)}}throw Error("Unsupported decorator location: "+r)};function d(i){return(t,e)=>typeof e=="object"?Os(i,t,e):((r,s,n)=>{let o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?R(x({},r),{wrapped:!0}):r),o?Object.getOwnPropertyDescriptor(s,n):void 0})(i,t,e)}function C(i){return d(R(x({},i),{state:!0,attribute:!1}))}var ee=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function He(i,t){return(e,r,s)=>{let n=o=>{var a,c;return(c=(a=o.renderRoot)==null?void 0:a.querySelector(i))!=null?c:null};if(t){let{get:o,set:a}=typeof r=="object"?e:s!=null?s:(()=>{let c=Symbol();return{get(){return this[c]},set(u){this[c]=u}}})();return ee(e,r,{get(){let c=o.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return ee(e,r,{get(){return n(this)}})}}function Zr(i){return(t,e)=>{let{slot:r,selector:s}=i!=null?i:{},n="slot"+(r?`[name=${r}]`:":not([name])");return ee(t,e,{get(){var c,u;let o=(c=this.renderRoot)==null?void 0:c.querySelector(n),a=(u=o==null?void 0:o.assignedElements(i))!=null?u:[];return s===void 0?a:a.filter(h=>h.matches(s))}})}}function $(i,t){let e=x({waitUntilFirstUpdate:!1},t);return(r,s)=>{let{update:n}=r,o=Array.isArray(i)?i:[i];r.update=function(a){o.forEach(c=>{let u=c;if(a.has(u)){let h=a.get(u),m=this[u];h!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[s](h,m)}}),n.call(this,a)}}}var Qr=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],I="item";var P=class extends f{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent="false";this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(s=>s.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(s=>s.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:Qr};this._state="item-created";this._initialContext=R(x({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.state="item-created",this.addEventListener("qti-register-variable",({detail:e})=>{this._context=R(x({},this._context),{variables:[...this._context.variables,e.variable]}),this._initialContext=this._context}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let r=e.detail;this._feedbackElements.push(r),r.checkShowFeedback(r.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:r,countAttempt:s}=e.detail;this.updateResponseVariable(r,"true"),this.processResponse(s)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:s}=e.detail;this.updateOutcomeVariable(r,s)}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}set state(e){this._state=e}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type}))}set variables(e){if(!Array.isArray(e)||e.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=R(x({},this._context),{variables:this._context.variables.map(r=>{let s=e.find(n=>n.identifier===r.identifier);return s?x(x({},r),s):r})}),this._context.variables.forEach(r=>{if(r.type==="response"){let s=this._interactionElements.find(n=>n.responseIdentifier===r.identifier);s&&(s.response=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(s=>s.checkShowFeedback(r.identifier))})}firstUpdated(e){this.state="first-updated",this._emit("qti-assessment-item-first-updated",this)}connectedCallback(){super.connectedCallback(),this.state="item-connected"}set responses(e){if(e)for(let r of e){this.getResponse(r.responseIdentifier)&&this.updateResponseVariable(r.responseIdentifier,r.response);let n=this._interactionElements.find(o=>o.getAttribute("response-identifier")===r.responseIdentifier);n&&(n.response=r.response)}}render(){return p`<slot></slot>`}showCorrectResponse(e){let s=this._context.variables.filter(n=>"correctResponse"in n&&n.correctResponse).map(n=>({responseIdentifier:n.identifier,response:n.correctResponse}));for(let n of s){let o=this._interactionElements.find(a=>a.getAttribute("response-identifier")===n.responseIdentifier);o&&(o.correctResponse=e?n.response:"")}}processResponse(e=!0){var s;let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((s=this._context.variables.find(n=>n.identifier==="numAttempts"))==null?void 0:s.value)+1).toString()),this._emit("qti-response-processed"),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(r=>r.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:r,response:s}=e.detail;this.updateResponseVariable(r,s)}updateResponseVariable(e,r){this._context=R(x({},this._context),{variables:this._context.variables.map(s=>s.identifier!==e?s:R(x({},s),{value:r}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,r){var n;let s=this.getOutcome(e);if(!s){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=R(x({},this._context),{variables:this._context.variables.map(o=>o.identifier!==e?o:R(x({},o),{value:s.cardinality==="single"?r:[...o.value,r]}))}),this._feedbackElements.forEach(o=>o.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:(n=this._context.variables.find(o=>o.identifier===e))==null?void 0:n.value})}_getCompletionStatus(){return this._interactionElements.every(e=>e.validate())?"completed":this._interactionElements.some(e=>e.validate())?"incomplete":"not_attempted"}_emit(e,r=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:r}))}};l([d({type:String})],P.prototype,"title",2),l([d({type:String})],P.prototype,"identifier",2),l([d({type:String})],P.prototype,"adaptive",2),l([d({type:String})],P.prototype,"timeDependent",2),l([d({type:Boolean})],P.prototype,"disabled",2),l([$("disabled",{waitUntilFirstUpdate:!0})],P.prototype,"_handleDisabledChange",2),l([d({type:Boolean})],P.prototype,"readonly",2),l([$("readonly",{waitUntilFirstUpdate:!0})],P.prototype,"_handleReadonlyChange",2),l([Ht({context:I})],P.prototype,"_context",2),P=l([_("qti-assessment-item")],P);var Us={SPACE:32},T=class extends f{constructor(){super(...arguments);this.tabindex=0;this.disabled=!1;this.readonly=!1;this.checked=!1}handleDisabledChange(e,r){r?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-register-choice",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-loose-choice",{bubbles:!0,cancelable:!1,composed:!0}))}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case Us.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("qti-choice-element-selected",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier,checked:this.checked}})))}validateAllProps(){return!!this.getAttribute("identifier")}render(){return this.validateAllProps()||console.warn(`Invalid props for ${this.outerHTML}`,"missing identifier"),p` <slot></slot> `}};l([d({type:String})],T.prototype,"identifier",2),l([d({type:Number,reflect:!0})],T.prototype,"tabindex",2),l([d({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:e=>e}})],T.prototype,"disabled",2),l([d({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:e=>e}})],T.prototype,"readonly",2),l([d({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>e}})],T.prototype,"checked",2),l([$("disabled",{waitUntilFirstUpdate:!0})],T.prototype,"handleDisabledChange",1);var es=b`
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dr=/'/g,Or=/"/g,Xr=/^(?:script|style|textarea|title)$/i,zr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),p=zr(1),Xt=zr(2),M=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),Ur=new WeakMap,oe=ne.createTreeWalker(ne,129);function jr(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Vr!==void 0?Vr.createHTML(t):t}var Yr=(i,t)=>{let e=i.length-1,r=[],s,n=t===2?"<svg>":"",o=Le;for(let a=0;a<e;a++){let c=i[a],u,h,m=-1,y=0;for(;y<c.length&&(o.lastIndex=y,h=o.exec(c),h!==null);)y=o.lastIndex,o===Le?h[1]==="!--"?o=Hr:h[1]!==void 0?o=Nr:h[2]!==void 0?(Xr.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=ie):h[3]!==void 0&&(o=ie):o===ie?h[0]===">"?(o=s!=null?s:Le,m=-1):h[1]===void 0?m=-2:(m=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?ie:h[3]==='"'?Or:Dr):o===Or||o===Dr?o=ie:o===Hr||o===Nr?o=Le:(o=ie,s=void 0);let g=o===ie&&i[a+1].startsWith("/>")?" ":"";n+=o===Le?c+Ns:m>=0?(r.push(u),c.slice(0,m)+Ft+c.slice(m)+W+g):c+W+(m===-2?a:g)}return[jr(i,n+(i[e]||"<?>")+(t===2?"</svg>":"")),r]},Ve=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let n=0,o=0,a=t.length-1,c=this.parts,[u,h]=Yr(t,e);if(this.el=i.createElement(u,r),oe.currentNode=this.el.content,e===2){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(s=oe.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let m of s.getAttributeNames())if(m.endsWith(Ft)){let y=h[o++],g=s.getAttribute(m).split(W),q=/([.?@])?(.*)/.exec(y);c.push({type:1,index:n,name:q[2],strings:g,ctor:q[1]==="."?et:q[1]==="?"?tt:q[1]==="@"?rt:le}),s.removeAttribute(m)}else m.startsWith(W)&&(c.push({type:6,index:n}),s.removeAttribute(m));if(Xr.test(s.tagName)){let m=s.textContent.split(W),y=m.length-1;if(y>0){s.textContent=Ze?Ze.emptyScript:"";for(let g=0;g<y;g++)s.append(m[g],Me()),oe.nextNode(),c.push({type:2,index:++n});s.append(m[y],Me())}}}else if(s.nodeType===8)if(s.data===Bt)c.push({type:2,index:n});else{let m=-1;for(;(m=s.data.indexOf(W,m+1))!==-1;)c.push({type:7,index:n}),m+=W.length-1}n++}}static createElement(t,e){let r=ne.createElement("template");return r.innerHTML=t,r}};function ae(i,t,e=i,r){var o,a,c;if(t===M)return t;let s=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl,n=Pe(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),n===void 0?s=void 0:(s=new n(i),s._$AT(i,e,r)),r!==void 0?((c=e._$Co)!=null?c:e._$Co=[])[r]=s:e._$Cl=s),s!==void 0&&(t=ae(i,s._$AS(i,t.values),s,r)),t}var Qe=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var u;let{el:{content:e},parts:r}=this._$AD,s=((u=t==null?void 0:t.creationScope)!=null?u:ne).importNode(e,!0);oe.currentNode=s;let n=oe.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new ge(n,n.nextSibling,this,t):c.type===1?h=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(h=new st(n,this,t)),this._$AV.push(h),c=r[++a]}o!==(c==null?void 0:c.index)&&(n=oe.nextNode(),o++)}return oe.currentNode=ne,s}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},ge=class i{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,r,s){var n;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=(n=s==null?void 0:s.isConnected)!=null?n:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ae(this,t,e),Pe(t)?t===E||t==null||t===""?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==M&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Br(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==E&&Pe(this._$AH)?this._$AA.nextSibling.data=t:this.$(ne.createTextNode(t)),this._$AH=t}g(t){var n;let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ve.createElement(jr(r.h,r.h[0]),this.options)),r);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{let o=new Qe(s,this),a=o.u(this.options);o.p(e),this.$(a),this._$AH=o}}_$AC(t){let e=Ur.get(t.strings);return e===void 0&&Ur.set(t.strings,e=new Ve(t)),e}T(t){Fr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,s=0;for(let n of t)s===e.length?e.push(r=new i(this.k(Me()),this.k(Me()),this,this.options)):r=e[s],r._$AI(n),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,n){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=E}_$AI(t,e=this,r,s){let n=this.strings,o=!1;if(n===void 0)t=ae(this,t,e,0),o=!Pe(t)||t!==this._$AH&&t!==M,o&&(this._$AH=t);else{let a=t,c,u;for(t=n[0],c=0;c<n.length-1;c++)u=ae(this,a[r+c],e,c),u===M&&(u=this._$AH[c]),o||(o=!Pe(u)||u!==this._$AH[c]),u===E?t=E:t!==E&&(t+=(u!=null?u:"")+n[c+1]),this._$AH[c]=u}o&&!s&&this.O(t)}O(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},et=class extends le{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===E?void 0:t}},tt=class extends le{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==E)}},rt=class extends le{constructor(t,e,r,s,n){super(t,e,r,s,n),this.type=5}_$AI(t,e=this){var o;if((t=(o=ae(this,t,e,0))!=null?o:E)===M)return;let r=this._$AH,s=t===E&&r!==E||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==E&&(r===E||s);s&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;typeof this._$AH=="function"?this._$AH.call((r=(e=this.options)==null?void 0:e.host)!=null?r:this.element,t):this._$AH.handleEvent(t)}},st=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){ae(this,t)}},Kr={j:Ft,P:W,A:Bt,C:1,M:Yr,L:Qe,R:Br,V:ae,D:ge,I:le,H:tt,N:rt,U:et,B:st},It=be.litHtmlPolyfillSupport,Ir;It==null||It(Ve,ge),((Ir=be.litHtmlVersions)!=null?Ir:be.litHtmlVersions=[]).push("3.1.0");var Wr=(i,t,e)=>{var n,o;let r=(n=e==null?void 0:e.renderBefore)!=null?n:t,s=r._$litPart$;if(s===void 0){let a=(o=e==null?void 0:e.renderBefore)!=null?o:null;r._$litPart$=s=new ge(t.insertBefore(Me(),a),a,void 0,e!=null?e:{})}return s._$AI(i),s};var f=class extends K{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let t=super.createRenderRoot();return(r=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Wr(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return M}},Jr;f._$litElement$=!0,f.finalized=!0,(Jr=globalThis.litElementHydrateSupport)==null||Jr.call(globalThis,{LitElement:f});var zt=globalThis.litElementPolyfillSupport;zt==null||zt({LitElement:f});var Gr;((Gr=globalThis.litElementVersions)!=null?Gr:globalThis.litElementVersions=[]).push("4.0.2");var _=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Ds={attribute:!0,type:String,converter:Te,reflect:!1,hasChanged:Ge},Os=(i=Ds,t,e)=>{let{kind:r,metadata:s}=e,n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(e.name,i),r==="accessor"){let{name:o}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,i)},init(a){return a!==void 0&&this.C(o,void 0,i),a}}}if(r==="setter"){let{name:o}=e;return function(a){let c=this[o];t.call(this,a),this.requestUpdate(o,c,i)}}throw Error("Unsupported decorator location: "+r)};function d(i){return(t,e)=>typeof e=="object"?Os(i,t,e):((r,s,n)=>{let o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?R(x({},r),{wrapped:!0}):r),o?Object.getOwnPropertyDescriptor(s,n):void 0})(i,t,e)}function C(i){return d(R(x({},i),{state:!0,attribute:!1}))}var ee=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function He(i,t){return(e,r,s)=>{let n=o=>{var a,c;return(c=(a=o.renderRoot)==null?void 0:a.querySelector(i))!=null?c:null};if(t){let{get:o,set:a}=typeof r=="object"?e:s!=null?s:(()=>{let c=Symbol();return{get(){return this[c]},set(u){this[c]=u}}})();return ee(e,r,{get(){let c=o.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return ee(e,r,{get(){return n(this)}})}}function Zr(i){return(t,e)=>{let{slot:r,selector:s}=i!=null?i:{},n="slot"+(r?`[name=${r}]`:":not([name])");return ee(t,e,{get(){var c,u;let o=(c=this.renderRoot)==null?void 0:c.querySelector(n),a=(u=o==null?void 0:o.assignedElements(i))!=null?u:[];return s===void 0?a:a.filter(h=>h.matches(s))}})}}function $(i,t){let e=x({waitUntilFirstUpdate:!1},t);return(r,s)=>{let{update:n}=r,o=Array.isArray(i)?i:[i];r.update=function(a){o.forEach(c=>{let u=c;if(a.has(u)){let h=a.get(u),m=this[u];h!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[s](h,m)}}),n.call(this,a)}}}var Qr=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],I="item";var P=class extends f{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent="false";this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(s=>s.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(s=>s.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:Qr};this._state="item-created";this._initialContext=R(x({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.state="item-created",this.addEventListener("qti-register-variable",({detail:e})=>{this._context=R(x({},this._context),{variables:[...this._context.variables,e.variable]}),this._initialContext=this._context}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let r=e.detail;this._feedbackElements.push(r),r.checkShowFeedback(r.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:r,countAttempt:s}=e.detail;this.updateResponseVariable(r,"true"),this.processResponse(s)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:s}=e.detail;this.updateOutcomeVariable(r,s)}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}set state(e){this._state=e}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type}))}set variables(e){if(!Array.isArray(e)||e.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=R(x({},this._context),{variables:this._context.variables.map(r=>{let s=e.find(n=>n.identifier===r.identifier);return s?x(x({},r),s):r})}),this._context.variables.forEach(r=>{if(r.type==="response"){let s=this._interactionElements.find(n=>n.responseIdentifier===r.identifier);s&&(s.response=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(s=>s.checkShowFeedback(r.identifier))})}firstUpdated(e){this.state="first-updated",requestAnimationFrame(()=>{this._emit("qti-assessment-item-first-updated",this)})}connectedCallback(){super.connectedCallback(),this.state="item-connected"}set responses(e){if(e)for(let r of e){this.getResponse(r.responseIdentifier)&&this.updateResponseVariable(r.responseIdentifier,r.response);let n=this._interactionElements.find(o=>o.getAttribute("response-identifier")===r.responseIdentifier);n&&(n.response=r.response)}}render(){return p`<slot></slot>`}showCorrectResponse(e){let s=this._context.variables.filter(n=>"correctResponse"in n&&n.correctResponse).map(n=>({responseIdentifier:n.identifier,response:n.correctResponse}));for(let n of s){let o=this._interactionElements.find(a=>a.getAttribute("response-identifier")===n.responseIdentifier);o&&(o.correctResponse=e?n.response:"")}}processResponse(e=!0){var s;let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((s=this._context.variables.find(n=>n.identifier==="numAttempts"))==null?void 0:s.value)+1).toString()),this._emit("qti-response-processed"),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(r=>r.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:r,response:s}=e.detail;this.updateResponseVariable(r,s)}updateResponseVariable(e,r){this._context=R(x({},this._context),{variables:this._context.variables.map(s=>s.identifier!==e?s:R(x({},s),{value:r}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,r){var n;let s=this.getOutcome(e);if(!s){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=R(x({},this._context),{variables:this._context.variables.map(o=>o.identifier!==e?o:R(x({},o),{value:s.cardinality==="single"?r:[...o.value,r]}))}),this._feedbackElements.forEach(o=>o.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:(n=this._context.variables.find(o=>o.identifier===e))==null?void 0:n.value})}_getCompletionStatus(){return this._interactionElements.every(e=>e.validate())?"completed":this._interactionElements.some(e=>e.validate())?"incomplete":"not_attempted"}_emit(e,r=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:r}))}};l([d({type:String})],P.prototype,"title",2),l([d({type:String})],P.prototype,"identifier",2),l([d({type:String})],P.prototype,"adaptive",2),l([d({type:String})],P.prototype,"timeDependent",2),l([d({type:Boolean})],P.prototype,"disabled",2),l([$("disabled",{waitUntilFirstUpdate:!0})],P.prototype,"_handleDisabledChange",2),l([d({type:Boolean})],P.prototype,"readonly",2),l([$("readonly",{waitUntilFirstUpdate:!0})],P.prototype,"_handleReadonlyChange",2),l([Ht({context:I})],P.prototype,"_context",2),P=l([_("qti-assessment-item")],P);var Us={SPACE:32},T=class extends f{constructor(){super(...arguments);this.tabindex=0;this.disabled=!1;this.readonly=!1;this.checked=!1}handleDisabledChange(e,r){r?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-register-choice",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-loose-choice",{bubbles:!0,cancelable:!1,composed:!0}))}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case Us.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("qti-choice-element-selected",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier,checked:this.checked}})))}validateAllProps(){return!!this.getAttribute("identifier")}render(){return this.validateAllProps()||console.warn(`Invalid props for ${this.outerHTML}`,"missing identifier"),p` <slot></slot> `}};l([d({type:String})],T.prototype,"identifier",2),l([d({type:Number,reflect:!0})],T.prototype,"tabindex",2),l([d({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:e=>e}})],T.prototype,"disabled",2),l([d({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:e=>e}})],T.prototype,"readonly",2),l([d({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>e}})],T.prototype,"checked",2),l([$("disabled",{waitUntilFirstUpdate:!0})],T.prototype,"handleDisabledChange",1);var es=b`
|
|
4
4
|
:host {
|
|
5
5
|
display: block;
|
|
6
6
|
}
|
|
@@ -241,7 +241,7 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
241
241
|
/>`}
|
|
242
242
|
</svg>
|
|
243
243
|
<slot></slot>
|
|
244
|
-
</line-container>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),a=n.split(",").map(c=>parseInt(c));Ae(o,a,r,s)}firstUpdated(e){super.firstUpdated(e),this.hotspots=
|
|
244
|
+
</line-container>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),a=n.split(",").map(c=>parseInt(c));Ae(o,a,r,s)}firstUpdated(e){super.firstUpdated(e),this.hotspots=this.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",r=>{this.mouseCoord={x:r.clientX-this.grImage[0].getBoundingClientRect().left,y:r.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(r=>{r.style.left=r.getAttribute("coords").split(",")[0]+"px",r.style.top=r.getAttribute("coords").split(",")[1]+"px",r.addEventListener("click",s=>{this.startPoint?this.endPoint||(this.endPoint=s.target,this._lines=[...this._lines,this.startPoint.getAttribute("identifier")+" "+this.endPoint.getAttribute("identifier")],this.saveResponse(this._lines),this.startPoint=null,this.endPoint=null):(this.startPoint=s.target,this.startCoord={x:this.startPoint.getAttribute("coords").split(",")[0],y:this.startPoint.getAttribute("coords").split(",")[1]})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};Z.styles=[b`
|
|
245
245
|
slot:not([name='prompt']) {
|
|
246
246
|
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
247
247
|
display: block;
|