@citolab/qti-components 6.0.22 → 6.0.24

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.
Files changed (37) hide show
  1. package/dist/chunk-BVYXUE3V.js +1 -0
  2. package/dist/chunk-C4C24R3I.cjs +1 -0
  3. package/dist/chunk-NT6UB5QT.cjs +17 -0
  4. package/dist/chunk-RGNNQ7CN.js +17 -0
  5. package/dist/{chunk-YDFMBQT4.js → chunk-WFE4NR22.js} +28 -6
  6. package/dist/{chunk-GEVRCVN2.cjs → chunk-XHNCXKJ6.cjs} +28 -6
  7. package/dist/custom-elements.json +6817 -0
  8. package/dist/decorators/index.cjs +1 -1
  9. package/dist/decorators/index.js +1 -1
  10. package/dist/index.cjs +84 -62
  11. package/dist/index.css +2215 -0
  12. package/dist/index.d.cts +30 -50
  13. package/dist/index.d.ts +30 -50
  14. package/dist/index.js +76 -54
  15. package/dist/qti-components/index.cjs +21 -21
  16. package/dist/qti-components/index.d.cts +11 -11
  17. package/dist/qti-components/index.d.ts +11 -11
  18. package/dist/qti-components/index.js +57 -57
  19. package/dist/qti-item/index.cjs +1 -1
  20. package/dist/qti-item/index.d.cts +1 -2
  21. package/dist/qti-item/index.d.ts +1 -2
  22. package/dist/qti-item/index.js +1 -1
  23. package/dist/qti-item-395a9535.d.ts +19 -0
  24. package/dist/qti-item-react/index.cjs +1 -1
  25. package/dist/qti-item-react/index.d.cts +7 -15
  26. package/dist/qti-item-react/index.d.ts +7 -15
  27. package/dist/qti-item-react/index.js +1 -1
  28. package/dist/{qti-simple-choice-e28cfb34.d.ts → qti-simple-choice-6d581309.d.ts} +109 -5
  29. package/dist/qti-transform/index.cjs +1 -17
  30. package/dist/qti-transform/index.js +1 -17
  31. package/package.json +3 -4
  32. package/dist/chunk-3O4URV5U.cjs +0 -1
  33. package/dist/chunk-6RJ7J4AE.cjs +0 -1
  34. package/dist/chunk-M7QOVOG6.js +0 -1
  35. package/dist/chunk-WFLR5TH7.js +0 -1
  36. package/dist/qti-assessment-item-c1eb7de3.d.ts +0 -121
  37. package/dist/qti-item-e2edd87f.d.ts +0 -30
