@citolab/qti-components 6.3.3 → 6.3.5

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,79 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkLWL4UHCJcjs = require('./chunk-LWL4UHCJ.cjs');var _chunk6G76D2MIcjs = require('./chunk-6G76D2MI.cjs');var _decoratorsjs = require('lit/decorators.js');var d=class extends _chunkLWL4UHCJcjs.a{connectedCallback(){super.connectedCallback();let t=new CustomEvent("register-item-ref",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href}});this.dispatchEvent(t)}};_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],d.prototype,"identifier",2),_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String})],d.prototype,"href",2),d= exports.a =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-assessment-item-ref")],d);var _lit = require('lit');var _context2 = require('@lit/context');var i=_context2.createContext.call(void 0, "test");var x=class extends _lit.LitElement{constructor(){super();this.context={itemIndex:null,items:[]};this.itemRefEls=new Map;this.itemConnected=t=>{let s=this.context.items.findIndex(o=>o.identifier===t.identifier);this.context=_chunk6G76D2MIcjs.b.call(void 0, _chunk6G76D2MIcjs.a.call(void 0, {},this.context),{itemIndex:s});let r=this.context.items.find(o=>(o==null?void 0:o.identifier)===(t==null?void 0:t.identifier));r.variables.length===1?this.copyItemVariables(t.identifier):t.variables=[...r.variables]};this.addEventListener("register-item-ref",this.onItemRefRegistered),this.addEventListener("on-test-request-item",this.onTestRequestItem),this.addEventListener("qti-item-connected",t=>this.itemConnected(t.detail)),this.addEventListener("qti-interaction-changed",t=>this.copyItemVariables(t.detail.item)),this.addEventListener("qti-outcome-changed",t=>this.copyItemVariables(t.detail.item))}copyItemVariables(t){this.context=_chunk6G76D2MIcjs.b.call(void 0, _chunk6G76D2MIcjs.a.call(void 0, {},this.context),{items:this.context.items.map(s=>s.identifier==t?_chunk6G76D2MIcjs.b.call(void 0, _chunk6G76D2MIcjs.a.call(void 0, {},s),{variables:this.getAssessmentItem(t).context.variables}):s)})}getAssessmentItem(t){return this.querySelector(`qti-assessment-item-ref[identifier="${t}"]`).assessmentItem}onItemRefRegistered(t){this.itemRefEls.set(t.detail.identifier,t.target);let{href:s,identifier:r}=t.detail;this.context.items=[...this.context.items,{href:s,identifier:r,variables:[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"}]}]}onTestRequestItem(t){t.stopImmediatePropagation(),t.detail!==this.context.itemIndex&&(this.context=_chunk6G76D2MIcjs.b.call(void 0, _chunk6G76D2MIcjs.a.call(void 0, {},this.context),{itemIndex:null}),this._requestItem(this.context.items[t.detail].identifier))}firstUpdated(t){super.firstUpdated(t),this._requestItem(this.context.items[0].identifier)}_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-set-item",{bubbles:!0,composed:!0,detail:t}))}render(){return _lit.html`<slot></slot>`}};_chunk6G76D2MIcjs.c.call(void 0, [_context2.provide.call(void 0, {context:i}),_decoratorsjs.property.call(void 0, {attribute:!1})],x.prototype,"context",2),x= exports.b =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-assessment-test")],x);var h=class extends _lit.LitElement{constructor(){super(...arguments);this._navigationMode="linear"}render(){return _lit.html`
2
+ <slot name="qti-item"></slot>
3
+ <slot> </slot>
4
+ `}};_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"navigation-mode"})],h.prototype,"_navigationMode",2),h= exports.c =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-test-part")],h);var _haunted = require('haunted');var f=class extends _lit.LitElement{constructor(){super(...arguments);this._navigationMode="linear";this.loadedItems=[];this.itemRefEls=_haunted.useRef.call(void 0, new Map);this.controller=new AbortController}requestItem(t){let s=async()=>{for(let m of this.itemRefEls.current.values())m.xml="";let r=this.itemRefEls.current.get(t),n=new AbortController().signal;try{let u=await(await fetch(`${this.assessmentTestURI}/items/${r.href}`,{signal:n})).text();r.xml=u}catch(m){m.name==="AbortError"?console.log("Fetch aborted"):console.error(m)}};this.controller&&this.controller.abort(),s()}render(){return _lit.html`
5
+ <qti-assessment-test
6
+ @register-item-ref=${t=>{this.itemRefEls.current.set(t.target.identifier,t.target),t.target.itemLocation=`${this.assessmentTestURI}/items/${t.target.href}`}}
7
+ @on-test-set-item=${({detail:t})=>this.requestItem(t)}
8
+ >
9
+ <test-show-index></test-show-index>
10
+ <qti-test-part identifier="part1" navigation-mode="nonlinear" submission-mode="individual">
11
+ <qti-assessment-section identifier="section-1" title="Section 1" visible="true" required="true">
12
+ ${this.loadedItems.map(t=>_lit.html`<qti-assessment-item-ref identifier="${t.identifier}" href="${t.href}">
13
+ </qti-assessment-item-ref>`)}
14
+ </qti-assessment-section>
15
+ </qti-test-part>
16
+ <test-next>NEXT</test-next>
17
+
18
+ <test-prev>PREV</test-prev>
19
+ <test-progress></test-progress>
20
+ <test-paging-buttons></test-paging-buttons>
21
+ <test-paging-radio></test-paging-radio>
22
+ <test-slider></test-slider>
23
+ <test-show-correct>correct</test-show-correct>
24
+ <test-print-variables></test-print-variables>
25
+ </qti-assessment-test>
26
+ `}};_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"navigation-mode"})],f.prototype,"_navigationMode",2),_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.property.call(void 0, {type:String,attribute:"assessment-test-uri"})],f.prototype,"assessmentTestURI",2),f= exports.d =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "qti-test")],f);var b=class extends _lit.LitElement{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testContext,r=Math.min(s+1,t.length-1);return _lit.html`
27
+ <button part="button" @click=${o=>this._requestItem(r)} id="${t[r].identifier}">
28
+ <slot></slot>
29
+ </button>
30
+ `}};_chunk6G76D2MIcjs.c.call(void 0, [_context2.consume.call(void 0, {context:i,subscribe:!0}),_decoratorsjs.state.call(void 0, )],b.prototype,"_testContext",2),b= exports.e =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-next")],b);var v=class extends _lit.LitElement{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testContext,r=Math.max(s-1,0);return _lit.html`
31
+ <button part="button" @click=${o=>this._requestItem(r)} id="${t[r].identifier}">
32
+ <slot></slot>
33
+ </button>
34
+ `}};_chunk6G76D2MIcjs.c.call(void 0, [_context2.consume.call(void 0, {context:i,subscribe:!0}),_decoratorsjs.state.call(void 0, )],v.prototype,"_testContext",2),v= exports.f =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-prev")],v);var E=class extends _lit.LitElement{render(){let{items:t,itemIndex:s}=this._testProvider;return _lit.html`
35
+ <progress part="progress" id="file" max=${t.length-1} value=${s}>
36
+ ${s/(t.length-1)}%
37
+ </progress>
38
+ `}};_chunk6G76D2MIcjs.c.call(void 0, [_context2.consume.call(void 0, {context:i,subscribe:!0}),_decoratorsjs.state.call(void 0, )],E.prototype,"_testProvider",2),E= exports.g =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-progress")],E);var C=class extends _lit.LitElement{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testProvider;return _lit.html`
39
+ <input
40
+ part="input"
41
+ type="range"
42
+ value=${s}
43
+ class="absolute w-full appearance-none bg-transparent"
44
+ max=${t.length-1}
45
+ @input=${r=>this._requestItem(+r.target.value)}
46
+ />
47
+ `}};_chunk6G76D2MIcjs.c.call(void 0, [_context2.consume.call(void 0, {context:i,subscribe:!0}),_decoratorsjs.state.call(void 0, )],C.prototype,"_testProvider",2),C= exports.h =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-slider")],C);var I=class extends _lit.LitElement{createRenderRoot(){return this}_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testProvider;return _lit.html`
48
+ ${t.map((r,o)=>{var n;return _lit.html` <label>
49
+ <input
50
+ type="radio"
51
+ part="input"
52
+ name="item"
53
+ value="${o}"
54
+ ?checked=${o===s}
55
+ @change=${m=>this._requestItem(o)}
56
+ data-completion-status=${(n=r.variables.find(m=>m.identifier==="completionStatus"))==null?void 0:n.value}
57
+ id="${r.identifier}"
58
+ />
59
+ ${o+1}
60
+ </label>`})}
61
+ `}};_chunk6G76D2MIcjs.c.call(void 0, [_context2.consume.call(void 0, {context:i,subscribe:!0}),_decoratorsjs.state.call(void 0, )],I.prototype,"_testProvider",2),I= exports.i =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-paging-radio")],I);var g=class extends _lit.LitElement{createRenderRoot(){return this}_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testProvider;return _lit.html`
62
+ ${t.map((r,o)=>{var n;return _lit.html` <button
63
+ part="button"
64
+ data-completion-status=${(n=r.variables.find(m=>m.identifier==="completionStatus"))==null?void 0:n.value}
65
+ data-active-item=${o===s}
66
+ @click=${m=>this._requestItem(o)}
67
+ id="${r.identifier}"
68
+ >
69
+ ${o+1}
70
+ </button>`})}
71
+ `}};_chunk6G76D2MIcjs.c.call(void 0, [_context2.consume.call(void 0, {context:i,subscribe:!0}),_decoratorsjs.state.call(void 0, )],g.prototype,"_testProvider",2),g= exports.j =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-paging-buttons")],g);var q=class extends _lit.LitElement{render(){var o,n,m;let{items:t,itemIndex:s}=this._testProvider;if(s==null)return _lit.html``;let r=(m=(n=this.closest("qti-assessment-test"))==null?void 0:n.itemRefEls.get((o=t[s])==null?void 0:o.identifier))==null?void 0:m.assessmentItem;return _lit.html`
72
+ <button part="button" @click=${u=>r.showCorrectResponse()}>
73
+ <slot></slot>
74
+ </button>
75
+ `}};_chunk6G76D2MIcjs.c.call(void 0, [_context2.consume.call(void 0, {context:i,subscribe:!0}),_decoratorsjs.state.call(void 0, )],q.prototype,"_testProvider",2),q= exports.k =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-show-correct")],q);var _=class extends _lit.LitElement{constructor(){super(...arguments);this._printed=""}render(){return _lit.html`${this._printed}<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(t){var r,o;let s=Array.from((r=this.childNodes)!=null?r:[]).find(n=>n.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","item",(o=s.textContent)!=null?o:"")}catch(n){console.error("custom-operator contains invalid javascript code",n)}this._context=new (0, _context2.ContextConsumer)(this,i,n=>{this._printed=this.operatorFunction(n,this.closest("qti-assessment-item"))},!0)}};_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.state.call(void 0, )],_.prototype,"_printed",2),_= exports.l =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-script")],_);var $=class extends _lit.LitElement{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testContext,r=t[s-1];return _lit.html` ${s+1}/${t.length} `}};_chunk6G76D2MIcjs.c.call(void 0, [_context2.consume.call(void 0, {context:i,subscribe:!0}),_decoratorsjs.state.call(void 0, )],$.prototype,"_testContext",2),$= exports.m =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-show-index")],$);var y=class extends _lit.LitElement{render(){return _lit.html`
76
+ <pre>
77
+ ${JSON.stringify(_chunk6G76D2MIcjs.b.call(void 0, _chunk6G76D2MIcjs.a.call(void 0, {},this._testProvider),{items:this._testProvider.items.map(t=>_chunk6G76D2MIcjs.b.call(void 0, _chunk6G76D2MIcjs.a.call(void 0, {},t),{itemEl:null}))}),null,2)}</pre
78
+ >
79
+ `}};_chunk6G76D2MIcjs.c.call(void 0, [_context2.consume.call(void 0, {context:i,subscribe:!0}),_decoratorsjs.state.call(void 0, )],y.prototype,"_testProvider",2),y= exports.n =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-print-variables")],y);var R=class extends _lit.LitElement{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t}=this._testContext,s=t.reduce((o,n)=>{let m=n.variables.find(u=>u.identifier==="SCORE");return o+(m?+m.value:0)},0),r=t.reduce((o,n)=>{let m=n.variables.find(u=>u.identifier==="MAXSCORE");return o+(m?+m.value:0)},0);return _lit.html` ${s}/${r}`}};_chunk6G76D2MIcjs.c.call(void 0, [_context2.consume.call(void 0, {context:i,subscribe:!0}),_decoratorsjs.state.call(void 0, )],R.prototype,"_testContext",2),R= exports.o =_chunk6G76D2MIcjs.c.call(void 0, [_decoratorsjs.customElement.call(void 0, "test-print-score")],R);exports.a = d; exports.b = x; exports.c = h; exports.d = f; exports.e = b; exports.f = v; exports.g = E; exports.h = C; exports.i = I; exports.j = g; exports.k = q; exports.l = _; exports.m = $; exports.n = y; exports.o = R;
@@ -0,0 +1,79 @@
1
+ import{a as L}from"./chunk-LNHTXQXY.js";import{a as p,b as l,c as e}from"./chunk-343LZK3D.js";import{customElement as U,property as w}from"lit/decorators.js";var d=class extends L{connectedCallback(){super.connectedCallback();let t=new CustomEvent("register-item-ref",{bubbles:!0,composed:!0,detail:{identifier:this.identifier,href:this.href}});this.dispatchEvent(t)}};e([w({type:String})],d.prototype,"identifier",2),e([w({type:String})],d.prototype,"href",2),d=e([U("qti-assessment-item-ref")],d);import{html as X,LitElement as j}from"lit";import{customElement as D,property as H}from"lit/decorators.js";import{provide as J}from"@lit/context";import{createContext as N}from"@lit/context";var i=N("test");var x=class extends j{constructor(){super();this.context={itemIndex:null,items:[]};this.itemRefEls=new Map;this.itemConnected=t=>{let s=this.context.items.findIndex(o=>o.identifier===t.identifier);this.context=l(p({},this.context),{itemIndex:s});let r=this.context.items.find(o=>(o==null?void 0:o.identifier)===(t==null?void 0:t.identifier));r.variables.length===1?this.copyItemVariables(t.identifier):t.variables=[...r.variables]};this.addEventListener("register-item-ref",this.onItemRefRegistered),this.addEventListener("on-test-request-item",this.onTestRequestItem),this.addEventListener("qti-item-connected",t=>this.itemConnected(t.detail)),this.addEventListener("qti-interaction-changed",t=>this.copyItemVariables(t.detail.item)),this.addEventListener("qti-outcome-changed",t=>this.copyItemVariables(t.detail.item))}copyItemVariables(t){this.context=l(p({},this.context),{items:this.context.items.map(s=>s.identifier==t?l(p({},s),{variables:this.getAssessmentItem(t).context.variables}):s)})}getAssessmentItem(t){return this.querySelector(`qti-assessment-item-ref[identifier="${t}"]`).assessmentItem}onItemRefRegistered(t){this.itemRefEls.set(t.detail.identifier,t.target);let{href:s,identifier:r}=t.detail;this.context.items=[...this.context.items,{href:s,identifier:r,variables:[{identifier:"completionStatus",cardinality:"single",baseType:"string",value:"not_attempted",type:"outcome"}]}]}onTestRequestItem(t){t.stopImmediatePropagation(),t.detail!==this.context.itemIndex&&(this.context=l(p({},this.context),{itemIndex:null}),this._requestItem(this.context.items[t.detail].identifier))}firstUpdated(t){super.firstUpdated(t),this._requestItem(this.context.items[0].identifier)}_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-set-item",{bubbles:!0,composed:!0,detail:t}))}render(){return X`<slot></slot>`}};e([J({context:i}),H({attribute:!1})],x.prototype,"context",2),x=e([D("qti-assessment-test")],x);import{html as V,LitElement as z}from"lit";import{customElement as G,property as K}from"lit/decorators.js";var h=class extends z{constructor(){super(...arguments);this._navigationMode="linear"}render(){return V`
2
+ <slot name="qti-item"></slot>
3
+ <slot> </slot>
4
+ `}};e([K({type:String,attribute:"navigation-mode"})],h.prototype,"_navigationMode",2),h=e([G("qti-test-part")],h);import{useRef as W}from"haunted";import{html as M,LitElement as Y}from"lit";import{customElement as Z,property as A}from"lit/decorators.js";var f=class extends Y{constructor(){super(...arguments);this._navigationMode="linear";this.loadedItems=[];this.itemRefEls=W(new Map);this.controller=new AbortController}requestItem(t){let s=async()=>{for(let m of this.itemRefEls.current.values())m.xml="";let r=this.itemRefEls.current.get(t),n=new AbortController().signal;try{let u=await(await fetch(`${this.assessmentTestURI}/items/${r.href}`,{signal:n})).text();r.xml=u}catch(m){m.name==="AbortError"?console.log("Fetch aborted"):console.error(m)}};this.controller&&this.controller.abort(),s()}render(){return M`
5
+ <qti-assessment-test
6
+ @register-item-ref=${t=>{this.itemRefEls.current.set(t.target.identifier,t.target),t.target.itemLocation=`${this.assessmentTestURI}/items/${t.target.href}`}}
7
+ @on-test-set-item=${({detail:t})=>this.requestItem(t)}
8
+ >
9
+ <test-show-index></test-show-index>
10
+ <qti-test-part identifier="part1" navigation-mode="nonlinear" submission-mode="individual">
11
+ <qti-assessment-section identifier="section-1" title="Section 1" visible="true" required="true">
12
+ ${this.loadedItems.map(t=>M`<qti-assessment-item-ref identifier="${t.identifier}" href="${t.href}">
13
+ </qti-assessment-item-ref>`)}
14
+ </qti-assessment-section>
15
+ </qti-test-part>
16
+ <test-next>NEXT</test-next>
17
+
18
+ <test-prev>PREV</test-prev>
19
+ <test-progress></test-progress>
20
+ <test-paging-buttons></test-paging-buttons>
21
+ <test-paging-radio></test-paging-radio>
22
+ <test-slider></test-slider>
23
+ <test-show-correct>correct</test-show-correct>
24
+ <test-print-variables></test-print-variables>
25
+ </qti-assessment-test>
26
+ `}};e([A({type:String,attribute:"navigation-mode"})],f.prototype,"_navigationMode",2),e([A({type:String,attribute:"assessment-test-uri"})],f.prototype,"assessmentTestURI",2),f=e([Z("qti-test")],f);import{html as S,LitElement as B}from"lit";import{customElement as P,state as T}from"lit/decorators.js";import{consume as Q}from"@lit/context";var b=class extends B{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testContext,r=Math.min(s+1,t.length-1);return S`
27
+ <button part="button" @click=${o=>this._requestItem(r)} id="${t[r].identifier}">
28
+ <slot></slot>
29
+ </button>
30
+ `}};e([Q({context:i,subscribe:!0}),T()],b.prototype,"_testContext",2),b=e([P("test-next")],b);import{html as tt,LitElement as et}from"lit";import{customElement as st,state as rt}from"lit/decorators.js";import{consume as ot}from"@lit/context";var v=class extends et{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testContext,r=Math.max(s-1,0);return tt`
31
+ <button part="button" @click=${o=>this._requestItem(r)} id="${t[r].identifier}">
32
+ <slot></slot>
33
+ </button>
34
+ `}};e([ot({context:i,subscribe:!0}),rt()],v.prototype,"_testContext",2),v=e([st("test-prev")],v);import{consume as it}from"@lit/context";import{LitElement as nt,html as mt}from"lit";import{customElement as at,state as ct}from"lit/decorators.js";var E=class extends nt{render(){let{items:t,itemIndex:s}=this._testProvider;return mt`
35
+ <progress part="progress" id="file" max=${t.length-1} value=${s}>
36
+ ${s/(t.length-1)}%
37
+ </progress>
38
+ `}};e([it({context:i,subscribe:!0}),ct()],E.prototype,"_testProvider",2),E=e([at("test-progress")],E);import{consume as pt}from"@lit/context";import{LitElement as lt,html as ut}from"lit";import{customElement as dt,state as ft}from"lit/decorators.js";var C=class extends lt{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testProvider;return ut`
39
+ <input
40
+ part="input"
41
+ type="range"
42
+ value=${s}
43
+ class="absolute w-full appearance-none bg-transparent"
44
+ max=${t.length-1}
45
+ @input=${r=>this._requestItem(+r.target.value)}
46
+ />
47
+ `}};e([pt({context:i,subscribe:!0}),ft()],C.prototype,"_testProvider",2),C=e([dt("test-slider")],C);import{consume as xt}from"@lit/context";import{LitElement as ht,html as F}from"lit";import{customElement as bt,state as vt}from"lit/decorators.js";var I=class extends ht{createRenderRoot(){return this}_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testProvider;return F`
48
+ ${t.map((r,o)=>{var n;return F` <label>
49
+ <input
50
+ type="radio"
51
+ part="input"
52
+ name="item"
53
+ value="${o}"
54
+ ?checked=${o===s}
55
+ @change=${m=>this._requestItem(o)}
56
+ data-completion-status=${(n=r.variables.find(m=>m.identifier==="completionStatus"))==null?void 0:n.value}
57
+ id="${r.identifier}"
58
+ />
59
+ ${o+1}
60
+ </label>`})}
61
+ `}};e([xt({context:i,subscribe:!0}),vt()],I.prototype,"_testProvider",2),I=e([bt("test-paging-radio")],I);import{consume as Et}from"@lit/context";import{LitElement as Ct,html as k}from"lit";import{customElement as It,state as gt}from"lit/decorators.js";var g=class extends Ct{createRenderRoot(){return this}_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testProvider;return k`
62
+ ${t.map((r,o)=>{var n;return k` <button
63
+ part="button"
64
+ data-completion-status=${(n=r.variables.find(m=>m.identifier==="completionStatus"))==null?void 0:n.value}
65
+ data-active-item=${o===s}
66
+ @click=${m=>this._requestItem(o)}
67
+ id="${r.identifier}"
68
+ >
69
+ ${o+1}
70
+ </button>`})}
71
+ `}};e([Et({context:i,subscribe:!0}),gt()],g.prototype,"_testProvider",2),g=e([It("test-paging-buttons")],g);import{consume as qt}from"@lit/context";import{LitElement as _t,html as O}from"lit";import{customElement as $t,state as yt}from"lit/decorators.js";var q=class extends _t{render(){var o,n,m;let{items:t,itemIndex:s}=this._testProvider;if(s==null)return O``;let r=(m=(n=this.closest("qti-assessment-test"))==null?void 0:n.itemRefEls.get((o=t[s])==null?void 0:o.identifier))==null?void 0:m.assessmentItem;return O`
72
+ <button part="button" @click=${u=>r.showCorrectResponse()}>
73
+ <slot></slot>
74
+ </button>
75
+ `}};e([qt({context:i,subscribe:!0}),yt()],q.prototype,"_testProvider",2),q=e([$t("test-show-correct")],q);import{ContextConsumer as Rt}from"@lit/context";import{html as Lt,LitElement as wt}from"lit";import{customElement as Mt,state as At}from"lit/decorators.js";var _=class extends wt{constructor(){super(...arguments);this._printed=""}render(){return Lt`${this._printed}<slot @slotchange=${this.handleSlotChange}></slot>`}handleSlotChange(t){var r,o;let s=Array.from((r=this.childNodes)!=null?r:[]).find(n=>n.nodeType===Node.COMMENT_NODE);try{this.operatorFunction=new Function("context","item",(o=s.textContent)!=null?o:"")}catch(n){console.error("custom-operator contains invalid javascript code",n)}this._context=new Rt(this,i,n=>{this._printed=this.operatorFunction(n,this.closest("qti-assessment-item"))},!0)}};e([At()],_.prototype,"_printed",2),_=e([Mt("test-script")],_);import{html as Ft,LitElement as kt}from"lit";import{customElement as Ot,state as Ut}from"lit/decorators.js";import{consume as Nt}from"@lit/context";var $=class extends kt{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t,itemIndex:s}=this._testContext,r=t[s-1];return Ft` ${s+1}/${t.length} `}};e([Nt({context:i,subscribe:!0}),Ut()],$.prototype,"_testContext",2),$=e([Ot("test-show-index")],$);import{consume as Xt}from"@lit/context";import{LitElement as jt,html as Dt}from"lit";import{customElement as Ht,state as Jt}from"lit/decorators.js";var y=class extends jt{render(){return Dt`
76
+ <pre>
77
+ ${JSON.stringify(l(p({},this._testProvider),{items:this._testProvider.items.map(t=>l(p({},t),{itemEl:null}))}),null,2)}</pre
78
+ >
79
+ `}};e([Xt({context:i,subscribe:!0}),Jt()],y.prototype,"_testProvider",2),y=e([Ht("test-print-variables")],y);import{consume as Vt}from"@lit/context";import{LitElement as zt,html as Gt}from"lit";import{customElement as Kt,state as Wt}from"lit/decorators.js";var R=class extends zt{_requestItem(t){this.dispatchEvent(new CustomEvent("on-test-request-item",{composed:!0,bubbles:!0,detail:t}))}render(){let{items:t}=this._testContext,s=t.reduce((o,n)=>{let m=n.variables.find(u=>u.identifier==="SCORE");return o+(m?+m.value:0)},0),r=t.reduce((o,n)=>{let m=n.variables.find(u=>u.identifier==="MAXSCORE");return o+(m?+m.value:0)},0);return Gt` ${s}/${r}`}};e([Vt({context:i,subscribe:!0}),Wt()],R.prototype,"_testContext",2),R=e([Kt("test-print-score")],R);export{d as a,x as b,h as c,f as d,b as e,v as f,E as g,C as h,I as i,g as j,q as k,_ as l,$ as m,y as n,R as o};