@citolab/qti-components 6.7.1-1 → 6.7.1-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +76 -76
- package/dist/index.js +18 -18
- package/dist/qti-components/index.d.ts +25 -25
- package/dist/qti-components/index.js +43 -43
- package/package.json +1 -1
|
@@ -96,6 +96,65 @@
|
|
|
96
96
|
}
|
|
97
97
|
]
|
|
98
98
|
},
|
|
99
|
+
{
|
|
100
|
+
"kind": "javascript-module",
|
|
101
|
+
"path": "src/lib/qti-transformers/index.ts",
|
|
102
|
+
"declarations": [],
|
|
103
|
+
"exports": [
|
|
104
|
+
{
|
|
105
|
+
"kind": "js",
|
|
106
|
+
"name": "*",
|
|
107
|
+
"declaration": {
|
|
108
|
+
"name": "*",
|
|
109
|
+
"package": "./qti-transformers"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"kind": "javascript-module",
|
|
116
|
+
"path": "src/lib/qti-transformers/qti-transformers.ts",
|
|
117
|
+
"declarations": [
|
|
118
|
+
{
|
|
119
|
+
"kind": "function",
|
|
120
|
+
"name": "qtiTransformItem",
|
|
121
|
+
"description": "This module exports a function that returns an object with methods to load, parse, transform and serialize QTI XML items.",
|
|
122
|
+
"return": {
|
|
123
|
+
"type": {
|
|
124
|
+
"text": ""
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"kind": "function",
|
|
130
|
+
"name": "qtiTransformTest",
|
|
131
|
+
"description": "Returns an object with methods to load, parse and transform QTI tests.",
|
|
132
|
+
"return": {
|
|
133
|
+
"type": {
|
|
134
|
+
"text": ""
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"exports": [
|
|
140
|
+
{
|
|
141
|
+
"kind": "js",
|
|
142
|
+
"name": "qtiTransformItem",
|
|
143
|
+
"declaration": {
|
|
144
|
+
"name": "qtiTransformItem",
|
|
145
|
+
"module": "src/lib/qti-transformers/qti-transformers.ts"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"kind": "js",
|
|
150
|
+
"name": "qtiTransformTest",
|
|
151
|
+
"declaration": {
|
|
152
|
+
"name": "qtiTransformTest",
|
|
153
|
+
"module": "src/lib/qti-transformers/qti-transformers.ts"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
},
|
|
99
158
|
{
|
|
100
159
|
"kind": "javascript-module",
|
|
101
160
|
"path": "src/lib/qti-components/index.ts",
|
|
@@ -301,6 +360,14 @@
|
|
|
301
360
|
"package": "./qti-interaction/qti-associate-interaction/qti-associate-interaction"
|
|
302
361
|
}
|
|
303
362
|
},
|
|
363
|
+
{
|
|
364
|
+
"kind": "js",
|
|
365
|
+
"name": "*",
|
|
366
|
+
"declaration": {
|
|
367
|
+
"name": "*",
|
|
368
|
+
"package": "./qti-interaction/qti-end-attempt-interaction/qti-end-attempt-interaction"
|
|
369
|
+
}
|
|
370
|
+
},
|
|
304
371
|
{
|
|
305
372
|
"kind": "js",
|
|
306
373
|
"name": "*",
|
|
@@ -402,7 +469,15 @@
|
|
|
402
469
|
"name": "*",
|
|
403
470
|
"declaration": {
|
|
404
471
|
"name": "*",
|
|
405
|
-
"package": "./qti-
|
|
472
|
+
"package": "./qti-assessment-item/qti-assessment-item.context"
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"kind": "js",
|
|
477
|
+
"name": "*",
|
|
478
|
+
"declaration": {
|
|
479
|
+
"name": "*",
|
|
480
|
+
"package": "./qti-custom-operator/qti-custom-operator"
|
|
406
481
|
}
|
|
407
482
|
},
|
|
408
483
|
{
|
|
@@ -484,81 +559,6 @@
|
|
|
484
559
|
"name": "*",
|
|
485
560
|
"package": "./qti-interaction/qti-simple-choice"
|
|
486
561
|
}
|
|
487
|
-
},
|
|
488
|
-
{
|
|
489
|
-
"kind": "js",
|
|
490
|
-
"name": "*",
|
|
491
|
-
"declaration": {
|
|
492
|
-
"name": "*",
|
|
493
|
-
"package": "./qti-assessment-item/qti-assessment-item.context"
|
|
494
|
-
}
|
|
495
|
-
},
|
|
496
|
-
{
|
|
497
|
-
"kind": "js",
|
|
498
|
-
"name": "*",
|
|
499
|
-
"declaration": {
|
|
500
|
-
"name": "*",
|
|
501
|
-
"package": "./qti-custom-operator/qti-custom-operator"
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
]
|
|
505
|
-
},
|
|
506
|
-
{
|
|
507
|
-
"kind": "javascript-module",
|
|
508
|
-
"path": "src/lib/qti-transformers/index.ts",
|
|
509
|
-
"declarations": [],
|
|
510
|
-
"exports": [
|
|
511
|
-
{
|
|
512
|
-
"kind": "js",
|
|
513
|
-
"name": "*",
|
|
514
|
-
"declaration": {
|
|
515
|
-
"name": "*",
|
|
516
|
-
"package": "./qti-transformers"
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
]
|
|
520
|
-
},
|
|
521
|
-
{
|
|
522
|
-
"kind": "javascript-module",
|
|
523
|
-
"path": "src/lib/qti-transformers/qti-transformers.ts",
|
|
524
|
-
"declarations": [
|
|
525
|
-
{
|
|
526
|
-
"kind": "function",
|
|
527
|
-
"name": "qtiTransformItem",
|
|
528
|
-
"description": "This module exports a function that returns an object with methods to load, parse, transform and serialize QTI XML items.",
|
|
529
|
-
"return": {
|
|
530
|
-
"type": {
|
|
531
|
-
"text": ""
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
"kind": "function",
|
|
537
|
-
"name": "qtiTransformTest",
|
|
538
|
-
"description": "Returns an object with methods to load, parse and transform QTI tests.",
|
|
539
|
-
"return": {
|
|
540
|
-
"type": {
|
|
541
|
-
"text": ""
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
],
|
|
546
|
-
"exports": [
|
|
547
|
-
{
|
|
548
|
-
"kind": "js",
|
|
549
|
-
"name": "qtiTransformItem",
|
|
550
|
-
"declaration": {
|
|
551
|
-
"name": "qtiTransformItem",
|
|
552
|
-
"module": "src/lib/qti-transformers/qti-transformers.ts"
|
|
553
|
-
}
|
|
554
|
-
},
|
|
555
|
-
{
|
|
556
|
-
"kind": "js",
|
|
557
|
-
"name": "qtiTransformTest",
|
|
558
|
-
"declaration": {
|
|
559
|
-
"name": "qtiTransformTest",
|
|
560
|
-
"module": "src/lib/qti-transformers/qti-transformers.ts"
|
|
561
|
-
}
|
|
562
562
|
}
|
|
563
563
|
]
|
|
564
564
|
},
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnPropertyDescriptor,_s=Object.getOwnPropertyDescriptors;var yr=Object.getOwnPropertySymbols;var Cs=Object.prototype.hasOwnProperty,As=Object.prototype.propertyIsEnumerable;var xr=(i,t,e)=>t in i?Er(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,x=(i,t)=>{for(var e in t||(t={}))Cs.call(t,e)&&xr(i,e,t[e]);if(yr)for(var e of yr(t))As.call(t,e)&&xr(i,e,t[e]);return i},R=(i,t)=>xs(i,_s(t));var l=(i,t,e,r)=>{for(var s=r>1?void 0:r?Es(t,e):t,n=i.length-1,o;n>=0;n--)(o=i[n])&&(s=(r?o(t,e,s):o(s))||s);return r&&s&&Er(t,e,s),s};var Q=class extends Event{constructor(t,e,r){super("context-request",{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=r!=null?r:!1}};var me=class{constructor(t,e,r,s){var n;if(this.subscribe=!1,this.provided=!1,this.value=void 0,this.t=(o,a)=>{this.unsubscribe&&(this.unsubscribe!==a&&(this.provided=!1,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=!0,this.callback&&this.callback(o,a)),this.unsubscribe=a},this.host=t,e.context!==void 0){let o=e;this.context=o.context,this.callback=o.callback,this.subscribe=(n=o.subscribe)!=null?n:!1}else this.context=e,this.callback=r,this.subscribe=s!=null?s:!1;this.host.addController(this)}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new Q(this.context,this.t,this.subscribe))}};var Ke=class{get value(){return this.o}set value(t){this.setValue(t)}setValue(t,e=!1){let r=e||!Object.is(t,this.o);this.o=t,r&&this.updateObservers()}constructor(t){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:r}]of this.subscriptions)e(this.o,r)},t!==void 0&&(this.value=t)}addCallback(t,e,r){if(!r)return void t(this.value);this.subscriptions.has(t)||this.subscriptions.set(t,{disposer:()=>{this.subscriptions.delete(t)},consumerHost:e});let{disposer:s}=this.subscriptions.get(t);t(this.value,s)}clearCallbacks(){this.subscriptions.clear()}};var Vt=class extends Event{constructor(t){super("context-provider",{bubbles:!0,composed:!0}),this.context=t}},fe=class extends Ke{constructor(t,e,r){var s,n;super(e.context!==void 0?e.initialValue:r),this.onContextRequest=o=>{let a=o.composedPath()[0];o.context===this.context&&a!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,a,o.subscribe))},this.onProviderRequest=o=>{let a=o.composedPath()[0];if(o.context!==this.context||a===this.host)return;let c=new Set;for(let[u,{consumerHost:h}]of this.subscriptions)c.has(u)||(c.add(u),h.dispatchEvent(new Q(this.context,u,!0)));o.stopPropagation()},this.host=t,e.context!==void 0?this.context=e.context:this.context=e,this.attachListeners(),(n=(s=this.host).addController)==null||n.call(s,this)}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest)}hostConnected(){this.host.dispatchEvent(new Vt(this.context))}};function Ht({context:i}){return(t,e)=>{let r=new WeakMap;if(typeof e=="object")return e.addInitializer(function(){r.set(this,new fe(this,{context:i}))}),{get(){return t.get.call(this)},set(s){var n;return(n=r.get(this))==null||n.setValue(s),t.set.call(this,s)},init(s){var n;return(n=r.get(this))==null||n.setValue(s),s}};{t.constructor.addInitializer(o=>{r.set(o,new fe(o,{context:i}))});let s=Object.getOwnPropertyDescriptor(t,e),n;if(s===void 0){let o=new WeakMap;n={get:function(){return o.get(this)},set:function(a){r.get(this).setValue(a),o.set(this,a)},configurable:!0,enumerable:!0}}else{let o=s.set;n=R(x({},s),{set:function(a){r.get(this).setValue(a),o==null||o.call(this,a)}})}return void Object.defineProperty(t,e,n)}}}function Y({context:i,subscribe:t}){return(e,r)=>{typeof r=="object"?r.addInitializer(function(){new me(this,{context:i,callback:s=>{this[r.name]=s},subscribe:t})}):e.constructor.addInitializer(s=>{new me(s,{context:i,callback:n=>{s[r]=n},subscribe:t})})}}var _r=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(t){this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBraileLabel="",this.ariaBraileRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColSpan="",this.ariaCurrent="",this.ariaDescription="",this.ariaDisabled="",this.ariaExpanded="",this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=!0,this.__host=t}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),!0}reportValidity(){return!0}setFormValue(){}setValidity(){}};var Cr=new WeakMap,$e=i=>{let t=Cr.get(i);return t===void 0&&Cr.set(i,t=new Map),t},ws=class{constructor(){this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null}get attributes(){return Array.from($e(this)).map(([t,e])=>({name:t,value:e}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}setAttribute(t,e){$e(this).set(t,String(e))}removeAttribute(t){$e(this).delete(t)}hasAttribute(t){return $e(this).has(t)}attachShadow(t){let e={host:this};return this.__shadowRootMode=t.mode,t&&t.mode==="open"&&(this.__shadowRoot=e),e}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let t=new _r(this);return this.__internals=t,t}getAttribute(t){let e=$e(this).get(t);return e!=null?e:null}};var $s=class extends ws{},Ar=$s;var Ss=class{constructor(){this.__definitions=new Map}define(t,e){var r;if(this.__definitions.has(t))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${t}" has already been used with this registry`);this.__definitions.set(t,{ctor:e,observedAttributes:(r=e.observedAttributes)!=null?r:[]})}get(t){let e=this.__definitions.get(t);return e==null?void 0:e.ctor}},Rs=Ss;var qr=new Rs;var Se=globalThis,We=Se.ShadowRoot&&(Se.ShadyCSS===void 0||Se.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Nt=Symbol(),wr=new WeakMap,Re=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Nt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(We&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=wr.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&wr.set(e,t))}return t}toString(){return this.cssText}},$r=i=>new Re(typeof i=="string"?i:i+"",void 0,Nt),b=(i,...t)=>{let e=i.length===1?i[0]:t.reduce((r,s,n)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+i[n+1],i[0]);return new Re(e,i,Nt)},Dt=(i,t)=>{if(We)i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),s=Se.litNonce;s!==void 0&&r.setAttribute("nonce",s),r.textContent=e.cssText,i.appendChild(r)}},Je=We||Se.CSSStyleSheet===void 0?i=>i:i=>i instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return $r(e)})(i):i;var{is:ks,defineProperty:Ts,getOwnPropertyDescriptor:Ls,getOwnPropertyNames:Ms,getOwnPropertySymbols:Ps,getPrototypeOf:Vs}=Object,O=globalThis,kr;(kr=O.customElements)!=null||(O.customElements=qr);var Sr=O.trustedTypes,Hs=Sr?Sr.emptyScript:"",Ot=O.reactiveElementPolyfillSupport,ke=(i,t)=>i,Te={toAttribute(i,t){switch(t){case Boolean:i=i?Hs:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,t){let e=i;switch(t){case Boolean:e=i!==null;break;case Number:e=i===null?null:Number(i);break;case Object:case Array:try{e=JSON.parse(i)}catch(r){e=null}}return e}},Ge=(i,t)=>!ks(i,t),Rr={attribute:!0,type:String,converter:Te,reflect:!1,hasChanged:Ge},Tr,Lr;(Tr=Symbol.metadata)!=null||(Symbol.metadata=Symbol("metadata")),(Lr=O.litPropertyMetadata)!=null||(O.litPropertyMetadata=new WeakMap);var Mr,K=class extends((Mr=globalThis.HTMLElement)!=null?Mr:Ar){static addInitializer(t){var e;this._$Ei(),((e=this.l)!=null?e:this.l=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=Rr){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),s=this.getPropertyDescriptor(t,r,e);s!==void 0&&Ts(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){var o;let{get:s,set:n}=(o=Ls(this.prototype,t))!=null?o:{get(){return this[e]},set(a){this[e]=a}};return{get(){return s==null?void 0:s.call(this)},set(a){let c=s==null?void 0:s.call(this);n.call(this,a),this.requestUpdate(t,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){var e;return(e=this.elementProperties.get(t))!=null?e:Rr}static _$Ei(){if(this.hasOwnProperty(ke("elementProperties")))return;let t=Vs(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ke("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ke("properties"))){let e=this.properties,r=[...Ms(e),...Ps(e)];for(let s of r)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,s]of e)this.elementProperties.set(r,s)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let s=this._$Eu(e,r);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let s of r)e.unshift(Je(s))}else t!==void 0&&e.push(Je(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var t;this._$Eg=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$ES(),this.requestUpdate(),(t=this.constructor.l)==null||t.forEach(e=>e(this))}addController(t){var e,r;((e=this._$E_)!=null?e:this._$E_=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&((r=t.hostConnected)==null||r.call(t))}removeController(t){var e;(e=this._$E_)==null||e.delete(t)}_$ES(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){var e;let t=(e=this.shadowRoot)!=null?e:this.attachShadow(this.constructor.shadowRootOptions);return Dt(t,this.constructor.elementStyles),t}connectedCallback(){var t,e;(t=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(r=>{var s;return(s=r.hostConnected)==null?void 0:s.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$E_)==null||t.forEach(e=>{var r;return(r=e.hostDisconnected)==null?void 0:r.call(e)})}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EO(t,e){var n;let r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(s!==void 0&&r.reflect===!0){let o=(((n=r.converter)==null?void 0:n.toAttribute)!==void 0?r.converter:Te).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null}}_$AK(t,e){var n;let r=this.constructor,s=r._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let o=r.getPropertyOptions(s),a=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:Te;this._$Em=s,this[s]=a.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r,s=!1,n){var o;if(t!==void 0){if(r!=null||(r=this.constructor.getPropertyOptions(t)),!((o=r.hasChanged)!=null?o:Ge)(s?n:this[t],e))return;this.C(t,e,r)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(t,e,r){var s;this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&((s=this._$Ej)!=null?s:this._$Ej=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r,s;if(!this.isUpdatePending)return;if(!this.hasUpdated){if((r=this.renderRoot)!=null||(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[o,a]of this._$Ep)this[o]=a;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[o,a]of n)a.wrapped!==!0||this._$AL.has(o)||this[o]===void 0||this.C(o,this[o],a)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),(s=this._$E_)==null||s.forEach(n=>{var o;return(o=n.hostUpdate)==null?void 0:o.call(n)}),this.update(e)):this._$ET()}catch(n){throw t=!1,this._$ET(),n}t&&this._$AE(e)}willUpdate(t){}_$AE(t){var e;(e=this._$E_)==null||e.forEach(r=>{var s;return(s=r.hostUpdated)==null?void 0:s.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EO(e,this[e]))),this._$ET()}updated(t){}firstUpdated(t){}},Pr;K.elementStyles=[],K.shadowRootOptions={mode:"open"},K[ke("elementProperties")]=new Map,K[ke("finalized")]=new Map,Ot==null||Ot({ReactiveElement:K}),((Pr=O.reactiveElementVersions)!=null?Pr:O.reactiveElementVersions=[]).push("2.0.2");var be=globalThis,Ze=be.trustedTypes,Vr=Ze?Ze.createPolicy("lit-html",{createHTML:i=>i}):void 0,Ft="$lit$",W=`lit$${(Math.random()+"").slice(9)}$`,Bt="?"+W,Ns=`<${Bt}>`,ne=be.document===void 0?{createTreeWalker:()=>({})}:document,Me=()=>ne.createComment(""),Pe=i=>i===null||typeof i!="object"&&typeof i!="function",Fr=Array.isArray,Br=i=>Fr(i)||typeof(i==null?void 0:i[Symbol.iterator])=="function",Ut=`[
|
|
2
2
|
\f\r]`,Le=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hr=/-->/g,Nr=/>/g,ie=RegExp(`>|${Ut}(?:([^\\s"'>=/]+)(${Ut}*=${Ut}*(?:[^
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dr=/'/g,Or=/"/g,Xr=/^(?:script|style|textarea|title)$/i,zr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),p=zr(1),Xt=zr(2),M=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),Ur=new WeakMap,oe=ne.createTreeWalker(ne,129);function jr(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Vr!==void 0?Vr.createHTML(t):t}var Yr=(i,t)=>{let e=i.length-1,r=[],s,n=t===2?"<svg>":"",o=Le;for(let a=0;a<e;a++){let c=i[a],u,h,m=-1,y=0;for(;y<c.length&&(o.lastIndex=y,h=o.exec(c),h!==null);)y=o.lastIndex,o===Le?h[1]==="!--"?o=Hr:h[1]!==void 0?o=Nr:h[2]!==void 0?(Xr.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=ie):h[3]!==void 0&&(o=ie):o===ie?h[0]===">"?(o=s!=null?s:Le,m=-1):h[1]===void 0?m=-2:(m=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?ie:h[3]==='"'?Or:Dr):o===Or||o===Dr?o=ie:o===Hr||o===Nr?o=Le:(o=ie,s=void 0);let g=o===ie&&i[a+1].startsWith("/>")?" ":"";n+=o===Le?c+Ns:m>=0?(r.push(u),c.slice(0,m)+Ft+c.slice(m)+W+g):c+W+(m===-2?a:g)}return[jr(i,n+(i[e]||"<?>")+(t===2?"</svg>":"")),r]},Ve=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let n=0,o=0,a=t.length-1,c=this.parts,[u,h]=Yr(t,e);if(this.el=i.createElement(u,r),oe.currentNode=this.el.content,e===2){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(s=oe.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let m of s.getAttributeNames())if(m.endsWith(Ft)){let y=h[o++],g=s.getAttribute(m).split(W),q=/([.?@])?(.*)/.exec(y);c.push({type:1,index:n,name:q[2],strings:g,ctor:q[1]==="."?et:q[1]==="?"?tt:q[1]==="@"?rt:le}),s.removeAttribute(m)}else m.startsWith(W)&&(c.push({type:6,index:n}),s.removeAttribute(m));if(Xr.test(s.tagName)){let m=s.textContent.split(W),y=m.length-1;if(y>0){s.textContent=Ze?Ze.emptyScript:"";for(let g=0;g<y;g++)s.append(m[g],Me()),oe.nextNode(),c.push({type:2,index:++n});s.append(m[y],Me())}}}else if(s.nodeType===8)if(s.data===Bt)c.push({type:2,index:n});else{let m=-1;for(;(m=s.data.indexOf(W,m+1))!==-1;)c.push({type:7,index:n}),m+=W.length-1}n++}}static createElement(t,e){let r=ne.createElement("template");return r.innerHTML=t,r}};function ae(i,t,e=i,r){var o,a,c;if(t===M)return t;let s=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl,n=Pe(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),n===void 0?s=void 0:(s=new n(i),s._$AT(i,e,r)),r!==void 0?((c=e._$Co)!=null?c:e._$Co=[])[r]=s:e._$Cl=s),s!==void 0&&(t=ae(i,s._$AS(i,t.values),s,r)),t}var Qe=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var u;let{el:{content:e},parts:r}=this._$AD,s=((u=t==null?void 0:t.creationScope)!=null?u:ne).importNode(e,!0);oe.currentNode=s;let n=oe.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new ge(n,n.nextSibling,this,t):c.type===1?h=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(h=new st(n,this,t)),this._$AV.push(h),c=r[++a]}o!==(c==null?void 0:c.index)&&(n=oe.nextNode(),o++)}return oe.currentNode=ne,s}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},ge=class i{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,r,s){var n;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=(n=s==null?void 0:s.isConnected)!=null?n:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ae(this,t,e),Pe(t)?t===E||t==null||t===""?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==M&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Br(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==E&&Pe(this._$AH)?this._$AA.nextSibling.data=t:this.$(ne.createTextNode(t)),this._$AH=t}g(t){var n;let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ve.createElement(jr(r.h,r.h[0]),this.options)),r);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{let o=new Qe(s,this),a=o.u(this.options);o.p(e),this.$(a),this._$AH=o}}_$AC(t){let e=Ur.get(t.strings);return e===void 0&&Ur.set(t.strings,e=new Ve(t)),e}T(t){Fr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,s=0;for(let n of t)s===e.length?e.push(r=new i(this.k(Me()),this.k(Me()),this,this.options)):r=e[s],r._$AI(n),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,n){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=E}_$AI(t,e=this,r,s){let n=this.strings,o=!1;if(n===void 0)t=ae(this,t,e,0),o=!Pe(t)||t!==this._$AH&&t!==M,o&&(this._$AH=t);else{let a=t,c,u;for(t=n[0],c=0;c<n.length-1;c++)u=ae(this,a[r+c],e,c),u===M&&(u=this._$AH[c]),o||(o=!Pe(u)||u!==this._$AH[c]),u===E?t=E:t!==E&&(t+=(u!=null?u:"")+n[c+1]),this._$AH[c]=u}o&&!s&&this.O(t)}O(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},et=class extends le{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===E?void 0:t}},tt=class extends le{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==E)}},rt=class extends le{constructor(t,e,r,s,n){super(t,e,r,s,n),this.type=5}_$AI(t,e=this){var o;if((t=(o=ae(this,t,e,0))!=null?o:E)===M)return;let r=this._$AH,s=t===E&&r!==E||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==E&&(r===E||s);s&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;typeof this._$AH=="function"?this._$AH.call((r=(e=this.options)==null?void 0:e.host)!=null?r:this.element,t):this._$AH.handleEvent(t)}},st=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){ae(this,t)}},Kr={j:Ft,P:W,A:Bt,C:1,M:Yr,L:Qe,R:Br,V:ae,D:ge,I:le,H:tt,N:rt,U:et,B:st},It=be.litHtmlPolyfillSupport,Ir;It==null||It(Ve,ge),((Ir=be.litHtmlVersions)!=null?Ir:be.litHtmlVersions=[]).push("3.1.0");var Wr=(i,t,e)=>{var n,o;let r=(n=e==null?void 0:e.renderBefore)!=null?n:t,s=r._$litPart$;if(s===void 0){let a=(o=e==null?void 0:e.renderBefore)!=null?o:null;r._$litPart$=s=new ge(t.insertBefore(Me(),a),a,void 0,e!=null?e:{})}return s._$AI(i),s};var f=class extends K{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let t=super.createRenderRoot();return(r=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Wr(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return M}},Jr;f._$litElement$=!0,f.finalized=!0,(Jr=globalThis.litElementHydrateSupport)==null||Jr.call(globalThis,{LitElement:f});var zt=globalThis.litElementPolyfillSupport;zt==null||zt({LitElement:f});var Gr;((Gr=globalThis.litElementVersions)!=null?Gr:globalThis.litElementVersions=[]).push("4.0.2");var _=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Ds={attribute:!0,type:String,converter:Te,reflect:!1,hasChanged:Ge},Os=(i=Ds,t,e)=>{let{kind:r,metadata:s}=e,n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(e.name,i),r==="accessor"){let{name:o}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,i)},init(a){return a!==void 0&&this.C(o,void 0,i),a}}}if(r==="setter"){let{name:o}=e;return function(a){let c=this[o];t.call(this,a),this.requestUpdate(o,c,i)}}throw Error("Unsupported decorator location: "+r)};function d(i){return(t,e)=>typeof e=="object"?Os(i,t,e):((r,s,n)=>{let o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?R(x({},r),{wrapped:!0}):r),o?Object.getOwnPropertyDescriptor(s,n):void 0})(i,t,e)}function C(i){return d(R(x({},i),{state:!0,attribute:!1}))}var ee=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function He(i,t){return(e,r,s)=>{let n=o=>{var a,c;return(c=(a=o.renderRoot)==null?void 0:a.querySelector(i))!=null?c:null};if(t){let{get:o,set:a}=typeof r=="object"?e:s!=null?s:(()=>{let c=Symbol();return{get(){return this[c]},set(u){this[c]=u}}})();return ee(e,r,{get(){let c=o.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return ee(e,r,{get(){return n(this)}})}}function Zr(i){return(t,e)=>{let{slot:r,selector:s}=i!=null?i:{},n="slot"+(r?`[name=${r}]`:":not([name])");return ee(t,e,{get(){var c,u;let o=(c=this.renderRoot)==null?void 0:c.querySelector(n),a=(u=o==null?void 0:o.assignedElements(i))!=null?u:[];return s===void 0?a:a.filter(h=>h.matches(s))}})}}function $(i,t){let e=x({waitUntilFirstUpdate:!1},t);return(r,s)=>{let{update:n}=r,o=Array.isArray(i)?i:[i];r.update=function(a){o.forEach(c=>{let u=c;if(a.has(u)){let h=a.get(u),m=this[u];h!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[s](h,m)}}),n.call(this,a)}}}var Qr=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],I="item";var P=class extends f{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent="false";this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(s=>s.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(s=>s.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:Qr};this._state="item-created";this._initialContext=R(x({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];console.info("constructor qti-assessment-item"),this.state="item-created",this.addEventListener("qti-register-variable",({detail:e})=>{this._context=R(x({},this._context),{variables:[...this._context.variables,e.variable]}),this._initialContext=this._context}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let r=e.detail;this._feedbackElements.push(r),r.checkShowFeedback(r.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:r,countAttempt:s}=e.detail;this.updateResponseVariable(r,"true"),this.processResponse(s)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:s}=e.detail;this.updateOutcomeVariable(r,s)}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}set state(e){this._state=e}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type}))}set variables(e){if(!Array.isArray(e)||e.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=R(x({},this._context),{variables:this._context.variables.map(r=>{let s=e.find(n=>n.identifier===r.identifier);return s?x(x({},r),s):r})}),this._context.variables.forEach(r=>{if(r.type==="response"){let s=this._interactionElements.find(n=>n.responseIdentifier===r.identifier);s&&(s.response=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(s=>s.checkShowFeedback(r.identifier))})}firstUpdated(e){this.state="first-updated",this._emit("qti-assessment-item-first-updated",this)}connectedCallback(){super.connectedCallback(),this.state="item-connected"}set responses(e){if(e)for(let r of e){this.getResponse(r.responseIdentifier)&&this.updateResponseVariable(r.responseIdentifier,r.response);let n=this._interactionElements.find(o=>o.getAttribute("response-identifier")===r.responseIdentifier);n&&(n.response=r.response)}}render(){return p`<slot></slot>`}showCorrectResponse(e){let s=this._context.variables.filter(n=>"correctResponse"in n&&n.correctResponse).map(n=>({responseIdentifier:n.identifier,response:n.correctResponse}));for(let n of s){let o=this._interactionElements.find(a=>a.getAttribute("response-identifier")===n.responseIdentifier);o&&(o.correctResponse=e?n.response:"")}}processResponse(e=!0){var s;let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((s=this._context.variables.find(n=>n.identifier==="numAttempts"))==null?void 0:s.value)+1).toString()),this._emit("qti-response-processed"),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(r=>r.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:r,response:s}=e.detail;this.updateResponseVariable(r,s)}updateResponseVariable(e,r){this._context=R(x({},this._context),{variables:this._context.variables.map(s=>s.identifier!==e?s:R(x({},s),{value:r}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,r){var n;let s=this.getOutcome(e);if(!s){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=R(x({},this._context),{variables:this._context.variables.map(o=>o.identifier!==e?o:R(x({},o),{value:s.cardinality==="single"?r:[...o.value,r]}))}),this._feedbackElements.forEach(o=>o.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:(n=this._context.variables.find(o=>o.identifier===e))==null?void 0:n.value})}_getCompletionStatus(){return this._interactionElements.every(e=>e.validate())?"completed":this._interactionElements.some(e=>e.validate())?"incomplete":"not_attempted"}_emit(e,r=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:r}))}};l([d({type:String})],P.prototype,"title",2),l([d({type:String})],P.prototype,"identifier",2),l([d({type:String})],P.prototype,"adaptive",2),l([d({type:String})],P.prototype,"timeDependent",2),l([d({type:Boolean})],P.prototype,"disabled",2),l([$("disabled",{waitUntilFirstUpdate:!0})],P.prototype,"_handleDisabledChange",2),l([d({type:Boolean})],P.prototype,"readonly",2),l([$("readonly",{waitUntilFirstUpdate:!0})],P.prototype,"_handleReadonlyChange",2),l([Ht({context:I})],P.prototype,"_context",2),P=l([_("qti-assessment-item")],P);var Us={SPACE:32},T=class extends f{constructor(){super(...arguments);this.tabindex=0;this.disabled=!1;this.readonly=!1;this.checked=!1}handleDisabledChange(e,r){r?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-register-choice",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-loose-choice",{bubbles:!0,cancelable:!1,composed:!0}))}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case Us.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("qti-choice-element-selected",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier,checked:this.checked}})))}validateAllProps(){return!!this.getAttribute("identifier")}render(){return this.validateAllProps()||console.warn(`Invalid props for ${this.outerHTML}`,"missing identifier"),p` <slot></slot> `}};l([d({type:String})],T.prototype,"identifier",2),l([d({type:Number,reflect:!0})],T.prototype,"tabindex",2),l([d({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:e=>e}})],T.prototype,"disabled",2),l([d({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:e=>e}})],T.prototype,"readonly",2),l([d({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>e}})],T.prototype,"checked",2),l([$("disabled",{waitUntilFirstUpdate:!0})],T.prototype,"handleDisabledChange",1);var es=b`
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Dr=/'/g,Or=/"/g,Xr=/^(?:script|style|textarea|title)$/i,zr=i=>(t,...e)=>({_$litType$:i,strings:t,values:e}),p=zr(1),Xt=zr(2),M=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),Ur=new WeakMap,oe=ne.createTreeWalker(ne,129);function jr(i,t){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Vr!==void 0?Vr.createHTML(t):t}var Yr=(i,t)=>{let e=i.length-1,r=[],s,n=t===2?"<svg>":"",o=Le;for(let a=0;a<e;a++){let c=i[a],u,h,m=-1,y=0;for(;y<c.length&&(o.lastIndex=y,h=o.exec(c),h!==null);)y=o.lastIndex,o===Le?h[1]==="!--"?o=Hr:h[1]!==void 0?o=Nr:h[2]!==void 0?(Xr.test(h[2])&&(s=RegExp("</"+h[2],"g")),o=ie):h[3]!==void 0&&(o=ie):o===ie?h[0]===">"?(o=s!=null?s:Le,m=-1):h[1]===void 0?m=-2:(m=o.lastIndex-h[2].length,u=h[1],o=h[3]===void 0?ie:h[3]==='"'?Or:Dr):o===Or||o===Dr?o=ie:o===Hr||o===Nr?o=Le:(o=ie,s=void 0);let g=o===ie&&i[a+1].startsWith("/>")?" ":"";n+=o===Le?c+Ns:m>=0?(r.push(u),c.slice(0,m)+Ft+c.slice(m)+W+g):c+W+(m===-2?a:g)}return[jr(i,n+(i[e]||"<?>")+(t===2?"</svg>":"")),r]},Ve=class i{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let n=0,o=0,a=t.length-1,c=this.parts,[u,h]=Yr(t,e);if(this.el=i.createElement(u,r),oe.currentNode=this.el.content,e===2){let m=this.el.content.firstChild;m.replaceWith(...m.childNodes)}for(;(s=oe.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let m of s.getAttributeNames())if(m.endsWith(Ft)){let y=h[o++],g=s.getAttribute(m).split(W),q=/([.?@])?(.*)/.exec(y);c.push({type:1,index:n,name:q[2],strings:g,ctor:q[1]==="."?et:q[1]==="?"?tt:q[1]==="@"?rt:le}),s.removeAttribute(m)}else m.startsWith(W)&&(c.push({type:6,index:n}),s.removeAttribute(m));if(Xr.test(s.tagName)){let m=s.textContent.split(W),y=m.length-1;if(y>0){s.textContent=Ze?Ze.emptyScript:"";for(let g=0;g<y;g++)s.append(m[g],Me()),oe.nextNode(),c.push({type:2,index:++n});s.append(m[y],Me())}}}else if(s.nodeType===8)if(s.data===Bt)c.push({type:2,index:n});else{let m=-1;for(;(m=s.data.indexOf(W,m+1))!==-1;)c.push({type:7,index:n}),m+=W.length-1}n++}}static createElement(t,e){let r=ne.createElement("template");return r.innerHTML=t,r}};function ae(i,t,e=i,r){var o,a,c;if(t===M)return t;let s=r!==void 0?(o=e._$Co)==null?void 0:o[r]:e._$Cl,n=Pe(t)?void 0:t._$litDirective$;return(s==null?void 0:s.constructor)!==n&&((a=s==null?void 0:s._$AO)==null||a.call(s,!1),n===void 0?s=void 0:(s=new n(i),s._$AT(i,e,r)),r!==void 0?((c=e._$Co)!=null?c:e._$Co=[])[r]=s:e._$Cl=s),s!==void 0&&(t=ae(i,s._$AS(i,t.values),s,r)),t}var Qe=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var u;let{el:{content:e},parts:r}=this._$AD,s=((u=t==null?void 0:t.creationScope)!=null?u:ne).importNode(e,!0);oe.currentNode=s;let n=oe.nextNode(),o=0,a=0,c=r[0];for(;c!==void 0;){if(o===c.index){let h;c.type===2?h=new ge(n,n.nextSibling,this,t):c.type===1?h=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(h=new st(n,this,t)),this._$AV.push(h),c=r[++a]}o!==(c==null?void 0:c.index)&&(n=oe.nextNode(),o++)}return oe.currentNode=ne,s}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},ge=class i{get _$AU(){var t,e;return(e=(t=this._$AM)==null?void 0:t._$AU)!=null?e:this._$Cv}constructor(t,e,r,s){var n;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=(n=s==null?void 0:s.isConnected)!=null?n:!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=ae(this,t,e),Pe(t)?t===E||t==null||t===""?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==M&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Br(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==E&&Pe(this._$AH)?this._$AA.nextSibling.data=t:this.$(ne.createTextNode(t)),this._$AH=t}g(t){var n;let{values:e,_$litType$:r}=t,s=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=Ve.createElement(jr(r.h,r.h[0]),this.options)),r);if(((n=this._$AH)==null?void 0:n._$AD)===s)this._$AH.p(e);else{let o=new Qe(s,this),a=o.u(this.options);o.p(e),this.$(a),this._$AH=o}}_$AC(t){let e=Ur.get(t.strings);return e===void 0&&Ur.set(t.strings,e=new Ve(t)),e}T(t){Fr(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,s=0;for(let n of t)s===e.length?e.push(r=new i(this.k(Me()),this.k(Me()),this,this.options)):r=e[s],r._$AI(n),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var r;for((r=this._$AP)==null?void 0:r.call(this,!1,!0,e);t&&t!==this._$AB;){let s=t.nextSibling;t.remove(),t=s}}setConnected(t){var e;this._$AM===void 0&&(this._$Cv=t,(e=this._$AP)==null||e.call(this,t))}},le=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,n){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=E}_$AI(t,e=this,r,s){let n=this.strings,o=!1;if(n===void 0)t=ae(this,t,e,0),o=!Pe(t)||t!==this._$AH&&t!==M,o&&(this._$AH=t);else{let a=t,c,u;for(t=n[0],c=0;c<n.length-1;c++)u=ae(this,a[r+c],e,c),u===M&&(u=this._$AH[c]),o||(o=!Pe(u)||u!==this._$AH[c]),u===E?t=E:t!==E&&(t+=(u!=null?u:"")+n[c+1]),this._$AH[c]=u}o&&!s&&this.O(t)}O(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t!=null?t:"")}},et=class extends le{constructor(){super(...arguments),this.type=3}O(t){this.element[this.name]=t===E?void 0:t}},tt=class extends le{constructor(){super(...arguments),this.type=4}O(t){this.element.toggleAttribute(this.name,!!t&&t!==E)}},rt=class extends le{constructor(t,e,r,s,n){super(t,e,r,s,n),this.type=5}_$AI(t,e=this){var o;if((t=(o=ae(this,t,e,0))!=null?o:E)===M)return;let r=this._$AH,s=t===E&&r!==E||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==E&&(r===E||s);s&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,r;typeof this._$AH=="function"?this._$AH.call((r=(e=this.options)==null?void 0:e.host)!=null?r:this.element,t):this._$AH.handleEvent(t)}},st=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){ae(this,t)}},Kr={j:Ft,P:W,A:Bt,C:1,M:Yr,L:Qe,R:Br,V:ae,D:ge,I:le,H:tt,N:rt,U:et,B:st},It=be.litHtmlPolyfillSupport,Ir;It==null||It(Ve,ge),((Ir=be.litHtmlVersions)!=null?Ir:be.litHtmlVersions=[]).push("3.1.0");var Wr=(i,t,e)=>{var n,o;let r=(n=e==null?void 0:e.renderBefore)!=null?n:t,s=r._$litPart$;if(s===void 0){let a=(o=e==null?void 0:e.renderBefore)!=null?o:null;r._$litPart$=s=new ge(t.insertBefore(Me(),a),a,void 0,e!=null?e:{})}return s._$AI(i),s};var f=class extends K{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let t=super.createRenderRoot();return(r=(e=this.renderOptions).renderBefore)!=null||(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Wr(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)==null||t.setConnected(!1)}render(){return M}},Jr;f._$litElement$=!0,f.finalized=!0,(Jr=globalThis.litElementHydrateSupport)==null||Jr.call(globalThis,{LitElement:f});var zt=globalThis.litElementPolyfillSupport;zt==null||zt({LitElement:f});var Gr;((Gr=globalThis.litElementVersions)!=null?Gr:globalThis.litElementVersions=[]).push("4.0.2");var _=i=>(t,e)=>{e!==void 0?e.addInitializer(()=>{customElements.define(i,t)}):customElements.define(i,t)};var Ds={attribute:!0,type:String,converter:Te,reflect:!1,hasChanged:Ge},Os=(i=Ds,t,e)=>{let{kind:r,metadata:s}=e,n=globalThis.litPropertyMetadata.get(s);if(n===void 0&&globalThis.litPropertyMetadata.set(s,n=new Map),n.set(e.name,i),r==="accessor"){let{name:o}=e;return{set(a){let c=t.get.call(this);t.set.call(this,a),this.requestUpdate(o,c,i)},init(a){return a!==void 0&&this.C(o,void 0,i),a}}}if(r==="setter"){let{name:o}=e;return function(a){let c=this[o];t.call(this,a),this.requestUpdate(o,c,i)}}throw Error("Unsupported decorator location: "+r)};function d(i){return(t,e)=>typeof e=="object"?Os(i,t,e):((r,s,n)=>{let o=s.hasOwnProperty(n);return s.constructor.createProperty(n,o?R(x({},r),{wrapped:!0}):r),o?Object.getOwnPropertyDescriptor(s,n):void 0})(i,t,e)}function C(i){return d(R(x({},i),{state:!0,attribute:!1}))}var ee=(i,t,e)=>(e.configurable=!0,e.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(i,t,e),e);function He(i,t){return(e,r,s)=>{let n=o=>{var a,c;return(c=(a=o.renderRoot)==null?void 0:a.querySelector(i))!=null?c:null};if(t){let{get:o,set:a}=typeof r=="object"?e:s!=null?s:(()=>{let c=Symbol();return{get(){return this[c]},set(u){this[c]=u}}})();return ee(e,r,{get(){let c=o.call(this);return c===void 0&&(c=n(this),(c!==null||this.hasUpdated)&&a.call(this,c)),c}})}return ee(e,r,{get(){return n(this)}})}}function Zr(i){return(t,e)=>{let{slot:r,selector:s}=i!=null?i:{},n="slot"+(r?`[name=${r}]`:":not([name])");return ee(t,e,{get(){var c,u;let o=(c=this.renderRoot)==null?void 0:c.querySelector(n),a=(u=o==null?void 0:o.assignedElements(i))!=null?u:[];return s===void 0?a:a.filter(h=>h.matches(s))}})}}function $(i,t){let e=x({waitUntilFirstUpdate:!1},t);return(r,s)=>{let{update:n}=r,o=Array.isArray(i)?i:[i];r.update=function(a){o.forEach(c=>{let u=c;if(a.has(u)){let h=a.get(u),m=this[u];h!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[s](h,m)}}),n.call(this,a)}}}var Qr=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],I="item";var P=class extends f{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent="false";this._handleDisabledChange=(e,r)=>{this._interactionElements.forEach(s=>s.disabled=r)};this._handleReadonlyChange=(e,r)=>this._interactionElements.forEach(s=>s.readonly=r);this._context={identifier:this.getAttribute("identifier"),variables:Qr};this._state="item-created";this._initialContext=R(x({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.state="item-created",this.addEventListener("qti-register-variable",({detail:e})=>{this._context=R(x({},this._context),{variables:[...this._context.variables,e.variable]}),this._initialContext=this._context}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let r=e.detail;this._feedbackElements.push(r),r.checkShowFeedback(r.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:r,countAttempt:s}=e.detail;this.updateResponseVariable(r,"true"),this.processResponse(s)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:r,value:s}=e.detail;this.updateOutcomeVariable(r,s)}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}set state(e){this._state=e}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type}))}set variables(e){if(!Array.isArray(e)||e.some(r=>!("identifier"in r))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=R(x({},this._context),{variables:this._context.variables.map(r=>{let s=e.find(n=>n.identifier===r.identifier);return s?x(x({},r),s):r})}),this._context.variables.forEach(r=>{if(r.type==="response"){let s=this._interactionElements.find(n=>n.responseIdentifier===r.identifier);s&&(s.response=r.value)}r.type==="outcome"&&this._feedbackElements.forEach(s=>s.checkShowFeedback(r.identifier))})}firstUpdated(e){this.state="first-updated",this._emit("qti-assessment-item-first-updated",this)}connectedCallback(){super.connectedCallback(),this.state="item-connected"}set responses(e){if(e)for(let r of e){this.getResponse(r.responseIdentifier)&&this.updateResponseVariable(r.responseIdentifier,r.response);let n=this._interactionElements.find(o=>o.getAttribute("response-identifier")===r.responseIdentifier);n&&(n.response=r.response)}}render(){return p`<slot></slot>`}showCorrectResponse(e){let s=this._context.variables.filter(n=>"correctResponse"in n&&n.correctResponse).map(n=>({responseIdentifier:n.identifier,response:n.correctResponse}));for(let n of s){let o=this._interactionElements.find(a=>a.getAttribute("response-identifier")===n.responseIdentifier);o&&(o.correctResponse=e?n.response:"")}}processResponse(e=!0){var s;let r=this.querySelector("qti-response-processing");return!r||!r.process?!1:(r.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((s=this._context.variables.find(n=>n.identifier==="numAttempts"))==null?void 0:s.value)+1).toString()),this._emit("qti-response-processed"),!0)}resetResponses(){this._context=this._initialContext}getResponse(e){return this.getVariable(e)}getOutcome(e){return this.getVariable(e)}getVariable(e){return this._context.variables.find(r=>r.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:r,response:s}=e.detail;this.updateResponseVariable(r,s)}updateResponseVariable(e,r){this._context=R(x({},this._context),{variables:this._context.variables.map(s=>s.identifier!==e?s:R(x({},s),{value:r}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:r}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,r){var n;let s=this.getOutcome(e);if(!s){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=R(x({},this._context),{variables:this._context.variables.map(o=>o.identifier!==e?o:R(x({},o),{value:s.cardinality==="single"?r:[...o.value,r]}))}),this._feedbackElements.forEach(o=>o.checkShowFeedback(e)),this._emit("qti-outcome-changed",{item:this.identifier,outcomeIdentifier:e,value:(n=this._context.variables.find(o=>o.identifier===e))==null?void 0:n.value})}_getCompletionStatus(){return this._interactionElements.every(e=>e.validate())?"completed":this._interactionElements.some(e=>e.validate())?"incomplete":"not_attempted"}_emit(e,r=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:r}))}};l([d({type:String})],P.prototype,"title",2),l([d({type:String})],P.prototype,"identifier",2),l([d({type:String})],P.prototype,"adaptive",2),l([d({type:String})],P.prototype,"timeDependent",2),l([d({type:Boolean})],P.prototype,"disabled",2),l([$("disabled",{waitUntilFirstUpdate:!0})],P.prototype,"_handleDisabledChange",2),l([d({type:Boolean})],P.prototype,"readonly",2),l([$("readonly",{waitUntilFirstUpdate:!0})],P.prototype,"_handleReadonlyChange",2),l([Ht({context:I})],P.prototype,"_context",2),P=l([_("qti-assessment-item")],P);var Us={SPACE:32},T=class extends f{constructor(){super(...arguments);this.tabindex=0;this.disabled=!1;this.readonly=!1;this.checked=!1}handleDisabledChange(e,r){r?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-register-choice",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-loose-choice",{bubbles:!0,cancelable:!1,composed:!0}))}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case Us.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("qti-choice-element-selected",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier,checked:this.checked}})))}validateAllProps(){return!!this.getAttribute("identifier")}render(){return this.validateAllProps()||console.warn(`Invalid props for ${this.outerHTML}`,"missing identifier"),p` <slot></slot> `}};l([d({type:String})],T.prototype,"identifier",2),l([d({type:Number,reflect:!0})],T.prototype,"tabindex",2),l([d({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:e=>e}})],T.prototype,"disabled",2),l([d({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:e=>e}})],T.prototype,"readonly",2),l([d({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>e}})],T.prototype,"checked",2),l([$("disabled",{waitUntilFirstUpdate:!0})],T.prototype,"handleDisabledChange",1);var es=b`
|
|
4
4
|
:host {
|
|
5
5
|
display: block;
|
|
6
6
|
}
|
|
@@ -187,7 +187,7 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
187
187
|
flex-wrap: wrap;
|
|
188
188
|
gap: 0.5rem;
|
|
189
189
|
}
|
|
190
|
-
`,l([C()],Be.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",Be);var _t=class extends j(f,"qti-gap-text",!1,"qti-gap"){render(){return p` <slot part="drags" name="qti-gap-text"></slot>
|
|
190
|
+
`,l([C()],Be.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",Be);var Ce=class extends w{constructor(){super(...arguments);this.countAttempt="true"}validate(){return!0}set response(e){}render(){return p`<button ?disabled=${this.disabled} part="button" @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.dispatchEvent(new CustomEvent("end-attempt",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,countAttempt:this.countAttempt==="true"}}))}};l([d({type:String,attribute:"count-attempt"})],Ce.prototype,"countAttempt",2),l([d({type:String})],Ce.prototype,"title",2),Ce=l([_("qti-end-attempt-interaction")],Ce);var _t=class extends j(f,"qti-gap-text",!1,"qti-gap"){render(){return p` <slot part="drags" name="qti-gap-text"></slot>
|
|
191
191
|
<slot part="drops"></slot>`}};_t.styles=[b`
|
|
192
192
|
:host {
|
|
193
193
|
display: flex;
|
|
@@ -211,7 +211,7 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
211
211
|
align-items: flex-start;
|
|
212
212
|
flex: 1;
|
|
213
213
|
}
|
|
214
|
-
`];customElements.define("qti-gap-match-interaction",_t);function
|
|
214
|
+
`];customElements.define("qti-gap-match-interaction",_t);function Ae(i,t,e,r){switch(i){case"circle":{let[s,n,o]=t,a=s/e.width*100,c=n/e.height*100,u=o/e.width*100;r.style.left=a-u+"%",r.style.top=c-u+"%",r.style.width=r.style.height=4*u+"px",r.style.borderRadius="9999px"}break;case"rect":{let[s,n,o,a]=t,c=s/e.width*100,u=n/e.height*100,h=o/e.width*100,m=a/e.height*100;r.style.left=c+"%",r.style.top=u+"%",r.style.width=h-c+"%",r.style.height=m-u+"%"}break;case"poly":{let s=t.reduce((A,S,he,Ye)=>{if(he%2===1){let ys=A.pop();A[A.length]={x:ys,y:Ye[he]}}else A.push(S);return A},[]),n=Math.min(...s.map(A=>A.x)),o=Math.max(...s.map(A=>A.x)),a=Math.min(...s.map(A=>A.y)),c=Math.max(...s.map(A=>A.y)),u=n/e.width*100,h=a/e.height*100,m=o/e.width*100,y=c/e.height*100;r.style.left=n/e.width*100+"%",r.style.top=a/e.height*100+"%",r.style.width=m-u+"%",r.style.height=y-h+"%";let q=s.map(A=>({x:(A.x-n)/(o-n)*100,y:(A.y-a)/(c-a)*100})).map(A=>Math.round(A.x)+"% "+Math.round(A.y)+"%").join(",");r.style.clipPath=`polygon(${q})`}break;default:break}}var ms=(i,t,e)=>{let r=new Map;for(let s=t;s<=e;s++)r.set(i[s],s);return r},Ct=G(class extends U{constructor(i){if(super(i),i.type!==J.CHILD)throw Error("repeat() can only be used in text expressions")}ht(i,t,e){let r;e===void 0?e=t:t!==void 0&&(r=t);let s=[],n=[],o=0;for(let a of i)s[o]=r?r(a,o):o,n[o]=e(a,o),o++;return{values:n,keys:s}}render(i,t,e){return this.ht(i,t,e).values}update(i,[t,e,r]){var A;let s=is(i),{values:n,keys:o}=this.ht(t,e,r);if(!Array.isArray(s))return this.dt=o,n;let a=(A=this.dt)!=null?A:this.dt=[],c=[],u,h,m=0,y=s.length-1,g=0,q=n.length-1;for(;m<=y&&g<=q;)if(s[m]===null)m++;else if(s[y]===null)y--;else if(a[m]===o[g])c[g]=se(s[m],n[g]),m++,g++;else if(a[y]===o[q])c[q]=se(s[y],n[q]),y--,q--;else if(a[m]===o[q])c[q]=se(s[m],n[q]),ye(i,c[q+1],s[m]),m++,q--;else if(a[y]===o[g])c[g]=se(s[y],n[g]),ye(i,s[m],s[y]),y--,g++;else if(u===void 0&&(u=ms(o,g,q),h=ms(a,m,y)),u.has(a[m]))if(u.has(a[y])){let S=h.get(o[g]),he=S!==void 0?s[S]:null;if(he===null){let Ye=ye(i,s[m]);se(Ye,n[g]),c[g]=Ye}else c[g]=se(he,n[g]),ye(i,s[m],he),s[S]=null;g++}else pt(s[y]),y--;else pt(s[m]),m++;for(;g<=q;){let S=ye(i,c[q+1]);se(S,n[g]),c[g++]=S}for(;m<=y;){let S=s[m++];S!==null&&pt(S)}return this.dt=o,ss(i,c),M}});var Z=class extends w{constructor(){super();this.startPoint=null;this.endPoint=null;this._lines=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._lines=[]}validate(){return this._lines.length>0}set response(e){Array.isArray(e)&&(this._lines=e)}render(){var e,r,s,n;return p`<slot name="prompt"></slot>
|
|
215
215
|
<line-container>
|
|
216
216
|
<svg
|
|
217
217
|
width=${B((e=this.grImage[0])==null?void 0:e.width)}
|
|
@@ -241,7 +241,7 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
241
241
|
/>`}
|
|
242
242
|
</svg>
|
|
243
243
|
<slot></slot>
|
|
244
|
-
</line-container>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),a=n.split(",").map(c=>parseInt(c));
|
|
244
|
+
</line-container>`}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),a=n.split(",").map(c=>parseInt(c));Ae(o,a,r,s)}firstUpdated(e){super.firstUpdated(e),this.hotspots=document.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",r=>{this.mouseCoord={x:r.clientX-this.grImage[0].getBoundingClientRect().left,y:r.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(r=>{r.style.left=r.getAttribute("coords").split(",")[0]+"px",r.style.top=r.getAttribute("coords").split(",")[1]+"px",r.addEventListener("click",s=>{this.startPoint?this.endPoint||(this.endPoint=s.target,this._lines=[...this._lines,this.startPoint.getAttribute("identifier")+" "+this.endPoint.getAttribute("identifier")],this.saveResponse(this._lines),this.startPoint=null,this.endPoint=null):(this.startPoint=s.target,this.startCoord={x:this.startPoint.getAttribute("coords").split(",")[0],y:this.startPoint.getAttribute("coords").split(",")[1]})})})}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}};Z.styles=[b`
|
|
245
245
|
slot:not([name='prompt']) {
|
|
246
246
|
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
247
247
|
display: block;
|
|
@@ -279,7 +279,7 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
279
279
|
<!-- slot for the prompt -->
|
|
280
280
|
<slot></slot>
|
|
281
281
|
<!-- slot for the image and hotspots -->
|
|
282
|
-
`}setHotspotOrder(e){let{identifier:r}=e.detail,s=this._choiceElements.find(o=>o.getAttribute("identifier")===r),n=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,s.order==null){if(this._choiceElements.filter(o=>o.order>0).length>=n){this.choiceOrdering=!1;return}s.order=this._choiceElements.filter(o=>!!o.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(o=>(o.order>o.order&&o.order--,o)),s.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),a=n.split(",").map(c=>parseInt(c));
|
|
282
|
+
`}setHotspotOrder(e){let{identifier:r}=e.detail,s=this._choiceElements.find(o=>o.getAttribute("identifier")===r),n=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,s.order==null){if(this._choiceElements.filter(o=>o.order>0).length>=n){this.choiceOrdering=!1;return}s.order=this._choiceElements.filter(o=>!!o.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(o=>(o.order>o.order&&o.order--,o)),s.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let r=this.querySelector("img"),s=e.target,n=s.getAttribute("coords"),o=s.getAttribute("shape"),a=n.split(",").map(c=>parseInt(c));Ae(o,a,r,s)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this.setHotspotOrder),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this.setHotspotOrder),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};qt.styles=[b`
|
|
283
283
|
slot:not([name='prompt']) {
|
|
284
284
|
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
285
285
|
display: block;
|
|
@@ -295,7 +295,7 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
295
295
|
<!-- slot for the prompt -->
|
|
296
296
|
<slot></slot>
|
|
297
297
|
<!-- slot for the image and hotspots -->
|
|
298
|
-
`}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,s=r.getAttribute("coords"),n=r.getAttribute("shape"),o=s.split(",").map(a=>parseInt(a));
|
|
298
|
+
`}positionHotspotOnRegister(t){let e=this.querySelector("img"),r=t.target,s=r.getAttribute("coords"),n=r.getAttribute("shape"),o=s.split(",").map(a=>parseInt(a));Ae(n,o,e,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};wt.styles=[b`
|
|
299
299
|
slot:not([name='prompt']) {
|
|
300
300
|
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
301
301
|
display: block;
|
|
@@ -310,7 +310,7 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
310
310
|
`];customElements.define("qti-hotspot-interaction",wt);var gr=class extends f{connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return p`
|
|
311
311
|
<slot></slot>
|
|
312
312
|
<slot name="qti-simple-associable-choice"></slot>
|
|
313
|
-
`}};customElements.define("qti-simple-associable-choice",gr);var
|
|
313
|
+
`}};customElements.define("qti-simple-associable-choice",gr);var qe=class extends j(f,"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.response=[];this.responseIdentifier=""}connectedCallback(){super.connectedCallback(),this.rows=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.cols=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.response=[]}render(){return this.classList.contains("qti-match-tabular")?p`
|
|
314
314
|
<slot name="prompt"></slot>
|
|
315
315
|
<table>
|
|
316
316
|
<tr>
|
|
@@ -329,14 +329,14 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
329
329
|
</td>`})}
|
|
330
330
|
</tr>`)}
|
|
331
331
|
</table>
|
|
332
|
-
`:p`<slot name="prompt"></slot> <slot></slot>`}};
|
|
333
|
-
<slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this.value++,this.saveResponse(this.value.toString())})}};$t.styles=[b``];customElements.define("qti-media-interaction",$t);var
|
|
332
|
+
`:p`<slot name="prompt"></slot> <slot></slot>`}};qe.styles=[],l([C()],qe.prototype,"response",2),l([d({type:String,attribute:"response-identifier"})],qe.prototype,"responseIdentifier",2);customElements.define("qti-match-interaction",qe);var $t=class extends w{constructor(){super();this.value=0}reset(){}validate(){return!0}set response(e){}static get properties(){return R(x({},w.properties),{step:{type:Number,attribute:"step",default:10}})}render(){return p` <slot name="prompt"></slot>
|
|
333
|
+
<slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this.value++,this.saveResponse(this.value.toString())})}};$t.styles=[b``];customElements.define("qti-media-interaction",$t);var we=class extends j(f,"qti-simple-choice",!0,"drop-list"){render(){return p` <slot name="prompt"> </slot>
|
|
334
334
|
<div part="container">
|
|
335
335
|
<slot part="drags"> </slot>
|
|
336
336
|
<div part="drops">
|
|
337
337
|
${Array.from(this.querySelectorAll("qti-simple-choice")).map((e,r)=>p`<drop-list part="drop-list" identifier="droplist${r}"></drop-list>`)}
|
|
338
338
|
</div>
|
|
339
|
-
</div>`}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(e=>e.setAttribute("part","qti-simple-choice"))}};
|
|
339
|
+
</div>`}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(e=>e.setAttribute("part","qti-simple-choice"))}};we.layoutClass=["qti-choices-top","qti-choices-bottom","qti-choices-left","qti-choices-right"],we.styles=[b`
|
|
340
340
|
[part='drags'] {
|
|
341
341
|
display: flex;
|
|
342
342
|
align-items: flex-start;
|
|
@@ -384,7 +384,7 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
384
384
|
:host(.qti-choices-right) [part='container'] {
|
|
385
385
|
flex-direction: row-reverse;
|
|
386
386
|
}
|
|
387
|
-
`],l([d({type:String})],
|
|
387
|
+
`],l([d({type:String})],we.prototype,"orientation",2);customElements.define("qti-order-interaction",we);var St=class extends f{render(){return p`<slot></slot>`}};St.styles=[b`
|
|
388
388
|
:host {
|
|
389
389
|
display: block;
|
|
390
390
|
}
|
|
@@ -431,17 +431,17 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
431
431
|
${this.csLive.getPropertyValue("--show-value")=="true"?p`<div id="value" part="value">${this.value}</div>`:E}
|
|
432
432
|
</div>
|
|
433
433
|
</div>
|
|
434
|
-
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let r=a=>{let{x:c}=this.getPositionFromEvent(a),u=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(u),a.stopPropagation()},s=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",s),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",s);let{x:n}=this.getPositionFromEvent(e),o=n-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.stopPropagation()}_onMouseDown(e){let r=o=>{let a=o.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(a),o.preventDefault(),o.stopPropagation()},s=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",s);let n=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.preventDefault(),e.stopPropagation()}calculateValue(e){let r=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,s=this.min+Math.round((r-this.min)/this._step)*this._step;this.value=s}getPositionFromEvent(e){let r;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let s=typeof e.originalEvent=="undefined"?e:e.originalEvent,n=s.touches[0]||s.changedTouches[0];r={x:n.pageX,y:n.pageY}}else(e.type=="mousedown"||e.type=="mouseup"||e.type=="mousemove"||e.type=="mouseover"||e.type=="mouseout"||e.type=="mouseenter"||e.type=="mouseleave")&&(r={x:e.clientX,y:e.clientY});return r}};L.styles=[b``],l([He("#knob")],L.prototype,"_knob",2),l([He("#rail")],L.prototype,"_rail",2),l([d({type:Number})],L.prototype,"value",2),l([d({type:Boolean,attribute:"step-label"})],L.prototype,"stepLabel",2),l([d({type:Boolean})],L.prototype,"reverse",2),l([d({type:Number,attribute:"lower-bound"})],L.prototype,"min",1),l([d({type:Number,attribute:"upper-bound"})],L.prototype,"max",1),l([d({type:Number,attribute:"step"})],L.prototype,"step",1),l([$("disabled",{waitUntilFirstUpdate:!0})],L.prototype,"_handleDisabledChange",2),l([$("readonly",{waitUntilFirstUpdate:!0})],L.prototype,"_handleReadonlyChange",2);customElements.define("qti-slider-interaction",L);var
|
|
434
|
+
</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),u=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(u),a.stopPropagation()},s=()=>{document.removeEventListener("touchmove",r),document.removeEventListener("touchend",s),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",r),document.addEventListener("touchend",s);let{x:n}=this.getPositionFromEvent(e),o=n-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.stopPropagation()}_onMouseDown(e){let r=o=>{let a=o.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(a),o.preventDefault(),o.stopPropagation()},s=()=>{document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",s),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",r),document.addEventListener("mouseup",s);let n=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.preventDefault(),e.stopPropagation()}calculateValue(e){let r=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,s=this.min+Math.round((r-this.min)/this._step)*this._step;this.value=s}getPositionFromEvent(e){let r;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let s=typeof e.originalEvent=="undefined"?e:e.originalEvent,n=s.touches[0]||s.changedTouches[0];r={x:n.pageX,y:n.pageY}}else(e.type=="mousedown"||e.type=="mouseup"||e.type=="mousemove"||e.type=="mouseover"||e.type=="mouseout"||e.type=="mouseenter"||e.type=="mouseleave")&&(r={x:e.clientX,y:e.clientY});return r}};L.styles=[b``],l([He("#knob")],L.prototype,"_knob",2),l([He("#rail")],L.prototype,"_rail",2),l([d({type:Number})],L.prototype,"value",2),l([d({type:Boolean,attribute:"step-label"})],L.prototype,"stepLabel",2),l([d({type:Boolean})],L.prototype,"reverse",2),l([d({type:Number,attribute:"lower-bound"})],L.prototype,"min",1),l([d({type:Number,attribute:"upper-bound"})],L.prototype,"max",1),l([d({type:Number,attribute:"step"})],L.prototype,"step",1),l([$("disabled",{waitUntilFirstUpdate:!0})],L.prototype,"_handleDisabledChange",2),l([$("readonly",{waitUntilFirstUpdate:!0})],L.prototype,"_handleReadonlyChange",2);customElements.define("qti-slider-interaction",L);var Xe=class extends f{render(){return p`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(e){var s,n,o;let r=Array.from((n=(s=this.firstElementChild)==null?void 0:s.childNodes)!=null?n:[]).find(a=>a.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",(o=r.textContent)!=null?o:"")}catch(a){console.error("custom-operator contains invalid javascript code",a)}}calculate(){let e={variable:s=>{var n,o,a;return(a=(o=(n=this._context)==null?void 0:n.variables.find(c=>c.identifier===s))==null?void 0:o.value)!=null?a:""},correct:s=>{var n,o,a;return(a=(o=(n=this._context)==null?void 0:n.variables.find(c=>c.identifier===s))==null?void 0:o.correctResponse)!=null?a:""}},r={getVariable:s=>{var n;return(n=this._context)==null?void 0:n.variables.find(o=>o.identifier===s)},updateOutcomeVariable:(s,n)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:s,value:n}}))}};return this.operatorFunction(this._context,e,r)}};l([Y({context:I,subscribe:!0}),C()],Xe.prototype,"_context",2),Xe=l([_("qti-custom-operator")],Xe);var kt=class extends f{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return p` <slot name="qti-gap-img"></slot> `}};kt.styles=b`
|
|
435
435
|
:host {
|
|
436
436
|
position: absolute;
|
|
437
437
|
}
|
|
438
|
-
`;customElements.define("qti-associable-hotspot",kt);var Tt=class extends f{constructor(){super(...arguments);this.tabindex=0}render(){return p` <slot name="qti-gap-text"></slot>`}};l([d({type:Number,reflect:!0})],Tt.prototype,"tabindex",2);customElements.define("qti-gap",Tt);var Lt=class extends f{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","qti-gap-img")}};l([d({type:Number,reflect:!0})],Lt.prototype,"tabindex",2);customElements.define("qti-gap-img",Lt);var Mt=class extends f{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-gap-text")}render(){return p`<slot></slot>`}};l([d({type:Number,reflect:!0})],Mt.prototype,"tabindex",2);customElements.define("qti-gap-text",Mt);var
|
|
438
|
+
`;customElements.define("qti-associable-hotspot",kt);var Tt=class extends f{constructor(){super(...arguments);this.tabindex=0}render(){return p` <slot name="qti-gap-text"></slot>`}};l([d({type:Number,reflect:!0})],Tt.prototype,"tabindex",2);customElements.define("qti-gap",Tt);var Lt=class extends f{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","qti-gap-img")}};l([d({type:Number,reflect:!0})],Lt.prototype,"tabindex",2);customElements.define("qti-gap-img",Lt);var Mt=class extends f{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-gap-text")}render(){return p`<slot></slot>`}};l([d({type:Number,reflect:!0})],Mt.prototype,"tabindex",2);customElements.define("qti-gap-text",Mt);var ze=class extends T{};ze.styles=b`
|
|
439
439
|
:host {
|
|
440
440
|
position: absolute;
|
|
441
441
|
}
|
|
442
|
-
`,l([d({attribute:"aria-ordervalue",type:Number,reflect:!0})],
|
|
443
|
-
<slot></slot> `}};Pt=l([_("qti-hottext")],Pt);var vr=class extends f{};customElements.define("qti-inline-choice",vr);var
|
|
444
|
-
<slot part="slot"></slot> `}};
|
|
442
|
+
`,l([d({attribute:"aria-ordervalue",type:Number,reflect:!0})],ze.prototype,"order",2);customElements.define("qti-hotspot-choice",ze);var Pt=class extends T{render(){return p`<div part="ch"><div part="cha"></div></div>
|
|
443
|
+
<slot></slot> `}};Pt=l([_("qti-hottext")],Pt);var vr=class extends f{};customElements.define("qti-inline-choice",vr);var je=class extends T{render(){return p`<div part="ch"><div part="cha"></div></div>
|
|
444
|
+
<slot part="slot"></slot> `}};je.styles=b`
|
|
445
445
|
:host {
|
|
446
446
|
display: flex;
|
|
447
447
|
}
|
|
@@ -449,7 +449,7 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
449
449
|
width: 100%;
|
|
450
450
|
display: block;
|
|
451
451
|
}
|
|
452
|
-
`,
|
|
452
|
+
`,je=l([_("qti-simple-choice")],je);console.log("%cC\xBFTO%cLab%c: qti-components loaded","font-weight:bold; color:green",'font-family: "PT Sans", font-weight:bold; color:green; font-size: smaller;vertical-align: sub',"font-weight:unset");var Ym=()=>{let i,t={async load(e){return new Promise((r,s)=>{gs(e).then(n=>(i=n,r(t)))})},parse(e){return i=Gs(e),t},path:e=>(Zs(i,e),t),html(){return vs(i)},xml(){return new XMLSerializer().serializeToString(i)}};return t},Km=()=>{let i,t={async load(e){return new Promise((r,s)=>{gs(e).then(n=>(i=n,r(t)))})},items(){return Js(i)},html(){return vs(i)},xml(){return new XMLSerializer().serializeToString(i)}};return t},Ws=`
|
|
453
453
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
454
454
|
<xsl:output method="html" version="5.0" encoding="UTF-8" indent="yes" />
|
|
455
455
|
<xsl:template match="@*|node()">
|
|
@@ -484,7 +484,7 @@ var Er=Object.defineProperty,xs=Object.defineProperties,Es=Object.getOwnProperty
|
|
|
484
484
|
<xsl:apply-templates/>
|
|
485
485
|
</xsl:element>
|
|
486
486
|
</xsl:template>
|
|
487
|
-
</xsl:stylesheet>`;function Js(i){let t=[];return i.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),s=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:s,category:n})}),t}function gs(i){return new Promise((t,e)=>{let r=new XMLHttpRequest;r.open("GET",i,!0),r.responseType="document",r.onload=()=>r.status>=200&&r.status<300?t(r.responseXML):(e(r.statusText),null),r.onerror=function(){e(r.statusText)},r.send()})}function Gs(i){return new DOMParser().parseFromString(i,"text/xml")}function vs(i){let t=new XSLTProcessor,e=new DOMParser().parseFromString(Ws,"text/xml");t.importStylesheet(e);let r=t.transformToFragment(i,document);return new XMLSerializer().serializeToString(r)}function Zs(i,t){i.querySelectorAll("[src],[href]").forEach(e=>{var n;let r="";e.getAttribute("src")&&(r="src"),e.getAttribute("href")&&(r="href");let s=(n=e.getAttribute(r))==null?void 0:n.trim();if(!s.startsWith("data:")&&!s.startsWith("http")){let o=t+encodeURI(s);e.setAttribute(r,o)}})}export{w as Interaction,Fe as QtPrintedVariable,ft as QtiAnd,P as QtiAssessmentItem,kt as QtiAssociableHotspot,Be as QtiAssociateInteraction,bt as QtiBaseValue,T as QtiChoice,Ee as QtiChoiceInteraction,ot as QtiCompanionMaterialsInfo,N as QtiConditionExpression,er as QtiContains,nt as QtiContentBody,tr as QtiCorrect,
|
|
487
|
+
</xsl:stylesheet>`;function Js(i){let t=[];return i.querySelectorAll("qti-assessment-item-ref").forEach(e=>{let r=e.getAttribute("identifier"),s=e.getAttribute("href"),n=e.getAttribute("category");t.push({identifier:r,href:s,category:n})}),t}function gs(i){return new Promise((t,e)=>{let r=new XMLHttpRequest;r.open("GET",i,!0),r.responseType="document",r.onload=()=>r.status>=200&&r.status<300?t(r.responseXML):(e(r.statusText),null),r.onerror=function(){e(r.statusText)},r.send()})}function Gs(i){return new DOMParser().parseFromString(i,"text/xml")}function vs(i){let t=new XSLTProcessor,e=new DOMParser().parseFromString(Ws,"text/xml");t.importStylesheet(e);let r=t.transformToFragment(i,document);return new XMLSerializer().serializeToString(r)}function Zs(i,t){i.querySelectorAll("[src],[href]").forEach(e=>{var n;let r="";e.getAttribute("src")&&(r="src"),e.getAttribute("href")&&(r="href");let s=(n=e.getAttribute(r))==null?void 0:n.trim();if(!s.startsWith("data:")&&!s.startsWith("http")){let o=t+encodeURI(s);e.setAttribute(r,o)}})}export{w as Interaction,Fe as QtPrintedVariable,ft as QtiAnd,P as QtiAssessmentItem,kt as QtiAssociableHotspot,Be as QtiAssociateInteraction,bt as QtiBaseValue,T as QtiChoice,Ee as QtiChoiceInteraction,ot as QtiCompanionMaterialsInfo,N as QtiConditionExpression,er as QtiContains,nt as QtiContentBody,tr as QtiCorrect,Xe as QtiCustomOperator,Ce as QtiEndAttemptInteraction,vt as QtiEqual,gt as QtiEqualRounded,v as QtiExpression,X as QtiExtendedTextInteraction,at as QtiFeedbackBlock,lt as QtiFeedbackInline,Tt as QtiGap,Lt as QtiGapImg,_t as QtiGapMatchInteraction,Mt as QtiGapText,Z as QtiGraphicAssociateInteraction,At as QtiGraphicGapMatchInteraction,qt as QtiGraphicOrderInteraction,rr as QtiGt,sr as QtiGte,ze as QtiHotspotChoice,wt as QtiHotspotInteraction,Pt as QtiHottext,Jt as QtiHottextInteraction,vr as QtiInlineChoice,pe as QtiInlineChoiceInteraction,ir as QtiIsNull,mt as QtiLookupOutcomeValue,or as QtiLt,nr as QtiLte,yt as QtiMapResponse,_e as QtiMapping,ar as QtiMatch,qe as QtiMatchInteraction,$t as QtiMediaInteraction,lr as QtiMember,ct as QtiModalFeedback,cr as QtiMultiple,pr as QtiNot,dr as QtiOr,we as QtiOrderInteraction,ur as QtiOrdered,te as QtiOutcomeDeclaration,br as QtiPortableCustomInteraction,Rt as QtiPositionObjectStage,hr as QtiProduct,it as QtiPrompt,Gt as QtiResponseCondition,re as QtiResponseDeclaration,Ue as QtiResponseElse,Qt as QtiResponseElseIf,Ie as QtiResponseIf,de as QtiResponseProcessing,F as QtiRubricBlock,z as QtiRule,St as QtiSPositionObjectInteraction,ue as QtiSelectPointInteraction,Zt as QtiSetOutcomeValue,gr as QtiSimpleAssociableChoice,je as QtiSimpleChoice,L as QtiSliderInteraction,xt as QtiStringMatch,jt as QtiStylesheet,mr as QtiSum,H as QtiTextEntryInteraction,fr as QtiVariable,I as itemContext,Qr as itemContextVariables,Ys as qtiAndMixin,Ym as qtiTransformItem,Km as qtiTransformTest};
|
|
488
488
|
/*! Bundled license information:
|
|
489
489
|
|
|
490
490
|
@lit/context/lib/context-request-event.js:
|
|
@@ -723,6 +723,15 @@ declare class QtiAssociateInteraction extends QtiAssociateInteraction_base {
|
|
|
723
723
|
connectedCallback(): void;
|
|
724
724
|
}
|
|
725
725
|
|
|
726
|
+
declare class QtiEndAttemptInteraction extends Interaction {
|
|
727
|
+
countAttempt: string;
|
|
728
|
+
title: 'end attempt';
|
|
729
|
+
validate(): boolean;
|
|
730
|
+
set response(val: undefined);
|
|
731
|
+
render(): lit_html.TemplateResult<1>;
|
|
732
|
+
endAttempt(e: Event): void;
|
|
733
|
+
}
|
|
734
|
+
|
|
726
735
|
declare const QtiGapMatchInteraction_base: (new (...args: any[]) => IInteraction) & typeof LitElement;
|
|
727
736
|
declare class QtiGapMatchInteraction extends QtiGapMatchInteraction_base {
|
|
728
737
|
static styles: lit.CSSResult[];
|
|
@@ -918,13 +927,23 @@ declare class QtiSliderInteraction extends Interaction {
|
|
|
918
927
|
private getPositionFromEvent;
|
|
919
928
|
}
|
|
920
929
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
930
|
+
/**
|
|
931
|
+
* https://www.imsglobal.org/spec/qti/v3p0/impl#h.fi29q8dubjgw
|
|
932
|
+
* <qti-custom-operator class="js.org">
|
|
933
|
+
<qti-base-value base-type="string"><![CDATA[
|
|
934
|
+
console.log(context.variables);
|
|
935
|
+
return 'B'
|
|
936
|
+
document.querySelector('qti-end-attempt-interaction').disabled = true;
|
|
937
|
+
]]></qti-base-value>
|
|
938
|
+
</qti-custom-operator>
|
|
939
|
+
</qti-set-outcome-value>
|
|
940
|
+
*/
|
|
941
|
+
declare class QtiCustomOperator extends LitElement implements Calculate {
|
|
942
|
+
private operatorFunction;
|
|
943
|
+
private _context?;
|
|
926
944
|
render(): lit_html.TemplateResult<1>;
|
|
927
|
-
|
|
945
|
+
handleSlotChange(event: Event): void;
|
|
946
|
+
calculate(): any;
|
|
928
947
|
}
|
|
929
948
|
|
|
930
949
|
declare class QtiAssociableHotspot extends LitElement {
|
|
@@ -988,23 +1007,4 @@ declare global {
|
|
|
988
1007
|
}
|
|
989
1008
|
}
|
|
990
1009
|
|
|
991
|
-
/**
|
|
992
|
-
* https://www.imsglobal.org/spec/qti/v3p0/impl#h.fi29q8dubjgw
|
|
993
|
-
* <qti-custom-operator class="js.org">
|
|
994
|
-
<qti-base-value base-type="string"><![CDATA[
|
|
995
|
-
console.log(context.variables);
|
|
996
|
-
return 'B'
|
|
997
|
-
document.querySelector('qti-end-attempt-interaction').disabled = true;
|
|
998
|
-
]]></qti-base-value>
|
|
999
|
-
</qti-custom-operator>
|
|
1000
|
-
</qti-set-outcome-value>
|
|
1001
|
-
*/
|
|
1002
|
-
declare class QtiCustomOperator extends LitElement implements Calculate {
|
|
1003
|
-
private operatorFunction;
|
|
1004
|
-
private _context?;
|
|
1005
|
-
render(): lit_html.TemplateResult<1>;
|
|
1006
|
-
handleSlotChange(event: Event): void;
|
|
1007
|
-
calculate(): any;
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
1010
|
export { type BaseType, type Calculate, type Cardinality, Interaction, type InteractionChangedDetails, type ItemContext, type MockQtiExpression, type Multiple, type Ordered, type OutcomeChangedDetails, type OutcomeVariable, QtPrintedVariable, QtiAnd, QtiAssessmentItem, QtiAssociableHotspot, QtiAssociateInteraction, QtiBaseValue, QtiChoice, QtiChoiceInteraction, QtiCompanionMaterialsInfo, QtiConditionExpression, QtiContains, QtiContentBody, QtiCorrect, QtiCustomOperator, QtiEndAttemptInteraction, QtiEqual, QtiEqualRounded, QtiExpression, QtiExtendedTextInteraction, QtiFeedbackBlock, QtiFeedbackInline, QtiGap, QtiGapImg, QtiGapMatchInteraction, QtiGapText, QtiGraphicAssociateInteraction, QtiGraphicGapMatchInteraction, QtiGraphicOrderInteraction, QtiGt, QtiGte, QtiHotspotChoice, QtiHotspotInteraction, QtiHottext, QtiHottextInteraction, QtiInlineChoice, QtiInlineChoiceInteraction, type QtiInteractionChanged, QtiIsNull, QtiLookupOutcomeValue, QtiLt, QtiLte, QtiMapResponse, QtiMapping, QtiMatch, QtiMatchInteraction, QtiMediaInteraction, QtiMember, QtiModalFeedback, QtiMultiple, QtiNot, QtiOr, QtiOrderInteraction, QtiOrdered, type QtiOutcomeChanged, QtiOutcomeDeclaration, QtiPortableCustomInteraction, QtiPositionObjectStage, QtiProduct, QtiPrompt, QtiResponseCondition, QtiResponseDeclaration, QtiResponseElse, QtiResponseElseIf, QtiResponseIf, QtiResponseProcessing, QtiRubricBlock, QtiRule, QtiSPositionObjectInteraction, QtiSelectPointInteraction, QtiSetOutcomeValue, QtiSimpleAssociableChoice, QtiSimpleChoice, QtiSliderInteraction, QtiStringMatch, QtiStylesheet, QtiSum, QtiTextEntryInteraction, QtiVariable, type ResponseInteraction, type ResponseVariable, type VariableDeclaration, type VariableValue, type directedPair, type float, type integer, itemContext, itemContextVariables, qtiAndMixin };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as h,b as
|
|
1
|
+
import{a as h,b as q,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from"@lit/context";import{LitElement as zt,html as Wt}from"lit";import{customElement as Jt,property as X}from"lit/decorators.js";function g(a,i){let e=h({waitUntilFirstUpdate:!1},i);return(t,r)=>{let{update:o}=t,n=Array.isArray(a)?a:[a];t.update=function(l){n.forEach(c=>{let p=c;if(l.has(p)){let d=l.get(p),m=this[p];d!==m&&(!e.waitUntilFirstUpdate||this.hasUpdated)&&this[r](d,m)}}),o.call(this,l)}}}import{createContext as Kt}from"@lit/context";var xt=[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"unknown",type:"outcome"},{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:"0",type:"response"}],T=Kt("item");var _=class extends zt{constructor(){super();this.identifier="";this.adaptive="false";this.timeDependent="false";this._handleDisabledChange=(e,t)=>{this._interactionElements.forEach(r=>r.disabled=t)};this._handleReadonlyChange=(e,t)=>this._interactionElements.forEach(r=>r.readonly=t);this._context={identifier:this.getAttribute("identifier"),variables:xt};this._state="item-created";this._initialContext=q(h({},this._context),{variables:this._context.variables});this._feedbackElements=[];this._interactionElements=[];this.state="item-created",this.addEventListener("qti-register-variable",({detail:e})=>{this._context=q(h({},this._context),{variables:[...this._context.variables,e.variable]}),this._initialContext=this._context}),this.addEventListener("qti-register-feedback",e=>{e.stopPropagation();let t=e.detail;this._feedbackElements.push(t),t.checkShowFeedback(t.outcomeIdentifier)}),this.addEventListener("qti-register-interaction",e=>{e.stopPropagation(),this._interactionElements.push(e.target)}),this.addEventListener("end-attempt",e=>{let{responseIdentifier:t,countAttempt:r}=e.detail;this.updateResponseVariable(t,"true"),this.processResponse(r)}),this.addEventListener("qti-set-outcome-value",e=>{let{outcomeIdentifier:t,value:r}=e.detail;this.updateOutcomeVariable(t,r)}),this.addEventListener("qti-interaction-response",this.handleUpdateResponseVariable)}set state(e){this._state=e}get variables(){return this._context.variables.map(e=>({identifier:e.identifier,value:e.value,type:e.type}))}set variables(e){if(!Array.isArray(e)||e.some(t=>!("identifier"in t))){console.warn("variables property should be an array of VariableDeclaration");return}this._context=q(h({},this._context),{variables:this._context.variables.map(t=>{let r=e.find(o=>o.identifier===t.identifier);return r?h(h({},t),r):t})}),this._context.variables.forEach(t=>{if(t.type==="response"){let r=this._interactionElements.find(o=>o.responseIdentifier===t.identifier);r&&(r.response=t.value)}t.type==="outcome"&&this._feedbackElements.forEach(r=>r.checkShowFeedback(t.identifier))})}firstUpdated(e){this.state="first-updated",this._emit("qti-assessment-item-first-updated",this)}connectedCallback(){super.connectedCallback(),this.state="item-connected"}set responses(e){if(e)for(let t of e){this.getResponse(t.responseIdentifier)&&this.updateResponseVariable(t.responseIdentifier,t.response);let o=this._interactionElements.find(n=>n.getAttribute("response-identifier")===t.responseIdentifier);o&&(o.response=t.response)}}render(){return Wt`<slot></slot>`}showCorrectResponse(e){let r=this._context.variables.filter(o=>"correctResponse"in o&&o.correctResponse).map(o=>({responseIdentifier:o.identifier,response:o.correctResponse}));for(let o of r){let n=this._interactionElements.find(l=>l.getAttribute("response-identifier")===o.responseIdentifier);n&&(n.correctResponse=e?o.response:"")}}processResponse(e=!0){var r;let t=this.querySelector("qti-response-processing");return!t||!t.process?!1:(t.process(),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus()),e&&this.updateOutcomeVariable("numAttempts",(+((r=this._context.variables.find(o=>o.identifier==="numAttempts"))==null?void 0:r.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(t=>t.identifier===e)||null}handleUpdateResponseVariable(e){let{responseIdentifier:t,response:r}=e.detail;this.updateResponseVariable(t,r)}updateResponseVariable(e,t){this._context=q(h({},this._context),{variables:this._context.variables.map(r=>r.identifier!==e?r:q(h({},r),{value:t}))}),this._emit("qti-interaction-changed",{item:this.identifier,responseIdentifier:e,response:t}),this.adaptive==="false"&&this.updateOutcomeVariable("completionStatus",this._getCompletionStatus())}updateOutcomeVariable(e,t){var o;let r=this.getOutcome(e);if(!r){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}this._context=q(h({},this._context),{variables:this._context.variables.map(n=>n.identifier!==e?n:q(h({},n),{value:r.cardinality==="single"?t:[...n.value,t]}))}),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,t=null){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t}))}};s([X({type:String})],_.prototype,"title",2),s([X({type:String})],_.prototype,"identifier",2),s([X({type:String})],_.prototype,"adaptive",2),s([X({type:String})],_.prototype,"timeDependent",2),s([X({type:Boolean})],_.prototype,"disabled",2),s([g("disabled",{waitUntilFirstUpdate:!0})],_.prototype,"_handleDisabledChange",2),s([X({type:Boolean})],_.prototype,"readonly",2),s([g("readonly",{waitUntilFirstUpdate:!0})],_.prototype,"_handleReadonlyChange",2),s([jt({context:T})],_.prototype,"_context",2),_=s([Jt("qti-assessment-item")],_);import{LitElement as Zt,html as Gt}from"lit";import{property as Q}from"lit/decorators.js";var Qt={SPACE:32},x=class extends Zt{constructor(){super(...arguments);this.tabindex=0;this.disabled=!1;this.readonly=!1;this.checked=!1}handleDisabledChange(e,t){t?(this.tabindex=void 0,this.blur()):this.tabIndex=0}connectedCallback(){super.connectedCallback(),this.addEventListener("keyup",this._onKeyUp),this.addEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-register-choice",{bubbles:!0,cancelable:!1,composed:!0}))}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.dispatchEvent(new CustomEvent("qti-loose-choice",{bubbles:!0,cancelable:!1,composed:!0}))}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case Qt.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.dispatchEvent(new CustomEvent("qti-choice-element-selected",{bubbles:!0,cancelable:!1,composed:!0,detail:{identifier:this.identifier,checked:this.checked}})))}validateAllProps(){return!!this.getAttribute("identifier")}render(){return this.validateAllProps()||console.warn(`Invalid props for ${this.outerHTML}`,"missing identifier"),Gt` <slot></slot> `}};s([Q({type:String})],x.prototype,"identifier",2),s([Q({type:Number,reflect:!0})],x.prototype,"tabindex",2),s([Q({reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:e=>e}})],x.prototype,"disabled",2),s([Q({reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:e=>e}})],x.prototype,"readonly",2),s([Q({reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:e=>e}})],x.prototype,"checked",2),s([g("disabled",{waitUntilFirstUpdate:!0})],x.prototype,"handleDisabledChange",1);import{customElement as tr}from"lit/decorators.js";import{html as rr,LitElement as ir}from"lit";import{css as er}from"lit";var Et=er`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
}
|
|
@@ -10,7 +10,7 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
10
10
|
:host {
|
|
11
11
|
display: none;
|
|
12
12
|
}
|
|
13
|
-
`],s([Ie({type:String,attribute:"base-type"})],D.prototype,"baseType",2),s([Ie({type:String})],D.prototype,"identifier",2),s([Ie({type:String})],D.prototype,"cardinality",2),s([hr({context:T,subscribe:!0}),gr()],D.prototype,"itemContext",2);customElements.define("qti-response-declaration",D);import{LitElement as vr}from"lit";import{customElement as yr}from"lit/decorators.js";var pe=class extends vr{};pe=s([yr("qti-companion-materials-info")],pe);import{LitElement as xr,html as Er}from"lit";import{customElement as
|
|
13
|
+
`],s([Ie({type:String,attribute:"base-type"})],D.prototype,"baseType",2),s([Ie({type:String})],D.prototype,"identifier",2),s([Ie({type:String})],D.prototype,"cardinality",2),s([hr({context:T,subscribe:!0}),gr()],D.prototype,"itemContext",2);customElements.define("qti-response-declaration",D);import{LitElement as vr}from"lit";import{customElement as yr}from"lit/decorators.js";var pe=class extends vr{};pe=s([yr("qti-companion-materials-info")],pe);import{LitElement as xr,html as Er}from"lit";import{customElement as Cr}from"lit/decorators.js";var de=class extends xr{render(){return Er`<slot></slot>`}};de=s([Cr("qti-content-body")],de);import{LitElement as qr,css as _r,html as kr}from"lit";import{customElement as Ar,property as ue}from"lit/decorators.js";var S=class extends qr{handleclassNamesChange(e,t){this.classNames.split(" ").forEach(o=>{switch(o){case"qti-rubric-discretionary-placement":this.setAttribute("slot","qti-rubric-block");break;case"qti-rubric-inline":this.setAttribute("slot","");break;default:break}})}render(){return kr`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};S.styles=_r`
|
|
14
14
|
:host {
|
|
15
15
|
display: block;
|
|
16
16
|
}
|
|
@@ -63,7 +63,7 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
63
63
|
?disabled="${this.disabled}"
|
|
64
64
|
?readonly="${this.readonly}"
|
|
65
65
|
.value=${this._value}
|
|
66
|
-
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this._value!==t.value&&(this._value=t.value,this.saveResponse(t.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};s([ge({type:Number,attribute:"expected-length"})],L.prototype,"expectedLength",2),s([ge({type:String,attribute:"pattern-mask"})],L.prototype,"patternMask",2),s([ge({type:String,attribute:"placeholder-text"})],L.prototype,"placeholderText",2),s([Fr()],L.prototype,"_value",2),s([ge({type:String,attribute:"class"})],L.prototype,"classNames",2),s([g("classNames",{waitUntilFirstUpdate:!0})],L.prototype,"handleclassNamesChange",1),L=s([Ur("qti-extended-text-interaction")],L);import{css as Ir,html as Xr}from"lit";import{customElement as Yr,property as ve,state as Ke}from"lit/decorators.js";import{ifDefined as
|
|
66
|
+
></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this._value!==t.value&&(this._value=t.value,this.saveResponse(t.value))}reset(){this._value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};s([ge({type:Number,attribute:"expected-length"})],L.prototype,"expectedLength",2),s([ge({type:String,attribute:"pattern-mask"})],L.prototype,"patternMask",2),s([ge({type:String,attribute:"placeholder-text"})],L.prototype,"placeholderText",2),s([Fr()],L.prototype,"_value",2),s([ge({type:String,attribute:"class"})],L.prototype,"classNames",2),s([g("classNames",{waitUntilFirstUpdate:!0})],L.prototype,"handleclassNamesChange",1),L=s([Ur("qti-extended-text-interaction")],L);import{css as Ir,html as Xr}from"lit";import{customElement as Yr,property as ve,state as Ke}from"lit/decorators.js";import{ifDefined as qt}from"lit/directives/if-defined.js";import{createRef as Br}from"lit/directives/ref.js";function Ct(a,i){let e,t=h({},i);return(r,o)=>{let{connectedCallback:n,disconnectedCallback:l}=r;r.connectedCallback=function(){var d;n.call(this);let c=m=>{let C=Array.from(this.querySelectorAll(a));for(let v of m){let I=Array.from(v.addedNodes).map(N=>N),b=Array.from(v.addedNodes).map(N=>N);v.type==="childList"&&I.find(N=>C.includes(N))&&this[o](I,b)}};e=new MutationObserver(c),e.observe(this,{childList:!0,subtree:!0});let p=(d=this.querySelectorAll(a))!=null?d:[];this[o](Array.from(p),[])},r.disconnectedCallback=function(){l.call(this),e.disconnect()}}}var A=class extends f{constructor(){super(...arguments);this._value="";this._correctValue="";this._size=5;this.inputRef=Br()}handleclassNamesChange(e,t){t.split(" ").forEach(o=>{if(o.startsWith("qti-input-width")){let n=o.replace("qti-input-width-","");this._size=parseInt(n)}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[Ir`
|
|
67
67
|
:host {
|
|
68
68
|
display: inline-flex;
|
|
69
69
|
display: flex;
|
|
@@ -85,10 +85,10 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
85
85
|
@keyup="${this.textChanged}"
|
|
86
86
|
@change="${this.textChanged}"
|
|
87
87
|
type="${this.patternMask=="[0-9]*"?"number":"text"}"
|
|
88
|
-
placeholder="${
|
|
88
|
+
placeholder="${qt(this.placeholderText?this.placeholderText:void 0)}"
|
|
89
89
|
.value="${this._value}"
|
|
90
90
|
size="${this._size}"
|
|
91
|
-
pattern="${
|
|
91
|
+
pattern="${qt(this.patternMask?this.patternMask:void 0)}"
|
|
92
92
|
?disabled="${this.disabled}"
|
|
93
93
|
?readonly="${this.readonly}"
|
|
94
94
|
/>
|
|
@@ -104,7 +104,7 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
104
104
|
</select>
|
|
105
105
|
|
|
106
106
|
${wt(this.correctOption)}
|
|
107
|
-
`}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(t=>({textContent:t.innerHTML,value:t.getAttribute("identifier"),selected:!1}))]}disconnectedCallback(){this.removeEventListener("on-dropdown-selected",this.choiceSelected)}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>
|
|
107
|
+
`}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(t=>({textContent:t.innerHTML,value:t.getAttribute("identifier"),selected:!1}))]}disconnectedCallback(){this.removeEventListener("on-dropdown-selected",this.choiceSelected)}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>q(h({},e),{selected:t===0}))}set response(e){this.options=this.options.map(t=>(e===t.value&&(t.selected=!0),t))}set correctResponse(e){if(e===""){this.correctOption="";return}this.correctOption=`<span part="correct-option">${this.options.find(t=>e===t.value).textContent}</span>`}choiceSelected(e){let t=e.target.value;this.options=this.options.map(r=>q(h({},r),{selected:r.value===t})),this.saveResponse(t)}};P.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"],s([At()],P.prototype,"options",2),s([At()],P.prototype,"correctOption",2),s([zr({attribute:"data-prompt",type:String})],P.prototype,"dataPrompt",2);customElements.define("qti-inline-choice-interaction",P);import{customElement as Jr,property as Zr}from"lit/decorators.js";import{html as Gr}from"lit";import{css as Wr}from"lit";var Rt=Wr`
|
|
108
108
|
:host {
|
|
109
109
|
display: flex;
|
|
110
110
|
flex-direction: column;
|
|
@@ -168,10 +168,10 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
168
168
|
slot {
|
|
169
169
|
display: none;
|
|
170
170
|
}
|
|
171
|
-
`,s([hi()],u.prototype,"result",2);var w=class extends u{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var xe=class extends fi(w){calculate(){return this.calculateChildren(Array.from(this.children))}};function fi(a){return class extends a{calculateChildren(e){return e.map(r=>{let o=r;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=o.calculate();if(typeof n=="string")if(n==="true")n=!0;else if(n==="false")n=!1;else return console.error("unexpected value in qti-and, expected boolean"),null;return n}).every(r=>typeof r=="boolean"&&r)}}}customElements.define("qti-and",xe);import{property as bi}from"lit/decorators.js";var Ee=class extends u{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent}};s([bi({type:String,attribute:"base-type"})],Ee.prototype,"baseType",2);customElements.define("qti-base-value",Ee);var Ze=class extends w{getResult(){let i=this.getVariables();if(this.children.length===2){let e=i[0],t=i[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let r=e.value,o=t.value;return r.filter(c=>o.includes(c)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let r=e.value;return t.value.includes(r)}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",Ze);var Ge=class extends u{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let i=this.getAttribute("identifier")||"",e=this.closest("qti-assessment-item").getResponse(i);return e.correctResponse,e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",Ge);import{property as gi}from"lit/decorators.js";var qe=class extends u{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let o=parseFloat(t.value),n=parseFloat(r.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}};s([gi({type:String})],qe.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",qe);import{property as vi}from"lit/decorators.js";var R=class{static compareSingleValues(i,e,t){switch(t){case"identifier":case"string":return i===e;case"integer":{let r=parseInt(i,10),o=parseInt(e,10);if(!isNaN(r)&&!isNaN(o))return r===o;console.error(`Cannot convert ${i} and/or ${e} to int.`);break}case"float":{let r=parseFloat(i),o=parseFloat(e);if(!isNaN(r)&&!isNaN(o))return r===o;console.error(`couldn't convert ${i} and/or ${e} to float.`);break}case"pair":case"directedPair":{let r=i.split(" ").sort(),o=e.split(" ").sort();if(r.length===2&&o.length===2)return t==="pair"&&(r.sort(),o.sort()),r.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${i} 2: ${e}`);break}}return!1}};var Ce=class extends u{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):R.compareSingleValues(t.value,r.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};s([vi({type:String})],Ce.prototype,"toleranceMode",2);customElements.define("qti-equal",Ce);var Qe=class extends u{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if(e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",Qe);var et=class extends w{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value>=+t.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",et);var tt=class extends u{getResult(){if(this.children.length===1){let i=this.getVariables();if(!i)return!0;let e=i[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",tt);var rt=class extends u{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if(e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",rt);var it=class extends w{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value<=+t.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",it);import{property as yi}from"lit/decorators.js";var _e=class extends u{getResult(){let e=this.assessmentItem.getResponse(this.identifier);if(!e)return console.warn(`Response ${this.identifier} can not be found`),null;let t=e.mapping,r=Array.isArray(e.value)?e.value:[e.value],o=0;for(let n of r){let l=t.mapEntries.find(c=>R.compareSingleValues(c.mapKey,n,e.baseType));l==null||l.mappedValue==null?o+=t.defaultValue:o+=l.mappedValue}return t.lowerBound!=null&&(o=Math.max(t.lowerBound,o)),t.upperBound!=null&&(o=Math.min(t.upperBound,o)),o}};s([yi({type:String})],_e.prototype,"identifier",2);customElements.define("qti-map-response",_e);import{property as st}from"lit/decorators.js";import{LitElement as xi}from"lit";var K=class extends xi{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")}))}};s([st({attribute:"default-value",type:Number})],K.prototype,"defaultValue",2),s([st({attribute:"lower-bound",type:Number})],K.prototype,"lowerBound",2),s([st({attribute:"upper-bound",type:Number})],K.prototype,"upperBound",2);customElements.define("qti-mapping",K);var ot=class a extends u{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return a.match(e,t)}return console.error("unexpected number of children in match"),null}static match(i,e){var t;if(e.cardinality==="single")return i.value===null?!1:Array.isArray(i.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):R.compareSingleValues((t=i.value)==null?void 0:t.toString(),e.value.toString(),e.baseType);{if(!Array.isArray(i.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(i.value.length!==e.value.length)return!1;let r=0;for(let o of e.value){if(e.cardinality==="ordered"){let n=i[r];if(!R.compareSingleValues(o,n,e.baseType))return!1}else{let n=null;for(let l of i.value)if(R.compareSingleValues(o,l,e.baseType)){n=l;break}if(n!==null)i.value.splice(i.value.indexOf(n),1);else return!1}r++}return!0}}};customElements.define("qti-match",ot);var nt=class extends u{getResult(){let i=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=i;if(e.baseType!==t.baseType&&console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let r=e.value;return t.value.includes(r)}};customElements.define("qti-member",nt);var at=class extends u{getResult(){let i=this.getVariables();if(i.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of i)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return i}};customElements.define("qti-multiple",at);import{html as Ei}from"lit";var lt=class extends u{render(){return Ei`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",lt);var ct=class extends w{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate();if(typeof r=="string")if(r==="true")r=!0;else if(r==="false")r=!1;else return console.error("unexpected value in qti-or, expected boolean"),null;return r}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",ct);var pt=class extends u{getResult(){let i=this.getVariables();if(i.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of i)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return i}};customElements.define("qti-ordered",pt);import{consume as qi}from"@lit/context";import{LitElement as Ci,html as _i}from"lit";import{property as ki,state as Ai}from"lit/decorators.js";var ie=class extends Ci{render(){var t,r;let e=(r=(t=this.itemContext)==null?void 0:t.variables.find(o=>o.identifier===this.identifier))==null?void 0:r.value;return _i`${JSON.stringify(e,null,2)}`}calculate(){let e=this.closest("qti-assessment-item"),t=this.identifier;return e.getVariable(t).value}};s([ki({type:String})],ie.prototype,"identifier",2),s([qi({context:T,subscribe:!0}),Ai()],ie.prototype,"itemContext",2);customElements.define("qti-printed-variable",ie);var dt=class extends u{getResult(){return this.getVariables().reduce((t,r)=>{if(r.baseType=="float"||r.baseType=="integer")try{return t*parseInt(r.value.toString())}catch(o){console.warn("can not convert to number")}else console.warn(`has another baseType ${r.baseType}`);return t},1)}};customElements.define("qti-product",dt);import{property as wi}from"lit/decorators.js";var ke=class extends u{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let o=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return R.compareSingleValues(o,n,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};s([wi({type:String,attribute:"case-sensitive"})],ke.prototype,"caseSensitive",2);customElements.define("qti-string-match",ke);var ut=class extends u{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((e,t)=>e+t,0)}};customElements.define("qti-sum",ut);var mt=class extends u{getResult(){let i=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(i).value}};customElements.define("qti-variable",mt);import{LitElement as Ri,html as Vt}from"lit";var ht=class extends Ri{constructor(){super(...arguments);this._errorMessage=null}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},baseUrl:{type:String,attribute:"base-url"},_errorMessage:{type:String,state:!0}}}getTAOConfig(e){let t=e.querySelectorAll("properties"),r={},o=l=>{let c={},p=l.getAttribute("key");if(p){let d=Array.from(l.children),m=d.map(v=>v.getAttribute("key"));m.length>0&&!m.find(v=>!Number.isInteger(+v))?c[p]=d.map(v=>n(v)):c[p]=l.textContent}return c},n=l=>{if(l){let c={};for(let p of l.children)c=h(h({},c),o(p));return c}};for(let l of t)return l.getAttribute("key")||(r=h(h({},r),n(l))),r;console.log("Can not find qti-custom-interaction config")}register(e){let t=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",r=t=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");r.classList.add("qti-customInteraction"),t=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let o=t=="IMS"?{properties:this.dataset}:this.getTAOConfig(this);t=="IMS"?e.getInstance(r,o,void 0):e.initialize(this.customInteractionTypeIdentifier,r.firstElementChild,o),t=="TAO"&&Array.from(this.querySelectorAll("link")).map(l=>l.getAttribute("href")).forEach(l=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=l,r.appendChild(c)})}connectedCallback(){super.connectedCallback();let e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};if(window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim),!globalThis.require){this._errorMessage="requirejs not found, load with cdn: https://cdnjs.com/libraries/require.js";return}requirejs.config(e)(["require"],r=>{!r.defined("qtiCustomInteractionContext")&&define("qtiCustomInteractionContext",()=>({register:n=>{this.register(n)},notifyReady:()=>{}}));let o=r.defined(this.module);r([this.module],n=>{o&&this.register(n)},n=>{this._errorMessage=n})},r=>{this._errorMessage=r})}render(){return Vt`<slot></slot>${this._errorMessage&&Vt`<div style="color:red">
|
|
171
|
+
`,s([hi()],u.prototype,"result",2);var w=class extends u{calculate(){return this.result=this.getResult(),this.result}getResult(){throw new Error("Not implemented")}};var xe=class extends fi(w){calculate(){return this.calculateChildren(Array.from(this.children))}};function fi(a){return class extends a{calculateChildren(e){return e.map(r=>{let o=r;if(!o.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let n=o.calculate();if(typeof n=="string")if(n==="true")n=!0;else if(n==="false")n=!1;else return console.error("unexpected value in qti-and, expected boolean"),null;return n}).every(r=>typeof r=="boolean"&&r)}}}customElements.define("qti-and",xe);import{property as bi}from"lit/decorators.js";var Ee=class extends u{constructor(){super(...arguments);this.baseType="string"}getResult(){return this.textContent}};s([bi({type:String,attribute:"base-type"})],Ee.prototype,"baseType",2);customElements.define("qti-base-value",Ee);var Ze=class extends w{getResult(){let i=this.getVariables();if(this.children.length===2){let e=i[0],t=i[1];if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="multiple"){let r=e.value,o=t.value;return r.filter(c=>o.includes(c)).length>0}else if(e.baseType==="directedPair"&&t.baseType==="directedPair"&&e.cardinality==="single"){let r=e.value;return t.value.includes(r)}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",Ze);var Ge=class extends u{get interpretation(){return this.getAttribute("interpretation")||""}getResult(){let i=this.getAttribute("identifier")||"",e=this.closest("qti-assessment-item").getResponse(i);return e.correctResponse,e.cardinality!=="single"?e.correctResponse.length>0?e.correctResponse[0]:"":e.correctResponse}};customElements.define("qti-correct",Ge);import{property as gi}from"lit/decorators.js";var Ce=class extends u{constructor(){super(...arguments);this.roundingMode="significantFigures"}get figures(){if(!this.getAttribute("figures"))return console.error("figures attribute is missing"),null;let t=parseInt(this.getAttribute("figures")||"0");return isNaN(t)?(console.error("figures attribute is not a number"),null):t<0?(console.error("figures attribute is negative"),null):t<1&&this.roundingMode==="significantFigures"?(console.error("figures cannot be smaller than 1 for RoundingMode significantFigures"),null):t}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(this.roundingMode===null)return null;if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti equal"),!1;switch(e[0].baseType){case"integer":case"float":{let o=parseFloat(t.value),n=parseFloat(r.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}};s([gi({type:String})],Ce.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",Ce);import{property as vi}from"lit/decorators.js";var R=class{static compareSingleValues(i,e,t){switch(t){case"identifier":case"string":return i===e;case"integer":{let r=parseInt(i,10),o=parseInt(e,10);if(!isNaN(r)&&!isNaN(o))return r===o;console.error(`Cannot convert ${i} and/or ${e} to int.`);break}case"float":{let r=parseFloat(i),o=parseFloat(e);if(!isNaN(r)&&!isNaN(o))return r===o;console.error(`couldn't convert ${i} and/or ${e} to float.`);break}case"pair":case"directedPair":{let r=i.split(" ").sort(),o=e.split(" ").sort();if(r.length===2&&o.length===2)return t==="pair"&&(r.sort(),o.sort()),r.join(" ")===o.join(" ");console.error(`compared two pair but one of the values does not have 2 values: 1: ${i} 2: ${e}`);break}}return!1}};var qe=class extends u{constructor(){super(...arguments);this.toleranceMode="exact"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];return this.toleranceMode!=="exact"?(console.error("toleranceMode is not supported yet"),!1):t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value)?(console.error("unexpected cardinality in qti equal"),!1):R.compareSingleValues(t.value,r.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};s([vi({type:String})],qe.prototype,"toleranceMode",2);customElements.define("qti-equal",qe);var Qe=class extends u{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if(e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value>+t.value;console.error("unexpected baseType or cardinality in qti gt")}return console.error("unexpected number of children in qt"),null}};customElements.define("qti-gt",Qe);var et=class extends w{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value>=+t.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",et);var tt=class extends u{getResult(){if(this.children.length===1){let i=this.getVariables();if(!i)return!0;let e=i[0].value;return e==null||e==null||e===""}return console.error("unexpected number of children in qti Null"),null}};customElements.define("qti-is-null",tt);var rt=class extends u{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if(e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float"))return+e.value<+t.value;console.error("unexpected baseType or cardinality in qti lt")}return console.error("unexpected number of children in lt"),null}};customElements.define("qti-lt",rt);var it=class extends w{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return e.baseType===t.baseType&&(e.baseType==="integer"||e.baseType==="float")?+e.value<=+t.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",it);import{property as yi}from"lit/decorators.js";var _e=class extends u{getResult(){let e=this.assessmentItem.getResponse(this.identifier);if(!e)return console.warn(`Response ${this.identifier} can not be found`),null;let t=e.mapping,r=Array.isArray(e.value)?e.value:[e.value],o=0;for(let n of r){let l=t.mapEntries.find(c=>R.compareSingleValues(c.mapKey,n,e.baseType));l==null||l.mappedValue==null?o+=t.defaultValue:o+=l.mappedValue}return t.lowerBound!=null&&(o=Math.max(t.lowerBound,o)),t.upperBound!=null&&(o=Math.min(t.upperBound,o)),o}};s([yi({type:String})],_e.prototype,"identifier",2);customElements.define("qti-map-response",_e);import{property as st}from"lit/decorators.js";import{LitElement as xi}from"lit";var K=class extends xi{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")}))}};s([st({attribute:"default-value",type:Number})],K.prototype,"defaultValue",2),s([st({attribute:"lower-bound",type:Number})],K.prototype,"lowerBound",2),s([st({attribute:"upper-bound",type:Number})],K.prototype,"upperBound",2);customElements.define("qti-mapping",K);var ot=class a extends u{getResult(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];return a.match(e,t)}return console.error("unexpected number of children in match"),null}static match(i,e){var t;if(e.cardinality==="single")return i.value===null?!1:Array.isArray(i.value)||Array.isArray(e.value)?(console.error("unexpected cardinality in qti match"),!1):R.compareSingleValues((t=i.value)==null?void 0:t.toString(),e.value.toString(),e.baseType);{if(!Array.isArray(i.value)||!Array.isArray(e.value))return console.error("unexpected cardinality in qti match"),!1;if(i.value.length!==e.value.length)return!1;let r=0;for(let o of e.value){if(e.cardinality==="ordered"){let n=i[r];if(!R.compareSingleValues(o,n,e.baseType))return!1}else{let n=null;for(let l of i.value)if(R.compareSingleValues(o,l,e.baseType)){n=l;break}if(n!==null)i.value.splice(i.value.indexOf(n),1);else return!1}r++}return!0}}};customElements.define("qti-match",ot);var nt=class extends u{getResult(){let i=this.getVariables();this.children.length!==2&&console.warn("The member operator takes two sub-expressions");let[e,t]=i;if(e.baseType!==t.baseType&&console.warn("Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||console.warn("and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&console.warn("The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&console.warn("It must not be used on sub-expressions with a base-type of duration"),e.value===null||t.value===null)return null;let r=e.value;return t.value.includes(r)}};customElements.define("qti-member",nt);var at=class extends u{getResult(){let i=this.getVariables();if(i.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of i)if(e.cardinality!=="multiple"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti multiple"),[];return i}};customElements.define("qti-multiple",at);import{html as Ei}from"lit";var lt=class extends u{render(){return Ei`${super.render()}`}getResult(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",lt);var ct=class extends w{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate();if(typeof r=="string")if(r==="true")r=!0;else if(r==="false")r=!1;else return console.error("unexpected value in qti-or, expected boolean"),null;return r}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",ct);var pt=class extends u{getResult(){let i=this.getVariables();if(i.length===0)return console.error("unexpected number of children in qti multiple"),null;for(let e of i)if(e.cardinality!=="ordered"&&e.cardinality!=="single")return console.error("unexpected cardinality in qti ordered"),[];return i}};customElements.define("qti-ordered",pt);import{consume as Ci}from"@lit/context";import{LitElement as qi,html as _i}from"lit";import{property as ki,state as Ai}from"lit/decorators.js";var ie=class extends qi{render(){var t,r;let e=(r=(t=this.itemContext)==null?void 0:t.variables.find(o=>o.identifier===this.identifier))==null?void 0:r.value;return _i`${JSON.stringify(e,null,2)}`}calculate(){let e=this.closest("qti-assessment-item"),t=this.identifier;return e.getVariable(t).value}};s([ki({type:String})],ie.prototype,"identifier",2),s([Ci({context:T,subscribe:!0}),Ai()],ie.prototype,"itemContext",2);customElements.define("qti-printed-variable",ie);var dt=class extends u{getResult(){return this.getVariables().reduce((t,r)=>{if(r.baseType=="float"||r.baseType=="integer")try{return t*parseInt(r.value.toString())}catch(o){console.warn("can not convert to number")}else console.warn(`has another baseType ${r.baseType}`);return t},1)}};customElements.define("qti-product",dt);import{property as wi}from"lit/decorators.js";var ke=class extends u{constructor(){super(...arguments);this.caseSensitive="true"}getResult(){if(this.children.length===2){let e=this.getVariables(),t=e[0],r=e[1];if(t.cardinality!=="single"||r.cardinality!=="single"||Array.isArray(t.value)||Array.isArray(r.value))return console.error("unexpected cardinality in qti string-match"),!1;let o=this.caseSensitive==="true"?t.value:t.value.toLowerCase(),n=this.caseSensitive==="true"?r.value:r.value.toLowerCase();return R.compareSingleValues(o,n,t.baseType)}return console.error("unexpected number of children in qti-string-match"),null}};s([wi({type:String,attribute:"case-sensitive"})],ke.prototype,"caseSensitive",2);customElements.define("qti-string-match",ke);var ut=class extends u{getResult(){return Array.from(this.children).map(e=>{let t=e;if(!t.calculate)return console.error("Element doesn't implement QtiConditionExpression"),null;let r=t.calculate();return Number.isNaN(r)?(console.error("unexpected value in qti-sum, expected number"),null):Number(r)}).reduce((e,t)=>e+t,0)}};customElements.define("qti-sum",ut);var mt=class extends u{getResult(){let i=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(i).value}};customElements.define("qti-variable",mt);import{LitElement as Ri,html as Vt}from"lit";var ht=class extends Ri{constructor(){super(...arguments);this._errorMessage=null}static get properties(){return{responseIdentifier:{type:String,attribute:"response-identifier"},module:{type:String,attribute:"module"},customInteractionTypeIdentifier:{type:String,attribute:"custom-interaction-type-identifier"},baseUrl:{type:String,attribute:"base-url"},_errorMessage:{type:String,state:!0}}}getTAOConfig(e){let t=e.querySelectorAll("properties"),r={},o=l=>{let c={},p=l.getAttribute("key");if(p){let d=Array.from(l.children),m=d.map(v=>v.getAttribute("key"));m.length>0&&!m.find(v=>!Number.isInteger(+v))?c[p]=d.map(v=>n(v)):c[p]=l.textContent}return c},n=l=>{if(l){let c={};for(let p of l.children)c=h(h({},c),o(p));return c}};for(let l of t)return l.getAttribute("key")||(r=h(h({},r),n(l))),r;console.log("Can not find qti-custom-interaction config")}register(e){let t=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",r=t=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");r.classList.add("qti-customInteraction"),t=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let o=t=="IMS"?{properties:this.dataset}:this.getTAOConfig(this);t=="IMS"?e.getInstance(r,o,void 0):e.initialize(this.customInteractionTypeIdentifier,r.firstElementChild,o),t=="TAO"&&Array.from(this.querySelectorAll("link")).map(l=>l.getAttribute("href")).forEach(l=>{let c=document.createElement("link");c.rel="stylesheet",c.type="text/css",c.media="screen",c.href=l,r.appendChild(c)})}connectedCallback(){super.connectedCallback();let e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};if(window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim),!globalThis.require){this._errorMessage="requirejs not found, load with cdn: https://cdnjs.com/libraries/require.js";return}requirejs.config(e)(["require"],r=>{!r.defined("qtiCustomInteractionContext")&&define("qtiCustomInteractionContext",()=>({register:n=>{this.register(n)},notifyReady:()=>{}}));let o=r.defined(this.module);r([this.module],n=>{o&&this.register(n)},n=>{this._errorMessage=n})},r=>{this._errorMessage=r})}render(){return Vt`<slot></slot>${this._errorMessage&&Vt`<div style="color:red">
|
|
172
172
|
<h1>Error</h1>
|
|
173
173
|
${this._errorMessage}
|
|
174
|
-
</div>`}`}};customElements.define("qti-portable-custom-interaction",ht);import{LitElement as Si,css as Li,html as Ht}from"lit";var Ae=class a{constructor(){this._touchBegin=0;this._touchDown=null;this._lastClick=0;this._canDrag=!1;this._dragSrc=null;this._dragCopy=null;this._touchEndCalled=!1;this._dragRunning=!1;this._dataTransfer={data:{},setData:function(i,e){this.data[i]=e},getData:function(i){return this.data[i]},effectAllowed:"move"};this._copyOffset={x:0,y:0};this._lastTarget=null;this._currentDropContainer=null;this._handleClick=!0;this._DBLCLICKDELAY=500;this._CONTEXTMENUDELAY=1e3;this._DRAGDELTA=5;this._COPYOPACITY=.7;this.copyStylesDragClone=!0;this.dragOnClick=!1;this._createDragCopy=(i,e)=>{if(this._dragCopy===null&&this._dragRunning){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);let t=window.getComputedStyle(this._dragSrc);if(this._dragCopy.style="",this._dragCopy.setAttribute("dragclone",""),this.copyStylesDragClone)for(let r of t)this._dragCopy.style[r]=t.getPropertyValue(r);this._calculateDragCopyPosition(e),this._dragCopy.style.top=e.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=e.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="fixed",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._dragRunning){let t=this;requestAnimationFrame(function(){t._touchEndCalled||t._dragCopy===null||(t._dragCopy.style.top=e.clientY-t._copyOffset.y+"px",t._dragCopy.style.left=e.clientX-t._copyOffset.x+"px")});let r=this._findDroppable(i);r!=this._lastTarget&&(this._dispatchEvent(r,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=r),this._currentDropContainer=r,this._currentDropContainer&&this._dispatchEvent(r,"dragover")}};return a._instance?a._instance:(a._instance=this,document.addEventListener("touchmove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("mousemove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchend",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("mouseup",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchcancel",this._touchCancel.bind(this),{passive:!1,capture:!1}),this)}addDraggables(i){i.forEach(e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})}_touchStart(i){this._touchBegin=Date.now();let{x:e,y:t}=this._getPoint(i);if(this._touchDown={x:e,y:t},this._dragSrc=i.currentTarget,this._canDrag=!0,this.dragOnClick){let r={clientX:e,clientY:t};this._dragRunning=!0,this._createDragCopy(i,r)}i.preventDefault()}_touchMove(i){if(this._canDrag&&this._dragSrc){let{x:e,y:t}=this._getPoint(i),r={clientX:e,clientY:t};this._getDelta(r)>=this._DRAGDELTA&&(this._dragRunning=!0),this._createDragCopy(i,r),i.preventDefault()}}_touchEnd(i){var e;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else if(this._dragRunning){let t=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});t.dataTransfer={dropEffect:"none"},(e=this._dragSrc)==null||e.dispatchEvent(t)}this._reset()}_touchCancel(i){this._reset()}_findDroppable(i){let e=this._getPoint(i);return this.elementFromPoint(e.x,e.y)}elementFromPoint(i,e){let t=document.elementFromPoint(i,e);if(t){for(;t.shadowRoot;){let r=t.shadowRoot.elementFromPoint(i,e);if(r===null||r===t)break;t=r}return t}return null}_getPoint(i,e){return i&&i.touches&&(i=i.touches[0]),{x:e?i.pageX:i.clientX,y:e?i.pageY:i.clientY}}_calculateDragCopyPosition(i){let e=this._dragSrc.getBoundingClientRect();this._copyOffset.x=i.clientX-e.left,this._copyOffset.y=i.clientY-e.top}_getDelta(i){let e=Math.abs(i.clientX-this._touchDown.x),t=Math.abs(i.clientY-this._touchDown.y);return e+t}_dispatchEvent(i,e,t=!0){if(!i)return!1;let r=new CustomEvent(e,{bubbles:t,cancelable:!0});return r.dataTransfer=this._dataTransfer,i.dispatchEvent(r),r.defaultPrevented}_reset(){this._dragRunning&&(this._dragSrc.style.opacity="1.0",this._dragCopy.parentElement.removeChild(this._dragCopy)),this._dragRunning=!1,this._dragSrc=null,this._dragCopy=null,this._canDrag=!1,this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._touchEndCalled=!1,this._dataTransfer={data:{},setData:function(i,e){this.data[i]=e},getData:function(i){return this.data[i]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}};import{property as Ti}from"lit/decorators.js";var Mt=(a,i,e)=>{class t extends a{constructor(){super(...arguments);this.disabled=!1}firstUpdated(n){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(n);let l=Array.from(i?this.shadowRoot.querySelectorAll(e):this.querySelectorAll(e));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),l.forEach(c=>{c.setAttribute("dropzone","move"),c.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(c)});for(let c of l)this.observer=new MutationObserver(p=>{p.forEach(d=>{if(d.type==="attributes")switch(d.attributeName){case"disabled":{c.hasAttribute("disabled")?this.removeHandler(c):this.attachHandler(c);break}}})}),this.observer.observe(c,{attributes:!0})}attachHandler(n){n.addEventListener("dragover",this.dragoverHandler),n.addEventListener("dragenter",this.dragenterHandler),n.addEventListener("drop",this.dropHandler)}removeHandler(n){n.removeEventListener("dragover",this.dragoverHandler),n.removeEventListener("dragenter",this.dragenterHandler),n.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var n;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),(n=this.observer)==null||n.disconnect())}dragenterHandler(n){n.preventDefault()}dragoverHandler(n){return n.preventDefault(),n.currentTarget.setAttribute("active",""),n.dataTransfer.dropEffect="move",!1}dropHandler(n){n.preventDefault();let l=n.currentTarget,c=this.querySelector(`[identifier=${n.dataTransfer.getData("text")}`),p=c||this.shadowRoot.querySelector(`[identifier=${n.dataTransfer.getData("text")}`);return l?p.parentElement.getAttribute("identifier")!==l.getAttribute("identifier")&&l.appendChild(p):console.error(`cannot find droppable, target: ${n.target?JSON.stringify(n.target):"null"}`),l.removeAttribute("active"),!1}dragleaveHandler(n){return n.preventDefault(),n.currentTarget.removeAttribute("active"),n.dataTransfer.dropEffect="none",!1}}return s([Ti({type:Boolean,reflect:!0})],t.prototype,"disabled",2),t};var Nt=(a,i,e)=>{class t extends a{}return t};import{property as j}from"lit/decorators.js";var M=(a,i,e,t)=>{class r extends Nt(Mt(a,e,t),t,i){constructor(){super(...arguments);this.draggables=new Map;this.responseIdentifier="";this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.disabled=!1;this.readonly=!1;this.minAssociations=1;this.maxAssociations=1}reInitDragAndDrop(l,c){if(this.classList.contains("qti-match-tabular"))return;l.filter(d=>!this.draggables||!this.draggables.get(d)).length>0&&(this.dragDropApi.addDraggables(l),l.forEach(d=>{this.draggables.set(d,{parent:d.parentElement,index:Array.from(d.parentNode.children).indexOf(d)}),d.setAttribute("qti-draggable","true"),d.addEventListener("dragstart",m=>{m.dataTransfer.setData("text",m.currentTarget.getAttribute("identifier")),d.setAttribute("dragging","")}),d.addEventListener("dragend",m=>{if(m.preventDefault(),d.removeAttribute("over"),d.removeAttribute("dragging"),(m.dataTransfer.dropEffect==="none"||m.dataTransfer.dropEffect===void 0)&&this.configuration.dragCanBePlacedBack){let q=m.currentTarget,v=this.draggables.get(q),I=v.index<v.parent.children.length?v.index:v.parent.children.length-1,b=v.parent,N=v.parent.children[I];b.insertBefore(q,N),this.saveResponse(),this.checkMaxMatchAssociations()}m.dataTransfer.dropEffect==="move"&&(this.saveResponse(),this.checkMaxMatchAssociations())})}))}handleDragOptionsChanged(l,c){this.dragDropApi.copyStylesDragClone=c.copyStylesDragClone,this.dragDropApi.dragOnClick=c.dragOnClick}handleDisabledChange(l,c){this.draggables.forEach((p,d)=>{c?d.setAttribute("disabled",""):d.removeAttribute("disabled"),c?d.removeAttribute("qti-draggable"):d.setAttribute("qti-draggable","true")})}handleReadonlyChange(l,c){this.draggables.forEach((p,d)=>{c?d.setAttribute("readonly",""):d.removeAttribute("readonly"),c?d.removeAttribute("qti-draggable"):d.setAttribute("qti-draggable","true")})}firstUpdated(l){super.firstUpdated(l),this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(t):this.querySelectorAll(t))}connectedCallback(){super.connectedCallback(),this.dragDropApi=new Ae,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}reset(l=!0){this.draggables.forEach((c,p)=>{let d=c.parent.children,m=c.index<d.length?c.index:d.length;c.parent.insertBefore(p,d[m])}),l&&this.saveResponse()}checkMaxMatchAssociations(){this.droppables.forEach(l=>{let p=+(l.getAttribute("match-max")||1)<=(l.children.length||0);p?l.setAttribute("disabled",""):l.removeAttribute("disabled"),p?l.removeAttribute("dropzone"):l.setAttribute("dropzone","move")})}set response(l){this.classList.contains("qti-match-tabular")||(this.reset(!1),l!==null&&Array.isArray(l)&&l.forEach(c=>{let[p,...d]=c.split(" ").reverse();if(p){let m=this.droppables.find(q=>q.getAttribute("identifier")===p);d.forEach(q=>{let v=this.querySelector(`[identifier=${q}]`);m?v?(m.appendChild(v),this.checkMaxMatchAssociations()):console.error(`cannot find draggable with identifier: ${q}`):console.error(`cannot find droppable with identifier: ${p}`)})}}))}validate(){let c=(e?Array.from(this.shadowRoot.querySelectorAll(t)):Array.from(this.querySelectorAll(t))).filter(p=>p.childElementCount>0).length;return this.minAssociations<=0||this.minAssociations<=c}saveResponse(){let l=this.droppables.map(c=>{var d;let p="";return((d=c.children)==null?void 0:d.length)>0&&(p+=Array.from(c.children).map(m=>m.getAttribute("identifier")).join(" ")+" "),p+=c.getAttribute("identifier"),p});this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:l}}))}}return s([qt(i)],r.prototype,"reInitDragAndDrop",1),s([j({type:String,attribute:"response-identifier"})],r.prototype,"responseIdentifier",2),s([j({attribute:!1,type:Object})],r.prototype,"configuration",2),s([g("configuration")],r.prototype,"handleDragOptionsChanged",1),s([j({type:Boolean,reflect:!0})],r.prototype,"disabled",2),s([g("disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",1),s([j({type:Boolean,reflect:!0})],r.prototype,"readonly",2),s([g("readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",1),s([j({type:Number,reflect:!0,attribute:"min-associations"})],r.prototype,"minAssociations",2),s([j({type:Number,reflect:!0,attribute:"max-associations"})],r.prototype,"maxAssociations",2),r};import{state as Vi}from"lit/decorators.js";var se=class extends M(Si,"qti-simple-associable-choice",!0,".dl"){render(){return Ht` <slot name="prompt"></slot>
|
|
174
|
+
</div>`}`}};customElements.define("qti-portable-custom-interaction",ht);import{LitElement as Si,css as Li,html as Ht}from"lit";var Ae=class a{constructor(){this._touchBegin=0;this._touchDown=null;this._lastClick=0;this._canDrag=!1;this._dragSrc=null;this._dragCopy=null;this._touchEndCalled=!1;this._dragRunning=!1;this._dataTransfer={data:{},setData:function(i,e){this.data[i]=e},getData:function(i){return this.data[i]},effectAllowed:"move"};this._copyOffset={x:0,y:0};this._lastTarget=null;this._currentDropContainer=null;this._handleClick=!0;this._DBLCLICKDELAY=500;this._CONTEXTMENUDELAY=1e3;this._DRAGDELTA=5;this._COPYOPACITY=.7;this.copyStylesDragClone=!0;this.dragOnClick=!1;this._createDragCopy=(i,e)=>{if(this._dragCopy===null&&this._dragRunning){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);let t=window.getComputedStyle(this._dragSrc);if(this._dragCopy.style="",this._dragCopy.setAttribute("dragclone",""),this.copyStylesDragClone)for(let r of t)this._dragCopy.style[r]=t.getPropertyValue(r);this._calculateDragCopyPosition(e),this._dragCopy.style.top=e.clientY-this._copyOffset.y+"px",this._dragCopy.style.left=e.clientX-this._copyOffset.x+"px",this._dragCopy.style.position="fixed",this._dragCopy.style.pointerEvents="none",this._dragCopy.style.zIndex="999999",this._dragCopy=document.body.appendChild(this._dragCopy),this._dispatchEvent(this._dragSrc,"dragstart")}if(this._dragRunning){let t=this;requestAnimationFrame(function(){t._touchEndCalled||t._dragCopy===null||(t._dragCopy.style.top=e.clientY-t._copyOffset.y+"px",t._dragCopy.style.left=e.clientX-t._copyOffset.x+"px")});let r=this._findDroppable(i);r!=this._lastTarget&&(this._dispatchEvent(r,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=r),this._currentDropContainer=r,this._currentDropContainer&&this._dispatchEvent(r,"dragover")}};return a._instance?a._instance:(a._instance=this,document.addEventListener("touchmove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("mousemove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchend",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("mouseup",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchcancel",this._touchCancel.bind(this),{passive:!1,capture:!1}),this)}addDraggables(i){i.forEach(e=>{e.addEventListener("touchstart",this._touchStart.bind(this),{passive:!1,capture:!1}),e.addEventListener("mousedown",this._touchStart.bind(this),{passive:!1,capture:!1})})}_touchStart(i){this._touchBegin=Date.now();let{x:e,y:t}=this._getPoint(i);if(this._touchDown={x:e,y:t},this._dragSrc=i.currentTarget,this._canDrag=!0,this.dragOnClick){let r={clientX:e,clientY:t};this._dragRunning=!0,this._createDragCopy(i,r)}i.preventDefault()}_touchMove(i){if(this._canDrag&&this._dragSrc){let{x:e,y:t}=this._getPoint(i),r={clientX:e,clientY:t};this._getDelta(r)>=this._DRAGDELTA&&(this._dragRunning=!0),this._createDragCopy(i,r),i.preventDefault()}}_touchEnd(i){var e;if(this._touchEndCalled=!0,this._canDrag=!1,this._currentDropContainer)this._dispatchEvent(this._currentDropContainer,"drop"),this._dispatchEvent(this._dragSrc,"dragend");else if(this._dragRunning){let t=new CustomEvent("dragend",{bubbles:!0,cancelable:!0});t.dataTransfer={dropEffect:"none"},(e=this._dragSrc)==null||e.dispatchEvent(t)}this._reset()}_touchCancel(i){this._reset()}_findDroppable(i){let e=this._getPoint(i);return this.elementFromPoint(e.x,e.y)}elementFromPoint(i,e){let t=document.elementFromPoint(i,e);if(t){for(;t.shadowRoot;){let r=t.shadowRoot.elementFromPoint(i,e);if(r===null||r===t)break;t=r}return t}return null}_getPoint(i,e){return i&&i.touches&&(i=i.touches[0]),{x:e?i.pageX:i.clientX,y:e?i.pageY:i.clientY}}_calculateDragCopyPosition(i){let e=this._dragSrc.getBoundingClientRect();this._copyOffset.x=i.clientX-e.left,this._copyOffset.y=i.clientY-e.top}_getDelta(i){let e=Math.abs(i.clientX-this._touchDown.x),t=Math.abs(i.clientY-this._touchDown.y);return e+t}_dispatchEvent(i,e,t=!0){if(!i)return!1;let r=new CustomEvent(e,{bubbles:t,cancelable:!0});return r.dataTransfer=this._dataTransfer,i.dispatchEvent(r),r.defaultPrevented}_reset(){this._dragRunning&&(this._dragSrc.style.opacity="1.0",this._dragCopy.parentElement.removeChild(this._dragCopy)),this._dragRunning=!1,this._dragSrc=null,this._dragCopy=null,this._canDrag=!1,this._touchBegin=0,this._touchDown=null,this._lastClick=0,this._touchEndCalled=!1,this._dataTransfer={data:{},setData:function(i,e){this.data[i]=e},getData:function(i){return this.data[i]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}};import{property as Ti}from"lit/decorators.js";var Mt=(a,i,e)=>{class t extends a{constructor(){super(...arguments);this.disabled=!1}firstUpdated(n){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(n);let l=Array.from(i?this.shadowRoot.querySelectorAll(e):this.querySelectorAll(e));this.dragoverHandler=this.dragoverHandler.bind(this),this.dragleaveHandler=this.dragleaveHandler.bind(this),this.dragenterHandler=this.dragenterHandler.bind(this),this.dropHandler=this.dropHandler.bind(this),l.forEach(c=>{c.setAttribute("dropzone","move"),c.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(c)});for(let c of l)this.observer=new MutationObserver(p=>{p.forEach(d=>{if(d.type==="attributes")switch(d.attributeName){case"disabled":{c.hasAttribute("disabled")?this.removeHandler(c):this.attachHandler(c);break}}})}),this.observer.observe(c,{attributes:!0})}attachHandler(n){n.addEventListener("dragover",this.dragoverHandler),n.addEventListener("dragenter",this.dragenterHandler),n.addEventListener("drop",this.dropHandler)}removeHandler(n){n.removeEventListener("dragover",this.dragoverHandler),n.removeEventListener("dragenter",this.dragenterHandler),n.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var n;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),(n=this.observer)==null||n.disconnect())}dragenterHandler(n){n.preventDefault()}dragoverHandler(n){return n.preventDefault(),n.currentTarget.setAttribute("active",""),n.dataTransfer.dropEffect="move",!1}dropHandler(n){n.preventDefault();let l=n.currentTarget,c=this.querySelector(`[identifier=${n.dataTransfer.getData("text")}`),p=c||this.shadowRoot.querySelector(`[identifier=${n.dataTransfer.getData("text")}`);return l?p.parentElement.getAttribute("identifier")!==l.getAttribute("identifier")&&l.appendChild(p):console.error(`cannot find droppable, target: ${n.target?JSON.stringify(n.target):"null"}`),l.removeAttribute("active"),!1}dragleaveHandler(n){return n.preventDefault(),n.currentTarget.removeAttribute("active"),n.dataTransfer.dropEffect="none",!1}}return s([Ti({type:Boolean,reflect:!0})],t.prototype,"disabled",2),t};var Nt=(a,i,e)=>{class t extends a{}return t};import{property as j}from"lit/decorators.js";var M=(a,i,e,t)=>{class r extends Nt(Mt(a,e,t),t,i){constructor(){super(...arguments);this.draggables=new Map;this.responseIdentifier="";this.configuration={copyStylesDragClone:!0,dragCanBePlacedBack:!0,dragOnClick:!1};this.disabled=!1;this.readonly=!1;this.minAssociations=1;this.maxAssociations=1}reInitDragAndDrop(l,c){if(this.classList.contains("qti-match-tabular"))return;l.filter(d=>!this.draggables||!this.draggables.get(d)).length>0&&(this.dragDropApi.addDraggables(l),l.forEach(d=>{this.draggables.set(d,{parent:d.parentElement,index:Array.from(d.parentNode.children).indexOf(d)}),d.setAttribute("qti-draggable","true"),d.addEventListener("dragstart",m=>{m.dataTransfer.setData("text",m.currentTarget.getAttribute("identifier")),d.setAttribute("dragging","")}),d.addEventListener("dragend",m=>{if(m.preventDefault(),d.removeAttribute("over"),d.removeAttribute("dragging"),(m.dataTransfer.dropEffect==="none"||m.dataTransfer.dropEffect===void 0)&&this.configuration.dragCanBePlacedBack){let C=m.currentTarget,v=this.draggables.get(C),I=v.index<v.parent.children.length?v.index:v.parent.children.length-1,b=v.parent,N=v.parent.children[I];b.insertBefore(C,N),this.saveResponse(),this.checkMaxMatchAssociations()}m.dataTransfer.dropEffect==="move"&&(this.saveResponse(),this.checkMaxMatchAssociations())})}))}handleDragOptionsChanged(l,c){this.dragDropApi.copyStylesDragClone=c.copyStylesDragClone,this.dragDropApi.dragOnClick=c.dragOnClick}handleDisabledChange(l,c){this.draggables.forEach((p,d)=>{c?d.setAttribute("disabled",""):d.removeAttribute("disabled"),c?d.removeAttribute("qti-draggable"):d.setAttribute("qti-draggable","true")})}handleReadonlyChange(l,c){this.draggables.forEach((p,d)=>{c?d.setAttribute("readonly",""):d.removeAttribute("readonly"),c?d.removeAttribute("qti-draggable"):d.setAttribute("qti-draggable","true")})}firstUpdated(l){super.firstUpdated(l),this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(t):this.querySelectorAll(t))}connectedCallback(){super.connectedCallback(),this.dragDropApi=new Ae,this.dispatchEvent(new CustomEvent("qti-register-interaction",{bubbles:!0,composed:!0,detail:this}))}reset(l=!0){this.draggables.forEach((c,p)=>{let d=c.parent.children,m=c.index<d.length?c.index:d.length;c.parent.insertBefore(p,d[m])}),l&&this.saveResponse()}checkMaxMatchAssociations(){this.droppables.forEach(l=>{let p=+(l.getAttribute("match-max")||1)<=(l.children.length||0);p?l.setAttribute("disabled",""):l.removeAttribute("disabled"),p?l.removeAttribute("dropzone"):l.setAttribute("dropzone","move")})}set response(l){this.classList.contains("qti-match-tabular")||(this.reset(!1),l!==null&&Array.isArray(l)&&l.forEach(c=>{let[p,...d]=c.split(" ").reverse();if(p){let m=this.droppables.find(C=>C.getAttribute("identifier")===p);d.forEach(C=>{let v=this.querySelector(`[identifier=${C}]`);m?v?(m.appendChild(v),this.checkMaxMatchAssociations()):console.error(`cannot find draggable with identifier: ${C}`):console.error(`cannot find droppable with identifier: ${p}`)})}}))}validate(){let c=(e?Array.from(this.shadowRoot.querySelectorAll(t)):Array.from(this.querySelectorAll(t))).filter(p=>p.childElementCount>0).length;return this.minAssociations<=0||this.minAssociations<=c}saveResponse(){let l=this.droppables.map(c=>{var d;let p="";return((d=c.children)==null?void 0:d.length)>0&&(p+=Array.from(c.children).map(m=>m.getAttribute("identifier")).join(" ")+" "),p+=c.getAttribute("identifier"),p});this.dispatchEvent(new CustomEvent("qti-interaction-response",{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,response:l}}))}}return s([Ct(i)],r.prototype,"reInitDragAndDrop",1),s([j({type:String,attribute:"response-identifier"})],r.prototype,"responseIdentifier",2),s([j({attribute:!1,type:Object})],r.prototype,"configuration",2),s([g("configuration")],r.prototype,"handleDragOptionsChanged",1),s([j({type:Boolean,reflect:!0})],r.prototype,"disabled",2),s([g("disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",1),s([j({type:Boolean,reflect:!0})],r.prototype,"readonly",2),s([g("readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",1),s([j({type:Number,reflect:!0,attribute:"min-associations"})],r.prototype,"minAssociations",2),s([j({type:Number,reflect:!0,attribute:"max-associations"})],r.prototype,"maxAssociations",2),r};import{state as Vi}from"lit/decorators.js";var se=class extends M(Si,"qti-simple-associable-choice",!0,".dl"){render(){return Ht` <slot name="prompt"></slot>
|
|
175
175
|
<slot name="qti-simple-associable-choice"></slot>
|
|
176
176
|
${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>Ht`<div part="associables-container">
|
|
177
177
|
<div name="left${t}" part="drop-list" class="dl" identifier="droplist${t}_left"></div>
|
|
@@ -185,8 +185,8 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
185
185
|
flex-wrap: wrap;
|
|
186
186
|
gap: 0.5rem;
|
|
187
187
|
}
|
|
188
|
-
`,s([Vi()],se.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",se);import{
|
|
189
|
-
<slot part="drops"></slot>`}};we.styles=[
|
|
188
|
+
`,s([Vi()],se.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",se);import{html as Mi}from"lit";import{customElement as Ni,property as $t}from"lit/decorators.js";var z=class extends f{constructor(){super(...arguments);this.countAttempt="true"}validate(){return!0}set response(e){}render(){return Mi`<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"}}))}};s([$t({type:String,attribute:"count-attempt"})],z.prototype,"countAttempt",2),s([$t({type:String})],z.prototype,"title",2),z=s([Ni("qti-end-attempt-interaction")],z);import{css as Hi,html as $i,LitElement as Di}from"lit";var we=class extends M(Di,"qti-gap-text",!1,"qti-gap"){render(){return $i` <slot part="drags" name="qti-gap-text"></slot>
|
|
189
|
+
<slot part="drops"></slot>`}};we.styles=[Hi`
|
|
190
190
|
:host {
|
|
191
191
|
display: flex;
|
|
192
192
|
align-items: flex-start;
|
|
@@ -209,14 +209,14 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
209
209
|
align-items: flex-start;
|
|
210
210
|
flex: 1;
|
|
211
211
|
}
|
|
212
|
-
`];customElements.define("qti-gap-match-interaction",we);import{css as
|
|
212
|
+
`];customElements.define("qti-gap-match-interaction",we);import{css as Oi,svg as Dt,html as Pi}from"lit";function W(a,i,e,t){switch(a){case"circle":{let[r,o,n]=i,l=r/e.width*100,c=o/e.height*100,p=n/e.width*100;t.style.left=l-p+"%",t.style.top=c-p+"%",t.style.width=t.style.height=4*p+"px",t.style.borderRadius="9999px"}break;case"rect":{let[r,o,n,l]=i,c=r/e.width*100,p=o/e.height*100,d=n/e.width*100,m=l/e.height*100;t.style.left=c+"%",t.style.top=p+"%",t.style.width=d-c+"%",t.style.height=m-p+"%"}break;case"poly":{let r=i.reduce((b,N,yt,Yt)=>{if(yt%2===1){let Bt=b.pop();b[b.length]={x:Bt,y:Yt[yt]}}else b.push(N);return b},[]),o=Math.min(...r.map(b=>b.x)),n=Math.max(...r.map(b=>b.x)),l=Math.min(...r.map(b=>b.y)),c=Math.max(...r.map(b=>b.y)),p=o/e.width*100,d=l/e.height*100,m=n/e.width*100,C=c/e.height*100;t.style.left=o/e.width*100+"%",t.style.top=l/e.height*100+"%",t.style.width=m-p+"%",t.style.height=C-d+"%";let I=r.map(b=>({x:(b.x-o)/(n-o)*100,y:(b.y-l)/(c-l)*100})).map(b=>Math.round(b.x)+"% "+Math.round(b.y)+"%").join(",");t.style.clipPath=`polygon(${I})`}break;default:break}}import{query as Ui,queryAssignedElements as Fi,state as ft}from"lit/decorators.js";import{repeat as Ii}from"lit/directives/repeat.js";import{ifDefined as Ot}from"lit/directives/if-defined.js";var H=class extends f{constructor(){super();this.startPoint=null;this.endPoint=null;this._lines=[];this.addEventListener("qti-register-hotspot",this.positionHotspotOnRegister)}reset(){this._lines=[]}validate(){return this._lines.length>0}set response(e){Array.isArray(e)&&(this._lines=e)}render(){var e,t,r,o;return Pi`<slot name="prompt"></slot>
|
|
213
213
|
<line-container>
|
|
214
214
|
<svg
|
|
215
|
-
width=${
|
|
216
|
-
height=${
|
|
215
|
+
width=${Ot((e=this.grImage[0])==null?void 0:e.width)}
|
|
216
|
+
height=${Ot((t=this.grImage[0])==null?void 0:t.height)}
|
|
217
217
|
viewbox="0 0 ${(r=this.grImage[0])==null?void 0:r.width} ${(o=this.grImage[0])==null?void 0:o.height}"
|
|
218
218
|
>
|
|
219
|
-
${
|
|
219
|
+
${Ii(this._lines,n=>n,(n,l)=>Dt`
|
|
220
220
|
<line
|
|
221
221
|
part="line"
|
|
222
222
|
x1=${parseInt(this.querySelector("[identifier="+n.split(" ")[0]+"]").style.left)}
|
|
@@ -228,7 +228,7 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
228
228
|
@click=${c=>{c.stopPropagation(),this._lines=this._lines.filter((p,d)=>d!==l),this.saveResponse(this._lines)}}
|
|
229
229
|
/>
|
|
230
230
|
`)}
|
|
231
|
-
${this.startPoint
|
|
231
|
+
${this.startPoint&&Dt`<line
|
|
232
232
|
part="point"
|
|
233
233
|
x1=${this.startCoord.x}
|
|
234
234
|
y1=${this.startCoord.y}
|
|
@@ -239,7 +239,7 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
239
239
|
/>`}
|
|
240
240
|
</svg>
|
|
241
241
|
<slot></slot>
|
|
242
|
-
</line-container>`}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,o=r.getAttribute("coords"),n=r.getAttribute("shape"),l=o.split(",").map(c=>parseInt(c));
|
|
242
|
+
</line-container>`}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,o=r.getAttribute("coords"),n=r.getAttribute("shape"),l=o.split(",").map(c=>parseInt(c));W(n,l,t,r)}firstUpdated(e){super.firstUpdated(e),this.hotspots=document.querySelectorAll("qti-associable-hotspot"),document.addEventListener("mousemove",t=>{this.mouseCoord={x:t.clientX-this.grImage[0].getBoundingClientRect().left,y:t.clientY-this.grImage[0].getBoundingClientRect().top}}),this.hotspots.forEach(t=>{t.style.left=t.getAttribute("coords").split(",")[0]+"px",t.style.top=t.getAttribute("coords").split(",")[1]+"px",t.addEventListener("click",r=>{this.startPoint?this.endPoint||(this.endPoint=r.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=r.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)}};H.styles=[Oi`
|
|
243
243
|
slot:not([name='prompt']) {
|
|
244
244
|
// position: relative; /* qti-hotspot-choice relative to the slot */
|
|
245
245
|
display: block;
|
|
@@ -262,8 +262,8 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
262
262
|
top: 0px;
|
|
263
263
|
left: 0px;
|
|
264
264
|
}
|
|
265
|
-
`],s([ft()],H.prototype,"_lines",2),s([ft()],H.prototype,"startCoord",2),s([ft()],H.prototype,"mouseCoord",2),s([
|
|
266
|
-
<slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(i){let e=this.querySelector("img"),t=i.target,r=t.getAttribute("coords"),o=t.getAttribute("shape"),n=r.split(",").map(l=>parseInt(l));switch(o){case"circle":{let[l,c,p]=n;t.style.left=l-p+"px",t.style.top=c-p+"px",t.style.width=t.style.height=2*p+"px"}break;case"rect":{let[l,c,p,d]=n;t.style.left=l+"px",t.style.top=c+"px",t.style.width=p-l+"px",t.style.height=d-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)}};Re.styles=
|
|
265
|
+
`],s([ft()],H.prototype,"_lines",2),s([ft()],H.prototype,"startCoord",2),s([ft()],H.prototype,"mouseCoord",2),s([Ui("svg")],H.prototype,"svgContainer",2),s([Fi({selector:"img"})],H.prototype,"grImage",2);customElements.define("qti-graphic-associate-interaction",H);import{css as Xi,html as Yi,LitElement as Bi}from"lit";var Re=class extends M(Bi,"qti-gap-img",!1,"qti-associable-hotspot"){render(){return Yi` <slot></slot>
|
|
266
|
+
<slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(i){let e=this.querySelector("img"),t=i.target,r=t.getAttribute("coords"),o=t.getAttribute("shape"),n=r.split(",").map(l=>parseInt(l));switch(o){case"circle":{let[l,c,p]=n;t.style.left=l-p+"px",t.style.top=c-p+"px",t.style.width=t.style.height=2*p+"px"}break;case"rect":{let[l,c,p,d]=n;t.style.left=l+"px",t.style.top=c+"px",t.style.width=p-l+"px",t.style.height=d-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)}};Re.styles=Xi`
|
|
267
267
|
:host {
|
|
268
268
|
display: inline-block;
|
|
269
269
|
position: relative;
|
|
@@ -272,12 +272,12 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
272
272
|
display: flex;
|
|
273
273
|
gap: 1rem;
|
|
274
274
|
}
|
|
275
|
-
`;customElements.define("qti-graphic-gap-match-interaction",Re);import{css as
|
|
275
|
+
`;customElements.define("qti-graphic-gap-match-interaction",Re);import{css as Ki,html as ji}from"lit";var Te=class extends y{render(){return ji`
|
|
276
276
|
<slot name="prompt"></slot>
|
|
277
277
|
<!-- slot for the prompt -->
|
|
278
278
|
<slot></slot>
|
|
279
279
|
<!-- slot for the image and hotspots -->
|
|
280
|
-
`}setHotspotOrder(e){let{identifier:t}=e.detail,r=this._choiceElements.find(n=>n.getAttribute("identifier")===t),o=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){if(this._choiceElements.filter(n=>n.order>0).length>=o){this.choiceOrdering=!1;return}r.order=this._choiceElements.filter(n=>!!n.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(n=>(n.order>n.order&&n.order--,n)),r.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,o=r.getAttribute("coords"),n=r.getAttribute("shape"),l=o.split(",").map(c=>parseInt(c));
|
|
280
|
+
`}setHotspotOrder(e){let{identifier:t}=e.detail,r=this._choiceElements.find(n=>n.getAttribute("identifier")===t),o=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,r.order==null){if(this._choiceElements.filter(n=>n.order>0).length>=o){this.choiceOrdering=!1;return}r.order=this._choiceElements.filter(n=>!!n.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(n=>(n.order>n.order&&n.order--,n)),r.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let t=this.querySelector("img"),r=e.target,o=r.getAttribute("coords"),n=r.getAttribute("shape"),l=o.split(",").map(c=>parseInt(c));W(n,l,t,r)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this.setHotspotOrder),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this.setHotspotOrder),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};Te.styles=[Ki`
|
|
281
281
|
slot:not([name='prompt']) {
|
|
282
282
|
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
283
283
|
display: block;
|
|
@@ -288,12 +288,12 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
288
288
|
pointer-events: none;
|
|
289
289
|
user-select: none;
|
|
290
290
|
}
|
|
291
|
-
`];customElements.define("qti-graphic-order-interaction",Te);import{css as
|
|
291
|
+
`];customElements.define("qti-graphic-order-interaction",Te);import{css as zi,html as Wi}from"lit";var Se=class extends y{render(){return Wi`
|
|
292
292
|
<slot name="prompt"></slot>
|
|
293
293
|
<!-- slot for the prompt -->
|
|
294
294
|
<slot></slot>
|
|
295
295
|
<!-- slot for the image and hotspots -->
|
|
296
|
-
`}positionHotspotOnRegister(i){let e=this.querySelector("img"),t=i.target,r=t.getAttribute("coords"),o=t.getAttribute("shape"),n=r.split(",").map(l=>parseInt(l));
|
|
296
|
+
`}positionHotspotOnRegister(i){let e=this.querySelector("img"),t=i.target,r=t.getAttribute("coords"),o=t.getAttribute("shape"),n=r.split(",").map(l=>parseInt(l));W(o,n,e,t)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};Se.styles=[zi`
|
|
297
297
|
slot:not([name='prompt']) {
|
|
298
298
|
position: relative; /* qti-hotspot-choice relative to the slot */
|
|
299
299
|
display: block;
|
|
@@ -305,18 +305,18 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
305
305
|
user-select: none;
|
|
306
306
|
/* width:100%; */
|
|
307
307
|
}
|
|
308
|
-
`];customElements.define("qti-hotspot-interaction",Se);import{html as oe,LitElement as
|
|
308
|
+
`];customElements.define("qti-hotspot-interaction",Se);import{html as oe,LitElement as Gi}from"lit";import{html as Ji,LitElement as Zi}from"lit";var bt=class extends Zi{connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return Ji`
|
|
309
309
|
<slot></slot>
|
|
310
310
|
<slot name="qti-simple-associable-choice"></slot>
|
|
311
|
-
`}};customElements.define("qti-simple-associable-choice",bt);import{property as
|
|
311
|
+
`}};customElements.define("qti-simple-associable-choice",bt);import{property as Qi,state as es}from"lit/decorators.js";import{unsafeHTML as Pt}from"lit/directives/unsafe-html.js";var J=class extends M(Gi,"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.response=[];this.responseIdentifier=""}connectedCallback(){super.connectedCallback(),this.rows=Array.from(this.querySelectorAll("qti-simple-match-set:first-of-type qti-simple-associable-choice")),this.cols=Array.from(this.querySelectorAll("qti-simple-match-set:last-of-type qti-simple-associable-choice")),this.response=[]}render(){return this.classList.contains("qti-match-tabular")?oe`
|
|
312
312
|
<slot name="prompt"></slot>
|
|
313
313
|
<table>
|
|
314
314
|
<tr>
|
|
315
315
|
<td></td>
|
|
316
|
-
${this.cols.map((e,t)=>oe`<th part="r-header">${
|
|
316
|
+
${this.cols.map((e,t)=>oe`<th part="r-header">${Pt(e.innerHTML)}</th>`)}
|
|
317
317
|
</tr>
|
|
318
318
|
${this.rows.map((e,t)=>oe`<tr>
|
|
319
|
-
<td part="c-header">${
|
|
319
|
+
<td part="c-header">${Pt(e.innerHTML)}</td>
|
|
320
320
|
${this.cols.map((r,o)=>{let n=`${e.getAttribute("identifier")} ${r.getAttribute("identifier")}`;return oe`<td>
|
|
321
321
|
<input
|
|
322
322
|
type="checkbox"
|
|
@@ -327,14 +327,14 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
327
327
|
</td>`})}
|
|
328
328
|
</tr>`)}
|
|
329
329
|
</table>
|
|
330
|
-
`:oe`<slot name="prompt"></slot> <slot></slot>`}};
|
|
331
|
-
<slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this.value++,this.saveResponse(this.value.toString())})}};Le.styles=[
|
|
330
|
+
`:oe`<slot name="prompt"></slot> <slot></slot>`}};J.styles=[],s([es()],J.prototype,"response",2),s([Qi({type:String,attribute:"response-identifier"})],J.prototype,"responseIdentifier",2);customElements.define("qti-match-interaction",J);import{css as ts,html as rs}from"lit";var Le=class extends f{constructor(){super();this.value=0}reset(){}validate(){return!0}set response(e){}static get properties(){return q(h({},f.properties),{step:{type:Number,attribute:"step",default:10}})}render(){return rs` <slot name="prompt"></slot>
|
|
331
|
+
<slot></slot>`}connectedCallback(){super.connectedCallback();let e=this.querySelector("audio")||this.querySelector("video")||this.querySelector("object");e&&e.addEventListener("ended",()=>{this.value++,this.saveResponse(this.value.toString())})}};Le.styles=[ts``];customElements.define("qti-media-interaction",Le);import{css as is,html as Ut,LitElement as ss}from"lit";import{property as os}from"lit/decorators.js";var Z=class extends M(ss,"qti-simple-choice",!0,"drop-list"){render(){return Ut` <slot name="prompt"> </slot>
|
|
332
332
|
<div part="container">
|
|
333
333
|
<slot part="drags"> </slot>
|
|
334
334
|
<div part="drops">
|
|
335
|
-
${Array.from(this.querySelectorAll("qti-simple-choice")).map((e,t)=>
|
|
335
|
+
${Array.from(this.querySelectorAll("qti-simple-choice")).map((e,t)=>Ut`<drop-list part="drop-list" identifier="droplist${t}"></drop-list>`)}
|
|
336
336
|
</div>
|
|
337
|
-
</div>`}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(e=>e.setAttribute("part","qti-simple-choice"))}};
|
|
337
|
+
</div>`}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(e=>e.setAttribute("part","qti-simple-choice"))}};Z.layoutClass=["qti-choices-top","qti-choices-bottom","qti-choices-left","qti-choices-right"],Z.styles=[is`
|
|
338
338
|
[part='drags'] {
|
|
339
339
|
display: flex;
|
|
340
340
|
align-items: flex-start;
|
|
@@ -382,7 +382,7 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
382
382
|
:host(.qti-choices-right) [part='container'] {
|
|
383
383
|
flex-direction: row-reverse;
|
|
384
384
|
}
|
|
385
|
-
`],s([
|
|
385
|
+
`],s([os({type:String})],Z.prototype,"orientation",2);customElements.define("qti-order-interaction",Z);import{LitElement as ns,css as as,html as ls}from"lit";var Ve=class extends ns{render(){return ls`<slot></slot>`}};Ve.styles=[as`
|
|
386
386
|
:host {
|
|
387
387
|
display: block;
|
|
388
388
|
}
|
|
@@ -393,23 +393,23 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
393
393
|
left: 50%;
|
|
394
394
|
transform: translateX(-50%);
|
|
395
395
|
}
|
|
396
|
-
`];customElements.define("qti-position-object-interaction",Ve);import{LitElement as
|
|
396
|
+
`];customElements.define("qti-position-object-interaction",Ve);import{LitElement as cs,css as ps,html as ds}from"lit";var Me=class extends cs{constructor(){super();this.removeMoveListener=this.removeMoveListener.bind(this),this.dragElementHandler=this.dragElementHandler.bind(this)}render(){return ds`<slot></slot>`}dragElementHandler(e){e.preventDefault();let t=e.clientX-this.startX,r=e.clientY-this.startY;this.dragElement.style.left=this.dragElement.offsetLeft+t+"px",this.dragElement.style.top=this.dragElement.offsetTop+r+"px",this.startX=e.clientX,this.startY=e.clientY}firstUpdated(e){super.firstUpdated(e),this.dragElement=this.querySelector("qti-position-object-interaction>img"),this.startX=0,this.startY=0,this.dragElement.addEventListener("mousedown",t=>{this.startX=t.clientX,this.startY=t.clientY,document.addEventListener("mousemove",this.dragElementHandler,!0)}),document.addEventListener("mouseup",this.removeMoveListener)}removeMoveListener(e){document.removeEventListener("mousemove",this.dragElementHandler,!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousemove",this.dragElementHandler),document.removeEventListener("mouseup",this.removeMoveListener)}};Me.styles=[ps`
|
|
397
397
|
:host {
|
|
398
398
|
display: inline-block;
|
|
399
399
|
position: relative;
|
|
400
400
|
}
|
|
401
|
-
`];customElements.define("qti-position-object-stage",Me);import{css as
|
|
401
|
+
`];customElements.define("qti-position-object-stage",Me);import{css as us,html as Ft}from"lit";import{property as It,state as ms}from"lit/decorators.js";import{repeat as hs}from"lit/directives/repeat.js";import{styleMap as fs}from"lit/directives/style-map.js";var F=class extends f{constructor(){super(...arguments);this.maxChoices=0;this.minChoices=0;this._points=[]}render(){return Ft` <slot name="prompt"></slot>
|
|
402
402
|
<point-container>
|
|
403
|
-
${
|
|
403
|
+
${hs(this._points,e=>e,(e,t)=>Ft`
|
|
404
404
|
<button
|
|
405
405
|
part="point"
|
|
406
|
-
style=${
|
|
406
|
+
style=${fs({position:"absolute",transform:"translate(-50%, -50%)",left:`${e.split(" ")[0]}px`,top:`${e.split(" ")[1]}px`})}
|
|
407
407
|
aria-label="Remove point at ${e}"
|
|
408
408
|
@click=${r=>{r.stopPropagation(),this._points=this._points.filter((o,n)=>n!==t),this.saveResponse(this._points)}}
|
|
409
409
|
></button>
|
|
410
410
|
`)}
|
|
411
411
|
<slot></slot>
|
|
412
|
-
</point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set response(e){this._points=Array.isArray(e)?e:[e]}connectedCallback(){super.connectedCallback(),this.querySelector("img").addEventListener("click",t=>{let r=t.offsetX,o=t.offsetY;this._points=[...this._points,r+" "+o],this.saveResponse(this._points)})}disconnectedCallback(){super.disconnectedCallback()}};F.styles=[
|
|
412
|
+
</point-container>`}reset(){this._points=[]}validate(){return this._points.length>=this.minChoices&&this._points.length<=this.maxChoices}set response(e){this._points=Array.isArray(e)?e:[e]}connectedCallback(){super.connectedCallback(),this.querySelector("img").addEventListener("click",t=>{let r=t.offsetX,o=t.offsetY;this._points=[...this._points,r+" "+o],this.saveResponse(this._points)})}disconnectedCallback(){super.disconnectedCallback()}};F.styles=[us`
|
|
413
413
|
:host {
|
|
414
414
|
display: block;
|
|
415
415
|
}
|
|
@@ -417,7 +417,7 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
417
417
|
display: block;
|
|
418
418
|
position: relative;
|
|
419
419
|
}
|
|
420
|
-
`],s([
|
|
420
|
+
`],s([It({type:Number,attribute:"max-choices"})],F.prototype,"maxChoices",2),s([It({type:Number,attribute:"min-choices"})],F.prototype,"minChoices",2),s([ms()],F.prototype,"_points",2);customElements.define("qti-select-point-interaction",F);import{css as bs,html as Ne,nothing as gt}from"lit";import{property as G,query as Xt}from"lit/decorators.js";var E=class extends f{constructor(){super();this.stepLabel=!1;this.reverse=!1;this._handleDisabledChange=(e,t)=>{};this._handleReadonlyChange=(e,t)=>{};this.csLive=getComputedStyle(this)}set min(e){this._min=e,this.value=e,this.style.setProperty("--min",`${this._min}`)}get min(){return this._min}set max(e){this._max=e,this.style.setProperty("--max",`${this._max}`)}get max(){return this._max}set step(e){this._step=e,this.style.setProperty("--step",`${this._step}`)}get step(){return this._step}reset(){}validate(){return!0}set response(e){if(Array.isArray(e)){console.error("QtiSliderInteraction: response is an array, but should be a single value");return}let t=parseInt(e);if(Number.isNaN(t)){console.error("QtiSliderInteraction: response is not a number");return}this.value=t}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()),Ne`<slot name="prompt"></slot>
|
|
421
421
|
<div id="slider" part="slider">
|
|
422
422
|
${this.csLive.getPropertyValue("--show-bounds")=="true"?Ne`<div id="bounds" part="bounds">
|
|
423
423
|
<div>${this._min}</div>
|
|
@@ -429,17 +429,17 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
429
429
|
${this.csLive.getPropertyValue("--show-value")=="true"?Ne`<div id="value" part="value">${this.value}</div>`:gt}
|
|
430
430
|
</div>
|
|
431
431
|
</div>
|
|
432
|
-
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let t=l=>{let{x:c}=this.getPositionFromEvent(l),p=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(p),l.stopPropagation()},r=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",r),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",t),document.addEventListener("touchend",r);let{x:o}=this.getPositionFromEvent(e),n=o-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.stopPropagation()}_onMouseDown(e){let t=n=>{let l=n.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),n.preventDefault(),n.stopPropagation()},r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r);let o=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.preventDefault(),e.stopPropagation()}calculateValue(e){let t=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,r=this.min+Math.round((t-this.min)/this._step)*this._step;this.value=r}getPositionFromEvent(e){let t;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let r=typeof e.originalEvent=="undefined"?e:e.originalEvent,o=r.touches[0]||r.changedTouches[0];t={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")&&(t={x:e.clientX,y:e.clientY});return t}};E.styles=[
|
|
432
|
+
</div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let t=l=>{let{x:c}=this.getPositionFromEvent(l),p=c-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(p),l.stopPropagation()},r=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",r),this.saveResponse(this.value.toString())};document.addEventListener("touchmove",t),document.addEventListener("touchend",r);let{x:o}=this.getPositionFromEvent(e),n=o-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.stopPropagation()}_onMouseDown(e){let t=n=>{let l=n.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),n.preventDefault(),n.stopPropagation()},r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r),this.saveResponse(this.value.toString())};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r);let o=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),e.preventDefault(),e.stopPropagation()}calculateValue(e){let t=this.min+(this.max-this.min)*e/this._rail.getBoundingClientRect().width,r=this.min+Math.round((t-this.min)/this._step)*this._step;this.value=r}getPositionFromEvent(e){let t;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let r=typeof e.originalEvent=="undefined"?e:e.originalEvent,o=r.touches[0]||r.changedTouches[0];t={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")&&(t={x:e.clientX,y:e.clientY});return t}};E.styles=[bs``],s([Xt("#knob")],E.prototype,"_knob",2),s([Xt("#rail")],E.prototype,"_rail",2),s([G({type:Number})],E.prototype,"value",2),s([G({type:Boolean,attribute:"step-label"})],E.prototype,"stepLabel",2),s([G({type:Boolean})],E.prototype,"reverse",2),s([G({type:Number,attribute:"lower-bound"})],E.prototype,"min",1),s([G({type:Number,attribute:"upper-bound"})],E.prototype,"max",1),s([G({type:Number,attribute:"step"})],E.prototype,"step",1),s([g("disabled",{waitUntilFirstUpdate:!0})],E.prototype,"_handleDisabledChange",2),s([g("readonly",{waitUntilFirstUpdate:!0})],E.prototype,"_handleReadonlyChange",2);customElements.define("qti-slider-interaction",E);import{consume as gs}from"@lit/context";import{html as vs,LitElement as ys}from"lit";import{customElement as xs,state as Es}from"lit/decorators.js";var ne=class extends ys{render(){return vs`<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(e){var r,o,n;let t=Array.from((o=(r=this.firstElementChild)==null?void 0:r.childNodes)!=null?o:[]).find(l=>l.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","fn","item",(n=t.textContent)!=null?n:"")}catch(l){console.error("custom-operator contains invalid javascript code",l)}}calculate(){let e={variable:r=>{var o,n,l;return(l=(n=(o=this._context)==null?void 0:o.variables.find(c=>c.identifier===r))==null?void 0:n.value)!=null?l:""},correct:r=>{var o,n,l;return(l=(n=(o=this._context)==null?void 0:o.variables.find(c=>c.identifier===r))==null?void 0:n.correctResponse)!=null?l:""}},t={getVariable:r=>{var o;return(o=this._context)==null?void 0:o.variables.find(n=>n.identifier===r)},updateOutcomeVariable:(r,o)=>{this.dispatchEvent(new CustomEvent("qti-set-outcome-value",{bubbles:!0,composed:!0,detail:{outcomeIdentifier:r,value:o}}))}};return this.operatorFunction(this._context,e,t)}};s([gs({context:T,subscribe:!0}),Es()],ne.prototype,"_context",2),ne=s([xs("qti-custom-operator")],ne);import{LitElement as Cs,css as qs,html as _s}from"lit";var He=class extends Cs{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return _s` <slot name="qti-gap-img"></slot> `}};He.styles=qs`
|
|
433
433
|
:host {
|
|
434
434
|
position: absolute;
|
|
435
435
|
}
|
|
436
|
-
`;customElements.define("qti-associable-hotspot",He);import{html as
|
|
436
|
+
`;customElements.define("qti-associable-hotspot",He);import{html as ks,LitElement as As}from"lit";import{property as ws}from"lit/decorators.js";var $e=class extends As{constructor(){super(...arguments);this.tabindex=0}render(){return ks` <slot name="qti-gap-text"></slot>`}};s([ws({type:Number,reflect:!0})],$e.prototype,"tabindex",2);customElements.define("qti-gap",$e);import{LitElement as Rs}from"lit";import{property as Ts}from"lit/decorators.js";var De=class extends Rs{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","qti-gap-img")}};s([Ts({type:Number,reflect:!0})],De.prototype,"tabindex",2);customElements.define("qti-gap-img",De);import{html as Ss,LitElement as Ls}from"lit";import{property as Vs}from"lit/decorators.js";var Oe=class extends Ls{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-gap-text")}render(){return Ss`<slot></slot>`}};s([Vs({type:Number,reflect:!0})],Oe.prototype,"tabindex",2);customElements.define("qti-gap-text",Oe);import{css as Ms}from"lit";import{property as Ns}from"lit/decorators.js";var ae=class extends x{};ae.styles=Ms`
|
|
437
437
|
:host {
|
|
438
438
|
position: absolute;
|
|
439
439
|
}
|
|
440
|
-
`,s([
|
|
441
|
-
<slot></slot> `}};Pe=s([
|
|
442
|
-
<slot part="slot"></slot> `}};
|
|
440
|
+
`,s([Ns({attribute:"aria-ordervalue",type:Number,reflect:!0})],ae.prototype,"order",2);customElements.define("qti-hotspot-choice",ae);import{customElement as Hs}from"lit/decorators.js";import{html as $s}from"lit";var Pe=class extends x{render(){return $s`<div part="ch"><div part="cha"></div></div>
|
|
441
|
+
<slot></slot> `}};Pe=s([Hs("qti-hottext")],Pe);import{LitElement as Ds}from"lit";var vt=class extends Ds{};customElements.define("qti-inline-choice",vt);import{customElement as Os}from"lit/decorators.js";import{css as Ps,html as Us}from"lit";var le=class extends x{render(){return Us`<div part="ch"><div part="cha"></div></div>
|
|
442
|
+
<slot part="slot"></slot> `}};le.styles=Ps`
|
|
443
443
|
:host {
|
|
444
444
|
display: flex;
|
|
445
445
|
}
|
|
@@ -447,4 +447,4 @@ import{a as h,b as C,c as s}from"../chunk-BKTGSVMP.js";import{provide as jt}from
|
|
|
447
447
|
width: 100%;
|
|
448
448
|
display: block;
|
|
449
449
|
}
|
|
450
|
-
`,
|
|
450
|
+
`,le=s([Os("qti-simple-choice")],le);console.log("%cC\xBFTO%cLab%c: qti-components loaded","font-weight:bold; color:green",'font-family: "PT Sans", font-weight:bold; color:green; font-size: smaller;vertical-align: sub',"font-weight:unset");export{f as Interaction,ie as QtPrintedVariable,xe as QtiAnd,_ as QtiAssessmentItem,He as QtiAssociableHotspot,se as QtiAssociateInteraction,Ee as QtiBaseValue,x as QtiChoice,B as QtiChoiceInteraction,pe as QtiCompanionMaterialsInfo,w as QtiConditionExpression,Ze as QtiContains,de as QtiContentBody,Ge as QtiCorrect,ne as QtiCustomOperator,z as QtiEndAttemptInteraction,qe as QtiEqual,Ce as QtiEqualRounded,u as QtiExpression,L as QtiExtendedTextInteraction,he as QtiFeedbackBlock,fe as QtiFeedbackInline,$e as QtiGap,De as QtiGapImg,we as QtiGapMatchInteraction,Oe as QtiGapText,H as QtiGraphicAssociateInteraction,Re as QtiGraphicGapMatchInteraction,Te as QtiGraphicOrderInteraction,Qe as QtiGt,et as QtiGte,ae as QtiHotspotChoice,Se as QtiHotspotInteraction,Pe as QtiHottext,je as QtiHottextInteraction,vt as QtiInlineChoice,P as QtiInlineChoiceInteraction,tt as QtiIsNull,ye as QtiLookupOutcomeValue,rt as QtiLt,it as QtiLte,_e as QtiMapResponse,K as QtiMapping,ot as QtiMatch,J as QtiMatchInteraction,Le as QtiMediaInteraction,nt as QtiMember,be as QtiModalFeedback,at as QtiMultiple,lt as QtiNot,ct as QtiOr,Z as QtiOrderInteraction,pt as QtiOrdered,$ as QtiOutcomeDeclaration,ht as QtiPortableCustomInteraction,Me as QtiPositionObjectStage,dt as QtiProduct,ce as QtiPrompt,ze as QtiResponseCondition,D as QtiResponseDeclaration,te as QtiResponseElse,Je as QtiResponseElseIf,re as QtiResponseIf,U as QtiResponseProcessing,S as QtiRubricBlock,V as QtiRule,Ve as QtiSPositionObjectInteraction,F as QtiSelectPointInteraction,We as QtiSetOutcomeValue,bt as QtiSimpleAssociableChoice,le as QtiSimpleChoice,E as QtiSliderInteraction,ke as QtiStringMatch,Ue as QtiStylesheet,ut as QtiSum,A as QtiTextEntryInteraction,mt as QtiVariable,T as itemContext,xt as itemContextVariables,fi as qtiAndMixin};
|