@@ -1,20 +1,20 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6RJ7J4AEcjs = require('../chunk-6RJ7J4AE.cjs');var _chunkGGEPFBR7cjs = require('../chunk-GGEPFBR7.cjs');var _chunk3O4URV5Ucjs = require('../chunk-3O4URV5U.cjs');var _chunkHOQW4KDAcjs = require('../chunk-HOQW4KDA.cjs');var bt={};var gt={};var vt={};var yt={};var xt={};var Et={};var qt={};var Ct={};var _t={};var kt={ON_OUTCOME_CHANGED:"qti-outcome-changed",ON_INTERACTION_CHANGED:"on-interaction-changed",ON_REGISTER_VARIABLE:"on-register-variable",ON_REGISTER_FEEDBACK:"on-register-feedback",ON_REGISTER_INTERACTION:"on-register-interaction",ON_REGISTER_CHOICE:"on-register-choice",ON_REGISTER_HOTSPOT:"on-register-hotspot",ON_LOOSE_CHOICE:"on-loose-choice",ON_INTERACTION_RESPONSE:"on-interaction-response",ON_DROPDOWN_SELECTED:"on-dropdown-selected",ON_CHOICE_ELEMENT_SELECTED:"choice-element-selected"};var H=class{constructor({mapping:i,correctResponse:e,cardinality:t,baseType:r,identifier:o}){this._basetype="string";this._mapping=i,this._correctResponse=e,this._cardinality=t,this._basetype=r,this._identifier=o}get mapping(){return this._mapping}get correctResponse(){return this._correctResponse}get cardinality(){return this._cardinality}get baseType(){return this._basetype}get identifier(){return this._identifier}get value(){return this._candidateResponse}set value(i){this._candidateResponse=i}};var O=class{constructor(){this.value=void 0}};var _decoratorsjs = require('lit/decorators.js');var _lit = require('lit');var k=class extends _lit.LitElement{constructor(){super();this.variables=[];this.feedbackElements=[];this.interactionElements=[];this._handleDisabledChange=(e,t)=>{this.interactionElements.forEach(r=>r.disabled=t)};this._handleReadonlyChange=(e,t)=>this.interactionElements.forEach(r=>r.readonly=t);this.addEventListener("qti-register-variable",this._registerVariable),this.addEventListener("qti-register-feedback",this.registerFeedbackElement),this.addEventListener("qti-register-interaction",this.registerInteractionElement),this.addEventListener("qti-outcome-changed",this.outcomeChanged),this.addEventListener("qti-interaction-response",this.interactionResponse)}render(){return _lit.html`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-item-connected",{bubbles:!0,composed:!0,detail:{identifier:this.identifier}}))}disconnectedCallback(){this.removeEventListener("qti-register-variable",this._registerVariable),this.removeEventListener("qti-register-feedback",this.registerFeedbackElement),this.removeEventListener("qti-register-interaction",this.registerInteractionElement),this.removeEventListener("qti-outcome-changed",this.outcomeChanged),this.removeEventListener("qti-interaction-response",this.interactionResponse)}_registerVariable(e){this.variables.push(e.detail.variable)}showCorrectResponse(){let e=this.variables.filter(t=>"correctResponse"in t);this.responses=e.map(t=>({responseIdentifier:t.identifier,response:t.correctResponse}))}processResponse(){let e=this.querySelector("qti-response-processing");return e?e.process?(e.process(),!0):(console.info("Client side response webcomponents not available"),!1):(console.info("Client side response processing template not available"),!1)}set responses(e){if(e)for(let t of e){let r=this.interactionElements.find(a=>a.getAttribute("response-identifier")===t.responseIdentifier),o=this.getResponse(t.responseIdentifier);o&&(o.value=t.response),r&&(r.response=t.response)}}resetInteractions(){this.interactionElements.forEach(e=>e.reset())}validateResponses(){let e=!0;return this.interactionElements.forEach(t=>{t.validate()||(e=!1)}),e}getVariable(e){let t=this.variables.find(r=>r.identifier===e);return t||(console.warn(`Variable with identifier ${e} was not found`),null)}getResponse(e){let t=this.variables.find(o=>o.identifier===e);return t instanceof H?t:null}getOutcome(e){let t=this.variables.find(r=>r.identifier===e);return t instanceof O?t:null}registerFeedbackElement(e){e.stopPropagation(),this.feedbackElements.push(e.detail)}registerInteractionElement(e){e.stopPropagation(),this.interactionElements.push(e.target)}interactionResponse(e){let t=e.detail,r=this.getResponse(t.responseIdentifier);r&&(r.value=t.response),e.stopImmediatePropagation();let o=this.getAttribute("identifier");o||console.warn("qti-assessment-item has no identifier specified"),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:o,responseIdentifier:t.responseIdentifier,response:t.response}}))}outcomeChanged(e){this.showFeedback(e)}showFeedback(e){this.feedbackElements.forEach(t=>{t.checkShowFeedback(e.detail.outcomeIdentifier)})}setOutcomeValue(e,t){let r=this.getOutcome(e);if(!r){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}r.cardinality==="single"?r.value=t:r.value.push(t),this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:t}}))}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean})],k.prototype,"disabled",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean})],k.prototype,"readonly",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],k.prototype,"title",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],k.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],k.prototype,"_handleDisabledChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],k.prototype,"_handleReadonlyChange",2),k= exports.QtiAssessmentItem =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-assessment-item")],k);var Ne=class extends _lit.LitElement{constructor(){super()}connectedCallback(){super.connectedCallback();let e=this.closest("qti-assessment-item"),t=this.getAttribute("href"),r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.media="screen",r.href=t,e.appendChild(r),this.styleLink=r}disconnectedCallback(){let e=this.closest("qti-assessment-item");if(this.styleLink&&this.styleLink.parentElement===this)try{e.removeChild(this.styleLink)}catch(t){console.log("could not remove stylesheet")}}};customElements.define("qti-stylesheet",Ne);var Rt=_lit.css`
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkC4C24R3Icjs = require('../chunk-C4C24R3I.cjs');var _chunkGGEPFBR7cjs = require('../chunk-GGEPFBR7.cjs');var _chunkHOQW4KDAcjs = require('../chunk-HOQW4KDA.cjs');var bt={};var gt={};var vt={};var yt={};var xt={};var Et={};var qt={};var Ct={};var _t={};var kt={ON_OUTCOME_CHANGED:"qti-outcome-changed",ON_INTERACTION_CHANGED:"on-interaction-changed",ON_REGISTER_VARIABLE:"on-register-variable",ON_REGISTER_FEEDBACK:"on-register-feedback",ON_REGISTER_INTERACTION:"on-register-interaction",ON_REGISTER_CHOICE:"on-register-choice",ON_REGISTER_HOTSPOT:"on-register-hotspot",ON_LOOSE_CHOICE:"on-loose-choice",ON_INTERACTION_RESPONSE:"on-interaction-response",ON_DROPDOWN_SELECTED:"on-dropdown-selected",ON_CHOICE_ELEMENT_SELECTED:"choice-element-selected"};var H=class{constructor(){this.value=null;this.candidateResponse=null;this.correctResponse=null}};var O=class{constructor(){this.value=null}};var _decoratorsjs = require('lit/decorators.js');var _lit = require('lit');var k=class extends _lit.LitElement{constructor(){super();this.variables=[];this.feedbackElements=[];this.interactionElements=[];this._numAttempts=0;this._handleDisabledChange=(e,t)=>{this.interactionElements.forEach(r=>r.disabled=t)};this._handleReadonlyChange=(e,t)=>this.interactionElements.forEach(r=>r.readonly=t);this.addEventListener("qti-register-variable",this._registerVariable),this.addEventListener("qti-register-feedback",this.registerFeedbackElement),this.addEventListener("qti-register-interaction",this.registerInteractionElement),this.addEventListener("qti-outcome-changed",this.outcomeChanged),this.addEventListener("qti-interaction-response",this.interactionResponse)}render(){return _lit.html`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-item-connected",{bubbles:!0,composed:!0,detail:this}))}disconnectedCallback(){this.removeEventListener("qti-register-variable",this._registerVariable),this.removeEventListener("qti-register-feedback",this.registerFeedbackElement),this.removeEventListener("qti-register-interaction",this.registerInteractionElement),this.removeEventListener("qti-outcome-changed",this.outcomeChanged),this.removeEventListener("qti-interaction-response",this.interactionResponse)}_registerVariable(e){this.variables.push(e.detail.variable)}showCorrectResponse(){let e=this.variables.filter(t=>"correctResponse"in t&&t.correctResponse);this.responses=e.map(t=>({responseIdentifier:t.identifier,response:t.correctResponse}))}processResponse(){let e=this.querySelector("qti-response-processing");return e?e.process?(e.process(),this._numAttempts++,this.dispatchEvent(new CustomEvent("qti-response-processing")),!0):(console.info("Client side response webcomponents not available"),!1):(console.info("Client side response processing template not available"),!1)}set responses(e){if(e)for(let t of e){let r=this.interactionElements.find(a=>a.getAttribute("response-identifier")===t.responseIdentifier),o=this.getResponse(t.responseIdentifier);o&&(o.value=t.response),r&&(r.response=t.response)}}resetInteractions(){this.interactionElements.forEach(e=>e.reset())}validateResponses(){let e=!0;return this.interactionElements.forEach(t=>{t.validate()||(e=!1)}),e}getVariable(e){switch(e){case"numAttempts":return{identifier:"numAttempts",cardinality:"single",baseType:"integer",value:this._numAttempts.toString()};default:{let t=this.variables.find(r=>r.identifier===e);return t||(console.warn(`Variable with identifier ${e} was not found`),null)}break}}getResponse(e){let t=this.variables.find(o=>o.identifier===e);return t instanceof H?t:null}getOutcome(e){let t=this.variables.find(r=>r.identifier===e);return t instanceof O?t:null}registerFeedbackElement(e){e.stopPropagation(),this.feedbackElements.push(e.detail)}registerInteractionElement(e){e.stopPropagation(),this.interactionElements.push(e.target)}interactionResponse(e){let t=e.detail,r=this.getResponse(t.responseIdentifier);r&&(r.value=t.response),e.stopImmediatePropagation();let o=this.getAttribute("identifier");o||console.warn("qti-assessment-item has no identifier specified"),this.dispatchEvent(new CustomEvent("qti-interaction-changed",{bubbles:!0,composed:!0,detail:{item:o,responseIdentifier:t.responseIdentifier,response:t.response}}))}outcomeChanged(e){this.showFeedback(e)}showFeedback(e){this.feedbackElements.forEach(t=>{t.checkShowFeedback(e.detail.outcomeIdentifier)})}setOutcomeValue(e,t){let r;switch(e){case"completionStatus":r={identifier:"completionStatus",cardinality:"single",baseType:"string",value:t};break;default:{if(r=this.getOutcome(e),!r){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}r.cardinality==="single"?r.value=t:r.value.push(t)}break}this.dispatchEvent(new CustomEvent("qti-outcome-changed",{bubbles:!0,composed:!0,detail:{item:this.identifier,outcomeIdentifier:e,value:r.value}}))}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean})],k.prototype,"disabled",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean})],k.prototype,"readonly",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],k.prototype,"title",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],k.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],k.prototype,"_handleDisabledChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],k.prototype,"_handleReadonlyChange",2),k= exports.QtiAssessmentItem =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-assessment-item")],k);var De=class extends _lit.LitElement{constructor(){super()}connectedCallback(){super.connectedCallback();let e=this.closest("qti-assessment-item"),t=this.getAttribute("href"),r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.media="screen",r.href=t,e.appendChild(r),this.styleLink=r}disconnectedCallback(){let e=this.closest("qti-assessment-item");if(this.styleLink&&this.styleLink.parentElement===this)try{e.removeChild(this.styleLink)}catch(t){console.log("could not remove stylesheet")}}};customElements.define("qti-stylesheet",De);var At=_lit.css`
2
2
  :host {
3
3
  display: block;
4
4
  }
5
5
  `;var $=class extends _lit.LitElement{render(){return _lit.html` <slot name="qti-rubric-block"></slot>
6
- <slot></slot>`}};$.styles=Rt,$=_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-item-body")],$);var De=class extends _lit.LitElement{render(){return _lit.html` <slot></slot> `}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};customElements.define("qti-prompt",De);var _statichtmljs = require('lit/static-html.js');var nr={SPACE:32},y= exports.QtiChoice =class extends _lit.LitElement{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 nr.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"),_statichtmljs.html` <slot></slot> `}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],y.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0})],y.prototype,"tabindex",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:n=>n}})],y.prototype,"disabled",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:n=>n}})],y.prototype,"readonly",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:n=>n}})],y.prototype,"checked",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],y.prototype,"handleDisabledChange",1);var V=class extends _lit.LitElement{render(){return _lit.html``}};customElements.define("qti-variabledeclaration",V);var P=class extends V{connectedCallback(){super.connectedCallback();let e=new H({baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping});this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get correctResponse(){let e,t=this.querySelector("qti-correct-response");if(t){let r=t.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)e=r[0].textContent,r[0].remove();else if(this.cardinality!=="single"){e=[];for(let o=0;o<r.length;o++)e.push(r[o].textContent),r[o].remove()}}return e}get mapping(){return this.querySelector("qti-mapping")}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"base-type"})],P.prototype,"baseType",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],P.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],P.prototype,"cardinality",2);customElements.define("qti-response-declaration",P);var I=class extends V{get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let r of e.querySelectorAll("qti-interpolation-table-entry")){!r.getAttribute("source-value")&&r.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let o=parseInt(r.getAttribute("source-value")),a=parseInt(r.getAttribute("target-value"));(isNaN(o)||isNaN(a))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(o,a)}}return null}connectedCallback(){super.connectedCallback();let e=new O;e.identifier=this.identifier,e.cardinality=this.cardinality,e.baseType=this.baseType,(e.cardinality==="multiple"||e.cardinality==="ordered")&&(e.value=[]);let t=Array.from(this.querySelectorAll("qti-default-value > qti-value")).map(r=>r.innerHTML);t.length>1&&(e.value=t),t.length===1&&(e.cardinality==="multiple"||e.cardinality==="ordered"?e.value=t:e.value=t[0]),t||(e.value=null),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"base-type"})],I.prototype,"baseType",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],I.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],I.prototype,"cardinality",2);customElements.define("qti-outcome-declaration",I);var te=class extends _lit.LitElement{};te= exports.QtiCompanionMaterialsInfo =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-companion-materials-info")],te);var _context = require('@lit-labs/context');var R=class extends _lit.LitElement{constructor(){super(...arguments);this.logger=new (0, _context.ContextConsumer)(this,_chunkGGEPFBR7cjs.a,e=>this.style.display=this.view===e.view?"block":"none",!0)}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 _lit.html`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};R.styles=_lit.css`
6
+ <slot></slot>`}};$.styles=At,$=_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-item-body")],$);var Ne=class extends _lit.LitElement{render(){return _lit.html` <slot></slot> `}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};customElements.define("qti-prompt",Ne);var _statichtmljs = require('lit/static-html.js');var ar={SPACE:32},y= exports.QtiChoice =class extends _lit.LitElement{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 ar.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"),_statichtmljs.html` <slot></slot> `}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],y.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0})],y.prototype,"tabindex",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {reflect:!0,type:Boolean,attribute:"aria-disabled",converter:{toAttribute:n=>n}})],y.prototype,"disabled",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {reflect:!0,type:Boolean,attribute:"aria-readonly",converter:{toAttribute:n=>n}})],y.prototype,"readonly",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:n=>n}})],y.prototype,"checked",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],y.prototype,"handleDisabledChange",1);var V=class extends _lit.LitElement{render(){return _lit.html``}defaultValues(i){let e=Array.from(this.querySelectorAll("qti-default-value > qti-value"));if(e.length===0&&(i.cardinality==="multiple"||i.cardinality==="ordered"))return[];if(e.length===0)return null;let t=e.map(r=>r.innerHTML);return t.length>1||i.cardinality==="multiple"||i.cardinality==="ordered"?t:t[0]}};customElements.define("qti-variabledeclaration",V);var P=class extends V{connectedCallback(){super.connectedCallback();let e=new H;e.baseType=this.baseType,e.identifier=this.identifier,e.correctResponse=this.correctResponse,e.cardinality=this.cardinality||"single",e.mapping=this.mapping,e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}get correctResponse(){let e,t=this.querySelector("qti-correct-response");if(t){let r=t.querySelectorAll("qti-value");if(this.cardinality==="single"&&r.length>0)e=r[0].textContent,r[0].remove();else if(this.cardinality!=="single"){e=[];for(let o=0;o<r.length;o++)e.push(r[o].textContent),r[o].remove()}}return e}get mapping(){return this.querySelector("qti-mapping")}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"base-type"})],P.prototype,"baseType",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],P.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],P.prototype,"cardinality",2);customElements.define("qti-response-declaration",P);var I=class extends V{get interpolationTable(){let e=this.querySelector("qti-interpolation-table");if(e){let t=new Map;for(let r of e.querySelectorAll("qti-interpolation-table-entry")){!r.getAttribute("source-value")&&r.getAttribute("target-value")&&console.error("source-value or target-value is missing in qti-interpolation-table-entry");let o=parseInt(r.getAttribute("source-value")),a=parseInt(r.getAttribute("target-value"));(isNaN(o)||isNaN(a))&&console.error("source-value or target-value is not a number in qti-interpolation-table-entry"),t.set(o,a)}}return null}connectedCallback(){super.connectedCallback();let e=new O;e.identifier=this.identifier,e.cardinality=this.cardinality,e.baseType=this.baseType,e.value=this.defaultValues(e),this.dispatchEvent(new CustomEvent("qti-register-variable",{bubbles:!0,composed:!0,detail:{variable:e}}))}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"base-type"})],I.prototype,"baseType",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],I.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],I.prototype,"cardinality",2);customElements.define("qti-outcome-declaration",I);var re=class extends _lit.LitElement{};re= exports.QtiCompanionMaterialsInfo =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-companion-materials-info")],re);var _context = require('@lit-labs/context');var A=class extends _lit.LitElement{constructor(){super(...arguments);this.logger=new (0, _context.ContextConsumer)(this,_chunkGGEPFBR7cjs.a,e=>this.style.display=this.view===e.view?"block":"none",!0)}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 _lit.html`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-rubric-block")}};A.styles=_lit.css`
7
7
  :host {
8
8
  display: block;
9
9
  }
10
- `,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],R.prototype,"id",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],R.prototype,"use",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],R.prototype,"view",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"class"})],R.prototype,"classNames",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "classNames",{waitUntilFirstUpdate:!0})],R.prototype,"handleclassNamesChange",1),R= exports.qtiRubricBlock =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-rubric-block")],R);var ie=class extends _lit.LitElement{render(){return _lit.html`<slot></slot>`}};ie= exports.qtiContentBody =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-content-body")],ie);var E=class extends _lit.LitElement{constructor(){super();this.showHide="show",this.showFeedback(this.showHide==="hide")}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e){var o;let t=this.closest("qti-assessment-item").getOutcome(e);if(this.outcomeIdentifier!==e||!t)return;let r=Array.isArray(t)?t.includes(this.identifier):this.identifier===((o=t==null?void 0:t.value)==null?void 0:o.toString());this.showFeedback(r)}showFeedback(e){this.showStatus=e?"on":"off"}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"show-hide"})],E.prototype,"showHide",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"outcome-identifier"})],E.prototype,"outcomeIdentifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],E.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:!1})],E.prototype,"showStatus",2);var oe=class extends E{constructor(){super(...arguments);this.render=()=>_lit.html` <slot class="${this.showStatus}"></slot> `}};oe.styles=_lit.css`
10
+ `,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],A.prototype,"id",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],A.prototype,"use",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],A.prototype,"view",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"class"})],A.prototype,"classNames",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "classNames",{waitUntilFirstUpdate:!0})],A.prototype,"handleclassNamesChange",1),A= exports.qtiRubricBlock =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-rubric-block")],A);var se=class extends _lit.LitElement{render(){return _lit.html`<slot></slot>`}};se= exports.qtiContentBody =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-content-body")],se);var E=class extends _lit.LitElement{constructor(){super();this.showHide="show",this.showFeedback(this.showHide==="hide")}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-feedback",{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e){let t=this.closest("qti-assessment-item").getOutcome(e);if(this.outcomeIdentifier!==e||!t)return;let r=!1;Array.isArray(t.value)?r=t.baseType=="float"||t.baseType=="integer"?t.value.includes(this.identifier):t.value.includes(this.identifier):r=t.baseType=="float"||t.baseType=="integer"?this.identifier===t.value:this.identifier===t.value,this.showFeedback(r)}showFeedback(e){this.showStatus=e?"on":"off"}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"show-hide"})],E.prototype,"showHide",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"outcome-identifier"})],E.prototype,"outcomeIdentifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],E.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:!1})],E.prototype,"showStatus",2);var ne=class extends E{constructor(){super(...arguments);this.render=()=>_lit.html` <slot class="${this.showStatus}"></slot> `}};ne.styles=_lit.css`
11
11
  .on {
12
12
  display: inline-block;
13
13
  }
