@citolab/qti-components 6.9.1-beta.65 → 6.9.1-beta.68
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-element-eslint-rules.js +331 -0
- package/dist/custom-elements.json +18695 -3089
- package/dist/index.global.js +1 -1
- package/dist/index.js +7633 -2
- package/dist/index.min.js +952 -0
- package/dist/qti-components/index.cjs +6506 -0
- package/dist/qti-components/index.d.cts +150 -0
- package/dist/qti-components/index.js +5832 -136
- package/dist/qti-components-jsx.d.ts +1870 -0
- package/dist/qti-item/index.cjs +90 -0
- package/dist/qti-item/index.d.cts +24 -0
- package/dist/qti-item/index.js +66 -2
- package/dist/qti-loader/index.cjs +333 -0
- package/dist/qti-loader/index.d.cts +20 -0
- package/dist/qti-loader/index.js +306 -2
- package/dist/qti-simple-choice-C2d4_r3u.d.cts +1137 -0
- package/dist/qti-transformers/index.cjs +317 -0
- package/dist/qti-transformers/index.d.cts +75 -0
- package/dist/qti-transformers/index.js +289 -2
- package/dist/vscode.css-custom-data.json +44 -0
- package/dist/vscode.html-custom-data.json +971 -0
- package/package.json +69 -30
- package/dist/chunk-NYAUPIAG.js +0 -2
- package/dist/chunk-YY52I6U7.js +0 -24
|
@@ -0,0 +1,952 @@
|
|
|
1
|
+
var Nr=Object.defineProperty,zi=Object.defineProperties,Wi=Object.getOwnPropertyDescriptor,Yi=Object.getOwnPropertyDescriptors;var Hr=Object.getOwnPropertySymbols;var Ki=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable;var Vr=(s,t,e)=>t in s?Nr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,q=(s,t)=>{for(var e in t||(t={}))Ki.call(t,e)&&Vr(s,e,t[e]);if(Hr)for(var e of Hr(t))Zi.call(t,e)&&Vr(s,e,t[e]);return s},S=(s,t)=>zi(s,Yi(t));var l=(s,t,e,r)=>{for(var i=r>1?void 0:r?Wi(t,e):t,o=s.length-1,n;o>=0;o--)(n=s[o])&&(i=(r?n(t,e,i):n(i))||i);return r&&i&&Nr(t,e,i),i};var ee=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 Ee=class{constructor(t,e,r,i){var o;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(n,a)=>{this.unsubscribe&&(this.unsubscribe!==a&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=n,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(n,a)),this.unsubscribe=a},this.host=t,e.context!==void 0){let n=e;this.context=n.context,this.callback=n.callback,this.subscribe=(o=n.subscribe)!=null?o:!1}else this.context=e,this.callback=r,this.subscribe=i!=null?i:!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new ee(this.context,this.t,this.subscribe))}};var vt=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:i}=this.subscriptions.get(t);t(this.value,i)}clearCallbacks(){this.subscriptions.clear()}};var Kt=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},Ce=class extends vt{constructor(t,e,r){var i,o;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=n=>{let a=n.composedPath()[0];n.context===this.context&&a!==this.host&&(n.stopPropagation(),this.addCallback(n.callback,a,n.subscribe))},this.onProviderRequest=n=>{let a=n.composedPath()[0];if(n.context!==this.context||a===this.host)return;let c=new Set;for(let[p,{consumerHost:f}]of this.subscriptions)c.has(p)||(c.add(p),f.dispatchEvent(new ee(this.context,p,!0)));n.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(o=(i=this.host).addController)==null||o.call(i,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Kt(this.context))}};function Zt({context:s}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new Ce(this,{context:s}))}),{get(){return t.get.call(this)},set(i){var o;return(o=r.get(this))==null||o.setValue(i),t.set.call(this,i)},init(i){var o;return(o=r.get(this))==null||o.setValue(i),i}};{t.constructor.addInitializer(n=>{r.set(n,new Ce(n,{context:s}))});let i=Object.getOwnPropertyDescriptor(t,e),o;if(i===void 0){let n=new WeakMap;o={get(){return n.get(this)},set(a){r.get(this).setValue(a),n.set(this,a)},configurable:!0,enumerable:!0}}else{let n=i.set;o=S(q({},i),{set(a){r.get(this).setValue(a),n==null||n.call(this,a)}})}return void Object.defineProperty(t,e,o)}}}function k({context:s,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new Ee(this,{context:s,callback:i=>{e.set.call(this,i)},subscribe:t})}):e.constructor.addInitializer(i=>{new Ee(i,{context:s,callback:o=>{i[r]=o},subscribe:t})})}}var Pr=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Ir=new WeakMap,Oe=s=>{let t=Ir.get(s);return t===void 0&&Ir.set(s,t=new Map),t},Gi=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from(Oe(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){var t;return(t=this.localName)==null?void 0:t.toUpperCase()}setAttribute(t,e){Oe(this).set(t,String(e))}removeAttribute(t){Oe(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 Oe(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 Pr(this);return this.__internals=t,t}getAttribute(t){let e=Oe(this).get(t);return e!=null?e:null}};var Qi=class extends Gi{},Or=Qi;var es=class{constructor(){this.__definitions=new Map}define(t,e){var r;if(this.__definitions.has(t))if(process.env.NODE_ENV==="development")console.warn(`'CustomElementRegistry' already has "${t}" defined. This may have been caused by live reload or hot module replacement in which case it can be safely ignored.
|
|
2
|
+
Make sure to test your application with a production build as repeat registrations will throw in production.`);else throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);e.__localName=t,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}},ts=es;var Ur=new ts;var Ue=globalThis,yt=Ue.ShadowRoot&&(Ue.ShadyCSS===void 0||Ue.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Jt=Symbol(),Fr=new WeakMap,Fe=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Jt)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(yt&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Fr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Fr.set(e,t))}return t}toString(){return this.cssText}},Br=s=>new Fe(typeof s=="string"?s:s+"",void 0,Jt),g=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((r,i,o)=>r+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+s[o+1],s[0]);return new Fe(e,s,Jt)},Gt=(s,t)=>{if(yt)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=Ue.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,s.appendChild(r)}},xt=yt||Ue.CSSStyleSheet===void 0?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Br(e)})(s):s;var{is:rs,defineProperty:is,getOwnPropertyDescriptor:ss,getOwnPropertyNames:os,getOwnPropertySymbols:ns,getPrototypeOf:as}=Object,I=globalThis,zr;(zr=I.customElements)!=null||(I.customElements=Ur);var Xr=I.trustedTypes,ls=Xr?Xr.emptyScript:"",Qt=I.reactiveElementPolyfillSupport,Be=(s,t)=>s,Xe={toAttribute(s,t){switch(t){case Boolean:s=s?ls:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch(r){e=null}}return e}},Et=(s,t)=>!rs(s,t),jr={attribute:!0,type:String,converter:Xe,reflect:!1,hasChanged:Et},Wr,Yr;(Wr=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Yr=I.litPropertyMetadata)!=null||(I.litPropertyMetadata=new WeakMap);var Kr,K=class extends((Kr=globalThis.HTMLElement)!=null?Kr:Or){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=jr){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&is(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){var n;let{get:i,set:o}=(n=ss(this.prototype,t))!=null?n:{get(){return this[e]},set(a){this[e]=a}};return{get(){return i==null?void 0:i.call(this)},set(a){let c=i==null?void 0:i.call(this);o.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:jr}static _$Ei(){if(this.hasOwnProperty(Be("elementProperties")))return;let t=as(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(Be("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Be("properties"))){let e=this.properties,r=[...os(e),...ns(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(xt(i))}else t!==void 0&&e.push(xt(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 Gt(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 i;return(i=r.hostConnected)==null?void 0:i.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 o;let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let n=(((o=r.converter)==null?void 0:o.toAttribute)!==void 0?r.converter:Xe).toAttribute(e,r.type);this._$Em=t,n==null?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(t,e){var o;let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let n=r.getPropertyOptions(i),a=typeof n.converter=="function"?{fromAttribute:n.converter}:((o=n.converter)==null?void 0:o.fromAttribute)!==void 0?n.converter:Xe;this._$Em=i,this[i]=a.fromAttribute(e,n.type),this._$Em=null}}requestUpdate(t,e,r){var i;if(t!==void 0){if(r!=null||(r=this.constructor.getPropertyOptions(t)),!((i=r.hasChanged)!=null?i:Et)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){var i;this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&((i=this._$Ej)!=null?i: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,i;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[n,a]of this._$Ep)this[n]=a;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[n,a]of o)a.wrapped!==!0||this._$AL.has(n)||this[n]===void 0||this.P(n,this[n],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(i=this._$EO)==null||i.forEach(o=>{var n;return(n=o.hostUpdate)==null?void 0:n.call(o)}),this.update(e)):this._$EU()}catch(o){throw t=!1,this._$EU(),o}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$EO)==null||e.forEach(r=>{var i;return(i=r.hostUpdated)==null?void 0:i.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){}},Zr;K.elementStyles=[],K.shadowRootOptions={mode:"open"},K[Be("elementProperties")]=new Map,K[Be("finalized")]=new Map,Qt==null||Qt({ReactiveElement:K}),((Zr=I.reactiveElementVersions)!=null?Zr:I.reactiveElementVersions=[]).push("2.0.4");var _e=globalThis,Ct=_e.trustedTypes,Jr=Ct?Ct.createPolicy("lit-html",{createHTML:s=>s}):void 0,rr="$lit$",Z=`lit$${Math.random().toFixed(9).slice(2)}$`,ir="?"+Z,cs=`<${ir}>`,fe=_e.document===void 0?{createTreeWalker:()=>({})}:document,ze=()=>fe.createComment(""),We=s=>s===null||typeof s!="object"&&typeof s!="function",sr=Array.isArray,si=s=>sr(s)||typeof(s==null?void 0:s[Symbol.iterator])=="function",er=`[
|
|
3
|
+
\f\r]`,je=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Gr=/-->/g,Qr=/>/g,he=RegExp(`>|${er}(?:([^\\s"'>=/]+)(${er}*=${er}*(?:[^
|
|
4
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),ei=/'/g,ti=/"/g,oi=/^(?:script|style|textarea|title)$/i,or=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),u=or(1),nr=or(2),ho=or(3),L=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),ri=new WeakMap,me=fe.createTreeWalker(fe,129);function ni(s,t){if(!sr(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Jr!==void 0?Jr.createHTML(t):t}var ai=(s,t)=>{let e=s.length-1,r=[],i,o=t===2?"<svg>":t===3?"<math>":"",n=je;for(let a=0;a<e;a++){let c=s[a],p,f,m=-1,y=0;for(;y<c.length&&(n.lastIndex=y,f=n.exec(c),f!==null);)y=n.lastIndex,n===je?f[1]==="!--"?n=Gr:f[1]!==void 0?n=Qr:f[2]!==void 0?(oi.test(f[2])&&(i=RegExp("</"+f[2],"g")),n=he):f[3]!==void 0&&(n=he):n===he?f[0]===">"?(n=i!=null?i:je,m=-1):f[1]===void 0?m=-2:(m=n.lastIndex-f[2].length,p=f[1],n=f[3]===void 0?he:f[3]==='"'?ti:ei):n===ti||n===ei?n=he:n===Gr||n===Qr?n=je:(n=he,i=void 0);let b=n===he&&s[a+1].startsWith("/>")?" ":"";o+=n===je?c+cs:m>=0?(r.push(p),c.slice(0,m)+rr+c.slice(m)+Z+b):c+Z+(m===-2?a:b)}return[ni(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},Ye=class s{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let o=0,n=0,a=t.length-1,c=this.parts,[p,f]=ai(t,e);if(this.el=s.createElement(p,r),me.currentNode=this.el.content,e===2||e===3){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(i=me.nextNode())!==null&&c.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let m of i.getAttributeNames())if(m.endsWith(rr)){let y=f[n++],b=i.getAttribute(m).split(Z),C=/([.?@])?(.*)/.exec(y);c.push({type:1,index:o,name:C[2],strings:b,ctor:C[1]==="."?wt:C[1]==="?"?qt:C[1]==="@"?At:be}),i.removeAttribute(m)}else m.startsWith(Z)&&(c.push({type:6,index:o}),i.removeAttribute(m));if(oi.test(i.tagName)){let m=i.textContent.split(Z),y=m.length-1;if(y>0){i.textContent=Ct?Ct.emptyScript:"";for(let b=0;b<y;b++)i.append(m[b],ze()),me.nextNode(),c.push({type:2,index:++o});i.append(m[y],ze())}}}else if(i.nodeType===8)if(i.data===ir)c.push({type:2,index:o});else{let m=-1;for(;(m=i.data.indexOf(Z,m+1))!==-1;)c.push({type:7,index:o}),m+=Z.length-1}o++}}static createElement(t,e){let r=fe.createElement("template");return r.innerHTML=t,r}};function ge(s,t,e=s,r){var n,a,c;if(t===L)return t;let i=r!==void 0?(n=e._$Co)==null?void 0:n[r]:e._$Cl,o=We(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==o&&((a=i==null?void 0:i._$AO)==null||a.call(i,!1),o===void 0?i=void 0:(i=new o(s),i._$AT(s,e,r)),r!==void 0?((c=e._$Co)!=null?c:e._$Co=[])[r]=i:e._$Cl=i),i!==void 0&&(t=ge(s,i._$AS(s,t.values),i,r)),t}var _t=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 p;let{el:{content:e},parts:r}=this._$AD,i=((p=t==null?void 0:t.creationScope)!=null?p:fe).importNode(e,!0);me.currentNode=i;let o=me.nextNode(),n=0,a=0,c=r[0];for(;c!==void 0;){if(n===c.index){let f;c.type===2?f=new we(o,o.nextSibling,this,t):c.type===1?f=new c.ctor(o,c.name,c.strings,this,t):c.type===6&&(f=new Tt(o,this,t)),this._$AV.push(f),c=r[++a]}n!==(c==null?void 0:c.index)&&(o=me.nextNode(),n++)}return me.currentNode=fe,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},we=class s{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,r,i){var o;this.type=2,this._$AH=w,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this._$Cv=(o=i==null?void 0:i.isConnected)!=null?o:!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=ge(this,t,e),We(t)?t===w||t==null||t===""?(this._$AH!==w&&this._$AR(),this._$AH=w):t!==this._$AH&&t!==L&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):si(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==w&&We(this._$AH)?this._$AA.nextSibling.data=t:this.T(fe.createTextNode(t)),this._$AH=t}$(t){var o;let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ye.createElement(ni(r.h,r.h[0]),this.options)),r);if(((o=this._$AH)==null?void 0:o._$AD)===i)this._$AH.p(e);else{let n=new _t(i,this),a=n.u(this.options);n.p(e),this.T(a),this._$AH=n}}_$AC(t){let e=ri.get(t.strings);return e===void 0&&ri.set(t.strings,e=new Ye(t)),e}k(t){sr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let o of t)i===e.length?e.push(r=new s(this.O(ze()),this.O(ze()),this,this.options)):r=e[i],r._$AI(o),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$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 i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},be=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,o){this.type=1,this._$AH=w,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=w}_$AI(t,e=this,r,i){let o=this.strings,n=!1;if(o===void 0)t=ge(this,t,e,0),n=!We(t)||t!==this._$AH&&t!==L,n&&(this._$AH=t);else{let a=t,c,p;for(t=o[0],c=0;c<o.length-1;c++)p=ge(this,a[r+c],e,c),p===L&&(p=this._$AH[c]),n||(n=!We(p)||p!==this._$AH[c]),p===w?t=w:t!==w&&(t+=(p!=null?p:"")+o[c+1]),this._$AH[c]=p}n&&!i&&this.j(t)}j(t){t===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},wt=class extends be{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===w?void 0:t}},qt=class extends be{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==w)}},At=class extends be{constructor(t,e,r,i,o){super(t,e,r,i,o),this.type=5}_$AI(t,e=this){var n;if((t=(n=ge(this,t,e,0))!=null?n:w)===L)return;let r=this._$AH,i=t===w&&r!==w||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==w&&(r===w||i);i&&this.element.removeEventListener(this.name,this,r),o&&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)}},Tt=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){ge(this,t)}},li={M:rr,P:Z,A:ir,C:1,L:ai,R:_t,D:si,V:ge,I:we,H:be,N:qt,U:At,B:wt,F:Tt},tr=_e.litHtmlPolyfillSupport,ii;tr==null||tr(Ye,we),((ii=_e.litHtmlVersions)!=null?ii:_e.litHtmlVersions=[]).push("3.2.1");var ci=(s,t,e)=>{var o,n;let r=(o=e==null?void 0:e.renderBefore)!=null?o:t,i=r._$litPart$;if(i===void 0){let a=(n=e==null?void 0:e.renderBefore)!=null?n:null;r._$litPart$=i=new we(t.insertBefore(ze(),a),a,void 0,e!=null?e:{})}return i._$AI(s),i};var v=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=ci(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}},pi;v._$litElement$=!0,v.finalized=!0,(pi=globalThis.litElementHydrateSupport)==null||pi.call(globalThis,{LitElement:v});var ar=globalThis.litElementPolyfillSupport;ar==null||ar({LitElement:v});var di;((di=globalThis.litElementVersions)!=null?di:globalThis.litElementVersions=[]).push("4.1.1");var h=s=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(s,t)}):customElements.define(s,t)};var ps={attribute:!0,type:String,converter:Xe,reflect:!1,hasChanged:Et},ds=(s=ps,t,e)=>{let{kind:r,metadata:i}=e,o=globalThis.litPropertyMetadata.get(i);if(o===void 0&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(e.name,s),r==="accessor"){let{name:n}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(n,c,s)},init(a){return a!==void 0&&this.P(n,void 0,s),a}}}if(r==="setter"){let{name:n}=e;return function(a){let c=this[n];t.call(this,a),this.requestUpdate(n,c,s)}}throw Error("Unsupported decorator location: "+r)};function d(s){return(t,e)=>typeof e=="object"?ds(s,t,e):((r,i,o)=>{let n=i.hasOwnProperty(o);return i.constructor.createProperty(o,n?S(q({},r),{wrapped:!0}):r),n?Object.getOwnPropertyDescriptor(i,o):void 0})(s,t,e)}function E(s){return d(S(q({},s),{state:!0,attribute:!1}))}var te=(s,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(s,t,e),e);function ve(s,t){return(e,r,i)=>{let o=n=>{var a,c;return(c=(a=n.renderRoot)==null?void 0:a.querySelector(s))!=null?c:null};if(t){let{get:n,set:a}=typeof r=="object"?e:i!=null?i:(()=>{let c=Symbol();return{get(){return this[c]},set(p){this[c]=p}}})();return te(e,r,{get(){let c=n.call(this);return c===void 0&&(c=o(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return te(e,r,{get(){return o(this)}})}}function ui(s){return(t,e)=>{let{slot:r,selector:i}=s!=null?s:{},o="slot"+(r?`[name=${r}]`:":not([name])");return te(t,e,{get(){var c,p;let n=(c=this.renderRoot)==null?void 0:c.querySelector(o),a=(p=n==null?void 0:n.assignedElements(s))!=null?p:[];return i===void 0?a:a.filter(f=>f.matches(i))}})}}function M(s,t){let e=q({waitUntilFirstUpdate:!1},t);return(r,i)=>{let{update:o}=r,n=Array.isArray(s)?s:[s];r.update=function(a){n.forEach(c=>{let p=c;if(a.has(p)){let f=a.get(p),m=this[p];f!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[i](f,m)}}),o.call(this,a)}}}var hi=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],$=Symbol("item");var D=class extends v{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent=null;this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(i=>i.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(i=>i.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:hi};this._initialContext=S(q({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.addEventListener("qti-register-variable",e=>{this._context=S(q({},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:i}=e.detail;this.updateResponseVariable(r,"true"),this.processResponse(i)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:i}=e.detail;this.updateOutcomeVariable(r,i),e.stopPropagation()}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}get variables(){return this._context.variables.map(e=>q({identifier:e.identifier,value:e.value,type:e.type},e.type==="outcome"&&e.identifier==="SCORE"?{externalScored:e.externalScored}:{}))}set variables(e){if(!Array.isArray(e)||e.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=S(q({},this._context),{variables:this._context.variables.map(r=>{let i=e.find(o=>o.identifier===r.identifier);return i?q(q({},r),i):r})}),this._context.variables.forEach(r=>{if(r.type==="response"){let i=this._interactionElements.find(o=>o.responseIdentifier===r.identifier);i&&(i.value=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(i=>i.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 o=this._interactionElements.find(n=>n.getAttribute("response-identifier")===r.responseIdentifier);o&&(o.value=r.response)}}render(){return u`<slot></slot>`}showCorrectResponse(e){let i=this._context.variables.filter(o=>"correctResponse"in o&&o.correctResponse).map(o=>({responseIdentifier:o.identifier,response:o.correctResponse}));for(let o of i){let n=this._interactionElements.find(a=>a.getAttribute("response-identifier")===o.responseIdentifier);n&&(n.correctResponse=e?o.response:"")}}processResponse(e=!0){var i;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",(+((i=this._context.variables.find(o=>o.identifier==="numAttempts"))==null?void 0:i.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:i}=e.detail;this.updateResponseVariable(r,i)}updateResponseVariable(e,r){this._context=S(q({},this._context),{variables:this._context.variables.map(i=>i.identifier!==e?i:S(q({},i),{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 o;let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=S(q({},this._context),{variables:this._context.variables.map(n=>n.identifier!==e?n:S(q({},n),{value:i.cardinality==="single"?r:[...n.value,r]}))}),this._feedbackElements.forEach(n=>n.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:(o=this._context.variables.find(n=>n.identifier===e))==null?void 0:o.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})],D.prototype,"title",2),l([d({type:String})],D.prototype,"identifier",2),l([d({type:String})],D.prototype,"adaptive",2),l([d({type:String})],D.prototype,"timeDependent",2),l([d({type:Boolean})],D.prototype,"disabled",2),l([M("disabled",{waitUntilFirstUpdate:!0})],D.prototype,"_handleDisabledChange",2),l([d({type:Boolean})],D.prototype,"readonly",2),l([M("readonly",{waitUntilFirstUpdate:!0})],D.prototype,"_handleReadonlyChange",2),l([Zt({context:$})],D.prototype,"_context",2),D=l([h("qti-assessment-item")],D);var us=String.raw,hs=us`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
5
|
+
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
|
|
6
|
+
<xsl:template match="@*|node()">
|
|
7
|
+
<xsl:copy>
|
|
8
|
+
<xsl:apply-templates select="@*|node()"/>
|
|
9
|
+
</xsl:copy>
|
|
10
|
+
</xsl:template>
|
|
11
|
+
|
|
12
|
+
<!-- remove existing namespaces -->
|
|
13
|
+
<xsl:template match="*">
|
|
14
|
+
<!-- remove element prefix -->
|
|
15
|
+
<xsl:element name="{local-name()}">
|
|
16
|
+
<!-- process attributes -->
|
|
17
|
+
<xsl:for-each select="@*">
|
|
18
|
+
<!-- remove attribute prefix -->
|
|
19
|
+
<xsl:attribute name="{local-name()}">
|
|
20
|
+
<xsl:value-of select="."/>
|
|
21
|
+
</xsl:attribute>
|
|
22
|
+
</xsl:for-each>
|
|
23
|
+
<xsl:apply-templates/>
|
|
24
|
+
</xsl:element>
|
|
25
|
+
</xsl:template>
|
|
26
|
+
</xsl:stylesheet>`;function mi(s,t,e){s.querySelectorAll(t).forEach(r=>{let i=`${t}-${e}`,o=gi(r,i);r.replaceWith(o)})}function fi(s,t){s.querySelectorAll("*").forEach(e=>{let r=e.classList;r&&r.forEach(i=>{if(i.startsWith(`${t}:`)){let o=i.slice(`${t}:`.length),n=`${e.nodeName}-${o}`,a=gi(e,n);e.replaceWith(a)}})})}function gi(s,t){let e=document.createElement(t);for(let r of s.attributes)e.setAttribute(r.name,r.value);for(;s.firstChild;)e.appendChild(s.firstChild);return e}function bi(s){let t=[];return s.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),i=e.getAttribute("href"),o=e.getAttribute("category");t.push({identifier:r,href:i,category:o})}),t}var lr=null;function qe(s,t=!1){return t&&lr!==null&&lr.abort(),new Promise((e,r)=>{let i=new XMLHttpRequest;lr=i,i.open("GET",s,!0),i.responseType="document",i.onload=()=>{i.status>=200&&i.status<300?e(i.responseXML):r(i.statusText)},i.onerror=()=>{r(i.statusText)},i.send()})}function Ae(s){return new DOMParser().parseFromString(s,"text/xml")}function Te(s){let t=new XSLTProcessor,e=new DOMParser().parseFromString(hs,"text/xml");return t.importStylesheet(e),t.transformToFragment(s,document)}function vi(s,t){t.endsWith("/")||(t+="/"),s.querySelectorAll("[src],[href],[primary-path]").forEach(e=>{var o;let r="";e.getAttribute("src")&&(r="src"),e.getAttribute("href")&&(r="href"),e.getAttribute("primary-path")&&(r="primary-path");let i=(o=e.getAttribute(r))==null?void 0:o.trim();if(!i.startsWith("data:")&&!i.startsWith("http")){let n=t+encodeURI(i);e.setAttribute(r,n)}})}function yi(s){s.querySelectorAll('qti-custom-operator[class="js.org"] > qti-base-value').forEach(e=>{let r=document.createComment(e.textContent);e.replaceChild(r,e.firstChild)})}function xi(s){s.querySelectorAll("qti-stylesheet").forEach(t=>t.remove())}var St=()=>{let s,t={async load(e,r=!1){return new Promise((i,o)=>{qe(e,r).then(n=>(s=n,t.path(e.substring(0,e.lastIndexOf("/"))),i(t)))})},parse(e){return s=Ae(e),t},path:e=>(vi(s,e),t),fn(e){return e(s),t},pciHooks(e){let r=["hook","module"],i=e.substring(0,e.lastIndexOf("/"));for(let o of r)s.querySelectorAll("["+o+"]").forEach(a=>{let c=a.getAttribute(o);!c.startsWith("data:")&&!c.startsWith("http")&&(a.setAttribute("base-url",e),a.setAttribute("module",i+"/"+encodeURI(c+(c.endsWith(".js")?"":".js"))))});return t},extendElementName:(e,r)=>(mi(s,e,r),t),extendElementsWithClass:(e="extend")=>(fi(s,e),t),customInteraction(e,r){let i=s.querySelector("qti-custom-interaction"),o=i.querySelector("object");return i.setAttribute("data-base-ref",e),i.setAttribute("data-base-item",e+r),i.setAttribute("data",o.getAttribute("data")),i.setAttribute("width",o.getAttribute("width")),i.setAttribute("height",o.getAttribute("height")),i.removeChild(o),t},convertCDATAtoComment(){return yi(s),t},stripStyleSheets(){return xi(s),t},html(){return new XMLSerializer().serializeToString(Te(s))},xml(){return new XMLSerializer().serializeToString(s)},htmlDoc(){return Te(s)},xmlDoc(){return s}};return t};var Ei=()=>{let s,t={async load(e){return new Promise((r,i)=>{qe(e).then(o=>(s=o,r(t)))})},parse(e){s=Ae(e)},assessmentTest(){let e=s.querySelector('resource[type="imsqti_test_xmlv3p0"]');return{href:e.getAttribute("href"),identifier:e.getAttribute("identifier")}}};return t};var cr=()=>{let s,t={async load(e){return new Promise((r,i)=>{qe(e).then(o=>(s=o,r(t)))})},parse(e){return s=Ae(e),t},fn(e){return e(s),t},items(){return bi(s)},html(){return new XMLSerializer().serializeToString(Te(s))},xml(){return new XMLSerializer().serializeToString(s)},htmlDoc(){return Te(s)},xmlDoc(){return s}};return t};var Se=class extends v{constructor(){super(...arguments);this.identifier="";this.href=""}async connectedCallback(){super.connectedCallback();let e=new Event("qti-assessment-stimulus-ref-connected",{cancelable:!0,bubbles:!0});if(this.dispatchEvent(e)){let o=this.closest("qti-assessment-item").querySelector(`[data-stimulus-idref=${this.identifier}]`);o?await this.updateStimulusRef(o):console.warn(`Stimulus with data-stimulus-idref ${this.identifier} not found`)}}async updateStimulusRef(e){let r=this.href.substring(0,this.href.lastIndexOf("/")),i=await St().load(this.href).then(o=>o.path(r).htmlDoc());if(i){let o=i.querySelectorAll("qti-stimulus-body, qti-stylesheet");e.innerHTML="",e.append(...o)}}};l([d({type:String})],Se.prototype,"identifier",2),l([d({type:String})],Se.prototype,"href",2),Se=l([h("qti-assessment-stimulus-ref")],Se);var Ci={toAttribute:s=>s?"true":"false",fromAttribute:s=>s==="true"};function O(s,t){class e extends s{constructor(...o){super(...o);this.identifier="";this.tabIndex=0;this.disabled=!1;this.readonly=!1;this.internals=this.attachInternals()}handleDisabledChange(o,n){this.tabIndex=n?-1:0,n&&this.blur()}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`register-${t}`,{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent(`unregister-${t}`,{bubbles:!0,composed:!0}))}_onKeyUp(o){o.altKey||o.code==="Space"&&(o.preventDefault(),this._activate())}_onClick(){this.disabled||this.readonly||(this.focus(),this._activate())}_activate(){this.disabled||this.readonly||this.dispatchEvent(new CustomEvent(`activate-${t}`,{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}render(){return u`<slot></slot>`}}return l([d({type:String})],e.prototype,"identifier",2),l([d({type:Number,reflect:!0,attribute:"tabindex"})],e.prototype,"tabIndex",2),l([d({type:Boolean,reflect:!0,attribute:"aria-disabled",converter:Ci})],e.prototype,"disabled",2),l([d({type:Boolean,reflect:!0,attribute:"aria-readonly",converter:Ci})],e.prototype,"readonly",2),l([M("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"handleDisabledChange",1),e}var _i=g`
|
|
27
|
+
:host {
|
|
28
|
+
display: block;
|
|
29
|
+
}
|
|
30
|
+
`;var Ke=class extends v{render(){return u`<slot name="qti-rubric-block"></slot><slot></slot>`}};Ke.styles=_i,Ke=l([h("qti-item-body")],Ke);var Mt=class extends v{render(){return u`<slot></slot>`}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};Mt=l([h("qti-prompt")],Mt);var $t=class extends v{constructor(){super(...arguments);this.styleElement=null}firstUpdated(e){super.firstUpdated(e);let r=this.getAttribute("href");if(r!==null&&fetch(r).then(i=>i.text()).then(i=>{let o=this.minifyCss(i);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${o}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}).catch(i=>{console.error("Failed to load stylesheet:",i)}),this.textContent!==null&&this.textContent.trim()!==""){let i=this.minifyCss(this.textContent);this.styleElement=document.createElement("style"),this.styleElement.media="screen",this.styleElement.textContent=`@scope {${i}}`,this.parentElement?this.parentElement.appendChild(this.styleElement):console.warn("No parent element to append the scoped stylesheet to.")}}minifyCss(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\s+/g," ").replace(/\s*([{}:;])\s*/g,"$1").trim()}disconnectedCallback(){if(this.styleElement)try{this.styleElement.remove()}catch(e){console.error("Could not remove stylesheet:",e)}super.disconnectedCallback()}};$t=l([h("qti-stylesheet")],$t);var re=class extends v{render(){return u`<slot></slot>`}defaultValues(t){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0)return null;let r=e.map(i=>i.innerHTML.trim());return r.length>1||t.cardinality==="multiple"||t.cardinality==="ordered"?r:r[0]}};re=l([h("qti-variabledeclaration")],re);var U=class extends re{constructor(){super(...arguments);this.externalScored=null}render(){var r,i;let e=(i=(r=this.itemContext)==null?void 0:r.variables.find(o=>o.identifier===this.identifier))==null?void 0:i.value;return u`${JSON.stringify(e,null,2)}`}get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let r=new Map;for(let i of e.querySelectorAll("qti-interpolation-table-entry")){!i.getAttribute("source-value")&&i.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let o=parseInt(i.getAttribute("source-value")),n=parseInt(i.getAttribute("target-value"));(isNaN(o)||isNaN(n))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),r.set(o,n)}return r}return null}connectedCallback(){super.connectedCallback();let e={identifier:this.identifier,cardinality:this.cardinality,baseType:this.baseType,type:"outcome",value:null,interpolationTable:this.interpolationTable,externalScored:this.externalScored};e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};U.styles=[g`
|
|
31
|
+
:host {
|
|
32
|
+
display: none;
|
|
33
|
+
}
|
|
34
|
+
`],l([d({type:String,attribute:"base-type"})],U.prototype,"baseType",2),l([d({type:String,attribute:"external-scored"})],U.prototype,"externalScored",2),l([d({type:String})],U.prototype,"identifier",2),l([d({type:String})],U.prototype,"cardinality",2),l([k({context:$,subscribe:!0}),E()],U.prototype,"itemContext",2),U=l([h("qti-outcome-declaration")],U);var J=class extends re{render(){var e,r;let t=(r=(e=this.itemContext)==null?void 0:e.variables.find(i=>i.identifier===this.identifier))==null?void 0:r.value;return u`${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 i=0;i<r.length;i++)t.push(r[i].textContent),r[i].remove()}}return t}get mapping(){return this.querySelector("qti-mapping")}};J.styles=[g`
|
|
35
|
+
:host {
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
38
|
+
`],l([d({type:String,attribute:"base-type"})],J.prototype,"baseType",2),l([d({type:String})],J.prototype,"identifier",2),l([d({type:String})],J.prototype,"cardinality",2),l([k({context:$,subscribe:!0}),E()],J.prototype,"itemContext",2),J=l([h("qti-response-declaration")],J);var Rt=class extends v{};Rt=l([h("qti-companion-materials-info")],Rt);var kt=class extends v{render(){return u`<slot></slot>`}};kt=l([h("qti-content-body")],kt);var F=class extends v{handleclassNamesChange(t,e){this.classNames.split(" ").forEach(i=>{switch(i){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return u`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};F.styles=g`
|
|
39
|
+
:host {
|
|
40
|
+
display: block;
|
|
41
|
+
}
|
|
42
|
+
`,l([d({type:String})],F.prototype,"id",2),l([d({type:String})],F.prototype,"use",2),l([d({type:String})],F.prototype,"view",2),l([d({type:String,attribute:"class"})],F.prototype,"classNames",2),l([M("classNames",{waitUntilFirstUpdate:!0})],F.prototype,"handleclassNamesChange",1),F=l([h("qti-rubric-block")],F);var ms=()=>new Intl.NumberFormat().format(.1).replace(/\d/g,""),Ze=s=>{if(typeof s=="string")return s;let t=ms();return t==="."?s.toLocaleString():s.toString().replace(".","").replace(t,".")};function pr(s){return s==null}function Je(s){return s.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}var H=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(t){let e=this._context.variables.find(i=>i.identifier===t)||null;if(this.outcomeIdentifier!==t||!e)return;let r=!1;Array.isArray(e.value)?r=e.value.includes(this.identifier):r=!pr(this.identifier)&&!pr(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"}};l([d({type:String,attribute:"show-hide"})],H.prototype,"showHide",2),l([d({type:String,attribute:"outcome-identifier"})],H.prototype,"outcomeIdentifier",2),l([d({type:String})],H.prototype,"identifier",2),l([d({type:String,attribute:!1})],H.prototype,"showStatus",2),l([k({context:$,subscribe:!0}),E()],H.prototype,"_context",2);var Ge=class extends H{render(){return u` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `}firstUpdated(t){this.checkShowFeedback(this.outcomeIdentifier)}};Ge.styles=g`
|
|
43
|
+
:host {
|
|
44
|
+
display: block;
|
|
45
|
+
}
|
|
46
|
+
.on {
|
|
47
|
+
display: block;
|
|
48
|
+
}
|
|
49
|
+
.off {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
`,Ge=l([h("qti-feedback-block")],Ge);var Qe=class extends H{constructor(){super(...arguments);this.render=()=>u` <slot part="feedback" class="${this.showStatus}"></slot> `}};Qe.styles=g`
|
|
53
|
+
.on {
|
|
54
|
+
display: inline-block;
|
|
55
|
+
}
|
|
56
|
+
.off {
|
|
57
|
+
display: none;
|
|
58
|
+
}
|
|
59
|
+
`,Qe=l([h("qti-feedback-inline")],Qe);var et=class extends H{constructor(){super(...arguments);this.render=()=>u` <slot part="feedback" class="${this.showStatus}"></slot> `}};et.styles=g`
|
|
60
|
+
.on {
|
|
61
|
+
display: inline-block;
|
|
62
|
+
}
|
|
63
|
+
.off {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
`,et=l([h("qti-modal-feedback")],et);var ie=s=>s!=null?s:w;var x=class extends v{constructor(){super();this.responseIdentifier="";this.disabled=!1;this.readonly=!1;this._correctResponse="";this._internals=this.attachInternals()}reportValidity(){return this._internals.reportValidity()}reset(){this.value=""}get correctResponse(){return this._correctResponse}set correctResponse(e){this._correctResponse=e}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,cancelable:!1}))}saveResponse(e){this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,cancelable:!1,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(e)?[...e]:e}}))}};x.formAssociated=!0,l([d({type:String,attribute:"response-identifier"})],x.prototype,"responseIdentifier",2),l([d({reflect:!0,type:Boolean})],x.prototype,"disabled",2),l([d({reflect:!0,type:Boolean})],x.prototype,"readonly",2),l([E()],x.prototype,"_correctResponse",2);var V=class extends x{constructor(){super(...arguments);this._rows=5;this._value=""}handleclassNamesChange(e,r){let i=r.split(" "),o=!1;if(i.forEach(n=>{if(n.startsWith("qti-height-lines-")){let a=n.replace("qti-height-lines-","");this._rows=parseInt(a),o=!0}}),!o&&this.expectedLength){let n=Math.ceil(this.expectedLength/50);this._rows=n}}get value(){return this._value}set value(e){if(typeof e=="string"){this._value=e;let r=new FormData;r.append(this.responseIdentifier,e),this._internals.setFormValue(r),this.validate()}else throw new Error("Value must be a string")}validate(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage){this._internals.setValidity({}),e.setCustomValidity("");let r=this.patternMask.startsWith("^")&&this.patternMask.endsWith("$")?this.patternMask:`^${this.patternMask}$`,i=new RegExp(r);e.checkValidity()&&i.test(e.value)||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage))}else{let r=e.checkValidity();this._internals.setValidity(r?{}:{customError:!1})}return this._value!==""&&e.checkValidity()}reportValidity(){let e=this.shadowRoot.querySelector("textarea");if(!e)return!1;let r=this.validate();return r||e.reportValidity(),r}static get styles(){return[g`
|
|
67
|
+
/* PK: display host as block, else design will be collapsed */
|
|
68
|
+
:host {
|
|
69
|
+
display: block;
|
|
70
|
+
}
|
|
71
|
+
textarea {
|
|
72
|
+
box-sizing: border-box;
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
border: 0;
|
|
76
|
+
}
|
|
77
|
+
`]}render(){return u`<slot name="prompt"></slot
|
|
78
|
+
><textarea
|
|
79
|
+
part="textarea"
|
|
80
|
+
name="${this.responseIdentifier}"
|
|
81
|
+
spellcheck="false"
|
|
82
|
+
autocomplete="off"
|
|
83
|
+
maxlength="${5e3}"
|
|
84
|
+
@keydown="${e=>e.stopImmediatePropagation()}"
|
|
85
|
+
@keyup="${this.textChanged}"
|
|
86
|
+
@change="${this.textChanged}"
|
|
87
|
+
@blur="${e=>{this.reportValidity()}}"
|
|
88
|
+
placeholder="${ie(this.placeholderText?this.placeholderText:void 0)}"
|
|
89
|
+
rows="${this._rows}"
|
|
90
|
+
?disabled="${this.disabled}"
|
|
91
|
+
?readonly="${this.readonly}"
|
|
92
|
+
.value=${this._value}
|
|
93
|
+
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;if(this.setEmptyAttribute(r.value),this._value!==r.value){this.value=r.value;let i=this.validate();this.saveResponse(r.value)}}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};l([E()],V.prototype,"_rows",2),l([d({type:Number,attribute:"expected-length"})],V.prototype,"expectedLength",2),l([d({type:String,attribute:"pattern-mask"})],V.prototype,"patternMask",2),l([d({type:String,attribute:"placeholder-text"})],V.prototype,"placeholderText",2),l([d({type:String,attribute:"data-patternmask-message"})],V.prototype,"dataPatternmaskMessage",2),l([E()],V.prototype,"_value",2),l([d({type:String,attribute:"class"})],V.prototype,"classNames",2),l([M("classNames")],V.prototype,"handleclassNamesChange",1),V=l([h("qti-extended-text-interaction")],V);var{I:fs}=li;var qi=s=>s.strings===void 0,wi=()=>document.createComment(""),Me=(s,t,e)=>{var o;let r=s._$AA.parentNode,i=t===void 0?s._$AB:t._$AA;if(e===void 0){let n=r.insertBefore(wi(),i),a=r.insertBefore(wi(),i);e=new fs(n,a,s,s.options)}else{let n=e._$AB.nextSibling,a=e._$AM,c=a!==s;if(c){let p;(o=e._$AQ)==null||o.call(e,s),e._$AM=s,e._$AP!==void 0&&(p=s._$AU)!==a._$AU&&e._$AP(p)}if(n!==i||c){let p=e._$AA;for(;p!==n;){let f=p.nextSibling;r.insertBefore(p,i),p=f}}}return e},se=(s,t,e=s)=>(s._$AI(t,e),s),gs={},Ai=(s,t=gs)=>s._$AH=t,Ti=s=>s._$AH,Lt=s=>{var r;(r=s._$AP)==null||r.call(s,!1,!0);let t=s._$AA,e=s._$AB.nextSibling;for(;t!==e;){let i=t.nextSibling;t.remove(),t=i}};var oe={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},G=s=>(...t)=>({_$litDirective$:s,values:t}),B=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 tt=(s,t)=>{var r;let e=s._$AN;if(e===void 0)return!1;for(let i of e)(r=i._$AO)==null||r.call(i,t,!1),tt(i,t);return!0},Dt=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while((e==null?void 0:e.size)===0)},Si=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),ys(t)}};function bs(s){this._$AN!==void 0?(Dt(this),this._$AM=s,Si(this)):this._$AM=s}function vs(s,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let o=e;o<r.length;o++)tt(r[o],!1),Dt(r[o]);else r!=null&&(tt(r,!1),Dt(r));else tt(this,s)}var ys=s=>{var t,e;s.type==oe.CHILD&&((t=s._$AP)!=null||(s._$AP=vs),(e=s._$AQ)!=null||(s._$AQ=bs))},Ht=class extends B{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Si(this),this.isConnected=t._$AU}_$AO(t,e=!0){var r,i;t!==this.isConnected&&(this.isConnected=t,t?(r=this.reconnected)==null||r.call(this):(i=this.disconnected)==null||i.call(this)),e&&(tt(this,t),Dt(this))}setValue(t){if(qi(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 Mi=()=>new ur,ur=class{},dr=new WeakMap,Sl=G(class extends Ht{render(s){return w}update(s,[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=s.options)==null?void 0:r.host,this.rt(this.ct=s.element)),w}rt(s){var t;if(this.isConnected||(s=void 0),typeof this.Y=="function"){let e=(t=this.ht)!=null?t:globalThis,r=dr.get(e);r===void 0&&(r=new WeakMap,dr.set(e,r)),r.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),r.set(this.Y,s),s!==void 0&&this.Y.call(this.ht,s)}else this.Y.value=s}get lt(){var s,t,e;return typeof this.Y=="function"?(t=dr.get((s=this.ht)!=null?s: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 $i=g`
|
|
94
|
+
:host {
|
|
95
|
+
display: inline-block;
|
|
96
|
+
}
|
|
97
|
+
[part='correct'] {
|
|
98
|
+
position: absolute;
|
|
99
|
+
width: 100%;
|
|
100
|
+
}
|
|
101
|
+
:host(.qti-input-width-1) [part='input'] {
|
|
102
|
+
width: 1.1rem;
|
|
103
|
+
min-width: 1.1rem;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:host(.qti-input-width-2) [part='input'] {
|
|
107
|
+
width: 2.3rem;
|
|
108
|
+
min-width: 2.3rem;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
:host(.qti-input-width-3) [part='input'] {
|
|
112
|
+
width: 3.3rem;
|
|
113
|
+
min-width: 3.3rem;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
:host(.qti-input-width-4) [part='input'] {
|
|
117
|
+
width: 4.2rem;
|
|
118
|
+
min-width: 4.2rem;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host(.qti-input-width-6) [part='input'] {
|
|
122
|
+
width: 6.6rem;
|
|
123
|
+
min-width: 6.6rem;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:host(.qti-input-width-10) [part='input'] {
|
|
127
|
+
width: 8rem;
|
|
128
|
+
min-width: 8rem;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
:host(.qti-input-width-15) [part='input'] {
|
|
132
|
+
width: 12rem;
|
|
133
|
+
min-width: 12rem;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
:host(.qti-input-width-20) [part='input'] {
|
|
137
|
+
width: 17rem;
|
|
138
|
+
min-width: 17rem;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
:host(.qti-input-width-25) [part='input'] {
|
|
142
|
+
width: 20rem;
|
|
143
|
+
min-width: 20rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
:host(.qti-input-width-30) [part='input'] {
|
|
147
|
+
width: 24rem;
|
|
148
|
+
min-width: 24rem;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
:host(.qti-input-width-35) [part='input'] {
|
|
152
|
+
width: 28rem;
|
|
153
|
+
min-width: 28rem;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
:host(.qti-input-width-40) [part='input'] {
|
|
157
|
+
width: 32rem;
|
|
158
|
+
min-width: 32rem;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host(.qti-input-width-45) [part='input'] {
|
|
162
|
+
width: 36rem;
|
|
163
|
+
min-width: 36rem;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
:host(.qti-input-width-50) [part='input'] {
|
|
167
|
+
width: 40rem;
|
|
168
|
+
min-width: 40rem;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
:host(.qti-input-width-72) [part='input'] {
|
|
172
|
+
width: 57rem;
|
|
173
|
+
min-width: 57rem;
|
|
174
|
+
}
|
|
175
|
+
`;var X=class extends x{constructor(){super(...arguments);this._value="";this.inputRef=Mi()}get value(){return this._value}set value(e){if(typeof e=="string"){this._value=e;let r=new FormData;r.append(this.responseIdentifier,e),this._internals.setFormValue(r),this.validate()}else throw new Error("Value must be a string")}validate(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;if(this.patternMask&&this.dataPatternmaskMessage)this._internals.setValidity({}),e.setCustomValidity(""),e.checkValidity()||(this._internals.setValidity({customError:!0},this.dataPatternmaskMessage),e.setCustomValidity(this.dataPatternmaskMessage));else{let r=e.checkValidity();this._internals.setValidity(r?{}:{customError:!1})}return this._value!==""&&e.checkValidity()}render(){return u`
|
|
176
|
+
<input
|
|
177
|
+
part="input"
|
|
178
|
+
name="${this.responseIdentifier}"
|
|
179
|
+
spellcheck="false"
|
|
180
|
+
autocomplete="off"
|
|
181
|
+
@blur="${e=>{this.reportValidity()}}"
|
|
182
|
+
@keydown="${e=>e.stopImmediatePropagation()}"
|
|
183
|
+
@keyup="${this.textChanged}"
|
|
184
|
+
@change="${this.textChanged}"
|
|
185
|
+
type="${this.patternMask=="[0-9]*"?"number":"text"}"
|
|
186
|
+
placeholder="${ie(this.placeholderText?this.placeholderText:void 0)}"
|
|
187
|
+
.value="${this._value}"
|
|
188
|
+
pattern="${ie(this.patternMask?this.patternMask:void 0)}"
|
|
189
|
+
maxlength=${1e3}
|
|
190
|
+
?disabled="${this.disabled}"
|
|
191
|
+
?readonly="${this.readonly}"
|
|
192
|
+
/>
|
|
193
|
+
<div part="correct">${this._correctResponse}</div>
|
|
194
|
+
`}textChanged(e){if(this.disabled||this.readonly)return;let r=e.target;if(this.setEmptyAttribute(r.value),this._value!==r.value){this.value=r.value;let i=this.validate();this.saveResponse(r.value)}}reportValidity(){let e=this.shadowRoot.querySelector("input");if(!e)return!1;let r=this.validate();return r||e.reportValidity(),r}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};X.styles=$i,l([d({type:Number,attribute:"expected-length"})],X.prototype,"expectedLength",2),l([d({type:String,attribute:"pattern-mask"})],X.prototype,"patternMask",2),l([d({type:String,attribute:"placeholder-text"})],X.prototype,"placeholderText",2),l([d({type:String,attribute:"data-patternmask-message"})],X.prototype,"dataPatternmaskMessage",2),l([E()],X.prototype,"_value",2),X=l([h("qti-text-entry-interaction")],X);var ne=(s,t)=>{class e extends s{constructor(){super(...arguments);this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(o,n)=>{this._choiceElements.forEach(a=>a.disabled=n)};this._handleReadonlyChange=(o,n)=>{this._choiceElements.forEach(a=>a.readonly=n)};this._value=""}_handleMaxChoicesChange(o,n){this._determineInputType()}get value(){return Array.isArray(this._value)?this._value.join(","):this._value}set value(o){if(this.maxChoices>1&&typeof o=="string"?this._value=o.split(","):this._value=o,Array.isArray(this._value)){let n=new FormData;this._value.forEach(a=>{n.append(this.responseIdentifier,a)}),this._internals.setFormValue(n)}else this._internals.setFormValue(this._value);this._updateChoiceSelection()}get correctResponse(){return this._correctResponse}set correctResponse(o){this._correctResponse=o;let n=Array.isArray(o)?o:[o];this._choiceElements.forEach(a=>{a.internals.states.delete("correct-response"),a.internals.states.delete("incorrect-response"),n.length>0&&(n.includes(a.identifier)?a.internals.states.add("correct-response"):a.internals.states.add("incorrect-response"))})}connectedCallback(){super.connectedCallback(),this.addEventListener(`register-${t}`,this._registerChoiceElement),this.addEventListener(`unregister-${t}`,this._unregisterChoiceElement),this.addEventListener(`activate-${t}`,this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(`register-${t}`,this._registerChoiceElement),this.removeEventListener(`unregister-${t}`,this._unregisterChoiceElement),this.removeEventListener(`activate-${t}`,this._choiceElementSelectedHandler)}validate(){let o=this._choiceElements.filter(p=>this._getChoiceChecked(p)),n=o.length,a=!0,c="";return this.maxChoices!==0&&n>this.maxChoices?(a=!1,c=this.dataset.maxSelectionsMessage||`You can select at most ${this.maxChoices} choices.`):n<this.minChoices&&(a=!1,c=this.dataset.minSelectionsMessage||`You must select at least ${this.minChoices} choices.`),o.length>0&&this._internals.setValidity(a?{}:{customError:!0},c,o[n-1]||this._choiceElements[0]||this),this.reportValidity(),a}reportValidity(){return this._validationMessageElement&&(this._internals.validity.valid?(this._validationMessageElement.textContent="",this._validationMessageElement.style.display="none"):(this._validationMessageElement.textContent=this._internals.validationMessage,this._validationMessageElement.style.display="block")),this._internals.validity.valid}_registerChoiceElement(o){o.stopPropagation();let n=o.target;n.disabled=this.disabled,this._choiceElements.push(n),this._setInputType(n)}_unregisterChoiceElement(o){o.stopPropagation();let n=o.target;this._choiceElements=this._choiceElements.filter(a=>a!==n)}_determineInputType(){this._choiceElements.forEach(o=>{this._setInputType(o)})}_setInputType(o){o.internals.role=this.maxChoices===1?"radio":"checkbox",o.internals.states.add(o.internals.role)}_choiceElementSelectedHandler(o){this._toggleChoiceChecked(o.target),this.maxChoices===1&&this._choiceElements.forEach(n=>{n.identifier!==o.detail.identifier&&this._setChoiceChecked(n,!1)}),this._handleChoiceSelection()}_setChoiceChecked(o,n){var a;(a=o.internals)!=null&&a.states&&(n?(o.internals.states.add("--checked"),o.internals.ariaChecked="true"):(o.internals.states.delete("--checked"),o.internals.ariaChecked="false"))}_getChoiceChecked(o){return o.internals.states.has("--checked")}_toggleChoiceChecked(o){let n=this._getChoiceChecked(o);this._setChoiceChecked(o,!n)}_handleChoiceSelection(){let n=this._choiceElements.filter(a=>this._getChoiceChecked(a)).map(a=>a.identifier);this.value=this.maxChoices===1?n[0]||"":n,this.validate(),this.saveResponse(this._value)}_updateChoiceSelection(){let o=Array.isArray(this._value)?this._value:[this._value];this._choiceElements.forEach(n=>{let a=o.includes(n.identifier);this._setChoiceChecked(n,a)})}}return l([ve("#validationMessage")],e.prototype,"_validationMessageElement",2),l([d({type:Number,attribute:"min-choices"})],e.prototype,"minChoices",2),l([d({type:Number,attribute:"max-choices"})],e.prototype,"maxChoices",2),l([M("maxChoices",{waitUntilFirstUpdate:!0})],e.prototype,"_handleMaxChoicesChange",1),l([M("disabled",{waitUntilFirstUpdate:!0})],e.prototype,"_handleDisabledChange",2),l([M("readonly",{waitUntilFirstUpdate:!0})],e.prototype,"_handleReadonlyChange",2),e};var Vt=class extends ne(x,"qti-hottext"){constructor(){super(...arguments);this.render=()=>u`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};Vt=l([h("qti-hottext-interaction")],Vt);var rt=class extends B{constructor(t){if(super(t),this.it=w,t.type!==oe.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===w||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:[]}}};rt.directiveName="unsafeHTML",rt.resultType=1;var ae=G(rt);var le=class extends x{constructor(){super(...arguments);this.options=[];this.correctOption="";this.dataPrompt="select"}static get styles(){return[g`
|
|
195
|
+
:host {
|
|
196
|
+
display: inline-block;
|
|
197
|
+
}
|
|
198
|
+
slot {
|
|
199
|
+
display: flex;
|
|
200
|
+
flex-direction: column;
|
|
201
|
+
}
|
|
202
|
+
[role='menu'] {
|
|
203
|
+
position: absolute;
|
|
204
|
+
z-index: 1000;
|
|
205
|
+
}
|
|
206
|
+
.anchor {
|
|
207
|
+
/* anchor-name: --infobox; */
|
|
208
|
+
width: fit-content;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.positionedElement {
|
|
212
|
+
position: absolute;
|
|
213
|
+
/* position-anchor: --infobox; */
|
|
214
|
+
/* top: anchor(bottom); */
|
|
215
|
+
}
|
|
216
|
+
`]}render(){return u`
|
|
217
|
+
<select part="select" @change="${this.choiceSelected}" ?disabled="${this.disabled}" ?readonly="${this.readonly}">
|
|
218
|
+
${this.options.map(e=>u`
|
|
219
|
+
<option value="${e.value}" ?selected="${e.selected}">${ae(e.textContent)}</option>
|
|
220
|
+
`)}
|
|
221
|
+
</select>
|
|
222
|
+
|
|
223
|
+
${ae(this.correctOption)}
|
|
224
|
+
`}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)=>S(q({},e),{selected:r===0}))}set value(e){this.options=this.options.map(r=>(e===r.value&&(r.selected=!0),r))}get value(){return this.options.find(e=>e.selected).value}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(i=>S(q({},i),{selected:i.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"],l([E()],le.prototype,"options",2),l([E()],le.prototype,"correctOption",2),l([d({attribute:"data-prompt",type:String})],le.prototype,"dataPrompt",2),le=l([h("qti-inline-choice-interaction")],le);var Nt=(s,t)=>{class e extends s{constructor(){super(...arguments);this._shuffle=!1}set shuffle(o){let n=this._shuffle;this._shuffle=o,o?this._shuffleChoices():this._resetShuffleChoices(),this.requestUpdate("shuffle",n)}get shuffle(){return this._shuffle}connectedCallback(){super.connectedCallback(),this.shuffle?this._shuffleChoices():this._resetShuffleChoices()}_shuffleChoices(){let o=Array.from(this.querySelectorAll(t)),n=[],a=[];if(o.forEach((b,C)=>{b.hasAttribute("fixed")?n.push({element:b,index:C}):a.push(b)}),a.length<=1){console.warn("Shuffling is not possible with fewer than 2 non-fixed elements.");return}let c=!1,p=10,f=0,m=[...a];for(;!c&&f<p;){f++;for(let b=a.length-1;b>0;b--){let C=Math.floor(Math.random()*(b+1));[a[b],a[C]]=[a[C],a[b]]}if(c=!a.every((b,C)=>b===m[C]),c)break}c||console.warn("Failed to shuffle the choices after multiple attempts.");let y=1;o.forEach((b,C)=>{b.hasAttribute("fixed")?b.style.setProperty("order",String(y++)):a.shift().style.setProperty("order",String(y++))})}_resetShuffleChoices(){Array.from(this.querySelectorAll("qti-simple-choice")).forEach((n,a)=>{n.style.setProperty("order","initial")})}}return l([d({type:String,reflect:!0,converter:xs})],e.prototype,"shuffle",1),e},xs={fromAttribute(s){return s==="true"},toAttribute(s){return s?"true":"false"}};var Ri=(s,t)=>{class e extends s{constructor(){super(...arguments);this._classes=[];this._allLabels=["qti-labels-decimal","qti-labels-lower-alpha","qti-labels-upper-alpha"];this._allLabelSuffixes=["qti-labels-suffix-period","qti-labels-suffix-parenthesis"]}set class(o){o&&(this._classes=o.split(" "),this._addLabels())}get class(){var o;return((o=this._classes)==null?void 0:o.join(" "))||""}updated(o){super.updated(o),o.has("shuffle")&&this._addLabels()}_addLabels(){let o=this._classes.some(a=>this._allLabels.includes(a)||this._allLabelSuffixes.includes(a)),n=a=>!isNaN(+a);if(o){let c=Array.from(this.querySelectorAll("qti-simple-choice")).map(p=>p).map((p,f)=>({el:p,order:n(p.style.order)?+p.style.order:f+1})).sort((p,f)=>p.order-f.order).map(p=>p.el);for(let p=0;p<c.length;p++)c[p].marker=this._getLabel(p+1)}}_getLabel(o){let n=this._classes.filter(p=>this._allLabels.includes(p)).pop(),a=this._classes.filter(p=>this._allLabelSuffixes.includes(p)).pop();!n&&a&&(n="qti-labels-upper-alpha");let c="";switch(n){case"qti-labels-decimal":c=`${o}`;break;case"qti-labels-lower-alpha":c=`${String.fromCharCode(97+o-1)}`;break;case"qti-labels-upper-alpha":c=`${String.fromCharCode(65+o-1)}`;break}return a==="qti-labels-suffix-period"?c+=".":a==="qti-labels-suffix-parenthesis"&&(c+=")"),c}}return l([d({type:String,reflect:!0})],e.prototype,"class",1),e};var ki=g`
|
|
225
|
+
[part='slot'] {
|
|
226
|
+
display: flex;
|
|
227
|
+
flex-direction: column;
|
|
228
|
+
gap: var(--qti-gap-size);
|
|
229
|
+
flex-wrap: wrap;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
::slotted(qti-simple-choice) {
|
|
233
|
+
flex: 0 0
|
|
234
|
+
calc((100% - (var(--qti-gap-size) * var(--choice-interactions-stacking))) / var(--choice-interactions-stacking)) !important;
|
|
235
|
+
box-sizing: border-box !important;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
:host(.qti-choices-stacking-1) [part='slot'] {
|
|
239
|
+
flex-direction: row;
|
|
240
|
+
--choice-interactions-stacking: 1;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
:host(.qti-choices-stacking-2) [part='slot'] {
|
|
244
|
+
flex-direction: row;
|
|
245
|
+
--choice-interactions-stacking: 2;
|
|
246
|
+
}
|
|
247
|
+
:host(.qti-choices-stacking-3) [part='slot'] {
|
|
248
|
+
flex-direction: row;
|
|
249
|
+
--choice-interactions-stacking: 3;
|
|
250
|
+
}
|
|
251
|
+
:host(.qti-choices-stacking-4) [part='slot'] {
|
|
252
|
+
flex-direction: row;
|
|
253
|
+
--choice-interactions-stacking: 4;
|
|
254
|
+
}
|
|
255
|
+
:host(.qti-choices-stacking-5) [part='slot'] {
|
|
256
|
+
flex-direction: row;
|
|
257
|
+
--choice-interactions-stacking: 5;
|
|
258
|
+
}
|
|
259
|
+
:host([orientation='horizontal']) [part='slot'] {
|
|
260
|
+
flex-direction: row;
|
|
261
|
+
}
|
|
262
|
+
`;var $e=class extends Ri(Nt(ne(x,"qti-simple-choice"),"qti-simple-choice"),"qti-simple-choice"){render(){return u`
|
|
263
|
+
<slot name="prompt"></slot><slot part="slot"></slot>
|
|
264
|
+
<div role="alert" id="validationMessage"></div>
|
|
265
|
+
`}};$e.styles=ki,l([d({type:String})],$e.prototype,"orientation",2),$e=l([h("qti-choice-interaction")],$e);var it=class extends v{render(){return u`<slot></slot>`}process(){let t=new hr,e=[...this.children];t.process(e)}};it.styles=[g`
|
|
266
|
+
:host {
|
|
267
|
+
display: none;
|
|
268
|
+
}
|
|
269
|
+
`],it=l([h("qti-outcome-processing")],it);var hr=class{process(t){for(let e of t)e.process()}};var Li=`<qti-response-processing>
|
|
270
|
+
<qti-response-condition>
|
|
271
|
+
<qti-response-if>
|
|
272
|
+
<qti-match>
|
|
273
|
+
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
274
|
+
<qti-correct identifier="RESPONSE"></qti-correct>
|
|
275
|
+
</qti-match>
|
|
276
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
277
|
+
<qti-base-value base-type="float">1</qti-base-value>
|
|
278
|
+
</qti-set-outcome-value>
|
|
279
|
+
</qti-response-if>
|
|
280
|
+
<qti-response-else>
|
|
281
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
282
|
+
<qti-base-value base-type="float">0</qti-base-value>
|
|
283
|
+
</qti-set-outcome-value>
|
|
284
|
+
</qti-response-else>
|
|
285
|
+
</qti-response-condition>
|
|
286
|
+
</qti-response-processing>`,Di=`<qti-response-processing>
|
|
287
|
+
<qti-response-condition>
|
|
288
|
+
<qti-response-if>
|
|
289
|
+
<qti-is-null>
|
|
290
|
+
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
291
|
+
</qti-is-null>
|
|
292
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
293
|
+
<qti-base-value base-type="float">0.0</qti-base-value>
|
|
294
|
+
</qti-set-outcome-value>
|
|
295
|
+
</qti-response-if>
|
|
296
|
+
<qti-response-else>
|
|
297
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
298
|
+
<qti-map-response identifier="RESPONSE"> </qti-map-response>
|
|
299
|
+
</qti-set-outcome-value>
|
|
300
|
+
</qti-response-else>
|
|
301
|
+
</qti-response-condition>
|
|
302
|
+
</qti-response-processing>`,Hi=`<qti-response-processing>
|
|
303
|
+
<qti-response-condition>
|
|
304
|
+
<qti-response-if>
|
|
305
|
+
<qti-is-null>
|
|
306
|
+
<qti-variable identifier="RESPONSE"></qti-variable>
|
|
307
|
+
</qti-is-null>
|
|
308
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
309
|
+
<qti-base-value base-type="float">0</qti-base-value>
|
|
310
|
+
</qti-set-outcome-value>
|
|
311
|
+
</qti-response-if>
|
|
312
|
+
<qti-response-else>
|
|
313
|
+
<qti-set-outcome-value identifier="SCORE">
|
|
314
|
+
<qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
|
|
315
|
+
</qti-set-outcome-value>
|
|
316
|
+
</qti-response-else>
|
|
317
|
+
</qti-response-condition>
|
|
318
|
+
</qti-response-processing>`;var ye=class extends v{render(){return u`<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(Di).firstElementChild.firstElementChild);break}case"map_response_point":{this.appendChild(this.fragmentFromString(Hi).firstElementChild.firstElementChild);break}case"match_correct":this.appendChild(this.fragmentFromString(Li).firstElementChild.firstElementChild);break}}}fragmentFromString(t){return document.createRange().createContextualFragment(t)}};ye.styles=[g`
|
|
319
|
+
:host {
|
|
320
|
+
display: none;
|
|
321
|
+
}
|
|
322
|
+
`],ye=l([h("qti-response-processing")],ye);var j=class extends v{render(){return u`<slot></slot>`}process(){throw new Error("Not implemented")}};j=l([h("qti-rule")],j);var Pt=class extends j{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:Ze(r)}})),r)}};l([d({type:String})],Pt.prototype,"identifier",2);customElements.define("qti-lookup-outcome-value",Pt);var mr=class extends j{render(){return u`<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",mr);var fr=class extends j{process(){let t=this.getAttribute("identifier"),e=this.firstElementChild,i=new gr(e).process();this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:t,value:Array.isArray(i)?i.map(o=>Ze(o)):Ze(i)}}))}},gr=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",fr);var st=class extends v{render(){return u`<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",st);var ot=class extends st{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",ot);var br=class extends ot{render(){return u`${super.render()}`}};customElements.define("qti-response-else-if",br);var _=class extends v{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.trim(),cardinality:"single"};case"qti-variable":{let r=e.getAttribute("identifier")||"";return this.context.variables.find(o=>o.identifier===r)||null}case"qti-multiple":{let i=e.getResult();return i.length>0?{identifier:"",baseType:i[0].baseType,value:i.map(o=>o.value),cardinality:"multiple",type:"response"}:null}case"qti-correct":{let r=e.getAttribute("identifier")||"",i=this.context.variables.find(o=>o.identifier===r)||null;return{baseType:i.baseType,value:i.correctResponse,cardinality:i.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 u`<pre>${JSON.stringify(this.result,null,2)}</pre>
|
|
323
|
+
<slot></slot>`}calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};_.styles=g`
|
|
324
|
+
slot {
|
|
325
|
+
display: none;
|
|
326
|
+
}
|
|
327
|
+
`,l([E()],_.prototype,"result",2),l([k({context:$,subscribe:!0}),E()],_.prototype,"context",2);var N=class extends _{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var It=class extends Es(N){calculate(){return this.calculateChildren(Array.from(this.children))}};function Es(s){return class extends s{calculateChildren(e){return e.map(i=>{let o=i;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=o.calculate(),a=!1;if(typeof n=="string")if(n==="true")a=!0;else if(n==="false")a=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof n=="boolean"&&(a=n);return a}).every(i=>typeof i=="boolean"&&i)}}}customElements.define("qti-and",It);var Ot=class extends _{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent.trim()}};l([d({type:String,attribute:"base-type"})],Ot.prototype,"baseType",2);customElements.define("qti-base-value",Ot);var vr=class extends N{getResult(){let t=this.getVariables();if(this.children.length===2){let e=t[0],r=t[1];if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="multiple"){let i=e.value,o=r.value;return i.filter(c=>o.includes(c)).length>0}else if(e.baseType==="directedPair"&&r.baseType==="directedPair"&&e.cardinality==="single"){let i=e.value;return r.value.includes(i)}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",vr);var yr=class extends _{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let t=this.getAttribute("identifier")||"",e=this.context.variables.find(r=>r.identifier===t)||null;return e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",yr);var Ut=class extends _{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],i=e[1];if(this.roundingMode===null)return null;if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let o=parseFloat(r.value),n=parseFloat(i.value);if(!isNaN(o)&&!isNaN(n))return this.roundingMode==="significantFigures"?o.toPrecision(this.figures)===n.toPrecision(this.figures):Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(n*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${o}, ${n}`);break}default:{console.error("values other than float and int cannot be used in equalRounded operator.");break}}return!1}return console.error("unexpected number of children in qti-equal-rounded"),null}};l([d({type:String})],Ut.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Ut);var P=class{static compareSingleValues(t,e,r){switch(r){case"identifier":case"string":return t===e;case"integer":{let i=parseInt(t,10),o=parseInt(e,10);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`Cannot convert ${t} and/or ${e} to int.`);break}case"float":{let i=parseFloat(t),o=parseFloat(e);if(!isNaN(i)&&!isNaN(o))return i===o;console.error(`couldn't convert ${t} and/or ${e} to float.`);break}case"pair":case"directedPair":{let i=t.split(" ").sort(),o=e.split(" ").sort();if(i.length===2&&o.length===2)return r==="pair"&&(i.sort(),o.sort()),i.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${t} 2: ${e}`);break}}return!1}};var Ft=class extends _{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value)?(console.error("unexpected cardinality in qti equal"),!1):P.compareSingleValues(r.value,i.value,r.baseType)}return console.error("unexpected number of children in qti-equal"),null}};l([d({type:String})],Ft.prototype,"toleranceMode",2);customElements.define("qti-equal",Ft);var xr=class extends _{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",xr);var Er=class extends N{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value>=+r.value:(console.error("unexpected baseType or cardinality in qti gte"),null)}return console.log("unexpected number of children in qte"),null}};customElements.define("qti-gte",Er);var Cr=class extends _{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",Cr);var _r=class extends _{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",_r);var wr=class extends N{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return e.baseType===r.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value<=+r.value:(console.error("unexpected baseType or cardinality in qti lte"),null)}return console.log("unexpected number of children in lte"),null}};customElements.define("qti-lte",wr);var Bt=class extends _{getResult(){let t=this.context.variables.find(o=>o.identifier===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],i=0;for(let o of r){let n=e.mapEntries.find(a=>P.compareSingleValues(a.mapKey,o,t.baseType));n==null||n.mappedValue==null?i+=e.defaultValue:i+=n.mappedValue}return e.lowerBound!=null&&(i=Math.max(e.lowerBound,i)),e.upperBound!=null&&(i=Math.min(e.upperBound,i)),i}};l([d({type:String})],Bt.prototype,"identifier",2);customElements.define("qti-map-response",Bt);var Re=class extends v{constructor(){super(...arguments);this.defaultValue=0}get mapEntries(){return Array.from(this.querySelectorAll("qti-map-entry")).map(e=>({mapKey:e.getAttribute("map-key"),mappedValue:+e.getAttribute("mapped-value")}))}};l([d({attribute:"default-value",type:Number})],Re.prototype,"defaultValue",2),l([d({attribute:"lower-bound",type:Number})],Re.prototype,"lowerBound",2),l([d({attribute:"upper-bound",type:Number})],Re.prototype,"upperBound",2);customElements.define("qti-mapping",Re);var qr=class s extends _{getResult(){if(this.children.length===2){let t=this.getVariables(),e=t[0],r=t[1];return s.match(e,r)}return console.error("unexpected number of children in match"),null}static match(t,e){var r;switch(e.cardinality){case"single":return t.value===null?!1:Array.isArray(t.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):P.compareSingleValues((r=t.value)==null?void 0:r.toString(),e.value.toString(),e.baseType);case"ordered":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;for(let i=0;i<t.value.length;i++)if(!P.compareSingleValues(e.value[i],t.value[i],e.baseType))return!1;return!0}case"multiple":{if(!Array.isArray(t.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(t.value.length!==e.value.length)return!1;let i=0;for(let o of e.value){let n=null,a=[...t.value];for(let c of a)if(P.compareSingleValues(o,c,e.baseType)){n=c;break}if(n!==null)a.splice(a.indexOf(n),1);else return!1;i++}return!0}default:return console.error("unexpected cardinality in qti match"),!1}}};customElements.define("qti-match",qr);var Ar=class extends _{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 i=e.value;return r.value.includes(i)}};customElements.define("qti-member",Ar);var Tr=class extends _{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",Tr);var Sr=class extends _{render(){return u`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",Sr);var Mr=class extends N{getResult(){return Array.from(this.children).map(e=>{let r=e;if(!r.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let i=r.calculate(),o=!1;if(typeof i=="string")if(i==="true")o=!0;else if(i==="false")o=!1;else return console.error("unexpected val in qti-or, expected boolean"),null;else typeof i=="boolean"&&(o=i);return o}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",Mr);var $r=class extends _{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",$r);var nt=class extends v{render(){var e,r;let t=(r=(e=this.context)==null?void 0:e.variables.find(i=>i.identifier===this.identifier))==null?void 0:r.value;return u`${JSON.stringify(t,null,2)}`}calculate(){return this.context.variables.find(e=>e.identifier===this.identifier)||null}};l([d({type:String})],nt.prototype,"identifier",2),l([k({context:$,subscribe:!0}),E()],nt.prototype,"context",2);customElements.define("qti-printed-variable",nt);var Rr=class extends _{getResult(){return this.getVariables().reduce((r,i)=>{if(i.baseType=="float"||i.baseType=="integer")try{return r*parseInt(i.value.toString())}catch(o){console.warn("can not convert to number")}else console.warn(`has another baseType ${i.baseType}`);return r},1)}};customElements.define("qti-product",Rr);var Xt=class extends _{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),r=e[0],i=e[1];if(r.cardinality!=="single"||i.cardinality!=="single"||Array.isArray(r.value)||Array.isArray(i.value))return console.error("unexpected cardinality in qti string-match"),!1;let o=this.caseSensitive==="true"?r.value:r.value.toLowerCase(),n=this.caseSensitive==="true"?i.value:i.value.toLowerCase();return P.compareSingleValues(o,n,r.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};l([d({type:String,attribute:"case-sensitive"})],Xt.prototype,"caseSensitive",2);customElements.define("qti-string-match",Xt);var kr=class extends _{constructor(){super(),this._expression=new Lr(Array.from(this.children))}getResult(){return this._expression.calculate()}},Lr=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",kr);var Dr=class extends _{getResult(){let t=this.getAttribute("identifier");return this.context.variables.find(r=>r.identifier===t).value}};customElements.define("qti-variable",Dr);var ce=class extends x{constructor(){super(...arguments);this._errorMessage=null;this.loadConfig=async(e,r)=>{e=this.removeDoubleSlashes(e);try{let i=await fetch(e);if(i.ok){let n=await i.json();for(let a in n.paths)r&&(n.paths[a]=this.getResolvablePath(n.paths[a],r));return n}}catch(i){}return null};this.getResolvablePathString=(e,r)=>(e=e.replace(/\.js$/,""),e!=null&&e.toLocaleLowerCase().startsWith("http")||!r?e:this.removeDoubleSlashes(`${r}/${e}`));this.getResolvablePath=(e,r)=>Array.isArray(e)?e.map(i=>this.getResolvablePathString(i,r)):this.getResolvablePathString(e,r)}convertQtiVariableJSON(e){for(let r in e)if(e.hasOwnProperty(r)){let i=e[r];if(i){for(let o in i)if(i.hasOwnProperty(o)){let n=i[o];if(Array.isArray(n))return n.map(String);if(n!=null)return String(n)}}}return null}startChecking(){this.intervalId=setInterval(()=>{let e=this.pci.getResponse(),r=this.pci.getResponse(),i=JSON.stringify(e);if(i!==this.rawResponse){this.rawResponse=i;let o=this.convertQtiVariableJSON(r);this.value=o,this.saveResponse(o)}},200)}stopChecking(){this.intervalId!==void 0&&clearInterval(this.intervalId)}validate(){return!0}set value(e){}get value(){return this.rawResponse}getTAOConfig(e){let r=e.querySelectorAll("properties"),i={},o=a=>{let c={},p=a.getAttribute("key");if(p){let f=Array.from(a.children),m=f.map(b=>b.getAttribute("key"));m.length>0&&!m.find(b=>!Number.isInteger(+b))?c[p]=f.map(b=>n(b)):c[p]=a.textContent}return c},n=a=>{if(a){let c={};for(let p of a.children)c=q(q({},c),o(p));return c}};for(let a of r)return a.getAttribute("key")||(i=q(q({},i),n(a))),i;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",i=r=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");i.classList.add("qti-customInteraction"),r=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let o=r=="IMS"?{properties:this.dataset,onready:()=>{console.log("onready")}}:this.getTAOConfig(this);r=="IMS"?e.getInstance(i,o,void 0):e.initialize(this.customInteractionTypeIdentifier,i.firstElementChild,o),r=="TAO"&&Array.from(this.querySelectorAll("link")).map(a=>a.getAttribute("href")).forEach(a=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=a,i.appendChild(c)}),this.startChecking()}connectedCallback(){super.connectedCallback(),define("qtiCustomInteractionContext",()=>({register:i=>{this.register(i)},notifyReady:()=>{}}));let e=this.buildRequireConfig();requirejs.config(e)(["require"],i=>{i([this.module])})}disconnectedCallback(){super.disconnectedCallback(),requirejs.undef(this.customInteractionTypeIdentifier);let e=requirejs.s.contexts;delete e[this.customInteractionTypeIdentifier],this.stopChecking()}buildRequireConfig(){let e={context:this.customInteractionTypeIdentifier,catchError:!0,paths:window.requirePaths||{},shim:window.requireShim||{}};if(!globalThis.require)return this._errorMessage="RequireJS not found. Please load it via CDN: https://cdnjs.com/libraries/require.js",null;let r=this.getAttribute("data-base-url"),i=this.querySelector("qti-interaction-modules");if(i){let o=i.querySelectorAll("qti-interaction-module");for(let n of o){let a=n.getAttribute("id"),c=n.getAttribute("primary-path"),p=n.getAttribute("fallback-path");if(a&&c){let f=p?this.combineRequireResolvePaths(this.getResolvablePath(c,r),this.getResolvablePath(p,r)):this.getResolvablePath(c,r),m=e.paths[a]||[];e.paths[a]=this.combineRequireResolvePaths(m,f)}}}return e}combineRequireResolvePaths(e,r){let i=Array.isArray(e)?e:[e],o=Array.isArray(r)?r:[r];return i.concat(o)}removeDoubleSlashes(e){return e.replace(/([^:]\/)\/+/g,"$1").replace(/\/\//g,"/").replace("http:/","http://").replace("https:/","https://")}render(){return u`<slot></slot>${this._errorMessage&&u`<div style="color:red">
|
|
328
|
+
<h1>Error</h1>
|
|
329
|
+
${this._errorMessage}
|
|
330
|
+
</div>`}`}};l([d({type:String,attribute:"response-identifier"})],ce.prototype,"responseIdentifier",2),l([d({type:String,attribute:"module"})],ce.prototype,"module",2),l([d({type:String,attribute:"custom-interaction-type-identifier"})],ce.prototype,"customInteractionTypeIdentifier",2),l([E()],ce.prototype,"_errorMessage",2),ce=l([h("qti-portable-custom-interaction")],ce);var jt=class s{constructor(){this.touchStartTime=0;this.touchStartPoint=null;this.lastClickTime=0;this.isDraggable=!1;this.dragSource=null;this.dragClone=null;this.touchEndTriggered=!1;this.isDragging=!1;this.initialTransform="";this.hasDispatchedDragStart=!1;this.rootNode=null;this.focusedElement=null;this.focusableDropZones=[];this.currentDropZoneIndex=-1;this.dataTransfer={data:{},setData(t,e){this.data[t]=e},getData(t){return this.data[t]},effectAllowed:"move"};this.cloneOffset={x:0,y:0};this.lastTarget=null;this.currentDropTarget=null;this.allowClick=!0;this.copyStylesForDragClone=!0;this.dragOnClickEnabled=!1;this.useDragClone=!1;this.MIN_DRAG_DISTANCE=5;this.DRAG_CLONE_OPACITY=1;if(s.instance)return s.instance;s.instance=this,document.addEventListener("touchmove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("mousemove",this.handleTouchMove.bind(this),{passive:!1}),document.addEventListener("touchend",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("mouseup",this.handleTouchEnd.bind(this),{passive:!1}),document.addEventListener("touchcancel",this.handleTouchCancel.bind(this),{passive:!1}),document.addEventListener("keydown",this.handleKeyDown.bind(this)),document.addEventListener("keyup",this.handleKeyUp.bind(this))}addDraggableElements(t){t.forEach(e=>{e.setAttribute("tabindex","0"),e.addEventListener("focus",()=>this.focusedElement=e),e.addEventListener("blur",()=>this.focusedElement=null),e.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!1}),e.addEventListener("mousedown",this.handleTouchStart.bind(this),{passive:!1})})}handleTouchStart(t){this.touchStartTime=Date.now();let{x:e,y:r}=this.getEventCoordinates(t);if(this.touchStartPoint={x:e,y:r},this.dragSource=t.currentTarget,this.isDraggable=!0,this.rootNode=this.dragSource.getRootNode(),this.dragOnClickEnabled&&(this.isDragging=!0,this.createDragClone(t,{clientX:e,clientY:r})),!this.useDragClone){let i=window.getComputedStyle(this.dragSource);this.initialTransform=i.transform==="none"?"":i.transform,this.initialTransition=i.transition||"",this.dragSource.style.transition="none";let o=this.dragSource.getBoundingClientRect();this.cloneOffset.x=e-o.left,this.cloneOffset.y=r-o.top,this.dragSource.style.zIndex="9999",this.dragSource.focus()}t.preventDefault()}handleTouchMove(t){if(this.isDraggable&&this.dragSource){let{x:e,y:r}=this.getEventCoordinates(t),i={clientX:e,clientY:r};this.calculateDragDistance(i)>=this.MIN_DRAG_DISTANCE&&(this.dragSource.style.pointerEvents="none",this.isDragging=!0),this.createDragClone(t,i),t.preventDefault()}}createDragClone(t,e){if(!this.isDragging)return;if(this.useDragClone){if(!this.dragClone){if(this.dragSource.style.opacity=this.DRAG_CLONE_OPACITY.toString(),this.dragClone=this.dragSource.cloneNode(!0),this.copyStylesForDragClone){let i=window.getComputedStyle(this.dragSource);for(let o of i)this.dragClone.style[o]=i.getPropertyValue(o)}this.rootNode instanceof ShadowRoot?this.rootNode.host.appendChild(this.dragClone):this.rootNode instanceof Document&&document.body.appendChild(this.dragClone),this.calculateClonePosition(e),this.setDragCloneStyles(e),this.dispatchCustomEvent(this.dragSource,"dragstart")}this.updateDragClonePosition(e)}else if(this.touchStartPoint){let i=e.clientX-this.touchStartPoint.x,o=e.clientY-this.touchStartPoint.y;this.dragSource.style.transform=`${this.initialTransform} translate(${i}px, ${o}px)`,this.hasDispatchedDragStart||(this.dispatchCustomEvent(this.dragSource,"dragstart"),this.hasDispatchedDragStart=!0)}let r=this.findDropTarget(t);r!==this.lastTarget&&(this.dispatchCustomEvent(r,"dragenter"),this.dispatchCustomEvent(this.lastTarget,"dragleave"),this.lastTarget=r),this.currentDropTarget=r,this.currentDropTarget&&this.dispatchCustomEvent(r,"dragover")}handleTouchEnd(t){var r;this.touchEndTriggered=!0,this.isDraggable=!1;let e=!1;if(this.currentDropTarget)this.dispatchCustomEvent(this.currentDropTarget,"drop"),this.dispatchCustomEvent(this.dragSource,"dragend"),e=!0;else if(this.isDragging){let i=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});i.dataTransfer={dropEffect:"none"},(r=this.dragSource)==null||r.dispatchEvent(i)}this.resetDragState(e)}handleTouchCancel(t){this.resetDragState()}findDropTarget(t){let{x:e,y:r}=this.getEventCoordinates(t);return this.getDropTargetAtPoint(document,e,r)}getDropTargetAtPoint(t,e,r,i=0){if(i>2)return null;let n=t.elementFromPoint(e,r);if(!n)return null;if(n.hasAttribute("dropzone"))return n;let a=n.parentElement;for(;a;){if(a.hasAttribute("dropzone"))return a;a=a.parentElement}if(n.shadowRoot&&i<2){let c=this.getDropTargetAtPoint(n.shadowRoot,e,r,i+1);if(c)return c}return null}handleKeyDown(t){this.focusedElement&&(t.key===" "&&!this.isDragging?(t.preventDefault(),this.isDraggable=!0,this.dragSource=this.focusedElement,this.isDragging=!0,this.collectDropZones(),this.dispatchCustomEvent(this.dragSource,"dragstart")):t.key==="Tab"&&this.isDragging&&(t.preventDefault(),this.moveToNextDropZone()))}handleKeyUp(t){t.key===" "&&this.isDragging&&this.currentDropTarget&&(t.preventDefault(),this.dispatchCustomEvent(this.currentDropTarget,"drop"),this.dispatchCustomEvent(this.dragSource,"dragend"),this.resetDragState(!0))}collectDropZones(){this.focusableDropZones=Array.from(document.querySelectorAll("[dropzone]")),this.currentDropZoneIndex=-1}moveToNextDropZone(){if(this.focusableDropZones.length===0)return;this.currentDropZoneIndex=(this.currentDropZoneIndex+1)%this.focusableDropZones.length;let t=this.focusableDropZones[this.currentDropZoneIndex];t.focus(),this.currentDropTarget=t,this.dispatchCustomEvent(t,"dragenter")}getEventCoordinates(t,e=!1){let r=t.touches?t.touches[0]:t;return{x:e?r.pageX:r.clientX,y:e?r.pageY:r.clientY}}calculateClonePosition(t){let e=this.dragSource.getBoundingClientRect();this.cloneOffset.x=t.clientX-e.left,this.cloneOffset.y=t.clientY-e.top}setDragCloneStyles(t){this.dragClone.style.position="fixed",this.dragClone.style.top=`${t.clientY-this.cloneOffset.y}px`,this.dragClone.style.left=`${t.clientX-this.cloneOffset.x}px`,this.dragClone.style.pointerEvents="none",this.dragClone.style.zIndex="999999"}updateDragClonePosition(t){requestAnimationFrame(()=>{if(this.touchEndTriggered||!this.dragClone)return;let e=t.clientX-this.cloneOffset.x,r=t.clientY-this.cloneOffset.y,{newLeft:i,newTop:o}=this.applyBoundaries(e,r,this.dragClone);this.dragClone.style.left=`${i}px`,this.dragClone.style.top=`${o}px`})}applyTransformBoundaries(t,e){let r;this.rootNode instanceof ShadowRoot?r=this.rootNode.host.getBoundingClientRect():this.rootNode instanceof Document?r=document.documentElement.getBoundingClientRect():r=new DOMRect(0,0,window.innerWidth,window.innerHeight);let i=this.dragSource.getBoundingClientRect(),o=i.width,n=i.height,a=i.left+t,c=i.top+e,p=Math.max(r.left,Math.min(a,r.right-o)),f=Math.max(r.top,Math.min(c,r.bottom-n)),m=p-i.left,y=f-i.top;return{boundedDeltaX:m,boundedDeltaY:y}}applyBoundaries(t,e,r){let i;this.rootNode instanceof ShadowRoot?i=this.rootNode.host.getBoundingClientRect():this.rootNode instanceof Document?i=document.documentElement.getBoundingClientRect():i=new DOMRect(0,0,window.innerWidth,window.innerHeight);let o=r.getBoundingClientRect(),n=o.width,a=o.height,c=Math.max(i.left,Math.min(t,i.right-n)),p=Math.max(i.top,Math.min(e,i.bottom-a));return{newLeft:c,newTop:p}}calculateDragDistance(t){let e=Math.abs(t.clientX-this.touchStartPoint.x),r=Math.abs(t.clientY-this.touchStartPoint.y);return e+r}dispatchCustomEvent(t,e,r=!0){if(!t)return;let i=new CustomEvent(e,{bubbles:r,cancelable:!0});i.dataTransfer=this.dataTransfer,t.dispatchEvent(i)}resetDragState(t=!1){var e;this.isDragging&&(this.useDragClone?(this.dragSource.style.opacity="1.0",(e=this.dragClone)==null||e.parentElement.removeChild(this.dragClone)):(t||(this.dragSource.style.transform="translate(0, 0)"),this.dragSource.style.zIndex="",this.dragSource.style.pointerEvents="",this.dragSource.style.transition=this.initialTransition,this.initialTransition="")),this.isDragging=!1,this.dragSource=null,this.dragClone=null,this.isDraggable=!1,this.touchStartTime=0,this.touchStartPoint=null,this.touchEndTriggered=!1,this.dataTransfer={data:{},setData(r,i){this.data[r]=i},getData(r){return this.data[r]},effectAllowed:"move"},this.cloneOffset={x:0,y:0},this.lastTarget=null,this.currentDropTarget=null,this.allowClick=!0,this.initialTransform="",this.hasDispatchedDragStart=!1,this.rootNode=null}};var Vi=(s,t,e)=>{class r extends s{constructor(){super(...arguments);this.disabled=!1}firstUpdated(n){if(this.isMatchTabular())return;super.firstUpdated(n);let a=this.getDroppableElements();this.initializeEventHandlers(),a.forEach(c=>{this.prepareDroppable(c),this.observeDroppableAttributes(c)})}isMatchTabular(){return this.classList.contains("qti-match-tabular")}getDroppableElements(){return Array.from(t?this.shadowRoot.querySelectorAll(e):this.querySelectorAll(e))}initializeEventHandlers(){this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this)}prepareDroppable(n){n.setAttribute("dropzone","move"),n.addEventListener("dragleave",this.dragleaveHandler),this.attachEventListeners(n)}observeDroppableAttributes(n){this.observer=new MutationObserver(a=>{a.forEach(({attributeName:c})=>{c==="disabled"&&this.toggleDroppableHandlers(n)})}),this.observer.observe(n,{attributes:!0})}toggleDroppableHandlers(n){n.hasAttribute("disabled")?this.removeEventListeners(n):this.attachEventListeners(n)}attachEventListeners(n){n.addEventListener("dragover",this.dragoverHandler),n.addEventListener("dragenter",this.dragenterHandler),n.addEventListener("drop",this.dropHandler)}removeEventListeners(n){n.removeEventListener("dragover",this.dragoverHandler),n.removeEventListener("dragenter",this.dragenterHandler),n.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var n;this.isMatchTabular()||(super.disconnectedCallback(),(n=this.observer)==null||n.disconnect())}dragenterHandler(n){n.preventDefault()}dragoverHandler(n){return n.preventDefault(),this.activateDroppable(n.currentTarget),n.dataTransfer.dropEffect="move",!1}activateDroppable(n){n.setAttribute("active","")}async dropHandler(n){n.preventDefault();let a=n.currentTarget,c=n.dataTransfer.getData("text"),p=this.findDraggable(c);return p?p&&!this.isValidDrop(a,p)?(p.style.transform="translate(0, 0)",!1):(await this.moveDraggableToDroppable(p,a),this.deactivateDroppable(a),!1):!1}findDraggable(n){return n?this.querySelector(`[identifier=${n}]`)||this.shadowRoot.querySelector(`[identifier=${n}]`):null}isValidDrop(n,a){return a.parentElement.getAttribute("identifier")!==n.getAttribute("identifier")}async moveDraggableToDroppable(n,a){let c=()=>{n.style.transform="translate(0, 0)",a.appendChild(n),this.checkMaxAssociations(),this.saveResponse(null)};if(!document.startViewTransition){c();return}await document.startViewTransition(c).finished}deactivateDroppable(n){n.removeAttribute("active")}dragleaveHandler(n){return n.preventDefault(),this.deactivateDroppable(n.currentTarget),n.dataTransfer.dropEffect="none",!1}}return l([d({type:Boolean,reflect:!0})],r.prototype,"disabled",2),r};var Ni=(s,t,e)=>{class r extends s{}return r};function Pi(s,t){let e,r=q({},t);return(i,o)=>{let{connectedCallback:n,disconnectedCallback:a}=i;i.connectedCallback=function(){var f;n.call(this);let c=m=>{let y=Array.from(this.querySelectorAll(s));for(let b of m){let C=Array.from(b.addedNodes).map(T=>T),A=Array.from(b.addedNodes).map(T=>T);b.type==="childList"&&C.find(T=>y.includes(T))&&this[o](C,A)}};e=new MutationObserver(c),e.observe(this,{childList:!0,subtree:!0});let p=(f=this.querySelectorAll(s))!=null?f:[];this[o](Array.from(p),[])},i.disconnectedCallback=function(){a.call(this),e.disconnect()}}}var z=(s,t,e,r)=>{class i extends Ni(Vi(s,e,r),r,t){constructor(){super(...arguments);this.draggables=new Map;this.droppables=[];this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.minAssociations=1;this.maxAssociations=1;this.handleDragStart=a=>{let c=a.currentTarget;a.dataTransfer.setData("text",c.getAttribute("identifier")),c.setAttribute("dragging",""),this.activateDroppables()};this.handleDragEnd=async a=>{a.preventDefault(),this.deactivateDroppables();let c=a.currentTarget;c.removeAttribute("dragging"),await this.wasDropped(a)||this.configuration.dragCanBePlacedBack&&this.restoreInitialDraggablePosition(c)};this.checkForMoveTestItem=a=>a.dataTransfer.items?new Promise(c=>{let p=!1,f=Array.from(a.dataTransfer.items),m=f.length;if(m===0){c(!1);return}f.forEach(y=>{y.kind==="string"&&y.type==="text"?y.getAsString(b=>{b==="move-test"&&(p=!0),m===0&&c(p)}):m===0&&c(p)})}):Promise.resolve(!1)}handleDraggablesChange(a,c){if(this.isMatchTabular())return;let p=this.filterExistingDraggables(a);p.length>0&&this.addNewDraggables(p)}firstUpdated(a){super.firstUpdated(a),this.initializeDroppables()}connectedCallback(){super.connectedCallback(),this.initializeDragDropApi()}initializeDragDropApi(){this.dragDropApi=new jt,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}isMatchTabular(){return this.classList.contains("qti-match-tabular")}filterExistingDraggables(a){return a.filter(c=>!this.draggables.has(c))}addNewDraggables(a){this.dragDropApi.addDraggableElements(a),a.forEach(c=>this.storeDraggable(c))}storeDraggable(a){let c=Array.from(a.parentNode.children).indexOf(a);this.draggables.set(a,{parent:a.parentElement,index:c}),a.style.viewTransitionName=`drag-${c}-${this.getAttribute("identifier")||crypto.randomUUID()}`,a.setAttribute("qti-draggable","true"),a.addEventListener("dragstart",this.handleDragStart),a.addEventListener("dragend",this.handleDragEnd)}initializeDroppables(){this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(r):this.querySelectorAll(r))}activateDroppables(){this.droppables.forEach(a=>a.setAttribute("enabled",""))}deactivateDroppables(){this.droppables.forEach(a=>a.removeAttribute("enabled"))}async wasDropped(a){let c=await this.checkForMoveTestItem(a);return a.dataTransfer.dropEffect!=="none"||c}wasMoved(a){return a.dataTransfer.dropEffect==="move"}async restoreInitialDraggablePosition(a){let{parent:c,index:p}=this.draggables.get(a),f=Math.min(p,c.children.length),m=(b,C,A)=>{let T=Math.min(A,C.children.length);C.insertBefore(b,C.children[T]),b.style.transform="translate(0, 0)",this.checkMaxAssociations()};if(!document.startViewTransition){m(a,c,p);return}let y=document.startViewTransition(()=>{a.style.transform="",m(a,c,p)})}checkMaxAssociations(){this.droppables.forEach((a,c)=>{let p=+(a.getAttribute("match-max")||1);a.querySelectorAll('[qti-draggable="true"]').length>=p?this.disableDroppable(a):this.enableDroppable(a)})}disableDroppable(a){a.setAttribute("disabled",""),a.removeAttribute("dropzone")}enableDroppable(a){a.removeAttribute("disabled"),a.setAttribute("dropzone","move")}get value(){return this.collectResponseData()}set value(a){this.isMatchTabular()||(this.resetDroppables(),a==null||a.forEach(c=>this.placeResponse(c)))}placeResponse(a){let[c,...p]=a.split(" ").reverse(),f=this.findDroppableById(c);p.forEach(m=>this.placeDraggableInDroppable(m,f))}findDroppableById(a){return this.droppables.find(c=>c.getAttribute("identifier")===a)}async placeDraggableInDroppable(a,c){let p=this.querySelector(`[identifier=${a}]`);if(!c||!p){console.error(`Cannot find draggable or droppable with the given identifier: ${a}`);return}let f=()=>{p.style.transform="translate(0, 0)",c.appendChild(p),this.checkMaxAssociations()};document.startViewTransition?await document.startViewTransition(f).finished:f()}validate(){let a=this.getValidAssociations();return this.minAssociations<=0||this.minAssociations<=a}getValidAssociations(){return this.droppables.filter(a=>a.childElementCount>0).length}saveResponse(){let a=this.collectResponseData();this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:a}}))}collectResponseData(){return this.droppables.map(c=>{let p=c.querySelectorAll('[qti-draggable="true"]'),f=Array.from(p).map(y=>y.getAttribute("identifier")),m=c.getAttribute("identifier");return f.map(y=>`${y} ${m}`)}).flat()}reset(a=!0){this.resetDroppables(),a&&this.saveResponse()}async resetDroppables(){let a=(p,f,m)=>{p.style.transform="translate(0, 0)";let y=Math.min(m,f.children.length);f.insertBefore(p,f.children[y])};if(!document.startViewTransition){this.draggables.forEach(({parent:p,index:f},m)=>{a(m,p,f)});return}await document.startViewTransition(()=>{this.draggables.forEach(({parent:p,index:f},m)=>{a(m,p,f)})}).finished}}return l([d({attribute:!1,type:Object})],i.prototype,"configuration",2),l([d({type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),l([d({type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),l([Pi(t)],i.prototype,"handleDraggablesChange",1),i};var Ii=g`
|
|
331
|
+
:host {
|
|
332
|
+
display: block; /* necessary to calculate scaling position */
|
|
333
|
+
}
|
|
334
|
+
slot[name='qti-simple-associable-choice'] {
|
|
335
|
+
display: flex;
|
|
336
|
+
flex-wrap: wrap;
|
|
337
|
+
gap: 0.5rem;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
:host::part(associables-container) {
|
|
341
|
+
display: flex;
|
|
342
|
+
justify-content: space-between;
|
|
343
|
+
background: linear-gradient(
|
|
344
|
+
180deg,
|
|
345
|
+
rgb(0 0 0 / 0%) calc(50% - 1px),
|
|
346
|
+
var(--qti-border-color-gray) calc(50%),
|
|
347
|
+
rgb(0 0 0 / 0%) calc(50% + 1px)
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
`;var ke=class extends z(x,"qti-simple-associable-choice",!0,".dl"){constructor(){super();this._childrenMap=[];this._registerChoiceHandler=this._registerChoice.bind(this),this.addEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}_registerChoice(e){let r=e.target;this._childrenMap.push(r)}render(){return u` <slot name="prompt"></slot>
|
|
351
|
+
<slot name="qti-simple-associable-choice"></slot>
|
|
352
|
+
<div part="drop-container">
|
|
353
|
+
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,r)=>u`<div part="associables-container">
|
|
354
|
+
<div name="left${r}" part="drop-list" class="dl" identifier="droplist${r}_left"></div>
|
|
355
|
+
<div name="right${r}" part="drop-list" class="dl" identifier="droplist${r}_right"></div>
|
|
356
|
+
</div>`)}
|
|
357
|
+
</div>`}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("register-qti-simple-associable-choice",this._registerChoiceHandler)}};ke.styles=Ii,l([E()],ke.prototype,"_childrenMap",2),ke=l([h("qti-associate-interaction")],ke);var W=class extends x{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,i=e.contentDocument;window.addEventListener("message",this.handlePostMessage),i.open(),i.write(`
|
|
358
|
+
<html>
|
|
359
|
+
<head>
|
|
360
|
+
<link href='${Je(`${this.baseRefUrl}/${this.manifest.style[0]}`)}' rel="stylesheet" />
|
|
361
|
+
<script src='${Je(`${this.baseRefUrl}/${this.manifest.script[0]}`)}'></script>
|
|
362
|
+
</head>
|
|
363
|
+
<body></body>
|
|
364
|
+
</html>
|
|
365
|
+
`),i.close()}getIFrames(){let e=this.shadowRoot.querySelectorAll("iframe"),r=this.querySelectorAll("iframe"),i=[...e,...r];for(let o of i){let n=o.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let c=o.contentDocument||o.contentWindow.document;c&&this.getInnerIFrames(c,i)}catch(c){console.error("Error accessing nested iframe:",c)}}return i.forEach((o,n)=>{i.indexOf(o)!==n&&i.splice(n,1)}),i}getInnerIFrames(e,r=[]){return e.querySelectorAll("iframe").forEach(o=>{r.push(o);let n=o.src;if(new URL(n,window.location.href).origin===window.location.origin)try{let c=o.contentDocument||o.contentWindow.document;this.getInnerIFrames(c,r)}catch(c){console.error("Error accessing nested iframe:",c)}else console.warn("Skipped cross-origin iframe:",n)}),r}postToWindowAndIframes(e,r){window.postMessage({type:e,data:r},"*");let i=this.getIFrames();for(let o of i)o.contentWindow&&o.contentWindow.postMessage({type:e,data:r},"*")}handlePostMessage(e){let{type:r,data:i}=e.data;switch(r){case"setResponse":this.rawResponse=i,this.saveResponse(i);break;case"getResponse":{this.postToWindowAndIframes("responseData",this.rawResponse);break}case"getMedia":{let o=this.manifest.media.map(n=>n.startsWith("http")?n:Je(this.baseRefUrl+"/"+n));this.postToWindowAndIframes("mediaData",o);break}case"setStageHeight":console.log("setStageHeight not implemented");break}}validate(){return this.rawResponse!==""}get value(){return this.rawResponse}set value(e){if(typeof e=="string")this.rawResponse=e,this.saveResponse(e);else throw new Error("Value must be a string")}disconnectedCallback(){window.removeEventListener("message",this.handlePostMessage),super.disconnectedCallback()}render(){return u`<iframe
|
|
366
|
+
width=${this.getAttribute("width")}
|
|
367
|
+
height=${this.getAttribute("height")}
|
|
368
|
+
frameborder="0"
|
|
369
|
+
title="pciContainer"
|
|
370
|
+
id="pciContainer"
|
|
371
|
+
>
|
|
372
|
+
</iframe>
|
|
373
|
+
${this._errorMessage&&u`<div style="color:red">
|
|
374
|
+
<h1>Error</h1>
|
|
375
|
+
${this._errorMessage}
|
|
376
|
+
</div>`}`}};l([d({type:String,attribute:"response-identifier"})],W.prototype,"responseIdentifier",2),l([d({type:String,attribute:"data"})],W.prototype,"data",2),l([d({type:String,attribute:"data-base-item"})],W.prototype,"baseItemUrl",2),l([d({type:String,attribute:"data-base-ref"})],W.prototype,"baseRefUrl",2),l([d({type:String,attribute:"id"})],W.prototype,"id",2),l([E()],W.prototype,"_errorMessage",2),W=l([h("qti-custom-interaction")],W);var Le=class extends x{constructor(){super(...arguments);this.countAttempt="true"}validate(){return!0}get value(){return""}set value(e){}render(){return u`<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"}}))}};l([d({type:String,attribute:"count-attempt"})],Le.prototype,"countAttempt",2),l([d({type:String})],Le.prototype,"title",2),Le=l([h("qti-end-attempt-interaction")],Le);var at=class extends z(x,"qti-gap-text",!1,"qti-gap"){render(){return u`<slot name="prompt"> </slot><slot part="drags" name="qti-gap-text"></slot> <slot part="drops"></slot>`}set correctResponse(t){let e=[],r=Array.isArray(t)?t:[t];r&&(e=r.map(o=>{let n=o.split(" ");return{text:n[0],gap:n[1]}})),this.querySelectorAll("qti-gap").forEach((o,n)=>{var f,m,y,b;let a=o.getAttribute("identifier"),c=(f=e.find(C=>C.gap===a))==null?void 0:f.text,p=(m=this.querySelector(`qti-gap-text[identifier="${c}"]`))==null?void 0:m.textContent.trim();if(c&&p){if(!((y=o.nextElementSibling)!=null&&y.classList.contains("correct-option"))){let C=document.createElement("span");C.classList.add("correct-option"),C.textContent=p,o.insertAdjacentElement("afterend",C)}}else(b=o.nextElementSibling)!=null&&b.classList.contains("correct-option")&&o.nextElementSibling.remove()})}};at.styles=[g`
|
|
377
|
+
:host {
|
|
378
|
+
display: flex;
|
|
379
|
+
align-items: flex-start;
|
|
380
|
+
flex-direction: column;
|
|
381
|
+
gap: 0.5rem;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
:host(.qti-choices-top) {
|
|
385
|
+
flex-direction: column;
|
|
386
|
+
}
|
|
387
|
+
:host(.qti-choices-bottom) {
|
|
388
|
+
flex-direction: column-reverse;
|
|
389
|
+
}
|
|
390
|
+
:host(.qti-choices-left) {
|
|
391
|
+
flex-direction: row;
|
|
392
|
+
}
|
|
393
|
+
:host(.qti-choices-right) {
|
|
394
|
+
flex-direction: row-reverse;
|
|
395
|
+
}
|
|
396
|
+
/* [part='drops'] , */
|
|
397
|
+
[part='drags'] {
|
|
398
|
+
display: flex;
|
|
399
|
+
align-items: flex-start;
|
|
400
|
+
flex: 1;
|
|
401
|
+
gap: 0.5rem;
|
|
402
|
+
}
|
|
403
|
+
`],at=l([h("qti-gap-match-interaction")],at);var Oi=(s,t,e)=>{let r=new Map;for(let i=t;i<=e;i++)r.set(s[i],i);return r},zt=G(class extends B{constructor(s){if(super(s),s.type!==oe.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let i=[],o=[],n=0;for(let a of s)i[n]=r?r(a,n):n,o[n]=e(a,n),n++;return{values:o,keys:i}}render(s,t,e){return this.dt(s,t,e).values}update(s,[t,e,r]){var A;let i=Ti(s),{values:o,keys:n}=this.dt(t,e,r);if(!Array.isArray(i))return this.ut=n,o;let a=(A=this.ut)!=null?A:this.ut=[],c=[],p,f,m=0,y=i.length-1,b=0,C=o.length-1;for(;m<=y&&b<=C;)if(i[m]===null)m++;else if(i[y]===null)y--;else if(a[m]===n[b])c[b]=se(i[m],o[b]),m++,b++;else if(a[y]===n[C])c[C]=se(i[y],o[C]),y--,C--;else if(a[m]===n[C])c[C]=se(i[m],o[C]),Me(s,c[C+1],i[m]),m++,C--;else if(a[y]===n[b])c[b]=se(i[y],o[b]),Me(s,i[m],i[y]),y--,b++;else if(p===void 0&&(p=Oi(n,b,C),f=Oi(a,m,y)),p.has(a[m]))if(p.has(a[y])){let T=f.get(n[b]),xe=T!==void 0?i[T]:null;if(xe===null){let bt=Me(s,i[m]);se(bt,o[b]),c[b]=bt}else c[b]=se(xe,o[b]),Me(s,i[m],xe),i[T]=null;b++}else Lt(i[y]),y--;else Lt(i[m]),m++;for(;b<=C;){let T=Me(s,c[C+1]);se(T,o[b]),c[b++]=T}for(;m<=y;){let T=i[m++];T!==null&&Lt(T)}return this.ut=n,Ai(s,c),L}});function De(s,t,e,r){switch(s){case"circle":{let[i,o,n]=t,a=i/e.width*100,c=o/e.height*100,p=n/e.width*100;r.style.left=a-p+"%",r.style.top=c-p+"%",r.style.width=r.style.height=4*p+"px",r.style.borderRadius="9999px"}break;case"rect":{let[i,o,n,a]=t,c=i/e.width*100,p=o/e.height*100,f=n/e.width*100,m=a/e.height*100;r.style.left=c+"%",r.style.top=p+"%",r.style.width=f-c+"%",r.style.height=m-p+"%"}break;case"poly":{let i=t.reduce((A,T,xe,bt)=>{if(xe%2===1){let ji=A.pop();A[A.length]={x:ji,y:bt[xe]}}else A.push(T);return A},[]),o=Math.min(...i.map(A=>A.x)),n=Math.max(...i.map(A=>A.x)),a=Math.min(...i.map(A=>A.y)),c=Math.max(...i.map(A=>A.y)),p=o/e.width*100,f=a/e.height*100,m=n/e.width*100,y=c/e.height*100;r.style.left=o/e.width*100+"%",r.style.top=a/e.height*100+"%",r.style.width=m-p+"%",r.style.height=y-f+"%";let C=i.map(A=>({x:(A.x-o)/(n-o)*100,y:(A.y-a)/(c-a)*100})).map(A=>Math.round(A.x)+"% "+Math.round(A.y)+"%").join(",");r.style.clipPath=`polygon(${C})`}break;default:break}}var Y=class extends x{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 value(e){Array.isArray(e)&&(this._lines=e)}get value(){return this._lines}render(){var e,r,i,o;return u`<slot name="prompt"></slot>
|
|
404
|
+
<line-container>
|
|
405
|
+
<svg
|
|
406
|
+
width=${ie((e=this.grImage[0])==null?void 0:e.width)}
|
|
407
|
+
height=${ie((r=this.grImage[0])==null?void 0:r.height)}
|
|
408
|
+
viewbox="0 0 ${(i=this.grImage[0])==null?void 0:i.width} ${(o=this.grImage[0])==null?void 0:o.height}"
|
|
409
|
+
>
|
|
410
|
+
${zt(this._lines,n=>n,(n,a)=>nr`
|
|
411
|
+
<line
|
|
412
|
+
part="line"
|
|
413
|
+
x1=${parseInt(this.querySelector("[identifier="+n.split(" ")[0]+"]").style.left)}
|
|
414
|
+
y1=${parseInt(this.querySelector("[identifier="+n.split(" ")[0]+"]").style.top)}
|
|
415
|
+
x2=${parseInt(this.querySelector("[identifier="+n.split(" ")[1]+"]").style.left)}
|
|
416
|
+
y2=${parseInt(this.querySelector("[identifier="+n.split(" ")[1]+"]").style.top)}
|
|
417
|
+
stroke="red"
|
|
418
|
+
stroke-width="3"
|
|
419
|
+
@click=${c=>{c.stopPropagation(),this._lines=this._lines.filter((p,f)=>f!==a),this.saveResponse(this._lines)}}
|
|
420
|
+
/>
|
|
421
|
+
`)}
|
|
422
|
+
${this.startPoint&&nr`<line
|
|
423
|
+
part="point"
|
|
424
|
+
x1=${this.startCoord.x}
|
|
425
|
+
y1=${this.startCoord.y}
|
|
426
|
+
x2=${this.mouseCoord.x}
|
|
427
|
+
y2=${this.mouseCoord.y}
|
|
428
|
+
stroke="red"
|
|
429
|
+
stroke-width="3"
|
|
430
|
+
/>`}
|
|
431
|
+
</svg>
|
|
432
|
+
<slot></slot>
|
|
433
|
+
</line-container>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),i=e.target,o=i.getAttribute("coords"),n=i.getAttribute("shape"),a=o.split(",").map(c=>parseInt(c));De(n,a,r,i)}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",i=>{this.startPoint?this.endPoint||(this.endPoint=i.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=i.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)}};Y.styles=[g`
|
|
434
|
+
slot:not([name='prompt']) {
|
|
435
|
+
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
436
|
+
display: block;
|
|
437
|
+
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
438
|
+
}
|
|
439
|
+
::slotted(img) {
|
|
440
|
+
/* image not selectable anymore */
|
|
441
|
+
pointer-events: none;
|
|
442
|
+
user-select: none;
|
|
443
|
+
}
|
|
444
|
+
::slotted(qti-associable-hotspot) {
|
|
445
|
+
transform: translate(-50%, -50%);
|
|
446
|
+
}
|
|
447
|
+
line-container {
|
|
448
|
+
display: block;
|
|
449
|
+
position: relative;
|
|
450
|
+
}
|
|
451
|
+
svg {
|
|
452
|
+
position: absolute;
|
|
453
|
+
top: 0px;
|
|
454
|
+
left: 0px;
|
|
455
|
+
}
|
|
456
|
+
`],l([E()],Y.prototype,"_lines",2),l([E()],Y.prototype,"startCoord",2),l([E()],Y.prototype,"mouseCoord",2),l([ve("svg")],Y.prototype,"svgContainer",2),l([ui({selector:"img"})],Y.prototype,"grImage",2),Y=l([h("qti-graphic-associate-interaction")],Y);var lt=class extends z(x,"qti-gap-img",!1,"qti-associable-hotspot"){render(){return u` <slot name="prompt"></slot>
|
|
457
|
+
<slot></slot>
|
|
458
|
+
<slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a));switch(o){case"circle":{let[a,c,p]=n;r.style.left=a-p+"px",r.style.top=c-p+"px",r.style.width=r.style.height=2*p+"px"}break;case"rect":{let[a,c,p,f]=n;r.style.left=a+"px",r.style.top=c+"px",r.style.width=p-a+"px",r.style.height=f-c+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};lt.styles=g`
|
|
459
|
+
:host {
|
|
460
|
+
display: inline-block;
|
|
461
|
+
position: relative;
|
|
462
|
+
}
|
|
463
|
+
slot[name='qti-gap-img'] {
|
|
464
|
+
display: flex;
|
|
465
|
+
gap: 1rem;
|
|
466
|
+
}
|
|
467
|
+
`,lt=l([h("qti-graphic-gap-match-interaction")],lt);var ct=class extends ne(x,"qti-hotspot-choice"){render(){return u`
|
|
468
|
+
<slot name="prompt"></slot>
|
|
469
|
+
<!-- slot for the prompt -->
|
|
470
|
+
<slot></slot>
|
|
471
|
+
<!-- slot for the image and hotspots -->
|
|
472
|
+
`}setHotspotOrder(t){let{identifier:e}=t.detail,r=this._choiceElements.find(o=>o.getAttribute("identifier")===e),i=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){if(this._choiceElements.filter(o=>o.order>0).length>=i){this.choiceOrdering=!1;return}r.order=this._choiceElements.filter(o=>!!o.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(o=>(o.order>o.order&&o.order--,o)),r.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a));De(o,n,e,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.addEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("activate-qti-hotspot-choice",this.setHotspotOrder),this.removeEventListener("register-qti-hotspot-choice",this.positionHotspotOnRegister)}};ct.styles=[g`
|
|
473
|
+
slot:not([name='prompt']) {
|
|
474
|
+
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
475
|
+
display: block;
|
|
476
|
+
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
477
|
+
}
|
|
478
|
+
::slotted(img) {
|
|
479
|
+
/* image not selectable anymore */
|
|
480
|
+
pointer-events: none;
|
|
481
|
+
user-select: none;
|
|
482
|
+
}
|
|
483
|
+
`],ct=l([h("qti-graphic-order-interaction")],ct);var pt=class extends ne(x,"qti-hotspot-choice"){render(){return u`
|
|
484
|
+
<slot name="prompt"></slot>
|
|
485
|
+
<!-- slot for the prompt -->
|
|
486
|
+
<slot></slot>
|
|
487
|
+
<!-- slot for the image and hotspots -->
|
|
488
|
+
`}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,i=r.getAttribute("coords"),o=r.getAttribute("shape"),n=i.split(",").map(a=>parseInt(a));De(o,n,e,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};pt.styles=[g`
|
|
489
|
+
slot:not([name='prompt']) {
|
|
490
|
+
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
491
|
+
display: block;
|
|
492
|
+
width: fit-content; /* hotspots not stretching further if image is at max size */
|
|
493
|
+
}
|
|
494
|
+
::slotted(img) {
|
|
495
|
+
/* image not selectable anymore */
|
|
496
|
+
pointer-events: none;
|
|
497
|
+
user-select: none;
|
|
498
|
+
/* width:100%; */
|
|
499
|
+
}
|
|
500
|
+
`],pt=l([h("qti-hotspot-interaction")],pt);var pe=class extends O(v,"qti-simple-associable-choice"){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 u`
|
|
501
|
+
<slot part="slot"></slot>
|
|
502
|
+
<slot part="dropslot" name="qti-simple-associable-choice"></slot>
|
|
503
|
+
`}};pe.styles=g`
|
|
504
|
+
:host {
|
|
505
|
+
display: flex;
|
|
506
|
+
user-select: none;
|
|
507
|
+
}
|
|
508
|
+
slot {
|
|
509
|
+
width: 100%;
|
|
510
|
+
display: block;
|
|
511
|
+
}
|
|
512
|
+
slot[name='qti-simple-associable-choice'] {
|
|
513
|
+
width: 100%;
|
|
514
|
+
}
|
|
515
|
+
`,l([d({type:Number,attribute:"match-min"})],pe.prototype,"matchMin",2),l([d({type:Number,attribute:"match-max"})],pe.prototype,"matchMax",2),l([d({type:Boolean,attribute:"fixed"})],pe.prototype,"fixed",2),pe=l([h("qti-simple-associable-choice")],pe);var Ui=g`
|
|
516
|
+
slot {
|
|
517
|
+
/* slot where the */
|
|
518
|
+
display: flex;
|
|
519
|
+
flex-direction: column;
|
|
520
|
+
gap: 0.5rem;
|
|
521
|
+
align-items: flex-start; /* prevents the drag and drop container slots having the same height */
|
|
522
|
+
}
|
|
523
|
+
:host(.qti-choices-top) slot {
|
|
524
|
+
flex-direction: column;
|
|
525
|
+
}
|
|
526
|
+
:host(.qti-choices-bottom) slot {
|
|
527
|
+
flex-direction: column-reverse;
|
|
528
|
+
}
|
|
529
|
+
:host(.qti-choices-left) slot {
|
|
530
|
+
flex-direction: row;
|
|
531
|
+
}
|
|
532
|
+
:host(.qti-choices-right) slot {
|
|
533
|
+
flex-direction: row-reverse;
|
|
534
|
+
}
|
|
535
|
+
slot[name='prompt'] {
|
|
536
|
+
display: block;
|
|
537
|
+
}
|
|
538
|
+
::slotted(qti-simple-match-set) {
|
|
539
|
+
/* Make sure the drag and drop container slots have the same width */
|
|
540
|
+
flex: 1;
|
|
541
|
+
}
|
|
542
|
+
`;var de=class extends z(x,"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,i=r.value,o=r.name,n=r.type;r.checked?(this.value?this.value.indexOf(i)===-1&&(n==="radio"&&(this.value=this.value.filter(a=>a.indexOf(o)===-1)),this.value=[...this.value,i]):this.value=[i],this.lastCheckedRadio=r):(this.value=this.value.filter(a=>a!==i),this.lastCheckedRadio=null),this.requestUpdate(),this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:Array.isArray(this.value)?[...this.value]:this.value}}))}}get value(){return this.classList.contains("qti-match-tabular")?this._response:super.value}set value(e){this.classList.contains("qti-match-tabular")?this._response=e:super.value=e}async 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.value=[]}set correctResponse(e){if(e===""){this.correctOptions=[];return}else Array.isArray(e)&&(this.correctOptions=e)}render(){return this.classList.contains("qti-match-tabular")?u`
|
|
543
|
+
<slot name="prompt"></slot>
|
|
544
|
+
<table>
|
|
545
|
+
<tr>
|
|
546
|
+
<td></td>
|
|
547
|
+
${this.cols.map((e,r)=>u`<th part="r-header">${ae(e.innerHTML)}</th>`)}
|
|
548
|
+
</tr>
|
|
549
|
+
|
|
550
|
+
${this.rows.map((e,r)=>u`<tr>
|
|
551
|
+
<td part="c-header">${ae(e.innerHTML)}</td>
|
|
552
|
+
${this.cols.map((i,o)=>{let n=e.getAttribute("identifier"),a=i.getAttribute("identifier"),c=`${n} ${a}`,p=this.value.filter(b=>b.split(" ")[0]===n).length||0,f=this.value.includes(c),m=`rb ${f?"rb-checked":""} ${this.correctOptions.includes(c)?"rb-correct":""}`,y=this.correctOptions.length>0?!0:e.matchMax===1?!1:p>=e.matchMax&&!f;return u`<td>
|
|
553
|
+
<input
|
|
554
|
+
type=${e.matchMax===1?"radio":"checkbox"}
|
|
555
|
+
part=${m}
|
|
556
|
+
name=${n}
|
|
557
|
+
value=${c}
|
|
558
|
+
.disabled=${y}
|
|
559
|
+
@change=${b=>this.handleRadioChange(b)}
|
|
560
|
+
@click=${b=>e.matchMax===1?this.handleRadioClick(b):null}
|
|
561
|
+
/>
|
|
562
|
+
</td>`})}
|
|
563
|
+
</tr>`)}
|
|
564
|
+
</table>
|
|
565
|
+
`:u`<slot name="prompt"></slot> <slot></slot>`}};de.styles=Ui,l([E()],de.prototype,"_response",2),l([E()],de.prototype,"correctOptions",2),l([d({type:String,attribute:"response-identifier"})],de.prototype,"responseIdentifier",2),de=l([h("qti-match-interaction")],de);var dt=class extends x{constructor(){super();this._value=0}reset(){}validate(){return!0}get value(){return this._value.toString()}set value(e){if(!isNaN(parseInt(e.toString())))this._value=parseInt(e.toString());else throw new Error("Value must be a number")}static get properties(){return S(q({},x.properties),{step:{type:Number,attribute:"step",default:10}})}render(){return u` <slot name="prompt"></slot>
|
|
566
|
+
<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)})}};dt.styles=[g``],dt=l([h("qti-media-interaction")],dt);var Q=class extends Nt(z(x,"qti-simple-choice",!0,"drop-list"),"qti-simple-choice"){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),u` <slot name="prompt"> </slot>
|
|
567
|
+
<div part="container">
|
|
568
|
+
<slot part="drags"> </slot>
|
|
569
|
+
<div part="drops">
|
|
570
|
+
${Array.from(Array(this.nrChoices)).map((r,i)=>u`<drop-list part="drop-list" identifier="droplist${i}"></drop-list>${this.showCorrectResponses&&this.correctResponses.length>i?ae(`<span part='correct-response'>${this.correctResponses[i]}</span>`):""}`)}
|
|
571
|
+
</div>
|
|
572
|
+
</div>`}set correctResponse(e){if(e===""){this.showCorrectResponses=!1;return}this.correctResponses.length===0&&(Array.isArray(e)?e:[e]).forEach((i,o)=>{let n=this.querySelector(`qti-simple-choice[identifier="${i}"]`);n||(n=this.shadowRoot.querySelector(`qti-simple-choice[identifier="${i}"]`));let a=n==null?void 0:n.textContent.trim();this.correctResponses=[...this.correctResponses,a]}),this.showCorrectResponses=!0}getResponse(){return Array.from(this.shadowRoot.querySelectorAll("drop-list")).map(i=>{let o=i.querySelectorAll('[qti-draggable="true"]');return[...Array.from(o).map(a=>a.getAttribute("identifier"))].join(" ")})}async firstUpdated(e){super.firstUpdated(e),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(r=>r.setAttribute("part","qti-simple-choice"))}};Q.styles=[g`
|
|
573
|
+
[part='drags'] {
|
|
574
|
+
display: flex;
|
|
575
|
+
align-items: flex-start;
|
|
576
|
+
flex: 1;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
[part='drops'] {
|
|
580
|
+
flex: 1;
|
|
581
|
+
display: grid;
|
|
582
|
+
grid-auto-flow: column;
|
|
583
|
+
grid-auto-columns: 1fr;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
:host([orientation='horizontal']) [part='drags'] {
|
|
587
|
+
flex-direction: row;
|
|
588
|
+
}
|
|
589
|
+
:host([orientation='horizontal']) [part='drops'] {
|
|
590
|
+
grid-auto-flow: column;
|
|
591
|
+
}
|
|
592
|
+
:host([orientation='vertical']) [part='drags'] {
|
|
593
|
+
flex-direction: column;
|
|
594
|
+
}
|
|
595
|
+
:host([orientation='vertical']) [part='drops'] {
|
|
596
|
+
grid-auto-flow: row;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
[part='drop-list'] {
|
|
600
|
+
display: block;
|
|
601
|
+
flex: 1;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
[part='container'] {
|
|
605
|
+
display: flex;
|
|
606
|
+
gap: 0.5rem;
|
|
607
|
+
}
|
|
608
|
+
:host(.qti-choices-top) [part='container'] {
|
|
609
|
+
flex-direction: column;
|
|
610
|
+
}
|
|
611
|
+
:host(.qti-choices-bottom) [part='container'] {
|
|
612
|
+
flex-direction: column-reverse;
|
|
613
|
+
}
|
|
614
|
+
:host(.qti-choices-left) [part='container'] {
|
|
615
|
+
flex-direction: row;
|
|
616
|
+
}
|
|
617
|
+
:host(.qti-choices-right) [part='container'] {
|
|
618
|
+
flex-direction: row-reverse;
|
|
619
|
+
}
|
|
620
|
+
`],l([E()],Q.prototype,"nrChoices",2),l([E()],Q.prototype,"correctResponses",2),l([E()],Q.prototype,"showCorrectResponses",2),l([d({type:String})],Q.prototype,"orientation",2),Q=l([h("qti-order-interaction")],Q);var Wt=class extends v{render(){return u`<slot></slot>`}};Wt.styles=[g`
|
|
621
|
+
:host {
|
|
622
|
+
display: block;
|
|
623
|
+
}
|
|
624
|
+
::slotted(img) {
|
|
625
|
+
position: absolute;
|
|
626
|
+
cursor: move;
|
|
627
|
+
user-select: none;
|
|
628
|
+
left: 50%;
|
|
629
|
+
transform: translateX(-50%);
|
|
630
|
+
}
|
|
631
|
+
`];customElements.define("qti-position-object-interaction",Wt);var ut=class extends v{render(){return u`<slot></slot>`}constructor(){super(),this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}dragElementHandler(t){t.preventDefault();let e=t.clientX-this.startX,r=t.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+e+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=t.clientX,this.startY=t.clientY}firstUpdated(t){super.firstUpdated(t),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",e=>{this.startX=e.clientX,this.startY=e.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(t){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};ut.styles=[g`
|
|
632
|
+
:host {
|
|
633
|
+
display: inline-block;
|
|
634
|
+
position: relative;
|
|
635
|
+
}
|
|
636
|
+
`],ut=l([h("qti-position-object-stage")],ut);var Fi="important",Cs=" !"+Fi,Bi=G(class extends B{constructor(s){var t;if(super(s),s.type!==oe.ATTRIBUTE||s.name!=="style"||((t=s.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(s){return Object.keys(s).reduce((t,e)=>{let r=s[e];return r==null?t:t+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${r};`},"")}update(s,[t]){let{style:e}=s.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(t)),this.render(t);for(let r of this.ft)t[r]==null&&(this.ft.delete(r),r.includes("-")?e.removeProperty(r):e[r]=null);for(let r in t){let i=t[r];if(i!=null){this.ft.add(r);let o=typeof i=="string"&&i.endsWith(Cs);r.includes("-")||o?e.setProperty(r,o?i.slice(0,-11):i,o?Fi:""):e[r]=i}}return L}});var ue=class extends x{constructor(){super(...arguments);this.maxChoices=1/0;this.minChoices=0;this._points=[];this._imgElement=null;this._onImageClick=e=>{if(this._points.length<this.maxChoices){let r=e.offsetX,i=e.offsetY;this._points=[...this._points,`${r} ${i}`],this.saveResponse(this._points)}}}render(){return u` <slot name="prompt"></slot>
|
|
637
|
+
<point-container>
|
|
638
|
+
${zt(this._points,e=>e,(e,r)=>u`
|
|
639
|
+
<button
|
|
640
|
+
part="point"
|
|
641
|
+
style=${Bi({position:"absolute",transform:"translate(-50%, -50%)",left:`${e.split(" ")[0]}px`,top:`${e.split(" ")[1]}px`})}
|
|
642
|
+
aria-label="Remove point at ${e}"
|
|
643
|
+
@click=${i=>{i.stopPropagation(),this._points=this._points.filter((o,n)=>n!==r),this.saveResponse(this._points)}}
|
|
644
|
+
></button>
|
|
645
|
+
`)}
|
|
646
|
+
<slot></slot>
|
|
647
|
+
</point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set value(e){this._points=Array.isArray(e)?e:[e]}get value(){return this._points}firstUpdated(){this._imgElement=this.querySelector("img"),this._imgElement?this._imgElement.addEventListener("click",this._onImageClick):console.warn("No <img> element found in <qti-select-point-interaction>")}disconnectedCallback(){super.disconnectedCallback(),this._imgElement&&this._imgElement.removeEventListener("click",this._onImageClick)}};ue.styles=[g`
|
|
648
|
+
:host {
|
|
649
|
+
display: block;
|
|
650
|
+
}
|
|
651
|
+
point-container {
|
|
652
|
+
display: block;
|
|
653
|
+
position: relative;
|
|
654
|
+
}
|
|
655
|
+
`],l([d({type:Number,attribute:"max-choices"})],ue.prototype,"maxChoices",2),l([d({type:Number,attribute:"min-choices"})],ue.prototype,"minChoices",2),l([E()],ue.prototype,"_points",2),ue=l([h("qti-select-point-interaction")],ue);var R=class extends x{constructor(){super();this._value=0;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}get value(){return this._value.toString()}set value(e){if(!isNaN(parseInt(e.toString())))this._value=parseInt(e.toString());else throw new Error("Value must be a number")}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()),u`<slot name="prompt"></slot>
|
|
656
|
+
<div id="slider" part="slider">
|
|
657
|
+
${this.csLive.getPropertyValue("--show-bounds")=="true"?u`<div id="bounds" part="bounds">
|
|
658
|
+
<div>${this._min}</div>
|
|
659
|
+
<div>${this._max}</div>
|
|
660
|
+
</div>`:w}
|
|
661
|
+
${this.csLive.getPropertyValue("--show-ticks")=="true"?u`<div id="ticks" part="ticks"></div>`:w}
|
|
662
|
+
<div id="rail" part="rail" @mousedown=${this._onMouseDown} @touchstart=${this._onTouchMove}>
|
|
663
|
+
<div id="knob" part="knob">
|
|
664
|
+
${this.csLive.getPropertyValue("--show-value")=="true"?u`<div id="value" part="value">${this.value}</div>`:w}
|
|
665
|
+
</div>
|
|
666
|
+
</div>
|
|
667
|
+
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=a=>{let{x:c}=this.getPositionFromEvent(a),p=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(p),a.stopPropagation()},i=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",i),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",i);let{x:o}=this.getPositionFromEvent(e),n=o-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.stopPropagation()}_onMouseDown(e){let r=n=>{let a=n.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(a),n.preventDefault(),n.stopPropagation()},i=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",i),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",i);let o=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.preventDefault(),e.stopPropagation()}calculateValue(e){let r=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,i=this.min+Math.round((r-this.min)/this._step)*this._step;this._value=i}getPositionFromEvent(e){let r;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let i=typeof e.originalEvent=="undefined"?e:e.originalEvent,o=i.touches[0]||i.changedTouches[0];r={x:o.pageX,y:o.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}};R.styles=[g``],l([ve("#knob")],R.prototype,"_knob",2),l([ve("#rail")],R.prototype,"_rail",2),l([d({type:Boolean,attribute:"step-label"})],R.prototype,"stepLabel",2),l([d({type:Boolean})],R.prototype,"reverse",2),l([d({type:Number,attribute:"lower-bound"})],R.prototype,"min",1),l([d({type:Number,attribute:"upper-bound"})],R.prototype,"max",1),l([d({type:Number,attribute:"step"})],R.prototype,"step",1),l([M("disabled",{waitUntilFirstUpdate:!0})],R.prototype,"_handleDisabledChange",2),l([M("readonly",{waitUntilFirstUpdate:!0})],R.prototype,"_handleReadonlyChange",2),R=l([h("qti-slider-interaction")],R);var ht=class extends v{render(){return u`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(t){var r,i,o;let e=Array.from((i=(r=this.firstElementChild)==null?void 0:r.childNodes)!=null?i:[]).find(n=>n.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",(o=e.textContent)!=null?o:"")}catch(n){console.error("custom-operator contains invalid javascript code",n)}}calculate(){let t={variable:r=>{var i,o,n;return(n=(o=(i=this._context)==null?void 0:i.variables.find(a=>a.identifier===r))==null?void 0:o.value)!=null?n:""},correct:r=>{var i,o,n;return(n=(o=(i=this._context)==null?void 0:i.variables.find(a=>a.identifier===r))==null?void 0:o.correctResponse)!=null?n:""}},e={getVariable:r=>{var i;return(i=this._context)==null?void 0:i.variables.find(o=>o.identifier===r)},updateOutcomeVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:i}}))},updateResponseVariable:(r,i)=>{this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:r,response:i}}))}};return this.operatorFunction(this._context,t,e)}};l([k({context:$,subscribe:!0}),E()],ht.prototype,"_context",2),ht=l([h("qti-custom-operator")],ht);var mt=class extends v{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,composed:!0,cancelable:!1}))}render(){return u` <slot name="qti-gap-img"></slot> `}};mt.styles=g`
|
|
668
|
+
:host {
|
|
669
|
+
display: flex;
|
|
670
|
+
user-select: none;
|
|
671
|
+
position: absolute;
|
|
672
|
+
}
|
|
673
|
+
`,mt=l([h("qti-associable-hotspot")],mt);var He=class extends v{constructor(){super(...arguments);this.tabindex=0}render(){return u` <slot name="qti-gap-text"></slot>`}};He.styles=g`
|
|
674
|
+
:host {
|
|
675
|
+
display: flex;
|
|
676
|
+
user-select: none;
|
|
677
|
+
}
|
|
678
|
+
`,l([d({type:Number,reflect:!0})],He.prototype,"tabindex",2),He=l([h("qti-gap")],He);var Ve=class extends v{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","qti-gap-img")}};Ve.styles=g`
|
|
679
|
+
:host {
|
|
680
|
+
display: flex;
|
|
681
|
+
user-select: none;
|
|
682
|
+
}
|
|
683
|
+
`,l([d({type:Number,reflect:!0})],Ve.prototype,"tabindex",2),Ve=l([h("qti-gap-img")],Ve);var Ne=class extends O(v,"qti-gap-text"){constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-gap-text")}render(){return u`<slot></slot>`}};Ne.styles=g`
|
|
684
|
+
:host {
|
|
685
|
+
display: inline-flex;
|
|
686
|
+
user-select: none;
|
|
687
|
+
}
|
|
688
|
+
`,l([d({type:Number,reflect:!0})],Ne.prototype,"tabindex",2),Ne=l([h("qti-gap-text")],Ne);var Pe=class extends O(v,"qti-hotspot-choice"){};Pe.styles=g`
|
|
689
|
+
:host {
|
|
690
|
+
display: flex;
|
|
691
|
+
user-select: none;
|
|
692
|
+
position: absolute;
|
|
693
|
+
}
|
|
694
|
+
`,l([d({attribute:"aria-ordervalue",type:Number,reflect:!0})],Pe.prototype,"order",2),Pe=l([h("qti-hotspot-choice")],Pe);var ft=class extends O(v,"qti-hottext"){render(){return u`<div part="ch"><div part="cha"></div></div>
|
|
695
|
+
<slot></slot> `}};ft.styles=g`
|
|
696
|
+
:host {
|
|
697
|
+
display: flex;
|
|
698
|
+
user-select: none;
|
|
699
|
+
}
|
|
700
|
+
`,ft=l([h("qti-hottext")],ft);var gt=class extends v{static get styles(){return[g`
|
|
701
|
+
:host {
|
|
702
|
+
display: block;
|
|
703
|
+
cursor: pointer;
|
|
704
|
+
}
|
|
705
|
+
`]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onSelectInlineChoice),this.dispatchEvent(new CustomEvent("qti-inline-choice-register",{bubbles:!0,composed:!0,cancelable:!1}))}disconnectedCallback(){this.removeEventListener("click",this._onSelectInlineChoice)}render(){return u` <slot></slot> `}_onSelectInlineChoice(){this.dispatchEvent(new CustomEvent("qti-inline-choice-select",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier}}))}};l([d({type:String})],gt.prototype,"identifier",2),gt=l([h("qti-inline-choice")],gt);var Ie=class extends O(v,"qti-simple-choice"){get checked(){return this.internals.states.has("--checked")}render(){return u`<div part="ch">
|
|
706
|
+
<div part="cha"></div>
|
|
707
|
+
</div>
|
|
708
|
+
${this.marker?u`<div id="label">${this.marker}</div>`:w}
|
|
709
|
+
<slot part="slot"></slot> `}};Ie.styles=g`
|
|
710
|
+
:host {
|
|
711
|
+
display: flex;
|
|
712
|
+
align-items: center;
|
|
713
|
+
user-select: none;
|
|
714
|
+
}
|
|
715
|
+
slot {
|
|
716
|
+
width: 100%;
|
|
717
|
+
display: flex;
|
|
718
|
+
align-items: center;
|
|
719
|
+
}
|
|
720
|
+
[part='ch'] {
|
|
721
|
+
display: flex;
|
|
722
|
+
flex-shrink: 0;
|
|
723
|
+
align-items: center;
|
|
724
|
+
justify-content: center;
|
|
725
|
+
}
|
|
726
|
+
`,l([d({type:String,attribute:!1})],Ie.prototype,"marker",2),Ie=l([h("qti-simple-choice")],Ie);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");function Xi(s){class t extends s{createRenderRoot(){return this}get assessmentItem(){var r;return(r=this.renderRoot)==null?void 0:r.querySelector("qti-assessment-item")}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.dispatchEvent(new CustomEvent("qti-item-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href}}))}render(){return u`${this.xmlDoc}`}}return l([d({type:String,reflect:!0})],t.prototype,"identifier",2),l([d({type:String})],t.prototype,"href",2),l([d({type:Object,attribute:!1})],t.prototype,"xmlDoc",2),t}var Yt=class extends Xi(v){};Yt=l([h("qti-item")],Yt);var bb=async s=>{let t=s.substring(0,s.lastIndexOf("/")),e=await Ei().load(`${s}`).then(a=>a.assessmentTest()),r=await cr().load(`${t}/${e.href}`).then(a=>a.htmlDoc()),i=await cr().load(`${t}/${e.href}`).then(a=>a.items()),o=`${t}/${e.href}`,n=`${t}/${e.href.substring(0,e.href.lastIndexOf("/"))}`;return{testHTMLDoc:r,testURI:n,testURL:o,items:i,testIdentifier:e.identifier}},vb=async s=>St().load(s).then(t=>t.htmlDoc().firstElementChild);export{O as ActiveElementMixin,x as Interaction,It as QtiAnd,D as QtiAssessmentItem,Se as QtiAssessmentStimulusRef,mt as QtiAssociableHotspot,ke as QtiAssociateInteraction,Ot as QtiBaseValue,$e as QtiChoiceInteraction,Rt as QtiCompanionMaterialsInfo,N as QtiConditionExpression,vr as QtiContains,kt as QtiContentBody,yr as QtiCorrect,W as QtiCustomInteraction,ht as QtiCustomOperator,Le as QtiEndAttemptInteraction,Ft as QtiEqual,Ut as QtiEqualRounded,_ as QtiExpression,V as QtiExtendedTextInteraction,Ge as QtiFeedbackBlock,Qe as QtiFeedbackInline,He as QtiGap,Ve as QtiGapImg,at as QtiGapMatchInteraction,Ne as QtiGapText,Y as QtiGraphicAssociateInteraction,lt as QtiGraphicGapMatchInteraction,ct as QtiGraphicOrderInteraction,xr as QtiGt,Er as QtiGte,Pe as QtiHotspotChoice,pt as QtiHotspotInteraction,ft as QtiHottext,Vt as QtiHottextInteraction,gt as QtiInlineChoice,le as QtiInlineChoiceInteraction,Cr as QtiIsNull,Yt as QtiItem,Ke as QtiItemBody,Xi as QtiItemMixin,Pt as QtiLookupOutcomeValue,_r as QtiLt,wr as QtiLte,Bt as QtiMapResponse,Re as QtiMapping,qr as QtiMatch,de as QtiMatchInteraction,dt as QtiMediaInteraction,Ar as QtiMember,et as QtiModalFeedback,Tr as QtiMultiple,Sr as QtiNot,Mr as QtiOr,Q as QtiOrderInteraction,$r as QtiOrdered,U as QtiOutcomeDeclaration,it as QtiOutcomeProcessing,hr as QtiOutcomeProcessingProcessor,ce as QtiPortableCustomInteraction,ut as QtiPositionObjectStage,nt as QtiPrintedVariable,Rr as QtiProduct,Mt as QtiPrompt,mr as QtiResponseCondition,J as QtiResponseDeclaration,st as QtiResponseElse,br as QtiResponseElseIf,ot as QtiResponseIf,ye as QtiResponseProcessing,F as QtiRubricBlock,j as QtiRule,Wt as QtiSPositionObjectInteraction,ue as QtiSelectPointInteraction,fr as QtiSetOutcomeValue,gr as QtiSetOutcomeValueRule,pe as QtiSimpleAssociableChoice,Ie as QtiSimpleChoice,R as QtiSliderInteraction,Xt as QtiStringMatch,$t as QtiStylesheet,kr as QtiSum,Lr as QtiSumExpression,X as QtiTextEntryInteraction,Dr as QtiVariable,vb as getItemByUri,bb as getManifestInfo,$ as itemContext,hi as itemContextVariables,Es as qtiAndMixin,St as qtiTransformItem,Ei as qtiTransformManifest,cr as qtiTransformTest};
|
|
727
|
+
/*! Bundled license information:
|
|
728
|
+
|
|
729
|
+
@lit/context/lib/context-request-event.js:
|
|
730
|
+
(**
|
|
731
|
+
* @license
|
|
732
|
+
* Copyright 2021 Google LLC
|
|
733
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
734
|
+
*)
|
|
735
|
+
|
|
736
|
+
@lit/context/lib/create-context.js:
|
|
737
|
+
(**
|
|
738
|
+
* @license
|
|
739
|
+
* Copyright 2021 Google LLC
|
|
740
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
741
|
+
*)
|
|
742
|
+
|
|
743
|
+
@lit/context/lib/controllers/context-consumer.js:
|
|
744
|
+
(**
|
|
745
|
+
* @license
|
|
746
|
+
* Copyright 2021 Google LLC
|
|
747
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
748
|
+
*)
|
|
749
|
+
|
|
750
|
+
@lit/context/lib/value-notifier.js:
|
|
751
|
+
(**
|
|
752
|
+
* @license
|
|
753
|
+
* Copyright 2021 Google LLC
|
|
754
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
755
|
+
*)
|
|
756
|
+
|
|
757
|
+
@lit/context/lib/controllers/context-provider.js:
|
|
758
|
+
(**
|
|
759
|
+
* @license
|
|
760
|
+
* Copyright 2021 Google LLC
|
|
761
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
762
|
+
*)
|
|
763
|
+
|
|
764
|
+
@lit/context/lib/context-root.js:
|
|
765
|
+
(**
|
|
766
|
+
* @license
|
|
767
|
+
* Copyright 2021 Google LLC
|
|
768
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
769
|
+
*)
|
|
770
|
+
|
|
771
|
+
@lit/context/lib/decorators/provide.js:
|
|
772
|
+
(**
|
|
773
|
+
* @license
|
|
774
|
+
* Copyright 2017 Google LLC
|
|
775
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
776
|
+
*)
|
|
777
|
+
|
|
778
|
+
@lit/context/lib/decorators/consume.js:
|
|
779
|
+
(**
|
|
780
|
+
* @license
|
|
781
|
+
* Copyright 2022 Google LLC
|
|
782
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
783
|
+
*)
|
|
784
|
+
|
|
785
|
+
@lit-labs/ssr-dom-shim/lib/element-internals.js:
|
|
786
|
+
(**
|
|
787
|
+
* @license
|
|
788
|
+
* Copyright 2023 Google LLC
|
|
789
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
790
|
+
*)
|
|
791
|
+
|
|
792
|
+
@lit-labs/ssr-dom-shim/index.js:
|
|
793
|
+
(**
|
|
794
|
+
* @license
|
|
795
|
+
* Copyright 2019 Google LLC
|
|
796
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
797
|
+
*)
|
|
798
|
+
|
|
799
|
+
@lit/reactive-element/node/css-tag.js:
|
|
800
|
+
(**
|
|
801
|
+
* @license
|
|
802
|
+
* Copyright 2019 Google LLC
|
|
803
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
804
|
+
*)
|
|
805
|
+
|
|
806
|
+
lit-html/node/lit-html.js:
|
|
807
|
+
(**
|
|
808
|
+
* @license
|
|
809
|
+
* Copyright 2017 Google LLC
|
|
810
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
811
|
+
*)
|
|
812
|
+
|
|
813
|
+
lit-element/lit-element.js:
|
|
814
|
+
(**
|
|
815
|
+
* @license
|
|
816
|
+
* Copyright 2017 Google LLC
|
|
817
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
818
|
+
*)
|
|
819
|
+
|
|
820
|
+
lit-html/node/is-server.js:
|
|
821
|
+
(**
|
|
822
|
+
* @license
|
|
823
|
+
* Copyright 2022 Google LLC
|
|
824
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
825
|
+
*)
|
|
826
|
+
|
|
827
|
+
@lit/reactive-element/node/decorators/custom-element.js:
|
|
828
|
+
(**
|
|
829
|
+
* @license
|
|
830
|
+
* Copyright 2017 Google LLC
|
|
831
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
832
|
+
*)
|
|
833
|
+
|
|
834
|
+
@lit/reactive-element/node/decorators/property.js:
|
|
835
|
+
(**
|
|
836
|
+
* @license
|
|
837
|
+
* Copyright 2017 Google LLC
|
|
838
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
839
|
+
*)
|
|
840
|
+
|
|
841
|
+
@lit/reactive-element/node/decorators/state.js:
|
|
842
|
+
(**
|
|
843
|
+
* @license
|
|
844
|
+
* Copyright 2017 Google LLC
|
|
845
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
846
|
+
*)
|
|
847
|
+
|
|
848
|
+
@lit/reactive-element/node/decorators/event-options.js:
|
|
849
|
+
(**
|
|
850
|
+
* @license
|
|
851
|
+
* Copyright 2017 Google LLC
|
|
852
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
853
|
+
*)
|
|
854
|
+
|
|
855
|
+
@lit/reactive-element/node/decorators/base.js:
|
|
856
|
+
(**
|
|
857
|
+
* @license
|
|
858
|
+
* Copyright 2017 Google LLC
|
|
859
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
860
|
+
*)
|
|
861
|
+
|
|
862
|
+
@lit/reactive-element/node/decorators/query.js:
|
|
863
|
+
(**
|
|
864
|
+
* @license
|
|
865
|
+
* Copyright 2017 Google LLC
|
|
866
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
867
|
+
*)
|
|
868
|
+
|
|
869
|
+
@lit/reactive-element/node/decorators/query-all.js:
|
|
870
|
+
(**
|
|
871
|
+
* @license
|
|
872
|
+
* Copyright 2017 Google LLC
|
|
873
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
874
|
+
*)
|
|
875
|
+
|
|
876
|
+
@lit/reactive-element/node/decorators/query-async.js:
|
|
877
|
+
(**
|
|
878
|
+
* @license
|
|
879
|
+
* Copyright 2017 Google LLC
|
|
880
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
881
|
+
*)
|
|
882
|
+
|
|
883
|
+
@lit/reactive-element/node/decorators/query-assigned-elements.js:
|
|
884
|
+
(**
|
|
885
|
+
* @license
|
|
886
|
+
* Copyright 2021 Google LLC
|
|
887
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
888
|
+
*)
|
|
889
|
+
|
|
890
|
+
@lit/reactive-element/node/decorators/query-assigned-nodes.js:
|
|
891
|
+
(**
|
|
892
|
+
* @license
|
|
893
|
+
* Copyright 2017 Google LLC
|
|
894
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
895
|
+
*)
|
|
896
|
+
|
|
897
|
+
lit-html/node/directives/if-defined.js:
|
|
898
|
+
(**
|
|
899
|
+
* @license
|
|
900
|
+
* Copyright 2018 Google LLC
|
|
901
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
902
|
+
*)
|
|
903
|
+
|
|
904
|
+
lit-html/node/directive-helpers.js:
|
|
905
|
+
(**
|
|
906
|
+
* @license
|
|
907
|
+
* Copyright 2020 Google LLC
|
|
908
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
909
|
+
*)
|
|
910
|
+
|
|
911
|
+
lit-html/node/directive.js:
|
|
912
|
+
(**
|
|
913
|
+
* @license
|
|
914
|
+
* Copyright 2017 Google LLC
|
|
915
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
916
|
+
*)
|
|
917
|
+
|
|
918
|
+
lit-html/node/async-directive.js:
|
|
919
|
+
(**
|
|
920
|
+
* @license
|
|
921
|
+
* Copyright 2017 Google LLC
|
|
922
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
923
|
+
*)
|
|
924
|
+
|
|
925
|
+
lit-html/node/directives/ref.js:
|
|
926
|
+
(**
|
|
927
|
+
* @license
|
|
928
|
+
* Copyright 2020 Google LLC
|
|
929
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
930
|
+
*)
|
|
931
|
+
|
|
932
|
+
lit-html/node/directives/unsafe-html.js:
|
|
933
|
+
(**
|
|
934
|
+
* @license
|
|
935
|
+
* Copyright 2017 Google LLC
|
|
936
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
937
|
+
*)
|
|
938
|
+
|
|
939
|
+
lit-html/node/directives/repeat.js:
|
|
940
|
+
(**
|
|
941
|
+
* @license
|
|
942
|
+
* Copyright 2017 Google LLC
|
|
943
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
944
|
+
*)
|
|
945
|
+
|
|
946
|
+
lit-html/node/directives/style-map.js:
|
|
947
|
+
(**
|
|
948
|
+
* @license
|
|
949
|
+
* Copyright 2018 Google LLC
|
|
950
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
951
|
+
*)
|
|
952
|
+
*/
|