@citolab/qti-components 6.0.2-1 → 6.0.2

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.
@@ -0,0 +1,117 @@
1
+ import * as lit_html from 'lit-html';
2
+ import { C as Cardinality, B as BaseType, R as ResponseType, Q as QtiVariableJSON, I as InputResponseFormat } from './ExpressionResult-2192c3d8.js';
3
+ import { LitElement } from 'lit';
4
+
5
+ interface VariableDeclaration {
6
+ identifier: string;
7
+ cardinality: Cardinality;
8
+ baseType: BaseType;
9
+ value: ResponseType;
10
+ }
11
+
12
+ declare class ResponseVariable implements VariableDeclaration {
13
+ private _candidateResponse;
14
+ private _mapping;
15
+ private _correctResponse;
16
+ private _cardinality;
17
+ private _identifier;
18
+ private _basetype;
19
+ private _qtiVariable;
20
+ static getCandidateResponse(value: QtiVariableJSON): ResponseType;
21
+ constructor({ mapping, correctResponse, cardinality, baseType, identifier }: {
22
+ mapping: Map<string, number>;
23
+ correctResponse: BaseType;
24
+ cardinality: Cardinality;
25
+ baseType: BaseType;
26
+ identifier: string;
27
+ });
28
+ get mapping(): Map<string, number>;
29
+ get correctResponse(): BaseType;
30
+ get cardinality(): Cardinality;
31
+ get baseType(): BaseType;
32
+ get identifier(): string;
33
+ get value(): ResponseType;
34
+ set value(val: ResponseType);
35
+ set qtiVariable(value: QtiVariableJSON);
36
+ get qtiVariable(): QtiVariableJSON;
37
+ }
38
+
39
+ declare class OutcomeVariable implements VariableDeclaration {
40
+ identifier: string;
41
+ cardinality: Cardinality;
42
+ baseType: BaseType;
43
+ value: ResponseType;
44
+ }
45
+
46
+ type EventTypeRequiresDetail<T> = T extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>> ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>> ? never : Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail'] ? never : T : never : never;
47
+ type EventTypeDoesNotRequireDetail<T> = T extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>> ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>> ? T : Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail'] ? T : never : T : T;
48
+ type EventTypesWithRequiredDetail = {
49
+ [EventType in keyof GlobalEventHandlersEventMap as EventTypeRequiresDetail<EventType>]: true;
50
+ };
51
+ type EventTypesWithoutRequiredDetail = {
52
+ [EventType in keyof GlobalEventHandlersEventMap as EventTypeDoesNotRequireDetail<EventType>]: true;
53
+ };
54
+ type WithRequired<T, K extends keyof T> = T & {
55
+ [P in K]-?: T[P];
56
+ };
57
+ type SlEventInit<T> = T extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, unknown>> ? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<PropertyKey, never>> ? CustomEventInit<GlobalEventHandlersEventMap[T]['detail']> : Partial<GlobalEventHandlersEventMap[T]['detail']> extends GlobalEventHandlersEventMap[T]['detail'] ? CustomEventInit<GlobalEventHandlersEventMap[T]['detail']> : WithRequired<CustomEventInit<GlobalEventHandlersEventMap[T]['detail']>, 'detail'> : CustomEventInit : CustomEventInit;
58
+ type GetCustomEventType<T> = T extends keyof GlobalEventHandlersEventMap ? GlobalEventHandlersEventMap[T] extends CustomEvent<unknown> ? GlobalEventHandlersEventMap[T] : CustomEvent<unknown> : CustomEvent<unknown>;
59
+ declare class QtiElement extends LitElement {
60
+ dir: string;
61
+ lang: string;
62
+ /** Emits a custom event with more convenient defaults. */
63
+ emit<T extends string & keyof EventTypesWithoutRequiredDetail>(name: EventTypeDoesNotRequireDetail<T>, options?: SlEventInit<T> | undefined): GetCustomEventType<T>;
64
+ emit<T extends string & keyof EventTypesWithRequiredDetail>(name: EventTypeRequiresDetail<T>, options: SlEventInit<T>): GetCustomEventType<T>;
65
+ err(value: string): void;
66
+ }
67
+
68
+ /**
69
+ * @summary The qti-assessment-item element contains all the other QTI 3 item structures.
70
+ * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.dltnnj87l0yj
71
+ * @status stable
72
+ * @since 4.0
73
+ *
74
+ * @dependency qti-feedback
75
+ * @dependency qti-responseprocessing
76
+ *
77
+ * @slot - The default slot where all the other QTI 3 item structures go.
78
+ *
79
+ * @event qti-interaction-changed - Emitted when an interaction is changed.
80
+ * @event qti-outcome-changed - Emitted when the radio group receives user input.
81
+ *
82
+ */
83
+ declare class QtiAssessmentItem extends QtiElement {
84
+ private variables;
85
+ private feedbackElements;
86
+ private interactionElements;
87
+ disabled: boolean;
88
+ readonly: boolean;
89
+ title: string;
90
+ identifier: string;
91
+ render(): lit_html.TemplateResult<1>;
92
+ _handleDisabledChange: (_: boolean, disabled: boolean) => void;
93
+ _handleReadonlyChange: (_: boolean, readonly: boolean) => void;
94
+ constructor();
95
+ disconnectedCallback(): void;
96
+ private _registerVariable;
97
+ showCorrectResponse(): void;
98
+ processResponse(): boolean;
99
+ set responses(myResponses: InputResponseFormat<QtiVariableJSON>);
100
+ resetInteractions(): void;
101
+ validateResponses(): boolean;
102
+ getVariableValue(identifier: string): ResponseType | null;
103
+ getResponse(identifier: string): ResponseVariable | null;
104
+ getOutcome(identifier: string): OutcomeVariable | null;
105
+ private registerFeedbackElement;
106
+ private registerInteractionElement;
107
+ private interactionResponse;
108
+ private outcomeChanged;
109
+ setOutcomeValue(identifier: string, value: ResponseType): void;
110
+ }
111
+ declare global {
112
+ interface HTMLElementTagNameMap {
113
+ 'qti-assessment-item': QtiAssessmentItem;
114
+ }
115
+ }
116
+
117
+ export { OutcomeVariable as O, QtiElement as Q, ResponseVariable as R, VariableDeclaration as V, QtiAssessmentItem as a };
@@ -0,0 +1,403 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJLKCCEGGcjs = require('../chunk-JLKCCEGG.cjs');var _chunk2TX3IEPDcjs = require('../chunk-2TX3IEPD.cjs');var _chunkHOQW4KDAcjs = require('../chunk-HOQW4KDA.cjs');var Le={};var Ae={};var Me={};var He={};var Ne={};var De={};var Pe={};var Ie={};var Ve={};var g={ON_OUTCOME_CHANGED:"on-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 O=class{constructor({mapping:r,correctResponse:e,cardinality:t,baseType:i,identifier:l}){this._basetype="string";this._mapping=r,this._correctResponse=e,this._cardinality=t,this._basetype=i,this._identifier=l}static getCandidateResponse(r){let e=Object.keys(r)[0],t=Object.keys(r[e])[0];return r[e][t]}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(r){this._candidateResponse=r}set qtiVariable(r){this._qtiVariable=r,this._candidateResponse=O.getCandidateResponse(r)}get qtiVariable(){return this._qtiVariable}};var P=class{};var _decoratorsjs = require('lit/decorators.js');var _lit = require('lit');var m=class extends _lit.LitElement{emit(e,t){let i=new CustomEvent(e,_chunkHOQW4KDAcjs.a.call(void 0, {bubbles:!0,cancelable:!1,composed:!0,detail:{}},t));return this.dispatchEvent(i),i}err(e){throw e}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, )],m.prototype,"dir",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, )],m.prototype,"lang",2);var q=class extends m{constructor(){super();this.variables=[];this.feedbackElements=[];this.interactionElements=[];this._handleDisabledChange=(e,t)=>this.interactionElements.forEach(i=>i.disabled=t);this._handleReadonlyChange=(e,t)=>this.interactionElements.forEach(i=>i.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>`}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={item:this.identifier,interactions:e.map(t=>({responseIdentifier:t.identifier,responses:{base:{identifier:t.correctResponse}}}))}}processResponse(){if(!this.validateResponses())return console.info("Item is not valid, call validateResponses first"),!1;let e=this.querySelector("qti-responseprocessing");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){e&&e.interactions.forEach(i=>{let l=this.interactionElements.find(a=>a.getAttribute("response-identifier")===i.responseIdentifier),n=this.getResponse(i.responseIdentifier);n&&(n.qtiVariable=i.responses);let o=O.getCandidateResponse(i.responses);l&&(l.response=o)})}resetInteractions(){this.interactionElements.forEach(e=>e.reset())}validateResponses(){let e=!0;return this.interactionElements.forEach(t=>{t.validate()||(e=!1)}),e}getVariableValue(e){let t=this.variables.find(i=>i.identifier===e);return t?t.value:(console.warn(`Variable with identifier ${e} was not found`),null)}getResponse(e){let t=this.variables.find(l=>l.identifier===e);return t instanceof O?t:null}getOutcome(e){let t=this.variables.find(i=>i.identifier===e);return t instanceof P?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,i=this.getResponse(t.responseIdentifier);i&&(i.qtiVariable=t.responses),e.stopImmediatePropagation();let l=this.getAttribute("identifier");l||console.warn("qti-assessment-item has no identifier specified"),this.emit("qti-interaction-changed",{detail:{item:l,interaction:{responseIdentifier:t.responseIdentifier,responses:t.responses}}})}outcomeChanged(e){this.feedbackElements.forEach(t=>{t.checkShowFeedback(e.detail.outcomeIdentifier,e.detail.value)})}setOutcomeValue(e,t){let i=this.getOutcome(e);if(!i){console.warn(`Can not set qti-outcome-identifier: ${e}, it is not available`);return}i.value=t,this.dispatchEvent(new CustomEvent(g.ON_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})],q.prototype,"disabled",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean})],q.prototype,"readonly",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],q.prototype,"title",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],q.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],q.prototype,"_handleDisabledChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],q.prototype,"_handleReadonlyChange",2),q= exports.QtiAssessmentItem =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-assessment-item")],q);var be=class extends _lit.LitElement{constructor(){super()}connectedCallback(){super.connectedCallback();let e=this.closest("qti-assessment-item"),t=this.getAttribute("href"),i=document.createElement("link");i.rel="stylesheet",i.type="text/css",i.media="screen",i.href=t,e.appendChild(i),this.styleLink=i}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",be);var Ge=_lit.css`
2
+ :host {
3
+ display: block;
4
+ }
5
+ `;var I=class extends _lit.LitElement{render(){return _lit.html` <slot name="qti-rubric-block"></slot>
6
+ <slot></slot>`}};I.styles=Ge,I=_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-item-body")],I);var ge=class extends _lit.LitElement{render(){return _lit.html` <slot></slot> `}connectedCallback(){this.parentElement.tagName.endsWith("INTERACTION")&&this.setAttribute("slot","prompt")}};customElements.define("qti-prompt",ge);var _statichtmljs = require('lit/static-html.js');var ft={SPACE:32},C= exports.QtiChoice =class extends m{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.emit("qti-register-choice")}disconnectedCallback(){this.removeEventListener("keyup",this._onKeyUp),this.removeEventListener("click",this._onClick),this.emit("qti-loose-choice")}reset(){this.checked=!1,this.disabled=!1}_onKeyUp(e){if(!e.altKey)switch(e.keyCode){case ft.SPACE:e.preventDefault(),this._toggleChecked();break;default:}}_onClick(){this._toggleChecked()}_toggleChecked(){this.disabled||this.readonly||(this.checked=!this.checked,this.emit("qti-choice-element-selected",{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})],C.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0})],C.prototype,"tabindex",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],C.prototype,"disabled",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],C.prototype,"readonly",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {reflect:!0,type:Boolean,attribute:"aria-checked",converter:{toAttribute:c=>c}})],C.prototype,"checked",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],C.prototype,"handleDisabledChange",1);var H=class extends m{render(){return _lit.html``}};customElements.define("qti-variabledeclaration",H);var V=class extends H{connectedCallback(){super.connectedCallback();let e=new O({baseType:this.baseType,identifier:this.identifier,correctResponse:this.correctResponse,cardinality:this.cardinality||"single",mapping:this.mapping});this.emit("qti-register-variable",{detail:{variable:e}})}get correctResponse(){let e,t=this.querySelector("qti-correct-response");if(t){let i=t.querySelectorAll("qti-value");if(i.length===1)e=i[0].textContent,i[0].remove();else{e=[];for(let l=0;l<i.length;l++)e.push(i[l].textContent),i[l].remove()}}return e}get mapping(){let e=this.querySelector("qti-mapping");if(e){let t=new Map,i=e.querySelectorAll("qti-map-entry");for(let l=0;l<i.length;l++){let n=i[l],o=n.getAttribute("map-key"),a=n.getAttribute("mapped-value");t.set(o,a?parseFloat(a):null)}return t}else return null}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"base-type"})],V.prototype,"baseType",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"identifier"})],V.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"cardinality"})],V.prototype,"cardinality",2);customElements.define("qti-response-declaration",V);var ye=class extends H{static get observedAttributes(){return["identifier","cardinality","base-type"]}connectedCallback(){super.connectedCallback();let r=this.getAttribute("identifier"),e=new P;e.identifier=r,this.emit("qti-register-variable",{detail:{variable:e}})}};customElements.define("qti-outcome-declaration",ye);var Z=class extends m{};Z= exports.QtiCompanionMaterialsInfo =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-companion-materials-info")],Z);var _context = require('@lit-labs/context');var T=class extends m{constructor(){super(...arguments);this.logger=new (0, _context.ContextConsumer)(this,_chunkJLKCCEGGcjs.a,e=>this.style.display=this.view===e.view?"block":"none",!0)}handleclassNamesChange(e,t){this.classNames.split(" ").forEach(l=>{switch(l){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")}};T.styles=_lit.css`
7
+ :host {
8
+ display: block;
9
+ }
10
+ `,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],T.prototype,"id",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],T.prototype,"use",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],T.prototype,"view",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"class"})],T.prototype,"classNames",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "classNames",{waitUntilFirstUpdate:!0})],T.prototype,"handleclassNamesChange",1),T= exports.qtiRubricBlock =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-rubric-block")],T);var te=class extends m{render(){return _lit.html`<slot></slot>`}};te= exports.qtiContentBody =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-content-body")],te);var k=class extends _lit.LitElement{constructor(){super();this.showHide="show",this.showFeedback(this.showHide==="hide")}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent(g.ON_REGISTER_FEEDBACK,{bubbles:!0,composed:!0,detail:this}))}checkShowFeedback(e,t){if(this.outcomeIdentifier!==e||!t)return;let i=Array.isArray(t)?t.includes(this.identifier):this.identifier===t;this.showFeedback(i)}showFeedback(e){this.showStatus=e?"on":"off"}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],k.prototype,"showHide",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"outcome-identifier"})],k.prototype,"outcomeIdentifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],k.prototype,"identifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"show-hide"})],k.prototype,"showStatus",2);var re=class extends k{constructor(){super(...arguments);this.render=()=>_lit.html` <slot class="${this.showStatus}"></slot> `}};re.styles=_lit.css`
11
+ .on {
12
+ display: inline-block;
13
+ }
14
+ .off {
15
+ display: none;
16
+ }
17
+ `;customElements.define("qti-feedback-inline",re);var Ee=class extends k{render(){return _lit.html`
18
+ <style>
19
+ .on {
20
+ display: inline-block;
21
+ }
22
+ .off {
23
+ display: none;
24
+ }
25
+ </style>
26
+ <div class="feedback ${this.showStatus}">
27
+ <slot></slot>
28
+ </div>
29
+ `}};customElements.define("qti-modal-feedback",Ee);var _ifdefinedjs = require('lit/directives/if-defined.js');var v=class extends m{constructor(){super(...arguments);this.responseIdentifier="";this.disabled=!1;this.readonly=!1}connectedCallback(){super.connectedCallback(),this.emit("qti-register-interaction")}saveResponse(e){this.emit("qti-interaction-response",{detail:{responseIdentifier:this.responseIdentifier,responses:e}})}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:"response-identifier"})],v.prototype,"responseIdentifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {reflect:!0,type:Boolean})],v.prototype,"disabled",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {reflect:!0,type:Boolean})],v.prototype,"readonly",2);var $=_lit.css`
30
+ /***
31
+ The new CSS reset - version 1.4.9 (last updated 11.2.2022)
32
+ GitHub page: https://github.com/elad2412/the-new-css-reset
33
+ ***/
34
+
35
+ /*
36
+ Remove all the styles of the "User-Agent-Stylesheet", except for the 'display' property
37
+ - The "symbol *" part is to solve Firefox SVG sprite bug
38
+ */
39
+ *:where(:not(iframe, canvas, img, svg, video, object):not(svg *, symbol *)) {
40
+ all: unset;
41
+ display: revert;
42
+ }
43
+
44
+ /* Preferred box-sizing value */
45
+ *,
46
+ *::before,
47
+ *::after {
48
+ box-sizing: border-box;
49
+ }
50
+
51
+ /* Reapply the pointer cursor for anchor tags */
52
+ a,
53
+ button {
54
+ cursor: revert;
55
+ }
56
+
57
+ /* Remove list styles (bullets/numbers) */
58
+ ol,
59
+ ul,
60
+ menu {
61
+ list-style: none;
62
+ }
63
+
64
+ /* For images to not be able to exceed their container */
65
+ img {
66
+ max-width: 100%;
67
+ }
68
+
69
+ /* removes spacing between cells in tables */
70
+ table {
71
+ border-collapse: collapse;
72
+ }
73
+
74
+ /* revert the 'white-space' property for textarea elements on Safari */
75
+ textarea {
76
+ white-space: revert;
77
+ }
78
+
79
+ /* minimum style to allow to style meter element */
80
+ meter {
81
+ -webkit-appearance: revert;
82
+ appearance: revert;
83
+ }
84
+
85
+ /* reset default text opacity of input placeholder */
86
+ ::placeholder {
87
+ all: unset;
88
+ }
89
+
90
+ /* fix the feature of 'hidden' attribute.
91
+ display:revert; revert to element instead of attribute */
92
+ :where([hidden]) {
93
+ display: none;
94
+ }
95
+
96
+ /* revert for bug in Chromium browsers
97
+ - fix for the content editable attribute will work properly. */
98
+ :where([contenteditable]) {
99
+ -moz-user-modify: read-write;
100
+ -webkit-user-modify: read-write;
101
+ overflow-wrap: break-word;
102
+ -webkit-line-break: after-white-space;
103
+ }
104
+
105
+ /* apply back the draggable feature - exist only in Chromium and Safari */
106
+ :where([draggable='true']) {
107
+ -webkit-user-drag: element;
108
+ }
109
+ `;var se=class extends v{constructor(){super();this.value=""}static get properties(){return _chunkHOQW4KDAcjs.b.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},v.properties),{expectedLength:{type:Number,attribute:"expected-length"},patternMask:{type:String,attribute:"pattern-mask"},placeholderText:{type:String,attribute:"placeholder-text"},value:{type:String}})}set response(e){this.value=e!==void 0?e:""}validate(){return this.value!==""}static get styles(){return[$,_lit.css`
110
+ /* PK: display host as block, else design will be collapsed */
111
+ :host {
112
+ display: inline-block;
113
+ }
114
+ input {
115
+ padding: var(--qti-padding, 0.5rem);
116
+ }
117
+ `]}render(){return _lit.html`
118
+ <input
119
+ spellcheck="false"
120
+ autocomplete="off"
121
+ @keydown="${e=>e.stopImmediatePropagation()}"
122
+ @keyup="${this.textChanged}"
123
+ @change="${this.textChanged}"
124
+ type="text"
125
+ placeholder="${_ifdefinedjs.ifDefined.call(void 0, this.placeholderText?this.placeholderText:void 0)}"
126
+ .value="${this.value}"
127
+ size="${_ifdefinedjs.ifDefined.call(void 0, this.expectedLength?this.expectedLength:void 0)}"
128
+ pattern="${_ifdefinedjs.ifDefined.call(void 0, this.patternMask?this.patternMask:void 0)}"
129
+ ?disabled="${this.disabled}"
130
+ ?readonly="${this.readonly}"
131
+ />`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.value=t.value,this.saveResponse({base:{string:t.value}})}reset(){this.value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};se.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-text-entry-interaction",se);var _refjs = require('lit/directives/ref.js');var R=class extends v{constructor(){super(...arguments);this.textareaRef=_refjs.createRef.call(void 0, );this.value=""}handleclassNamesChange(e,t){this.classNames.split(" ").forEach(l=>{if(l.startsWith("qti-height-lines")){let n=l.replace("qti-height-lines-","");this.textareaRef&&(this.textareaRef.value.rows=parseInt(n))}})}set response(e){this.value=e!==void 0?e:""}validate(){return this.value!==""}static get styles(){return[$,_lit.css`
132
+ /* PK: display host as block, else design will be collapsed */
133
+ :host {
134
+ display: block;
135
+ }
136
+ textarea {
137
+ padding: var(--qti-padding, 0.5rem);
138
+ width: 100%;
139
+ height: 100%;
140
+ }
141
+ `]}render(){return _lit.html`<textarea
142
+ ${_refjs.ref.call(void 0, this.textareaRef)}
143
+ spellcheck="false"
144
+ autocomplete="off"
145
+ @keydown="${e=>e.stopImmediatePropagation()}"
146
+ @keyup="${this.textChanged}"
147
+ @change="${this.textChanged}"
148
+ placeholder="${_ifdefinedjs.ifDefined.call(void 0, this.placeholderText?this.placeholderText:void 0)}"
149
+ maxlength="${_ifdefinedjs.ifDefined.call(void 0, this.expectedLength?this.expectedLength:void 0)}"
150
+ pattern="${_ifdefinedjs.ifDefined.call(void 0, this.patternMask?this.patternMask:void 0)}"
151
+ ?disabled="${this.disabled}"
152
+ ?readonly="${this.readonly}"
153
+ .value=${this.value}
154
+ ></textarea>`}textChanged(e){if(this.disabled||this.readonly)return;let t=e.target;this.setEmptyAttribute(t.value),this.value=t.value,this.saveResponse({base:{string:t.value}})}reset(){this.value=""}setEmptyAttribute(e){this.setAttribute("empty",e===""?"true":"false")}};R.rowHeightClass=["","qti-height-lines-3","qti-height-lines-6","qti-height-lines-15"],_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"expected-length"})],R.prototype,"expectedLength",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"pattern-mask"})],R.prototype,"patternMask",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"placeholder-text"})],R.prototype,"placeholderText",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],R.prototype,"value",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"class"})],R.prototype,"classNames",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "classNames",{waitUntilFirstUpdate:!0})],R.prototype,"handleclassNamesChange",1);customElements.define("qti-extended-text-interaction",R);var oe=class extends C{};oe= exports.QtiHottext =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-hottext")],oe);var y=class extends v{constructor(){super();this._choiceElements=[];this.minChoices=0;this.maxChoices=1;this._handleDisabledChange=(e,t)=>this._choiceElements.forEach(i=>i.disabled=t);this._handleReadonlyChange=(e,t)=>this._choiceElements.forEach(i=>i.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,i)=>t+(i.checked?1:0),0)>=this.minChoices}set response(e){this._choiceElements.forEach(i=>{i.checked=!1}),(Array.isArray(e)?e:[e]).forEach(i=>{let l=this.querySelector(`[identifier='${i}']`);l&&(l.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(i=>i!==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(i=>i.checked).map(i=>i.identifier);this.maxChoices>1&&(this.maxChoices===e.length?this._choiceElements.forEach(i=>i.disabled=!i.checked):this._choiceElements.forEach(i=>i.disabled=!1));let t;this.maxChoices===1?t={base:{identifier:e.length>0?e[0]:""}}:t={list:{identifier:e}},this.saveResponse(t)}};_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"min-choices"})],y.prototype,"minChoices",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"max-choices"})],y.prototype,"maxChoices",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],y.prototype,"_handleDisabledChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],y.prototype,"_handleReadonlyChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "_maxChoices",{waitUntilFirstUpdate:!0})],y.prototype,"_handleMaxChoicesChange",2);var qe=class extends y{constructor(){super(...arguments);this.render=()=>_lit.html`<slot></slot>`}connectedCallback(){super.connectedCallback(),this.setAttribute("qti-hottext-interaction","")}};customElements.define("qti-hottext-interaction",qe);var ne=class extends v{constructor(){super();this.options=[];this.addEventListener(g.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, {},v.properties),{options:{type:Array,value:[],attribute:!1}})}connectedCallback(){super.connectedCallback()}static get styles(){return[$,_lit.css`
155
+ :host {
156
+ display: inline-block;
157
+ }
158
+ select {
159
+ width:100%;
160
+ padding: var(--qti-padding-y) var(--qti-padding-x);
161
+ padding-right: calc(var(--qti-padding-x) + 1ch)
162
+ }
163
+ `]}render(){return _lit.html`
164
+ <select
165
+ @change="${this.choiceSelected}"
166
+ ?disabled="${this.disabled}"
167
+ ?readonly="${this.readonly}"
168
+ >
169
+ ${this.options.map(e=>_lit.html`
170
+ <option value="${e.value}" ?selected="${e.selected}">${e.textContent}</option>
171
+ `)}
172
+ </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(i=>_chunkHOQW4KDAcjs.b.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},i),{selected:i.value===t})),this.saveResponse({base:{string:t}})}};ne.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",ne);var ae=_lit.css`
173
+ :host {
174
+ box-sizing: border-box;
175
+ }
176
+
177
+ :host *,
178
+ :host *::before,
179
+ :host *::after {
180
+ box-sizing: inherit;
181
+ }
182
+
183
+ [hidden] {
184
+ display: none !important;
185
+ }
186
+ `;var Be=_lit.css`
187
+ ${ae}
188
+
189
+ :host {
190
+ display: block;
191
+ }
192
+ `;var N=class extends y{constructor(){super(...arguments);this.render=()=>_lit.html`<slot name="prompt"></slot><slot></slot>`}};N.styles=Be,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:"orientation",type:String})],N.prototype,"orientation",2),N=_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-choice-interaction")],N);var Xe=_lit.css`
193
+ ${ae}
194
+
195
+ :host {
196
+ display: block;
197
+ }
198
+ `;var G=class extends C{};G.styles=Xe,G=_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-simple-choice")],G);var Ye=`<qti-response-processing>
199
+ <qti-response-condition>
200
+ <qti-response-if>
201
+ <qti-match>
202
+ <qti-variable identifier="RESPONSE"></qti-variable>
203
+ <qti-correct identifier="RESPONSE"></qti-correct>
204
+ </qti-match>
205
+ <qti-set-outcome-value identifier="SCORE">
206
+ <qti-base-value base-type="float">1</qti-base-value>
207
+ </qti-set-outcome-value>
208
+ </qti-response-if>
209
+ <qti-response-else>
210
+ <qti-set-outcome-value identifier="SCORE">
211
+ <qti-base-value base-type="float">0</qti-base-value>
212
+ </qti-set-outcome-value>
213
+ </qti-response-else>
214
+ </qti-response-condition>
215
+ </qti-response-processing>`,Ke=`<qti-response-processing>
216
+ <qti-response-condition>
217
+ <qti-response-if>
218
+ <qti-is-null>
219
+ <qti-variable identifier="RESPONSE"></qti-variable>
220
+ </qti-is-null>
221
+ <qti-set-outcome-value identifier="SCORE">
222
+ <qti-base-value base-type="float">0.0</qti-base-value>
223
+ </qti-set-outcome-value>
224
+ </qti-response-if>
225
+ <qti-response-else>
226
+ <qti-set-outcome-value identifier="SCORE">
227
+ <qti-map-response identifier="RESPONSE"> </qti-map-response>
228
+ </qti-set-outcome-value>
229
+ </qti-response-else>
230
+ </qti-response-condition>
231
+ </qti-response-processing>`,Je=`<qti-response-processing>
232
+ <qti-response-condition>
233
+ <qti-response-if>
234
+ <qti-is-null>
235
+ <qti-variable identifier="RESPONSE"></qti-variable>
236
+ </qti-is-null>
237
+ <qti-set-outcome-value identifier="SCORE">
238
+ <qti-base-value base-type="float">0</qti-base-value>
239
+ </qti-set-outcome-value>
240
+ </qti-response-if>
241
+ <qti-response-else>
242
+ <qti-set-outcome-value identifier="SCORE">
243
+ <qti-map-response-point identifier="RESPONSE"></qti-map-response-point>
244
+ </qti-set-outcome-value>
245
+ </qti-response-else>
246
+ </qti-response-condition>
247
+ </qti-response-processing>`;var F=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(Ke));break}case"map_response_point":{this.appendChild(this.fragmentFromString(Je));break}case"match_correct":this.appendChild(this.fragmentFromString(Ye));break}}let r=[...this.children];for(let e of r)e.process()}fragmentFromString(r){return document.createRange().createContextualFragment(r)}};F= exports.QtiResponseProcessing =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-response-processing")],F);var J=class extends _lit.LitElement{render(){return _lit.html``}process(){throw new Error("Not implemented")}};J= exports.QtiRule =_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-rule")],J);var Te=class extends m{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"),i={},l=o=>{let a={},d=o.getAttribute("key");if(d){let p=Array.from(o.children),h=p.map(f=>f.getAttribute("key"));h.length>0&&!h.find(f=>!Number.isInteger(+f))?a[d]=p.map(f=>n(f)):a[d]=o.textContent}return a},n=o=>{if(o){let a={};for(let d of o.children)a=_chunkHOQW4KDAcjs.a.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},a),l(d));return a}};for(let o of t)return o.getAttribute("key")||(i=_chunkHOQW4KDAcjs.a.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},i),n(o))),i;this.err("Can not find qti-custom-interaction config")}register(e){let t=this.parentElement.tagName==="QTI-CUSTOM-INTERACTION"?"TAO":"IMS",i=t=="IMS"?this.querySelector("qti-interaction-markup"):this.querySelector("markup");i.classList.add("qti-customInteraction"),t=="TAO"&&this.querySelector("properties")&&(this.querySelector("properties").style.display="none");let l=t=="IMS"?{properties:this.dataset}:this.getTAOConfig(this);t=="IMS"?e.getInstance(i,l,void 0):e.initialize(this.customInteractionTypeIdentifier,i.firstElementChild,l),t=="TAO"&&Array.from(this.querySelectorAll("link")).map(o=>o.getAttribute("href")).forEach(o=>{let a=document.createElement("link");a.rel="stylesheet",a.type="text/css",a.media="screen",a.href=o,i.appendChild(a)})}connectedCallback(){super.connectedCallback();let e={context:this.customInteractionTypeIdentifier,baseUrl:this.baseUrl,catchError:!0};window.requirePaths&&window.requireShim&&(e.paths=window.requirePaths,e.shim=window.requireShim),requirejs.config(e)(["require"],i=>{define("qtiCustomInteractionContext",()=>({register:l=>{this.register(l)},notifyReady:()=>{}})),i([this.module],()=>{},l=>{this._errorMessage=l})},i=>{this._errorMessage=i})}render(){return _lit.html`<slot></slot>${this._errorMessage&&_lit.html`<div style="color:red"><h1>Error</h1>${this._errorMessage}</div>`}`}};customElements.define("qti-portable-custom-interaction",Te);var A=class{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(r,e){this.data[r]=e},getData:function(r){return this.data[r]},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=(r,e)=>{if(this._dragCopy===null&&this._dragRunning){this._dragSrc.style.opacity=this._COPYOPACITY,this._dragCopy=this._dragSrc.cloneNode(!0);let i=window.getComputedStyle(this._dragSrc);if(this._dragCopy.style="",this._dragCopy.setAttribute("dragclone",""),this.copyStylesDragClone)for(let l of i)this._dragCopy.style[l]=i.getPropertyValue(l);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="absolute",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 i=this;requestAnimationFrame(function(){i._touchEndCalled||i._dragCopy===null||(i._dragCopy.style.top=e.clientY-i._copyOffset.y+"px",i._dragCopy.style.left=e.clientX-i._copyOffset.x+"px")});var t=this._findDroppable(r);t!=this._lastTarget&&(this._dispatchEvent(t,"dragenter"),this._dispatchEvent(this._lastTarget,"dragleave"),this._lastTarget=t),this._currentDropContainer=t,this._currentDropContainer&&this._dispatchEvent(t,"dragover")}};return A._instance?A._instance:(A._instance=this,document.addEventListener("touchmove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("mousemove",this._touchMove.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchend",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("mouseup",this._touchEnd.bind(this),{passive:!1,capture:!1}),document.addEventListener("touchcancel",this._touchCancel.bind(this),{passive:!1,capture:!1}),this)}addDraggables(r){r.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(r){this._touchBegin=Date.now();let{x:e,y:t}=this.getPositionFromEvent(r);if(this._touchDown={x:e,y:t},this._dragSrc=r.currentTarget,this._canDrag=!0,this.dragOnClick){let i={clientX:e,clientY:t};this._dragRunning=!0,this.createDragCopy(r,i)}r.preventDefault()}_touchMove(r){if(this._canDrag&&this._dragSrc){let{x:e,y:t}=this.getPositionFromEvent(r),i={clientX:e,clientY:t};this._getDelta(i)>=this._DRAGDELTA&&(this._dragRunning=!0),this.createDragCopy(r,i),r.preventDefault()}}_touchEnd(r){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(r){this._reset()}_findDroppable(r){let e,t=r.composedPath().find(i=>{if(i.nodeType===1&&i.nodeName!=="SLOT"&&i.hasAttribute("dropzone"))return i});if(t){let i=t.getRootNode(),l=this._getPoint(r);e=i.elementFromPoint(l.x,l.y)}return e}_getPoint(r,e){return r&&r.touches&&(r=r.touches[0]),{x:e?r.pageX:r.clientX,y:e?r.pageY:r.clientY}}_calculateDragCopyPosition(r){let e=this._dragSrc.getBoundingClientRect();this._copyOffset.x=r.clientX-e.left,this._copyOffset.y=r.clientY-e.top}_getDelta(r){let e=Math.abs(r.clientX-this._touchDown.x),t=Math.abs(r.clientY-this._touchDown.y);return e+t}_dispatchEvent(r,e,t=!0){if(!r)return!1;let i=new CustomEvent(e,{bubbles:t,cancelable:!0});return i.dataTransfer=this._dataTransfer,r.dispatchEvent(i),i.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(r,e){this.data[r]=e},getData:function(r){return this.data[r]},effectAllowed:"move"},this._copyOffset={x:0,y:0},this._lastTarget=null,this._currentDropContainer=null,this._handleClick=!0}getPositionFromEvent(r){let e;if(r.type=="touchstart"||r.type=="touchmove"||r.type=="touchend"||r.type=="touchcancel"){let t=typeof r.originalEvent=="undefined"?r:r.originalEvent,i=t.touches[0]||t.changedTouches[0];e={x:i.pageX,y:i.pageY}}else(r.type=="mousedown"||r.type=="mouseup"||r.type=="mousemove"||r.type=="mouseover"||r.type=="mouseout"||r.type=="mouseenter"||r.type=="mouseleave")&&(e={x:r.clientX,y:r.clientY});return e}};var We=(c,r,e)=>{class t extends c{constructor(){super(...arguments);this.disabled=!1}firstUpdated(n){if(this.classList.contains("qti-match-tabular"))return;super.firstUpdated(n);let o=Array.from(r?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),o.forEach(a=>{a.setAttribute("dropzone","move"),a.addEventListener("dragleave",this.dragleaveHandler),this.attachHandler(a)});for(let a of o)this.observer=new MutationObserver(d=>{d.forEach(p=>{if(p.type==="attributes")switch(p.attributeName){case"disabled":{a.hasAttribute("disabled")?this.removeHandler(a):this.attachHandler(a);break}}})}),this.observer.observe(a,{attributes:!0})}attachHandler(n){n.addEventListener("dragover",this.dragoverHandler),n.addEventListener("drop",this.dropHandler)}removeHandler(n){n.removeEventListener("dragover",this.dragoverHandler),n.removeEventListener("drop",this.dropHandler)}disconnectedCallback(){var n;this.classList.contains("qti-match-tabular")||(super.disconnectedCallback(),(n=this.observer)==null||n.disconnect())}dragoverHandler(n){return n.preventDefault(),n.currentTarget.setAttribute("active",""),n.dataTransfer.dropEffect="move",!1}dropHandler(n){n.preventDefault();let o=n.currentTarget,a=this.querySelector(`[identifier=${n.dataTransfer.getData("text")}`),d=a||this.shadowRoot.querySelector(`[identifier=${n.dataTransfer.getData("text")}`);return o?d.parentElement.getAttribute("identifier")!==o.getAttribute("identifier")&&o.appendChild(d):console.error(`cannot find droppable, target: ${n.target?JSON.stringify(n.target):"null"}`),o.removeAttribute("active"),!1}dragleaveHandler(n){return n.preventDefault(),n.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 Qe=(c,r,e)=>{class t extends c{}return t};function je(c,r){let e,t=_chunkHOQW4KDAcjs.a.call(void 0, {},r);return(i,l)=>{let{connectedCallback:n,disconnectedCallback:o}=i;i.connectedCallback=function(){var p;n.call(this);let a=h=>{let x=Array.from(this.querySelectorAll(c));for(let f of h){let D=Array.from(f.addedNodes).map(S=>S),u=Array.from(f.addedNodes).map(S=>S);f.type==="childList"&&D.find(S=>x.includes(S))&&this[l](D,u)}};e=new MutationObserver(a),e.observe(this,{childList:!0,subtree:!0});let d=(p=this.querySelectorAll(c))!=null?p:[];this[l](Array.from(d),[])},i.disconnectedCallback=function(){o.call(this),e.disconnect()}}}var w=(c,r,e,t)=>{class i extends Qe(We(c,e,t),t,r){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(o,a){if(this.classList.contains("qti-match-tabular"))return;o.filter(p=>!this.draggables||!this.draggables.get(p)).length>0&&(this.dragDropApi.addDraggables(o),o.forEach(p=>{this.draggables.set(p,{parent:p.parentElement,index:Array.from(p.parentNode.children).indexOf(p)}),p.setAttribute("qti-draggable","true"),p.addEventListener("dragstart",h=>{h.dataTransfer.setData("text",h.currentTarget.getAttribute("identifier")),p.setAttribute("dragging","")}),p.addEventListener("dragend",h=>{if(h.preventDefault(),p.removeAttribute("over"),p.removeAttribute("dragging"),h.dataTransfer.dropEffect==="none"&&this.configuration.dragCanBePlacedBack){let x=h.currentTarget,f=this.draggables.get(x),D=f.index<f.parent.children.length?f.index:f.parent.children.length-1,u=f.parent,S=f.parent.children[D];u.insertBefore(x,S),this.saveResponse(),this.checkMaxMatchAssociations()}h.dataTransfer.dropEffect==="move"&&(this.saveResponse(),this.checkMaxMatchAssociations())})}))}handleDragOptionsChanged(o,a){this.dragDropApi.copyStylesDragClone=a.copyStylesDragClone,this.dragDropApi.dragOnClick=a.dragOnClick}handleDisabledChange(o,a){this.draggables.forEach((d,p)=>{a?p.setAttribute("disabled",""):p.removeAttribute("disabled"),a?p.removeAttribute("qti-draggable"):p.setAttribute("qti-draggable","true")})}handleReadonlyChange(o,a){this.draggables.forEach((d,p)=>{a?p.setAttribute("readonly",""):p.removeAttribute("readonly"),a?p.removeAttribute("qti-draggable"):p.setAttribute("qti-draggable","true")})}firstUpdated(o){super.firstUpdated(o),this.droppables=Array.from(e?this.shadowRoot.querySelectorAll(t):this.querySelectorAll(t))}connectedCallback(){super.connectedCallback(),this.dragDropApi=new A,this.dispatchEvent(new CustomEvent(g.ON_REGISTER_INTERACTION,{bubbles:!0,composed:!0,detail:this}))}reset(o=!0){this.draggables.forEach((a,d)=>{let p=a.parent.children,h=a.index<p.length?a.index:p.length;a.parent.insertBefore(d,p[h])}),o&&this.saveResponse()}checkMaxMatchAssociations(){this.droppables.forEach(o=>{let d=+(o.getAttribute("match-max")||1)<=(o.children.length||0);d?o.setAttribute("disabled",""):o.removeAttribute("disabled"),d?o.removeAttribute("dropzone"):o.setAttribute("dropzone","move")})}set response(o){this.classList.contains("qti-match-tabular")||(this.reset(!1),o!==null&&Array.isArray(o)&&o.forEach(a=>{let[d,...p]=a.split(" ").reverse();if(d){let h=this.droppables.find(x=>x.getAttribute("identifier")===d);p.forEach(x=>{let f=this.querySelector(`[identifier=${x}]`);h?f?(h.appendChild(f),this.checkMaxMatchAssociations()):console.error(`cannot find draggable with identifier: ${x}`):console.error(`cannot find droppable with identifier: ${d}`)})}}))}validate(){let a=(e?Array.from(this.shadowRoot.querySelectorAll(t)):Array.from(this.querySelectorAll(t))).filter(d=>d.childElementCount>0).length;return this.minAssociations<=0||this.minAssociations<=a}saveResponse(){let a={list:{pair:this.droppables.map(d=>{var h;let p="";return((h=d.children)==null?void 0:h.length)>0&&(p+=Array.from(d.children).map(x=>x.getAttribute("identifier")).join(" ")+" "),p+=d.getAttribute("identifier"),p})}};this.dispatchEvent(new CustomEvent(g.ON_INTERACTION_RESPONSE,{bubbles:!0,composed:!0,detail:{responseIdentifier:this.responseIdentifier,responses:a}}))}}return _chunkHOQW4KDAcjs.c.call(void 0, [je(r)],i.prototype,"reInitDragAndDrop",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"response-identifier"})],i.prototype,"responseIdentifier",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Object})],i.prototype,"configuration",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "configuration")],i.prototype,"handleDragOptionsChanged",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],i.prototype,"disabled",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],i.prototype,"handleDisabledChange",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,reflect:!0})],i.prototype,"readonly",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],i.prototype,"handleReadonlyChange",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0,attribute:"min-associations"})],i.prototype,"minAssociations",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,reflect:!0,attribute:"max-associations"})],i.prototype,"maxAssociations",2),i};var z=class extends w(m,"qti-simple-associable-choice",!0,"drop-list"){render(){return _lit.html` <slot name="prompt"></slot>
248
+ <slot name="qti-simple-associable-choice"></slot>
249
+ ${this._childrenMap.length>0&&Array.from(Array(Math.ceil(this._childrenMap.length/2)).keys()).map((e,t)=>_lit.html`<div part="associables-container">
250
+ <drop-list part="drop-list" identifier="droplist${t}_left"></drop-list>
251
+ <drop-list part="drop-list" identifier="droplist${t}_right"></drop-list>
252
+ </div>`)}`}connectedCallback(){super.connectedCallback(),this._childrenMap=Array.from(this.querySelectorAll("qti-simple-associable-choice"))}};z.styles=_lit.css`
253
+ :host {
254
+ display: block; /* necessary to calculate scaling position */
255
+ }
256
+ slot[name='qti-simple-associable-choice'] {
257
+ display: flex;
258
+ flex-wrap: wrap;
259
+ gap: 0.5rem;
260
+ }
261
+ `,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],z.prototype,"_childrenMap",2);customElements.define("qti-associate-interaction",z);var ke=class extends _lit.LitElement{connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-simple-associable-choice"),this.setAttribute("part","qti-simple-associable-choice")}render(){return _lit.html`
262
+ <slot></slot>
263
+ <slot name="qti-simple-associable-choice"></slot>
264
+ `}};customElements.define("qti-simple-associable-choice",ke);var le=class extends w(_lit.LitElement,"qti-gap-text",!1,"qti-gap"){render(){return _lit.html` <slot name="qti-gap-text"></slot>
265
+ <slot></slot>`}};le.styles=_lit.css`
266
+ :host {
267
+ display: block; /* necessary to calculate scaling position */
268
+ }
269
+ slot[name='qti-gap-text'] {
270
+ display: flex;
271
+ flex-wrap: wrap;
272
+ gap: var(--qti-gap, 0.5rem);
273
+ padding: var(--qti-gap, 0.5rem) 0px;
274
+ }
275
+ `;customElements.define("qti-gap-match-interaction",le);var Re=class extends _lit.LitElement{connectedCallback(){super.connectedCallback(),this.setAttribute("slot","qti-gap-text")}render(){return _lit.html`<slot></slot>`}};customElements.define("qti-gap-text",Re);var we=class extends _lit.LitElement{render(){return _lit.html` <slot name="qti-gap-text"></slot>`}};customElements.define("qti-gap",we);function B(c,r,e,t){switch(c){case"circle":{let[i,l,n]=r,o=i/e.width*100,a=l/e.height*100,d=n/e.width*100;t.style.left=o-d+"%",t.style.top=a-d+"%",t.style.width=t.style.height=4*d+"px",t.style.clipPath="circle(50% at 50% 50%)"}break;case"rect":{let[i,l,n,o]=r,a=i/e.width*100,d=l/e.height*100,p=n/e.width*100,h=o/e.height*100;t.style.left=a+"%",t.style.top=d+"%",t.style.width=p-a+"%",t.style.height=h-d+"%"}break;case"poly":{let i=r.reduce((u,S,Se,it)=>{if(Se%2===1){let rt=u.pop();u[u.length]={x:rt,y:it[Se]}}else u.push(S);return u},[]),l=Math.min(...i.map(u=>u.x)),n=Math.max(...i.map(u=>u.x)),o=Math.min(...i.map(u=>u.y)),a=Math.max(...i.map(u=>u.y)),d=l/e.width*100,p=o/e.height*100,h=n/e.width*100,x=a/e.height*100;t.style.left=l/e.width*100+"%",t.style.top=o/e.height*100+"%",t.style.width=h-d+"%",t.style.height=x-p+"%";let D=i.map(u=>({x:(u.x-l)/(n-l)*100,y:(u.y-o)/(a-o)*100})).map(u=>Math.round(u.x)+"% "+Math.round(u.y)+"%").join(",");t.style.clipPath=`polygon(${D})`}break;default:break}}var ce=class extends y{render(){return _lit.html`
276
+ <slot name="prompt"></slot>
277
+ <!-- slot for the prompt -->
278
+ <slot></slot>
279
+ <!-- slot for the image and hotspots -->
280
+ `}positionHotspotOnRegister(e){let t=this.querySelector("img"),i=e.target,l=i.getAttribute("coords"),n=i.getAttribute("shape"),o=l.split(",").map(a=>parseInt(a));B(n,o,t,i)}connectedCallback(){super.connectedCallback(),this.addEventListener(g.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(g.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}};ce.styles=[_lit.css`
281
+ slot:not([name='prompt']) {
282
+ position: relative; /* qti-hotspot-choice relative to the slot */
283
+ display: block;
284
+ width: fit-content; /* hotspots not stretching further if image is at max size */
285
+ }
286
+ ::slotted(img) {
287
+ /* image not selectable anymore */
288
+ pointer-events: none;
289
+ user-select: none;
290
+ }
291
+ `];customElements.define("qti-graphic-associate-interaction",ce);var pe=class extends w(m,"qti-gap-img",!1,"qti-associable-hotspot"){render(){return _lit.html` <slot></slot>
292
+ <slot name="qti-gap-img"></slot>`}positionHotspotOnRegister(r){let e=r.target,t=e.getAttribute("coords"),i=e.getAttribute("shape"),l=t.split(",").map(n=>parseInt(n));switch(i){case"circle":{let[n,o,a]=l;e.style.left=n-a+"px",e.style.top=o-a+"px",e.style.width=e.style.height=2*a+"px"}break;case"rect":{let[n,o,a,d]=l;e.style.left=n+"px",e.style.top=o+"px",e.style.width=a-n+"px",e.style.height=d-o+"px"}break;default:break}}connectedCallback(){super.connectedCallback(),this.addEventListener(g.ON_REGISTER_HOTSPOT,this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(g.ON_REGISTER_HOTSPOT,this.positionHotspotOnRegister)}};pe.styles=_lit.css`
293
+ slot[name="qti-gap-img"] {
294
+ display: flex;
295
+ gap: 1rem;
296
+ }
297
+ `;customElements.define("qti-graphic-gap-match-interaction",pe);var de=class extends y{render(){return _lit.html`
298
+ <slot name="prompt"></slot>
299
+ <!-- slot for the prompt -->
300
+ <slot></slot>
301
+ <!-- slot for the image and hotspots -->
302
+ `}setHotspotOrder(e){let{identifier:t}=e.detail,i=this._choiceElements.find(n=>n.getAttribute("identifier")===t),l=this._choiceElements.length;if(!this.choiceOrdering){if(this.choiceOrdering=!0,i.order==null){if(this._choiceElements.filter(n=>n.order>0).length>=l){this.choiceOrdering=!1;return}i.order=this._choiceElements.filter(n=>!!n.order).length+1,this.choiceOrdering=!1;return}else this._choiceElements.forEach(n=>(n.order>n.order&&n.order--,n)),i.order=null;this.choiceOrdering=!1}}positionHotspotOnRegister(e){let t=this.querySelector("img"),i=e.target,l=i.getAttribute("coords"),n=i.getAttribute("shape"),o=l.split(",").map(a=>parseInt(a));B(n,o,t,i)}connectedCallback(){super.connectedCallback(),this.addEventListener(g.ON_CHOICE_ELEMENT_SELECTED,this.setHotspotOrder),this.addEventListener(g.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener(g.ON_CHOICE_ELEMENT_SELECTED,this.setHotspotOrder),this.removeEventListener(g.ON_REGISTER_CHOICE,this.positionHotspotOnRegister)}};de.styles=[_lit.css`
303
+ slot:not([name='prompt']) {
304
+ position: relative; /* qti-hotspot-choice relative to the slot */
305
+ display: block;
306
+ width: fit-content; /* hotspots not stretching further if image is at max size */
307
+ }
308
+ ::slotted(img) {
309
+ /* image not selectable anymore */
310
+ pointer-events: none;
311
+ user-select: none;
312
+ }
313
+ `];customElements.define("qti-graphic-order-interaction",de);var me=class extends y{render(){return _lit.html`
314
+ <slot name="prompt"></slot>
315
+ <!-- slot for the prompt -->
316
+ <slot></slot>
317
+ <!-- slot for the image and hotspots -->
318
+ `}positionHotspotOnRegister(r){let e=this.querySelector("img"),t=r.target,i=t.getAttribute("coords"),l=t.getAttribute("shape"),n=i.split(",").map(o=>parseInt(o));B(l,n,e,t)}connectedCallback(){super.connectedCallback(),this.addEventListener("qti-register-choice",this.positionHotspotOnRegister)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("qti-register-choice",this.positionHotspotOnRegister)}};me.styles=[_lit.css`
319
+ slot:not([name='prompt']) {
320
+ position: relative; /* qti-hotspot-choice relative to the slot */
321
+ display: block;
322
+ width: fit-content; /* hotspots not stretching further if image is at max size */
323
+ }
324
+ ::slotted(img) {
325
+ /* image not selectable anymore */
326
+ pointer-events: none;
327
+ user-select: none;
328
+ }
329
+ `];customElements.define("qti-hotspot-interaction",me);var W=class extends C{};W.styles=_lit.css`
330
+ :host {
331
+ position: absolute;
332
+ }
333
+ `,_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {attribute:"aria-ordervalue",type:Number,reflect:!0})],W.prototype,"order",2);customElements.define("qti-hotspot-choice",W);var M=_lit.css`
334
+ .notification {
335
+ position: absolute;
336
+ z-index: 100000;
337
+ top: 0;
338
+ bottom: 0;
339
+ right: 0;
340
+ left: 0;
341
+ /* background: repeating-linear-gradient(45deg, #606cbc00, #606cbc00 10px, #4652980f 10px, #4652980f 20px); */
342
+ }
343
+ .notification:after {
344
+ position: absolute;
345
+ right: 1rem;
346
+ top: 1rem;
347
+ background-color: #222222;
348
+ color: #dddddd;
349
+ font-size: 14px;
350
+ width: fit-content;
351
+ padding: 0.4rem 0.6rem;
352
+ border-radius: 99999px;
353
+ content: 'preview not interactive';
354
+ }
355
+ `;var he=class extends w(_lit.LitElement,"qti-simple-match-set:first-of-type qti-simple-associable-choice",!1,"qti-simple-match-set:last-of-type qti-simple-associable-choice"){render(){return _lit.html`
356
+ <slot name="prompt"></slot>
357
+ <slot></slot>`}};he.styles=[M];customElements.define("qti-match-interaction",he);var ue=class extends v{constructor(){super()}reset(){}validate(){return!0}set response(e){}static get properties(){return _chunkHOQW4KDAcjs.b.call(void 0, _chunkHOQW4KDAcjs.a.call(void 0, {},v.properties),{step:{type:Number,attribute:"step",default:10}})}render(){return _lit.html`
358
+ <slot name="prompt"></slot>
359
+ <slot></slot>`}connectedCallback(){super.connectedCallback()}};ue.styles=[M,_lit.css``];customElements.define("qti-media-interaction",ue);var Q=class extends w(m,"qti-simple-choice",!0,"drop-list"){static get properties(){return{_classNames:{type:String,attribute:"class"},_orientation:{type:String,attribute:"orientation"}}}render(){return _lit.html` <slot name="prompt"> </slot>
360
+ <div class=${`container ${this._classNames}`}>
361
+ <slot class=${this._orientation==="vertical"?"ver":"hor"}> </slot>
362
+ <div class=${this._orientation==="vertical"?"ver":"hor"}>
363
+ ${this.childrenMap.map((e,t)=>_lit.html`<drop-list part="drop-list" identifier="droplist${t}"></drop-list>`)}
364
+ </div>
365
+ </div>`}connectedCallback(){super.connectedCallback(),this.childrenMap=Array.from(this.querySelectorAll("qti-simple-choice")),this.childrenMap.forEach(e=>e.setAttribute("part","qti-simple-choice"))}};Q.layoutClass=["qti-choices-top","qti-choices-bottom","qti-choices-left","qti-choices-right"],Q.styles=[M,_lit.css`
366
+ .hor {
367
+ display: grid;
368
+ gap: var(--qti-gap, 2px);
369
+ grid-auto-flow: column;
370
+ grid-auto-columns: 1fr;
371
+ }
372
+ .ver {
373
+ width:50%;
374
+ display: grid;
375
+ gap: var(--qti-gap, 2px);
376
+ grid-auto-flow: row;
377
+ grid-auto-columns: 1fr;
378
+ }
379
+ .container {
380
+ display: flex;
381
+ gap: var(--qti-gap, 2px);
382
+ }
383
+ .qti-choices-top {
384
+ flex-direction: column;
385
+ }
386
+ .qti-choices-bottom {
387
+ flex-direction: column-reverse;
388
+ }
389
+ .qti-choices-left {
390
+ flex-direction: row;
391
+ }
392
+ .qti-choices-right {
393
+ flex-direction: row-reverse;
394
+ }
395
+ drop-list:empty::before {
396
+ content: 'drop here';
397
+ color: var(--qti-placeholder-text);
398
+ }
399
+ `];customElements.define("qti-order-interaction",Q);var fe=class extends y{constructor(){super()}render(){return _lit.html`<slot></slot>
400
+ <div class="notification"></div>`}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}};fe.styles=[M];customElements.define("qti-select-point-interaction",fe);var _=class extends v{constructor(){super(...arguments);this.stepLabel=!1;this.reverse=!1;this._handleDisabledChange=(e,t)=>{};this._handleReadonlyChange=(e,t)=>{}}set min(e){this._min=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){this.value=e}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 _lit.html`<slot name="prompt"></slot>
401
+ <div id="rail" @mousedown=${this._onMouseDown} @touchstart=${this._onTouchMove} part="rail">
402
+ <div id="knob" part="knob" style="left:${e}%"></div>
403
+ </div>`}connectedCallback(){super.connectedCallback(),this.step=1,this.setAttribute("tabindex","0"),this.setAttribute("role","slider")}_onTouchMove(e){let t=o=>{let{x:a}=this.getPositionFromEvent(o),d=a-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(d),o.stopPropagation()},i=()=>{document.removeEventListener("touchmove",t),document.removeEventListener("touchend",i),this.saveResponse({base:{float:this.value}})};document.addEventListener("touchmove",t),document.addEventListener("touchend",i);let{x:l}=this.getPositionFromEvent(e),n=l-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(n),e.stopPropagation()}_onMouseDown(e){let t=n=>{let o=n.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(o),n.preventDefault(),n.stopPropagation()},i=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i),this.saveResponse({base:{float:this.value}})};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i);let l=e.pageX-this._rail.getBoundingClientRect().left-document.documentElement.scrollLeft;this.calculateValue(l),e.preventDefault(),e.stopPropagation()}calculateValue(e){let t=this.min+(this.max-this.min)*e/this.offsetWidth,i=this.min+Math.round((t-this.min)/this._step)*this._step;this.value=i}getPositionFromEvent(e){let t;if(e.type=="touchstart"||e.type=="touchmove"||e.type=="touchend"||e.type=="touchcancel"){let i=typeof e.originalEvent=="undefined"?e:e.originalEvent,l=i.touches[0]||i.changedTouches[0];t={x:l.pageX,y:l.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}};_.styles=[_lit.css``],_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.query.call(void 0, "#knob")],_.prototype,"_knob",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.query.call(void 0, "#rail")],_.prototype,"_rail",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number})],_.prototype,"value",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean,attribute:"step-label"})],_.prototype,"stepLabel",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Boolean})],_.prototype,"reverse",2),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"lower-bound"})],_.prototype,"min",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"upper-bound"})],_.prototype,"max",1),_chunkHOQW4KDAcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:Number,attribute:"step"})],_.prototype,"step",1),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "disabled",{waitUntilFirstUpdate:!0})],_.prototype,"_handleDisabledChange",2),_chunkHOQW4KDAcjs.c.call(void 0, [_chunk2TX3IEPDcjs.a.call(void 0, "readonly",{waitUntilFirstUpdate:!0})],_.prototype,"_handleReadonlyChange",2);customElements.define("qti-slider-interaction",_);exports.Choices = y; exports.DragDropInteractionMixin = w; exports.DroppablesMixin = We; exports.Events = g; exports.FlippablesMixin = Qe; exports.OutcomeVariable = P; exports.QtiAssessmentItem = q; exports.QtiAssociateInteraction = z; exports.QtiChoice = C; exports.QtiChoiceElementSelected = Ve; exports.QtiCompanionMaterialsInfo = Z; exports.QtiExtendedTextInteraction = R; exports.QtiFeedbackInline = re; exports.QtiGap = we; exports.QtiGapMatchInteraction = le; exports.QtiGapText = Re; exports.QtiGraphicAssociateInteraction = ce; exports.QtiGraphicGapMatchInteraction = pe; exports.QtiGraphicOrderInteraction = de; exports.QtiHotspotChoice = W; exports.QtiHotspotInteraction = me; exports.QtiHottext = oe; exports.QtiHottextInteraction = qe; exports.QtiInlineChoiceInteraction = ne; exports.QtiInteractionChanged = Ae; exports.QtiInteractionResponse = Ie; exports.QtiLooseChoice = Pe; exports.QtiMatchInteraction = he; exports.QtiMediaInteraction = ue; exports.QtiModalFeedback = Ee; exports.QtiOrderInteraction = Q; exports.QtiOutcomeChanged = Le; exports.QtiOutcomeDeclaration = ye; exports.QtiPortableCustomInteraction = Te; exports.QtiPrompt = ge; exports.QtiRegisterChoice = Ne; exports.QtiRegisterHotspot = De; exports.QtiRegisterInteraction = He; exports.QtiRegisterVariable = Me; exports.QtiResponseDeclaration = V; exports.QtiResponseProcessing = F; exports.QtiRule = J; exports.QtiSelectPointInteraction = fe; exports.QtiSliderInteraction = _; exports.QtiStylesheet = be; exports.QtiTextEntryInteraction = se; exports.ResponseVariable = O; exports.TouchDragAndDrop = A; exports.qtiContentBody = te; exports.qtiRubricBlock = T; exports.qtiSimpleAssociableChoice = ke;