14
14
  .off {
15
15
  display: none;
16
16
  }
17
- `;customElements.define("qti-feedback-inline",oe);var $e=class extends E{render(){return _lit.html`
17
+ `;customElements.define("qti-feedback-inline",ne);var $e=class extends E{render(){return _lit.html`
18
18
  <style>
19
19
  .on {
20
20
  display: inline-block;
@@ -56,7 +56,7 @@
56
56
  pattern="${_ifdefinedjs.ifDefined.call(void 0, this.patternMask?this.patternMask:void 0)}"
57
57
  ?disabled="${this.disabled}"
58
58
  ?readonly="${this.readonly}"
59
- />`}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")}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"expected-length"})],_.prototype,"expectedLength",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"pattern-mask"})],_.prototype,"patternMask",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"placeholder-text"})],_.prototype,"placeholderText",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],_.prototype,"_value",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],_.prototype,"_size",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"class"})],_.prototype,"classNames",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "classNames")],_.prototype,"handleclassNamesChange",1),_= exports.QtiTextEntryInteraction =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-text-entry-interaction")],_);var A=class extends m{constructor(){super(...arguments);this.textareaRef=_refjs.createRef.call(void 0, );this._value=""}handleclassNamesChange(e,t){this.classNames.split(" ").forEach(o=>{if(o.startsWith("qti-height-lines")){let a=o.replace("qti-height-lines-","");this.textareaRef&&(this.textareaRef.value.rows=parseInt(a))}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[_lit.css`
59
+ />`}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")}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"expected-length"})],_.prototype,"expectedLength",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"pattern-mask"})],_.prototype,"patternMask",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"placeholder-text"})],_.prototype,"placeholderText",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],_.prototype,"_value",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],_.prototype,"_size",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"class"})],_.prototype,"classNames",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "classNames")],_.prototype,"handleclassNamesChange",1),_= exports.QtiTextEntryInteraction =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-text-entry-interaction")],_);var T=class extends m{constructor(){super(...arguments);this.textareaRef=_refjs.createRef.call(void 0, );this._value=""}handleclassNamesChange(e,t){this.classNames.split(" ").forEach(o=>{if(o.startsWith("qti-height-lines")){let a=o.replace("qti-height-lines-","");this.textareaRef&&(this.textareaRef.value.rows=parseInt(a))}})}set response(e){this._value=e!==void 0?e:""}validate(){return this._value!==""}static get styles(){return[_lit.css`
60
60
  /* PK: display host as block, else design will be collapsed */
61
61
  :host {
62
62
  display: block;
@@ -80,7 +80,7 @@
80
80
  ?disabled="${this.disabled}"
81
81
  ?readonly="${this.readonly}"
82
82
  .value=${this._value}
83
- ></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")}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"expected-length"})],A.prototype,"expectedLength",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"pattern-mask"})],A.prototype,"patternMask",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"placeholder-text"})],A.prototype,"placeholderText",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],A.prototype,"_value",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"class"})],A.prototype,"classNames",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "classNames",{waitUntilFirstUpdate:!0})],A.prototype,"handleclassNamesChange",1),A= exports.QtiExtendedTextInteraction =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-extended-text-interaction")],A);var v=class extends m{constructor(){super();this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(e,t)=>this._choiceElements.forEach(r=>r.disabled=t);this._handleReadonlyChange=(e,t)=>this._choiceElements.forEach(r=>r.readonly=t);this._handleMaxChoicesChange=()=>this._determineInputType();this.addEventListener("qti-register-choice",this._registerChoiceElement),this.addEventListener("qti-loose-choice",this._looseChoiceElement)}reset(){this._choiceElements.forEach(e=>{e.reset()})}validate(){return this._choiceElements.reduce((t,r)=>t+(r.checked?1:0),0)>=this.minChoices}set response(e){this._choiceElements.forEach(r=>{r.checked=!1}),(Array.isArray(e)?e:[e]).forEach(r=>{let o=this.querySelector(`[identifier='${r}']`);o&&(o.checked=!0)})}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler),this.removeEventListener("qti-register-choice",this._registerChoiceElement)}_registerChoiceElement(e){e.stopPropagation();let t=e.target;this._choiceElements.push(t),this._setInputType(t)}_looseChoiceElement(e){e.stopPropagation();let t=e.target;this._choiceElements.push(t),this._choiceElements=this._choiceElements.filter(r=>r!==t)}_determineInputType(){this._choiceElements.forEach(e=>{this._setInputType(e)})}_setInputType(e){this.maxChoices===1?e.setAttribute("role","radio"):e.setAttribute("role","checkbox")}_choiceElementSelectedHandler(e){this.maxChoices===1&&this._choiceElements.filter(t=>t.identifier!==e.detail.identifier).forEach(t=>{t.checked=!1}),this._choiceElementSelected()}_choiceElementSelected(){let e=this._choiceElements.filter(r=>r.checked).map(r=>r.identifier);this.maxChoices>1&&(this.maxChoices===e.length?this._choiceElements.forEach(r=>r.disabled=!r.checked):this._choiceElements.forEach(r=>r.disabled=!1));let t;this.maxChoices===1?t=e.length>0?e[0]:void 0:t=e,this.saveResponse(t)}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"min-choices"})],v.prototype,"minChoices",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"max-choices"})],v.prototype,"maxChoices",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],v.prototype,"_handleDisabledChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],v.prototype,"_handleReadonlyChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "maxChoices",{waitUntilFirstUpdate:!0})],v.prototype,"_handleMaxChoicesChange",2);var Xe=class extends v{constructor(){super(...arguments);this.render=()=>_lit.html`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};customElements.define("qti-hottext-interaction",Xe);var le=class extends m{constructor(){super();this.options=[];this.addEventListener(kt.ON_DROPDOWN_SELECTED,this.choiceSelected);let e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:"select",value:"",selected:!1},...e.map(t=>({textContent:t.innerHTML,value:t.getAttribute("identifier"),selected:!1}))]}static get properties(){return _chunkHOQW4KDAcjs.b.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},m.properties),{options:{type:Array,value:[],attribute:!1}})}connectedCallback(){super.connectedCallback()}static get styles(){return[_lit.css`
83
+ ></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")}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"expected-length"})],T.prototype,"expectedLength",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"pattern-mask"})],T.prototype,"patternMask",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"placeholder-text"})],T.prototype,"placeholderText",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],T.prototype,"_value",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"class"})],T.prototype,"classNames",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "classNames",{waitUntilFirstUpdate:!0})],T.prototype,"handleclassNamesChange",1),T= exports.QtiExtendedTextInteraction =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-extended-text-interaction")],T);var v=class extends m{constructor(){super();this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(e,t)=>this._choiceElements.forEach(r=>r.disabled=t);this._handleReadonlyChange=(e,t)=>this._choiceElements.forEach(r=>r.readonly=t);this._handleMaxChoicesChange=()=>this._determineInputType();this.addEventListener("qti-register-choice",this._registerChoiceElement),this.addEventListener("qti-loose-choice",this._looseChoiceElement)}reset(){this._choiceElements.forEach(e=>{e.reset()})}validate(){return this._choiceElements.reduce((t,r)=>t+(r.checked?1:0),0)>=this.minChoices}set response(e){this._choiceElements.forEach(r=>{r.checked=!1}),(Array.isArray(e)?e:[e]).forEach(r=>{let o=this.querySelector(`[identifier='${r}']`);o&&(o.checked=!0)})}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-choice-element-selected",this._choiceElementSelectedHandler),this.removeEventListener("qti-register-choice",this._registerChoiceElement)}_registerChoiceElement(e){e.stopPropagation();let t=e.target;this._choiceElements.push(t),this._setInputType(t)}_looseChoiceElement(e){e.stopPropagation();let t=e.target;this._choiceElements.push(t),this._choiceElements=this._choiceElements.filter(r=>r!==t)}_determineInputType(){this._choiceElements.forEach(e=>{this._setInputType(e)})}_setInputType(e){this.maxChoices===1?e.setAttribute("role","radio"):e.setAttribute("role","checkbox")}_choiceElementSelectedHandler(e){this.maxChoices===1&&this._choiceElements.filter(t=>t.identifier!==e.detail.identifier).forEach(t=>{t.checked=!1}),this._choiceElementSelected()}_choiceElementSelected(){let e=this._choiceElements.filter(r=>r.checked).map(r=>r.identifier);this.maxChoices>1&&(this.maxChoices===e.length?this._choiceElements.forEach(r=>r.disabled=!r.checked):this._choiceElements.forEach(r=>r.disabled=!1));let t;this.maxChoices===1?t=e.length>0?e[0]:void 0:t=e,this.saveResponse(t)}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"min-choices"})],v.prototype,"minChoices",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"max-choices"})],v.prototype,"maxChoices",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],v.prototype,"_handleDisabledChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],v.prototype,"_handleReadonlyChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "maxChoices",{waitUntilFirstUpdate:!0})],v.prototype,"_handleMaxChoicesChange",2);var Xe=class extends v{constructor(){super(...arguments);this.render=()=>_lit.html`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};customElements.define("qti-hottext-interaction",Xe);var ce=class extends m{constructor(){super();this.options=[];this.addEventListener(kt.ON_DROPDOWN_SELECTED,this.choiceSelected);let e=Array.from(this.querySelectorAll("qti-inline-choice"));this.options=[{textContent:"select",value:"",selected:!1},...e.map(t=>({textContent:t.innerHTML,value:t.getAttribute("identifier"),selected:!1}))]}static get properties(){return _chunkHOQW4KDAcjs.b.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},m.properties),{options:{type:Array,value:[],attribute:!1}})}connectedCallback(){super.connectedCallback()}static get styles(){return[_lit.css`
84
84
  :host {
85
85
  display: inline-block;
86
86
  }
@@ -91,7 +91,7 @@
91
91
  ?readonly="${this.readonly}"
92
92
  >
93
93
  ${this.options.map(e=>_lit.html` <option value="${e.value}" ?selected="${e.selected}">${e.textContent}</option> `)}
94
- </select>`}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>_chunkHOQW4KDAcjs.b.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},e),{selected:t===0}))}set response(e){this.options=this.options.map(t=>(e===t.value&&(t.selected=!0),t))}choiceSelected(e){let t=e.target.value;this.options=this.options.map(r=>_chunkHOQW4KDAcjs.b.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},r),{selected:r.value===t})),this.saveResponse(t)}};le.inputWidthClass=["","qti-input-width-2","qti-input-width-1","qti-input-width-3","qti-input-width-4","qti-input-width-6","qti-input-width-10","qti-input-width-15","qti-input-width-20","qti-input-width-72"];customElements.define("qti-inline-choice-interaction",le);var St=_lit.css`
94
+ </select>`}validate(){let e=this.options.find(t=>t.selected);return e?e.value!=="":!1}reset(){this.options=this.options.map((e,t)=>_chunkHOQW4KDAcjs.b.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},e),{selected:t===0}))}set response(e){this.options=this.options.map(t=>(e===t.value&&(t.selected=!0),t))}choiceSelected(e){let t=e.target.value;this.options=this.options.map(r=>_chunkHOQW4KDAcjs.b.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},r),{selected:r.value===t})),this.saveResponse(t)}};ce.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"];customElements.define("qti-inline-choice-interaction",ce);var St=_lit.css`
95
95
  :host {
96
96
  display: flex;
97
97
  flex-direction: column;
@@ -130,7 +130,7 @@
130
130
  </qti-set-outcome-value>
131
131
  </qti-response-else>
132
132
  </qti-response-condition>
133
- </qti-response-processing>`,Nt=`<qti-response-processing>
133
+ </qti-response-processing>`,Dt=`<qti-response-processing>
134
134
  <qti-response-condition>
135
135
  <qti-response-if>
136
136
  <qti-is-null>
@@ -146,7 +146,7 @@
146
146
  </qti-set-outcome-value>
147
147
  </qti-response-else>
148
148
  </qti-response-condition>
149
- </qti-response-processing>`;var X=class extends _lit.LitElement{render(){return _lit.html`<slot></slot>`}static get observedAttributes(){return["identifier"]}process(){if(this.getAttribute("template")){let e=this.getAttribute("template").split("/"),t=e[e.length-1].replace(".xml","");switch(this.innerHTML="",t){case"map_response":{this.appendChild(this.fragmentFromString(Vt));break}case"map_response_point":{this.appendChild(this.fragmentFromString(Nt));break}case"match_correct":this.appendChild(this.fragmentFromString(Mt));break}}let i=[...this.children];for(let e of i)e.process()}fragmentFromString(i){return document.createRange().createContextualFragment(i)}};X= exports.QtiResponseProcessing =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-response-processing")],X);var S=class extends _lit.LitElement{render(){return _lit.html``}process(){throw new Error("Not implemented")}};S= exports.QtiRule =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-rule")],S);var Ye=class extends S{render(){return _lit.html`<slot></slot>`}process(){let i=[...this.children];for(let e=0;e<i.length;e++){let t=i[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",Ye);var Ue=class extends S{process(){let i=this.getAttribute("identifier"),e=this.firstElementChild,t=e?e.calculate():null;if(t==null){console.warn("setOutcomeValue: value is null or undefined");return}this.closest("qti-assessment-item").setOutcomeValue(i,t)}};customElements.define("qti-set-outcome-value",Ue);var W=class extends _lit.LitElement{static get properties(){return{debugCalculateResult:{type:Object}}}render(){return _lit.html` <slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let i=this.getSubRules();for(let e=0;e<i.length;e++)i[e].process()}};customElements.define("qti-response-else",W);var G=class extends W{render(){return _lit.html`${super.render()}`}calculate(){return this.firstElementChild.calculate()}getSubRules(){let i=[];for(let e=1;e<this.children.length;e++)i.push(this.children[e]);return i}};customElements.define("qti-response-if",G);var Be=class extends G{render(){return _lit.html`${super.render()}`}};customElements.define("qti-response-else-if",Be);var u=class extends _lit.LitElement{constructor(){super(...arguments);this._error=[];this.getVariables=()=>Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent,cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return this.assessmentItem.getVariable(t)}case"qti-multiple":{let r=e.calculate();return r.length>0?{baseType:r[0].baseType,value:r.map(o=>o.value),cardinality:"multiple"}:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",r=this.assessmentItem.getResponse(t);return{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}}default:{try{return{baseType:"integer",value:e.calculate().toString(),cardinality:"single"}}catch(t){console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}set error(e){let t=this._error;this._error.push(e),this.requestUpdate("error",t)}render(){return _lit.html`${this._error.map(e=>_lit.html`<div role="alert">${e}</div>`)}`}calculate(){throw new Error("Not implemented")}get assessmentItem(){return this.closest("qti-assessment-item")}};u.styles=_lit.css`
149
+ </qti-response-processing>`;var X=class extends _lit.LitElement{render(){return _lit.html`<slot></slot>`}static get observedAttributes(){return["identifier"]}process(){if(this.getAttribute("template")){let e=this.getAttribute("template").split("/"),t=e[e.length-1].replace(".xml","");switch(this.innerHTML="",t){case"map_response":{this.appendChild(this.fragmentFromString(Vt));break}case"map_response_point":{this.appendChild(this.fragmentFromString(Dt));break}case"match_correct":this.appendChild(this.fragmentFromString(Mt));break}}let i=[...this.children];for(let e of i)e.process()}fragmentFromString(i){return document.createRange().createContextualFragment(i)}};X= exports.QtiResponseProcessing =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-response-processing")],X);var S=class extends _lit.LitElement{render(){return _lit.html``}process(){throw new Error("Not implemented")}};S= exports.QtiRule =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-rule")],S);var Ye=class extends S{render(){return _lit.html`<slot></slot>`}process(){let i=[...this.children];for(let e=0;e<i.length;e++){let t=i[e];if(t.calculate()){t.process();return}}}};customElements.define("qti-response-condition",Ye);var Ue=class extends S{process(){let i=this.getAttribute("identifier"),e=this.firstElementChild,t=e?e.calculate():null;if(t==null){console.warn("setOutcomeValue: value is null or undefined");return}this.closest("qti-assessment-item").setOutcomeValue(i,t)}};customElements.define("qti-set-outcome-value",Ue);var W=class extends _lit.LitElement{static get properties(){return{debugCalculateResult:{type:Object}}}render(){return _lit.html` <slot></slot>`}calculate(){return!0}getSubRules(){return[...this.children]}process(){let i=this.getSubRules();for(let e=0;e<i.length;e++)i[e].process()}};customElements.define("qti-response-else",W);var G=class extends W{render(){return _lit.html`${super.render()}`}calculate(){return this.firstElementChild.calculate()}getSubRules(){let i=[];for(let e=1;e<this.children.length;e++)i.push(this.children[e]);return i}};customElements.define("qti-response-if",G);var Be=class extends G{render(){return _lit.html`${super.render()}`}};customElements.define("qti-response-else-if",Be);var u=class extends _lit.LitElement{constructor(){super(...arguments);this._error=[];this.getVariables=()=>Array.from(this.children).map(e=>{switch(e.tagName.toLowerCase()){case"qti-base-value":return{baseType:e.getAttribute("base-type"),value:e.textContent,cardinality:"single"};case"qti-variable":{let t=e.getAttribute("identifier")||"";return this.assessmentItem.getVariable(t)}case"qti-multiple":{let r=e.calculate();return r.length>0?{baseType:r[0].baseType,value:r.map(o=>o.value),cardinality:"multiple"}:null}case"qti-correct":{let t=e.getAttribute("identifier")||"",r=this.assessmentItem.getResponse(t);return{baseType:r.baseType,value:r.correctResponse,cardinality:r.cardinality}}default:{try{return{baseType:"integer",value:e.calculate().toString(),cardinality:"single"}}catch(t){console.warn("default not sufficient")}return null}}}).filter(e=>e!==null)}set error(e){let t=this._error;this._error.push(e),this.requestUpdate("error",t)}render(){return _lit.html`${this._error.map(e=>_lit.html`<div role="alert">${e}</div>`)}`}calculate(){throw new Error("Not implemented")}get assessmentItem(){return this.closest("qti-assessment-item")}};u.styles=_lit.css`
150
150
  [role='alert'] {
151
151
  border: 1px solid red;
152
152
  background: pink;
@@ -156,15 +156,15 @@
156
156
  border-radius: 5px;
157
157
  margin-bottom: 3px;
158
158
  }
159
- `,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],u.prototype,"error",1);customElements.define("qti-expression",u);var ze=class extends u{calculate(){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",ze);var T=class extends u{render(){return _lit.html``}calculate(){throw new Error("Not implemented")}};var je=class extends T{calculate(){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",je);var Ke=class extends u{calculate(){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",Ke);var We=class extends T{calculate(){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",We);var Ge=class extends T{render(){return _lit.html``}calculate(){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-and, expected boolean"),null;return r}).every(e=>typeof e=="boolean"&&e)}};customElements.define("qti-and",Ge);var ce=class extends u{constructor(){super(...arguments);this.mult=0;this.render=()=>_lit.html`<pre>${this.mult}</pre>`}calculate(){let t=this.getVariables().reduce((r,o)=>{if(o.baseType=="float"||o.baseType=="integer")try{return r*parseInt(o.value.toString())}catch(a){console.warn("can not convert to number")}else console.warn(`has another baseType ${o.baseType}`);return r},1);return this.mult=t,t}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],ce.prototype,"mult",2);customElements.define("qti-product",ce);var Je=class extends T{render(){return _lit.html``}calculate(){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-and, expected boolean"),null;return r}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",Je);var w=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 pe=class extends u{constructor(){super(...arguments);this.toleranceMode="exact"}calculate(){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):w.compareSingleValues(t.value,r.value,t.baseType)}return console.error("unexpected number of children in qti-equal"),null}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],pe.prototype,"toleranceMode",2);customElements.define("qti-equal",pe);var de=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}calculate(){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),a=parseFloat(r.value);if(!isNaN(o)&&!isNaN(a))return this.roundingMode==="significantFigures"?o.toPrecision(this.figures)===a.toPrecision(this.figures):Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(a*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${o}, ${a}`);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}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],de.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",de);var ue=class extends u{constructor(){super(...arguments);this.baseType="string"}calculate(){return this.textContent}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"base-type"})],ue.prototype,"baseType",2);customElements.define("qti-base-value",ue);var Ze=class extends u{calculate(){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 Qe=class extends u{render(){return _lit.html``}get interpretation(){return this.getAttribute("interpretation")||""}calculate(){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",Qe);var et=class extends u{calculate(){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",et);var tt=class extends u{render(){return _lit.html`${super.render()}`}calculate(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",tt);var me=class extends u{calculate(){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 a of r){let l=t.mapEntries.find(c=>w.compareSingleValues(c.mapKey,a,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}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],me.prototype,"identifier",2);customElements.define("qti-map-response",me);var rt=class extends u{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if(t.cardinality==="single")return Array.isArray(e.value)||Array.isArray(t.value)?(console.error("unexpected cardinality in qti match"),!1):w.compareSingleValues(e.value.toString(),t.value.toString(),t.baseType);{if(!Array.isArray(e.value)||!Array.isArray(t.value))return console.error("unexpected cardinality in qti match"),!1;if(e.value.length!==t.value.length)return!1;let r=0;for(let o of t.value){if(t.cardinality==="ordered"){let a=e[r];if(!w.compareSingleValues(o,a,t.baseType))return!1}else{let a=null;for(let l of e.value)if(w.compareSingleValues(o,l,t.baseType)){a=l;break}if(a!==null)e.value.splice(e.value.indexOf(a),1);else return!1}r++}return!0}}return console.error("unexpected number of children in match"),null}};customElements.define("qti-match",rt);var it=class extends u{render(){return _lit.html``}calculate(){let i=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(i).value}};customElements.define("qti-variable",it);var st=class extends u{calculate(){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",st);var ot=class extends u{calculate(){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",ot);var he=class extends _lit.LitElement{constructor(){super();this.value="";this.closest("qti-assessment-item").addEventListener("qti-outcome-changed",()=>{this.value=this.calculate()})}render(){return _lit.html`${this.value}`}calculate(){let e=this.closest("qti-assessment-item"),t=this.getAttribute("identifier");return e.getVariable(t).value}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],he.prototype,"value",2);customElements.define("qti-printed-variable",he);var nt=class extends u{calculate(){let i=this.getVariables();this.children.length!==2&&(this.error="The member operator takes two sub-expressions");let[e,t]=i;if(e.baseType!==t.baseType&&(this.error="Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||(this.error="and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&(this.error="The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&(this.error="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 Y=class extends _lit.LitElement{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")}))}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:"default-value",type:Number})],Y.prototype,"defaultValue",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:"lower-bound",type:Number})],Y.prototype,"lowerBound",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:"upper-bound",type:Number})],Y.prototype,"upperBound",2);customElements.define("qti-mapping",Y);var lt=class extends _lit.LitElement{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),h=d.map(g=>g.getAttribute("key"));h.length>0&&!h.find(g=>!Number.isInteger(+g))?c[p]=d.map(g=>a(g)):c[p]=l.textContent}return c},a=l=>{if(l){let c={};for(let p of l.children)c=_chunkHOQW4KDAcjs.a.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},c),o(p));return c}};for(let l of t)return l.getAttribute("key")||(r=_chunkHOQW4KDAcjs.a.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},r),a(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=>{define("qtiCustomInteractionContext",()=>({register:o=>{this.register(o)},notifyReady:()=>{}})),r([this.module],()=>{},o=>{this._errorMessage=o})},r=>{this._errorMessage=r})}render(){return _lit.html`<slot></slot>${this._errorMessage&&_lit.html`<div style="color:red">
159
+ `,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],u.prototype,"error",1);var ze=class extends u{calculate(){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",ze);var w=class extends u{render(){return _lit.html``}calculate(){throw new Error("Not implemented")}};var je=class extends w{calculate(){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",je);var Ke=class extends u{calculate(){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",Ke);var We=class extends w{calculate(){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",We);var Ge=class extends w{render(){return _lit.html``}calculate(){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-and, expected boolean"),null;return r}).every(e=>typeof e=="boolean"&&e)}};customElements.define("qti-and",Ge);var pe=class extends u{constructor(){super(...arguments);this.mult=0;this.render=()=>_lit.html`<pre>${this.mult}</pre>`}calculate(){let t=this.getVariables().reduce((r,o)=>{if(o.baseType=="float"||o.baseType=="integer")try{return r*parseInt(o.value.toString())}catch(a){console.warn("can not convert to number")}else console.warn(`has another baseType ${o.baseType}`);return r},1);return this.mult=t,t}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],pe.prototype,"mult",2);customElements.define("qti-product",pe);var Je=class extends w{render(){return _lit.html``}calculate(){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-and, expected boolean"),null;return r}).some(e=>typeof e=="boolean"&&e)}};customElements.define("qti-or",Je);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 de=class extends u{constructor(){super(...arguments);this.toleranceMode="exact"}calculate(){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}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],de.prototype,"toleranceMode",2);customElements.define("qti-equal",de);var ue=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}calculate(){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),a=parseFloat(r.value);if(!isNaN(o)&&!isNaN(a))return this.roundingMode==="significantFigures"?o.toPrecision(this.figures)===a.toPrecision(this.figures):Math.round(o*Math.pow(10,this.figures))/Math.pow(10,this.figures)===Math.round(a*Math.pow(10,this.figures))/Math.pow(10,this.figures);console.error(`value cannot be casted to numeric value in equalRounded operator: ${o}, ${a}`);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}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],ue.prototype,"roundingMode",2);customElements.define("qti-equal-rounded",ue);var me=class extends u{constructor(){super(...arguments);this.baseType="string"}calculate(){return this.textContent}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"base-type"})],me.prototype,"baseType",2);customElements.define("qti-base-value",me);var Ze=class extends u{calculate(){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 Qe=class extends u{render(){return _lit.html``}get interpretation(){return this.getAttribute("interpretation")||""}calculate(){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",Qe);var et=class extends u{calculate(){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",et);var tt=class extends u{render(){return _lit.html`${super.render()}`}calculate(){return!this.firstElementChild.calculate()}};customElements.define("qti-not",tt);var he=class extends u{calculate(){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 a of r){let l=t.mapEntries.find(c=>R.compareSingleValues(c.mapKey,a,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}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],he.prototype,"identifier",2);customElements.define("qti-map-response",he);var rt=class extends u{calculate(){if(this.children.length===2){let i=this.getVariables(),e=i[0],t=i[1];if(t.cardinality==="single")return Array.isArray(e.value)||Array.isArray(t.value)?(console.error("unexpected cardinality in qti match"),!1):R.compareSingleValues(e.value.toString(),t.value.toString(),t.baseType);{if(!Array.isArray(e.value)||!Array.isArray(t.value))return console.error("unexpected cardinality in qti match"),!1;if(e.value.length!==t.value.length)return!1;let r=0;for(let o of t.value){if(t.cardinality==="ordered"){let a=e[r];if(!R.compareSingleValues(o,a,t.baseType))return!1}else{let a=null;for(let l of e.value)if(R.compareSingleValues(o,l,t.baseType)){a=l;break}if(a!==null)e.value.splice(e.value.indexOf(a),1);else return!1}r++}return!0}}return console.error("unexpected number of children in match"),null}};customElements.define("qti-match",rt);var it=class extends u{render(){return _lit.html``}calculate(){let i=this.getAttribute("identifier");return this.closest("qti-assessment-item").getVariable(i).value}};customElements.define("qti-variable",it);var st=class extends u{calculate(){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",st);var ot=class extends u{calculate(){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",ot);var J=class extends _lit.LitElement{constructor(){super();this.value="";this.closest("qti-assessment-item").addEventListener("qti-response-processing",()=>{this.value=this.calculate()})}render(){return _lit.html`${Array.isArray(this.value)?this.value.map(e=>_lit.html`${e}`):this.value}`}calculate(){let e=this.closest("qti-assessment-item"),t=this.identifier;return e.getVariable(t).value}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],J.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],J.prototype,"value",2);customElements.define("qti-printed-variable",J);var nt=class extends u{calculate(){let i=this.getVariables();this.children.length!==2&&(this.error="The member operator takes two sub-expressions");let[e,t]=i;if(e.baseType!==t.baseType&&(this.error="Which must both have the same base-type"),t.cardinality==="multiple"||t.cardinality==="ordered"||(this.error="and the second must be a multiple or ordered container"),(e.baseType==="float"||t.baseType==="float")&&(this.error="The member operator should not be used on sub-expressions with a base-type of float"),(e.baseType==="duration"||t.baseType==="duration")&&(this.error="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 Y=class extends _lit.LitElement{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")}))}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:"default-value",type:Number})],Y.prototype,"defaultValue",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:"lower-bound",type:Number})],Y.prototype,"lowerBound",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:"upper-bound",type:Number})],Y.prototype,"upperBound",2);customElements.define("qti-mapping",Y);var lt=class extends _lit.LitElement{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),h=d.map(g=>g.getAttribute("key"));h.length>0&&!h.find(g=>!Number.isInteger(+g))?c[p]=d.map(g=>a(g)):c[p]=l.textContent}return c},a=l=>{if(l){let c={};for(let p of l.children)c=_chunkHOQW4KDAcjs.a.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},c),o(p));return c}};for(let l of t)return l.getAttribute("key")||(r=_chunkHOQW4KDAcjs.a.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},r),a(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=>{define("qtiCustomInteractionContext",()=>({register:o=>{this.register(o)},notifyReady:()=>{}})),r([this.module],()=>{},o=>{this._errorMessage=o})},r=>{this._errorMessage=r})}render(){return _lit.html`<slot></slot>${this._errorMessage&&_lit.html`<div style="color:red">
160
160
  <h1>Error</h1>
161
161
  ${this._errorMessage}
162
- </div>`}`}};customElements.define("qti-portable-custom-interaction",lt);var fe=class n{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 n._instance?n._instance:(n._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._getPositionFromEvent(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._getPositionFromEvent(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,t=i.composedPath().find(r=>{if(r.nodeType===1&&r.nodeName!=="SLOT"&&r.hasAttribute("dropzone"))return r});if(t){let r=t.getRootNode(),o=this._getPoint(i);e=r.elementFromPoint(o.x,o.y)}return e}_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}_getPositionFromEvent(i){let e;if(i.type=="touchstart"||i.type=="touchmove"||i.type=="touchend"||i.type=="touchcancel"){let t=typeof i.originalEvent=="undefined"?i:i.originalEvent,r=t.touches[0]||t.changedTouches[0];e={x:r.pageX,y:r.pageY}}else(i.type=="mousedown"||i.type=="mouseup"||i.type=="mousemove"||i.type=="mouseover"||i.type=="mouseout"||i.type=="mouseenter"||i.type=="mouseleave")&&(e={x:i.clientX,y:i.clientY});return e}};var Ot=(n,i,e)=>{class t extends n{constructor(){super(...arguments);this.disabled=!1}firstUpdated(a){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(a);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.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(a){a.addEventListener("dragover",this.dragoverHandler),a.addEventListener("drop",this.dropHandler)}removeHandler(a){a.removeEventListener("dragover",this.dragoverHandler),a.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var a;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),(a=this.observer)==null||a.disconnect())}dragoverHandler(a){return a.preventDefault(),a.currentTarget.setAttribute("active",""),a.dataTransfer.dropEffect="move",!1}dropHandler(a){a.preventDefault();let l=a.currentTarget,c=this.querySelector(`[identifier=${a.dataTransfer.getData("text")}`),p=c||this.shadowRoot.querySelector(`[identifier=${a.dataTransfer.getData("text")}`);return l?p.parentElement.getAttribute("identifier")!==l.getAttribute("identifier")&&l.appendChild(p):console.error(`cannot find droppable, target: ${a.target?JSON.stringify(a.target):"null"}`),l.removeAttribute("active"),!1}dragleaveHandler(a){return a.preventDefault(),a.currentTarget.removeAttribute("active"),!1}}return _chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],t.prototype,"disabled",2),t};var $t=(n,i,e)=>{class t extends n{}return t};var L=(n,i,e,t)=>{class r extends $t(Ot(n,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",h=>{h.dataTransfer.setData("text",h.currentTarget.getAttribute("identifier")),d.setAttribute("dragging","")}),d.addEventListener("dragend",h=>{if(h.preventDefault(),d.removeAttribute("over"),d.removeAttribute("dragging"),h.dataTransfer.dropEffect==="none"&&this.configuration.dragCanBePlacedBack){let q=h.currentTarget,g=this.draggables.get(q),Me=g.index<g.parent.children.length?g.index:g.parent.children.length-1,b=g.parent,Ve=g.parent.children[Me];b.insertBefore(q,Ve),this.saveResponse(),this.checkMaxMatchAssociations()}h.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 fe,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,h=c.index<d.length?c.index:d.length;c.parent.insertBefore(p,d[h])}),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 h=this.droppables.find(q=>q.getAttribute("identifier")===p);d.forEach(q=>{let g=this.querySelector(`[identifier=${q}]`);h?g?(h.appendChild(g),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(h=>h.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 _chunkHOQW4KDAcjs.c.call(void 0, [_chunk6RJ7J4AEcjs.a.call(void 0, i)],r.prototype,"reInitDragAndDrop",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"response-identifier"})],r.prototype,"responseIdentifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:!1,type:Object})],r.prototype,"configuration",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "configuration")],r.prototype,"handleDragOptionsChanged",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],r.prototype,"disabled",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],r.prototype,"readonly",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0,attribute:"min-associations"})],r.prototype,"minAssociations",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0,attribute:"max-associations"})],r.prototype,"maxAssociations",2),r};var J=class extends L(_lit.LitElement,"qti-simple-associable-choice",!0,".dl"){render(){return _lit.html` <slot name="prompt"></slot>
162
+ </div>`}`}};customElements.define("qti-portable-custom-interaction",lt);var fe=class n{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 n._instance?n._instance:(n._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._getPositionFromEvent(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._getPositionFromEvent(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,t=i.composedPath().find(r=>{if(r.nodeType===1&&r.nodeName!=="SLOT"&&r.hasAttribute("dropzone"))return r});if(t){let r=t.getRootNode(),o=this._getPoint(i);e=r.elementFromPoint(o.x,o.y)}return e}_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}_getPositionFromEvent(i){let e;if(i.type=="touchstart"||i.type=="touchmove"||i.type=="touchend"||i.type=="touchcancel"){let t=typeof i.originalEvent=="undefined"?i:i.originalEvent,r=t.touches[0]||t.changedTouches[0];e={x:r.pageX,y:r.pageY}}else(i.type=="mousedown"||i.type=="mouseup"||i.type=="mousemove"||i.type=="mouseover"||i.type=="mouseout"||i.type=="mouseenter"||i.type=="mouseleave")&&(e={x:i.clientX,y:i.clientY});return e}};var $t=(n,i,e)=>{class t extends n{constructor(){super(...arguments);this.disabled=!1}firstUpdated(a){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(a);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.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(a){a.addEventListener("dragover",this.dragoverHandler),a.addEventListener("drop",this.dropHandler)}removeHandler(a){a.removeEventListener("dragover",this.dragoverHandler),a.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var a;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),(a=this.observer)==null||a.disconnect())}dragoverHandler(a){return a.preventDefault(),a.currentTarget.setAttribute("active",""),a.dataTransfer.dropEffect="move",!1}dropHandler(a){a.preventDefault();let l=a.currentTarget,c=this.querySelector(`[identifier=${a.dataTransfer.getData("text")}`),p=c||this.shadowRoot.querySelector(`[identifier=${a.dataTransfer.getData("text")}`);return l?p.parentElement.getAttribute("identifier")!==l.getAttribute("identifier")&&l.appendChild(p):console.error(`cannot find droppable, target: ${a.target?JSON.stringify(a.target):"null"}`),l.removeAttribute("active"),!1}dragleaveHandler(a){return a.preventDefault(),a.currentTarget.removeAttribute("active"),!1}}return _chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],t.prototype,"disabled",2),t};var Pt=(n,i,e)=>{class t extends n{}return t};var L=(n,i,e,t)=>{class r extends Pt($t(n,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",h=>{h.dataTransfer.setData("text",h.currentTarget.getAttribute("identifier")),d.setAttribute("dragging","")}),d.addEventListener("dragend",h=>{if(h.preventDefault(),d.removeAttribute("over"),d.removeAttribute("dragging"),h.dataTransfer.dropEffect==="none"&&this.configuration.dragCanBePlacedBack){let q=h.currentTarget,g=this.draggables.get(q),Me=g.index<g.parent.children.length?g.index:g.parent.children.length-1,b=g.parent,Ve=g.parent.children[Me];b.insertBefore(q,Ve),this.saveResponse(),this.checkMaxMatchAssociations()}h.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 fe,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,h=c.index<d.length?c.index:d.length;c.parent.insertBefore(p,d[h])}),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 h=this.droppables.find(q=>q.getAttribute("identifier")===p);d.forEach(q=>{let g=this.querySelector(`[identifier=${q}]`);h?g?(h.appendChild(g),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(h=>h.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 _chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.a.call(void 0, i)],r.prototype,"reInitDragAndDrop",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"response-identifier"})],r.prototype,"responseIdentifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:!1,type:Object})],r.prototype,"configuration",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "configuration")],r.prototype,"handleDragOptionsChanged",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],r.prototype,"disabled",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],r.prototype,"handleDisabledChange",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],r.prototype,"readonly",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],r.prototype,"handleReadonlyChange",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0,attribute:"min-associations"})],r.prototype,"minAssociations",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0,attribute:"max-associations"})],r.prototype,"maxAssociations",2),r};var Z=class extends L(_lit.LitElement,"qti-simple-associable-choice",!0,".dl"){render(){return _lit.html` <slot name="prompt"></slot>
163
163
  <slot name="qti-simple-associable-choice"></slot>
164
164
  ${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>_lit.html`<div part="associables-container">
165
165
  <div name="left${t}" part="drop-list" class="dl" identifier="droplist${t}_left"></div>
166
166
  <div name="right${t}" part="drop-list" class="dl" identifier="droplist${t}_right"></div>
167
- </div>`)}`}connectedCallback(){super.connectedCallback(),this._childrenMap=Array.from(this.querySelectorAll("qti-simple-associable-choice"))}};J.styles=_lit.css`
167
+ </div>`)}`}connectedCallback(){super.connectedCallback(),this._childrenMap=Array.from(this.querySelectorAll("qti-simple-associable-choice"))}};Z.styles=_lit.css`
168
168
  :host {
169
169
  display: block; /* necessary to calculate scaling position */
170
170
  }
@@ -173,7 +173,7 @@
173
173
  flex-wrap: wrap;
174
174
  gap: 0.5rem;
175
175
  }
176
- `,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],J.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",J);var be=class extends L(_lit.LitElement,"qti-gap-text",!1,"qti-gap"){render(){return _lit.html` <slot part="drags" name="qti-gap-text"></slot>
176
+ `,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],Z.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",Z);var be=class extends L(_lit.LitElement,"qti-gap-text",!1,"qti-gap"){render(){return _lit.html` <slot part="drags" name="qti-gap-text"></slot>
177
177
  <slot part="drops"></slot>`}};be.styles=[_lit.css`
178
178
  :host {
179
179
  display: flex;
@@ -197,7 +197,7 @@
197
197
  align-items: flex-start;
198
198
  flex: 1;
199
199
  }
200
- `];customElements.define("qti-gap-match-interaction",be);function B(n,i,e,t){switch(n){case"circle":{let[r,o,a]=i,l=r/e.width*100,c=o/e.height*100,p=a/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,a,l]=i,c=r/e.width*100,p=o/e.height*100,d=a/e.width*100,h=l/e.height*100;t.style.left=c+"%",t.style.top=p+"%",t.style.width=d-c+"%",t.style.height=h-p+"%"}break;case"poly":{let r=i.reduce((b,Ve,mt,zt)=>{if(mt%2===1){let jt=b.pop();b[b.length]={x:jt,y:zt[mt]}}else b.push(Ve);return b},[]),o=Math.min(...r.map(b=>b.x)),a=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,h=a/e.width*100,q=c/e.height*100;t.style.left=o/e.width*100+"%",t.style.top=l/e.height*100+"%",t.style.width=h-p+"%",t.style.height=q-d+"%";let Me=r.map(b=>({x:(b.x-o)/(a-o)*100,y:(b.y-l)/(c-l)*100})).map(b=>Math.round(b.x)+"% "+Math.round(b.y)+"%").join(",");t.style.clipPath=`polygon(${Me})`}break;default:break}}var _repeatjs = require('lit/directives/repeat.js');var M=class extends m{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 _lit.html`<slot name="prompt"></slot>
200
+ `];customElements.define("qti-gap-match-interaction",be);function B(n,i,e,t){switch(n){case"circle":{let[r,o,a]=i,l=r/e.width*100,c=o/e.height*100,p=a/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,a,l]=i,c=r/e.width*100,p=o/e.height*100,d=a/e.width*100,h=l/e.height*100;t.style.left=c+"%",t.style.top=p+"%",t.style.width=d-c+"%",t.style.height=h-p+"%"}break;case"poly":{let r=i.reduce((b,Ve,mt,jt)=>{if(mt%2===1){let Kt=b.pop();b[b.length]={x:Kt,y:jt[mt]}}else b.push(Ve);return b},[]),o=Math.min(...r.map(b=>b.x)),a=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,h=a/e.width*100,q=c/e.height*100;t.style.left=o/e.width*100+"%",t.style.top=l/e.height*100+"%",t.style.width=h-p+"%",t.style.height=q-d+"%";let Me=r.map(b=>({x:(b.x-o)/(a-o)*100,y:(b.y-l)/(c-l)*100})).map(b=>Math.round(b.x)+"% "+Math.round(b.y)+"%").join(",");t.style.clipPath=`polygon(${Me})`}break;default:break}}var _repeatjs = require('lit/directives/repeat.js');var M=class extends m{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 _lit.html`<slot name="prompt"></slot>
201
201
  <line-container>
202
202
  <svg
203
203
  width=${_ifdefinedjs.ifDefined.call(void 0, (e=this.grImage[0])==null?void 0:e.width)}
@@ -376,7 +376,7 @@
376
376
  display: inline-block;
377
377
  position: relative;
378
378
  }
379
- `];customElements.define("qti-position-object-stage",Ce);var _stylemapjs = require('lit/directives/style-map.js');var N=class extends m{constructor(){super(...arguments);this.maxChoices=0;this.minChoices=0;this._points=[]}render(){return _lit.html` <slot name="prompt"></slot>
379
+ `];customElements.define("qti-position-object-stage",Ce);var _stylemapjs = require('lit/directives/style-map.js');var D=class extends m{constructor(){super(...arguments);this.maxChoices=0;this.minChoices=0;this._points=[]}render(){return _lit.html` <slot name="prompt"></slot>
380
380
  <point-container>
381
381
  ${_repeatjs.repeat.call(void 0, this._points,e=>e,(e,t)=>_lit.html`
382
382
  <button
@@ -386,7 +386,7 @@
386
386
  ></button>
387
387
  `)}
388
388
  <slot></slot>
389
- </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()}};N.styles=[_lit.css`
389
+ </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()}};D.styles=[_lit.css`
390
390
  host() {
391
391
  display: block;
392
392
  }
@@ -394,7 +394,7 @@
394
394
  display: block;
395
395
  position: relative;
396
396
  }
397
- `],_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"max-choices"})],N.prototype,"maxChoices",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"min-choices"})],N.prototype,"minChoices",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],N.prototype,"_points",2);customElements.define("qti-select-point-interaction",N);var x=class extends m{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()),_lit.html`<slot name="prompt"></slot>
397
+ `],_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"max-choices"})],D.prototype,"maxChoices",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"min-choices"})],D.prototype,"minChoices",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],D.prototype,"_points",2);customElements.define("qti-select-point-interaction",D);var x=class extends m{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()),_lit.html`<slot name="prompt"></slot>
398
398
  <div id="slider" part="slider">
399
399
  ${this.csLive.getPropertyValue("--show-bounds")=="true"?_lit.html`<div id="bounds" part="bounds">
400
400
  <div>${this._min}</div>
@@ -406,14 +406,14 @@
406
406
  ${this.csLive.getPropertyValue("--show-value")=="true"?_lit.html`<div id="value" part="value">${this.value}</div>`:_lit.nothing}
407
407
  </div>
408
408
  </div>
409
- </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),a=o-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(a),e.stopPropagation()}_onMouseDown(e){let t=a=>{let l=a.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),a.preventDefault(),a.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}};x.styles=[_lit.css``],_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.query.call(void 0, "#knob")],x.prototype,"_knob",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.query.call(void 0, "#rail")],x.prototype,"_rail",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number})],x.prototype,"value",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,attribute:"step-label"})],x.prototype,"stepLabel",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean})],x.prototype,"reverse",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"lower-bound"})],x.prototype,"min",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"upper-bound"})],x.prototype,"max",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"step"})],x.prototype,"step",1),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],x.prototype,"_handleDisabledChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk3O4URV5Ucjs.a.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],x.prototype,"_handleReadonlyChange",2);customElements.define("qti-slider-interaction",x);var ke=class extends _lit.LitElement{render(){return _lit.html`<button @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.closest("qti-assessment-item").processResponse()}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],ke.prototype,"title",2);customElements.define("qti-end-attempt-interaction",ke);var Re=class extends _lit.LitElement{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return _lit.html` <slot name="qti-gap-img"></slot> `}};Re.styles=_lit.css`
409
+ </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),a=o-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(a),e.stopPropagation()}_onMouseDown(e){let t=a=>{let l=a.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),a.preventDefault(),a.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}};x.styles=[_lit.css``],_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.query.call(void 0, "#knob")],x.prototype,"_knob",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.query.call(void 0, "#rail")],x.prototype,"_rail",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number})],x.prototype,"value",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,attribute:"step-label"})],x.prototype,"stepLabel",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean})],x.prototype,"reverse",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"lower-bound"})],x.prototype,"min",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"upper-bound"})],x.prototype,"max",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"step"})],x.prototype,"step",1),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],x.prototype,"_handleDisabledChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunkC4C24R3Icjs.b.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],x.prototype,"_handleReadonlyChange",2);customElements.define("qti-slider-interaction",x);var ke=class extends _lit.LitElement{render(){return _lit.html`<button @click=${this.endAttempt}>${this.title}</button>`}endAttempt(e){this.closest("qti-assessment-item").processResponse()}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],ke.prototype,"title",2);customElements.define("qti-end-attempt-interaction",ke);var Ae=class extends _lit.LitElement{connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("qti-register-hotspot",{bubbles:!0,cancelable:!1,composed:!0}))}render(){return _lit.html` <slot name="qti-gap-img"></slot> `}};Ae.styles=_lit.css`
410
410
  :host {
411
411
  position: absolute;
412
412
  }
413
- `;customElements.define("qti-associable-hotspot",Re);var Ae=class extends _lit.LitElement{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","qti-gap-img")}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0})],Ae.prototype,"tabindex",2);customElements.define("qti-gap-img",Ae);var Te=class extends _lit.LitElement{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-gap-text")}render(){return _lit.html`<slot></slot>`}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0})],Te.prototype,"tabindex",2);customElements.define("qti-gap-text",Te);var we=class extends _lit.LitElement{constructor(){super(...arguments);this.tabindex=0}render(){return _lit.html` <slot name="qti-gap-text"></slot>`}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0})],we.prototype,"tabindex",2);customElements.define("qti-gap",we);var Q=class extends y{};Q.styles=_lit.css`
413
+ `;customElements.define("qti-associable-hotspot",Ae);var Te=class extends _lit.LitElement{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){this.setAttribute("slot","qti-gap-img")}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0})],Te.prototype,"tabindex",2);customElements.define("qti-gap-img",Te);var we=class extends _lit.LitElement{constructor(){super(...arguments);this.tabindex=0}connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-gap-text")}render(){return _lit.html`<slot></slot>`}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0})],we.prototype,"tabindex",2);customElements.define("qti-gap-text",we);var Re=class extends _lit.LitElement{constructor(){super(...arguments);this.tabindex=0}render(){return _lit.html` <slot name="qti-gap-text"></slot>`}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0})],Re.prototype,"tabindex",2);customElements.define("qti-gap",Re);var ee=class extends y{};ee.styles=_lit.css`
414
414
  :host {
415
415
  position: absolute;
416
416
  }
417
- `,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:"aria-ordervalue",type:Number,reflect:!0})],Q.prototype,"order",2);customElements.define("qti-hotspot-choice",Q);var Le=class extends y{render(){return _lit.html`<div part="ch"><div part="cha"></div></div>
417
+ `,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:"aria-ordervalue",type:Number,reflect:!0})],ee.prototype,"order",2);customElements.define("qti-hotspot-choice",ee);var Le=class extends y{render(){return _lit.html`<div part="ch"><div part="cha"></div></div>
418
418
  <slot></slot> `}};Le= exports.QtiHottext =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-hottext")],Le);var ut=class extends _lit.LitElement{};customElements.define("qti-inline-choice",ut);var Se=class extends y{render(){return _lit.html`<div part="ch"><div part="cha"></div></div>
419
- <slot></slot> `}};Se= exports.QtiSimpleChoice =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-simple-choice")],Se);exports.Events = kt; exports.OutcomeVariable = O; exports.QtPrintedVariable = he; exports.QtiAnd = Ge; exports.QtiAssessmentItem = k; exports.QtiAssociableHotspot = Re; exports.QtiAssociateInteraction = J; exports.QtiBaseValue = ue; exports.QtiChoice = y; exports.QtiChoiceElementSelected = _t; exports.QtiChoiceInteraction = F; exports.QtiCompanionMaterialsInfo = te; exports.QtiContains = Ze; exports.QtiCorrect = Qe; exports.QtiEndAttemptInteraction = ke; exports.QtiEqual = pe; exports.QtiEqualRounded = de; exports.QtiExpression = u; exports.QtiExtendedTextInteraction = A; exports.QtiFeedbackBlock = Pe; exports.QtiFeedbackInline = oe; exports.QtiGap = we; exports.QtiGapImg = Ae; exports.QtiGapMatchInteraction = be; exports.QtiGapText = Te; exports.QtiGraphicAssociateInteraction = M; exports.QtiGraphicGapMatchInteraction = ge; exports.QtiGraphicOrderInteraction = ve; exports.QtiGt = ze; exports.QtiGte = je; exports.QtiHotspotChoice = Q; exports.QtiHotspotInteraction = ye; exports.QtiHottext = Le; exports.QtiHottextInteraction = Xe; exports.QtiInlineChoice = ut; exports.QtiInlineChoiceInteraction = le; exports.QtiInteractionChanged = gt; exports.QtiInteractionResponse = Ct; exports.QtiIsNull = et; exports.QtiLooseChoice = qt; exports.QtiLt = Ke; exports.QtiLte = We; exports.QtiMapResponse = me; exports.QtiMapping = Y; exports.QtiMatch = rt; exports.QtiMatchInteraction = xe; exports.QtiMediaInteraction = Ee; exports.QtiMember = nt; exports.QtiModalFeedback = $e; exports.QtiMultiple = st; exports.QtiNot = tt; exports.QtiOr = Je; exports.QtiOrderInteraction = z; exports.QtiOrdered = ot; exports.QtiOutcomeChanged = bt; exports.QtiOutcomeDeclaration = I; exports.QtiPortableCustomInteraction = lt; exports.QtiPositionObjectStage = Ce; exports.QtiProduct = ce; exports.QtiPrompt = De; exports.QtiRegisterChoice = xt; exports.QtiRegisterHotspot = Et; exports.QtiRegisterInteraction = yt; exports.QtiRegisterVariable = vt; exports.QtiResponseCondition = Ye; exports.QtiResponseDeclaration = P; exports.QtiResponseElse = W; exports.QtiResponseElseIf = Be; exports.QtiResponseIf = G; exports.QtiResponseProcessing = X; exports.QtiRule = S; exports.QtiSPositionObjectInteraction = qe; exports.QtiSelectPointInteraction = N; exports.QtiSetOutcomeValue = Ue; exports.QtiSimpleAssociableChoice = pt; exports.QtiSimpleChoice = Se; exports.QtiSliderInteraction = x; exports.QtiStylesheet = Ne; exports.QtiTextEntryInteraction = _; exports.QtiVariable = it; exports.ResponseVariable = H; exports.qtiContentBody = ie; exports.qtiRubricBlock = R;
419
+ <slot></slot> `}};Se= exports.QtiSimpleChoice =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-simple-choice")],Se);exports.Events = kt; exports.OutcomeVariable = O; exports.QtPrintedVariable = J; exports.QtiAnd = Ge; exports.QtiAssessmentItem = k; exports.QtiAssociableHotspot = Ae; exports.QtiAssociateInteraction = Z; exports.QtiBaseValue = me; exports.QtiChoice = y; exports.QtiChoiceElementSelected = _t; exports.QtiChoiceInteraction = F; exports.QtiCompanionMaterialsInfo = re; exports.QtiContains = Ze; exports.QtiCorrect = Qe; exports.QtiEndAttemptInteraction = ke; exports.QtiEqual = de; exports.QtiEqualRounded = ue; exports.QtiExpression = u; exports.QtiExtendedTextInteraction = T; exports.QtiFeedbackBlock = Pe; exports.QtiFeedbackInline = ne; exports.QtiGap = Re; exports.QtiGapImg = Te; exports.QtiGapMatchInteraction = be; exports.QtiGapText = we; exports.QtiGraphicAssociateInteraction = M; exports.QtiGraphicGapMatchInteraction = ge; exports.QtiGraphicOrderInteraction = ve; exports.QtiGt = ze; exports.QtiGte = je; exports.QtiHotspotChoice = ee; exports.QtiHotspotInteraction = ye; exports.QtiHottext = Le; exports.QtiHottextInteraction = Xe; exports.QtiInlineChoice = ut; exports.QtiInlineChoiceInteraction = ce; exports.QtiInteractionChanged = gt; exports.QtiInteractionResponse = Ct; exports.QtiIsNull = et; exports.QtiLooseChoice = qt; exports.QtiLt = Ke; exports.QtiLte = We; exports.QtiMapResponse = he; exports.QtiMapping = Y; exports.QtiMatch = rt; exports.QtiMatchInteraction = xe; exports.QtiMediaInteraction = Ee; exports.QtiMember = nt; exports.QtiModalFeedback = $e; exports.QtiMultiple = st; exports.QtiNot = tt; exports.QtiOr = Je; exports.QtiOrderInteraction = z; exports.QtiOrdered = ot; exports.QtiOutcomeChanged = bt; exports.QtiOutcomeDeclaration = I; exports.QtiPortableCustomInteraction = lt; exports.QtiPositionObjectStage = Ce; exports.QtiProduct = pe; exports.QtiPrompt = Ne; exports.QtiRegisterChoice = xt; exports.QtiRegisterHotspot = Et; exports.QtiRegisterInteraction = yt; exports.QtiRegisterVariable = vt; exports.QtiResponseCondition = Ye; exports.QtiResponseDeclaration = P; exports.QtiResponseElse = W; exports.QtiResponseElseIf = Be; exports.QtiResponseIf = G; exports.QtiResponseProcessing = X; exports.QtiRule = S; exports.QtiSPositionObjectInteraction = qe; exports.QtiSelectPointInteraction = D; exports.QtiSetOutcomeValue = Ue; exports.QtiSimpleAssociableChoice = pt; exports.QtiSimpleChoice = Se; exports.QtiSliderInteraction = x; exports.QtiStylesheet = De; exports.QtiTextEntryInteraction = _; exports.QtiVariable = it; exports.ResponseVariable = H; exports.qtiContentBody = se; exports.qtiRubricBlock = A;
@@ -1,7 +1,5 @@
1
- import { B as BaseType, C as Cardinality, Q as QtiAssessmentItem, V as VariableDeclaration, R as ResponseVariable } from '../qti-assessment-item-c1eb7de3.js';
2
- export { b as Calculate, M as Multiple, O as Ordered, c as OutcomeVariable, e as QtiMapping, a as ResponseInteraction, d as directedPair, f as float, i as integer } from '../qti-assessment-item-c1eb7de3.js';
3
- import { C as Choices, I as Interaction, Q as QtiRule, a as QtiChoice } from '../qti-simple-choice-e28cfb34.js';
4
- export { b as InteractionChangedDetails, O as OutcomeChangedDetails, j as QtiChoiceElementSelected, m as QtiChoiceInteraction, l as QtiExtendedTextInteraction, o as QtiHottext, c as QtiInteractionChanged, i as QtiInteractionResponse, h as QtiLooseChoice, q as QtiOutcomeChanged, f as QtiRegisterChoice, g as QtiRegisterHotspot, e as QtiRegisterInteraction, d as QtiRegisterVariable, n as QtiResponseProcessing, p as QtiSimpleChoice, k as QtiTextEntryInteraction } from '../qti-simple-choice-e28cfb34.js';
1
+ import { V as VariableDeclaration, B as BaseType, C as Cardinality, a as Choices, I as Interaction, Q as QtiRule, b as QtiAssessmentItem, R as ResponseVariable, c as QtiChoice } from '../qti-simple-choice-6d581309.js';
2
+ export { f as Calculate, j as InteractionChangedDetails, M as Multiple, O as Ordered, h as OutcomeChangedDetails, t as OutcomeVariable, s as QtiChoiceElementSelected, w as QtiChoiceInteraction, v as QtiExtendedTextInteraction, z as QtiHottext, k as QtiInteractionChanged, r as QtiInteractionResponse, p as QtiLooseChoice, y as QtiMapping, q as QtiOutcomeChanged, n as QtiRegisterChoice, o as QtiRegisterHotspot, m as QtiRegisterInteraction, l as QtiRegisterVariable, x as QtiResponseProcessing, A as QtiSimpleChoice, u as QtiTextEntryInteraction, e as ResponseInteraction, d as directedPair, g as float, i as integer } from '../qti-simple-choice-6d581309.js';
5
3
  import * as lit from 'lit';
6
4
  import { LitElement, PropertyValueMap } from 'lit';
7
5
  import * as lit_html from 'lit-html';
@@ -37,6 +35,7 @@ declare class QtiPrompt extends LitElement {
37
35
 
38
36
  declare class QtiVariableDeclaration extends LitElement {
39
37
  render(): lit_html.TemplateResult<1>;
38
+ protected defaultValues(variable: VariableDeclaration<string | string[] | null>): string | string[];
40
39
  }
41
40
 
42
41
  declare class QtiResponseDeclaration extends QtiVariableDeclaration {
@@ -163,14 +162,14 @@ declare class QtiResponseElseIf extends QtiResponseIf {
163
162
  render(): lit_html.TemplateResult<1>;
164
163
  }
165
164
 
166
- declare class QtiExpression<T> extends LitElement {
165
+ declare abstract class QtiExpression<T> extends LitElement {
167
166
  protected _error: any[];
168
167
  protected set error(val: string);
169
168
  static styles: lit.CSSResult;
170
169
  render(): lit_html.TemplateResult<1>;
171
170
  calculate(): T;
172
171
  protected get assessmentItem(): QtiAssessmentItem;
173
- protected getVariables: () => VariableDeclaration<string | string[]>[];
172
+ protected getVariables: () => VariableDeclaration<number | string | (number | string)[] | undefined>[];
174
173
  }
175
174
 
176
175
  declare class QtiGt extends QtiExpression<boolean> {
@@ -254,12 +253,12 @@ declare class QtiMatch extends QtiExpression<boolean> {
254
253
  calculate(): boolean;
255
254
  }
256
255
 
257
- declare class QtiVariable extends QtiExpression<number | string | string[]> {
256
+ declare class QtiVariable extends QtiExpression<string | string[]> {
258
257
  render(): lit_html.TemplateResult<1>;
259
- calculate(): any;
258
+ calculate(): string | string[];
260
259
  }
261
260
 
262
- declare class QtiMultiple extends QtiExpression<ResponseVariable[]> {
261
+ declare class QtiMultiple extends QtiExpression<VariableDeclaration<string | string[]>[]> {
263
262
  calculate(): ResponseVariable[];
264
263
  }
265
264
 
@@ -268,10 +267,11 @@ declare class QtiOrdered extends QtiExpression<ResponseVariable[]> {
268
267
  }
269
268
 
270
269
  declare class QtPrintedVariable extends LitElement {
271
- value: string;
270
+ identifier: string;
271
+ value: string | string[];
272
272
  render(): lit_html.TemplateResult<1>;
273
273
  constructor();
274
- calculate(): any;
274
+ calculate(): string | string[];
275
275
  }
276
276
 
277
277
  declare class QtiMember extends QtiExpression<boolean | null> {
@@ -1,7 +1,5 @@
1
- import { B as BaseType, C as Cardinality, Q as QtiAssessmentItem, V as VariableDeclaration, R as ResponseVariable } from '../qti-assessment-item-c1eb7de3.js';
2
- export { b as Calculate, M as Multiple, O as Ordered, c as OutcomeVariable, e as QtiMapping, a as ResponseInteraction, d as directedPair, f as float, i as integer } from '../qti-assessment-item-c1eb7de3.js';
3
- import { C as Choices, I as Interaction, Q as QtiRule, a as QtiChoice } from '../qti-simple-choice-e28cfb34.js';
4
- export { b as InteractionChangedDetails, O as OutcomeChangedDetails, j as QtiChoiceElementSelected, m as QtiChoiceInteraction, l as QtiExtendedTextInteraction, o as QtiHottext, c as QtiInteractionChanged, i as QtiInteractionResponse, h as QtiLooseChoice, q as QtiOutcomeChanged, f as QtiRegisterChoice, g as QtiRegisterHotspot, e as QtiRegisterInteraction, d as QtiRegisterVariable, n as QtiResponseProcessing, p as QtiSimpleChoice, k as QtiTextEntryInteraction } from '../qti-simple-choice-e28cfb34.js';
1
+ import { V as VariableDeclaration, B as BaseType, C as Cardinality, a as Choices, I as Interaction, Q as QtiRule, b as QtiAssessmentItem, R as ResponseVariable, c as QtiChoice } from '../qti-simple-choice-6d581309.js';
2
+ export { f as Calculate, j as InteractionChangedDetails, M as Multiple, O as Ordered, h as OutcomeChangedDetails, t as OutcomeVariable, s as QtiChoiceElementSelected, w as QtiChoiceInteraction, v as QtiExtendedTextInteraction, z as QtiHottext, k as QtiInteractionChanged, r as QtiInteractionResponse, p as QtiLooseChoice, y as QtiMapping, q as QtiOutcomeChanged, n as QtiRegisterChoice, o as QtiRegisterHotspot, m as QtiRegisterInteraction, l as QtiRegisterVariable, x as QtiResponseProcessing, A as QtiSimpleChoice, u as QtiTextEntryInteraction, e as ResponseInteraction, d as directedPair, g as float, i as integer } from '../qti-simple-choice-6d581309.js';
5
3
  import * as lit from 'lit';
6
4
  import { LitElement, PropertyValueMap } from 'lit';
7
5
  import * as lit_html from 'lit-html';
@@ -37,6 +35,7 @@ declare class QtiPrompt extends LitElement {
37
35
 
38
36
  declare class QtiVariableDeclaration extends LitElement {
39
37
  render(): lit_html.TemplateResult<1>;
38
+ protected defaultValues(variable: VariableDeclaration<string | string[] | null>): string | string[];
40
39
  }
41
40
 
42
41
  declare class QtiResponseDeclaration extends QtiVariableDeclaration {
@@ -163,14 +162,14 @@ declare class QtiResponseElseIf extends QtiResponseIf {
163
162
  render(): lit_html.TemplateResult<1>;
164
163
  }
165
164
 
166
- declare class QtiExpression<T> extends LitElement {
165
+ declare abstract class QtiExpression<T> extends LitElement {
167
166
  protected _error: any[];
168
167
  protected set error(val: string);
169
168
  static styles: lit.CSSResult;
170
169
  render(): lit_html.TemplateResult<1>;
171
170
  calculate(): T;
172
171
  protected get assessmentItem(): QtiAssessmentItem;
173
- protected getVariables: () => VariableDeclaration<string | string[]>[];
172
+ protected getVariables: () => VariableDeclaration<number | string | (number | string)[] | undefined>[];
174
173
  }
175
174
 
176
175
  declare class QtiGt extends QtiExpression<boolean> {
@@ -254,12 +253,12 @@ declare class QtiMatch extends QtiExpression<boolean> {
254
253
  calculate(): boolean;
255
254
  }
256
255
 
257
- declare class QtiVariable extends QtiExpression<number | string | string[]> {
256
+ declare class QtiVariable extends QtiExpression<string | string[]> {
258
257
  render(): lit_html.TemplateResult<1>;
259
- calculate(): any;
258
+ calculate(): string | string[];
260
259
  }
261
260
 
262
- declare class QtiMultiple extends QtiExpression<ResponseVariable[]> {
261
+ declare class QtiMultiple extends QtiExpression<VariableDeclaration<string | string[]>[]> {
263
262
  calculate(): ResponseVariable[];
264
263
  }
265
264
 
@@ -268,10 +267,11 @@ declare class QtiOrdered extends QtiExpression<ResponseVariable[]> {
268
267
  }
269
268
 
270
269
  declare class QtPrintedVariable extends LitElement {
271
- value: string;
270
+ identifier: string;
271
+ value: string | string[];
272
272
  render(): lit_html.TemplateResult<1>;
273
273
  constructor();
274
- calculate(): any;
274
+ calculate(): string | string[];
275
275
  }
276
276
 
277
277
  declare class QtiMember extends QtiExpression<boolean | null> {